Skip to contentSkip to conversation

ARM: atmel: switch to usb ehci for sama5d3 boards

PATCH In review Josh Wu 3 participants 6 messages May 19, 2015 – Aug 19, 2015

lore
Share & tools
lore

Josh Wu

author
#0 lore raw

PATCH 1/1 ARM: atmel: switch to usb ehci for sama5d3 boards

From: Bo Shen <[email protected]>

As the cache coherence issue in OHCI HCD, when enable I/D cache for sama5d3 SoC, the OHCI can not work properly. So, switch to EHCI, then the USB can work well.

[rebase to mainline]

---

 include/configs/sama5d3_xplained.h | 21 +++------------------
 include/configs/sama5d3xek.h       | 21 +++------------------
 2 files changed, 6 insertions(+), 36 deletions(-)
include/configs/sama5d3_xplained.h +3 -18
index bfd8aa7..0dab15d 100644
@@ -20,17 +20,6 @@
 #define CONFIG_USART_BASE		ATMEL_BASE_DBGU
 #define CONFIG_USART_ID			ATMEL_ID_DBGU
 
-/*
- * This needs to be defined for the OHCI code to work but it is defined as
- * ATMEL_ID_UHPHS in the CPU specific header files.
- */
-#define ATMEL_ID_UHP			ATMEL_ID_UHPHS
-
-/*
- * Specify the clock enable bit in the PMC_SCER register.
- */
-#define ATMEL_PMC_UHP			AT91SAM926x_PMC_UHP
-
 /* SDRAM */
 #define CONFIG_NR_DRAM_BANKS		1
 #define CONFIG_SYS_SDRAM_BASE           ATMEL_BASE_DDRCS
@@ -95,13 +84,9 @@
 #define CONFIG_CMD_USB
 
 #ifdef CONFIG_CMD_USB
-#define CONFIG_USB_ATMEL
-#define CONFIG_USB_ATMEL_CLK_SEL_UPLL
-#define CONFIG_USB_OHCI_NEW
-#define CONFIG_SYS_USB_OHCI_CPU_INIT
-#define CONFIG_SYS_USB_OHCI_REGS_BASE		ATMEL_BASE_OHCI
-#define CONFIG_SYS_USB_OHCI_SLOT_NAME		"SAMA5D3 Xplained"
-#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	2
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_ATMEL
+#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS	3
 #define CONFIG_DOS_PARTITION
 #define CONFIG_USB_STORAGE
 #endif
include/configs/sama5d3xek.h +3 -18
index d933a9e..d3ab6e4 100644
@@ -24,17 +24,6 @@
 #define CONFIG_USART_BASE		ATMEL_BASE_DBGU
 #define	CONFIG_USART_ID			ATMEL_ID_DBGU
 
-/*
- * This needs to be defined for the OHCI code to work but it is defined as
- * ATMEL_ID_UHPHS in the CPU specific header files.
- */
-#define ATMEL_ID_UHP			ATMEL_ID_UHPHS
-
-/*
- * Specify the clock enable bit in the PMC_SCER register.
- */
-#define ATMEL_PMC_UHP			AT91SAM926x_PMC_UHP
-
 /* LCD */
 #define CONFIG_LCD
 #define LCD_BPP				LCD_COLOR16
@@ -128,13 +117,9 @@
 #define CONFIG_CMD_USB
 
 #ifdef CONFIG_CMD_USB
-#define CONFIG_USB_ATMEL
-#define CONFIG_USB_ATMEL_CLK_SEL_UPLL
-#define CONFIG_USB_OHCI_NEW
-#define CONFIG_SYS_USB_OHCI_CPU_INIT
-#define CONFIG_SYS_USB_OHCI_REGS_BASE		ATMEL_BASE_OHCI
-#define CONFIG_SYS_USB_OHCI_SLOT_NAME		"sama5d3"
-#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	3
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_ATMEL
+#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS	3
 #define CONFIG_DOS_PARTITION
 #define CONFIG_USB_STORAGE
 #endif
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 ARM: atmel: switch to usb ehci for sama5d3 boards

Hi,

Quoted 9 lines · Josh Wu

From: Bo Shen <[email protected]>

As the cache coherence issue in OHCI HCD, when enable I/D cache for sama5d3 SoC, the OHCI can not work properly. So, switch to EHCI, then the USB can work well.

[rebase to mainline]

I'm confused now, with the patch you just send the ohci code should work, right? And this way usb-1 devices like keyboards will not work, otoh you will get faster usb storage support.

What you should really do is convert the atmel usb glue to support the u-boot driver model and move to that, then you can build in both the ohci and ehci drivers and get the best of both worlds.

I've already done so for sunxi, ironing out all the handover bugs in the usb core and ehci code, paving the way for you :)

Regards,

Hans

Quoted 85 lines

---

  include/configs/sama5d3_xplained.h | 21 +++------------------
  include/configs/sama5d3xek.h       | 21 +++------------------
  2 files changed, 6 insertions(+), 36 deletions(-)
include/configs/sama5d3_xplained.h +3 -18
index bfd8aa7..0dab15d 100644
@@ -20,17 +20,6 @@
  #define CONFIG_USART_BASE		ATMEL_BASE_DBGU
  #define CONFIG_USART_ID			ATMEL_ID_DBGU
 
-/*
- * This needs to be defined for the OHCI code to work but it is defined as
- * ATMEL_ID_UHPHS in the CPU specific header files.
- */
-#define ATMEL_ID_UHP			ATMEL_ID_UHPHS
-
-/*
- * Specify the clock enable bit in the PMC_SCER register.
- */
-#define ATMEL_PMC_UHP			AT91SAM926x_PMC_UHP
-
  /* SDRAM */
  #define CONFIG_NR_DRAM_BANKS		1
  #define CONFIG_SYS_SDRAM_BASE           ATMEL_BASE_DDRCS
@@ -95,13 +84,9 @@
  #define CONFIG_CMD_USB
 
  #ifdef CONFIG_CMD_USB
-#define CONFIG_USB_ATMEL
-#define CONFIG_USB_ATMEL_CLK_SEL_UPLL
-#define CONFIG_USB_OHCI_NEW
-#define CONFIG_SYS_USB_OHCI_CPU_INIT
-#define CONFIG_SYS_USB_OHCI_REGS_BASE		ATMEL_BASE_OHCI
-#define CONFIG_SYS_USB_OHCI_SLOT_NAME		"SAMA5D3 Xplained"
-#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	2
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_ATMEL
+#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS	3
  #define CONFIG_DOS_PARTITION
  #define CONFIG_USB_STORAGE
  #endif
include/configs/sama5d3xek.h +3 -18
index d933a9e..d3ab6e4 100644
@@ -24,17 +24,6 @@
  #define CONFIG_USART_BASE		ATMEL_BASE_DBGU
  #define	CONFIG_USART_ID			ATMEL_ID_DBGU
 
-/*
- * This needs to be defined for the OHCI code to work but it is defined as
- * ATMEL_ID_UHPHS in the CPU specific header files.
- */
-#define ATMEL_ID_UHP			ATMEL_ID_UHPHS
-
-/*
- * Specify the clock enable bit in the PMC_SCER register.
- */
-#define ATMEL_PMC_UHP			AT91SAM926x_PMC_UHP
-
  /* LCD */
  #define CONFIG_LCD
  #define LCD_BPP				LCD_COLOR16
@@ -128,13 +117,9 @@
  #define CONFIG_CMD_USB
 
  #ifdef CONFIG_CMD_USB
-#define CONFIG_USB_ATMEL
-#define CONFIG_USB_ATMEL_CLK_SEL_UPLL
-#define CONFIG_USB_OHCI_NEW
-#define CONFIG_SYS_USB_OHCI_CPU_INIT
-#define CONFIG_SYS_USB_OHCI_REGS_BASE		ATMEL_BASE_OHCI
-#define CONFIG_SYS_USB_OHCI_SLOT_NAME		"sama5d3"
-#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	3
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_ATMEL
+#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS	3
  #define CONFIG_DOS_PARTITION
  #define CONFIG_USB_STORAGE
  #endif
author
#2 lore raw

PATCH 1/1 ARM: atmel: switch to usb ehci for sama5d3 boards

Hi, Hans

Quoted 9 lines · Hans de Goede

Hi,

Quoted 6 lines · Josh Wu

From: Bo Shen <[email protected]>

As the cache coherence issue in OHCI HCD, when enable I/D cache for sama5d3 SoC, the OHCI can not work properly. So, switch to EHCI, then the USB can work well.

Quoted 6 lines
Quoted 3 lines
[rebase to mainline]

I'm confused now, with the patch you just send the ohci code should work, right?

Right. I forget to amend the commit message. Sorry.

Quoted 2 lines

And this way usb-1 devices like keyboards will not work, otoh you will get faster usb storage support.

I didn't test the keyboard yet. Good to know this. thanks.

Quoted 4 lines

What you should really do is convert the atmel usb glue to support the u-boot driver model and move to that, then you can build in both the ohci and ehci drivers and get the best of both worlds.

Ok, that sounds nice.

Quoted 3 lines

I've already done so for sunxi, ironing out all the handover bugs in the usb core and ehci code, paving the way for you :)

Indeed, it seems convert to DM is the right way.
Ok, I will do it. Thanks again.

Best Regards,
Josh Wu

Quoted 95 lines

Regards,

Hans

Quoted 88 lines

---

  include/configs/sama5d3_xplained.h | 21 +++------------------
  include/configs/sama5d3xek.h       | 21 +++------------------
  2 files changed, 6 insertions(+), 36 deletions(-)
include/configs/sama5d3_xplained.h +0 -2
index bfd8aa7..0dab15d 100644
@@ -20,17 +20,6 @@
  #define CONFIG_USART_BASE        ATMEL_BASE_DBGU
  #define CONFIG_USART_ID            ATMEL_ID_DBGU
 
-/*
- * This needs to be defined for the OHCI code to work but it is 

defined as
- * ATMEL_ID_UHPHS in the CPU specific header files.
- */

include/configs/sama5d3_xplained.h +3 -14
-#define ATMEL_ID_UHP            ATMEL_ID_UHPHS
-
-/*
- * Specify the clock enable bit in the PMC_SCER register.
- */
-#define ATMEL_PMC_UHP            AT91SAM926x_PMC_UHP
-
  /* SDRAM */
  #define CONFIG_NR_DRAM_BANKS        1
  #define CONFIG_SYS_SDRAM_BASE           ATMEL_BASE_DDRCS
@@ -95,13 +84,9 @@
  #define CONFIG_CMD_USB
 
  #ifdef CONFIG_CMD_USB
-#define CONFIG_USB_ATMEL
-#define CONFIG_USB_ATMEL_CLK_SEL_UPLL
-#define CONFIG_USB_OHCI_NEW
-#define CONFIG_SYS_USB_OHCI_CPU_INIT
-#define CONFIG_SYS_USB_OHCI_REGS_BASE        ATMEL_BASE_OHCI
-#define CONFIG_SYS_USB_OHCI_SLOT_NAME        "SAMA5D3 Xplained"
-#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS    2
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_ATMEL
+#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS    3
  #define CONFIG_DOS_PARTITION
  #define CONFIG_USB_STORAGE
  #endif
include/configs/sama5d3xek.h +0 -2
index d933a9e..d3ab6e4 100644
@@ -24,17 +24,6 @@
  #define CONFIG_USART_BASE        ATMEL_BASE_DBGU
  #define    CONFIG_USART_ID            ATMEL_ID_DBGU
 
