mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM: nxp-imx8mq-evk: remove SDRAM reservation for ATF
@ 2018-11-06 17:42 Lucas Stach
  2018-11-06 17:42 ` [PATCH 2/2] ARM: nxp-imx8mq-evk: add barebox and env partitions Lucas Stach
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Lucas Stach @ 2018-11-06 17:42 UTC (permalink / raw)
  To: barebox

Recent versions of the i.MX8MQ ATF (like the one shipped with Barebox)
reside in a part of OCRAM, so there is no need to reserve any part of
SDRAM anymore.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 arch/arm/boards/nxp-imx8mq-evk/board.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/arch/arm/boards/nxp-imx8mq-evk/board.c b/arch/arm/boards/nxp-imx8mq-evk/board.c
index 764eadb766a9..7918b5fb3e36 100644
--- a/arch/arm/boards/nxp-imx8mq-evk/board.c
+++ b/arch/arm/boards/nxp-imx8mq-evk/board.c
@@ -45,17 +45,6 @@ static int ar8031_phy_fixup(struct phy_device *phydev)
 	return 0;
 }
 
-static int imx8mq_evk_mem_init(void)
-{
-	if (!of_machine_is_compatible("fsl,imx8mq-evk"))
-		return 0;
-
-	request_sdram_region("ATF", 0x40000000, SZ_128K);
-
-	return 0;
-}
-mem_initcall(imx8mq_evk_mem_init);
-
 static int nxp_imx8mq_evk_init(void)
 {
 	if (!of_machine_is_compatible("fsl,imx8mq-evk"))
-- 
2.19.1


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

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

* [PATCH 2/2] ARM: nxp-imx8mq-evk: add barebox and env partitions
  2018-11-06 17:42 [PATCH 1/2] ARM: nxp-imx8mq-evk: remove SDRAM reservation for ATF Lucas Stach
@ 2018-11-06 17:42 ` Lucas Stach
  2018-11-06 21:14   ` Andrey Smirnov
  2018-11-06 20:57 ` [PATCH 1/2] ARM: nxp-imx8mq-evk: remove SDRAM reservation for ATF Andrey Smirnov
  2018-11-09  7:24 ` Sascha Hauer
  2 siblings, 1 reply; 6+ messages in thread
From: Lucas Stach @ 2018-11-06 17:42 UTC (permalink / raw)
  To: barebox

So we can have a persistent env and a bit safer barebox update. Also
switch the environment and update default depending on the bootsource,
as this is really helpful on an eval board where one might want to
have totally different systems on eMMC and SD card.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 arch/arm/boards/nxp-imx8mq-evk/board.c | 20 +++++++++++---
 arch/arm/dts/imx8mq-evk.dts            | 37 ++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boards/nxp-imx8mq-evk/board.c b/arch/arm/boards/nxp-imx8mq-evk/board.c
index 7918b5fb3e36..299d056e2777 100644
--- a/arch/arm/boards/nxp-imx8mq-evk/board.c
+++ b/arch/arm/boards/nxp-imx8mq-evk/board.c
@@ -17,11 +17,12 @@
  *
  */
 
+#include <asm/memory.h>
+#include <bootsource.h>
 #include <common.h>
 #include <init.h>
-#include <asm/memory.h>
-#include <linux/sizes.h>
 #include <linux/phy.h>
+#include <linux/sizes.h>
 #include <mach/bbu.h>
 
 #include <envfs.h>
@@ -47,12 +48,25 @@ static int ar8031_phy_fixup(struct phy_device *phydev)
 
 static int nxp_imx8mq_evk_init(void)
 {
+	int flags;
+
 	if (!of_machine_is_compatible("fsl,imx8mq-evk"))
 		return 0;
 
 	barebox_set_hostname("imx8mq-evk");
 
-	imx8mq_bbu_internal_mmc_register_handler("eMMC", "/dev/mmc0", 0);
+	flags = bootsource_get_instance() == 0 ? BBU_HANDLER_FLAG_DEFAULT : 0;
+	imx8mq_bbu_internal_mmc_register_handler("eMMC",
+						 "/dev/mmc0.barebox", flags);
+
+	flags = bootsource_get_instance() == 1 ? BBU_HANDLER_FLAG_DEFAULT : 0;
+	imx8mq_bbu_internal_mmc_register_handler("SD",
+						 "/dev/mmc1.barebox", flags);
+
+	if (bootsource_get_instance() == 0)
+		of_device_enable_path("/chosen/environment-emmc");
+	else
+		of_device_enable_path("/chosen/environment-sd");
 
 	phy_register_fixup_for_uid(PHY_ID_AR8031, AR_PHY_ID_MASK,
 				   ar8031_phy_fixup);
diff --git a/arch/arm/dts/imx8mq-evk.dts b/arch/arm/dts/imx8mq-evk.dts
index a6e724e2e2a5..56a35173a04f 100644
--- a/arch/arm/dts/imx8mq-evk.dts
+++ b/arch/arm/dts/imx8mq-evk.dts
@@ -15,6 +15,17 @@
 
 	chosen {
 		stdout-path = &uart1;
+
+		environment-emmc {
+			compatible = "barebox,environment";
+			device-path = &usdhc1, "partname:barebox-environment";
+			status = "disabled";
+		};
+		environment-sd {
+			compatible = "barebox,environment";
+			device-path = &usdhc2, "partname:barebox-environment";
+			status = "disabled";
+		};
 	};
 
 	reg_usdhc2_vmmc: regulator-vsd-3v3 {
@@ -177,6 +188,19 @@
 	no-sd;
 	no-sdio;
 	status = "okay";
+
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	partition@0 {
+		label = "barebox";
+		reg = <0x0 0xe0000>;
+	};
+
+	partition@e0000 {
+		label = "barebox-environment";
+		reg = <0xe0000 0x20000>;
+	};
 };
 
 &usdhc2 {
@@ -190,6 +214,19 @@
 	cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>;
 	vmmc-supply = <&reg_usdhc2_vmmc>;
 	status = "okay";
+
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	partition@0 {
+		label = "barebox";
+		reg = <0x0 0xe0000>;
+	};
+
+	partition@e0000 {
+		label = "barebox-environment";
+		reg = <0xe0000 0x20000>;
+	};
 };
 
 &wdog1 {
-- 
2.19.1


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

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

* Re: [PATCH 1/2] ARM: nxp-imx8mq-evk: remove SDRAM reservation for ATF
  2018-11-06 17:42 [PATCH 1/2] ARM: nxp-imx8mq-evk: remove SDRAM reservation for ATF Lucas Stach
  2018-11-06 17:42 ` [PATCH 2/2] ARM: nxp-imx8mq-evk: add barebox and env partitions Lucas Stach
@ 2018-11-06 20:57 ` Andrey Smirnov
  2018-11-07 12:02   ` Lucas Stach
  2018-11-09  7:24 ` Sascha Hauer
  2 siblings, 1 reply; 6+ messages in thread
From: Andrey Smirnov @ 2018-11-06 20:57 UTC (permalink / raw)
  To: Lucas Stach; +Cc: Barebox List

On Tue, Nov 6, 2018 at 9:43 AM Lucas Stach <l.stach@pengutronix.de> wrote:
>
> Recent versions of the i.MX8MQ ATF (like the one shipped with Barebox)
> reside in a part of OCRAM, so there is no need to reserve any part of
> SDRAM anymore.
>

Not sure if this will be handled by Barebox, but there's also:

/memreserve/ 0x40000000 0x00020000;

in arch/arm/dts/imx8mq.dtsi, do we want to drop that as well?

Other than that, definitely a good change:

Acked-by: Andrey Smirnov <andrew.smirnov@gmail.com>

> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  arch/arm/boards/nxp-imx8mq-evk/board.c | 11 -----------
>  1 file changed, 11 deletions(-)
>
> diff --git a/arch/arm/boards/nxp-imx8mq-evk/board.c b/arch/arm/boards/nxp-imx8mq-evk/board.c
> index 764eadb766a9..7918b5fb3e36 100644
> --- a/arch/arm/boards/nxp-imx8mq-evk/board.c
> +++ b/arch/arm/boards/nxp-imx8mq-evk/board.c
> @@ -45,17 +45,6 @@ static int ar8031_phy_fixup(struct phy_device *phydev)
>         return 0;
>  }
>
> -static int imx8mq_evk_mem_init(void)
> -{
> -       if (!of_machine_is_compatible("fsl,imx8mq-evk"))
> -               return 0;
> -
> -       request_sdram_region("ATF", 0x40000000, SZ_128K);
> -
> -       return 0;
> -}
> -mem_initcall(imx8mq_evk_mem_init);
> -
>  static int nxp_imx8mq_evk_init(void)
>  {
>         if (!of_machine_is_compatible("fsl,imx8mq-evk"))
> --
> 2.19.1
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

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

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

* Re: [PATCH 2/2] ARM: nxp-imx8mq-evk: add barebox and env partitions
  2018-11-06 17:42 ` [PATCH 2/2] ARM: nxp-imx8mq-evk: add barebox and env partitions Lucas Stach
