diff mbox

[U-Boot,20/20] M28EVK: Enable USB HOST support

Message ID 1320830307-4762-21-git-send-email-marek.vasut@gmail.com
State Awaiting Upstream
Delegated to: Stefano Babic
Headers show

Commit Message

Marek Vasut Nov. 9, 2011, 9:18 a.m. UTC
This enables the second port, aka. the port with the USB connector on the
M28EVK.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>
---
 board/denx/m28evk/m28evk.c |    7 +++++++
 include/configs/m28evk.h   |   12 ++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

Comments

Stefano Babic Nov. 10, 2011, 1:16 p.m. UTC | #1
On 11/09/2011 10:18 AM, Marek Vasut wrote:
> This enables the second port, aka. the port with the USB connector on the
> M28EVK.
> 
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Wolfgang Denk <wd@denx.de>
> Cc: Detlev Zundel <dzu@denx.de>
> Cc: Remy Bohmer <linux@bohmer.net>
> ---
>  board/denx/m28evk/m28evk.c |    7 +++++++
>  include/configs/m28evk.h   |   12 ++++++++++++
>  2 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/board/denx/m28evk/m28evk.c b/board/denx/m28evk/m28evk.c
> index 168ceeb..8cf3dc9 100644
> --- a/board/denx/m28evk/m28evk.c
> +++ b/board/denx/m28evk/m28evk.c
> @@ -52,6 +52,13 @@ int board_early_init_f(void)
>  	/* SSP2 clock at 96MHz */
>  	mx28_set_sspclk(MXC_SSPCLK2, 96000, 0);
>  
> +#ifdef	CONFIG_CMD_USB
> +	mxs_iomux_setup_pad(MX28_PAD_SSP2_SS1__USB1_OVERCURRENT);
> +	mxs_iomux_setup_pad(MX28_PAD_AUART3_TX__GPIO_3_13 |
> +			MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP);
> +	gpio_direction_output(MX28_PAD_AUART3_TX__GPIO_3_13, 0);
> +#endif
> +
>  	return 0;
>  }
>  
> diff --git a/include/configs/m28evk.h b/include/configs/m28evk.h
> index c8b0cf5..52dcd4a 100644
> --- a/include/configs/m28evk.h
> +++ b/include/configs/m28evk.h
> @@ -75,6 +75,7 @@
>  #define	CONFIG_CMD_SETEXPR
>  #define	CONFIG_CMD_SF
>  #define	CONFIG_CMD_SPI
> +#define	CONFIG_CMD_USB
>  
>  /*
>   * Memory configurations
> @@ -218,6 +219,17 @@
>  #endif
>  
>  /*
> + * USB
> + */
> +#ifdef	CONFIG_CMD_USB
> +#define	CONFIG_USB_EHCI
> +#define	CONFIG_USB_EHCI_MXS
> +#define	CONFIG_EHCI_MXS_PORT		1
> +#define	CONFIG_EHCI_IS_TDI
> +#define	CONFIG_USB_STORAGE
> +#endif
> +
> +/*
>   * SPI
>   */
>  #ifdef	CONFIG_CMD_SPI

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic
Veli-Pekka Peltola Nov. 11, 2011, 2:07 p.m. UTC | #2
Hi Marek,

On 11/09/2011 11:18 AM, Marek Vasut wrote:
> This enables the second port, aka. the port with the USB connector on the
> M28EVK.

Which version of GCC you are using? I noticed that "usb start" freezes 
after message "scanning bus for devices..." if I had memory stick 
connected. I used GCC 4.6.1 that comes with Yocto 1.1. Without stick I 
did not have any such problems. The board is very similar to M28EVK. 
With GCC 4.3.4 it works fine.

I also tested both compilers on our Atmel AT91SAM9260 based device but I 
didn't have such problems.

Any ideas how to debug this further? I noticed some comments related to 
GCC in common/usb.c before usb_set_maxpacket_ep function. I also printed 
out i and ii in usb_set_maxpacket. Results were something that I didn't 
expect:
i: 0, ii: 0
i: 0, ii: 1
i: 4, ii: -30879
i: 4, ii: -30878

--
Veli-Pekka Peltola
Marek Vasut Nov. 11, 2011, 5:49 p.m. UTC | #3
> Hi Marek,
> 
> On 11/09/2011 11:18 AM, Marek Vasut wrote:
> > This enables the second port, aka. the port with the USB connector on the
> > M28EVK.
> 
> Which version of GCC you are using? I noticed that "usb start" freezes
> after message "scanning bus for devices..." if I had memory stick
> connected. I used GCC 4.6.1 that comes with Yocto 1.1. Without stick I
> did not have any such problems. The board is very similar to M28EVK.
> With GCC 4.3.4 it works fine.
> 
> I also tested both compilers on our Atmel AT91SAM9260 based device but I
> didn't have such problems.
> 
> Any ideas how to debug this further? I noticed some comments related to
> GCC in common/usb.c before usb_set_maxpacket_ep function. I also printed
> out i and ii in usb_set_maxpacket. Results were something that I didn't
> expect:
> i: 0, ii: 0
> i: 0, ii: 1
> i: 4, ii: -30879
> i: 4, ii: -30878
> 
> --
> Veli-Pekka Peltola

Can you try this patch please:

Subject: [PATCH] GCC4.6: Fix common/usb.c on xscale
Message-Id: <1320532609-2408-1-git-send-email-marek.vasut@gmail.com>

I had the same issue with gcc4.6 on xscale, if it fixes your problem, can you 
also try with 3.4.3 and give me your ACK?

M
diff mbox

Patch

diff --git a/board/denx/m28evk/m28evk.c b/board/denx/m28evk/m28evk.c
index 168ceeb..8cf3dc9 100644
--- a/board/denx/m28evk/m28evk.c
+++ b/board/denx/m28evk/m28evk.c
@@ -52,6 +52,13 @@  int board_early_init_f(void)
 	/* SSP2 clock at 96MHz */
 	mx28_set_sspclk(MXC_SSPCLK2, 96000, 0);
 
+#ifdef	CONFIG_CMD_USB
+	mxs_iomux_setup_pad(MX28_PAD_SSP2_SS1__USB1_OVERCURRENT);
+	mxs_iomux_setup_pad(MX28_PAD_AUART3_TX__GPIO_3_13 |
+			MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP);
+	gpio_direction_output(MX28_PAD_AUART3_TX__GPIO_3_13, 0);
+#endif
+
 	return 0;
 }
 
diff --git a/include/configs/m28evk.h b/include/configs/m28evk.h
index c8b0cf5..52dcd4a 100644
--- a/include/configs/m28evk.h
+++ b/include/configs/m28evk.h
@@ -75,6 +75,7 @@ 
 #define	CONFIG_CMD_SETEXPR
 #define	CONFIG_CMD_SF
 #define	CONFIG_CMD_SPI
+#define	CONFIG_CMD_USB
 
 /*
  * Memory configurations
@@ -218,6 +219,17 @@ 
 #endif
 
 /*
+ * USB
+ */
+#ifdef	CONFIG_CMD_USB
+#define	CONFIG_USB_EHCI
+#define	CONFIG_USB_EHCI_MXS
+#define	CONFIG_EHCI_MXS_PORT		1
+#define	CONFIG_EHCI_IS_TDI
+#define	CONFIG_USB_STORAGE
+#endif
+
+/*
  * SPI
  */
 #ifdef	CONFIG_CMD_SPI