public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCHv2 0/4]enable USB OHCI on sam9x5ek boards
@ 2012-11-28 11:48 Richard Genoud
  2012-11-28 11:48 ` [U-Boot] [PATCHv2 1/4] usb documentation: fix typo Richard Genoud
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Richard Genoud @ 2012-11-28 11:48 UTC (permalink / raw)
  To: u-boot

This small patchset is based on current master ( 178d0cc1a4c73c3341afbeb2a93b172de8c96bd1 )
It enables usb on at91sam9x5ek boards.
Tested on at91sam9x5ek with a sam9g35 CPU (+ usb key and mouse)

By default the 3 USB 1.1 ports (A, B and C) are enabled.
If CONFIG_USB_EHCI is defined, the 2 USB 2.0 ports (A and B) will be enabled.

changes from v1:
* VBUS for usb port A is enabled
* EHCI configuration is now present
* number of OHCI ports corrected (3 instead of 2)

Richard Genoud (4):
  usb documentation: fix typo
  ARM: at91sam9x5: enable USB OHCI support for 9x5ek board.
  at91sam9x5ek: regroup FAT/DOS features
  at91sam9x5ek: add USB OHCI configuration

 arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c |    9 +++++++++
 arch/arm/include/asm/arch-at91/at91sam9x5.h      |    2 ++
 board/atmel/at91sam9x5ek/at91sam9x5ek.c          |    3 +++
 doc/README.usb                                   |    2 +-
 drivers/usb/host/ohci-at91.c                     |    6 ++++--
 include/configs/at91sam9x5ek.h                   |   18 +++++++++++++++++-
 6 files changed, 36 insertions(+), 4 deletions(-)

-- 
1.7.2.5

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

* [U-Boot] [PATCHv2 1/4] usb documentation: fix typo
  2012-11-28 11:48 [U-Boot] [PATCHv2 0/4]enable USB OHCI on sam9x5ek boards Richard Genoud
@ 2012-11-28 11:48 ` Richard Genoud
  2012-11-28 11:48 ` [U-Boot] [PATCHv2 2/4] at91sam9x5: enable USB support for 9x5ek board Richard Genoud
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Richard Genoud @ 2012-11-28 11:48 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 doc/README.usb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/doc/README.usb b/doc/README.usb
index ef1d6ba..b4c3ef5 100644
--- a/doc/README.usb
+++ b/doc/README.usb
@@ -63,7 +63,7 @@ Common USB Commands:
 Storage USB Commands:
 - usb scan:	    scans the USB for storage devices.The USB must be
 		    running for this command (usb start)
-- usb device [dev]: show or set current USB staorage device
+- usb device [dev]: show or set current USB storage device
 - usb part [dev]:   print partition table of one or all USB storage
 		    devices
 - usb read addr blk# cnt:
-- 
1.7.2.5

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

* [U-Boot] [PATCHv2 2/4] at91sam9x5: enable USB support for 9x5ek board.
  2012-11-28 11:48 [U-Boot] [PATCHv2 0/4]enable USB OHCI on sam9x5ek boards Richard Genoud
  2012-11-28 11:48 ` [U-Boot] [PATCHv2 1/4] usb documentation: fix typo Richard Genoud
@ 2012-11-28 11:48 ` Richard Genoud
  2012-11-29  5:22   ` Bo Shen
  2012-11-28 11:48 ` [U-Boot] [PATCHv2 3/4] at91sam9x5ek: regroup FAT/DOS features Richard Genoud
  2012-11-28 11:48 ` [U-Boot] [PATCHv2 4/4] at91sam9x5ek: add USB configuration Richard Genoud
  3 siblings, 1 reply; 8+ messages in thread
From: Richard Genoud @ 2012-11-28 11:48 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c |   10 ++++++++++
 arch/arm/include/asm/arch-at91/at91sam9x5.h      |    2 ++
 board/atmel/at91sam9x5ek/at91sam9x5ek.c          |    3 +++
 drivers/usb/host/ohci-at91.c                     |    6 ++++--
 4 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
index 9348552..f2a05c8 100644
--- a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
+++ b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
@@ -193,6 +193,16 @@ void at91_spi1_hw_init(unsigned long cs_mask)
 }
 #endif
 
+#if defined(CONFIG_USB_OHCI_NEW) || defined(CONFIG_USB_EHCI)
+void at91_uhp_hw_init(void)
+{
+	/* Enable VBus on UHP ports */
+	at91_set_pio_output(AT91_PIO_PORTD, 18, 0); /* port A */
+	at91_set_pio_output(AT91_PIO_PORTD, 19, 0); /* port B */
+	at91_set_pio_output(AT91_PIO_PORTD, 20, 0); /* port C */
+}
+#endif
+
 #ifdef CONFIG_MACB
 void at91_macb_hw_init(void)
 {
diff --git a/arch/arm/include/asm/arch-at91/at91sam9x5.h b/arch/arm/include/asm/arch-at91/at91sam9x5.h
index 0e728c9..de0f1b1 100644
--- a/arch/arm/include/asm/arch-at91/at91sam9x5.h
+++ b/arch/arm/include/asm/arch-at91/at91sam9x5.h
@@ -154,6 +154,8 @@
 #define ATMEL_PIO_PORTS         4
 #define CPU_HAS_PIO3
 #define PIO_SCDR_DIV            (0x3fff <<  0)  /* Slow Clock Divider Mask */
+#define ATMEL_PMC_UHP		AT91SAM926x_PMC_UHP
+#define ATMEL_ID_UHP		ATMEL_ID_UHPHS
 
 /*
  * at91sam9x5 specific prototypes
diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
index edb0886..8773e6f 100644
--- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c
+++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c
@@ -295,6 +295,9 @@ int board_init(void)
 	at91_macb_hw_init();
 #endif
 
+#if defined(CONFIG_USB_OHCI_NEW) || defined(CONFIG_USB_EHCI)
+	at91_uhp_hw_init();
+#endif
 #ifdef CONFIG_LCD
 	at91sam9x5ek_lcd_hw_init();
 #endif
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 9532dd9..efd711d 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -41,7 +41,8 @@ int usb_cpu_init(void)
 	writel(get_pllb_init(), &pmc->pllbr);
 	while ((readl(&pmc->sr) & AT91_PMC_LOCKB) != AT91_PMC_LOCKB)
 		;
-#elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45)
+#elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) || \
+	defined(CONFIG_AT91SAM9X5)
 	/* Enable UPLL */
 	writel(readl(&pmc->uckr) | AT91_PMC_UPLLEN | AT91_PMC_BIASEN,
 		&pmc->uckr);
@@ -81,7 +82,8 @@ int usb_cpu_stop(void)
 	writel(0, &pmc->pllbr);
 	while ((readl(&pmc->sr) & AT91_PMC_LOCKB) != 0)
 		;
-#elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45)
+#elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) || \
+	defined(CONFIG_AT91SAM9X5)
 	/* Disable UPLL */
 	writel(readl(&pmc->uckr) & (~AT91_PMC_UPLLEN), &pmc->uckr);
 	while ((readl(&pmc->sr) & AT91_PMC_LOCKU) == AT91_PMC_LOCKU)
-- 
1.7.2.5

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

* [U-Boot] [PATCHv2 3/4] at91sam9x5ek: regroup FAT/DOS features
  2012-11-28 11:48 [U-Boot] [PATCHv2 0/4]enable USB OHCI on sam9x5ek boards Richard Genoud
  2012-11-28 11:48 ` [U-Boot] [PATCHv2 1/4] usb documentation: fix typo Richard Genoud
  2012-11-28 11:48 ` [U-Boot] [PATCHv2 2/4] at91sam9x5: enable USB support for 9x5ek board Richard Genoud
@ 2012-11-28 11:48 ` Richard Genoud
  2012-11-28 11:48 ` [U-Boot] [PATCHv2 4/4] at91sam9x5ek: add USB configuration Richard Genoud
  3 siblings, 0 replies; 8+ messages in thread
From: Richard Genoud @ 2012-11-28 11:48 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 include/configs/at91sam9x5ek.h |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h
index 71f765b..5e5f9c1 100644
--- a/include/configs/at91sam9x5ek.h
+++ b/include/configs/at91sam9x5ek.h
@@ -90,6 +90,7 @@
 #define CONFIG_CMD_NAND
 #define CONFIG_CMD_SF
 #define CONFIG_CMD_MMC
+#define CONFIG_CMD_FAT
 
 /* SDRAM */
 #define CONFIG_NR_DRAM_BANKS		1
@@ -142,9 +143,12 @@
 /* MMC */
 #ifdef CONFIG_CMD_MMC
 #define CONFIG_MMC
-#define CONFIG_CMD_FAT
 #define CONFIG_GENERIC_MMC
 #define CONFIG_GENERIC_ATMEL_MCI
+#endif
+
+/* FAT */
+#ifdef CONFIG_CMD_FAT
 #define CONFIG_DOS_PARTITION
 #endif
 
-- 
1.7.2.5

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

* [U-Boot] [PATCHv2 4/4] at91sam9x5ek: add USB configuration
  2012-11-28 11:48 [U-Boot] [PATCHv2 0/4]enable USB OHCI on sam9x5ek boards Richard Genoud
                   ` (2 preceding siblings ...)
  2012-11-28 11:48 ` [U-Boot] [PATCHv2 3/4] at91sam9x5ek: regroup FAT/DOS features Richard Genoud
@ 2012-11-28 11:48 ` Richard Genoud
  2012-11-29  5:22   ` Bo Shen
  3 siblings, 1 reply; 8+ messages in thread
From: Richard Genoud @ 2012-11-28 11:48 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 include/configs/at91sam9x5ek.h |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h
index 5e5f9c1..fd2586d 100644
--- a/include/configs/at91sam9x5ek.h
+++ b/include/configs/at91sam9x5ek.h
@@ -91,6 +91,14 @@
 #define CONFIG_CMD_SF
 #define CONFIG_CMD_MMC
 #define CONFIG_CMD_FAT
+#define CONFIG_CMD_USB
+
+/*
+ * define CONFIG_USB_EHCI to enable USB Hi-Speed (aka 2.0)
+ * NB: in this case, USB 1.1 devices won't be recognized.
+ */
+#undef CONFIG_USB_EHCI
+
 
 /* SDRAM */
 #define CONFIG_NR_DRAM_BANKS		1
@@ -158,6 +166,22 @@
 #define CONFIG_NET_RETRY_COUNT		20
 #define CONFIG_MACB_SEARCH_PHY
 
+/* USB */
+#ifdef CONFIG_CMD_USB
+#ifdef CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_ATMEL
+#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS	2
+#else
+#define CONFIG_USB_OHCI_NEW
+#define CONFIG_SYS_USB_OHCI_CPU_INIT
+#define CONFIG_SYS_USB_OHCI_REGS_BASE		0x00600000	/* ATMEL_BASE_OHCI */
+#define CONFIG_SYS_USB_OHCI_SLOT_NAME		"at91sam9x5"
+#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	3
+#endif
+#define CONFIG_USB_ATMEL
+#define CONFIG_USB_STORAGE
+#endif
+
 #define CONFIG_SYS_LOAD_ADDR		0x22000000	/* load address */
 
 #define CONFIG_SYS_MEMTEST_START	CONFIG_SYS_SDRAM_BASE
-- 
1.7.2.5

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

* [U-Boot] [PATCHv2 2/4] at91sam9x5: enable USB support for 9x5ek board.
  2012-11-28 11:48 ` [U-Boot] [PATCHv2 2/4] at91sam9x5: enable USB support for 9x5ek board Richard Genoud
@ 2012-11-29  5:22   ` Bo Shen
  2012-11-30  9:06     ` Richard Genoud
  0 siblings, 1 reply; 8+ messages in thread
From: Bo Shen @ 2012-11-29  5:22 UTC (permalink / raw)
  To: u-boot

Hi Richard,

On 11/28/2012 19:48, Richard Genoud wrote:
> Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
> ---
>   arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c |   10 ++++++++++
>   arch/arm/include/asm/arch-at91/at91sam9x5.h      |    2 ++
>   board/atmel/at91sam9x5ek/at91sam9x5ek.c          |    3 +++
>   drivers/usb/host/ohci-at91.c                     |    6 ++++--
>   4 files changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
> index 9348552..f2a05c8 100644
> --- a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
> +++ b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
> @@ -193,6 +193,16 @@ void at91_spi1_hw_init(unsigned long cs_mask)
>   }
>   #endif
>
> +#if defined(CONFIG_USB_OHCI_NEW) || defined(CONFIG_USB_EHCI)
> +void at91_uhp_hw_init(void)
> +{
> +	/* Enable VBus on UHP ports */
> +	at91_set_pio_output(AT91_PIO_PORTD, 18, 0); /* port A */
> +	at91_set_pio_output(AT91_PIO_PORTD, 19, 0); /* port B */
> +	at91_set_pio_output(AT91_PIO_PORTD, 20, 0); /* port C */
> +}
> +#endif
> +

As port C doesn't support EHCI, so, I think we should deal with this 
carefully.
---<8---
#if OHCI
#else EHCI
#endif
--->8---
I think this will be better.

Best Regards
Bo Shen

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

* [U-Boot] [PATCHv2 4/4] at91sam9x5ek: add USB configuration
  2012-11-28 11:48 ` [U-Boot] [PATCHv2 4/4] at91sam9x5ek: add USB configuration Richard Genoud
@ 2012-11-29  5:22   ` Bo Shen
  0 siblings, 0 replies; 8+ messages in thread
From: Bo Shen @ 2012-11-29  5:22 UTC (permalink / raw)
  To: u-boot

On 11/28/2012 19:48, Richard Genoud wrote:
> Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
> ---
>   include/configs/at91sam9x5ek.h |   24 ++++++++++++++++++++++++
>   1 files changed, 24 insertions(+), 0 deletions(-)
>
> diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h
> index 5e5f9c1..fd2586d 100644
> --- a/include/configs/at91sam9x5ek.h
> +++ b/include/configs/at91sam9x5ek.h
> @@ -91,6 +91,14 @@
>   #define CONFIG_CMD_SF
>   #define CONFIG_CMD_MMC
>   #define CONFIG_CMD_FAT
> +#define CONFIG_CMD_USB
> +
> +/*
> + * define CONFIG_USB_EHCI to enable USB Hi-Speed (aka 2.0)
> + * NB: in this case, USB 1.1 devices won't be recognized.
> + */
> +#undef CONFIG_USB_EHCI
> +

Nowhere defined it, so no need undefined it.

>
>   /* SDRAM */
>   #define CONFIG_NR_DRAM_BANKS		1
> @@ -158,6 +166,22 @@
>   #define CONFIG_NET_RETRY_COUNT		20
>   #define CONFIG_MACB_SEARCH_PHY
>
> +/* USB */
> +#ifdef CONFIG_CMD_USB
> +#ifdef CONFIG_USB_EHCI
> +#define CONFIG_USB_EHCI_ATMEL
> +#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS	2
> +#else
> +#define CONFIG_USB_OHCI_NEW
> +#define CONFIG_SYS_USB_OHCI_CPU_INIT
> +#define CONFIG_SYS_USB_OHCI_REGS_BASE		0x00600000	/* ATMEL_BASE_OHCI */

This has defined in arch/arm/include/asm/arch-at91/at91sam9x5.h.
You can use it directly.

> +#define CONFIG_SYS_USB_OHCI_SLOT_NAME		"at91sam9x5"
> +#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	3
> +#endif
> +#define CONFIG_USB_ATMEL
> +#define CONFIG_USB_STORAGE
> +#endif
> +
>   #define CONFIG_SYS_LOAD_ADDR		0x22000000	/* load address */
>
>   #define CONFIG_SYS_MEMTEST_START	CONFIG_SYS_SDRAM_BASE
>

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

* [U-Boot] [PATCHv2 2/4] at91sam9x5: enable USB support for 9x5ek board.
  2012-11-29  5:22   ` Bo Shen
@ 2012-11-30  9:06     ` Richard Genoud
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Genoud @ 2012-11-30  9:06 UTC (permalink / raw)
  To: u-boot

2012/11/29 Bo Shen <voice.shen@atmel.com>:
Hi !
> As port C doesn't support EHCI, so, I think we should deal with this
> carefully.
> ---<8---
> #if OHCI
> #else EHCI
> #endif
> --->8---
> I think this will be better.

yes, you're right, I'll change that

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

end of thread, other threads:[~2012-11-30  9:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-28 11:48 [U-Boot] [PATCHv2 0/4]enable USB OHCI on sam9x5ek boards Richard Genoud
2012-11-28 11:48 ` [U-Boot] [PATCHv2 1/4] usb documentation: fix typo Richard Genoud
2012-11-28 11:48 ` [U-Boot] [PATCHv2 2/4] at91sam9x5: enable USB support for 9x5ek board Richard Genoud
2012-11-29  5:22   ` Bo Shen
2012-11-30  9:06     ` Richard Genoud
2012-11-28 11:48 ` [U-Boot] [PATCHv2 3/4] at91sam9x5ek: regroup FAT/DOS features Richard Genoud
2012-11-28 11:48 ` [U-Boot] [PATCHv2 4/4] at91sam9x5ek: add USB configuration Richard Genoud
2012-11-29  5:22   ` Bo Shen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox