* [U-Boot] [PATCH] mx7dsabresd: Make 'ums' command functional
@ 2016-02-17 15:34 Fabio Estevam
2016-02-21 10:13 ` Stefano Babic
0 siblings, 1 reply; 2+ messages in thread
From: Fabio Estevam @ 2016-02-17 15:34 UTC (permalink / raw)
To: u-boot
When running the 'ums' command we get:
=> ums 0 mmc 0
UMS: disk start sector: 0x0, count: 0xe18000
g_dnl_register: failed!, error: -22
ERROR: g_dnl_register failed
at common/cmd_usb_mass_storage.c:107/do_usb_mass_storage()
Fix this by initializing USB OTG1 port as USB device mode instead of host.
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
board/freescale/mx7dsabresd/mx7dsabresd.c | 41 ++++++++++++++-----------------
1 file changed, 18 insertions(+), 23 deletions(-)
diff --git a/board/freescale/mx7dsabresd/mx7dsabresd.c b/board/freescale/mx7dsabresd/mx7dsabresd.c
index fee24e2..4d0b195 100644
--- a/board/freescale/mx7dsabresd/mx7dsabresd.c
+++ b/board/freescale/mx7dsabresd/mx7dsabresd.c
@@ -23,6 +23,7 @@
#include <i2c.h>
#include <asm/imx-common/mxc_i2c.h>
#include <asm/arch/crm_regs.h>
+#include <usb.h>
#include <usb/ehci-fsl.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -111,6 +112,14 @@ static iomux_v3_cfg_t const usdhc3_emmc_pads[] = {
MX7D_PAD_SD3_RESET_B__GPIO6_IO11 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
};
+static iomux_v3_cfg_t const usb_otg1_pads[] = {
+ MX7D_PAD_GPIO1_IO05__USB_OTG1_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
+};
+
+static iomux_v3_cfg_t const usb_otg2_pads[] = {
+ MX7D_PAD_UART3_CTS_B__USB_OTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
+};
+
#define IOX_SDI IMX_GPIO_NR(1, 9)
#define IOX_STCP IMX_GPIO_NR(1, 12)
#define IOX_SHCP IMX_GPIO_NR(1, 13)
@@ -511,6 +520,10 @@ int board_early_init_f(void)
setup_iomux_uart();
setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
+ imx_iomux_v3_setup_multiple_pads(usb_otg1_pads,
+ ARRAY_SIZE(usb_otg1_pads));
+ imx_iomux_v3_setup_multiple_pads(usb_otg2_pads,
+ ARRAY_SIZE(usb_otg2_pads));
return 0;
}
@@ -602,29 +615,11 @@ int checkboard(void)
}
#ifdef CONFIG_USB_EHCI_MX7
-static iomux_v3_cfg_t const usb_otg1_pads[] = {
- MX7D_PAD_GPIO1_IO05__USB_OTG1_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
-};
-
-static iomux_v3_cfg_t const usb_otg2_pads[] = {
- MX7D_PAD_UART3_CTS_B__USB_OTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
-};
-
-int board_ehci_hcd_init(int port)
+int board_usb_phy_mode(int port)
{
- switch (port) {
- case 0:
- imx_iomux_v3_setup_multiple_pads(usb_otg1_pads,
- ARRAY_SIZE(usb_otg1_pads));
- break;
- case 1:
- imx_iomux_v3_setup_multiple_pads(usb_otg2_pads,
- ARRAY_SIZE(usb_otg2_pads));
- break;
- default:
- printf("MXC USB port %d not yet supported\n", port);
- return -EINVAL;
- }
- return 0;
+ if (port == 0)
+ return USB_INIT_DEVICE;
+ else
+ return USB_INIT_HOST;
}
#endif
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH] mx7dsabresd: Make 'ums' command functional
2016-02-17 15:34 [U-Boot] [PATCH] mx7dsabresd: Make 'ums' command functional Fabio Estevam
@ 2016-02-21 10:13 ` Stefano Babic
0 siblings, 0 replies; 2+ messages in thread
From: Stefano Babic @ 2016-02-21 10:13 UTC (permalink / raw)
To: u-boot
On 17/02/2016 16:34, Fabio Estevam wrote:
> When running the 'ums' command we get:
>
> => ums 0 mmc 0
> UMS: disk start sector: 0x0, count: 0xe18000
> g_dnl_register: failed!, error: -22
> ERROR: g_dnl_register failed
> at common/cmd_usb_mass_storage.c:107/do_usb_mass_storage()
>
> Fix this by initializing USB OTG1 port as USB device mode instead of host.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---
> board/freescale/mx7dsabresd/mx7dsabresd.c | 41 ++++++++++++++-----------------
> 1 file changed, 18 insertions(+), 23 deletions(-)
>
> diff --git a/board/freescale/mx7dsabresd/mx7dsabresd.c b/board/freescale/mx7dsabresd/mx7dsabresd.c
> index fee24e2..4d0b195 100644
> --- a/board/freescale/mx7dsabresd/mx7dsabresd.c
> +++ b/board/freescale/mx7dsabresd/mx7dsabresd.c
> @@ -23,6 +23,7 @@
> #include <i2c.h>
> #include <asm/imx-common/mxc_i2c.h>
> #include <asm/arch/crm_regs.h>
> +#include <usb.h>
> #include <usb/ehci-fsl.h>
>
> DECLARE_GLOBAL_DATA_PTR;
> @@ -111,6 +112,14 @@ static iomux_v3_cfg_t const usdhc3_emmc_pads[] = {
> MX7D_PAD_SD3_RESET_B__GPIO6_IO11 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
> };
>
> +static iomux_v3_cfg_t const usb_otg1_pads[] = {
> + MX7D_PAD_GPIO1_IO05__USB_OTG1_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
> +};
> +
> +static iomux_v3_cfg_t const usb_otg2_pads[] = {
> + MX7D_PAD_UART3_CTS_B__USB_OTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
> +};
> +
> #define IOX_SDI IMX_GPIO_NR(1, 9)
> #define IOX_STCP IMX_GPIO_NR(1, 12)
> #define IOX_SHCP IMX_GPIO_NR(1, 13)
> @@ -511,6 +520,10 @@ int board_early_init_f(void)
> setup_iomux_uart();
>
> setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
> + imx_iomux_v3_setup_multiple_pads(usb_otg1_pads,
> + ARRAY_SIZE(usb_otg1_pads));
> + imx_iomux_v3_setup_multiple_pads(usb_otg2_pads,
> + ARRAY_SIZE(usb_otg2_pads));
>
> return 0;
> }
> @@ -602,29 +615,11 @@ int checkboard(void)
> }
>
> #ifdef CONFIG_USB_EHCI_MX7
> -static iomux_v3_cfg_t const usb_otg1_pads[] = {
> - MX7D_PAD_GPIO1_IO05__USB_OTG1_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
> -};
> -
> -static iomux_v3_cfg_t const usb_otg2_pads[] = {
> - MX7D_PAD_UART3_CTS_B__USB_OTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
> -};
> -
> -int board_ehci_hcd_init(int port)
> +int board_usb_phy_mode(int port)
> {
> - switch (port) {
> - case 0:
> - imx_iomux_v3_setup_multiple_pads(usb_otg1_pads,
> - ARRAY_SIZE(usb_otg1_pads));
> - break;
> - case 1:
> - imx_iomux_v3_setup_multiple_pads(usb_otg2_pads,
> - ARRAY_SIZE(usb_otg2_pads));
> - break;
> - default:
> - printf("MXC USB port %d not yet supported\n", port);
> - return -EINVAL;
> - }
> - return 0;
> + if (port == 0)
> + return USB_INIT_DEVICE;
> + else
> + return USB_INIT_HOST;
> }
> #endif
>
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
--
=====================================================================
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] 2+ messages in thread
end of thread, other threads:[~2016-02-21 10:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-17 15:34 [U-Boot] [PATCH] mx7dsabresd: Make 'ums' command functional Fabio Estevam
2016-02-21 10:13 ` Stefano Babic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox