Skip to contentSkip to conversation

Add USB support to orion5x and edminiv2

PATCH New Albert ARIBAUD 2 participants 10 messages Jan 16, 2012 – Feb 8, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Add USB support to orion5x and edminiv2

This patch set adds USB support to the LaCie ED Mini V2 by renaming the 'kirkwood' USB driver a 'marvell' USB driver, sharing it between the orion5x SoC family and enabling it for the edminiv2 board.

(this is similar to what was done with the 'mvgbe' driver in commits 9b6bcdcb to ab9164d0)

Albert ARIBAUD (4):
Rename ehci-kirkwood as ehci-marvell Remove kirkwood-specifics from marvell EHCI driver
orion5x: add USB host ehci-marvell support
edminiv2: add USB host support

 arch/arm/include/asm/arch-kirkwood/config.h        |    2 +-
 arch/arm/include/asm/arch-kirkwood/kirkwood.h      |   12 ++++++
 arch/arm/include/asm/arch-orion5x/orion5x.h        |   12 ++++++
 drivers/usb/host/Makefile                          |    2 +-
 .../usb/host/{ehci-kirkwood.c => ehci-marvell.c}   |   36 ++++++++++++--------
 include/configs/edminiv2.h                         |   14 ++++++++
 6 files changed, 62 insertions(+), 16 deletions(-)
 rename drivers/usb/host/{ehci-kirkwood.c => ehci-marvell.c} (73%)
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/4 Rename ehci-kirkwood as ehci-marvell

---
 arch/arm/include/asm/arch-kirkwood/config.h        |    2 +-
 drivers/usb/host/Makefile                          |    2 +-
 .../usb/host/{ehci-kirkwood.c => ehci-marvell.c}   |    0
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename drivers/usb/host/{ehci-kirkwood.c => ehci-marvell.c} (100%)
arch/arm/include/asm/arch-kirkwood/config.h +1 -1
index d1c1998..91164eb 100644
@@ -104,7 +104,7 @@
  * USB/EHCI
  */
 #ifdef CONFIG_CMD_USB
-#define CONFIG_USB_EHCI_KIRKWOOD
+#define CONFIG_USB_EHCI_MARVELL
 #define CONFIG_EHCI_IS_TDI
 #endif /* CONFIG_CMD_USB */
 
drivers/usb/host/Makefile +1 -1
index 77e217f..7ba36ca 100644
@@ -45,7 +45,7 @@ COBJS-$(CONFIG_USB_EHCI_MXS) += ehci-mxs.o
 COBJS-$(CONFIG_USB_EHCI_MX5) += ehci-mx5.o
 COBJS-$(CONFIG_USB_EHCI_PPC4XX) += ehci-ppc4xx.o
 COBJS-$(CONFIG_USB_EHCI_IXP4XX) += ehci-ixp.o
-COBJS-$(CONFIG_USB_EHCI_KIRKWOOD) += ehci-kirkwood.o
+COBJS-$(CONFIG_USB_EHCI_MARVELL) += ehci-marvell.o
 COBJS-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
 COBJS-$(CONFIG_USB_EHCI_VCT) += ehci-vct.o
 
drivers/usb/host/ehci-marvell.c renamed from drivers/usb/host/ehci-kirkwood.c +0 -0
similarity index 100%
rename from drivers/usb/host/ehci-kirkwood.c
rename to drivers/usb/host/ehci-marvell.c
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 2/4 Remove kirkwood-specifics from marvell EHCI driver

---
 arch/arm/include/asm/arch-kirkwood/kirkwood.h |   12 +++++++++
 drivers/usb/host/ehci-marvell.c               |   31 +++++++++++++-----------
 2 files changed, 29 insertions(+), 14 deletions(-)
arch/arm/include/asm/arch-kirkwood/kirkwood.h +12 -0
index 0035ed5..47771d5 100644
@@ -65,6 +65,18 @@
 #define MVGBE0_BASE	KW_EGIGA0_BASE
 #define MVGBE1_BASE	KW_EGIGA1_BASE
 
+/* Kirkwood USB Host controller */
+#define MVUSB0_BASE			KW_USB20_BASE
+#define MVUSB0_CPU_ATTR_DRAM_CS0	KWCPU_ATTR_DRAM_CS0
+#define MVUSB0_CPU_ATTR_DRAM_CS1	KWCPU_ATTR_DRAM_CS1
+#define MVUSB0_CPU_ATTR_DRAM_CS2	KWCPU_ATTR_DRAM_CS2
+#define MVUSB0_CPU_ATTR_DRAM_CS3	KWCPU_ATTR_DRAM_CS3
+
+/* Kirkwood CPU memory windows */
+#define MVCPU_WIN_CTRL_DATA	KWCPU_WIN_CTRL_DATA
+#define MVCPU_WIN_ENABLE	KWCPU_WIN_ENABLE
+#define MVCPU_WIN_DISABLE	KWCPU_WIN_DISABLE
+
 #if defined (CONFIG_KW88F6281)
 #include <asm/arch/kw88f6281.h>
 #elif defined (CONFIG_KW88F6192)
drivers/usb/host/ehci-marvell.c +17 -14
index 6300587..e342d78 100644
@@ -30,8 +30,10 @@
 #include <asm/arch/cpu.h>
 #include <asm/arch/kirkwood.h>
 
-#define rdl(off)	readl(KW_USB20_BASE + (off))
-#define wrl(off, val)	writel((val), KW_USB20_BASE + (off))
+DECLARE_GLOBAL_DATA_PTR;
+
+#define rdl(off)	readl(MVUSB0_BASE + (off))
+#define wrl(off, val)	writel((val), MVUSB0_BASE + (off))
 
 #define USB_WINDOW_CTRL(i)	(0x320 + ((i) << 4))
 #define USB_WINDOW_BASE(i)	(0x324 + ((i) << 4))
@@ -43,23 +45,23 @@
 static void usb_brg_adrdec_setup(void)
 {
 	int i;
-	u32 size, attrib;
+	u32 size, base, attrib;
 
 	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
 
 		/* Enable DRAM bank */
 		switch (i) {
 		case 0:
-			attrib = KWCPU_ATTR_DRAM_CS0;
+			attrib = MVUSB0_CPU_ATTR_DRAM_CS0;
 			break;
 		case 1:
-			attrib = KWCPU_ATTR_DRAM_CS1;
+			attrib = MVUSB0_CPU_ATTR_DRAM_CS1;
 			break;
 		case 2:
-			attrib = KWCPU_ATTR_DRAM_CS2;
+			attrib = MVUSB0_CPU_ATTR_DRAM_CS2;
 			break;
 		case 3:
-			attrib = KWCPU_ATTR_DRAM_CS3;
+			attrib = MVUSB0_CPU_ATTR_DRAM_CS3;
 			break;
 		default:
 			/* invalide bank, disable access */
@@ -67,15 +69,16 @@ static void usb_brg_adrdec_setup(void)
 			break;
 		}
 
-		size = kw_sdram_bs(i);
+		size = gd->bd->bi_dram[i].size;
+		base = gd->bd->bi_dram[i].start;
 		if ((size) && (attrib))
 			wrl(USB_WINDOW_CTRL(i),
-				KWCPU_WIN_CTRL_DATA(size, USB_TARGET_DRAM,
-					attrib, KWCPU_WIN_ENABLE));
+				MVCPU_WIN_CTRL_DATA(size, USB_TARGET_DRAM,
+					attrib, MVCPU_WIN_ENABLE));
 		else
-			wrl(USB_WINDOW_CTRL(i), KWCPU_WIN_DISABLE);
+			wrl(USB_WINDOW_CTRL(i), MVCPU_WIN_DISABLE);
 
-		wrl(USB_WINDOW_BASE(i), kw_sdram_bar(i));
+		wrl(USB_WINDOW_BASE(i), base);
 	}
 }
 
@@ -87,11 +90,11 @@ int ehci_hcd_init(void)
 {
 	usb_brg_adrdec_setup();
 
-	hccr = (struct ehci_hccr *)(KW_USB20_BASE + 0x100);
+	hccr = (struct ehci_hccr *)(MVUSB0_BASE + 0x100);
 	hcor = (struct ehci_hcor *)((uint32_t) hccr
 			+ HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
 
-	debug("Kirkwood-ehci: init hccr %x and hcor %x hc_length %d\n",
+	debug("ehci-marvell: init hccr %x and hcor %x hc_length %d\n",
 		(uint32_t)hccr, (uint32_t)hcor,
 		(uint32_t)HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
 
Signature · 1 line
1.7.5.4
#3 lore raw

PATCH 3/4 orion5x: add USB host ehci-marvell support

---
 arch/arm/include/asm/arch-orion5x/orion5x.h |   12 ++++++++++++
 drivers/usb/host/ehci-marvell.c             |    5 +++++
 2 files changed, 17 insertions(+), 0 deletions(-)
arch/arm/include/asm/arch-orion5x/orion5x.h +12 -0
index 18225b9..b0d3368 100644
@@ -58,6 +58,18 @@
 #define MAX_MVGBE_DEVS	1
 #define MVGBE0_BASE	ORION5X_EGIGA_BASE
 
+/* Orion5x USB Host controller is port 1 */
+#define MVUSB0_BASE			ORION5X_USB20_HOST_PORT_BASE
+#define MVUSB0_CPU_ATTR_DRAM_CS0	ORION5X_ATTR_DRAM_CS0
+#define MVUSB0_CPU_ATTR_DRAM_CS1	ORION5X_ATTR_DRAM_CS1
+#define MVUSB0_CPU_ATTR_DRAM_CS2	ORION5X_ATTR_DRAM_CS2
+#define MVUSB0_CPU_ATTR_DRAM_CS3	ORION5X_ATTR_DRAM_CS3
+
+/* Kirkwood CPU memory windows */
+#define MVCPU_WIN_CTRL_DATA	ORION5X_CPU_WIN_CTRL_DATA
+#define MVCPU_WIN_ENABLE	ORION5X_WIN_ENABLE
+#define MVCPU_WIN_DISABLE	ORION5X_WIN_DISABLE
+
 #define CONFIG_MAX_RAM_BANK_SIZE		(64*1024*1024)
 
 /* include here SoC variants. 5181, 5281, 6183 should go here when
drivers/usb/host/ehci-marvell.c +5 -0
index e342d78..89c8af7 100644
@@ -28,7 +28,12 @@
 #include "ehci.h"
 #include "ehci-core.h"
 #include <asm/arch/cpu.h>
+
+#if defined(CONFIG_KIRKWOOD)
 #include <asm/arch/kirkwood.h>
+#elif defined(CONFIG_ORION5X)
+#include <asm/arch/orion5x.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
Signature · 1 line
1.7.5.4
#4 lore raw

PATCH 4/4 edminiv2: add USB host support

---
 include/configs/edminiv2.h |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
include/configs/edminiv2.h +14 -0
index 88d32b2..4162e8d 100644
@@ -134,6 +134,7 @@
 #include <config_cmd_default.h>
 #define CONFIG_CMD_IDE
 #define CONFIG_CMD_I2C
+#define CONFIG_CMD_USB
 
 /*
  * Network
@@ -183,6 +184,19 @@
 #endif /* CMD_IDE */
 
 /*
+ * Common USB/EHCI configuration
+ */
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI		/* Enable EHCI USB support */
+#define CONFIG_USB_EHCI_MARVELL
+#define ORION5X_USB20_HOST_PORT_BASE ORION5X_USB20_PORT0_BASE
+#define CONFIG_USB_STORAGE
+#define CONFIG_DOS_PARTITION
+#define CONFIG_ISO_PARTITION
+#define CONFIG_SUPPORT_VFAT
+#endif /* CONFIG_CMD_USB */
+
+/*
  * I2C related stuff
  */
 #ifdef CONFIG_CMD_I2C
Signature · 1 line
1.7.5.4
#5 lore raw

cover Add USB support to orion5x and edminiv2

In reply to Albert ARIBAUD
Quoted 9 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of Albert ARIBAUD
Sent: 16 January 2012 13:39
To: u-boot at lists.denx.de
Subject: [U-Boot] [PATCH 0/4] Add USB support to orion5x and edminiv2

Quoted 6 lines

This patch set adds USB support to the LaCie ED Mini V2 by renaming the 'kirkwood' USB driver a 'marvell' USB driver, sharing it between the orion5x SoC family and enabling it for the edminiv2 board.

(this is similar to what was done with the 'mvgbe' driver in commits 9b6bcdcb to ab9164d0)

Hi Albert
This is patch series tested on both the platforms- Kirkwood, Orion for this change?

Otherwise,

Regards..
Prafulla . ..

#6 lore raw

cover Add USB support to orion5x and edminiv2

Hi Prafulla,

Le 16/01/2012 09:20, Prafulla Wadaskar a ?crit :

Quoted 16 lines
Quoted 9 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of Albert ARIBAUD
Sent: 16 January 2012 13:39
To: u-boot at lists.denx.de
Subject: [U-Boot] [PATCH 0/4] Add USB support to orion5x and edminiv2

Quoted 6 lines

This patch set adds USB support to the LaCie ED Mini V2 by renaming the 'kirkwood' USB driver a 'marvell' USB driver, sharing it between the orion5x SoC family and enabling it for the edminiv2 board.

(this is similar to what was done with the 'mvgbe' driver in commits 9b6bcdcb to ab9164d0)

Quoted 8 lines

Hi Albert
This is patch series tested on both the platforms- Kirkwood, Orion for this change?

Otherwise,

Regards..
Prafulla . ..

For kirkwood the code is just a bunch of renames with no functional impact, but I did test the patch set on kirkwood for build-time and run-time regressions while developing it.

However, since then I have rebased it a couple of times, and my openrd-client is currently not available for testing again. Could you possibly test it?

Amicalement,

Signature · 1 line
Albert.
#7 lore raw

cover Add USB support to orion5x and edminiv2

Quoted 42 lines

-----Original Message-----
From: Albert ARIBAUD [mailto:albert.u.boot at aribaud.net]
Sent: 16 January 2012 14:00
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH 0/4] Add USB support to orion5x and edminiv2

Hi Prafulla,

Le 16/01/2012 09:20, Prafulla Wadaskar a ?crit :

Quoted 8 lines
Quoted 8 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of Albert ARIBAUD
Sent: 16 January 2012 13:39
To: u-boot at lists.denx.de
Subject: [U-Boot] [PATCH 0/4] Add USB support to orion5x and

edminiv2

Quoted 3 lines
Quoted 3 lines

This patch set adds USB support to the LaCie ED Mini V2 by renaming the 'kirkwood' USB driver a 'marvell' USB driver, sharing it

between

Quoted 3 lines
Quoted 3 lines

the orion5x SoC family and enabling it for the edminiv2 board.

(this is similar to what was done with the 'mvgbe' driver in

commits

Quoted 4 lines
Quoted 1 line

9b6bcdcb to ab9164d0)

Hi Albert
This is patch series tested on both the platforms- Kirkwood, Orion

for this change?

Quoted 6 lines

Otherwise,

Regards..
Prafulla . ..

Quoted 7 lines

For kirkwood the code is just a bunch of renames with no functional impact, but I did test the patch set on kirkwood for build-time and run-time regressions while developing it.

However, since then I have rebased it a couple of times, and my openrd-client is currently not available for testing again. Could you possibly test it?

Okay I will do it in next week is that okay with you?

Regards..
Prafulla . .

Quoted 4 lines

Amicalement,
--
Albert.

#8 lore raw

cover Add USB support to orion5x and edminiv2

Hi Prafulla,

Le 16/01/2012 09:32, Prafulla Wadaskar a ?crit :

Quoted 46 lines
Quoted 46 lines

-----Original Message-----
From: Albert ARIBAUD [mailto:albert.u.boot at aribaud.net]
Sent: 16 January 2012 14:00
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH 0/4] Add USB support to orion5x and edminiv2

Hi Prafulla,

Le 16/01/2012 09:20, Prafulla Wadaskar a ?crit :

Quoted 8 lines
Quoted 8 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of Albert ARIBAUD
Sent: 16 January 2012 13:39
To: u-boot at lists.denx.de
Subject: [U-Boot] [PATCH 0/4] Add USB support to orion5x and

edminiv2

Quoted 3 lines
Quoted 3 lines

This patch set adds USB support to the LaCie ED Mini V2 by renaming the 'kirkwood' USB driver a 'marvell' USB driver, sharing it

between

Quoted 3 lines
Quoted 3 lines

the orion5x SoC family and enabling it for the edminiv2 board.

(this is similar to what was done with the 'mvgbe' driver in

commits

Quoted 4 lines
Quoted 1 line

9b6bcdcb to ab9164d0)

Hi Albert
This is patch series tested on both the platforms- Kirkwood, Orion

for this change?

Quoted 6 lines

Otherwise,

Regards..
Prafulla . ..

For kirkwood the code is just a bunch of renames with no functional impact, but I did test the patch set on kirkwood for build-time and run-time regressions while developing it.

Quoted 5 lines
Quoted 3 lines

However, since then I have rebased it a couple of times, and my openrd-client is currently not available for testing again. Could you possibly test it?

Okay I will do it in next week is that okay with you?

Don't bother: I've been lent another open-rd and I could run the u-boot image through openocd during lunch break. I've just tested usb start, usb tree with a mass storage USB key plugged in, usb info, usb part) and all works fine.

Quoted 2 lines

Regards..
Prafulla . .

Amicalement,

Signature · 1 line
Albert.
#9 lore raw

cover Add USB support to orion5x and edminiv2

In reply to Albert ARIBAUD
Quoted 22 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of Albert ARIBAUD
Sent: 16 January 2012 13:39
To: u-boot at lists.denx.de
Subject: [U-Boot] [PATCH 0/4] Add USB support to orion5x and edminiv2

This patch set adds USB support to the LaCie ED Mini V2 by renaming the 'kirkwood' USB driver a 'marvell' USB driver, sharing it between the orion5x SoC family and enabling it for the edminiv2 board.

(this is similar to what was done with the 'mvgbe' driver in commits 9b6bcdcb to ab9164d0)

Albert ARIBAUD (4):
Rename ehci-kirkwood as ehci-marvell Remove kirkwood-specifics from marvell EHCI driver
orion5x: add USB host ehci-marvell support
edminiv2: add USB host support

Quoted 10 lines
 arch/arm/include/asm/arch-kirkwood/config.h        |    2 +-
 arch/arm/include/asm/arch-kirkwood/kirkwood.h      |   12 ++++++
 arch/arm/include/asm/arch-orion5x/orion5x.h        |   12 ++++++
 drivers/usb/host/Makefile                          |    2 +-
 .../usb/host/{ehci-kirkwood.c => ehci-marvell.c}   |   36
++++++++++++--------
 include/configs/edminiv2.h                         |   14 ++++++++
 6 files changed, 62 insertions(+), 16 deletions(-)
 rename drivers/usb/host/{ehci-kirkwood.c => ehci-marvell.c} (73%)

Applied this patch serried to u-boot-marvell.git master branch

Regards..
Prafulla . . .