Skip to contentSkip to conversation

Add support for the MPC5121e USB Host controller.

PATCH New Damien Dusha 4 participants 12 messages Aug 22, 2010 – Oct 26, 2010

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

PATCH 1/1 Add support for the MPC5121e USB Host controller.

Add support for the USB Host controller of the MPC5121e, based on the original patch by Francesco Rendine [1].

The patch configures the USB Host controller and the on-board UTMI phy, including the Freescale-specific registers as per the Linux kernel driver.

Tested on the MPC5121ADS platform with various USB mass storage devices.

[1] http://lists.denx.de/pipermail/u-boot/2009-June/055022.html

---
 arch/powerpc/include/asm/immap_512x.h   |    4 +
 board/freescale/mpc5121ads/mpc5121ads.c |    4 +-
 drivers/usb/host/ehci-fsl.c             |  137 ++++++++++++++++++++++++++++-
 drivers/usb/host/ehci.h                 |    5 +
 include/configs/mpc5121ads.h            |   22 +++++-
 include/usb/ehci-fsl.h                  |  149 +++++++++++++++++++++++++------
 6 files changed, 292 insertions(+), 29 deletions(-)
arch/powerpc/include/asm/immap_512x.h +4 -0
index 7f9db8b..4923a17 100644
@@ -1246,4 +1246,8 @@ static inline u32 get_pata_base (void)
 }
 #endif	/* __ASSEMBLY__ */
 
+#define CONFIG_SYS_MPC512x_USB_OFFSET   0x4000
+#define CONFIG_SYS_MPC512x_USB_ADDR \
+	(CONFIG_SYS_IMMR + CONFIG_SYS_MPC512x_USB_OFFSET)
+
 #endif /* __IMMAP_512x__ */
board/freescale/mpc5121ads/mpc5121ads.c +3 -1
index 2e13ea8..4c0caa7 100644
@@ -53,7 +53,9 @@ DECLARE_GLOBAL_DATA_PTR;
 #define SCCR2_CLOCKS_EN	(CLOCK_SCCR2_DIU_EN |		\
 			 CLOCK_SCCR2_I2C_EN |		\
 			 CLOCK_SCCR2_MEM_EN |		\
-			 CLOCK_SCCR2_SPDIF_EN)
+			 CLOCK_SCCR2_SPDIF_EN |  	\
+			 CLOCK_SCCR2_USB1_EN | 		\
+			 CLOCK_SCCR2_USB2_EN)
 
 void __mpc5121_nfc_select_chip(struct mtd_info *mtd, int chip);
 
drivers/usb/host/ehci-fsl.c +136 -1

156 lines not on this page · raw message

drivers/usb/host/ehci.h +5 -0
index b3c1d5d..5ba612d 100644
@@ -71,6 +71,11 @@ struct ehci_hcor {
 #define	STD_ASS		(1 << 15)
 #define STS_HALT	(1 << 12)
 	uint32_t or_usbintr;
+#define INTR_UE		(1 << 0)		/* USB interrupt enable */
+#define INTR_UEE	(1 << 1)		/* USB error interrupt enable */
+#define INTR_PCE	(1 << 2)		/* Port change detect enable */
+#define INTR_SEE	(1 << 4)		/* system error enable */
+#define INTR_AAE	(1 << 5)		/* Int on async adavance */
 	uint32_t or_frindex;
 	uint32_t or_ctrldssegment;
 	uint32_t or_periodiclistbase;
include/configs/mpc5121ads.h +21 -1
index 5281042..ce0df57 100644
@@ -374,6 +374,20 @@
 #define CONFIG_SYS_I2C_RTC_ADDR		0x68	/*@address 0x68		*/
 
 /*
+ * USB  Support
+ */
+#define CONFIG_CMD_USB
+
+#if defined(CONFIG_CMD_USB)
+#define CONFIG_USB_EHCI				/* Enable EHCI Support	*/
+#define CONFIG_USB_EHCI_FSL			/* On a FSL platform	*/
+#define CONFIG_EHCI_MMIO_BIG_ENDIAN		/* With big-endian regs	*/
+#define CONFIG_EHCI_DESC_BIG_ENDIAN
+#define CONFIG_EHCI_IS_TDI
+#define CONFIG_USB_STORAGE
+#endif
+
+/*
  * Environment
  */
 #define CONFIG_ENV_IS_IN_FLASH	1
@@ -441,10 +455,16 @@
 					"mpc5121.nand:-(data)"
 
 
-#if defined(CONFIG_CMD_IDE) || defined(CONFIG_CMD_EXT2)
+#if defined(CONFIG_CMD_IDE) || defined(CONFIG_CMD_EXT2) || \
+	defined(CONFIG_CMD_USB)
+
 #define CONFIG_DOS_PARTITION
 #define CONFIG_MAC_PARTITION
 #define CONFIG_ISO_PARTITION
+
+#define CONFIG_CMD_FAT
+#define CONFIG_SUPPORT_VFAT
+
 #endif /* defined(CONFIG_CMD_IDE) */
 
 /*
include/usb/ehci-fsl.h +123 -26

207 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 1/1 Add support for the MPC5121e USB Host controller.

Hi Damien

this patch seems to be doing alot better then the original one.
The root hub is detected and also it detects a device connected to the controller. However, by testing with a usbstick (mass storage) it fails to detect the device as a storage device.

I have here a debug printout which is being printed (with debug enabled) during execution of the command 'usb start':

-----------------------------------------------------------------------------

=> usb start
(Re)start USB...
Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... New Device 0
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x100 index 0x0 length 0x40 set address 1
usb_control_msg: request: 0x5, requesttype: 0x0, value 0x1 index 0x0 length 0x0
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x100 index 0x0 length 0x12
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x200 index 0x0 length 0x9
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x200 index 0x0 length 0x19 get_conf_no 0 Result 25, wLength 25
if 0, ep 0
##EP epmaxpacketin[1] = 2048
set configuration 1
usb_control_msg: request: 0x9, requesttype: 0x0, value 0x1 index 0x0 length 0x0 new device strings: Mfr=1, Product=2, SerialNumber=0
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x300 index 0x0 length 0xFF USB device number 1 default language ID 0x1
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x301 index 0x1 length 0xFF
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x302 index 0x1 length 0xFF Manufacturer u-boot
Product EHCI Host Controller
SerialNumber
USB hub found
usb_control_msg: request: 0x6, requesttype: 0xA0, value 0x2900 index 0x0 length 0x4
usb_control_msg: request: 0x6, requesttype: 0xA0, value 0x2900 index 0x0 length 0x8 1 ports detected
ganged power switching
standalone hub
global over-current protection
power on to power good time: 510ms
hub controller current requirement: 0mA
port 1 is not removable
usb_control_msg: request: 0x0, requesttype: 0xA0, value 0x0 index 0x0 length 0x4 get_hub_status returned status 1, change 1
local power source is lost (inactive)
no over-current condition exists
enabling power on all ports
usb_control_msg: request: 0x3, requesttype: 0x23, value 0x8 index 0x1 length 0x0 port 1 returns 0
usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x1 length 0x4 Port 1 Status 101 Change 1
port 1 connection change
usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x1 length 0x4 portstatus 101, change 1, 12 Mb/s
usb_control_msg: request: 0x1, requesttype: 0x23, value 0x10 index 0x1 length 0x0
hub_port_reset: resetting port 0...
usb_control_msg: request: 0x3, requesttype: 0x23, value 0x4 index 0x1 length 0x0
usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x1 length 0x4 portstatus 503, change 10, 480 Mb/s
STAT_C_CONNECTION = 0 STAT_CONNECTION = 1 USB_PORT_STAT_ENABLE 1
usb_control_msg: request: 0x1, requesttype: 0x23, value 0x14 index 0x1 length 0x0 New Device 1
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x100 index 0x0 length 0x40
hub_port_reset: resetting port 0...
usb_control_msg: request: 0x3, requesttype: 0x23, value 0x4 index 0x1 length 0x0
usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x1 length 0x4 portstatus 503, change 10, 480 Mb/s
STAT_C_CONNECTION = 0 STAT_CONNECTION = 1 USB_PORT_STAT_ENABLE 1
usb_control_msg: request: 0x1, requesttype: 0x23, value 0x14 index 0x1 length 0x0 set address 2
usb_control_msg: request: 0x5, requesttype: 0x0, value 0x2 index 0x0 length 0x0
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x100 index 0x0 length 0x12
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x200 index 0x0 length 0x9
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x200 index 0x0 length 0x19 get_conf_no 0 Result 25, wLength 25
if 0, ep 0
##EP epmaxpacketin[1] = 1
set configuration 1
usb_control_msg: request: 0x9, requesttype: 0x0, value 0x1 index 0x0 length 0x0 new device strings: Mfr=0, Product=0, SerialNumber=0
Manufacturer
Product
SerialNumber
USB hub found
usb_control_msg: request: 0x6, requesttype: 0xA0, value 0x2900 index 0x0 length 0x4
usb_control_msg: request: 0x6, requesttype: 0xA0, value 0x2900 index 0x0 length 0x9 4 ports detected
individual port power switching
standalone hub
individual port over-current protection
power on to power good time: 100ms
hub controller current requirement: 100mA
port 1 is removable
port 2 is removable
port 3 is removable
port 4 is removable
usb_control_msg: request: 0x0, requesttype: 0xA0, value 0x0 index 0x0 length 0x4 get_hub_status returned status 0, change 0
local power source is good
no over-current condition exists
enabling power on all ports
usb_control_msg: request: 0x3, requesttype: 0x23, value 0x8 index 0x1 length 0x0 port 1 returns 0
usb_control_msg: request: 0x3, requesttype: 0x23, value 0x8 index 0x2 length 0x0 port 2 returns 0
usb_control_msg: request: 0x3, requesttype: 0x23, value 0x8 index 0x3 length 0x0 port 3 returns 0
usb_control_msg: request: 0x3, requesttype: 0x23, value 0x8 index 0x4 length 0x0 port 4 returns 0
usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x1 length 0x4 Port 1 Status 100 Change 0
usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x2 length 0x4 Port 2 Status 101 Change 1
port 2 connection change
usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x2 length 0x4 portstatus 101, change 1, 12 Mb/s
usb_control_msg: request: 0x1, requesttype: 0x23, value 0x10 index 0x2 length 0x0
hub_port_reset: resetting port 1...
usb_control_msg: request: 0x3, requesttype: 0x23, value 0x4 index 0x2 length 0x0
usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x2 length 0x4 portstatus 103, change 10, 12 Mb/s
STAT_C_CONNECTION = 0 STAT_CONNECTION = 1 USB_PORT_STAT_ENABLE 1
usb_control_msg: request: 0x1, requesttype: 0x23, value 0x14 index 0x2 length 0x0 New Device 2
usb_control_msg: request: 0x6, requesttype: 0x80, value 0x100 index 0x0 length 0x40
usb_new_device: usb_get_descriptor() failed
hub: disabling port 2
usb_control_msg: request: 0x1, requesttype: 0x23, value 0x1 index 0x2 length 0x0
usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x3 length 0x4 get_port_status failed
usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x4 length 0x4 get_port_status failed
3 USB Device(s) found
scanning bus for storage devices... i=0
i=1
i=2
i=3
0 Storage Device(s) found
=>

-----------------------------------------------------------------------------

If I type 'usb storage' it says it has one device but the type is unknown.

Hope you can assist me in this.

regards
Einar
________________________________________
From: [email protected] [u-boot-bounces at lists.denx.de] on behalf of Damien Dusha [d.dusha at gmail.com]
Sent: Sunday, August 22, 2010 5:41 AM
To: u-boot at lists.denx.de
Cc: Damien Dusha
Subject: [U-Boot] [PATCH] Add support for the MPC5121e USB Host controller.

Add support for the USB Host controller of the MPC5121e, based on the original patch by Francesco Rendine [1].

The patch configures the USB Host controller and the on-board UTMI phy, including the Freescale-specific registers as per the Linux kernel driver.

Tested on the MPC5121ADS platform with various USB mass storage devices.

[1] http://lists.denx.de/pipermail/u-boot/2009-June/055022.html

---
 arch/powerpc/include/asm/immap_512x.h   |    4 +
 board/freescale/mpc5121ads/mpc5121ads.c |    4 +-
 drivers/usb/host/ehci-fsl.c             |  137 ++++++++++++++++++++++++++++-
 drivers/usb/host/ehci.h                 |    5 +
 include/configs/mpc5121ads.h            |   22 +++++-
 include/usb/ehci-fsl.h                  |  149 +++++++++++++++++++++++++------
 6 files changed, 292 insertions(+), 29 deletions(-)
arch/powerpc/include/asm/immap_512x.h +4 -0
index 7f9db8b..4923a17 100644
@@ -1246,4 +1246,8 @@ static inline u32 get_pata_base (void)
 }
 #endif /* __ASSEMBLY__ */
 
+#define CONFIG_SYS_MPC512x_USB_OFFSET   0x4000
+#define CONFIG_SYS_MPC512x_USB_ADDR \
+       (CONFIG_SYS_IMMR + CONFIG_SYS_MPC512x_USB_OFFSET)
+
 #endif /* __IMMAP_512x__ */
board/freescale/mpc5121ads/mpc5121ads.c +3 -1
index 2e13ea8..4c0caa7 100644
@@ -53,7 +53,9 @@ DECLARE_GLOBAL_DATA_PTR;
 #define SCCR2_CLOCKS_EN        (CLOCK_SCCR2_DIU_EN |           \
                         CLOCK_SCCR2_I2C_EN |           \
                         CLOCK_SCCR2_MEM_EN |           \
-                        CLOCK_SCCR2_SPDIF_EN)
+                        CLOCK_SCCR2_SPDIF_EN |         \
+                        CLOCK_SCCR2_USB1_EN |          \
+                        CLOCK_SCCR2_USB2_EN)
 
 void __mpc5121_nfc_select_chip(struct mtd_info *mtd, int chip);
 