-/*
- * This needs to be defined for the OHCI code to work but it is 

defined as
- * ATMEL_ID_UHPHS in the CPU specific header files.
- */

include/configs/sama5d3xek.h +3 -14
-#define ATMEL_ID_UHP            ATMEL_ID_UHPHS
-
-/*
- * Specify the clock enable bit in the PMC_SCER register.
- */
-#define ATMEL_PMC_UHP            AT91SAM926x_PMC_UHP
-
  /* LCD */
  #define CONFIG_LCD
  #define LCD_BPP                LCD_COLOR16
@@ -128,13 +117,9 @@
  #define CONFIG_CMD_USB
 
  #ifdef CONFIG_CMD_USB
-#define CONFIG_USB_ATMEL
-#define CONFIG_USB_ATMEL_CLK_SEL_UPLL
-#define CONFIG_USB_OHCI_NEW
-#define CONFIG_SYS_USB_OHCI_CPU_INIT
-#define CONFIG_SYS_USB_OHCI_REGS_BASE        ATMEL_BASE_OHCI
-#define CONFIG_SYS_USB_OHCI_SLOT_NAME        "sama5d3"
-#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS    3
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_ATMEL
+#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS    3
  #define CONFIG_DOS_PARTITION
  #define CONFIG_USB_STORAGE
  #endif
#3 lore raw
In reply to Josh Wu

Dear "Wu, Josh",

Quoted 6 lines · Josh Wu

From: Bo Shen <[email protected]>

As the cache coherence issue in OHCI HCD, when enable I/D cache for sama5d3 SoC, the OHCI can not work properly. So, switch to EHCI, then the USB can work well.

Quoted 8 lines
[rebase to mainline]

---

include/configs/sama5d3_xplained.h | 21 +++------------------
include/configs/sama5d3xek.h | 21 +++------------------

2 files changed, 6 insertions(+), 36 deletions(-)

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bie?mann

#4 lore raw

Hi Josh,

Quoted 14 lines · Andreas Bie?mann

Dear "Wu, Josh",

Quoted 11 lines · Josh Wu

From: Bo Shen <[email protected]>

As the cache coherence issue in OHCI HCD, when enable I/D cache for sama5d3 SoC, the OHCI can not work properly. So, switch to EHCI, then the USB can work well.

[rebase to mainline]

---

Quoted 5 lines
Quoted 3 lines

include/configs/sama5d3_xplained.h | 21 +++------------------
include/configs/sama5d3xek.h | 21 +++------------------

2 files changed, 6 insertions(+), 36 deletions(-)

applied to u-boot-atmel/master, thanks!

just saw the mails from Hans. I removed this patch again from u-boot-atmel/master. The USB-DM changes seems to be the better way and since the OHCI driver is fixed we should stay there.

Andreas

author
#5 lore raw

Hi, Andreas

Quoted 17 lines · Andreas Bie?mann

Hi Josh,

Quoted 14 lines · Andreas Bie?mann

Dear "Wu, Josh",

Quoted 11 lines · Josh Wu

From: Bo Shen <[email protected]>

As the cache coherence issue in OHCI HCD, when enable I/D cache for sama5d3 SoC, the OHCI can not work properly. So, switch to EHCI, then the USB can work well.

[rebase to mainline]

---

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines

include/configs/sama5d3_xplained.h | 21 +++------------------
include/configs/sama5d3xek.h | 21 +++------------------

2 files changed, 6 insertions(+), 36 deletions(-)

applied to u-boot-atmel/master, thanks!

just saw the mails from Hans. I removed this patch again from u-boot-atmel/master.

Yes, that's right.

Quoted 2 lines

The USB-DM changes seems to be the better way and since the OHCI driver is fixed we should stay there.

For the DM switch, I think the pinctrl dt support might be a big task. I've done the spi dm support on at91sam9m10g45ek. But as the pins configuration from dt is not support. So I just hard coded the pin configuration.
I may send it out for review in future.

Best Regards,
Josh Wu

Quoted 2 lines

Andreas