[U-Boot] [PATCH V2] imx: mx6slevk: fix mmc breakage

Log: " MMC Device 1 not found *** Warning - No MMC card found, using default environment " Add alias node for usdhc. Cleaned up board usb code.
Test: => usb tree USB device tree: 1 Hub (480 Mb/s, 0mA) | u-boot EHCI Host Controller | +-2 Mass Storage (480 Mb/s, 500mA) Generic USB Storage 000000000207
1 Hub (480 Mb/s, 0mA) | u-boot EHCI Host Controller | +-2 Mass Storage (480 Mb/s, 500mA) Generic USB2.0-CRW 20090815198100000
=> mmc list FSL_SDHC: 0 FSL_SDHC: 1 (SD) FSL_SDHC: 2
Signed-off-by: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de Cc: Fabio Estevam fabio.estevam@nxp.com ---
V2: Based on Fabio's patches: 1. https://patchwork.ozlabs.org/patch/825464/ 2. https://patchwork.ozlabs.org/patch/825039/
arch/arm/dts/imx6sl.dtsi | 4 +++ board/freescale/mx6slevk/mx6slevk.c | 49 ------------------------------------- 2 files changed, 4 insertions(+), 49 deletions(-)
diff --git a/arch/arm/dts/imx6sl.dtsi b/arch/arm/dts/imx6sl.dtsi index cc9572e..ac2f676 100644 --- a/arch/arm/dts/imx6sl.dtsi +++ b/arch/arm/dts/imx6sl.dtsi @@ -30,6 +30,10 @@ gpio2 = &gpio3; gpio3 = &gpio4; gpio4 = &gpio5; + mmc0 = &usdhc1; + mmc1 = &usdhc2; + mmc2 = &usdhc3; + mmc3 = &usdhc4; serial0 = &uart1; serial1 = &uart2; serial2 = &uart3; diff --git a/board/freescale/mx6slevk/mx6slevk.c b/board/freescale/mx6slevk/mx6slevk.c index 8afd5da..0597dbe 100644 --- a/board/freescale/mx6slevk/mx6slevk.c +++ b/board/freescale/mx6slevk/mx6slevk.c @@ -27,8 +27,6 @@ #include <power/pmic.h> #include <power/pfuze100_pmic.h> #include "../common/pfuze.h" -#include <usb.h> -#include <usb/ehci-ci.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -223,49 +221,6 @@ static int setup_fec(void) } #endif
-#ifdef CONFIG_USB_EHCI_MX6 -#define USB_OTHERREGS_OFFSET 0x800 -#define UCTRL_PWR_POL (1 << 9) - -static iomux_v3_cfg_t const usb_otg_pads[] = { - /* OTG1 */ - MX6_PAD_KEY_COL4__USB_USBOTG1_PWR | MUX_PAD_CTRL(NO_PAD_CTRL), - MX6_PAD_EPDC_PWRCOM__ANATOP_USBOTG1_ID | MUX_PAD_CTRL(OTGID_PAD_CTRL), - /* OTG2 */ - MX6_PAD_KEY_COL5__USB_USBOTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL) -}; - -static void setup_usb(void) -{ - imx_iomux_v3_setup_multiple_pads(usb_otg_pads, - ARRAY_SIZE(usb_otg_pads)); -} - -int board_usb_phy_mode(int port) -{ - if (port == 1) - return USB_INIT_HOST; - else - return usb_phy_mode(port); -} - -int board_ehci_hcd_init(int port) -{ - u32 *usbnc_usb_ctrl; - - if (port > 1) - return -EINVAL; - - usbnc_usb_ctrl = (u32 *)(USB_BASE_ADDR + USB_OTHERREGS_OFFSET + - port * 4); - - /* Set Power polarity */ - setbits_le32(usbnc_usb_ctrl, UCTRL_PWR_POL); - - return 0; -} -#endif - int board_early_init_f(void) { setup_iomux_uart(); @@ -287,10 +242,6 @@ int board_init(void) setup_fec(); #endif
-#ifdef CONFIG_USB_EHCI_MX6 - setup_usb(); -#endif - return 0; }

Hi Peng,
Subject should be changed as you are no longer fixing a MMC breakage.
On Mon, Oct 16, 2017 at 10:23 AM, Peng Fan peng.fan@nxp.com wrote:
Log: " MMC Device 1 not found *** Warning - No MMC card found, using default environment
This message should be removed as you are no longer fixing a MMC breakage.
" Add alias node for usdhc.
Why? Please explain why you need the alias. What happens if the alias is not added?
Upstream dts file does not have the alias either, so why should we diverge from upstream dts?
Also, as far as I recall the mmc alias mechanism does not work in the kernel.
We cannot guarantee the probe ordering and we should use UUID to specify the rootfs location.
Cleaned up board usb code.
This part is fine and you could do a patch doing only this USB board code removal.
Thanks

Hi Fabio
-----Original Message----- From: Fabio Estevam [mailto:festevam@gmail.com] Sent: Tuesday, October 17, 2017 12:15 AM To: Peng Fan peng.fan@nxp.com Cc: Stefano Babic sbabic@denx.de; Fabio Estevam fabio.estevam@nxp.com; U-Boot-Denx u-boot@lists.denx.de Subject: Re: [U-Boot] [PATCH V2] imx: mx6slevk: fix mmc breakage
Hi Peng,
Subject should be changed as you are no longer fixing a MMC breakage.
On Mon, Oct 16, 2017 at 10:23 AM, Peng Fan peng.fan@nxp.com wrote:
Log: " MMC Device 1 not found *** Warning - No MMC card found, using default environment
This message should be removed as you are no longer fixing a MMC breakage.
" Add alias node for usdhc.
Why? Please explain why you need the alias. What happens if the alias is not added?
Upstream dts file does not have the alias either, so why should we diverge from upstream dts?
When adding DM support, I add this piece code in fsl_esdhc.c /* * TODO: * Because lack of clk driver, if SDHC clk is not enabled, * need to enable it first before this driver is invoked. * * we use MXC_ESDHC_CLK to get clk freq. * If one would like to make this function work, * the aliases should be provided in dts as this: * * aliases { * mmc0 = &usdhc1; * mmc1 = &usdhc2; * mmc2 = &usdhc3; * mmc3 = &usdhc4; * }; * Then if your board only supports mmc2 and mmc3, but we can * correctly get the seq as 2 and 3, then let mxc_get_clock * work as expected. */
init_clk_usdhc(dev->seq);
priv->sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK + dev->seq);
If no alias node, the dev->seq maybe wrong.
Also, as far as I recall the mmc alias mechanism does not work in the kernel.
We cannot guarantee the probe ordering and we should use UUID to specify the rootfs location.
Cleaned up board usb code.
This part is fine and you could do a patch doing only this USB board code removal.
Ok. I'll do a cleanup patch for usb part.
Regards, Peng.
Thanks
participants (2)
-
Fabio Estevam
-
Peng Fan