drivers/usb/host/ehci-fsl.c +136 -1

156 lines not on this page · raw message

drivers/usb/host/ehci.h +5 -0
index b3c1d5d..5ba612d 100644
@@ -71,6 +71,11 @@ struct ehci_hcor {
 #define        STD_ASS         (1 << 15)
 #define STS_HALT       (1 << 12)
        uint32_t or_usbintr;
+#define INTR_UE                (1 << 0)                /* USB interrupt enable */
+#define INTR_UEE       (1 << 1)                /* USB error interrupt enable */
+#define INTR_PCE       (1 << 2)                /* Port change detect enable */
+#define INTR_SEE       (1 << 4)                /* system error enable */
+#define INTR_AAE       (1 << 5)                /* Int on async adavance */
        uint32_t or_frindex;
        uint32_t or_ctrldssegment;
        uint32_t or_periodiclistbase;
include/configs/mpc5121ads.h +21 -1
index 5281042..ce0df57 100644
@@ -374,6 +374,20 @@
 #define CONFIG_SYS_I2C_RTC_ADDR                0x68    /* at address 0x68              */
 
 /*
+ * USB  Support
+ */
+#define CONFIG_CMD_USB
+
+#if defined(CONFIG_CMD_USB)
+#define CONFIG_USB_EHCI                                /* Enable EHCI Support  */
+#define CONFIG_USB_EHCI_FSL                    /* On a FSL platform    */
+#define CONFIG_EHCI_MMIO_BIG_ENDIAN            /* With big-endian regs */
+#define CONFIG_EHCI_DESC_BIG_ENDIAN
+#define CONFIG_EHCI_IS_TDI
+#define CONFIG_USB_STORAGE
+#endif
+
+/*
  * Environment
  */
 #define CONFIG_ENV_IS_IN_FLASH 1
@@ -441,10 +455,16 @@
                                        "mpc5121.nand:-(data)"
 
 
-#if defined(CONFIG_CMD_IDE) || defined(CONFIG_CMD_EXT2)
+#if defined(CONFIG_CMD_IDE) || defined(CONFIG_CMD_EXT2) || \
+       defined(CONFIG_CMD_USB)
+
 #define CONFIG_DOS_PARTITION
 #define CONFIG_MAC_PARTITION
 #define CONFIG_ISO_PARTITION
+
+#define CONFIG_CMD_FAT
+#define CONFIG_SUPPORT_VFAT
+
 #endif /* defined(CONFIG_CMD_IDE) */
 
 /*
include/usb/ehci-fsl.h +123 -26

207 lines not on this page · raw message

--
1.7.0.4

_______________________________________________
U-Boot mailing list
[email protected]
http://lists.denx.de/mailman/listinfo/u-boot

#2 lore raw

PATCH 1/1 Add support for the MPC5121e USB Host controller.

Hi Elinar,

Quoted 9 lines

The root hub is detected and also it detects a device connected to the controller.
However, by testing with a usbstick (mass storage) it fails to detect the device as a storage device.

I have here a debug printout which is being printed (with debug enabled) during execution of the command 'usb start':

Unfortunately, our experience also shows some USB Mass Storage Devices

work better than others. For example, we are able to reproduce some of the
issues we have on the SheevaPlug (Marvel Kirkwood ARM) with the same combinations of hubs and USB sticks. Do you have another USB Host board available to try to see if your issue is reproducible across platforms?

Are you able to list the hub and the USB Stick that you are using below? Is it reproducible across different hubs and sticks? For example, SMSC hubs
tend to exhibit the problems far more than Genesys Logic hubs. I have no
experience with Cypress hubs as to whether they perform any better or not.

If you search the mailing list, I asked about the same issue some time ago.

-- Damien

#3 lore raw

PATCH 1/1 Add support for the MPC5121e USB Host controller.

Hi Damien

This patch didn't fix the problem, behaves exactly the same.

I'm using 2 usb sticks for testing: Corsair (32BG) and Doulos (128MB) both formatted with vfat. My board contains NXP ISP1520 USB Hub.
Neither of these sticks are being detected correctly, in fact the Corsair is not detected at all.

By using 'usb start' it detects 3 devices (2 ports and 1 device I assume). Output from 'usb tree' and 'usb info' gives me not much information but some:

--------------------------------------------------------------------------------

=> usb tree

Device Tree:
1 Hub (480 Mb/s, 0mA)
| u-boot EHCI Host Controller
|
+-0 See Interface (480 Mb/s, 0mA)

=> usb info
1: Hub, USB Revision 2.0
- u-boot EHCI Host Controller
- Class: Hub
- PacketSize: 64 Configurations: 1
- Vendor: 0x0000 Product 0x0000 Version 1.0
Configuration: 1
- Interfaces: 1 Self Powered 0mA
Interface: 0
- Alternate Setting 0, Endpoints: 1
- Class Hub
- Endpoint 1 In Interrupt MaxPacket 2048 Interval 0ms

Configuration: 0
- Interfaces: 0 Bus Powered 0mA

=>

--------------------------------------------------------------------------------

I have tested successfully the Doulos stick on another board with mpc5200 which don't have any USB Hub, just using the 2 on-chip ports. The Corsair stick is not working, halts the cpu.

Regards
Einar

________________________________
From: Damien Dusha [d.dusha at gmail.com]
Sent: Wednesday, August 25, 2010 12:45 AM
To: Einar M?r Bj?rgvinsson
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH] Add support for the MPC5121e USB Host controller.

Hi Elinar,

The root hub is detected and also it detects a device connected to the controller. However, by testing with a usbstick (mass storage) it fails to detect the device as a storage device.

I have here a debug printout which is being printed (with debug enabled) during execution of the command 'usb start':

Unfortunately, our experience also shows some USB Mass Storage Devices work better than others. For example, we are able to reproduce some of the issues we have on the SheevaPlug (Marvel Kirkwood ARM) with the same combinations of hubs and USB sticks. Do you have another USB Host board available to try to see if your issue is reproducible across platforms?

Are you able to list the hub and the USB Stick that you are using below? Is it reproducible across different hubs and sticks? For example, SMSC hubs tend to exhibit the problems far more than Genesys Logic hubs. I have no experience with Cypress hubs as to whether they perform any better or not.

If you search the mailing list, I asked about the same issue some time ago.

-- Damien

#4 lore raw

PATCH 1/1 Add support for the MPC5121e USB Host controller.

Hi Einar,

Quoted 5 lines

I'm using 2 usb sticks for testing: Corsair (32BG) and Doulos (128MB) both formatted with vfat. My board contains NXP ISP1520 USB Hub.
Neither of these sticks are being detected correctly, in fact the Corsair is not detected at all.

I have tested successfully the Doulos stick on another board with mpc5200 which don't have any USB Hub, just using the 2 on-chip ports. The Corsair stick is not working, halts the cpu.

If you have spare hardware, are you able to remove and bypass the hub to determine if you still see the same u-boot issues? Conversely, are you able to connect this hub (for example a dev kit or a commerical hub with this chipset) to the MPC5200 to see if you still have issues?
I'm trying to determine the hub's role, if at all possible.

Other than that, I'm a little short of ideas. Potentially some timing since (IIRC) the mpc5200 is full-speed not high speed? I'm kind of clutching at straws here.

Maybe someone with a bit more knowledge about USB can make a more informed comment.

-- Damien

#5 lore raw

PATCH 1/1 Add support for the MPC5121e USB Host controller.

In reply to Damien Dusha

Dear Damien Dusha,

Quoted 9 lines · In message <[email protected]> you wrote:

Add support for the USB Host controller of the MPC5121e, based on the original patch by Francesco Rendine [1].

The patch configures the USB Host controller and the on-board UTMI phy, including the Freescale-specific registers as per the Linux kernel driver.

Tested on the MPC5121ADS platform with various USB mass storage devices.

[1] http://lists.denx.de/pipermail/u-boot/2009-June/055022.html

Quoted 8 lines
---
 arch/powerpc/include/asm/immap_512x.h   |    4 +
 board/freescale/mpc5121ads/mpc5121ads.c |    4 +-
 drivers/usb/host/ehci-fsl.c             |  137 ++++++++++++++++++++++++++++-
 drivers/usb/host/ehci.h                 |    5 +
 include/configs/mpc5121ads.h            |   22 +++++-
 include/usb/ehci-fsl.h                  |  149 +++++++++++++++++++++++++------
 6 files changed, 292 insertions(+), 29 deletions(-)

Sorry for the late response.

I have to admit that I really dislike the big "#ifndef CONFIG_MPC512X" in drivers/usb/host/ehci-fsl.c - it covers basicly all of the existing code, and adds an alternative implementation for MPC512x. I think this should better be handled in a separate driver.

Patch following.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The ultimate barrier is one's viewpoint.
                        - Terry Pratchett, _The Dark Side of the Sun_
#6 lore raw

PATCH 1/1 MPC5121: Add USB EHCI support

In reply to Damien Dusha

From: Damien Dusha <[email protected]>

Coding style cleanup; slight file restructuring.

---
 arch/powerpc/include/asm/immap_512x.h   |    4 +
 board/freescale/mpc5121ads/mpc5121ads.c |    4 +-
 drivers/usb/host/Makefile               |    4 +
 drivers/usb/host/ehci-fsl.c             |    2 +-
 drivers/usb/host/ehci-mpc512x.c         |  159 +++++++++++++++++++++++++++++++
 drivers/usb/host/ehci.h                 |    5 +
 include/configs/mpc5121ads.h            |   21 ++++-
 include/usb/ehci-fsl.h                  |  148 +++++++++++++++++++++++-----
 8 files changed, 318 insertions(+), 29 deletions(-)
 create mode 100644 drivers/usb/host/ehci-mpc512x.c
arch/powerpc/include/asm/immap_512x.h +4 -0
index 7f9db8b..f763a54 100644
@@ -1246,4 +1246,8 @@ static inline u32 get_pata_base (void)
 }
 #endif	/* __ASSEMBLY__ */
 
+#define CONFIG_SYS_MPC512x_USB_OFFSET   0x4000
+#define CONFIG_SYS_MPC512x_USB_ADDR \
+			(CONFIG_SYS_IMMR + CONFIG_SYS_MPC512x_USB_OFFSET)
+
 #endif /* __IMMAP_512x__ */
board/freescale/mpc5121ads/mpc5121ads.c +3 -1
index 8cc6853..b356a47 100644
@@ -53,7 +53,9 @@ DECLARE_GLOBAL_DATA_PTR;
 #define SCCR2_CLOCKS_EN	(CLOCK_SCCR2_DIU_EN |		\
 			 CLOCK_SCCR2_I2C_EN |		\
 			 CLOCK_SCCR2_MEM_EN |		\
-			 CLOCK_SCCR2_SPDIF_EN)
+			 CLOCK_SCCR2_SPDIF_EN |  	\
+			 CLOCK_SCCR2_USB1_EN | 		\
+			 CLOCK_SCCR2_USB2_EN)
 
 void __mpc5121_nfc_select_chip(struct mtd_info *mtd, int chip);
 
drivers/usb/host/Makefile +4 -0
index 255679a..c4ce04b 100644
@@ -35,7 +35,11 @@ COBJS-$(CONFIG_USB_SL811HS) += sl811-hcd.o
 
 # echi
 COBJS-$(CONFIG_USB_EHCI) += ehci-hcd.o
+ifdef CONFIG_MPC512X
+COBJS-$(CONFIG_USB_EHCI_FSL) += ehci-mpc512x.o
+else
 COBJS-$(CONFIG_USB_EHCI_FSL) += ehci-fsl.o
+endif
 COBJS-$(CONFIG_USB_EHCI_PPC4XX) += ehci-ppc4xx.o
 COBJS-$(CONFIG_USB_EHCI_IXP4XX) += ehci-ixp.o
 COBJS-$(CONFIG_USB_EHCI_KIRKWOOD) += ehci-kirkwood.o
drivers/usb/host/ehci-fsl.c +1 -1
index c674929..6e0043a 100644
@@ -40,7 +40,7 @@ int ehci_hcd_init(void)
 {
 	struct usb_ehci *ehci;
 
-	ehci = (struct usb_ehci *)CONFIG_SYS_MPC8xxx_USB_ADDR;
+	ehci = (struct usb_ehci *)CONFIG_SYS_FSL_USB_ADDR;
 	hccr = (struct ehci_hccr *)((uint32_t)&ehci->caplength);
 	hcor = (struct ehci_hcor *)((uint32_t) hccr +
 			HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
drivers/usb/host/ehci-mpc512x.c new file +159 -0

159 lines not on this page · raw message

drivers/usb/host/ehci.h +5 -0
index b3c1d5d..6fae8ba 100644
@@ -71,6 +71,11 @@ struct ehci_hcor {
 #define	STD_ASS		(1 << 15)
 #define STS_HALT	(1 << 12)
 	uint32_t or_usbintr;
+#define INTR_UE         (1 << 0)                /* USB interrupt enable */
+#define INTR_UEE        (1 << 1)                /* USB error interrupt enable */
+#define INTR_PCE        (1 << 2)                /* Port change detect enable */
+#define INTR_SEE        (1 << 4)                /* system error enable */
+#define INTR_AAE        (1 << 5)                /* Interrupt on async adavance enable */
 	uint32_t or_frindex;
 	uint32_t or_ctrldssegment;
 	uint32_t or_periodiclistbase;
include/configs/mpc5121ads.h +20 -1
index 3740316..6b7bfdb 100644
@@ -375,6 +375,20 @@
 #define CONFIG_SYS_I2C_RTC_ADDR		0x68	/*@address 0x68		*/
 
 /*
+ * USB  Support
+ */
+#define CONFIG_CMD_USB
+
+#if defined(CONFIG_CMD_USB)
+#define CONFIG_USB_EHCI				/* Enable EHCI Support	*/
+#define CONFIG_USB_EHCI_FSL			/* On a FSL platform	*/
+#define CONFIG_EHCI_MMIO_BIG_ENDIAN		/* With big-endian regs	*/
+#define CONFIG_EHCI_DESC_BIG_ENDIAN
+#define CONFIG_EHCI_IS_TDI
+#define CONFIG_USB_STORAGE
+#endif
+
+/*
  * Environment
  */
 #define CONFIG_ENV_IS_IN_FLASH	1
@@ -442,10 +456,15 @@
 					"mpc5121.nand:-(data)"
 
 
-#if defined(CONFIG_CMD_IDE) || defined(CONFIG_CMD_EXT2)
+#if defined(CONFIG_CMD_IDE) || defined(CONFIG_CMD_EXT2) || defined(CONFIG_CMD_USB)
+
 #define CONFIG_DOS_PARTITION
 #define CONFIG_MAC_PARTITION
 #define CONFIG_ISO_PARTITION
+
+#define CONFIG_CMD_FAT
+#define CONFIG_SUPPORT_VFAT
+
 #endif /* defined(CONFIG_CMD_IDE) */
 
 /*
include/usb/ehci-fsl.h +122 -26

206 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#7 lore raw

PATCH 1/1 MPC5121: Add USB EHCI support

Dear Remy,

Quoted 8 lines · In message <[email protected]> I wrote:

From: Damien Dusha <[email protected]>

Coding style cleanup; slight file restructuring.

Quoted 11 lines
---
 arch/powerpc/include/asm/immap_512x.h   |    4 +
 board/freescale/mpc5121ads/mpc5121ads.c |    4 +-
 drivers/usb/host/Makefile               |    4 +
 drivers/usb/host/ehci-fsl.c             |    2 +-
 drivers/usb/host/ehci-mpc512x.c         |  159 +++++++++++++++++++++++++++++++
 drivers/usb/host/ehci.h                 |    5 +
 include/configs/mpc5121ads.h            |   21 ++++-
 include/usb/ehci-fsl.h                  |  148 +++++++++++++++++++++++-----
 8 files changed, 318 insertions(+), 29 deletions(-)
 create mode 100644 drivers/usb/host/ehci-mpc512x.c

How would you like to handle this?

Shall I send you an ACK for the MPC512x related parts, and you pull through the USB repo, or do you prefer to send me your ACK for the USB parts, and I pull through the MPC5xxx repos?

in any case:

Tested on MPC5121ADS board.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I came home the other night and tried to open the door  with  my  car
keys...and  the  building started up. So I took it out for a drive. A
cop pulled me over for speeding. He asked me where I  live...  "Right
here".                                                - Steven Wright
#8 lore raw

PATCH 1/1 MPC5121: Add USB EHCI support

Hi Wolfgang,

2010/10/14 Wolfgang Denk <[email protected]>:

Quoted 23 lines

Dear Remy,

Quoted 17 lines · In message <[email protected]> I wrote:

From: Damien Dusha <[email protected]>

Coding style cleanup; slight file restructuring.

---

?arch/powerpc/include/asm/immap_512x.h ? | ? ?4 +
?board/freescale/mpc5121ads/mpc5121ads.c | ? ?4 +-
?drivers/usb/host/Makefile ? ? ? ? ? ? ? | ? ?4 +
?drivers/usb/host/ehci-fsl.c ? ? ? ? ? ? | ? ?2 +-
?drivers/usb/host/ehci-mpc512x.c ? ? ? ? | ?159 +++++++++++++++++++++++++++++++
?drivers/usb/host/ehci.h ? ? ? ? ? ? ? ? | ? ?5 +
?include/configs/mpc5121ads.h ? ? ? ? ? ?| ? 21 ++++-
?include/usb/ehci-fsl.h ? ? ? ? ? ? ? ? ?| ?148 +++++++++++++++++++++++-----
Quoted 2 lines

?8 files changed, 318 insertions(+), 29 deletions(-) ?create mode 100644 drivers/usb/host/ehci-mpc512x.c

Quoted 5 lines

How would you like to handle this?

Shall I send you an ACK for the MPC512x related parts, and you pull through the USB repo, or do you prefer to send me your ACK for the USB parts, and I pull through the MPC5xxx repos?

Go ahead!

Thanks,

Remy

#9 lore raw

PATCH 1/1 MPC5121: Add USB EHCI support

In reply to Wolfgang Denk
Quoted 8 lines · In message <[email protected]> I wrote:

From: Damien Dusha <[email protected]>

Coding style cleanup; slight file restructuring.

Quoted 11 lines
---
 arch/powerpc/include/asm/immap_512x.h   |    4 +
 board/freescale/mpc5121ads/mpc5121ads.c |    4 +-
 drivers/usb/host/Makefile               |    4 +
 drivers/usb/host/ehci-fsl.c             |    2 +-
 drivers/usb/host/ehci-mpc512x.c         |  159 +++++++++++++++++++++++++++++++
 drivers/usb/host/ehci.h                 |    5 +
 include/configs/mpc5121ads.h            |   21 ++++-
 include/usb/ehci-fsl.h                  |  148 +++++++++++++++++++++++-----
 8 files changed, 318 insertions(+), 29 deletions(-)
 create mode 100644 drivers/usb/host/ehci-mpc512x.c

Applied.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You get a wonderful view from the point of no return.
                                    - Terry Pratchett, _Making_Money_
#10 lore raw

PATCH 1/1 MPC8315ERD: fix build error

In reply to Wolfgang Denk

Commit 29c6fbe "MPC5121: Add USB EHCI support" renamed CONFIG_SYS_MPC8xxx_USB_ADDR into CONFIG_SYS_FSL_USB_ADDR but missed to update arch/powerpc/cpu/mpc83xx/cpu_init.c, resulting in:

cpu_init.c: In function 'cpu_init_f':
cpu_init.c:332: error: 'CONFIG_SYS_MPC8xxx_USB_ADDR' undeclared (first use in this function) cpu_init.c:332: error: (Each undeclared identifier is reported only once cpu_init.c:332: error: for each function it appears in.)
make[1]: *** [/work/wd/tmp-ppc/arch/powerpc/cpu/mpc83xx/cpu_init.o] Error 1

Fix this.

---
 arch/powerpc/cpu/mpc83xx/cpu_init.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/cpu/mpc83xx/cpu_init.c +1 -1
index f01c09a..7a1cae7 100644
@@ -329,7 +329,7 @@ void cpu_init_f (volatile immap_t * im)
 #ifdef CONFIG_USB_EHCI_FSL
 #ifndef CONFIG_MPC834x
 	uint32_t temp;
-	struct usb_ehci *ehci = (struct usb_ehci *)CONFIG_SYS_MPC8xxx_USB_ADDR;
+	struct usb_ehci *ehci = (struct usb_ehci *)CONFIG_SYS_FSL_USB_ADDR;
 
 	/* Configure interface. */
 	setbits_be32(&ehci->control, REFSEL_16MHZ | UTMI_PHY_EN);
Signature · 1 line
1.7.2.3
#11 lore raw

PATCH 1/1 MPC8315ERD: fix build error

Quoted 10 lines · In message <[email protected]> you wrote:

Commit 29c6fbe "MPC5121: Add USB EHCI support" renamed CONFIG_SYS_MPC8xxx_USB_ADDR into CONFIG_SYS_FSL_USB_ADDR but missed to update arch/powerpc/cpu/mpc83xx/cpu_init.c, resulting in:

cpu_init.c: In function 'cpu_init_f':
cpu_init.c:332: error: 'CONFIG_SYS_MPC8xxx_USB_ADDR' undeclared (first use in this function) cpu_init.c:332: error: (Each undeclared identifier is reported only once cpu_init.c:332: error: for each function it appears in.)
make[1]: *** [/work/wd/tmp-ppc/arch/powerpc/cpu/mpc83xx/cpu_init.o] Error 1

Quoted 7 lines

Fix this.

---
 arch/powerpc/cpu/mpc83xx/cpu_init.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Applied.

Hope this is OK with you, Kim?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Well, the way I see it, logic is only a way of being ignorant by num-
bers.                                 - Terry Pratchett, _Small Gods_