mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: i.MX6UL: liteSOM: depend on DDR controller settings
@ 2019-02-26 13:05 Marcin Niestroj
  2019-02-26 18:35 ` Bartosz Biłas
  2019-02-27  7:46 ` Sascha Hauer
  0 siblings, 2 replies; 5+ messages in thread
From: Marcin Niestroj @ 2019-02-26 13:05 UTC (permalink / raw)
  To: barebox; +Cc: Bartosz Bilas, Marcin Niestroj

Initially we depended on DDR controller settings for liteSOM and liteboard. With
33fdc89d4cbd ("dts: update to v5.0-rc1") a `device_type = "memory";` property
was added to imx6ul-litesom.dtsi file, which causes "ram0" to be added with
512MB size (value in dtsi) instead of the real 256MB size that is configured in
barebox-grinn-liteboard-256mb.img. As a result Linux kernel fails to boot.

Lets depend on DDR controller settings, by removing whole `/memory` node from
device tree. This makes barebox-grinn-liteboard-256mb.img able to boot Linux
kernel once again.

Reported-by: Bartosz Bilas <b.bilas@grinn-global.com>
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
---
 arch/arm/dts/imx6ul-liteboard.dts | 1 +
 arch/arm/dts/imx6ul-litesom.dtsi  | 8 ++++++++
 2 files changed, 9 insertions(+)
 create mode 100644 arch/arm/dts/imx6ul-litesom.dtsi

diff --git a/arch/arm/dts/imx6ul-liteboard.dts b/arch/arm/dts/imx6ul-liteboard.dts
index 03a4bfc78..eb34e11dd 100644
--- a/arch/arm/dts/imx6ul-liteboard.dts
+++ b/arch/arm/dts/imx6ul-liteboard.dts
@@ -42,6 +42,7 @@
  */
 
 #include <arm/imx6ul-liteboard.dts>
+#include "imx6ul-litesom.dtsi"
 
 / {
 	chosen {
diff --git a/arch/arm/dts/imx6ul-litesom.dtsi b/arch/arm/dts/imx6ul-litesom.dtsi
new file mode 100644
index 000000000..8b73bfdd6
--- /dev/null
+++ b/arch/arm/dts/imx6ul-litesom.dtsi
@@ -0,0 +1,8 @@
+/*
+ * Include file to switch board DTS from using hardcoded memory node
+ * to dynamic memory size detection based on DDR controller settings
+ */
+
+/ {
+	/delete-node/ memory@80000000;
+};
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] ARM: i.MX6UL: liteSOM: depend on DDR controller settings
  2019-02-26 13:05 [PATCH] ARM: i.MX6UL: liteSOM: depend on DDR controller settings Marcin Niestroj
@ 2019-02-26 18:35 ` Bartosz Biłas
  2019-02-27  7:46 ` Sascha Hauer
  1 sibling, 0 replies; 5+ messages in thread
From: Bartosz Biłas @ 2019-02-26 18:35 UTC (permalink / raw)
  To: Marcin Niestroj, barebox

Tested-by: Bartosz Bilas <b.bilas@grinn-global.com>

On 26.02.2019 14:05, Marcin Niestroj wrote:
> Initially we depended on DDR controller settings for liteSOM and liteboard. With
> 33fdc89d4cbd ("dts: update to v5.0-rc1") a `device_type = "memory";` property
> was added to imx6ul-litesom.dtsi file, which causes "ram0" to be added with
> 512MB size (value in dtsi) instead of the real 256MB size that is configured in
> barebox-grinn-liteboard-256mb.img. As a result Linux kernel fails to boot.
>
> Lets depend on DDR controller settings, by removing whole `/memory` node from
> device tree. This makes barebox-grinn-liteboard-256mb.img able to boot Linux
> kernel once again.
>
> Reported-by: Bartosz Bilas <b.bilas@grinn-global.com>
> Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
> ---
>   arch/arm/dts/imx6ul-liteboard.dts | 1 +
>   arch/arm/dts/imx6ul-litesom.dtsi  | 8 ++++++++
>   2 files changed, 9 insertions(+)
>   create mode 100644 arch/arm/dts/imx6ul-litesom.dtsi
>
> diff --git a/arch/arm/dts/imx6ul-liteboard.dts b/arch/arm/dts/imx6ul-liteboard.dts
> index 03a4bfc78..eb34e11dd 100644
> --- a/arch/arm/dts/imx6ul-liteboard.dts
> +++ b/arch/arm/dts/imx6ul-liteboard.dts
> @@ -42,6 +42,7 @@
>    */
>   
>   #include <arm/imx6ul-liteboard.dts>
> +#include "imx6ul-litesom.dtsi"
>   
>   / {
>   	chosen {
> diff --git a/arch/arm/dts/imx6ul-litesom.dtsi b/arch/arm/dts/imx6ul-litesom.dtsi
> new file mode 100644
> index 000000000..8b73bfdd6
> --- /dev/null
> +++ b/arch/arm/dts/imx6ul-litesom.dtsi
> @@ -0,0 +1,8 @@
> +/*
> + * Include file to switch board DTS from using hardcoded memory node
> + * to dynamic memory size detection based on DDR controller settings
> + */
> +
> +/ {
> +	/delete-node/ memory@80000000;
> +};

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] ARM: i.MX6UL: liteSOM: depend on DDR controller settings
  2019-02-26 13:05 [PATCH] ARM: i.MX6UL: liteSOM: depend on DDR controller settings Marcin Niestroj
  2019-02-26 18:35 ` Bartosz Biłas
@ 2019-02-27  7:46 ` Sascha Hauer
  2019-02-27 10:04   ` Marcin Niestrój
  1 sibling, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2019-02-27  7:46 UTC (permalink / raw)
  To: Marcin Niestroj; +Cc: barebox, Bartosz Bilas

On Tue, Feb 26, 2019 at 02:05:29PM +0100, Marcin Niestroj wrote:
> Initially we depended on DDR controller settings for liteSOM and liteboard. With
> 33fdc89d4cbd ("dts: update to v5.0-rc1") a `device_type = "memory";` property
> was added to imx6ul-litesom.dtsi file, which causes "ram0" to be added with
> 512MB size (value in dtsi) instead of the real 256MB size that is configured in
> barebox-grinn-liteboard-256mb.img. As a result Linux kernel fails to boot.
> 
> Lets depend on DDR controller settings, by removing whole `/memory` node from
> device tree. This makes barebox-grinn-liteboard-256mb.img able to boot Linux
> kernel once again.

This issue should also be fixed by:

| commit 8a29e7b493c8c2aa57174c9e79c14b93c9807a4b
| Author: Marco Felsch <m.felsch@pengutronix.de>
| Date:   Tue Feb 12 16:10:41 2019 +0100
| 
|     memory: of_fixup: adapt to new memory layout
|     
|     Since kernel 4.16 the memory nodes got a @<reg> suffix so the fixup
|     won't work correctly anymore, because instead of adapting the extisting
|     one the fixup creates a new node and keeps the old (maybe incorrect)
|     node.
|     
|     To be compatible with the old and new layout delete the found memory
|     node and create a new one. The new node follows the new @<reg> style.
|     
|     The patch also renames the node parameter to make it clearer.
|     
|     Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
|     Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

I would prefer this patch as it solves the issue for all boards.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] ARM: i.MX6UL: liteSOM: depend on DDR controller settings
  2019-02-27  7:46 ` Sascha Hauer
@ 2019-02-27 10:04   ` Marcin Niestrój
  2019-03-07  7:24     ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Marcin Niestrój @ 2019-02-27 10:04 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox, Bartosz Bilas


Sascha Hauer <s.hauer@pengutronix.de> writes:

> On Tue, Feb 26, 2019 at 02:05:29PM +0100, Marcin Niestroj wrote:
>> Initially we depended on DDR controller settings for liteSOM and liteboard. With
>> 33fdc89d4cbd ("dts: update to v5.0-rc1") a `device_type = "memory";` property
>> was added to imx6ul-litesom.dtsi file, which causes "ram0" to be added with
>> 512MB size (value in dtsi) instead of the real 256MB size that is configured in
>> barebox-grinn-liteboard-256mb.img. As a result Linux kernel fails to boot.
>>
>> Lets depend on DDR controller settings, by removing whole `/memory` node from
>> device tree. This makes barebox-grinn-liteboard-256mb.img able to boot Linux
>> kernel once again.
>
> This issue should also be fixed by:
>
> | commit 8a29e7b493c8c2aa57174c9e79c14b93c9807a4b
> | Author: Marco Felsch <m.felsch@pengutronix.de>
> | Date:   Tue Feb 12 16:10:41 2019 +0100
> |
> |     memory: of_fixup: adapt to new memory layout
> |
> |     Since kernel 4.16 the memory nodes got a @<reg> suffix so the fixup
> |     won't work correctly anymore, because instead of adapting the extisting
> |     one the fixup creates a new node and keeps the old (maybe incorrect)
> |     node.
> |
> |     To be compatible with the old and new layout delete the found memory
> |     node and create a new one. The new node follows the new @<reg> style.
> |
> |     The patch also renames the node parameter to make it clearer.
> |
> |     Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> |     Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
>
> I would prefer this patch as it solves the issue for all boards.

We need this patch as well. The problem that I want to solve with
liteboard is configuring memory banks, which is done much earlier. In
current master branch a single memory bank is added from device-tree
(of_probe -> ... -> of_add_memory_bank). In case of liteboard this is
configured to 512MB. Then a imx6_mmdc_add_mem() is executed, which tries
to add 256MB memory bank (in case of barebox-grinn-liteboard-256mb.img).
This fails inside barebox_add_memory_bank(), because we get -EBUSY from
request_iomem_region() there. This makes no problem in Barebox
yet. However, when booting Linux kernel of_memory_fixup() function gets
called. It sets 512MB in fdt once again, which results in boot failure
when jumping into kernel.

I agree, that it is better to solve this kind of issues for all
boards. In order to achieve that we need to either:
1) "overwrite" in imx6_mmdc_add_mem() what we have set in
   of_add_memory_bank(),
2) make sure imx6_mmdc_add_mem() gets called earlier than
   of_add_memory_bank().

--
Regards,
Marcin

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] ARM: i.MX6UL: liteSOM: depend on DDR controller settings
  2019-02-27 10:04   ` Marcin Niestrój
@ 2019-03-07  7:24     ` Sascha Hauer
  0 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2019-03-07  7:24 UTC (permalink / raw)
  To: Marcin Niestrój; +Cc: barebox, Bartosz Bilas

On Wed, Feb 27, 2019 at 11:04:18AM +0100, Marcin Niestrój wrote:
> 
> Sascha Hauer <s.hauer@pengutronix.de> writes:
> 
> > On Tue, Feb 26, 2019 at 02:05:29PM +0100, Marcin Niestroj wrote:
> >> Initially we depended on DDR controller settings for liteSOM and liteboard. With
> >> 33fdc89d4cbd ("dts: update to v5.0-rc1") a `device_type = "memory";` property
> >> was added to imx6ul-litesom.dtsi file, which causes "ram0" to be added with
> >> 512MB size (value in dtsi) instead of the real 256MB size that is configured in
> >> barebox-grinn-liteboard-256mb.img. As a result Linux kernel fails to boot.
> >>
> >> Lets depend on DDR controller settings, by removing whole `/memory` node from
> >> device tree. This makes barebox-grinn-liteboard-256mb.img able to boot Linux
> >> kernel once again.
> >
> > This issue should also be fixed by:
> >
> > | commit 8a29e7b493c8c2aa57174c9e79c14b93c9807a4b
> > | Author: Marco Felsch <m.felsch@pengutronix.de>
> > | Date:   Tue Feb 12 16:10:41 2019 +0100
> > |
> > |     memory: of_fixup: adapt to new memory layout
> > |
> > |     Since kernel 4.16 the memory nodes got a @<reg> suffix so the fixup
> > |     won't work correctly anymore, because instead of adapting the extisting
> > |     one the fixup creates a new node and keeps the old (maybe incorrect)
> > |     node.
> > |
> > |     To be compatible with the old and new layout delete the found memory
> > |     node and create a new one. The new node follows the new @<reg> style.
> > |
> > |     The patch also renames the node parameter to make it clearer.
> > |
> > |     Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > |     Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> >
> > I would prefer this patch as it solves the issue for all boards.
> 
> We need this patch as well. The problem that I want to solve with
> liteboard is configuring memory banks, which is done much earlier. In
> current master branch a single memory bank is added from device-tree
> (of_probe -> ... -> of_add_memory_bank). In case of liteboard this is
> configured to 512MB. Then a imx6_mmdc_add_mem() is executed, which tries
> to add 256MB memory bank (in case of barebox-grinn-liteboard-256mb.img).
> This fails inside barebox_add_memory_bank(), because we get -EBUSY from
> request_iomem_region() there. This makes no problem in Barebox
> yet. However, when booting Linux kernel of_memory_fixup() function gets
> called. It sets 512MB in fdt once again, which results in boot failure
> when jumping into kernel.
> 
> I agree, that it is better to solve this kind of issues for all
> boards. In order to achieve that we need to either:
> 1) "overwrite" in imx6_mmdc_add_mem() what we have set in
>    of_add_memory_bank(),
> 2) make sure imx6_mmdc_add_mem() gets called earlier than
>    of_add_memory_bank().

Ok, I applied it now.

Thanks
 Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2019-03-07  7:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-26 13:05 [PATCH] ARM: i.MX6UL: liteSOM: depend on DDR controller settings Marcin Niestroj
2019-02-26 18:35 ` Bartosz Biłas
2019-02-27  7:46 ` Sascha Hauer
2019-02-27 10:04   ` Marcin Niestrój
2019-03-07  7:24     ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox