diff mbox series

[13/18] ARM: dts: Use simple-pm-bus for genpd for am3 l4_wkup

Message ID 20201026112222.56894-14-tony@atomide.com (mailing list archive)
State New, archived
Headers show
Series Drop remaining pdata for am335x and use genpd | expand

Commit Message

Tony Lindgren Oct. 26, 2020, 11:22 a.m. UTC
We can now enable simple-pm-bus to use genpd.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/boot/dts/am33xx-l4.dtsi | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Tony Lindgren Jan. 13, 2021, 4:23 p.m. UTC | #1
Hi,

* Geert Uytterhoeven <geert@linux-m68k.org> [210113 16:09]:
> Hi Tony,
> 
> On Mon, Oct 26, 2020 at 1:57 PM Tony Lindgren <tony@atomide.com> wrote:
> > We can now enable simple-pm-bus to use genpd.
> >
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> Thanks for your patch, which is now commit 5a230524f87926f2 ("ARM:
> dts: Use simple-pm-bus for genpd for am3 l4_wkup") in v5.11-rc1.
> 
> I have bisected a boot failure on BeagleBone Black to this commit.
> Reverting this commit on top of a v5.11-rc3-based tree does not help.
> 
> With "earlycon keep_bootcon", I do get some output, the last line is
> 
>     l4-wkup-clkctrl:00d4:0: failed to disable
> 
> I have attached the kernel output of the previous (good) commit,
> and the failing one.
> 
> Do you have a clue?

Strange, bbb has been working for me with NFSroot, that's with
omap2plus_defconfig. Care to send your .config so I can give it a
try tomorrow?

Regards,

Tony
Geert Uytterhoeven Jan. 13, 2021, 4:41 p.m. UTC | #2
Hi Tony,

On Wed, Jan 13, 2021 at 5:23 PM Tony Lindgren <tony@atomide.com> wrote:
> * Geert Uytterhoeven <geert@linux-m68k.org> [210113 16:09]:
> > On Mon, Oct 26, 2020 at 1:57 PM Tony Lindgren <tony@atomide.com> wrote:
> > > We can now enable simple-pm-bus to use genpd.
> > >
> > > Signed-off-by: Tony Lindgren <tony@atomide.com>
> >
> > Thanks for your patch, which is now commit 5a230524f87926f2 ("ARM:
> > dts: Use simple-pm-bus for genpd for am3 l4_wkup") in v5.11-rc1.
> >
> > I have bisected a boot failure on BeagleBone Black to this commit.
> > Reverting this commit on top of a v5.11-rc3-based tree does not help.
> >
> > With "earlycon keep_bootcon", I do get some output, the last line is
> >
> >     l4-wkup-clkctrl:00d4:0: failed to disable
> >
> > I have attached the kernel output of the previous (good) commit,
> > and the failing one.
> >
> > Do you have a clue?
>
> Strange, bbb has been working for me with NFSroot, that's with
> omap2plus_defconfig. Care to send your .config so I can give it a
> try tomorrow?

Sent by private email.

Just tried omap2plus_defconfig, and it also hangs during boot.

Gr{oetje,eeting}s,

                        Geert
Tony Lindgren Jan. 13, 2021, 4:47 p.m. UTC | #3
* Geert Uytterhoeven <geert@linux-m68k.org> [210113 16:42]:
> On Wed, Jan 13, 2021 at 5:23 PM Tony Lindgren <tony@atomide.com> wrote:
> > Strange, bbb has been working for me with NFSroot, that's with
> > omap2plus_defconfig. Care to send your .config so I can give it a
> > try tomorrow?
> 
> Sent by private email.

OK thanks.

> Just tried omap2plus_defconfig, and it also hangs during boot.

Hmm OK. Will give it a try tomorrow.

Reegards,

Tony
Tony Lindgren Jan. 13, 2021, 5:28 p.m. UTC | #4
* Tony Lindgren <tony@atomide.com> [210113 16:48]:
> * Geert Uytterhoeven <geert@linux-m68k.org> [210113 16:42]:
> > On Wed, Jan 13, 2021 at 5:23 PM Tony Lindgren <tony@atomide.com> wrote:
> > > Strange, bbb has been working for me with NFSroot, that's with
> > > omap2plus_defconfig. Care to send your .config so I can give it a
> > > try tomorrow?
> > 
> > Sent by private email.
> 
> OK thanks.
> 
> > Just tried omap2plus_defconfig, and it also hangs during boot.

Hmm and I just tried and bbb still boots NFSroot for me at commit
5a230524f879 ("ARM: dts: Use simple-pm-bus for genpd for am3 l4_wkup").

> Hmm OK. Will give it a try tomorrow.

Later,

Tony
Tony Lindgren Jan. 14, 2021, 7:20 a.m. UTC | #5
* Tony Lindgren <tony@atomide.com> [210113 17:30]:
> * Tony Lindgren <tony@atomide.com> [210113 16:48]:
> > * Geert Uytterhoeven <geert@linux-m68k.org> [210113 16:42]:
> > > On Wed, Jan 13, 2021 at 5:23 PM Tony Lindgren <tony@atomide.com> wrote:
> > > > Strange, bbb has been working for me with NFSroot, that's with
> > > > omap2plus_defconfig. Care to send your .config so I can give it a
> > > > try tomorrow?
> > > 
> > > Sent by private email.
> > 
> > OK thanks.
> > 
> > > Just tried omap2plus_defconfig, and it also hangs during boot.
> 
> Hmm and I just tried and bbb still boots NFSroot for me at commit
> 5a230524f879 ("ARM: dts: Use simple-pm-bus for genpd for am3 l4_wkup").
> 
> > Hmm OK. Will give it a try tomorrow.

Not sure why your bbb would produce all the deferred probe while mine
won't.

However, I've noticed that we need the following patch on omap4/5 and
dra7 when playing with updating them to use genpd.

Maybe this also fixes your boot issue if you can give it a try?

Regards,

Tony

8< -------------------
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
@@ -642,6 +642,51 @@ static int sysc_parse_and_check_child_range(struct sysc *ddata)
 	return 0;
 }
 
+/* Interconnect instances to probe before l4_per instances */
+static struct resource early_bus_ranges[] = {
+	/* am3/4 l4_wkup */
+	{ .start = 0x44c00000, .end = 0x44c00000 + 0x300000, },
+	/* omap4/5 and dra7 l4_cfg */
+	{ .start = 0x4a000000, .end = 0x4a000000 + 0x300000, },
+	/* omap4 l4_wkup */
+	{ .start = 0x4a300000, .end = 0x4a300000 + 0x30000,  },
+	/* omap5 and dra7 l4_wkup without dra7 dcan segment */
+	{ .start = 0x4ae00000, .end = 0x4ae00000 + 0x30000,  },
+};
+
+static atomic_t sysc_defer = ATOMIC_INIT(10);
+
+/**
+ * sysc_defer_non_critical - defer non_critical interconnect probing
+ * @ddata: device driver data
+ *
+ * We want to probe l4_cfg and l4_wkup interconnect instances before any
+ * l4_per instances as l4_per instances depend on resources on l4_cfg and
+ * l4_wkup interconnects.
+ */
+static int sysc_defer_non_critical(struct sysc *ddata)
+{
+	struct resource *res;
+	int i;
+
+	if (!atomic_read(&sysc_defer))
+		return 0;
+
+	for (i = 0; i < ARRAY_SIZE(early_bus_ranges); i++) {
+		res = &early_bus_ranges[i];
+		if (ddata->module_pa >= res->start &&
+		    ddata->module_pa <= res->end) {
+			atomic_set(&sysc_defer, 0);
+
+			return 0;
+		}
+	}
+
+	atomic_dec_if_positive(&sysc_defer);
+
+	return -EPROBE_DEFER;
+}
+
 static struct device_node *stdout_path;
 
 static void sysc_init_stdout_path(struct sysc *ddata)
@@ -870,6 +915,10 @@ static int sysc_map_and_check_registers(struct sysc *ddata)
 	if (error)
 		return error;
 
+	error = sysc_defer_non_critical(ddata);
+	if (error)
+		return error;
+
 	sysc_check_children(ddata);
 
 	error = sysc_parse_registers(ddata);
Vaittinen, Matti Jan. 14, 2021, 7:58 a.m. UTC | #6
Morning Tony & All,

On Thu, 2021-01-14 at 09:20 +0200, Tony Lindgren wrote:
> * Tony Lindgren <tony@atomide.com> [210113 17:30]:
> > * Tony Lindgren <tony@atomide.com> [210113 16:48]:
> > > * Geert Uytterhoeven <geert@linux-m68k.org> [210113 16:42]:
> > > > On Wed, Jan 13, 2021 at 5:23 PM Tony Lindgren <tony@atomide.com
> > > > > wrote:
> > > > > Strange, bbb has been working for me with NFSroot, that's
> > > > > with
> > > > > omap2plus_defconfig. Care to send your .config so I can give
> > > > > it a
> > > > > try tomorrow?
> > > > 
> > > > Sent by private email.
> > > 
> > > OK thanks.
> > > 
> > > > Just tried omap2plus_defconfig, and it also hangs during boot.
> > 
> > Hmm and I just tried and bbb still boots NFSroot for me at commit
> > 5a230524f879 ("ARM: dts: Use simple-pm-bus for genpd for am3
> > l4_wkup").
> > 
> > > Hmm OK. Will give it a try tomorrow.
> 
> Not sure why your bbb would produce all the deferred probe while mine
> won't.
> 
> However, I've noticed that we need the following patch on omap4/5 and
> dra7 when playing with updating them to use genpd.
> 
> Maybe this also fixes your boot issue if you can give it a try?
> 

I do also experience the boot problem described by Geert.

Head being:
b0625afe305253d0831af9289b37c906c18a781b
ARM: OMAP2+: Drop legacy platform data for am3 mpuss

=> BBB boots Ok.

Head being:
5a230524f87926f24d637fe62fd689f7f86f5036
ARM: dts: Use simple-pm-bus for genpd for am3 l4_wkup

=> BBB boot fails. (I don't have any debug parameters => last thing I
see in UART is from uBoot:

Bytes transferred = 89849 (15ef9 hex)
Kernel image @ 0x81000000 [ 0x000000 - 0x928200 ]
## Flattened Device Tree blob at 82000000
   Booting using the fdt blob at 0x82000000
   Using Device Tree in place at 82000000, end 82018ef8

Starting kernel ...

Head being 

5a230524f87926f24d637fe62fd689f7f86f5036 + this patch 
ARM: dts: Use simple-pm-bus for genpd for am3 l4_wkup (+ patch)
Boot still fails for me.

Please note - my environment takes the intermediate build result file:
arch/arm/boot/dts/.am335x-boneblack.dtb.dts.tmp

and compiles this with '-@' to allow further overlays.

Best Regards
	Matti Vaittinen
Tony Lindgren Jan. 14, 2021, 8:08 a.m. UTC | #7
* Vaittinen, Matti <Matti.Vaittinen@fi.rohmeurope.com> [210114 07:58]:
> I do also experience the boot problem described by Geert.
> 
> Head being:
> b0625afe305253d0831af9289b37c906c18a781b
> ARM: OMAP2+: Drop legacy platform data for am3 mpuss
> 
> => BBB boots Ok.
> 
> Head being:
> 5a230524f87926f24d637fe62fd689f7f86f5036
> ARM: dts: Use simple-pm-bus for genpd for am3 l4_wkup
> 
> => BBB boot fails. (I don't have any debug parameters => last thing I
> see in UART is from uBoot:

Looking at the .config Geert sent me, at least CONFIG_SIMPLE_PM_BUS=y
is now needed, and probably should be selected or default y for omaps.

Adding that removes the -512 errors at least that I started seeing with
Geert's config too.

Can you guys check if adding CONFIG_SIMPLE_PM_BUS=y fixes the problem?

Regards,

Tony
Vaittinen, Matti Jan. 14, 2021, 8:32 a.m. UTC | #8
Thanks Tony,

On Thu, 2021-01-14 at 10:08 +0200, Tony Lindgren wrote:
> * Vaittinen, Matti <Matti.Vaittinen@fi.rohmeurope.com> [210114
> 07:58]:
> > I do also experience the boot problem described by Geert.
> > 
> > Head being:
> > b0625afe305253d0831af9289b37c906c18a781b
> > ARM: OMAP2+: Drop legacy platform data for am3 mpuss
> > 
> > => BBB boots Ok.
> > 
> > Head being:
> > 5a230524f87926f24d637fe62fd689f7f86f5036
> > ARM: dts: Use simple-pm-bus for genpd for am3 l4_wkup
> > 
> > => BBB boot fails. (I don't have any debug parameters => last thing
> > I
> > see in UART is from uBoot:
> 
> Looking at the .config Geert sent me, at least CONFIG_SIMPLE_PM_BUS=y
> is now needed, and probably should be selected or default y for
> omaps.
> 
> Adding that removes the -512 errors at least that I started seeing
> with
> Geert's config too.
> 
> Can you guys check if adding CONFIG_SIMPLE_PM_BUS=y fixes the
> problem?

After enabling CONFIG_SIMPLE_PM_BUS
5a230524f87926f24d637fe62fd689f7f86f5036
ARM: dts: Use simple-pm-bus for genpd for am3 l4_wkup


boots Ok :) Sounds like it should be enabled on BBB by default.

Best Regards
	Matti Vaittinen
Geert Uytterhoeven Jan. 14, 2021, 8:52 a.m. UTC | #9
Hi Tony,

On Thu, Jan 14, 2021 at 9:08 AM Tony Lindgren <tony@atomide.com> wrote:
> * Vaittinen, Matti <Matti.Vaittinen@fi.rohmeurope.com> [210114 07:58]:
> > I do also experience the boot problem described by Geert.
> >
> > Head being:
> > b0625afe305253d0831af9289b37c906c18a781b
> > ARM: OMAP2+: Drop legacy platform data for am3 mpuss
> >
> > => BBB boots Ok.
> >
> > Head being:
> > 5a230524f87926f24d637fe62fd689f7f86f5036
> > ARM: dts: Use simple-pm-bus for genpd for am3 l4_wkup
> >
> > => BBB boot fails. (I don't have any debug parameters => last thing I
> > see in UART is from uBoot:
>
> Looking at the .config Geert sent me, at least CONFIG_SIMPLE_PM_BUS=y
> is now needed, and probably should be selected or default y for omaps.
>
> Adding that removes the -512 errors at least that I started seeing with
> Geert's config too.
>
> Can you guys check if adding CONFIG_SIMPLE_PM_BUS=y fixes the problem?

Thanks, that did the trick!
Sorry for not realizing that myself.

Gr{oetje,eeting}s,

                        Geert
Tony Lindgren Jan. 15, 2021, 8:12 a.m. UTC | #10
* Geert Uytterhoeven <geert@linux-m68k.org> [210114 08:52]:
> On Thu, Jan 14, 2021 at 9:08 AM Tony Lindgren <tony@atomide.com> wrote:
> > Can you guys check if adding CONFIG_SIMPLE_PM_BUS=y fixes the problem?
> 
> Thanks, that did the trick!
> Sorry for not realizing that myself.

OK thanks for testing, will send out a patch soon with both of you
in Cc.

Regards,

Tony
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/am33xx-l4.dtsi b/arch/arm/boot/dts/am33xx-l4.dtsi
--- a/arch/arm/boot/dts/am33xx-l4.dtsi
+++ b/arch/arm/boot/dts/am33xx-l4.dtsi
@@ -1,5 +1,8 @@ 
 &l4_wkup {						/* 0x44c00000 */
-	compatible = "ti,am33xx-l4-wkup", "simple-bus";
+	compatible = "ti,am33xx-l4-wkup", "simple-pm-bus";
+	power-domains = <&prm_wkup>;
+	clocks = <&l4_wkup_clkctrl AM3_L4_WKUP_L4_WKUP_CLKCTRL 0>;
+	clock-names = "fck";
 	reg = <0x44c00000 0x800>,
 	      <0x44c00800 0x800>,
 	      <0x44c01000 0x400>,
@@ -12,7 +15,7 @@  &l4_wkup {						/* 0x44c00000 */
 		 <0x00200000 0x44e00000 0x100000>;	/* segment 2 */
 
 	segment@0 {					/* 0x44c00000 */
-		compatible = "simple-bus";
+		compatible = "simple-pm-bus";
 		#address-cells = <1>;
 		#size-cells = <1>;
 		ranges = <0x00000000 0x00000000 0x000800>,	/* ap 0 */
@@ -22,7 +25,7 @@  segment@0 {					/* 0x44c00000 */
 	};
 
 	segment@100000 {					/* 0x44d00000 */
-		compatible = "simple-bus";
+		compatible = "simple-pm-bus";
 		#address-cells = <1>;
 		#size-cells = <1>;
 		ranges = <0x00000000 0x00100000 0x004000>,	/* ap 4 */
@@ -54,7 +57,7 @@  wkup_m3: cpu@0 {
 	};
 
 	segment@200000 {					/* 0x44e00000 */
-		compatible = "simple-bus";
+		compatible = "simple-pm-bus";
 		#address-cells = <1>;
 		#size-cells = <1>;
 		ranges = <0x00000000 0x00200000 0x002000>,	/* ap 8 */