@ 2018-11-06 21:14   ` Andrey Smirnov
  0 siblings, 0 replies; 6+ messages in thread
From: Andrey Smirnov @ 2018-11-06 21:14 UTC (permalink / raw)
  To: Lucas Stach; +Cc: Barebox List

On Tue, Nov 6, 2018 at 9:43 AM Lucas Stach <l.stach@pengutronix.de> wrote:
>
> So we can have a persistent env and a bit safer barebox update. Also
> switch the environment and update default depending on the bootsource,
> as this is really helpful on an eval board where one might want to
> have totally different systems on eMMC and SD card.
>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  arch/arm/boards/nxp-imx8mq-evk/board.c | 20 +++++++++++---
>  arch/arm/dts/imx8mq-evk.dts            | 37 ++++++++++++++++++++++++++
>  2 files changed, 54 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/boards/nxp-imx8mq-evk/board.c b/arch/arm/boards/nxp-imx8mq-evk/board.c
> index 7918b5fb3e36..299d056e2777 100644
> --- a/arch/arm/boards/nxp-imx8mq-evk/board.c
> +++ b/arch/arm/boards/nxp-imx8mq-evk/board.c
> @@ -17,11 +17,12 @@
>   *
>   */
>
> +#include <asm/memory.h>
> +#include <bootsource.h>
>  #include <common.h>
>  #include <init.h>
> -#include <asm/memory.h>
> -#include <linux/sizes.h>
>  #include <linux/phy.h>
> +#include <linux/sizes.h>
>  #include <mach/bbu.h>
>
>  #include <envfs.h>
> @@ -47,12 +48,25 @@ static int ar8031_phy_fixup(struct phy_device *phydev)
>
>  static int nxp_imx8mq_evk_init(void)
>  {
> +       int flags;
> +
>         if (!of_machine_is_compatible("fsl,imx8mq-evk"))
>                 return 0;
>
>         barebox_set_hostname("imx8mq-evk");
>
> -       imx8mq_bbu_internal_mmc_register_handler("eMMC", "/dev/mmc0", 0);
> +       flags = bootsource_get_instance() == 0 ? BBU_HANDLER_FLAG_DEFAULT : 0;
> +       imx8mq_bbu_internal_mmc_register_handler("eMMC",
> +                                                "/dev/mmc0.barebox", flags);
> +
> +       flags = bootsource_get_instance() == 1 ? BBU_HANDLER_FLAG_DEFAULT : 0;
> +       imx8mq_bbu_internal_mmc_register_handler("SD",
> +                                                "/dev/mmc1.barebox", flags);
> +
> +       if (bootsource_get_instance() == 0)
> +               of_device_enable_path("/chosen/environment-emmc");
> +       else
> +               of_device_enable_path("/chosen/environment-sd");

Optionally, you can probably simplify this to:

switch (bootsource_get_instance()) {
case 0:
    flags_emmc = BBU_HANDLER_FLAG_DEFAULT;
    flags_sd = 0;
    environment_path = "/chosen/envirnoment-emmc";
    break;
case 1:
    flags_emmc = 0;
    flags_sd = BBU_HANDLER_FLAGDEFAULT;
    environment_path = "/chosen/envirnoment-sd";
    break;
}

imx8mq_bbu_internal_mmc_register_handler("eMMC",
                                                "/dev/mmc0.barebox", flags_mmc);

imx8mq_bbu_internal_mmc_register_handler("SD",
                                               "/dev/mmc1.barebox", flags_sd);

of_device_enable_path(environment_path);

Thanks,
Andrey Smirnov

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

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

* Re: [PATCH 1/2] ARM: nxp-imx8mq-evk: remove SDRAM reservation for ATF
  2018-11-06 20:57 ` [PATCH 1/2] ARM: nxp-imx8mq-evk: remove SDRAM reservation for ATF Andrey Smirnov
