Skip to contentSkip to conversation

Simplify PM for am3/4, drop RTC pdata for am3/4/dra7

PATCH In review Tony Lindgren 2 participants 6 messages Jul 3, 2020 – Aug 19, 2020

Subsystems (7)
lore
Share & tools
lore

Tony Lindgren

author maintainer
#0 lore raw

cover Simplify PM for am3/4, drop RTC pdata for am3/4/dra7

Hi all,

Here are patches to simplify the RTC+DDR PM code for am3 and am4. We want to do this to drop the RTC related legacy platform data for am3 and am4. We also drop RTC legacy platform data for dra7.

Please test the RTC+DDR suspend on am437x-gp-evm if possible. I've tested this series on am437x-sk-evm, but at least currently cannot do RTC+DDR suspend and is limited to testing retention suspend only.

These patches depend on v5.8-rc3 for earlier suspend and resume related fixes.

Additionally, for testing the LCD for suspend, the following patch is needed for the missing omapdrm PM ops:

drm/omap: force runtime PM suspend on system suspend

Regards,

Tony

Tony Lindgren (3):
soc: ti: pm33xx: Simplify RTC usage to prepare to drop platform data
ARM: OMAP2+: Drop legacy platform data for am3 and am4 rtc
ARM: OMAP2+: Drop legacy platform data for dra7 rtcss

 arch/arm/boot/dts/am33xx-l4.dtsi              |  1 -
 arch/arm/boot/dts/am437x-l4.dtsi              |  3 +-
 arch/arm/boot/dts/am43x-epos-evm.dts          |  4 ++
 arch/arm/boot/dts/dra7-l4.dtsi                |  1 -
 .../omap_hwmod_33xx_43xx_common_data.h        |  2 -
 .../omap_hwmod_33xx_43xx_interconnect_data.c  |  8 ----
 .../omap_hwmod_33xx_43xx_ipblock_data.c       | 37 ---------------
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c    |  1 -
 arch/arm/mach-omap2/omap_hwmod_43xx_data.c    |  8 ----
 arch/arm/mach-omap2/omap_hwmod_7xx_data.c     | 44 -----------------
 arch/arm/mach-omap2/pm33xx-core.c             | 25 ----------
 drivers/soc/ti/pm33xx.c                       | 47 +++++++++++++++++--
 include/linux/platform_data/pm33xx.h          |  3 --
 13 files changed, 47 insertions(+), 137 deletions(-)
Signature · 1 line
2.27.0
author maintainer
#1 lore raw

PATCH 1/3 soc: ti: pm33xx: Simplify RTC usage to prepare to drop platform data

We must re-enable the RTC module clock enabled in RTC+DDR suspend, and pm33xx has been using platform data callbacks for that. Looks like for retention suspend the RTC module clock must not be re-enabled.

To remove the legacy platform data callbacks, and eventually be able to drop the RTC legacy platform data, let's manage the RTC module clock and register range directly in pm33xx.

---
 arch/arm/mach-omap2/pm33xx-core.c    | 25 ---------------
 drivers/soc/ti/pm33xx.c              | 47 +++++++++++++++++++++++++---
 include/linux/platform_data/pm33xx.h |  3 --
 3 files changed, 42 insertions(+), 33 deletions(-)
arch/arm/mach-omap2/pm33xx-core.c +0 -25
@@ -25,7 +25,6 @@
 #include "control.h"
 #include "clockdomain.h"
 #include "iomap.h"
-#include "omap_hwmod.h"
 #include "pm.h"
 #include "powerdomain.h"
 #include "prm33xx.h"
@@ -36,7 +35,6 @@
 static struct powerdomain *cefuse_pwrdm, *gfx_pwrdm, *per_pwrdm, *mpu_pwrdm;
 static struct clockdomain *gfx_l4ls_clkdm;
 static void __iomem *scu_base;
-static struct omap_hwmod *rtc_oh;
 
 static int (*idle_fn)(u32 wfi_flags);
 
@@ -267,13 +265,6 @@ static struct am33xx_pm_sram_addr *amx3_get_sram_addrs(void)
 		return NULL;
 }
 
-static void __iomem *am43xx_get_rtc_base_addr(void)
-{
-	rtc_oh = omap_hwmod_lookup("rtc");
-
-	return omap_hwmod_get_mpu_rt_va(rtc_oh);
-}
-
 static void am43xx_save_context(void)
 {
 }
