All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] pico-imx6ul: Fix eMMC boot after DM_MMC conversion
@ 2019-03-21 13:59 Fabio Estevam
  2019-03-27  9:23 ` Lukasz Majewski
  2019-03-30 20:59 ` Fabio Estevam
  0 siblings, 2 replies; 6+ messages in thread
From: Fabio Estevam @ 2019-03-21 13:59 UTC (permalink / raw)
  To: u-boot

After the DM_MMC conversion the following eMMC boot error is observed:

U-Boot SPL 2019.04-rc4 (Mar 20 2019 - 18:53:28 +0000)
Trying to boot from MMC1
MMC Device 0 not found
spl: could not find mmc device 0. error: -19
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

This happens because the SPL code does not initialize the SDHC pins
and clock.

Fix it by moving the original eMMC initialization from U-Boot proper
to SPL.

Reported-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Fabio Berton <fabio.berton@ossystems.com.br>
Reviewed-by: Otavio Salvador <otavio@ossystems.com.br>
---
 board/technexion/pico-imx6ul/spl.c | 34 ++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/board/technexion/pico-imx6ul/spl.c b/board/technexion/pico-imx6ul/spl.c
index 6464a32d3b..f972cc9eaf 100644
--- a/board/technexion/pico-imx6ul/spl.c
+++ b/board/technexion/pico-imx6ul/spl.c
@@ -10,6 +10,7 @@
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/boot_mode.h>
+#include <fsl_esdhc.h>
 #include <linux/libfdt.h>
 #include <spl.h>
 
@@ -141,4 +142,37 @@ void board_init_f(ulong dummy)
 void reset_cpu(ulong addr)
 {
 }
+
+#define USDHC_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE |		\
+	PAD_CTL_PUS_22K_UP  | PAD_CTL_SPEED_LOW |		\
+	PAD_CTL_DSE_80ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
+
+static iomux_v3_cfg_t const usdhc1_pads[] = {
+	MX6_PAD_SD1_CLK__USDHC1_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_SD1_CMD__USDHC1_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_SD1_DATA0__USDHC1_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_SD1_DATA1__USDHC1_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_SD1_DATA2__USDHC1_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_SD1_DATA3__USDHC1_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_NAND_READY_B__USDHC1_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_NAND_CE0_B__USDHC1_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_NAND_CE1_B__USDHC1_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+	MX6_PAD_NAND_CLE__USDHC1_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+};
+
+static struct fsl_esdhc_cfg usdhc_cfg[1] = {
+	{USDHC1_BASE_ADDR},
+};
+
+int board_mmc_getcd(struct mmc *mmc)
+{
+	return 1;
+}
+
+int board_mmc_init(bd_t *bis)
+{
+	imx_iomux_v3_setup_multiple_pads(usdhc1_pads, ARRAY_SIZE(usdhc1_pads));
+	usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
+	return fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
+}
 #endif
-- 
2.17.1

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

* [U-Boot] [PATCH] pico-imx6ul: Fix eMMC boot after DM_MMC conversion
  2019-03-21 13:59 [U-Boot] [PATCH] pico-imx6ul: Fix eMMC boot after DM_MMC conversion Fabio Estevam
@ 2019-03-27  9:23 ` Lukasz Majewski
  2019-03-27 12:44   ` Fabio Estevam
  2019-03-30 20:59 ` Fabio Estevam
  1 sibling, 1 reply; 6+ messages in thread
From: Lukasz Majewski @ 2019-03-27  9:23 UTC (permalink / raw)
  To: u-boot

Hi Fabio,

> After the DM_MMC conversion the following eMMC boot error is observed:
> 
> U-Boot SPL 2019.04-rc4 (Mar 20 2019 - 18:53:28 +0000)
> Trying to boot from MMC1
> MMC Device 0 not found
> spl: could not find mmc device 0. error: -19
> SPL: failed to boot from all boot devices
> ### ERROR ### Please RESET the board ###
> 
> This happens because the SPL code does not initialize the SDHC pins
> and clock.
> 
> Fix it by moving the original eMMC initialization from U-Boot proper
> to SPL.
> 
> Reported-by: Otavio Salvador <otavio@ossystems.com.br>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> Tested-by: Fabio Berton <fabio.berton@ossystems.com.br>
> Reviewed-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
>  board/technexion/pico-imx6ul/spl.c | 34
> ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
> 
> diff --git a/board/technexion/pico-imx6ul/spl.c
> b/board/technexion/pico-imx6ul/spl.c index 6464a32d3b..f972cc9eaf
> 100644 --- a/board/technexion/pico-imx6ul/spl.c
> +++ b/board/technexion/pico-imx6ul/spl.c
> @@ -10,6 +10,7 @@
>  #include <asm/gpio.h>
>  #include <asm/mach-imx/iomux-v3.h>
>  #include <asm/mach-imx/boot_mode.h>
> +#include <fsl_esdhc.h>
>  #include <linux/libfdt.h>
>  #include <spl.h>
>  
> @@ -141,4 +142,37 @@ void board_init_f(ulong dummy)
>  void reset_cpu(ulong addr)
>  {
>  }
> +
> +#define USDHC_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE |		\
> +	PAD_CTL_PUS_22K_UP  | PAD_CTL_SPEED_LOW |		\
> +	PAD_CTL_DSE_80ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
> +
> +static iomux_v3_cfg_t const usdhc1_pads[] = {
> +	MX6_PAD_SD1_CLK__USDHC1_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
> +	MX6_PAD_SD1_CMD__USDHC1_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
> +	MX6_PAD_SD1_DATA0__USDHC1_DATA0 |
> MUX_PAD_CTRL(USDHC_PAD_CTRL),
> +	MX6_PAD_SD1_DATA1__USDHC1_DATA1 |
> MUX_PAD_CTRL(USDHC_PAD_CTRL),
> +	MX6_PAD_SD1_DATA2__USDHC1_DATA2 |
> MUX_PAD_CTRL(USDHC_PAD_CTRL),
> +	MX6_PAD_SD1_DATA3__USDHC1_DATA3 |
> MUX_PAD_CTRL(USDHC_PAD_CTRL),
> +	MX6_PAD_NAND_READY_B__USDHC1_DATA4 |
> MUX_PAD_CTRL(USDHC_PAD_CTRL),
> +	MX6_PAD_NAND_CE0_B__USDHC1_DATA5 |
> MUX_PAD_CTRL(USDHC_PAD_CTRL),
> +	MX6_PAD_NAND_CE1_B__USDHC1_DATA6 |
> MUX_PAD_CTRL(USDHC_PAD_CTRL),
> +	MX6_PAD_NAND_CLE__USDHC1_DATA7 |
> MUX_PAD_CTRL(USDHC_PAD_CTRL), +};
> +
> +static struct fsl_esdhc_cfg usdhc_cfg[1] = {
> +	{USDHC1_BASE_ADDR},
> +};
> +
> +int board_mmc_getcd(struct mmc *mmc)
> +{
> +	return 1;
> +}
> +
> +int board_mmc_init(bd_t *bis)
> +{
> +	imx_iomux_v3_setup_multiple_pads(usdhc1_pads,
> ARRAY_SIZE(usdhc1_pads));
> +	usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
> +	return fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
> +}
>  #endif

This seems like a temporary solution - the u-boot proper is converted
to use DM_MMC, but the pinmux setup code is moved to SPL instead.

The proper solution would be to add support for pinmux in SPL and
setup those pins there.

Something similar to:
http://patchwork.ozlabs.org/cover/1019842/

But this patch series shall not be regarded as a template for the
conversion as some of those patches have been superseded (like clock
with CCF clock, FEC setup).

However, the pinctrl/eMMC shall be a good example.

The other question is if imx6ul has enough resources to use such
feature-rich SPL.


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 at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190327/6446a155/attachment.sig>

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

* [U-Boot] [PATCH] pico-imx6ul: Fix eMMC boot after DM_MMC conversion
  2019-03-27  9:23 ` Lukasz Majewski
@ 2019-03-27 12:44   ` Fabio Estevam
  2019-03-27 13:20     ` Lukasz Majewski
  0 siblings, 1 reply; 6+ messages in thread
From: Fabio Estevam @ 2019-03-27 12:44 UTC (permalink / raw)
  To: u-boot

Hi Lukasz,

On Wed, Mar 27, 2019 at 6:23 AM Lukasz Majewski <lukma@denx.de> wrote:

> This seems like a temporary solution - the u-boot proper is converted
> to use DM_MMC, but the pinmux setup code is moved to SPL instead.
>
> The proper solution would be to add support for pinmux in SPL and
> setup those pins there.

Thanks for the suggestion.

The problem is that we are too close of 2019.04 and pico-mx6ul is
currently broken.

This is the least invasive fix we can have to avoid breakage at the moment.

Can we go with this patch for 2019.04 and then revisit the pinctrl
setting in SPL afterwards?

Thanks

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

* [U-Boot] [PATCH] pico-imx6ul: Fix eMMC boot after DM_MMC conversion
  2019-03-27 12:44   ` Fabio Estevam
@ 2019-03-27 13:20     ` Lukasz Majewski
  0 siblings, 0 replies; 6+ messages in thread
From: Lukasz Majewski @ 2019-03-27 13:20 UTC (permalink / raw)
  To: u-boot

Hi Fabio,

> Hi Lukasz,
> 
> On Wed, Mar 27, 2019 at 6:23 AM Lukasz Majewski <lukma@denx.de> wrote:
> 
> > This seems like a temporary solution - the u-boot proper is
> > converted to use DM_MMC, but the pinmux setup code is moved to SPL
> > instead.
> >
> > The proper solution would be to add support for pinmux in SPL and
> > setup those pins there.  
> 
> Thanks for the suggestion.
> 
> The problem is that we are too close of 2019.04 and pico-mx6ul is
> currently broken.
> 
> This is the least invasive fix we can have to avoid breakage at the
> moment.

I see. Let's fix the board first before release.

> 
> Can we go with this patch for 2019.04 and then revisit the pinctrl
> setting in SPL afterwards?

Yes, no problem. I just wanted to show that a similar work has been
done previously.

> 
> Thanks




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 at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190327/4e2ef7f2/attachment.sig>

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

* [U-Boot] [PATCH] pico-imx6ul: Fix eMMC boot after DM_MMC conversion
  2019-03-21 13:59 [U-Boot] [PATCH] pico-imx6ul: Fix eMMC boot after DM_MMC conversion Fabio Estevam
  2019-03-27  9:23 ` Lukasz Majewski
@ 2019-03-30 20:59 ` Fabio Estevam
  2019-03-31 18:23   ` Stefano Babic
  1 sibling, 1 reply; 6+ messages in thread
From: Fabio Estevam @ 2019-03-30 20:59 UTC (permalink / raw)
  To: u-boot

Hi Stefano,

On Thu, Mar 21, 2019 at 10:59 AM Fabio Estevam <festevam@gmail.com> wrote:
>
> After the DM_MMC conversion the following eMMC boot error is observed:
>
> U-Boot SPL 2019.04-rc4 (Mar 20 2019 - 18:53:28 +0000)
> Trying to boot from MMC1
> MMC Device 0 not found
> spl: could not find mmc device 0. error: -19
> SPL: failed to boot from all boot devices
> ### ERROR ### Please RESET the board ###
>
> This happens because the SPL code does not initialize the SDHC pins
> and clock.
>
> Fix it by moving the original eMMC initialization from U-Boot proper
> to SPL.
>
> Reported-by: Otavio Salvador <otavio@ossystems.com.br>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> Tested-by: Fabio Berton <fabio.berton@ossystems.com.br>
> Reviewed-by: Otavio Salvador <otavio@ossystems.com.br>

Could you please consider this one for 2019.04?

It is needed to fix a boot regression after DM conversion.

Thanks

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

* [U-Boot] [PATCH] pico-imx6ul: Fix eMMC boot after DM_MMC conversion
  2019-03-30 20:59 ` Fabio Estevam
@ 2019-03-31 18:23   ` Stefano Babic
  0 siblings, 0 replies; 6+ messages in thread
From: Stefano Babic @ 2019-03-31 18:23 UTC (permalink / raw)
  To: u-boot

Hi Fabio,

On 30/03/19 21:59, Fabio Estevam wrote:
> Hi Stefano,
> 
> On Thu, Mar 21, 2019 at 10:59 AM Fabio Estevam <festevam@gmail.com> wrote:
>>
>> After the DM_MMC conversion the following eMMC boot error is observed:
>>
>> U-Boot SPL 2019.04-rc4 (Mar 20 2019 - 18:53:28 +0000)
>> Trying to boot from MMC1
>> MMC Device 0 not found
>> spl: could not find mmc device 0. error: -19
>> SPL: failed to boot from all boot devices
>> ### ERROR ### Please RESET the board ###
>>
>> This happens because the SPL code does not initialize the SDHC pins
>> and clock.
>>
>> Fix it by moving the original eMMC initialization from U-Boot proper
>> to SPL.
>>
>> Reported-by: Otavio Salvador <otavio@ossystems.com.br>
>> Signed-off-by: Fabio Estevam <festevam@gmail.com>
>> Tested-by: Fabio Berton <fabio.berton@ossystems.com.br>
>> Reviewed-by: Otavio Salvador <otavio@ossystems.com.br>
> 
> Could you please consider this one for 2019.04?
> 
> It is needed to fix a boot regression after DM conversion.
> 
> Thanks
> 

I picked up this and other fixes for the release - when Travis has
finished, I will send PR to Tom.

Regards,
Stefano

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

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

end of thread, other threads:[~2019-03-31 18:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-21 13:59 [U-Boot] [PATCH] pico-imx6ul: Fix eMMC boot after DM_MMC conversion Fabio Estevam
2019-03-27  9:23 ` Lukasz Majewski
2019-03-27 12:44   ` Fabio Estevam
2019-03-27 13:20     ` Lukasz Majewski
2019-03-30 20:59 ` Fabio Estevam
2019-03-31 18:23   ` Stefano Babic

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.