Linux-OMAP Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/4] ti-sysc changes for dropping omap4/5 legacy data
@ 2021-03-08 12:21 Tony Lindgren
  2021-03-08 12:21 ` [PATCH 1/4] ARM: OMAP2+: Init both prm and prcm nodes early for clocks Tony Lindgren
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Tony Lindgren @ 2021-03-08 12:21 UTC (permalink / raw)
  To: linux-omap
  Cc: Dave Gerlach, Faiz Abbas, Greg Kroah-Hartman, Grygorii Strashko,
	Keerthy, Nishanth Menon, Suman Anna, linux-kernel,
	linux-arm-kernel, Santosh Shilimkar, Stephen Boyd, Tero Kristo

Hi all,

Here are few ti-sysc related changes that are needed to drop legacy data
for omap4/5. The last patch also starts warning users about old incomplete
dtb, we do that initially only for am3/4 that no longer have the legacy
data.

Regards,

Tony


Tony Lindgren (4):
  ARM: OMAP2+: Init both prm and prcm nodes early for clocks
  soc: ti: omap-prm: Allow hardware supported retention when idle
  clk: ti: omap5: Add missing gpmc and ocmc clkctrl
  bus: ti-sysc: Check for old incomplete dtb

 arch/arm/mach-omap2/pdata-quirks.c | 29 +++++++++++++++++++++--------
 drivers/bus/ti-sysc.c              | 16 ++++++++++++++++
 drivers/clk/ti/clk-54xx.c          |  2 ++
 drivers/soc/ti/omap_prm.c          | 16 ++++++++++++----
 include/dt-bindings/clock/omap5.h  |  2 ++
 5 files changed, 53 insertions(+), 12 deletions(-)

-- 
2.30.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] ARM: OMAP2+: Init both prm and prcm nodes early for clocks
  2021-03-08 12:21 [PATCH 0/4] ti-sysc changes for dropping omap4/5 legacy data Tony Lindgren
@ 2021-03-08 12:21 ` Tony Lindgren
  2021-03-08 12:21 ` [PATCH 2/4] soc: ti: omap-prm: Allow hardware supported retention when idle Tony Lindgren
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Tony Lindgren @ 2021-03-08 12:21 UTC (permalink / raw)
  To: linux-omap
  Cc: Dave Gerlach, Faiz Abbas, Greg Kroah-Hartman, Grygorii Strashko,
	Keerthy, Nishanth Menon, Suman Anna, linux-kernel,
	linux-arm-kernel, Santosh Shilimkar, Stephen Boyd, Tero Kristo

We need to probe both prm and prcm nodes early for clocks
as they are needed by system timers.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/pdata-quirks.c | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -569,10 +569,29 @@ static void pdata_quirks_check(struct pdata_init *quirks)
 	}
 }
 
-void __init pdata_quirks_init(const struct of_device_id *omap_dt_match_table)
+static const char * const pdata_quirks_init_nodes[] = {
+	"prcm",
+	"prm",
+};
+
+void __init
+pdata_quirks_init_clocks(const struct of_device_id *omap_dt_match_table)
 {
 	struct device_node *np;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(pdata_quirks_init_nodes); i++) {
+		np = of_find_node_by_name(NULL, pdata_quirks_init_nodes[i]);
+		if (!np)
+			continue;
 
+		of_platform_populate(np, omap_dt_match_table,
+				     omap_auxdata_lookup, NULL);
+	}
+}
+
+void __init pdata_quirks_init(const struct of_device_id *omap_dt_match_table)
+{
 	/*
 	 * We still need this for omap2420 and omap3 PM to work, others are
 	 * using drivers/misc/sram.c already.
@@ -585,13 +604,7 @@ void __init pdata_quirks_init(const struct of_device_id *omap_dt_match_table)
 		omap3_mcbsp_init();
 	pdata_quirks_check(auxdata_quirks);
 
-	/* Populate always-on PRCM in l4_wkup to probe l4_wkup */
-	np = of_find_node_by_name(NULL, "prcm");
-	if (!np)
-		np = of_find_node_by_name(NULL, "prm");
-	if (np)
-		of_platform_populate(np, omap_dt_match_table,
-				     omap_auxdata_lookup, NULL);
+	pdata_quirks_init_clocks(omap_dt_match_table);
 
 	of_platform_populate(NULL, omap_dt_match_table,
 			     omap_auxdata_lookup, NULL);
-- 
2.30.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/4] soc: ti: omap-prm: Allow hardware supported retention when idle
  2021-03-08 12:21 [PATCH 0/4] ti-sysc changes for dropping omap4/5 legacy data Tony Lindgren
  2021-03-08 12:21 ` [PATCH 1/4] ARM: OMAP2+: Init both prm and prcm nodes early for clocks Tony Lindgren
@ 2021-03-08 12:21 ` Tony Lindgren
  2021-03-08 12:21 ` [PATCH 3/4] clk: ti: omap5: Add missing gpmc and ocmc clkctrl Tony Lindgren
  2021-03-08 12:21 ` [PATCH 4/4] bus: ti-sysc: Check for old incomplete dtb Tony Lindgren
  3 siblings, 0 replies; 5+ messages in thread
From: Tony Lindgren @ 2021-03-08 12:21 UTC (permalink / raw)
  To: linux-omap
  Cc: Dave Gerlach, Faiz Abbas, Greg Kroah-Hartman, Grygorii Strashko,
	Keerthy, Nishanth Menon, Suman Anna, linux-kernel,
	linux-arm-kernel, Santosh Shilimkar, Tero Kristo, Stephen Boyd

When moving the l4 interconnect instances to probe with simple-pm-bus and
genpd, we will have l4per and core domains stop idling unless we configure
the domain bits to allow retention when idle.

As the TI SoCs have hardware autoidle capabilities, this is safe to do.
The domains will only enter retention on WFI when none of the devices on
the domain block autoidle in the hardware. This follows what we are
already currently doing.

Cc: Santosh Shilimkar <ssantosh@kernel.org>
Cc: Tero Kristo <kristo@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/soc/ti/omap_prm.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/soc/ti/omap_prm.c b/drivers/soc/ti/omap_prm.c
--- a/drivers/soc/ti/omap_prm.c
+++ b/drivers/soc/ti/omap_prm.c
@@ -88,6 +88,7 @@ struct omap_reset_data {
 #define OMAP_PRM_HAS_RSTCTRL	BIT(0)
 #define OMAP_PRM_HAS_RSTST	BIT(1)
 #define OMAP_PRM_HAS_NO_CLKDM	BIT(2)
+#define OMAP_PRM_RET_WHEN_IDLE	BIT(3)
 
 #define OMAP_PRM_HAS_RESETS	(OMAP_PRM_HAS_RSTCTRL | OMAP_PRM_HAS_RSTST)
 
@@ -174,7 +175,8 @@ static const struct omap_prm_data omap4_prm_data[] = {
 		.name = "core", .base = 0x4a306700,
 		.pwrstctrl = 0x0, .pwrstst = 0x4, .dmap = &omap_prm_reton,
 		.rstctrl = 0x210, .rstst = 0x214, .clkdm_name = "ducati",
-		.rstmap = rst_map_012
+		.rstmap = rst_map_012,
+		.flags = OMAP_PRM_RET_WHEN_IDLE,
 	},
 	{
 		.name = "ivahd", .base = 0x4a306f00,
@@ -199,7 +201,8 @@ static const struct omap_prm_data omap4_prm_data[] = {
 	},
 	{
 		.name = "l4per", .base = 0x4a307400,
-		.pwrstctrl = 0x0, .pwrstst = 0x4, .dmap = &omap_prm_reton
+		.pwrstctrl = 0x0, .pwrstst = 0x4, .dmap = &omap_prm_reton,
+		.flags = OMAP_PRM_RET_WHEN_IDLE,
 	},
 	{
 		.name = "cefuse", .base = 0x4a307600,
@@ -517,7 +520,7 @@ static int omap_prm_domain_power_on(struct generic_pm_domain *domain)
 {
 	struct omap_prm_domain *prmd;
 	int ret;
-	u32 v;
+	u32 v, mode;
 
 	prmd = genpd_to_prm_domain(domain);
 	if (!prmd->cap)
@@ -530,7 +533,12 @@ static int omap_prm_domain_power_on(struct generic_pm_domain *domain)
 	else
 		v = readl_relaxed(prmd->prm->base + prmd->pwrstctrl);
 
-	writel_relaxed(v | OMAP_PRMD_ON_ACTIVE,
+	if (prmd->prm->data->flags & OMAP_PRM_RET_WHEN_IDLE)
+		mode = OMAP_PRMD_RETENTION;
+	else
+		mode = OMAP_PRMD_ON_ACTIVE;
+
+	writel_relaxed((v & ~PRM_POWERSTATE_MASK) | mode,
 		       prmd->prm->base + prmd->pwrstctrl);
 
 	/* wait for the transition bit to get cleared */
-- 
2.30.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/4] clk: ti: omap5: Add missing gpmc and ocmc clkctrl
  2021-03-08 12:21 [PATCH 0/4] ti-sysc changes for dropping omap4/5 legacy data Tony Lindgren
  2021-03-08 12:21 ` [PATCH 1/4] ARM: OMAP2+: Init both prm and prcm nodes early for clocks Tony Lindgren
  2021-03-08 12:21 ` [PATCH 2/4] soc: ti: omap-prm: Allow hardware supported retention when idle Tony Lindgren
@ 2021-03-08 12:21 ` Tony Lindgren
  2021-03-08 12:21 ` [PATCH 4/4] bus: ti-sysc: Check for old incomplete dtb Tony Lindgren
  3 siblings, 0 replies; 5+ messages in thread
From: Tony Lindgren @ 2021-03-08 12:21 UTC (permalink / raw)
  To: linux-omap
  Cc: Dave Gerlach, Faiz Abbas, Greg Kroah-Hartman, Grygorii Strashko,
	Keerthy, Nishanth Menon, Suman Anna, linux-kernel,
	linux-arm-kernel, Stephen Boyd, Tero Kristo, Santosh Shilimkar

The gpmc clock is needed to update omap5 to boot with genpd with the
related devicetree patches. The ocmc clock is currently not used but
let's add it so we have all the clocks for the l3main2 defined.

Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Tero Kristo <kristo@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/clk/ti/clk-54xx.c         | 2 ++
 include/dt-bindings/clock/omap5.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/clk/ti/clk-54xx.c b/drivers/clk/ti/clk-54xx.c
--- a/drivers/clk/ti/clk-54xx.c
+++ b/drivers/clk/ti/clk-54xx.c
@@ -156,6 +156,8 @@ static const struct omap_clkctrl_reg_data omap5_l3main1_clkctrl_regs[] __initcon
 
 static const struct omap_clkctrl_reg_data omap5_l3main2_clkctrl_regs[] __initconst = {
 	{ OMAP5_L3_MAIN_2_CLKCTRL, NULL, 0, "l3_iclk_div" },
+	{ OMAP5_L3_MAIN_2_GPMC_CLKCTRL, NULL, CLKF_HW_SUP, "l3_iclk_div" },
+	{ OMAP5_L3_MAIN_2_OCMC_RAM_CLKCTRL, NULL, CLKF_HW_SUP, "l3_iclk_div" },
 	{ 0 },
 };
 
diff --git a/include/dt-bindings/clock/omap5.h b/include/dt-bindings/clock/omap5.h
--- a/include/dt-bindings/clock/omap5.h
+++ b/include/dt-bindings/clock/omap5.h
@@ -32,6 +32,8 @@
 
 /* l3main2 clocks */
 #define OMAP5_L3_MAIN_2_CLKCTRL	OMAP5_CLKCTRL_INDEX(0x20)
+#define OMAP5_L3_MAIN_2_GPMC_CLKCTRL	OMAP5_CLKCTRL_INDEX(0x28)
+#define OMAP5_L3_MAIN_2_OCMC_RAM_CLKCTRL	OMAP5_CLKCTRL_INDEX(0x30)
 
 /* ipu clocks */
 #define OMAP5_MMU_IPU_CLKCTRL	OMAP5_CLKCTRL_INDEX(0x20)
-- 
2.30.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 4/4] bus: ti-sysc: Check for old incomplete dtb
  2021-03-08 12:21 [PATCH 0/4] ti-sysc changes for dropping omap4/5 legacy data Tony Lindgren
                   ` (2 preceding siblings ...)
  2021-03-08 12:21 ` [PATCH 3/4] clk: ti: omap5: Add missing gpmc and ocmc clkctrl Tony Lindgren
@ 2021-03-08 12:21 ` Tony Lindgren
  3 siblings, 0 replies; 5+ messages in thread
From: Tony Lindgren @ 2021-03-08 12:21 UTC (permalink / raw)
  To: linux-omap
  Cc: Dave Gerlach, Faiz Abbas, Greg Kroah-Hartman, Grygorii Strashko,
	Keerthy, Nishanth Menon, Suman Anna, linux-kernel,
	linux-arm-kernel, Santosh Shilimkar, Stephen Boyd, Tero Kristo

Let's be nice and show an error on the SoCs about old imcomplete devicetree
if the dtb is still using "simple-bus" instead of "simple-pm-bus" for the
root OCP node.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/bus/ti-sysc.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
--- a/drivers/bus/ti-sysc.c
+++ b/drivers/bus/ti-sysc.c
@@ -2858,6 +2858,7 @@ static int sysc_init_soc(struct sysc *ddata)
 	const struct soc_device_attribute *match;
 	struct ti_sysc_platform_data *pdata;
 	unsigned long features = 0;
+	struct device_node *np;
 
 	if (sysc_soc)
 		return 0;
@@ -2878,6 +2879,21 @@ static int sysc_init_soc(struct sysc *ddata)
 	if (match && match->data)
 		sysc_soc->soc = (int)match->data;
 
+	/*
+	 * Check and warn about possible old incomplete dtb. We now want to see
+	 * simple-pm-bus instead of simple-bus in the dtb for genpd using SoCs.
+	 */
+	switch (sysc_soc->soc) {
+	case SOC_AM3:
+	case SOC_AM4:
+		np = of_find_node_by_path("/ocp");
+		WARN_ONCE(np && of_device_is_compatible(np, "simple-bus"),
+			  "ti-sysc: Incomplete old dtb, please update\n");
+		break;
+	default:
+		break;
+	}
+
 	/* Ignore devices that are not available on HS and EMU SoCs */
 	if (!sysc_soc->general_purpose) {
 		switch (sysc_soc->soc) {
-- 
2.30.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08 12:21 [PATCH 0/4] ti-sysc changes for dropping omap4/5 legacy data Tony Lindgren
2021-03-08 12:21 ` [PATCH 1/4] ARM: OMAP2+: Init both prm and prcm nodes early for clocks Tony Lindgren
2021-03-08 12:21 ` [PATCH 2/4] soc: ti: omap-prm: Allow hardware supported retention when idle Tony Lindgren
2021-03-08 12:21 ` [PATCH 3/4] clk: ti: omap5: Add missing gpmc and ocmc clkctrl Tony Lindgren
2021-03-08 12:21 ` [PATCH 4/4] bus: ti-sysc: Check for old incomplete dtb Tony Lindgren

Linux-OMAP Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-omap/0 linux-omap/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-omap linux-omap/ https://lore.kernel.org/linux-omap \
		linux-omap@vger.kernel.org
	public-inbox-index linux-omap

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-omap


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git