@ 2018-11-07 12:02   ` Lucas Stach
  0 siblings, 0 replies; 6+ messages in thread
From: Lucas Stach @ 2018-11-07 12:02 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: Barebox List

Am Dienstag, den 06.11.2018, 12:57 -0800 schrieb Andrey Smirnov:
> On Tue, Nov 6, 2018 at 9:43 AM Lucas Stach <l.stach@pengutronix.de>
> wrote:
> > 
> > Recent versions of the i.MX8MQ ATF (like the one shipped with
> > Barebox)
> > reside in a part of OCRAM, so there is no need to reserve any part
> > of
> > SDRAM anymore.
> > 
> 
> Not sure if this will be handled by Barebox, but there's also:
> 
> /memreserve/ 0x40000000 0x00020000;
> 
> in arch/arm/dts/imx8mq.dtsi, do we want to drop that as well?

It doesn't hurt, as Barebox isn't looking at the reserved ranges right
now, but yes it should go eventually.

Regards,
Lucas

> Other than that, definitely a good change:
> 
> Acked-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> 
> > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> > ---
> >  arch/arm/boards/nxp-imx8mq-evk/board.c | 11 -----------
> >  1 file changed, 11 deletions(-)
> > 
> > diff --git a/arch/arm/boards/nxp-imx8mq-evk/board.c
> > b/arch/arm/boards/nxp-imx8mq-evk/board.c
> > index 764eadb766a9..7918b5fb3e36 100644
> > --- a/arch/arm/boards/nxp-imx8mq-evk/board.c
> > +++ b/arch/arm/boards/nxp-imx8mq-evk/board.c
> > @@ -45,17 +45,6 @@ static int ar8031_phy_fixup(struct phy_device
> > *phydev)
> >         return 0;
> >  }
> > 
> > -static int imx8mq_evk_mem_init(void)
> > -{
> > -       if (!of_machine_is_compatible("fsl,imx8mq-evk"))
> > -               return 0;
> > -
> > -       request_sdram_region("ATF", 0x40000000, SZ_128K);
> > -
> > -       return 0;
> > -}
> > -mem_initcall(imx8mq_evk_mem_init);
> > -
> >  static int nxp_imx8mq_evk_init(void)
> >  {
> >         if (!of_machine_is_compatible("fsl,imx8mq-evk"))
> > --
> > 2.19.1
> > 
> > 
> > _______________________________________________
> > barebox mailing list
> > barebox@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox

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

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

* Re: [PATCH 1/2] ARM: nxp-imx8mq-evk: remove SDRAM reservation for ATF
  2018-11-06 17:42 [PATCH 1/2] ARM: nxp-imx8mq-evk: remove SDRAM reservation for ATF Lucas Stach
  2018-11-06 17:42 ` [PATCH 2/2] ARM: nxp-imx8mq-evk: add barebox and env partitions Lucas Stach
  2018-11-06 20:57 ` [PATCH 1/2] ARM: nxp-imx8mq-evk: remove SDRAM reservation for ATF Andrey Smirnov
@ 2018-11-09  7:24 ` Sascha Hauer
  2 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2018-11-09  7:24 UTC (permalink / raw)
  To: Lucas Stach; +Cc: barebox

On Tue, Nov 06, 2018 at 06:42:53PM +0100, Lucas Stach wrote:
> Recent versions of the i.MX8MQ ATF (like the one shipped with Barebox)
> reside in a part of OCRAM, so there is no need to reserve any part of
> SDRAM anymore.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  arch/arm/boards/nxp-imx8mq-evk/board.c | 11 -----------
>  1 file changed, 11 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/arch/arm/boards/nxp-imx8mq-evk/board.c b/arch/arm/boards/nxp-imx8mq-evk/board.c
> index 764eadb766a9..7918b5fb3e36 100644
> --- a/arch/arm/boards/nxp-imx8mq-evk/board.c
> +++ b/arch/arm/boards/nxp-imx8mq-evk/board.c
> @@ -45,17 +45,6 @@ static int ar8031_phy_fixup(struct phy_device *phydev)
>  	return 0;
>  }
>  
> -static int imx8mq_evk_mem_init(void)
> -{
> -	if (!of_machine_is_compatible("fsl,imx8mq-evk"))
> -		return 0;
> -
> -	request_sdram_region("ATF", 0x40000000, SZ_128K);
> -
> -	return 0;
> -}
> -mem_initcall(imx8mq_evk_mem_init);
> -
>  static int nxp_imx8mq_evk_init(void)
>  {
>  	if (!of_machine_is_compatible("fsl,imx8mq-evk"))
> -- 
> 2.19.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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] 6+ messages in thread

end of thread, other threads:[~2018-11-09  7:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-06 17:42 [PATCH 1/2] ARM: nxp-imx8mq-evk: remove SDRAM reservation for ATF Lucas Stach
2018-11-06 17:42 ` [PATCH 2/2] ARM: nxp-imx8mq-evk: add barebox and env partitions Lucas Stach
2018-11-06 21:14   ` Andrey Smirnov
2018-11-06 20:57 ` [PATCH 1/2] ARM: nxp-imx8mq-evk: remove SDRAM reservation for ATF Andrey Smirnov
2018-11-07 12:02   ` Lucas Stach
2018-11-09  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