@@ -297,16 +288,6 @@ static void am43xx_restore_context(void)
 	writel_relaxed(0x0, AM33XX_L4_WK_IO_ADDRESS(0x44df2e14));
 }
 
-static void am43xx_prepare_rtc_suspend(void)
-{
-	omap_hwmod_enable(rtc_oh);
-}
-
-static void am43xx_prepare_rtc_resume(void)
-{
-	omap_hwmod_idle(rtc_oh);
-}
-
 static struct am33xx_pm_platform_data am33xx_ops = {
 	.init = am33xx_suspend_init,
 	.deinit = amx3_suspend_deinit,
@@ -317,10 +298,7 @@ static struct am33xx_pm_platform_data am33xx_ops = {
 	.get_sram_addrs = amx3_get_sram_addrs,
 	.save_context = am33xx_save_context,
 	.restore_context = am33xx_restore_context,
-	.prepare_rtc_suspend = am43xx_prepare_rtc_suspend,
-	.prepare_rtc_resume = am43xx_prepare_rtc_resume,
 	.check_off_mode_enable = am33xx_check_off_mode_enable,
-	.get_rtc_base_addr = am43xx_get_rtc_base_addr,
 };
 
 static struct am33xx_pm_platform_data am43xx_ops = {
@@ -333,10 +311,7 @@ static struct am33xx_pm_platform_data am43xx_ops = {
 	.get_sram_addrs = amx3_get_sram_addrs,
 	.save_context = am43xx_save_context,
 	.restore_context = am43xx_restore_context,
-	.prepare_rtc_suspend = am43xx_prepare_rtc_suspend,
-	.prepare_rtc_resume = am43xx_prepare_rtc_resume,
 	.check_off_mode_enable = am43xx_check_off_mode_enable,
-	.get_rtc_base_addr = am43xx_get_rtc_base_addr,
 };
 
 static struct am33xx_pm_platform_data *am33xx_pm_get_pdata(void)
drivers/soc/ti/pm33xx.c +42 -5

114 lines not on this page · raw message

include/linux/platform_data/pm33xx.h +0 -3
@@ -54,11 +54,8 @@ struct am33xx_pm_platform_data {
 	void    (*begin_suspend)(void);
 	void    (*finish_suspend)(void);
 	struct  am33xx_pm_sram_addr *(*get_sram_addrs)(void);
-	void __iomem *(*get_rtc_base_addr)(void);
 	void (*save_context)(void);
 	void (*restore_context)(void);
-	void (*prepare_rtc_suspend)(void);
-	void (*prepare_rtc_resume)(void);
 	int (*check_off_mode_enable)(void);
 };
 
Signature · 1 line
2.27.0
author maintainer
#2 lore raw

PATCH 2/3 ARM: OMAP2+: Drop legacy platform data for am3 and am4 rtc

In reply to Tony Lindgren

We can now probe devices with ti-sysc interconnect driver and dts data. Let's drop the related platform data and custom ti,hwmods dts property.

As we're just dropping data, and the early platform data init is based on the custom ti,hwmods property, we want to drop both the platform data and ti,hwmods property in a single patch.

Note that we also must tag rtc as disabled on am43x-epos-evm as it's not accessible according to commit 4321dc8dff35 ("ARM: AM43XX:
hwmod: Add rtc hwmod"). And we must keep RTC enabled for rtcwake to work now that we've removed the custom platfor code for re-enabling the RTC on suspend.

Keerthy <[email protected]>

---
 arch/arm/boot/dts/am33xx-l4.dtsi              |  1 -
 arch/arm/boot/dts/am437x-l4.dtsi              |  3 +-
 arch/arm/boot/dts/am43x-epos-evm.dts          |  4 ++
 .../omap_hwmod_33xx_43xx_common_data.h        |  2 -
 .../omap_hwmod_33xx_43xx_interconnect_data.c  |  8 ----
 .../omap_hwmod_33xx_43xx_ipblock_data.c       | 37 -------------------
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c    |  1 -
 arch/arm/mach-omap2/omap_hwmod_43xx_data.c    |  8 ----
 8 files changed, 5 insertions(+), 59 deletions(-)
arch/arm/boot/dts/am33xx-l4.dtsi +0 -1
@@ -413,7 +413,6 @@ target-module@39000 {			/* 0x44e39000, ap 33 02.0 */
 
 		target-module@3e000 {			/* 0x44e3e000, ap 35 60.0 */
 			compatible = "ti,sysc-omap4-simple", "ti,sysc";
-			ti,hwmods = "rtc";
 			reg = <0x3e074 0x4>,
 			      <0x3e078 0x4>;
 			reg-names = "rev", "sysc";
arch/arm/boot/dts/am437x-l4.dtsi +1 -2
@@ -409,9 +409,8 @@ target-module@39000 {			/* 0x44e39000, ap 32 02.0 */
 			ranges = <0x0 0x39000 0x1000>;
 		};
 
-		target-module@3e000 {			/* 0x44e3e000, ap 34 60.0 */
+		rtc_target: target-module@3e000 {	/* 0x44e3e000, ap 34 60.0 */
 			compatible = "ti,sysc-omap4-simple", "ti,sysc";
-			ti,hwmods = "rtc";
 			reg = <0x3e074 0x4>,
 			      <0x3e078 0x4>;
 			reg-names = "rev", "sysc";
arch/arm/boot/dts/am43x-epos-evm.dts +4 -0
@@ -833,6 +833,10 @@ &epwmss0 {
 	status = "okay";
 };
 
+&rtc_target {
+	status = "disabled";
+};
+
 &tscadc {
 	status = "okay";
 
arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h +0 -2
@@ -26,7 +26,6 @@ extern struct omap_hwmod_ocp_if am33xx_mpu__prcm;
 extern struct omap_hwmod_ocp_if am33xx_l3_s__l3_main;
 extern struct omap_hwmod_ocp_if am33xx_gfx__l3_main;
 extern struct omap_hwmod_ocp_if am33xx_l3_main__gfx;
-extern struct omap_hwmod_ocp_if am33xx_l4_wkup__rtc;
 extern struct omap_hwmod_ocp_if am33xx_l3_s__gpmc;
 extern struct omap_hwmod_ocp_if am33xx_l4_ls__timer2;
 extern struct omap_hwmod_ocp_if am33xx_l3_main__ocmc;
@@ -43,7 +42,6 @@ extern struct omap_hwmod am33xx_ocmcram_hwmod;
 extern struct omap_hwmod am33xx_smartreflex0_hwmod;
 extern struct omap_hwmod am33xx_smartreflex1_hwmod;
 extern struct omap_hwmod am33xx_gpmc_hwmod;
-extern struct omap_hwmod am33xx_rtc_hwmod;
 
 extern struct omap_hwmod_class am33xx_emif_hwmod_class;
 extern struct omap_hwmod_class am33xx_l4_hwmod_class;
arch/arm/mach-omap2/omap_hwmod_33xx_43xx_interconnect_data.c +0 -8
@@ -90,14 +90,6 @@ struct omap_hwmod_ocp_if am33xx_l3_main__gfx = {
 	.user		= OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* l4 wkup -> rtc */
-struct omap_hwmod_ocp_if am33xx_l4_wkup__rtc = {
-	.master		= &am33xx_l4_wkup_hwmod,
-	.slave		= &am33xx_rtc_hwmod,
-	.clk		= "clkdiv32k_ick",
-	.user		= OCP_USER_MPU,
-};
-
 /* l3s cfg -> gpmc */
 struct omap_hwmod_ocp_if am33xx_l3_s__gpmc = {
 	.master		= &am33xx_l3_s_hwmod,
arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c +0 -37
@@ -26,7 +26,6 @@
 #define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl))
 #define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl))
 #define RSTST(oh, rstst) ((oh).prcm.omap4.rstst_offs = (rstst))
-#define PRCM_FLAGS(oh, flag) ((oh).prcm.omap4.flags = (flag))
 
 /*
  * 'l3' class
@@ -274,47 +273,12 @@ struct omap_hwmod am33xx_gpmc_hwmod = {
 	},
 };
 
-
-/*
- * 'rtc' class
- * rtc subsystem
- */
-static struct omap_hwmod_class_sysconfig am33xx_rtc_sysc = {
-	.rev_offs	= 0x0074,
-	.sysc_offs	= 0x0078,
-	.sysc_flags	= SYSC_HAS_SIDLEMODE,
-	.idlemodes	= (SIDLE_FORCE | SIDLE_NO |
-			  SIDLE_SMART | SIDLE_SMART_WKUP),
-	.sysc_fields	= &omap_hwmod_sysc_type3,
-};
-
-static struct omap_hwmod_class am33xx_rtc_hwmod_class = {
-	.name		= "rtc",
-	.sysc		= &am33xx_rtc_sysc,
-	.unlock		= &omap_hwmod_rtc_unlock,
-	.lock		= &omap_hwmod_rtc_lock,
-};
-
-struct omap_hwmod am33xx_rtc_hwmod = {
-	.name		= "rtc",
-	.class		= &am33xx_rtc_hwmod_class,
-	.clkdm_name	= "l4_rtc_clkdm",
-	.main_clk	= "clk_32768_ck",
-	.prcm		= {
-		.omap4	= {
-			.modulemode	= MODULEMODE_SWCTRL,
-		},
-	},
-};
-
 static void omap_hwmod_am33xx_clkctrl(void)
 {
 	CLKCTRL(am33xx_smartreflex0_hwmod,
 		AM33XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET);
 	CLKCTRL(am33xx_smartreflex1_hwmod,
 		AM33XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET);
-	CLKCTRL(am33xx_rtc_hwmod, AM33XX_CM_RTC_RTC_CLKCTRL_OFFSET);
-	PRCM_FLAGS(am33xx_rtc_hwmod, HWMOD_OMAP4_ZERO_CLKCTRL_OFFSET);
 	CLKCTRL(am33xx_gpmc_hwmod, AM33XX_CM_PER_GPMC_CLKCTRL_OFFSET);
 	CLKCTRL(am33xx_l4_ls_hwmod, AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET);
 	CLKCTRL(am33xx_l4_wkup_hwmod, AM33XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET);
@@ -343,7 +307,6 @@ static void omap_hwmod_am43xx_clkctrl(void)
 		AM43XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET);
 	CLKCTRL(am33xx_smartreflex1_hwmod,
 		AM43XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET);
-	CLKCTRL(am33xx_rtc_hwmod, AM43XX_CM_RTC_RTC_CLKCTRL_OFFSET);
 	CLKCTRL(am33xx_gpmc_hwmod, AM43XX_CM_PER_GPMC_CLKCTRL_OFFSET);
 	CLKCTRL(am33xx_l4_ls_hwmod, AM43XX_CM_PER_L4LS_CLKCTRL_OFFSET);
 	CLKCTRL(am33xx_l4_wkup_hwmod, AM43XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET);
arch/arm/mach-omap2/omap_hwmod_33xx_data.c +0 -1
@@ -283,7 +283,6 @@ static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = {
 	&am33xx_l4_wkup__control,
 	&am33xx_l4_wkup__smartreflex0,
 	&am33xx_l4_wkup__smartreflex1,
-	&am33xx_l4_wkup__rtc,
 	&am33xx_l3_s__gpmc,
 	&am33xx_l3_main__ocmc,
 	NULL,
arch/arm/mach-omap2/omap_hwmod_43xx_data.c +0 -8
@@ -216,11 +216,6 @@ static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
 	NULL,
 };
 
-static struct omap_hwmod_ocp_if *am43xx_rtc_hwmod_ocp_ifs[] __initdata = {
-	&am33xx_l4_wkup__rtc,
-	NULL,
-};
-
 int __init am43xx_hwmod_init(void)
 {
 	int ret;
@@ -229,8 +224,5 @@ int __init am43xx_hwmod_init(void)
 	omap_hwmod_init();
 	ret = omap_hwmod_register_links(am43xx_hwmod_ocp_ifs);
 
-	if (!ret && of_machine_is_compatible("ti,am4372"))
-		ret = omap_hwmod_register_links(am43xx_rtc_hwmod_ocp_ifs);
-
 	return ret;
 }
Signature · 1 line
2.27.0
author maintainer
#3 lore raw

PATCH 3/3 ARM: OMAP2+: Drop legacy platform data for dra7 rtcss

In reply to Tony Lindgren

We can now probe devices with ti-sysc interconnect driver and dts data. Let's drop the related platform data and custom ti,hwmods dts property.

As we're just dropping data, and the early platform data init is based on the custom ti,hwmods property, we want to drop both the platform data and ti,hwmods property in a single patch.

---
 arch/arm/boot/dts/dra7-l4.dtsi            |  1 -
 arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 44 -----------------------
 2 files changed, 45 deletions(-)
arch/arm/boot/dts/dra7-l4.dtsi +0 -1
@@ -3561,7 +3561,6 @@ timer16: timer@0 {
 
 		rtctarget: target-module@38000 {			/* 0x48838000, ap 29 12.0 */
 			compatible = "ti,sysc-omap4-simple", "ti,sysc";
-			ti,hwmods = "rtcss";
 			reg = <0x38074 0x4>,
 			      <0x38078 0x4>;
 			reg-names = "rev", "sysc";
arch/arm/mach-omap2/omap_hwmod_7xx_data.c +0 -44

62 lines not on this page · raw message

Signature · 1 line
2.27.0
author maintainer
#4 lore raw
In reply to Tony Lindgren

Hi Santosh,

Quoted 10 lines · Tony Lindgren

Hi all,

Here are patches to simplify the RTC+DDR PM code for am3 and am4. We want to do this to drop the RTC related legacy platform data for am3 and am4. We also drop RTC legacy platform data for dra7.

Please test the RTC+DDR suspend on am437x-gp-evm if possible. I've tested this series on am437x-sk-evm, but at least currently cannot do RTC+DDR suspend and is limited to testing retention suspend only.

Quoted 7 lines

These patches depend on v5.8-rc3 for earlier suspend and resume related fixes.

Additionally, for testing the LCD for suspend, the following patch is needed for the missing omapdrm PM ops:

drm/omap: force runtime PM suspend on system suspend

Here's another series that was getting too late for v5.9 that I'd like to queue for v5.10. Care to take a look and ack if it looks OK?

Regards,

Tony

Quoted 23 lines

Tony Lindgren (3):
soc: ti: pm33xx: Simplify RTC usage to prepare to drop platform data
ARM: OMAP2+: Drop legacy platform data for am3 and am4 rtc
ARM: OMAP2+: Drop legacy platform data for dra7 rtcss

 arch/arm/boot/dts/am33xx-l4.dtsi              |  1 -
 arch/arm/boot/dts/am437x-l4.dtsi              |  3 +-
 arch/arm/boot/dts/am43x-epos-evm.dts          |  4 ++
 arch/arm/boot/dts/dra7-l4.dtsi                |  1 -
 .../omap_hwmod_33xx_43xx_common_data.h        |  2 -
 .../omap_hwmod_33xx_43xx_interconnect_data.c  |  8 ----
 .../omap_hwmod_33xx_43xx_ipblock_data.c       | 37 ---------------
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c    |  1 -
 arch/arm/mach-omap2/omap_hwmod_43xx_data.c    |  8 ----
 arch/arm/mach-omap2/omap_hwmod_7xx_data.c     | 44 -----------------
 arch/arm/mach-omap2/pm33xx-core.c             | 25 ----------
 drivers/soc/ti/pm33xx.c                       | 47 +++++++++++++++++--
 include/linux/platform_data/pm33xx.h          |  3 --
 13 files changed, 47 insertions(+), 137 deletions(-)
Signature · 1 line
2.27.0
Acked-by Santosh Shilimkar
#5 lore raw
Quoted 16 lines · Tony Lindgren

Hi Santosh,

Quoted 13 lines · Tony Lindgren

Hi all,

Here are patches to simplify the RTC+DDR PM code for am3 and am4. We want to do this to drop the RTC related legacy platform data for am3 and am4. We also drop RTC legacy platform data for dra7.

Please test the RTC+DDR suspend on am437x-gp-evm if possible. I've tested this series on am437x-sk-evm, but at least currently cannot do RTC+DDR suspend and is limited to testing retention suspend only.

These patches depend on v5.8-rc3 for earlier suspend and resume related fixes.

Quoted 8 lines
Quoted 4 lines

Additionally, for testing the LCD for suspend, the following patch is needed for the missing omapdrm PM ops:

drm/omap: force runtime PM suspend on system suspend

Here's another series that was getting too late for v5.9 that I'd like to queue for v5.10. Care to take a look and ack if it looks OK?

Just finished going through the patches. If the suspend continue to work with this update then its good to go.

FWIW,