diff mbox series

[U-Boot,16/20] imx8m: fix sd to mmc1 and emmc to mmc2 for i.MX8MM

Message ID 20190128094807.26532-17-peng.fan@nxp.com
State Changes Requested
Delegated to: Stefano Babic
Headers show
Series imx: add i.MX8MM support | expand

Commit Message

Peng Fan Jan. 28, 2019, 9:40 a.m. UTC
Since the SD is usdhc2 and eMMC is usdhc3, this cause mapping problem
for spl_boot_device. So far hard coded them to correct MMC index, so
that SD and eMMC boot can work.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 arch/arm/mach-imx/spl.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Lukasz Majewski Jan. 29, 2019, 10:57 p.m. UTC | #1
Hi Peng,

> Since the SD is usdhc2 and eMMC is usdhc3,

Is this true on all IMX8M boards? Or is it only on the development kit
you do have?

My point is that this shall be setup by DTS aliases or maybe by Kconfig
option.

> this cause mapping problem
> for spl_boot_device. So far hard coded them to correct MMC index, so
> that SD and eMMC boot can work.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  arch/arm/mach-imx/spl.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
> index ebd8ff9290..0048832be8 100644
> --- a/arch/arm/mach-imx/spl.c
> +++ b/arch/arm/mach-imx/spl.c
> @@ -147,9 +147,18 @@ u32 spl_boot_device(void)
>  	case SD1_BOOT:
>  	case MMC1_BOOT:
>  		return BOOT_DEVICE_MMC1;
> +#if defined(CONFIG_IMX8MM)
> +	case SD2_BOOT:
> +	case MMC2_BOOT:
> +		return BOOT_DEVICE_MMC1;
> +	case SD3_BOOT:
> +	case MMC3_BOOT:
> +		return BOOT_DEVICE_MMC2;
> +#else
>  	case SD2_BOOT:
>  	case MMC2_BOOT:
>  		return BOOT_DEVICE_MMC2;
> +#endif
>  #endif
>  	case NAND_BOOT:
>  		return BOOT_DEVICE_NAND;




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Fabio Estevam Jan. 29, 2019, 11:01 p.m. UTC | #2
On Tue, Jan 29, 2019 at 8:58 PM Lukasz Majewski <lukma@denx.de> wrote:

> Is this true on all IMX8M boards? Or is it only on the development kit
> you do have?
>
> My point is that this shall be setup by DTS aliases or maybe by Kconfig
> option.

Yes, it seems that setting up the alias in the board dts should do the trick.
Peng Fan Jan. 30, 2019, 5:47 a.m. UTC | #3
> -----Original Message-----
> From: Lukasz Majewski [mailto:lukma@denx.de]
> Sent: 2019年1月30日 6:58
> To: Peng Fan <peng.fan@nxp.com>
> Cc: sbabic@denx.de; Fabio Estevam <fabio.estevam@nxp.com>;
> dl-uboot-imx <uboot-imx@nxp.com>; u-boot@lists.denx.de
> Subject: Re: [U-Boot] [PATCH 16/20] imx8m: fix sd to mmc1 and emmc to
> mmc2 for i.MX8MM
> 
> Hi Peng,
> 
> > Since the SD is usdhc2 and eMMC is usdhc3,
> 
> Is this true on all IMX8M boards? Or is it only on the development kit you do
> have?

This is a hack for board, needs to be fixed in next version.

> 
> My point is that this shall be setup by DTS aliases or maybe by Kconfig option.

Could you share more information?

Thanks,
Peng.

> 
> > this cause mapping problem
> > for spl_boot_device. So far hard coded them to correct MMC index, so
> > that SD and eMMC boot can work.
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> >  arch/arm/mach-imx/spl.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index
> > ebd8ff9290..0048832be8 100644
> > --- a/arch/arm/mach-imx/spl.c
> > +++ b/arch/arm/mach-imx/spl.c
> > @@ -147,9 +147,18 @@ u32 spl_boot_device(void)
> >  	case SD1_BOOT:
> >  	case MMC1_BOOT:
> >  		return BOOT_DEVICE_MMC1;
> > +#if defined(CONFIG_IMX8MM)
> > +	case SD2_BOOT:
> > +	case MMC2_BOOT:
> > +		return BOOT_DEVICE_MMC1;
> > +	case SD3_BOOT:
> > +	case MMC3_BOOT:
> > +		return BOOT_DEVICE_MMC2;
> > +#else
> >  	case SD2_BOOT:
> >  	case MMC2_BOOT:
> >  		return BOOT_DEVICE_MMC2;
> > +#endif
> >  #endif
> >  	case NAND_BOOT:
> >  		return BOOT_DEVICE_NAND;
> 
> 
> 
> 
> Best regards,
> 
> Lukasz Majewski
> 
> --
> 
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> lukma@denx.de
Lukasz Majewski Jan. 30, 2019, 6:50 a.m. UTC | #4
Hi Peng,

> > -----Original Message-----
> > From: Lukasz Majewski [mailto:lukma@denx.de]
> > Sent: 2019年1月30日 6:58
> > To: Peng Fan <peng.fan@nxp.com>
> > Cc: sbabic@denx.de; Fabio Estevam <fabio.estevam@nxp.com>;
> > dl-uboot-imx <uboot-imx@nxp.com>; u-boot@lists.denx.de
> > Subject: Re: [U-Boot] [PATCH 16/20] imx8m: fix sd to mmc1 and emmc
> > to mmc2 for i.MX8MM
> > 
> > Hi Peng,
> >   
> > > Since the SD is usdhc2 and eMMC is usdhc3,  
> > 
> > Is this true on all IMX8M boards? Or is it only on the development
> > kit you do have?  
> 
> This is a hack for board, needs to be fixed in next version.
> 
> > 
> > My point is that this shall be setup by DTS aliases or maybe by
> > Kconfig option.  
> 
> Could you share more information?

For example:

/ {
	model = "K+P iMX6Q";
	compatible = "kp,imx6-kp", "fsl,imx6";

	aliases {
		mmc0 = &usdhc2;
		mmc1 = &usdhc4;
		usb1 = &usbh1;
	};

	chosen {
		stdout-path = &uart1;
	};


And the "aliases" set the order in which you get the devices (like
mmc0, mmc1 above).

> 
> Thanks,
> Peng.
> 
> >   
> > > this cause mapping problem
> > > for spl_boot_device. So far hard coded them to correct MMC index,
> > > so that SD and eMMC boot can work.
> > >
> > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > ---
> > >  arch/arm/mach-imx/spl.c | 9 +++++++++
> > >  1 file changed, 9 insertions(+)
> > >
> > > diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
> > > index ebd8ff9290..0048832be8 100644
> > > --- a/arch/arm/mach-imx/spl.c
> > > +++ b/arch/arm/mach-imx/spl.c
> > > @@ -147,9 +147,18 @@ u32 spl_boot_device(void)
> > >  	case SD1_BOOT:
> > >  	case MMC1_BOOT:
> > >  		return BOOT_DEVICE_MMC1;
> > > +#if defined(CONFIG_IMX8MM)
> > > +	case SD2_BOOT:
> > > +	case MMC2_BOOT:
> > > +		return BOOT_DEVICE_MMC1;
> > > +	case SD3_BOOT:
> > > +	case MMC3_BOOT:
> > > +		return BOOT_DEVICE_MMC2;
> > > +#else
> > >  	case SD2_BOOT:
> > >  	case MMC2_BOOT:
> > >  		return BOOT_DEVICE_MMC2;
> > > +#endif
> > >  #endif
> > >  	case NAND_BOOT:
> > >  		return BOOT_DEVICE_NAND;  
> > 
> > 
> > 
> > 
> > Best regards,
> > 
> > Lukasz Majewski
> > 
> > --
> > 
> > DENX Software Engineering GmbH,      Managing Director: Wolfgang
> > Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell,
> > Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> > lukma@denx.de  




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Peng Fan Jan. 30, 2019, 6:51 a.m. UTC | #5
> -----Original Message-----
> From: Lukasz Majewski [mailto:lukma@denx.de]
> Sent: 2019年1月30日 14:50
> To: Peng Fan <peng.fan@nxp.com>
> Cc: sbabic@denx.de; Fabio Estevam <fabio.estevam@nxp.com>;
> dl-uboot-imx <uboot-imx@nxp.com>; u-boot@lists.denx.de
> Subject: Re: [U-Boot] [PATCH 16/20] imx8m: fix sd to mmc1 and emmc to
> mmc2 for i.MX8MM
> 
> Hi Peng,
> 
> > > -----Original Message-----
> > > From: Lukasz Majewski [mailto:lukma@denx.de]
> > > Sent: 2019年1月30日 6:58
> > > To: Peng Fan <peng.fan@nxp.com>
> > > Cc: sbabic@denx.de; Fabio Estevam <fabio.estevam@nxp.com>;
> > > dl-uboot-imx <uboot-imx@nxp.com>; u-boot@lists.denx.de
> > > Subject: Re: [U-Boot] [PATCH 16/20] imx8m: fix sd to mmc1 and emmc
> > > to mmc2 for i.MX8MM
> > >
> > > Hi Peng,
> > >
> > > > Since the SD is usdhc2 and eMMC is usdhc3,
> > >
> > > Is this true on all IMX8M boards? Or is it only on the development
> > > kit you do have?
> >
> > This is a hack for board, needs to be fixed in next version.
> >
> > >
> > > My point is that this shall be setup by DTS aliases or maybe by
> > > Kconfig option.
> >
> > Could you share more information?
> 
> For example:
> 
> / {
> 	model = "K+P iMX6Q";
> 	compatible = "kp,imx6-kp", "fsl,imx6";
> 
> 	aliases {
> 		mmc0 = &usdhc2;
> 		mmc1 = &usdhc4;
> 		usb1 = &usbh1;
> 	};
> 
> 	chosen {
> 		stdout-path = &uart1;
> 	};
> 
> 
> And the "aliases" set the order in which you get the devices (like mmc0,
> mmc1 above).

Then we need SPL to have Device tree support, right?

Thanks,
Peng.

> 
> >
> > Thanks,
> > Peng.
> >
> > >
> > > > this cause mapping problem
> > > > for spl_boot_device. So far hard coded them to correct MMC index,
> > > > so that SD and eMMC boot can work.
> > > >
> > > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > > ---
> > > >  arch/arm/mach-imx/spl.c | 9 +++++++++
> > > >  1 file changed, 9 insertions(+)
> > > >
> > > > diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
> > > > index ebd8ff9290..0048832be8 100644
> > > > --- a/arch/arm/mach-imx/spl.c
> > > > +++ b/arch/arm/mach-imx/spl.c
> > > > @@ -147,9 +147,18 @@ u32 spl_boot_device(void)
> > > >  	case SD1_BOOT:
> > > >  	case MMC1_BOOT:
> > > >  		return BOOT_DEVICE_MMC1;
> > > > +#if defined(CONFIG_IMX8MM)
> > > > +	case SD2_BOOT:
> > > > +	case MMC2_BOOT:
> > > > +		return BOOT_DEVICE_MMC1;
> > > > +	case SD3_BOOT:
> > > > +	case MMC3_BOOT:
> > > > +		return BOOT_DEVICE_MMC2;
> > > > +#else
> > > >  	case SD2_BOOT:
> > > >  	case MMC2_BOOT:
> > > >  		return BOOT_DEVICE_MMC2;
> > > > +#endif
> > > >  #endif
> > > >  	case NAND_BOOT:
> > > >  		return BOOT_DEVICE_NAND;
> > >
> > >
> > >
> > >
> > > Best regards,
> > >
> > > Lukasz Majewski
> > >
> > > --
> > >
> > > DENX Software Engineering GmbH,      Managing Director: Wolfgang
> > > Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell,
> > > Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> > > lukma@denx.de
> 
> 
> 
> 
> Best regards,
> 
> Lukasz Majewski
> 
> --
> 
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> lukma@denx.de
Lukasz Majewski Jan. 30, 2019, 8:19 a.m. UTC | #6
Hi Peng,

> > -----Original Message-----
> > From: Lukasz Majewski [mailto:lukma@denx.de]
> > Sent: 2019年1月30日 14:50
> > To: Peng Fan <peng.fan@nxp.com>
> > Cc: sbabic@denx.de; Fabio Estevam <fabio.estevam@nxp.com>;
> > dl-uboot-imx <uboot-imx@nxp.com>; u-boot@lists.denx.de
> > Subject: Re: [U-Boot] [PATCH 16/20] imx8m: fix sd to mmc1 and emmc
> > to mmc2 for i.MX8MM
> > 
> > Hi Peng,
> >   
> > > > -----Original Message-----
> > > > From: Lukasz Majewski [mailto:lukma@denx.de]
> > > > Sent: 2019年1月30日 6:58
> > > > To: Peng Fan <peng.fan@nxp.com>
> > > > Cc: sbabic@denx.de; Fabio Estevam <fabio.estevam@nxp.com>;
> > > > dl-uboot-imx <uboot-imx@nxp.com>; u-boot@lists.denx.de
> > > > Subject: Re: [U-Boot] [PATCH 16/20] imx8m: fix sd to mmc1 and
> > > > emmc to mmc2 for i.MX8MM
> > > >
> > > > Hi Peng,
> > > >  
> > > > > Since the SD is usdhc2 and eMMC is usdhc3,  
> > > >
> > > > Is this true on all IMX8M boards? Or is it only on the
> > > > development kit you do have?  
> > >
> > > This is a hack for board, needs to be fixed in next version.
> > >  
> > > >
> > > > My point is that this shall be setup by DTS aliases or maybe by
> > > > Kconfig option.  
> > >
> > > Could you share more information?  
> > 
> > For example:
> > 
> > / {
> > 	model = "K+P iMX6Q";
> > 	compatible = "kp,imx6-kp", "fsl,imx6";
> > 
> > 	aliases {
> > 		mmc0 = &usdhc2;
> > 		mmc1 = &usdhc4;
> > 		usb1 = &usbh1;
> > 	};
> > 
> > 	chosen {
> > 		stdout-path = &uart1;
> > 	};
> > 
> > 
> > And the "aliases" set the order in which you get the devices (like
> > mmc0, mmc1 above).  
> 
> Then we need SPL to have Device tree support, right?

Yes, this would be the easiest way to support this feature.

If your board doesn't have any footprint constraints (and boottime)
then IMHO it would be worth to switch to full (including SPL)
conversion to DM/DTS.

Other option would be to provide such configuration via Kconfig or
define spl_boot_device(void) in board's file.

> 
> Thanks,
> Peng.
> 
> >   
> > >
> > > Thanks,
> > > Peng.
> > >  
> > > >  
> > > > > this cause mapping problem
> > > > > for spl_boot_device. So far hard coded them to correct MMC
> > > > > index, so that SD and eMMC boot can work.
> > > > >
> > > > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > > > ---
> > > > >  arch/arm/mach-imx/spl.c | 9 +++++++++
> > > > >  1 file changed, 9 insertions(+)
> > > > >
> > > > > diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
> > > > > index ebd8ff9290..0048832be8 100644
> > > > > --- a/arch/arm/mach-imx/spl.c
> > > > > +++ b/arch/arm/mach-imx/spl.c
> > > > > @@ -147,9 +147,18 @@ u32 spl_boot_device(void)
> > > > >  	case SD1_BOOT:
> > > > >  	case MMC1_BOOT:
> > > > >  		return BOOT_DEVICE_MMC1;
> > > > > +#if defined(CONFIG_IMX8MM)
> > > > > +	case SD2_BOOT:
> > > > > +	case MMC2_BOOT:
> > > > > +		return BOOT_DEVICE_MMC1;
> > > > > +	case SD3_BOOT:
> > > > > +	case MMC3_BOOT:
> > > > > +		return BOOT_DEVICE_MMC2;
> > > > > +#else
> > > > >  	case SD2_BOOT:
> > > > >  	case MMC2_BOOT:
> > > > >  		return BOOT_DEVICE_MMC2;
> > > > > +#endif
> > > > >  #endif
> > > > >  	case NAND_BOOT:
> > > > >  		return BOOT_DEVICE_NAND;  
> > > >
> > > >
> > > >
> > > >
> > > > Best regards,
> > > >
> > > > Lukasz Majewski
> > > >
> > > > --
> > > >
> > > > DENX Software Engineering GmbH,      Managing Director: Wolfgang
> > > > Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194
> > > > Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
> > > > (+49)-8142-66989-80 Email: lukma@denx.de  
> > 
> > 
> > 
> > 
> > Best regards,
> > 
> > Lukasz Majewski
> > 
> > --
> > 
> > DENX Software Engineering GmbH,      Managing Director: Wolfgang
> > Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell,
> > Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> > lukma@denx.de  




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
diff mbox series

Patch

diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index ebd8ff9290..0048832be8 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -147,9 +147,18 @@  u32 spl_boot_device(void)
 	case SD1_BOOT:
 	case MMC1_BOOT:
 		return BOOT_DEVICE_MMC1;
+#if defined(CONFIG_IMX8MM)
+	case SD2_BOOT:
+	case MMC2_BOOT:
+		return BOOT_DEVICE_MMC1;
+	case SD3_BOOT:
+	case MMC3_BOOT:
+		return BOOT_DEVICE_MMC2;
+#else
 	case SD2_BOOT:
 	case MMC2_BOOT:
 		return BOOT_DEVICE_MMC2;
+#endif
 #endif
 	case NAND_BOOT:
 		return BOOT_DEVICE_NAND;