EHCI support for on-chip PMC MSP USB controller.
Subsystems (3)
PATCH 1/1 EHCI support for on-chip PMC MSP USB controller.
From: Anoop P A <[email protected]>
This patch includes.
1. USB host driver for MSP71xx family SoC on-chip USB controller.
2. Platform support for USB controller.
--- .../mips/include/asm/pmc-sierra/msp71xx/msp_regs.h | 17 +- arch/mips/include/asm/pmc-sierra/msp71xx/msp_usb.h | 144 +++++ arch/mips/pmc-sierra/Kconfig | 8 + arch/mips/pmc-sierra/msp71xx/Makefile | 2 +- arch/mips/pmc-sierra/msp71xx/msp_usb.c | 239 +++++++--- drivers/usb/core/hub.c | 31 ++ drivers/usb/host/Kconfig | 15 +- drivers/usb/host/ehci-hcd.c | 12 + drivers/usb/host/ehci-pmcmsp.c | 555 ++++++++++++++++++++ 9 files changed, 949 insertions(+), 74 deletions(-) create mode 100644 arch/mips/include/asm/pmc-sierra/msp71xx/msp_usb.h create mode 100644 drivers/usb/host/ehci-pmcmsp.c
arch/mips/include/asm/pmc-sierra/msp71xx/msp_regs.h +9 -8
@@ -91,12 +91,10 @@/* MAC C device registers */ #define MSP_ADSL2_BASE (MSP_MSB_BASE + 0xA80000)/* ADSL2 device registers */ -#define MSP_USB_BASE (MSP_MSB_BASE + 0xB40000) -/* USB device registers */ -#define MSP_USB_BASE_START (MSP_MSB_BASE + 0xB40100) -/* USB device registers */ -#define MSP_USB_BASE_END (MSP_MSB_BASE + 0xB401FF) -/* USB device registers */ +#define MSP_USB0_BASE (MSP_MSB_BASE + 0xB00000) +/* USB0 device registers */ +#define MSP_USB1_BASE (MSP_MSB_BASE + 0x300000) +/* USB1 device registers */ #define MSP_CPUIF_BASE (MSP_MSB_BASE + 0xC00000)/* CPU interface registers */
@@ -319,8 +317,11 @@#define CPU_ERR2_REG regptr(MSP_SLP_BASE + 0x184)/* CPU/SLP Error status 1 */ -#define EXTENDED_GPIO_REG regptr(MSP_SLP_BASE + 0x188) -/* Extended GPIO register */ +/* Extended GPIO registers */ +#define EXTENDED_GPIO1_REG regptr(MSP_SLP_BASE + 0x188) +#define EXTENDED_GPIO2_REG regptr(MSP_SLP_BASE + 0x18c) +#define EXTENDED_GPIO_REG EXTENDED_GPIO1_REG +/* Backward-compatibility */ /* System Error registers */ #define SLP_ERR_STS_REG regptr(MSP_SLP_BASE + 0x190)
arch/mips/include/asm/pmc-sierra/msp71xx/msp_usb.h new file +144 -0
144 lines not on this page · raw message
arch/mips/pmc-sierra/Kconfig +8 -0
@@ -23,6 +23,7 @@ config PMC_MSP7120_GW select SYS_SUPPORTS_MULTITHREADING select IRQ_MSP_CIC select HW_HAS_PCI + select MSP_HAS_USB config PMC_MSP7120_FPGA bool "PMC-Sierra MSP7120 FPGA"
@@ -35,3 +36,10 @@ endchoice config HYPERTRANSPORT bool "Hypertransport Support for PMC-Sierra Yosemite" depends on PMC_YOSEMITE + + +config MSP_HAS_USB + boolean + depends on PMC_MSP + select USB_ARCH_HAS_EHCI + select USB_ARCH_HAS_HCD
arch/mips/pmc-sierra/msp71xx/Makefile +1 -1
@@ -9,5 +9,5 @@ obj-$(CONFIG_IRQ_MSP_SLP) += msp_irq_slp.o obj-$(CONFIG_IRQ_MSP_CIC) += msp_irq_cic.o msp_irq_per.o obj-$(CONFIG_PCI) += msp_pci.o obj-$(CONFIG_MSPETH) += msp_eth.o -obj-$(CONFIG_USB_MSP71XX) += msp_usb.o +obj-$(CONFIG_MSP_HAS_USB) += msp_usb.o obj-$(CONFIG_MIPS_MT_SMP) += msp_smp.o
arch/mips/pmc-sierra/msp71xx/msp_usb.c +176 -63
307 lines not on this page · raw message
drivers/usb/core/hub.c +31 -0
@@ -3377,12 +3377,43 @@ static void hub_events(void) }if (portchange &USB_PORT_STAT_C_OVERCURRENT ) { +#ifdef CONFIG_USB_EHCI_HCD_PMC_MSP +#define OVER_CURR_DELAY 100 +/* clear OCC bit */ +clear_port_feature (hdev, i, +USB_PORT_FEAT_C_OVER_CURRENT ); + +/* This step is required to toggle the PP bit +* to 0 and 1 (by hub_power_on) in order the +* CSC bit to be transitioned +* properly for device hotplug +*/ +/* clear PP bit */ +clear_port_feature (hdev, i, +USB_PORT_FEAT_POWER ); + +/* resume power */ +hub_power_on (hub, true); + +/* delay 100 usec */ +udelay (OVER_CURR_DELAY ); + +/* read OCA bit */ +if (portstatus & + (1 <<USB_PORT_FEAT_OVER_CURRENT )) { +/* declare overcurrent */ +dev_err (hub_dev, +"over-current change on port %d\n" , + i); + } +#else dev_err (hub_dev,"over-current change on port %d\n" , i);clear_port_feature (hdev, i,USB_PORT_FEAT_C_OVER_CURRENT );hub_power_on (hub, true); +#endif }if (portchange &USB_PORT_STAT_C_RESET ) {
drivers/usb/host/Kconfig +13 -2
@@ -91,17 +91,28 @@ config USB_EHCI_TT_NEWSCHED If unsure, say Y. +config USB_EHCI_HCD_PMC_MSP + tristate "EHCI support for on-chip PMC MSP USB controller" + depends on USB_EHCI_HCD && MSP_HAS_USB + default y + select USB_EHCI_BIG_ENDIAN_DESC + select USB_EHCI_BIG_ENDIAN_MMIO + ---help--- + Enables support for the onchip USB controller on the PMC_MSP7100 Family SoC's. + If unsure, say N. + config USB_EHCI_BIG_ENDIAN_MMIO bool depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || \ ARCH_IXP4XX || XPS_USB_HCD_XILINX || \ - PPC_MPC512x || CPU_CAVIUM_OCTEON) + PPC_MPC512x || CPU_CAVIUM_OCTEON || \ + MSP_HAS_USB) default y config USB_EHCI_BIG_ENDIAN_DESC bool depends on USB_EHCI_HCD && (440EPX || ARCH_IXP4XX || XPS_USB_HCD_XILINX || \ - PPC_MPC512x) + PPC_MPC512x || MSP_HAS_USB) default y config XPS_USB_HCD_XILINX
drivers/usb/host/ehci-hcd.c +12 -0
@@ -120,6 +120,9 @@ MODULE_PARM_DESC(hird, "host initiated resume duration, +1 for each 75us\n");#include "ehci-dbg.c" /*-------------------------------------------------------------------------*/ +#ifdef CONFIG_USB_EHCI_HCD_PMC_MSP +extern void usb_hcd_tdi_set_mode (struct ehci_hcd *ehci); +#endif static void timer_action (struct ehci_hcd *ehci,enum ehci_timer_action action)
@@ -259,6 +262,10 @@ static void tdi_reset (struct ehci_hcd *ehci)if (ehci_big_endian_mmio (ehci)) tmp |=USBMODE_BE ;ehci_writel (ehci, tmp, reg_ptr); +#ifdef CONFIG_USB_EHCI_HCD_PMC_MSP +/* set controller in host mode */ +usb_hcd_tdi_set_mode (ehci); +#endif }/* reset a non-running (STS_HALT == 1) controller */
@@ -1216,6 +1223,11 @@ MODULE_LICENSE ("GPL");#define PLATFORM_DRIVER ehci_octeon_driver#endif +#ifdef CONFIG_USB_EHCI_HCD_PMC_MSP +#include "ehci-pmcmsp.c" +#define PLATFORM_DRIVER ehci_hcd_msp_driver +#endif +#if !defined(PCI_DRIVER ) && !defined(PLATFORM_DRIVER ) && \ !defined(PS3_SYSTEM_BUS_DRIVER ) && !defined(OF_PLATFORM_DRIVER ) && \ !defined(XILINX_OF_PLATFORM_DRIVER )
drivers/usb/host/ehci-pmcmsp.c new file +555 -0
555 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Alan Stern
maintainerQuoted 6 lines · Anoop P
From: Anoop P A <[email protected]>
This patch includes.
1. USB host driver for MSP71xx family SoC on-chip USB controller.
2. Platform support for USB controller.
It also contains changes to the core USB hub driver code. You should mention things like that in the patch description.
...
drivers/usb/core/hub.c static void hub_events(void) · line 3381
Quoted 10 lines
drivers/usb/core/hub.c +2
-0@@ -3377,12 +3377,43 @@ static void hub_events(void) }if (portchange &USB_PORT_STAT_C_OVERCURRENT ) { +#ifdef CONFIG_USB_EHCI_HCD_PMC_MSP +#define OVER_CURR_DELAY 100
What happens if CONFIG_USB_EHCI_HCD_PMC_MSP is defined, but an overcurrent status is detected on an external hub instead of the root hub?
Quoted 26 lines
drivers/usb/core/hub.c +26
-0+/* clear OCC bit */ +clear_port_feature (hdev, i, +USB_PORT_FEAT_C_OVER_CURRENT ); + +/* This step is required to toggle the PP bit +* to 0 and 1 (by hub_power_on) in order the +* CSC bit to be transitioned +* properly for device hotplug +*/ +/* clear PP bit */ +clear_port_feature (hdev, i, +USB_PORT_FEAT_POWER ); + +/* resume power */ +hub_power_on (hub, true); + +/* delay 100 usec */ +udelay (OVER_CURR_DELAY ); + +/* read OCA bit */ +if (portstatus & + (1 <<USB_PORT_FEAT_OVER_CURRENT )) { +/* declare overcurrent */ +dev_err (hub_dev, +"over-current change on port %d\n" , + i);
drivers/usb/core/hub.c static void hub_events(void) · line 3417
Quoted 10 lines
drivers/usb/core/hub.c +3
-0+ } +#else dev_err (hub_dev,"over-current change on port %d\n" , i);clear_port_feature (hdev, i,USB_PORT_FEAT_C_OVER_CURRENT );hub_power_on (hub, true); +#endif }
"#ifdef" inside code like this is strongly discouraged. This should be written using a separate subroutine.
...
Quoted 40 lines
drivers/usb/host/ehci-pmcmsp.c new file +34
-0+static const struct hc_driver ehci_msp_hc_driver = { + .description = hcd_name, + .product_desc ="PMC MSP EHCI" , + .hcd_priv_size =sizeof (struct ehci_hcd ), + +/* +* generic hardware linkage +*/ +#ifdef CONFIG_MSP_HAS_DUAL_USB + .irq = ehci_msp_irq, +#else + .irq = ehci_irq, +#endif + .flags =HCD_MEMORY |HCD_USB2 , + +/* +* basic lifecycle operations +*/ + .reset = ehci_msp_setup, + .start = ehci_run, +#ifdef CONFIG_PM + .suspend = ehci_msp_suspend, + .resume = ehci_msp_resume, +#endif /*CONFIG_PM*/ + .stop = ehci_stop, + +/* +* managing i/o requests and associated device resources +*/ + .urb_enqueue = ehci_urb_enqueue, + .urb_dequeue = ehci_urb_dequeue, + .endpoint_disable = ehci_endpoint_disable, + +/*
drivers/usb/host/ehci-pmcmsp.c line 510
Quoted 10 lines
drivers/usb/host/ehci-pmcmsp.c new file +10
-0+* scheduling support +*/ + .get_frame_number = ehci_get_frame, + +/* +* root hub support +*/ + .hub_status_data = ehci_hub_status_data, + .hub_control = ehci_hub_control, +};
This appears to have been copied from a really old version of ehci-pci.c. You should start with the most up-to-date code.
Alan Stern
Quoted 11 lines · Alan Stern
Quoted 6 lines · Anoop P
From: Anoop P A <[email protected]>
This patch includes.
1. USB host driver for MSP71xx family SoC on-chip USB controller.
2. Platform support for USB controller.It also contains changes to the core USB hub driver code. You should mention things like that in the patch description.
And that portion of the code should be split into a different patch to make it easier to review.
thanks,
greg k-h
v2 cover EHCI support for on-chip PMC MSP USB controller
In reply to Anoop PFrom: Anoop P A <[email protected]>
Changes Since V1:
1.Updated driver code with changes from ehci-pci.c 2.Moved over current fixup to different patch. 3.Removed #ifdef and added quirk list entry for overcurrent fixup.
Anoop P A (2):
EHCI support for on-chip PMC MSP USB controller. MSP onchip root hub over current quirk.
.../mips/include/asm/pmc-sierra/msp71xx/msp_regs.h | 17 +- arch/mips/include/asm/pmc-sierra/msp71xx/msp_usb.h | 144 +++++ arch/mips/pmc-sierra/Kconfig | 8 + arch/mips/pmc-sierra/msp71xx/Makefile | 2 +- arch/mips/pmc-sierra/msp71xx/msp_usb.c | 239 +++++++--- drivers/usb/core/hub.c | 45 ++- drivers/usb/core/quirks.c | 3 + drivers/usb/host/Kconfig | 15 +- drivers/usb/host/ehci-hcd.c | 12 + drivers/usb/host/ehci-pmcmsp.c | 551 ++++++++++++++++++++ include/linux/usb/quirks.h | 3 + 11 files changed, 959 insertions(+), 80 deletions(-) create mode 100644 arch/mips/include/asm/pmc-sierra/msp71xx/msp_usb.h create mode 100644 drivers/usb/host/ehci-pmcmsp.c
PATCH v2 1/2 EHCI support for on-chip PMC MSP USB controller.
In reply to Anoop PFrom: Anoop P A <[email protected]>
This patch includes.
1. USB host driver for MSP71xx family SoC on-chip USB controller.
2. Platform support for USB controller.
--- .../mips/include/asm/pmc-sierra/msp71xx/msp_regs.h | 17 +- arch/mips/include/asm/pmc-sierra/msp71xx/msp_usb.h | 144 +++++ arch/mips/pmc-sierra/Kconfig | 8 + arch/mips/pmc-sierra/msp71xx/Makefile | 2 +- arch/mips/pmc-sierra/msp71xx/msp_usb.c | 239 +++++++--- drivers/usb/host/Kconfig | 15 +- drivers/usb/host/ehci-hcd.c | 12 + drivers/usb/host/ehci-pmcmsp.c | 551 ++++++++++++++++++++ 8 files changed, 914 insertions(+), 74 deletions(-) create mode 100644 arch/mips/include/asm/pmc-sierra/msp71xx/msp_usb.h create mode 100644 drivers/usb/host/ehci-pmcmsp.c
arch/mips/include/asm/pmc-sierra/msp71xx/msp_regs.h +9 -8
@@ -91,12 +91,10 @@/* MAC C device registers */ #define MSP_ADSL2_BASE (MSP_MSB_BASE + 0xA80000)/* ADSL2 device registers */ -#define MSP_USB_BASE (MSP_MSB_BASE + 0xB40000) -/* USB device registers */ -#define MSP_USB_BASE_START (MSP_MSB_BASE + 0xB40100) -/* USB device registers */ -#define MSP_USB_BASE_END (MSP_MSB_BASE + 0xB401FF) -/* USB device registers */ +#define MSP_USB0_BASE (MSP_MSB_BASE + 0xB00000) +/* USB0 device registers */ +#define MSP_USB1_BASE (MSP_MSB_BASE + 0x300000) +/* USB1 device registers */ #define MSP_CPUIF_BASE (MSP_MSB_BASE + 0xC00000)/* CPU interface registers */
@@ -319,8 +317,11 @@#define CPU_ERR2_REG regptr(MSP_SLP_BASE + 0x184)/* CPU/SLP Error status 1 */ -#define EXTENDED_GPIO_REG regptr(MSP_SLP_BASE + 0x188) -/* Extended GPIO register */ +/* Extended GPIO registers */ +#define EXTENDED_GPIO1_REG regptr(MSP_SLP_BASE + 0x188) +#define EXTENDED_GPIO2_REG regptr(MSP_SLP_BASE + 0x18c) +#define EXTENDED_GPIO_REG EXTENDED_GPIO1_REG +/* Backward-compatibility */ /* System Error registers */ #define SLP_ERR_STS_REG regptr(MSP_SLP_BASE + 0x190)
arch/mips/include/asm/pmc-sierra/msp71xx/msp_usb.h new file +144 -0
144 lines not on this page · raw message
arch/mips/pmc-sierra/Kconfig +8 -0
@@ -23,6 +23,7 @@ config PMC_MSP7120_GW select SYS_SUPPORTS_MULTITHREADING select IRQ_MSP_CIC select HW_HAS_PCI + select MSP_HAS_USB config PMC_MSP7120_FPGA bool "PMC-Sierra MSP7120 FPGA"
@@ -35,3 +36,10 @@ endchoice config HYPERTRANSPORT bool "Hypertransport Support for PMC-Sierra Yosemite" depends on PMC_YOSEMITE + + +config MSP_HAS_USB + boolean + depends on PMC_MSP + select USB_ARCH_HAS_EHCI + select USB_ARCH_HAS_HCD
arch/mips/pmc-sierra/msp71xx/Makefile +1 -1
@@ -9,5 +9,5 @@ obj-$(CONFIG_IRQ_MSP_SLP) += msp_irq_slp.o obj-$(CONFIG_IRQ_MSP_CIC) += msp_irq_cic.o msp_irq_per.o obj-$(CONFIG_PCI) += msp_pci.o obj-$(CONFIG_MSPETH) += msp_eth.o -obj-$(CONFIG_USB_MSP71XX) += msp_usb.o +obj-$(CONFIG_MSP_HAS_USB) += msp_usb.o obj-$(CONFIG_MIPS_MT_SMP) += msp_smp.o
arch/mips/pmc-sierra/msp71xx/msp_usb.c +176 -63
307 lines not on this page · raw message
drivers/usb/host/Kconfig +13 -2
@@ -91,17 +91,28 @@ config USB_EHCI_TT_NEWSCHED If unsure, say Y. +config USB_EHCI_HCD_PMC_MSP + tristate "EHCI support for on-chip PMC MSP USB controller" + depends on USB_EHCI_HCD && MSP_HAS_USB + default y + select USB_EHCI_BIG_ENDIAN_DESC + select USB_EHCI_BIG_ENDIAN_MMIO + ---help--- + Enables support for the onchip USB controller on the PMC_MSP7100 Family SoC's. + If unsure, say N. + config USB_EHCI_BIG_ENDIAN_MMIO bool depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || \ ARCH_IXP4XX || XPS_USB_HCD_XILINX || \ - PPC_MPC512x || CPU_CAVIUM_OCTEON) + PPC_MPC512x || CPU_CAVIUM_OCTEON || \ + MSP_HAS_USB) default y config USB_EHCI_BIG_ENDIAN_DESC bool depends on USB_EHCI_HCD && (440EPX || ARCH_IXP4XX || XPS_USB_HCD_XILINX || \ - PPC_MPC512x) + PPC_MPC512x || MSP_HAS_USB) default y config XPS_USB_HCD_XILINX
drivers/usb/host/ehci-hcd.c +12 -0
@@ -120,6 +120,9 @@ MODULE_PARM_DESC(hird, "host initiated resume duration, +1 for each 75us\n");#include "ehci-dbg.c" /*-------------------------------------------------------------------------*/ +#ifdef CONFIG_USB_EHCI_HCD_PMC_MSP +extern void usb_hcd_tdi_set_mode (struct ehci_hcd *ehci); +#endif static void timer_action (struct ehci_hcd *ehci,enum ehci_timer_action action)
@@ -259,6 +262,10 @@ static void tdi_reset (struct ehci_hcd *ehci)if (ehci_big_endian_mmio (ehci)) tmp |=USBMODE_BE ;ehci_writel (ehci, tmp, reg_ptr); +#ifdef CONFIG_USB_EHCI_HCD_PMC_MSP +/* set controller in host mode */ +usb_hcd_tdi_set_mode (ehci); +#endif }/* reset a non-running (STS_HALT == 1) controller */
@@ -1216,6 +1223,11 @@ MODULE_LICENSE ("GPL");#define PLATFORM_DRIVER ehci_octeon_driver#endif +#ifdef CONFIG_USB_EHCI_HCD_PMC_MSP +#include "ehci-pmcmsp.c" +#define PLATFORM_DRIVER ehci_hcd_msp_driver +#endif +#if !defined(PCI_DRIVER ) && !defined(PLATFORM_DRIVER ) && \ !defined(PS3_SYSTEM_BUS_DRIVER ) && !defined(OF_PLATFORM_DRIVER ) && \ !defined(XILINX_OF_PLATFORM_DRIVER )
drivers/usb/host/ehci-pmcmsp.c new file +551 -0
551 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH v2 2/2 MSP onchip root hub over current quirk.
In reply to Anoop PFrom: Anoop P A <[email protected]>
Adding chip specific code under quirk.
--- drivers/usb/core/hub.c | 45 ++++++++++++++++++++++++++++++++++++++----- drivers/usb/core/quirks.c | 3 ++ include/linux/usb/quirks.h | 3 ++ 3 files changed, 45 insertions(+), 6 deletions(-)
drivers/usb/core/hub.c +39 -6
@@ -3377,12 +3377,45 @@ static void hub_events(void) }if (portchange &USB_PORT_STAT_C_OVERCURRENT ) { -dev_err (hub_dev, -"over-current change on port %d\n" , - i); -clear_port_feature (hdev, i, -USB_PORT_FEAT_C_OVER_CURRENT ); -hub_power_on (hub, true); +usb_detect_quirks (hdev); +if (hdev->quirks &USB_QUIRK_MSP_OVERCURRENT ) { +/* clear OCC bit */ +clear_port_feature (hdev, i, +USB_PORT_FEAT_C_OVER_CURRENT ); + +/* This step is required to toggle the +* PP bit to 0 and 1 (by hub_power_on) +* in order the CSC bit to be +* transitioned properly for device +* hotplug +*/ +/* clear PP bit */ +clear_port_feature (hdev, i, +USB_PORT_FEAT_POWER ); + +/* resume power */ +hub_power_on (hub, true); + +/* delay 100 usec */ +udelay (100 ); + +/* read OCA bit */ +if (portstatus & + (1 <<USB_PORT_FEAT_OVER_CURRENT )) { +/* declare overcurrent */ +dev_err (hub_dev, +"over-current change \ +on port %d\n" , i); + } + }else { +dev_err (hub_dev, +"over-current change \ +on port %d\n" , i); +clear_port_feature (hdev, i, +USB_PORT_FEAT_C_OVER_CURRENT ); +hub_power_on (hub, true); + } + }if (portchange &USB_PORT_STAT_C_RESET ) {
drivers/usb/core/quirks.c +3 -0
@@ -88,6 +88,9 @@ static const struct usb_device_id usb_quirk_list[] = {/* INTEL VALUE SSD */ { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, + /* PMC MSP over current quirk */ + { USB_DEVICE(0x1d6b, 0x0002), .driver_info = USB_QUIRK_MSP_OVERCURRENT }, + { }/* terminating entry must be last */ };
include/linux/usb/quirks.h +3 -0
@@ -30,4 +30,7 @@descriptor */ #define USB_QUIRK_DELAY_INIT 0x00000040 +/*MSP SoC onchip EHCI overcurrent issue */ +#define USB_QUIRK_MSP_OVERCURRENT 0x00000080 +#endif /* __LINUX_USB_QUIRKS_H */
Signature · 1 line
1.7.0.4
drivers/usb/host/ehci-hcd.c static void tdi_reset (struct ehci_hcd *ehci) · line 268
Quoted 11 lines · Anoop P.A
From: Anoop P A <[email protected]>
This patch includes.
1. USB host driver for MSP71xx family SoC on-chip USB controller.
drivers/usb/host/ehci-hcd.c +4
-0ehci_writel (ehci, tmp, reg_ptr); +#ifdef CONFIG_USB_EHCI_HCD_PMC_MSP +/* set controller in host mode */ +usb_hcd_tdi_set_mode (ehci); +#endif
Missed this one while cleaning :(
Quoted 1 line
}
Alan Stern
maintainerRe: [PATCH V2 2/2] MSP onchip root hub over current quirk.
In reply to Anoop P.AQuoted 3 lines · Anoop P.A
From: Anoop P A <[email protected]>
Adding chip specific code under quirk.
NAK. See below.
Quoted 12 lines
Signed-off-by Anoop P A <[email protected]>--- drivers/usb/core/hub.c | 45 ++++++++++++++++++++++++++++++++++++++----- drivers/usb/core/quirks.c | 3 ++ include/linux/usb/quirks.h | 3 ++ 3 files changed, 45 insertions(+), 6 deletions(-)drivers/usb/core/hub.c +0
-0
drivers/usb/core/hub.c static void hub_events(void) · line 3380
Quoted 10 lines
drivers/usb/core/hub.c +1
-6@@ -3377,12 +3377,45 @@ static void hub_events(void) }if (portchange &USB_PORT_STAT_C_OVERCURRENT ) { -dev_err (hub_dev, -"over-current change on port %d\n" , - i); -clear_port_feature (hdev, i, -USB_PORT_FEAT_C_OVER_CURRENT ); -hub_power_on (hub, true); +usb_detect_quirks (hdev);
This line is wrong. usb_detect_quirks() gets called only once per device, when the device is initialized. Besides, you probably want to use a hub-specific flag for this rather than a device-specific flag.
drivers/usb/core/hub.c static void hub_events(void) · line 3381
Quoted 1 line
drivers/usb/core/hub.c +1
-0+if (hdev->quirks &USB_QUIRK_MSP_OVERCURRENT ) {
Also, it would be better to put this code in a separate subroutine instead of indenting it so far.
Quoted 45 lines
drivers/usb/core/hub.c +37
-0+/* clear OCC bit */ +clear_port_feature (hdev, i, +USB_PORT_FEAT_C_OVER_CURRENT ); + +/* This step is required to toggle the +* PP bit to 0 and 1 (by hub_power_on) +* in order the CSC bit to be +* transitioned properly for device +* hotplug +*/ +/* clear PP bit */ +clear_port_feature (hdev, i, +USB_PORT_FEAT_POWER ); + +/* resume power */ +hub_power_on (hub, true); + +/* delay 100 usec */ +udelay (100 ); + +/* read OCA bit */ +if (portstatus & + (1 <<USB_PORT_FEAT_OVER_CURRENT )) { +/* declare overcurrent */ +dev_err (hub_dev, +"over-current change \ +on port %d\n" , i); + } + }else { +dev_err (hub_dev, +"over-current change \ +on port %d\n" , i); +clear_port_feature (hdev, i, +USB_PORT_FEAT_C_OVER_CURRENT ); +hub_power_on (hub, true); + } + }if (portchange &USB_PORT_STAT_C_RESET ) {drivers/usb/core/quirks.c +0
-0
drivers/usb/core/quirks.c static const struct usb_device_id usb_quirk_list[] = { · line 93
Quoted 6 lines
drivers/usb/core/quirks.c +3
-0@@ -88,6 +88,9 @@ static const struct usb_device_id usb_quirk_list[] = {/* INTEL VALUE SSD */ { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, + /* PMC MSP over current quirk */ + { USB_DEVICE(0x1d6b, 0x0002), .driver_info = USB_QUIRK_MSP_OVERCURRENT }, +
This implementation is completely wrong. It applies to all USB-2.0 root hubs in Linux, not just the PMC MSP.
Quoted 16 lines
drivers/usb/core/quirks.c +0
-0{ }/* terminating entry must be last */ };include/linux/usb/quirks.h +3
-0@@ -30,4 +30,7 @@descriptor */ #define USB_QUIRK_DELAY_INIT 0x00000040 +/*MSP SoC onchip EHCI overcurrent issue */ +#define USB_QUIRK_MSP_OVERCURRENT 0x00000080 +#endif /* __LINUX_USB_QUIRKS_H */
Re: [PATCH V2 2/2] MSP onchip root hub over current quirk.
Quoted 22 lines · Alan Stern
Quoted 3 lines · Anoop P.A
From: Anoop P A <[email protected]>
Adding chip specific code under quirk.
NAK. See below.
Quoted 14 lines
Signed-off-by Anoop P A <[email protected]>--- drivers/usb/core/hub.c | 45 ++++++++++++++++++++++++++++++++++++++----- drivers/usb/core/quirks.c | 3 ++ include/linux/usb/quirks.h | 3 ++ 3 files changed, 45 insertions(+), 6 deletions(-)drivers/usb/core/hub.c +0
-0@@ -3377,12 +3377,45 @@ static void hub_events(void) }
Quoted 12 lines
drivers/usb/core/hub.c static void hub_events(void) · line 3380
Quoted 8 lines
drivers/usb/core/hub.c +1
-6if (portchange &USB_PORT_STAT_C_OVERCURRENT ) { -dev_err (hub_dev, -"over-current change on port %d\n" , - i); -clear_port_feature (hdev, i, -USB_PORT_FEAT_C_OVER_CURRENT ); -hub_power_on (hub, true); +usb_detect_quirks (hdev);This line is wrong.
usb_detect_quirks()gets called only once per device, when the device is initialized. Besides, you probably want to use a hub-specific flag for this rather than a device-specific flag.
Can you point me to an example for the recommended way of doing the hack. I don't have much exposure to USB subsystem.
Quoted 72 lines
drivers/usb/core/hub.c static void hub_events(void) · line 3381
Quoted 2 lines
drivers/usb/core/hub.c +1
-0+if (hdev->quirks &USB_QUIRK_MSP_OVERCURRENT ) {Also, it would be better to put this code in a separate subroutine instead of indenting it so far.
Quoted 45 lines
drivers/usb/core/hub.c +37
-0+/* clear OCC bit */ +clear_port_feature (hdev, i, +USB_PORT_FEAT_C_OVER_CURRENT ); + +/* This step is required to toggle the +* PP bit to 0 and 1 (by hub_power_on) +* in order the CSC bit to be +* transitioned properly for device +* hotplug +*/ +/* clear PP bit */ +clear_port_feature (hdev, i, +USB_PORT_FEAT_POWER ); + +/* resume power */ +hub_power_on (hub, true); + +/* delay 100 usec */ +udelay (100 ); + +/* read OCA bit */ +if (portstatus & + (1 <<USB_PORT_FEAT_OVER_CURRENT )) { +/* declare overcurrent */ +dev_err (hub_dev, +"over-current change \ +on port %d\n" , i); + } + }else { +dev_err (hub_dev, +"over-current change \ +on port %d\n" , i); +clear_port_feature (hdev, i, +USB_PORT_FEAT_C_OVER_CURRENT ); +hub_power_on (hub, true); + } + }if (portchange &USB_PORT_STAT_C_RESET ) {drivers/usb/core/quirks.c +0
-0drivers/usb/core/quirks.c static const struct usb_device_id usb_quirk_list[] = { · line 93
Quoted 6 lines
drivers/usb/core/quirks.c +3
-0@@ -88,6 +88,9 @@ static const struct usb_device_id usb_quirk_list[] = {/* INTEL VALUE SSD */ { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, + /* PMC MSP over current quirk */ + { USB_DEVICE(0x1d6b, 0x0002), .driver_info = USB_QUIRK_MSP_OVERCURRENT }, +This implementation is completely wrong. It applies to all USB-2.0 root hubs in Linux, not just the PMC MSP.
Quoted 11 lines
drivers/usb/core/quirks.c +0
-0{ }/* terminating entry must be last */ };include/linux/usb/quirks.h +0
-0@@ -30,4 +30,7 @@descriptor */ #define USB_QUIRK_DELAY_INIT 0x00000040
Quoted 6 lines
include/linux/usb/quirks.h line 36
Quoted 5 lines
include/linux/usb/quirks.h +3
-0+/*MSP SoC onchip EHCI overcurrent issue */ +#define USB_QUIRK_MSP_OVERCURRENT 0x00000080 +#endif /* __LINUX_USB_QUIRKS_H */
Thanks
Anoop
Alan Stern
maintainerRe: [PATCH V2 2/2] MSP onchip root hub over current quirk.
Quoted 8 lines · Anoop P A
Quoted 5 lines
drivers/usb/core/hub.c static void hub_events(void) · line 3380
Quoted 1 line
drivers/usb/core/hub.c +1
-0+usb_detect_quirks (hdev);This line is wrong.
usb_detect_quirks()gets called only once per device, when the device is initialized. Besides, you probably want to use a hub-specific flag for this rather than a device-specific flag.Can you point me to an example for the recommended way of doing the hack. I don't have much exposure to USB subsystem.
One example, suitable for PCI devices, can be found in drivers/usb/host/ehci-pci.c:ehci_pci_setup().
However the best approach would be for you to avoid adding any special-purpose code at all. Is it possible to handle overcurrent-change events in a way that will work just as well for normal hubs as for your MSP root hub?
Alan Stern
Hi Anoop:
Quoted 8 lines · Anoop P.A
From: Anoop P A <[email protected]>
This patch includes.
1. USB host driver for MSP71xx family SoC on-chip USB controller.
2. Platform support for USB controller.Signed-off-by Anoop P A <[email protected]>
I tried to apply this patch to a pristine linux-mips.org 2.6.37-rc6 kernel, but the patch failed on arch/mips/pmc-sierra/msp71xx/Makefile. I think you must have applied an SMP patch to your tree before generating this patch. That was easy to fix, and once I did that, I tried testing this on a PMC-Sierra MSP7120 Garibaldi evaluation board. Using your original changes to drivers/usb/core/hub.c in addition to this patch, I was able to boot a system, plug a USB hard drive in, and that drive was recognized by the Garibaldi.
You can add my:
PATCH v3 1/1 EHCI bus glue for on-chip PMC MSP USB controller.
From: Anoop P A <[email protected]>
--- drivers/usb/host/Kconfig | 15 +- drivers/usb/host/ehci-hcd.c | 7 + drivers/usb/host/ehci-pmcmsp.c | 552 ++++++++++++++++++++++++++++++++++++++++ drivers/usb/host/ehci.h | 3 + 4 files changed, 575 insertions(+), 2 deletions(-) create mode 100644 drivers/usb/host/ehci-pmcmsp.c
drivers/usb/host/Kconfig +13 -2
@@ -91,17 +91,28 @@ config USB_EHCI_TT_NEWSCHED If unsure, say Y. +config USB_EHCI_HCD_PMC_MSP + tristate "EHCI support for on-chip PMC MSP USB controller" + depends on USB_EHCI_HCD && MSP_HAS_USB + default y + select USB_EHCI_BIG_ENDIAN_DESC + select USB_EHCI_BIG_ENDIAN_MMIO + ---help--- + Enables support for the onchip USB controller on the PMC_MSP7100 Family SoC's. + If unsure, say N. + config USB_EHCI_BIG_ENDIAN_MMIO bool depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || \ ARCH_IXP4XX || XPS_USB_HCD_XILINX || \ - PPC_MPC512x || CPU_CAVIUM_OCTEON) + PPC_MPC512x || CPU_CAVIUM_OCTEON || \ + PMC_MSP) default y config USB_EHCI_BIG_ENDIAN_DESC bool depends on USB_EHCI_HCD && (440EPX || ARCH_IXP4XX || XPS_USB_HCD_XILINX || \ - PPC_MPC512x) + PPC_MPC512x || PMC_MSP) default y config XPS_USB_HCD_XILINX
drivers/usb/host/ehci-hcd.c +7 -0
@@ -262,6 +262,8 @@ static void tdi_reset (struct ehci_hcd *ehci)if (ehci_big_endian_mmio (ehci)) tmp |=USBMODE_BE ;ehci_writel (ehci, tmp, reg_ptr); +if (ehci->pmc_msp_tdi) +usb_hcd_tdi_set_mode (ehci); }/* reset a non-running (STS_HALT == 1) controller */
@@ -1249,6 +1251,11 @@ MODULE_LICENSE ("GPL");#define PLATFORM_DRIVER ehci_msm_driver#endif +#ifdef CONFIG_USB_EHCI_HCD_PMC_MSP +#include "ehci-pmcmsp.c" +#define PLATFORM_DRIVER ehci_hcd_msp_driver +#endif +#if !defined(PCI_DRIVER ) && !defined(PLATFORM_DRIVER ) && \ !defined(PS3_SYSTEM_BUS_DRIVER ) && !defined(OF_PLATFORM_DRIVER ) && \ !defined(XILINX_OF_PLATFORM_DRIVER )
drivers/usb/host/ehci-pmcmsp.c new file +552 -0
552 lines not on this page · raw message
drivers/usb/host/ehci.h +3 -0
@@ -134,6 +134,7 @@ struct ehci_hcd { /* one per controller */ unsigned amd_l1_fix:1; unsigned fs_i_thresh:1; /* Intel iso scheduling */ unsigned use_dummy_qh:1; /* AMD Frame List table quirk*/ + unsigned pmc_msp_tdi:1; /* PMC MSP tdi quirk*//* required for usb32 quirk */ #define OHCI_CTRL_HCFS (3 << 6)
@@ -162,6 +163,8 @@ struct ehci_hcd { /* one per controller */#endif }; +extern void usb_hcd_tdi_set_mode (struct ehci_hcd *ehci); +/* convert between an HCD pointer and the corresponding EHCI_HCD */ static inline struct ehci_hcd *hcd_to_ehci (struct usb_hcd *hcd) {
Signature · 1 line
1.7.0.4
Re: [PATCH v3] EHCI bus glue for on-chip PMC MSP USB controller.
Quoted 4 lines · Anoop P.A
From: Anoop P A <[email protected]>
Signed-off-by Anoop P A <[email protected]>Tested-by Shane McDonald <[email protected]>
Care to provide a "real" changelog comment for this patch? We need something here.
Quoted 74 lines
--- drivers/usb/host/Kconfig | 15 +- drivers/usb/host/ehci-hcd.c | 7 + drivers/usb/host/ehci-pmcmsp.c | 552 ++++++++++++++++++++++++++++++++++++++++ drivers/usb/host/ehci.h | 3 + 4 files changed, 575 insertions(+), 2 deletions(-) create mode 100644 drivers/usb/host/ehci-pmcmsp.cdrivers/usb/host/Kconfig +13
-2@@ -91,17 +91,28 @@ config USB_EHCI_TT_NEWSCHED If unsure, say Y. +config USB_EHCI_HCD_PMC_MSP + tristate "EHCI support for on-chip PMC MSP USB controller" + depends on USB_EHCI_HCD && MSP_HAS_USB + default y + select USB_EHCI_BIG_ENDIAN_DESC + select USB_EHCI_BIG_ENDIAN_MMIO + ---help--- + Enables support for the onchip USB controller on the PMC_MSP7100 Family SoC's. + If unsure, say N. + config USB_EHCI_BIG_ENDIAN_MMIO bool depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || \ ARCH_IXP4XX || XPS_USB_HCD_XILINX || \ - PPC_MPC512x || CPU_CAVIUM_OCTEON) + PPC_MPC512x || CPU_CAVIUM_OCTEON || \ + PMC_MSP) default y config USB_EHCI_BIG_ENDIAN_DESC bool depends on USB_EHCI_HCD && (440EPX || ARCH_IXP4XX || XPS_USB_HCD_XILINX || \ - PPC_MPC512x) + PPC_MPC512x || PMC_MSP) default y config XPS_USB_HCD_XILINXdrivers/usb/host/ehci-hcd.c +7
-0@@ -262,6 +262,8 @@ static void tdi_reset (struct ehci_hcd *ehci)if (ehci_big_endian_mmio (ehci)) tmp |=USBMODE_BE ;ehci_writel (ehci, tmp, reg_ptr); +if (ehci->pmc_msp_tdi) +usb_hcd_tdi_set_mode (ehci); }/* reset a non-running (STS_HALT == 1) controller */ @@ -1249,6 +1251,11 @@ MODULE_LICENSE ("GPL");#define PLATFORM_DRIVER ehci_msm_driver#endif +#ifdef CONFIG_USB_EHCI_HCD_PMC_MSP +#include "ehci-pmcmsp.c" +#define PLATFORM_DRIVER ehci_hcd_msp_driver +#endif +#if !defined(PCI_DRIVER ) && !defined(PLATFORM_DRIVER ) && \ !defined(PS3_SYSTEM_BUS_DRIVER ) && !defined(OF_PLATFORM_DRIVER ) && \ !defined(XILINX_OF_PLATFORM_DRIVER )drivers/usb/host/ehci-pmcmsp.c new file +0
-0
drivers/usb/host/ehci-pmcmsp.c line 9
Quoted 9 lines
drivers/usb/host/ehci-pmcmsp.c new file +9
-0@@ -0,0 +1,552 @@ +/* +* PMC MSP EHCI (Host Controller Driver) for USB. +* +* (C) Copyright 2006-2010 PMC-Sierra Inc +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version.
Are you sure about "any later version"? Is this acceptable to your company lawyers?
Quoted 5 lines
drivers/usb/host/ehci-pmcmsp.c new file +5
-0+* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
drivers/usb/host/ehci-pmcmsp.c line 24
Quoted 10 lines
drivers/usb/host/ehci-pmcmsp.c new file +10
-0+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA.
These two paragraphs are not needed, please remove them.
drivers/usb/host/ehci-pmcmsp.c line 31
Quoted 7 lines
drivers/usb/host/ehci-pmcmsp.c new file +7
-0+*/ + +#include <linux/platform_device.h> +#include <linux/gpio.h> +#include <msp_usb.h> + +/* includes */
Um, includes for what? Are we writing comments for the previous lines?
Quoted 10 lines
drivers/usb/host/ehci-pmcmsp.c new file +10
-0+#define USB_CTRL_MODE_HOST 0x3 +/* host mode */ +#define USB_CTRL_MODE_BIG_ENDIAN 0x4 +/* big endian */ +#define USB_CTRL_MODE_STREAM_DISABLE 0x10 +/* stream disable*/ +#define USB_CTRL_FIFO_THRESH 0x00300000 +/* thresh hold */ +#define USB_EHCI_REG_USB_MODE 0x68 +/* register offset for usb_mode */
drivers/usb/host/ehci-pmcmsp.c line 51
Quoted 10 lines
drivers/usb/host/ehci-pmcmsp.c new file +10
-0+#define USB_EHCI_REG_USB_FIFO 0x24 +/* register offset for usb fifo */ +#define USB_EHCI_REG_USB_STATUS 0x44 +/* register offset for usb status */ +#define USB_EHCI_REG_BIT_STAT_STS (1<<29) +/* serial/parallel transceiver */ +#define MSP_PIN_USB0_HOST_DEV 49 +/* TWI USB0 host device pin */ +#define MSP_PIN_USB1_HOST_DEV 50 +/* TWI USB1 host device pin */
Ok, I see we are. That's horrible, please fix it up.
drivers/usb/host/ehci-pmcmsp.c line 53
Quoted 2 lines
drivers/usb/host/ehci-pmcmsp.c new file +2
-0+ +extern int usb_disabled (void );
Why is this in a .c file? externs should never be in a .c file.
Quoted 21 lines
drivers/usb/host/ehci-pmcmsp.c new file +21
-0+ +void usb_hcd_tdi_set_mode (struct ehci_hcd *ehci) +{ +u8 *base; +u8 *statreg; +u8 *fiforeg; +u32 val; +struct ehci_regs *reg_base = ehci->regs; + +/* get register base */ + base = (u8 *)reg_base +USB_EHCI_REG_USB_MODE ; + statreg = (u8 *)reg_base +USB_EHCI_REG_USB_STATUS ; + fiforeg = (u8 *)reg_base +USB_EHCI_REG_USB_FIFO ; + +/* set the controller to host mode and BIG ENDIAN */ +ehci_writel (ehci, (USB_CTRL_MODE_HOST |USB_CTRL_MODE_BIG_ENDIAN + |USB_CTRL_MODE_STREAM_DISABLE ), (u32 *)base); + +/* clear STS to select parallel transceiver interface */ + val =ehci_readl (ehci, (u32 *)statreg); + val = val & ~USB_EHCI_REG_BIT_STAT_STS ;
drivers/usb/host/ehci-pmcmsp.c line 84
Quoted 10 lines
drivers/usb/host/ehci-pmcmsp.c new file +10
-0+ehci_writel (ehci, val, (u32 *)statreg); + +/* write to set the proper fifo threshold */ +ehci_writel (ehci,USB_CTRL_FIFO_THRESH , (u32 *)fiforeg); + +/* set TWI GPIO USB_HOST_DEV pin high */ +gpio_direction_output (MSP_PIN_USB0_HOST_DEV ,1 ); +#ifdef CONFIG_MSP_HAS_DUAL_USB +gpio_direction_output (MSP_PIN_USB1_HOST_DEV ,1 ); +#endif
Please don't put #defines in .c files.
Quoted 53 lines
drivers/usb/host/ehci-pmcmsp.c new file +53
-0+} + +/* called after powerup, by probe or system-pm "wakeup" */ +static int ehci_msp_reinit (struct ehci_hcd *ehci) +{ +ehci_port_power (ehci,0 ); + +return 0 ; +} + +/* called during probe() after chip reset completes */ +static int ehci_msp_setup (struct usb_hcd *hcd) +{ +struct ehci_hcd *ehci =hcd_to_ehci (hcd); +u32 temp; +int retval; + ehci->big_endian_mmio =1 ; + ehci->big_endian_desc =1 ; + ehci->pmc_msp_tdi =1 ; + + ehci->caps = hcd->regs; + ehci->regs = hcd->regs + +HC_LENGTH (ehci_readl (ehci, &ehci->caps->hc_capbase)); +dbg_hcs_params (ehci,"reset" ); +dbg_hcc_params (ehci,"reset" ); + +/* cache this readonly data; minimize chip reads */ + ehci->hcs_params =ehci_readl (ehci, &ehci->caps->hcs_params); + hcd->has_tt =1 ; +tdi_reset (ehci); + + retval =ehci_halt (ehci); +if (retval) +return retval; + +ehci_reset (ehci); + +/* data structure init */ + retval =ehci_init (hcd); +if (retval) +return retval; + + temp =HCS_N_CC (ehci->hcs_params) *HCS_N_PCC (ehci->hcs_params); + temp &=0x0f ; +if (temp &&HCS_N_PORTS (ehci->hcs_params) > temp) { +ehci_dbg (ehci,"bogus port configuration: " +"cc=%d x pcc=%d < ports=%d\n" , +HCS_N_CC (ehci->hcs_params), +HCS_N_PCC (ehci->hcs_params), +HCS_N_PORTS (ehci->hcs_params)); + } + + retval =ehci_msp_reinit (ehci);
drivers/usb/host/ehci-pmcmsp.c line 147
Quoted 10 lines
drivers/usb/host/ehci-pmcmsp.c new file +10
-0+ +return retval; +} + +/*-------------------------------------------------------------------------*/ + +static void msp_start_hc (struct platform_device *dev) +{ + printk(KERN_DEBUG __FILE__ + ": starting PMC MSP EHCI USB Controller\n");
Why? Who really cares? And, if you _really_ want to do this, please use a dev_dbg() call instead, which ties it properly into the dynamic printk system _and_ properly identifies this deivce.
drivers/usb/host/ehci-pmcmsp.c line 155
Quoted 8 lines
drivers/usb/host/ehci-pmcmsp.c new file +8
-0+ +/* +* Now, carefully enable the USB clock, and take +* the USB host controller out of reset. +*/ + printk(KERN_DEBUG __FILE__ + ": Clock to USB host has been enabled\n"); +}
You never enabled anything, yet you said you did? Somethings wrong here.
drivers/usb/host/ehci-pmcmsp.c line 161
Quoted 6 lines
drivers/usb/host/ehci-pmcmsp.c new file +6
-0+ +static void msp_stop_hc (struct platform_device *dev) +{ + printk(KERN_DEBUG __FILE__ + ": stopping PMC MSP EHCI USB Controller\n"); +}
Same for this printk, you didn't stop anything.
Also fix it up and don't use printk, see above.
Quoted 18 lines
drivers/usb/host/ehci-pmcmsp.c new file +18
-0+ + +/*-------------------------------------------------------------------------*/ + +/*-------------------------------------------------------------------------*/ + +#ifdef CONFIG_PM + +/* suspend/resume, section 4.3 */ + +/* These routines rely on the bus glue +* to handle powerdown and wakeup, and currently also on +* transceivers that don't need any software attention to set up +* the right sort of wakeup. +* Also they depend on separate root hub suspend/resume. +*/ +static int ehci_msp_suspend (struct device *dev) +{
drivers/usb/host/ehci-pmcmsp.c line 189
Quoted 10 lines
drivers/usb/host/ehci-pmcmsp.c new file +10
-0+struct usb_hcd *hcd =dev_get_drvdata (dev); +struct ehci_hcd *ehci =hcd_to_ehci (hcd); +unsigned long flags; +int rc; + +return 0 ; + rc =0 ; + +if (time_before (jiffies, ehci->next_statechange)) +msleep (10 );
Short sleep, why?
Quoted 5 lines
drivers/usb/host/ehci-pmcmsp.c new file +5
-0+ +/* Root hub was already suspended. Disable irq emission and +* mark HW unaccessible. The PM and USB cores make sure that +* the root hub is either suspended or stopped. +*/
drivers/usb/host/ehci-pmcmsp.c line 204
Quoted 10 lines
drivers/usb/host/ehci-pmcmsp.c new file +10
-0+spin_lock_irqsave (&ehci->lock, flags); +ehci_prepare_ports_for_controller_suspend (ehci,device_may_wakeup (dev)); +ehci_writel (ehci,0 , &ehci->regs->intr_enable); + (void )ehci_readl (ehci, &ehci->regs->intr_enable); + +clear_bit (HCD_FLAG_HW_ACCESSIBLE , &hcd->flags); +spin_unlock_irqrestore (&ehci->lock, flags); + +/* could save FLADJ in case of Vaux power loss +... we'd only use it to handle clock skew */
Huh?
drivers/usb/host/ehci-pmcmsp.c line 215
Quoted 11 lines
drivers/usb/host/ehci-pmcmsp.c new file +11
-0+ +return rc; +} + +static int ehci_msp_resume (struct device *dev) +{ +struct usb_hcd *hcd =dev_get_drvdata (dev); +struct ehci_hcd *ehci =hcd_to_ehci (hcd); + + +/* maybe restore FLADJ */
Don't you know?
drivers/usb/host/ehci-pmcmsp.c line 218
Quoted 3 lines
drivers/usb/host/ehci-pmcmsp.c new file +3
-0+ +if (time_before (jiffies, ehci->next_statechange)) +msleep (100 );
That's a long sleep, are you sure that's ok on the resume path?
Quoted 178 lines
drivers/usb/host/ehci-pmcmsp.c new file +178
-0+ +/* Mark hardware accessible again as we are out of D3 state by now */ +set_bit (HCD_FLAG_HW_ACCESSIBLE , &hcd->flags); + +/* If CF is still set, we maintained PCI Vaux power. +* Just undo the effect of ehci_pci_suspend(). +*/ +if (ehci_readl (ehci, &ehci->regs->configured_flag) ==FLAG_CF ) { +int mask =INTR_MASK ; + +ehci_prepare_ports_for_controller_resume (ehci); +if (!hcd->self.root_hub->do_remote_wakeup) + mask &= ~STS_PCD ; +ehci_writel (ehci, mask, &ehci->regs->intr_enable); +ehci_readl (ehci, &ehci->regs->intr_enable); +return 0 ; + } + +ehci_dbg (ehci,"lost power, restarting\n" ); +usb_root_hub_lost_power (hcd->self.root_hub); + +/* Else reset, to cope with power loss or flush-to-storage +* style "resume" having let BIOS kick in during reboot. +*/ + (void )ehci_halt (ehci); + (void )ehci_reset (ehci); + (void )ehci_msp_reinit (ehci); + +/* emptying the schedule aborts any urbs */ +spin_lock_irq (&ehci->lock); +if (ehci->reclaim) +end_unlink_async (ehci); +ehci_work (ehci); +spin_unlock_irq (&ehci->lock); + +ehci_writel (ehci, ehci->command, &ehci->regs->command); +ehci_writel (ehci,FLAG_CF , &ehci->regs->configured_flag); +ehci_readl (ehci, &ehci->regs->command);/* unblock posted writes */ + +/* here we "know" root ports should always stay powered */ +ehci_port_power (ehci,1 ); + + hcd->state =HC_STATE_SUSPENDED ; + +return 0 ; +} + +static const struct dev_pm_ops ehci_msp_pmops = { + .suspend = ehci_msp_suspend, + .resume = ehci_msp_resume, +}; +#endif + + +/* configure so an HC device and id are always provided */ +/* always called with process context; sleeping is OK */ + +static int usb_hcd_msp_map_regs (struct mspusb_device *dev) +{ +struct resource *res; +struct platform_device *pdev = &dev->dev; +u32 res_len; +int retval; + +/* MAB register space */ + res =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); +if (res ==NULL ) +return -ENOMEM ; + res_len = res->end - res->start +1 ; +if (!request_mem_region (res->start, res_len,"mab regs" )) +return -EBUSY ; + + dev->mab_regs =ioremap_nocache (res->start, res_len); +if (dev->mab_regs ==NULL ) { + retval = -ENOMEM ; + goto err1; + } + +/* MSP USB register space */ + res =platform_get_resource (pdev,IORESOURCE_MEM ,2 ); +if (res ==NULL ) { + retval = -ENOMEM ; + goto err2; + } + res_len = res->end - res->start +1 ; +if (!request_mem_region (res->start, res_len,"usbid regs" )) { + retval = -EBUSY ; + goto err2; + } + dev->usbid_regs =ioremap_nocache (res->start, res_len); +if (dev->usbid_regs ==NULL ) { + retval = -ENOMEM ; + goto err3; + } + +return 0 ; +err3: + res =platform_get_resource (pdev,IORESOURCE_MEM ,2 ); + res_len = res->end - res->start +1 ; +release_mem_region (res->start, res_len); +err2: +iounmap (dev->mab_regs); +err1: + res =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); + res_len = res->end - res->start +1 ; +release_mem_region (res->start, res_len); +dev_err (&pdev->dev,"Failed to map non-EHCI regs.\n" ); +return retval; +} + +/** +* usb_hcd_msp_probe - initialize PMC MSP-based HCDs +* Context: !in_interrupt() +* +* Allocates basic resources for this USB host controller, and +* then invokes the start() method for the HCD associated with it +* through the hotplug entry's driver_data. +* +*/ +int usb_hcd_msp_probe (const struct hc_driver *driver, +struct platform_device *dev) +{ +int retval; +struct usb_hcd *hcd; +struct resource *res; +struct ehci_hcd *ehci ; + + hcd =usb_create_hcd (driver, &dev->dev,"pmcmsp" ); +if (!hcd) +return -ENOMEM ; + + res =platform_get_resource (dev,IORESOURCE_MEM ,0 ); +if (res ==NULL ) { +pr_debug ("No IOMEM resource info for %s.\n" , dev->name); + retval = -ENOMEM ; + goto err1; + } + hcd->rsrc_start = res->start; + hcd->rsrc_len = res->end - res->start +1 ; +if (!request_mem_region (hcd->rsrc_start, hcd->rsrc_len, dev->name)) { + retval = -EBUSY ; + goto err1; + } + hcd->regs =ioremap_nocache (hcd->rsrc_start, hcd->rsrc_len); +if (!hcd->regs) { +pr_debug ("ioremap failed" ); + retval = -ENOMEM ; + goto err2; + } +msp_start_hc (dev); + + res =platform_get_resource (dev,IORESOURCE_IRQ ,0 ); +if (res ==NULL ) { +dev_err (&dev->dev,"No IRQ resource info for %s.\n" , dev->name); + retval = -ENOMEM ; + goto err3; + } + +/* Map non-EHCI register spaces */ + retval =usb_hcd_msp_map_regs (to_mspusb_device (dev)); +if (retval !=0 ) + goto err3; + + ehci =hcd_to_ehci (hcd); + ehci->big_endian_mmio =1 ; + ehci->big_endian_desc =1 ; + + + retval =usb_add_hcd (hcd, res->start,IRQF_SHARED ); +if (retval ==0 ) +return 0 ; + +usb_remove_hcd (hcd); +err3: +msp_stop_hc (dev); +iounmap (hcd->regs); +err2: +release_mem_region (hcd->rsrc_start, hcd->rsrc_len);
drivers/usb/host/ehci-pmcmsp.c line 406
Quoted 10 lines
drivers/usb/host/ehci-pmcmsp.c new file +10
-0+err1: +usb_put_hcd (hcd); + +return retval; +} + + +/* may be called without controller electrically present */ +/* may be called with controller, bus, and devices active */ +
What may be called?
Quoted 151 lines
drivers/usb/host/ehci-pmcmsp.c new file +146
-0+/** +* usb_hcd_msp_remove - shutdown processing for PMC MSP-based HCDs +* @dev: USB Host Controller being removed +* Context: !in_interrupt() +* +* Reverses the effect of usb_hcd_msp_probe(), first invoking +* the HCD's stop() method. It is always called from a thread +* context, normally "rmmod", "apmd", or something similar. +* +*/ +void usb_hcd_msp_remove (struct usb_hcd *hcd,struct platform_device *dev) +{ +usb_remove_hcd (hcd); +msp_stop_hc (dev); +iounmap (hcd->regs); +release_mem_region (hcd->rsrc_start, hcd->rsrc_len); +usb_put_hcd (hcd); +} + +#ifdef CONFIG_MSP_HAS_DUAL_USB +/*-------------------------------------------------------------------------*/ +/* +* Wrapper around the main ehci_irq. Since both USB host controllers are +* sharing the same IRQ, need to first determine whether we're the intended +* recipient of this interrupt. +*/ +static irqreturn_t ehci_msp_irq (struct usb_hcd *hcd) +{ +u32 int_src; +struct device *dev = hcd->self.controller; +struct platform_device *pdev; +struct mspusb_device *mdev; +struct ehci_hcd *ehci =hcd_to_ehci (hcd); + +/* need to reverse-map a couple of containers to get our device */ + pdev =to_platform_device (dev); + mdev =to_mspusb_device (pdev); + +/* Check to see if this interrupt is for this host controller */ + int_src =ehci_readl (ehci, &mdev->mab_regs->int_stat); +if (int_src & (1 << pdev->id)) +return ehci_irq (hcd); + +/* Not for this device */ +return IRQ_NONE ; +} +/*-------------------------------------------------------------------------*/ +#endif /* DUAL_USB */ + +static const struct hc_driver ehci_msp_hc_driver = { + .description = hcd_name, + .product_desc ="PMC MSP EHCI" , + .hcd_priv_size =sizeof (struct ehci_hcd ), + +/* +* generic hardware linkage +*/ +#ifdef CONFIG_MSP_HAS_DUAL_USB + .irq = ehci_msp_irq, +#else + .irq = ehci_irq, +#endif + .flags =HCD_MEMORY |HCD_USB2 , + +/* +* basic lifecycle operations +*/ + .reset = ehci_msp_setup, + .start = ehci_run, + .shutdown = ehci_shutdown, + .start = ehci_run, + .stop = ehci_stop, + +/* +* managing i/o requests and associated device resources +*/ + .urb_enqueue = ehci_urb_enqueue, + .urb_dequeue = ehci_urb_dequeue, + .endpoint_disable = ehci_endpoint_disable, + .endpoint_reset = ehci_endpoint_reset, + +/* +* scheduling support +*/ + .get_frame_number = ehci_get_frame, + +/* +* root hub support +*/ + .hub_status_data = ehci_hub_status_data, + .hub_control = ehci_hub_control, + .bus_suspend = ehci_bus_suspend, + .bus_resume = ehci_bus_resume, + .relinquish_port = ehci_relinquish_port, + .port_handed_over = ehci_port_handed_over, + + .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, +}; + +static int ehci_hcd_msp_drv_probe (struct platform_device *pdev) +{ +int ret; + +pr_debug ("In ehci_hcd_msp_drv_probe" ); + +if (usb_disabled ()) +return -ENODEV ; + +gpio_request (MSP_PIN_USB0_HOST_DEV ,"USB0_HOST_DEV_GPIO" ); +#ifdef CONFIG_MSP_HAS_DUAL_USB +gpio_request (MSP_PIN_USB1_HOST_DEV ,"USB1_HOST_DEV_GPIO" ); +#endif + + ret =usb_hcd_msp_probe (&ehci_msp_hc_driver, pdev); + +return ret; +} + +static int ehci_hcd_msp_drv_remove (struct platform_device *pdev) +{ +struct usb_hcd *hcd =platform_get_drvdata (pdev); + +usb_hcd_msp_remove (hcd, pdev); + +/* free TWI GPIO USB_HOST_DEV pin */ +gpio_free (MSP_PIN_USB0_HOST_DEV ); +#ifdef CONFIG_MSP_HAS_DUAL_USB +gpio_free (MSP_PIN_USB1_HOST_DEV ); +#endif + +return 0 ; +} + +MODULE_ALIAS ("pmcmsp-ehci" ); + +static struct platform_driver ehci_hcd_msp_driver = { + .probe = ehci_hcd_msp_drv_probe, + .remove = ehci_hcd_msp_drv_remove, + .driver = { + .name ="pmcmsp-ehci" , + .owner =THIS_MODULE , +#ifdef CONFIG_PM + .pm = &ehci_msp_pmops, +#endif + }, +};drivers/usb/host/ehci.h +0
-0
drivers/usb/host/ehci.h struct ehci_hcd { /* one per controller */ · line 137
Quoted 4 lines
drivers/usb/host/ehci.h +1
-0@@ -134,6 +134,7 @@ struct ehci_hcd { /* one per controller */ unsigned amd_l1_fix:1; unsigned fs_i_thresh:1; /* Intel iso scheduling */ unsigned use_dummy_qh:1; /* AMD Frame List table quirk*/ + unsigned pmc_msp_tdi:1; /* PMC MSP tdi quirk*/
This part of the patch doesn't apply cleanly anymore, care to refresh it against linux-next, and make all of the other fixes and resend it?
thanks,
greg k-h
Re: [PATCH v3] EHCI bus glue for on-chip PMC MSP USB controller.
Quoted 8 lines · Greg KH
Quoted 4 lines · Anoop P.A
From: Anoop P A <[email protected]>
Signed-off-by Anoop P A <[email protected]>Tested-by Shane McDonald <[email protected]>Care to provide a "real" changelog comment for this patch? We need something here.
Will do.
Quoted 13 lines
Quoted 4 lines
--- drivers/usb/host/Kconfig | 15 +-Quoted 8 lines
+ * PMC MSP EHCI (Host Controller Driver) for USB.
+ *
+ * (C) Copyright 2006-2010 PMC-Sierra Inc
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
Quoted 3 lines
Are you sure about "any later version"? Is this acceptable to your company lawyers?
Will fix it.
Quoted 16 lines
Quoted 7 lines
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OFQuoted 8 lines
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
Quoted 2 lines
These two paragraphs are not needed, please remove them.
Ok.
Quoted 24 lines
drivers/usb/host/ehci-pmcmsp.c line 31
Quoted 7 lines
+ */
drivers/usb/host/ehci-pmcmsp.c new file +6
-0+ +#include <linux/platform_device.h> +#include <linux/gpio.h> +#include <msp_usb.h> + +/* includes */ Um, includes for what? Are we writing comments for the previous lines?
Quoted 14 lines
drivers/usb/host/ehci-pmcmsp.c new file +14
-0+#define USB_CTRL_MODE_HOST 0x3 +/* host mode */ +#define USB_CTRL_MODE_BIG_ENDIAN 0x4 +/* big endian */ +#define USB_CTRL_MODE_STREAM_DISABLE 0x10 +/* stream disable*/ +#define USB_CTRL_FIFO_THRESH 0x00300000 +/* thresh hold */ +#define USB_EHCI_REG_USB_MODE 0x68 +/* register offset for usb_mode */ +#define USB_EHCI_REG_USB_FIFO 0x24 +/* register offset for usb fifo */ +#define USB_EHCI_REG_USB_STATUS 0x44 +/* register offset for usb status */
Quoted 8 lines
drivers/usb/host/ehci-pmcmsp.c line 51
Quoted 6 lines
drivers/usb/host/ehci-pmcmsp.c new file +6
-0+#define USB_EHCI_REG_BIT_STAT_STS (1<<29) +/* serial/parallel transceiver */ +#define MSP_PIN_USB0_HOST_DEV 49 +/* TWI USB0 host device pin */ +#define MSP_PIN_USB1_HOST_DEV 50 +/* TWI USB1 host device pin */ Ok, I see we are. That's horrible, please fix it up.
Ok.
Quoted 6 lines
Review
Quoted 3 lines
(quoted diff) +2
-0+ +extern int usb_disabled(void);Why is this in a .c file? externs should never be in a .c file.
Ok
Quoted 26 lines
Quoted 26 lines
drivers/usb/host/ehci-pmcmsp.c new file +25
-0+ +void usb_hcd_tdi_set_mode (struct ehci_hcd *ehci) +{ +u8 *base; +u8 *statreg; +u8 *fiforeg; +u32 val; +struct ehci_regs *reg_base = ehci->regs; + +/* get register base */ + base = (u8 *)reg_base +USB_EHCI_REG_USB_MODE ; + statreg = (u8 *)reg_base +USB_EHCI_REG_USB_STATUS ; + fiforeg = (u8 *)reg_base +USB_EHCI_REG_USB_FIFO ; + +/* set the controller to host mode and BIG ENDIAN */ +ehci_writel (ehci, (USB_CTRL_MODE_HOST |USB_CTRL_MODE_BIG_ENDIAN + |USB_CTRL_MODE_STREAM_DISABLE ), (u32 *)base); + +/* clear STS to select parallel transceiver interface */ + val =ehci_readl (ehci, (u32 *)statreg); + val = val & ~USB_EHCI_REG_BIT_STAT_STS ; +ehci_writel (ehci, val, (u32 *)statreg); + +/* write to set the proper fifo threshold */ +ehci_writel (ehci,USB_CTRL_FIFO_THRESH , (u32 *)fiforeg);
Quoted 8 lines
drivers/usb/host/ehci-pmcmsp.c line 84
Quoted 6 lines
drivers/usb/host/ehci-pmcmsp.c new file +6
-0+ +/* set TWI GPIO USB_HOST_DEV pin high */ +gpio_direction_output (MSP_PIN_USB0_HOST_DEV ,1 ); +#ifdef CONFIG_MSP_HAS_DUAL_USB +gpio_direction_output (MSP_PIN_USB1_HOST_DEV ,1 ); +#endif Please don't put #defines in .c files.
You mean #ifdef ???
Quoted 60 lines
Quoted 60 lines
drivers/usb/host/ehci-pmcmsp.c new file +59
-0+} + +/* called after powerup, by probe or system-pm "wakeup" */ +static int ehci_msp_reinit (struct ehci_hcd *ehci) +{ +ehci_port_power (ehci,0 ); + +return 0 ; +} + +/* called during probe() after chip reset completes */ +static int ehci_msp_setup (struct usb_hcd *hcd) +{ +struct ehci_hcd *ehci =hcd_to_ehci (hcd); +u32 temp; +int retval; + ehci->big_endian_mmio =1 ; + ehci->big_endian_desc =1 ; + ehci->pmc_msp_tdi =1 ; + + ehci->caps = hcd->regs; + ehci->regs = hcd->regs + +HC_LENGTH (ehci_readl (ehci, &ehci->caps->hc_capbase)); +dbg_hcs_params (ehci,"reset" ); +dbg_hcc_params (ehci,"reset" ); + +/* cache this readonly data; minimize chip reads */ + ehci->hcs_params =ehci_readl (ehci, &ehci->caps->hcs_params); + hcd->has_tt =1 ; +tdi_reset (ehci); + + retval =ehci_halt (ehci); +if (retval) +return retval; + +ehci_reset (ehci); + +/* data structure init */ + retval =ehci_init (hcd); +if (retval) +return retval; + + temp =HCS_N_CC (ehci->hcs_params) *HCS_N_PCC (ehci->hcs_params); + temp &=0x0f ; +if (temp &&HCS_N_PORTS (ehci->hcs_params) > temp) { +ehci_dbg (ehci,"bogus port configuration: " +"cc=%d x pcc=%d < ports=%d\n" , +HCS_N_CC (ehci->hcs_params), +HCS_N_PCC (ehci->hcs_params), +HCS_N_PORTS (ehci->hcs_params)); + } + + retval =ehci_msp_reinit (ehci); + +return retval; +} + +/*-------------------------------------------------------------------------*/ +
Quoted 8 lines
drivers/usb/host/ehci-pmcmsp.c line 147
Quoted 4 lines
drivers/usb/host/ehci-pmcmsp.c new file +4
-0+static void msp_start_hc (struct platform_device *dev) +{ + printk(KERN_DEBUG __FILE__ + ": starting PMC MSP EHCI USB Controller\n");Why? Who really cares? And, if you _really_ want to do this, please use a
dev_dbg()call instead, which ties it properly into the dynamic printk system _and_ properly identifies this deivce.
OK.
Quoted 13 lines
drivers/usb/host/ehci-pmcmsp.c line 155
Quoted 9 lines
drivers/usb/host/ehci-pmcmsp.c new file +8
-0+ +/* +* Now, carefully enable the USB clock, and take +* the USB host controller out of reset. +*/ + printk(KERN_DEBUG __FILE__ + ": Clock to USB host has been enabled\n"); +}You never enabled anything, yet you said you did? Somethings wrong here.
Forget to remove those comments.
Quoted 11 lines
drivers/usb/host/ehci-pmcmsp.c line 161
Quoted 7 lines
drivers/usb/host/ehci-pmcmsp.c new file +6
-0+ +static void msp_stop_hc (struct platform_device *dev) +{ + printk(KERN_DEBUG __FILE__ + ": stopping PMC MSP EHCI USB Controller\n"); +}Same for this printk, you didn't stop anything.
Also fix it up and don't use printk, see above.
Ok.
Quoted 23 lines
Quoted 23 lines
drivers/usb/host/ehci-pmcmsp.c new file +22
-0+ + +/*-------------------------------------------------------------------------*/ + +/*-------------------------------------------------------------------------*/ + +#ifdef CONFIG_PM + +/* suspend/resume, section 4.3 */ + +/* These routines rely on the bus glue +* to handle powerdown and wakeup, and currently also on +* transceivers that don't need any software attention to set up +* the right sort of wakeup. +* Also they depend on separate root hub suspend/resume. +*/ +static int ehci_msp_suspend (struct device *dev) +{ +struct usb_hcd *hcd =dev_get_drvdata (dev); +struct ehci_hcd *ehci =hcd_to_ehci (hcd); +unsigned long flags; +int rc;
Quoted 8 lines
drivers/usb/host/ehci-pmcmsp.c line 189
Quoted 6 lines
drivers/usb/host/ehci-pmcmsp.c new file +6
-0+ +return 0 ; + rc =0 ; + +if (time_before (jiffies, ehci->next_statechange)) +msleep (10 );Short sleep, why?
I am not very sure. Person who originally wrote this driver is unreachable.Any potential issues??
Quoted 10 lines
Quoted 10 lines
drivers/usb/host/ehci-pmcmsp.c new file +9
-0+ +/* Root hub was already suspended. Disable irq emission and +* mark HW unaccessible. The PM and USB cores make sure that +* the root hub is either suspended or stopped. +*/ +spin_lock_irqsave (&ehci->lock, flags); +ehci_prepare_ports_for_controller_suspend (ehci,device_may_wakeup (dev)); +ehci_writel (ehci,0 , &ehci->regs->intr_enable); + (void )ehci_readl (ehci, &ehci->regs->intr_enable);
Quoted 8 lines
drivers/usb/host/ehci-pmcmsp.c line 204
Quoted 6 lines
drivers/usb/host/ehci-pmcmsp.c new file +6
-0+ +clear_bit (HCD_FLAG_HW_ACCESSIBLE , &hcd->flags); +spin_unlock_irqrestore (&ehci->lock, flags); + +/* could save FLADJ in case of Vaux power loss +... we'd only use it to handle clock skew */ Huh?
Looks like some comments missed while cleaning up
Quoted 14 lines
drivers/usb/host/ehci-pmcmsp.c line 215
Quoted 12 lines
drivers/usb/host/ehci-pmcmsp.c new file +11
-0+ +return rc; +} + +static int ehci_msp_resume (struct device *dev) +{ +struct usb_hcd *hcd =dev_get_drvdata (dev); +struct ehci_hcd *ehci =hcd_to_ehci (hcd); + + +/* maybe restore FLADJ */ Don't you know?
Not really :)
Quoted 7 lines
drivers/usb/host/ehci-pmcmsp.c line 218
Quoted 4 lines
drivers/usb/host/ehci-pmcmsp.c new file +3
-0+ +if (time_before (jiffies, ehci->next_statechange)) +msleep (100 );That's a long sleep, are you sure that's ok on the resume path?
Again any potential issue you can guess ?
Quoted 182 lines
Quoted 182 lines
drivers/usb/host/ehci-pmcmsp.c new file +182
-0+ +/* Mark hardware accessible again as we are out of D3 state by now */ +set_bit (HCD_FLAG_HW_ACCESSIBLE , &hcd->flags); + +/* If CF is still set, we maintained PCI Vaux power. +* Just undo the effect of ehci_pci_suspend(). +*/ +if (ehci_readl (ehci, &ehci->regs->configured_flag) ==FLAG_CF ) { +int mask =INTR_MASK ; + +ehci_prepare_ports_for_controller_resume (ehci); +if (!hcd->self.root_hub->do_remote_wakeup) + mask &= ~STS_PCD ; +ehci_writel (ehci, mask, &ehci->regs->intr_enable); +ehci_readl (ehci, &ehci->regs->intr_enable); +return 0 ; + } + +ehci_dbg (ehci,"lost power, restarting\n" ); +usb_root_hub_lost_power (hcd->self.root_hub); + +/* Else reset, to cope with power loss or flush-to-storage +* style "resume" having let BIOS kick in during reboot. +*/ + (void )ehci_halt (ehci); + (void )ehci_reset (ehci); + (void )ehci_msp_reinit (ehci); + +/* emptying the schedule aborts any urbs */ +spin_lock_irq (&ehci->lock); +if (ehci->reclaim) +end_unlink_async (ehci); +ehci_work (ehci); +spin_unlock_irq (&ehci->lock); + +ehci_writel (ehci, ehci->command, &ehci->regs->command); +ehci_writel (ehci,FLAG_CF , &ehci->regs->configured_flag); +ehci_readl (ehci, &ehci->regs->command);/* unblock posted writes */ + +/* here we "know" root ports should always stay powered */ +ehci_port_power (ehci,1 ); + + hcd->state =HC_STATE_SUSPENDED ; + +return 0 ; +} + +static const struct dev_pm_ops ehci_msp_pmops = { + .suspend = ehci_msp_suspend, + .resume = ehci_msp_resume, +}; +#endif + + +/* configure so an HC device and id are always provided */ +/* always called with process context; sleeping is OK */ + +static int usb_hcd_msp_map_regs (struct mspusb_device *dev) +{ +struct resource *res; +struct platform_device *pdev = &dev->dev; +u32 res_len; +int retval; + +/* MAB register space */ + res =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); +if (res ==NULL ) +return -ENOMEM ; + res_len = res->end - res->start +1 ; +if (!request_mem_region (res->start, res_len,"mab regs" )) +return -EBUSY ; + + dev->mab_regs =ioremap_nocache (res->start, res_len); +if (dev->mab_regs ==NULL ) { + retval = -ENOMEM ; + goto err1; + } + +/* MSP USB register space */ + res =platform_get_resource (pdev,IORESOURCE_MEM ,2 ); +if (res ==NULL ) { + retval = -ENOMEM ; + goto err2; + } + res_len = res->end - res->start +1 ; +if (!request_mem_region (res->start, res_len,"usbid regs" )) { + retval = -EBUSY ; + goto err2; + } + dev->usbid_regs =ioremap_nocache (res->start, res_len); +if (dev->usbid_regs ==NULL ) { + retval = -ENOMEM ; + goto err3; + } + +return 0 ; +err3: + res =platform_get_resource (pdev,IORESOURCE_MEM ,2 ); + res_len = res->end - res->start +1 ; +release_mem_region (res->start, res_len); +err2: +iounmap (dev->mab_regs); +err1: + res =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); + res_len = res->end - res->start +1 ; +release_mem_region (res->start, res_len); +dev_err (&pdev->dev,"Failed to map non-EHCI regs.\n" ); +return retval; +} + +/** +* usb_hcd_msp_probe - initialize PMC MSP-based HCDs +* Context: !in_interrupt() +* +* Allocates basic resources for this USB host controller, and +* then invokes the start() method for the HCD associated with it +* through the hotplug entry's driver_data. +* +*/ +int usb_hcd_msp_probe (const struct hc_driver *driver, +struct platform_device *dev) +{ +int retval; +struct usb_hcd *hcd; +struct resource *res; +struct ehci_hcd *ehci ; + + hcd =usb_create_hcd (driver, &dev->dev,"pmcmsp" ); +if (!hcd) +return -ENOMEM ; + + res =platform_get_resource (dev,IORESOURCE_MEM ,0 ); +if (res ==NULL ) { +pr_debug ("No IOMEM resource info for %s.\n" , dev->name); + retval = -ENOMEM ; + goto err1; + } + hcd->rsrc_start = res->start; + hcd->rsrc_len = res->end - res->start +1 ; +if (!request_mem_region (hcd->rsrc_start, hcd->rsrc_len, dev->name)) { + retval = -EBUSY ; + goto err1; + } + hcd->regs =ioremap_nocache (hcd->rsrc_start, hcd->rsrc_len); +if (!hcd->regs) { +pr_debug ("ioremap failed" ); + retval = -ENOMEM ; + goto err2; + } +msp_start_hc (dev); + + res =platform_get_resource (dev,IORESOURCE_IRQ ,0 ); +if (res ==NULL ) { +dev_err (&dev->dev,"No IRQ resource info for %s.\n" , dev->name); + retval = -ENOMEM ; + goto err3; + } + +/* Map non-EHCI register spaces */ + retval =usb_hcd_msp_map_regs (to_mspusb_device (dev)); +if (retval !=0 ) + goto err3; + + ehci =hcd_to_ehci (hcd); + ehci->big_endian_mmio =1 ; + ehci->big_endian_desc =1 ; + + + retval =usb_add_hcd (hcd, res->start,IRQF_SHARED ); +if (retval ==0 ) +return 0 ; + +usb_remove_hcd (hcd); +err3: +msp_stop_hc (dev); +iounmap (hcd->regs); +err2: +release_mem_region (hcd->rsrc_start, hcd->rsrc_len); +err1: +usb_put_hcd (hcd); + +return retval;
Quoted 8 lines
drivers/usb/host/ehci-pmcmsp.c line 406
Quoted 6 lines
drivers/usb/host/ehci-pmcmsp.c new file +6
-0+} + + +/* may be called without controller electrically present */ +/* may be called with controller, bus, and devices active */ +What may be called?
may be usb_hcd_msp_remove :)
Quoted 151 lines
Quoted 151 lines
drivers/usb/host/ehci-pmcmsp.c new file +146
-0+/** +* usb_hcd_msp_remove - shutdown processing for PMC MSP-based HCDs +* @dev: USB Host Controller being removed +* Context: !in_interrupt() +* +* Reverses the effect of usb_hcd_msp_probe(), first invoking +* the HCD's stop() method. It is always called from a thread +* context, normally "rmmod", "apmd", or something similar. +* +*/ +void usb_hcd_msp_remove (struct usb_hcd *hcd,struct platform_device *dev) +{ +usb_remove_hcd (hcd); +msp_stop_hc (dev); +iounmap (hcd->regs); +release_mem_region (hcd->rsrc_start, hcd->rsrc_len); +usb_put_hcd (hcd); +} + +#ifdef CONFIG_MSP_HAS_DUAL_USB +/*-------------------------------------------------------------------------*/ +/* +* Wrapper around the main ehci_irq. Since both USB host controllers are +* sharing the same IRQ, need to first determine whether we're the intended +* recipient of this interrupt. +*/ +static irqreturn_t ehci_msp_irq (struct usb_hcd *hcd) +{ +u32 int_src; +struct device *dev = hcd->self.controller; +struct platform_device *pdev; +struct mspusb_device *mdev; +struct ehci_hcd *ehci =hcd_to_ehci (hcd); + +/* need to reverse-map a couple of containers to get our device */ + pdev =to_platform_device (dev); + mdev =to_mspusb_device (pdev); + +/* Check to see if this interrupt is for this host controller */ + int_src =ehci_readl (ehci, &mdev->mab_regs->int_stat); +if (int_src & (1 << pdev->id)) +return ehci_irq (hcd); + +/* Not for this device */ +return IRQ_NONE ; +} +/*-------------------------------------------------------------------------*/ +#endif /* DUAL_USB */ + +static const struct hc_driver ehci_msp_hc_driver = { + .description = hcd_name, + .product_desc ="PMC MSP EHCI" , + .hcd_priv_size =sizeof (struct ehci_hcd ), + +/* +* generic hardware linkage +*/ +#ifdef CONFIG_MSP_HAS_DUAL_USB + .irq = ehci_msp_irq, +#else + .irq = ehci_irq, +#endif + .flags =HCD_MEMORY |HCD_USB2 , + +/* +* basic lifecycle operations +*/ + .reset = ehci_msp_setup, + .start = ehci_run, + .shutdown = ehci_shutdown, + .start = ehci_run, + .stop = ehci_stop, + +/* +* managing i/o requests and associated device resources +*/ + .urb_enqueue = ehci_urb_enqueue, + .urb_dequeue = ehci_urb_dequeue, + .endpoint_disable = ehci_endpoint_disable, + .endpoint_reset = ehci_endpoint_reset, + +/* +* scheduling support +*/ + .get_frame_number = ehci_get_frame, + +/* +* root hub support +*/ + .hub_status_data = ehci_hub_status_data, + .hub_control = ehci_hub_control, + .bus_suspend = ehci_bus_suspend, + .bus_resume = ehci_bus_resume, + .relinquish_port = ehci_relinquish_port, + .port_handed_over = ehci_port_handed_over, + + .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, +}; + +static int ehci_hcd_msp_drv_probe (struct platform_device *pdev) +{ +int ret; + +pr_debug ("In ehci_hcd_msp_drv_probe" ); + +if (usb_disabled ()) +return -ENODEV ; + +gpio_request (MSP_PIN_USB0_HOST_DEV ,"USB0_HOST_DEV_GPIO" ); +#ifdef CONFIG_MSP_HAS_DUAL_USB +gpio_request (MSP_PIN_USB1_HOST_DEV ,"USB1_HOST_DEV_GPIO" ); +#endif + + ret =usb_hcd_msp_probe (&ehci_msp_hc_driver, pdev); + +return ret; +} + +static int ehci_hcd_msp_drv_remove (struct platform_device *pdev) +{ +struct usb_hcd *hcd =platform_get_drvdata (pdev); + +usb_hcd_msp_remove (hcd, pdev); + +/* free TWI GPIO USB_HOST_DEV pin */ +gpio_free (MSP_PIN_USB0_HOST_DEV ); +#ifdef CONFIG_MSP_HAS_DUAL_USB +gpio_free (MSP_PIN_USB1_HOST_DEV ); +#endif + +return 0 ; +} + +MODULE_ALIAS ("pmcmsp-ehci" ); + +static struct platform_driver ehci_hcd_msp_driver = { + .probe = ehci_hcd_msp_drv_probe, + .remove = ehci_hcd_msp_drv_remove, + .driver = { + .name ="pmcmsp-ehci" , + .owner =THIS_MODULE , +#ifdef CONFIG_PM + .pm = &ehci_msp_pmops, +#endif + }, +};drivers/usb/host/ehci.h +0
-0
Quoted 8 lines
drivers/usb/host/ehci.h struct ehci_hcd { /* one per controller */ · line 137
Quoted 5 lines
drivers/usb/host/ehci.h +1
-0@@ -134,6 +134,7 @@ struct ehci_hcd { /* one per controller */ unsigned amd_l1_fix:1; unsigned fs_i_thresh:1; /* Intel iso scheduling */ unsigned use_dummy_qh:1; /* AMD Frame List table quirk*/ + unsigned pmc_msp_tdi:1; /* PMC MSP tdi quirk*/This part of the patch doesn't apply cleanly anymore, care to refresh it against linux-next, and make all of the other fixes and resend it?
Ok. originally created against linux-mips git head. Will resend the revised patch once I fix issues you have pointed
Quoted 4 lines
thanks,
greg k-h
Re: [PATCH v3] EHCI bus glue for on-chip PMC MSP USB controller.
In reply to Anoop P.Adrivers/usb/host/ehci-hcd.c static void tdi_reset (struct ehci_hcd *ehci) · line 267
Quoted 12 lines · Anoop P.A
config
XPS_USB_HCD_XILINXdrivers/usb/host/ehci-hcd.c +2
-0@@ -262,6 +262,8 @@ static void tdi_reset (struct ehci_hcd *ehci)if (ehci_big_endian_mmio (ehci)) tmp |=USBMODE_BE ;ehci_writel (ehci, tmp, reg_ptr); +if (ehci->pmc_msp_tdi) +usb_hcd_tdi_set_mode (ehci); }
This is ugly to add callback to your driver here.
How this will build on other platform, usb_hcd_tdi_set_mode is only defined on ehci-pmcmsp.c
Quoted 7 lines
drivers/usb/host/ehci-hcd.c +7
-0+void usb_hcd_tdi_set_mode (struct ehci_hcd *ehci) +{ +u8 *base; +u8 *statreg; +u8 *fiforeg; +u32 val; +struct ehci_regs *reg_base = ehci->regs;
drivers/usb/host/ehci-hcd.c static void tdi_reset (struct ehci_hcd *ehci)
Quoted 10 lines
drivers/usb/host/ehci-hcd.c +10
-0+ +/* get register base */ + base = (u8 *)reg_base +USB_EHCI_REG_USB_MODE ; + statreg = (u8 *)reg_base +USB_EHCI_REG_USB_STATUS ; + fiforeg = (u8 *)reg_base +USB_EHCI_REG_USB_FIFO ; + +/* set the controller to host mode and BIG ENDIAN */ +ehci_writel (ehci, (USB_CTRL_MODE_HOST |USB_CTRL_MODE_BIG_ENDIAN + |USB_CTRL_MODE_STREAM_DISABLE ), (u32 *)base); +
We have done that in tdi_reset, why do you do it again ?
Matthieu
Re: [PATCH v3] EHCI bus glue for on-chip PMC MSP USB controller.
Quoted 17 lines · Matthieu CASTET
drivers/usb/host/ehci-hcd.c static void tdi_reset (struct ehci_hcd *ehci) · line 267
Quoted 12 lines · Anoop P.A
config
XPS_USB_HCD_XILINXdrivers/usb/host/ehci-hcd.c +2
-0@@ -262,6 +262,8 @@ static void tdi_reset (struct ehci_hcd *ehci)if (ehci_big_endian_mmio (ehci)) tmp |=USBMODE_BE ;ehci_writel (ehci, tmp, reg_ptr); +if (ehci->pmc_msp_tdi) +usb_hcd_tdi_set_mode (ehci); }This is ugly to add callback to your driver here.
How this will build on other platform,usb_hcd_tdi_set_modeis only defined onehci-pmcmsp.c
I got that will remove it from patch and resend.the patch got carried from an older kernel :( .
Thanks
Quoted 23 lines
Quoted 9 lines
drivers/usb/host/ehci-hcd.c +7
-0+void usb_hcd_tdi_set_mode (struct ehci_hcd *ehci) +{ +u8 *base; +u8 *statreg; +u8 *fiforeg; +u32 val; +struct ehci_regs *reg_base = ehci->regs;drivers/usb/host/ehci-hcd.c static void tdi_reset (struct ehci_hcd *ehci)
Quoted 10 lines
drivers/usb/host/ehci-hcd.c +10
-0+ +/* get register base */ + base = (u8 *)reg_base +USB_EHCI_REG_USB_MODE ; + statreg = (u8 *)reg_base +USB_EHCI_REG_USB_STATUS ; + fiforeg = (u8 *)reg_base +USB_EHCI_REG_USB_FIFO ; + +/* set the controller to host mode and BIG ENDIAN */ +ehci_writel (ehci, (USB_CTRL_MODE_HOST |USB_CTRL_MODE_BIG_ENDIAN + |USB_CTRL_MODE_STREAM_DISABLE ), (u32 *)base); +We have done that in
tdi_reset, why do you do it again ?Matthieu
Re: [PATCH v3] EHCI bus glue for on-chip PMC MSP USB controller.
In reply to Anoop P AQuoted 6 lines · Anoop P A
Quoted 5 lines
drivers/usb/host/ehci-pmcmsp.c line 84
Quoted 3 lines
drivers/usb/host/ehci-pmcmsp.c new file +3
-0+#ifdef CONFIG_MSP_HAS_DUAL_USB +gpio_direction_output (MSP_PIN_USB1_HOST_DEV ,1 ); +#endif Please don't put #defines in .c files.
You mean #ifdef ???
Yes, sorry.
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
drivers/usb/host/ehci-pmcmsp.c new file +6
-0+static int ehci_msp_suspend (struct device *dev) +{ +struct usb_hcd *hcd =dev_get_drvdata (dev); +struct ehci_hcd *ehci =hcd_to_ehci (hcd); +unsigned long flags; +int rc;Quoted 8 lines
drivers/usb/host/ehci-pmcmsp.c line 189
Quoted 6 lines
drivers/usb/host/ehci-pmcmsp.c new file +6
-0+ +return 0 ; + rc =0 ; + +if (time_before (jiffies, ehci->next_statechange)) +msleep (10 );Short sleep, why?
Quoted 2 lines
I am not very sure. Person who originally wrote this driver is unreachable.Any potential issues??
Yes, suspend/resume time delays are not nice for some systems. I would verify that this really is necessary, and, as you are going to be the one maintaining and responsible for the code, it would be good for you to figure out exactly what it is doing, and why.
Quoted 10 lines
Quoted 9 lines
drivers/usb/host/ehci-pmcmsp.c line 215
Quoted 7 lines
drivers/usb/host/ehci-pmcmsp.c new file +7
-0+static int ehci_msp_resume (struct device *dev) +{ +struct usb_hcd *hcd =dev_get_drvdata (dev); +struct ehci_hcd *ehci =hcd_to_ehci (hcd); + + +/* maybe restore FLADJ */ Don't you know?
Not really :)
Heh, you should.
Quoted 6 lines
Quoted 5 lines
drivers/usb/host/ehci-pmcmsp.c line 406
Quoted 3 lines
drivers/usb/host/ehci-pmcmsp.c new file +3
-0+/* may be called without controller electrically present */ +/* may be called with controller, bus, and devices active */ +What may be called?
may be
usb_hcd_msp_remove:)
Then put it in the comment block for that function, not above it, with an extra space between it, that just causes confusion.
thanks,
greg k-h
PATCH v4 1/1 EHCI bus glue for on-chip PMC MSP USB controller
In reply to Anoop P.AFrom: Anoop <paanoop1@paanoop1-desktop.(none)>
This patch add bus glue for USB controller commonly found in PMC-Sierra MSP71xx family of SoC's. Patch includes a tdi reset quirk as well .
---
Changes.
ehci-pmcmsp.c is based on latest ehci-pci.c.Addressed some stylistic issue pointed by Greg. Addressed review comments of Matthieu CASTET.
drivers/usb/host/Kconfig | 15 +- drivers/usb/host/ehci-hcd.c | 7 + drivers/usb/host/ehci-pmcmsp.c | 530 ++++++++++++++++++++++++++++++++++++++++ drivers/usb/host/ehci.h | 8 + 4 files changed, 558 insertions(+), 2 deletions(-) create mode 100644 drivers/usb/host/ehci-pmcmsp.c
drivers/usb/host/Kconfig +13 -2
@@ -91,17 +91,28 @@ config USB_EHCI_TT_NEWSCHED If unsure, say Y. +config USB_EHCI_HCD_PMC_MSP + tristate "EHCI support for on-chip PMC MSP USB controller" + depends on USB_EHCI_HCD && MSP_HAS_USB + default y + select USB_EHCI_BIG_ENDIAN_DESC + select USB_EHCI_BIG_ENDIAN_MMIO + ---help--- + Enables support for the onchip USB controller on the PMC_MSP7100 Family SoC's. + If unsure, say N. + config USB_EHCI_BIG_ENDIAN_MMIO bool depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || \ ARCH_IXP4XX || XPS_USB_HCD_XILINX || \ - PPC_MPC512x || CPU_CAVIUM_OCTEON) + PPC_MPC512x || CPU_CAVIUM_OCTEON || \ + PMC_MSP) default y config USB_EHCI_BIG_ENDIAN_DESC bool depends on USB_EHCI_HCD && (440EPX || ARCH_IXP4XX || XPS_USB_HCD_XILINX || \ - PPC_MPC512x) + PPC_MPC512x || PMC_MSP) default y config XPS_USB_HCD_XILINX
drivers/usb/host/ehci-hcd.c +7 -0
@@ -260,6 +260,8 @@ static void tdi_reset (struct ehci_hcd *ehci)if (ehci_big_endian_mmio (ehci)) tmp |=USBMODE_BE ;ehci_writel (ehci, tmp, reg_ptr); +if (ehci->pmc_msp_tdi) +usb_hcd_tdi_set_mode (ehci); }/* reset a non-running (STS_HALT == 1) controller */
@@ -1250,6 +1252,11 @@ MODULE_LICENSE ("GPL");#define PLATFORM_DRIVER ehci_msm_driver#endif +#ifdef CONFIG_USB_EHCI_HCD_PMC_MSP +#include "ehci-pmcmsp.c" +#define PLATFORM_DRIVER ehci_hcd_msp_driver +#endif +#if !defined(PCI_DRIVER ) && !defined(PLATFORM_DRIVER ) && \ !defined(PS3_SYSTEM_BUS_DRIVER ) && !defined(OF_PLATFORM_DRIVER ) && \ !defined(XILINX_OF_PLATFORM_DRIVER )
drivers/usb/host/ehci-pmcmsp.c new file +530 -0
530 lines not on this page · raw message
drivers/usb/host/ehci.h +8 -0
@@ -134,6 +134,7 @@ struct ehci_hcd { /* one per controller */ unsigned amd_pll_fix:1; unsigned fs_i_thresh:1; /* Intel iso scheduling */ unsigned use_dummy_qh:1; /* AMD Frame List table quirk*/ + unsigned pmc_msp_tdi:1; /* PMC MSP tdi quirk*//* required for usb32 quirk */ #define OHCI_CTRL_HCFS (3 << 6)
@@ -162,6 +163,13 @@ struct ehci_hcd { /* one per controller */#endif }; +#ifdef CONFIG_USB_EHCI_HCD_PMC_MSP +extern void usb_hcd_tdi_set_mode (struct ehci_hcd *ehci); +#else +static inline void usb_hcd_tdi_set_mode (struct ehci_hcd *ehci) +{ } +#endif +/* convert between an HCD pointer and the corresponding EHCI_HCD */ static inline struct ehci_hcd *hcd_to_ehci (struct usb_hcd *hcd) {
Signature · 1 line
1.7.0.4
Re: [PATCH v4] EHCI bus glue for on-chip PMC MSP USB controller
Quoted 26 lines · Anoop P.A
From: Anoop <paanoop1@paanoop1-desktop.(none)>
This patch add bus glue for USB controller commonly found in PMC-Sierra MSP71xx family of SoC's. Patch includes a tdi reset quirk as well .
Signed-off-by Anoop P A <[email protected]>Tested-by Shane McDonald <[email protected]>---
Changes.
ehci-pmcmsp.cis based on latest ehci-pci.c.Addressed some stylistic issue pointed by Greg. Addressed review comments of Matthieu CASTET.config
XPS_USB_HCD_XILINXdrivers/usb/host/ehci-hcd.c +3
-0@@ -260,6 +260,8 @@ static void tdi_reset (struct ehci_hcd *ehci)if (ehci_big_endian_mmio (ehci)) tmp |=USBMODE_BE ;ehci_writel (ehci, tmp, reg_ptr); +if (ehci->pmc_msp_tdi) +usb_hcd_tdi_set_mode (ehci); } +#ifdef CONFIG_USB_EHCI_HCD_PMC_MSP
drivers/usb/host/ehci-hcd.c static void tdi_reset (struct ehci_hcd *ehci)
Quoted 10 lines
drivers/usb/host/ehci-hcd.c +6
-1+extern void usb_hcd_tdi_set_mode (struct ehci_hcd *ehci); +#else +static inline void usb_hcd_tdi_set_mode (struct ehci_hcd *ehci) +{ } +#endif +/* convert between an HCD pointer and the corresponding EHCI_HCD */ static inline struct ehci_hcd *hcd_to_ehci (struct usb_hcd *hcd) { --
This won't work it you build CONFIG_USB_EHCI_HCD_PMC_MSP and other ehci controller.
A better alternative could something like : http://article.gmane.org/gmane.linux.usb.general/42624
drivers/usb/host/ehci-hcd.c
Quoted 10 lines
drivers/usb/host/ehci-hcd.c +10
-0+ +/* host mode */ +#define USB_CTRL_MODE_HOST 0x3 + +/* big endian */ +#define USB_CTRL_MODE_BIG_ENDIAN 0x4 + +/* stream disable*/ +#define USB_CTRL_MODE_STREAM_DISABLE 0x10 +
This doesn't seem to be used anymore.
Matthieu
PATCH v5 1/1 EHCI bus glue for on-chip PMC MSP USB controller
From: Anoop <paanoop1@paanoop1-desktop.(none)>
This patch add bus glue for USB controller commonly found in PMC-Sierra MSP71xx family of SoC's.
---
Changes.ehci-pmcmsp.c is based on latest ehci-pci.c.Addressed some stylistic issue pointed by Greg. Addressed comments from Matthieu CASTET.
drivers/usb/host/Kconfig | 15 +- drivers/usb/host/ehci-hcd.c | 5 + drivers/usb/host/ehci-pmcmsp.c | 524 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 542 insertions(+), 2 deletions(-) create mode 100644 drivers/usb/host/ehci-pmcmsp.c
drivers/usb/host/Kconfig +13 -2
@@ -91,17 +91,28 @@ config USB_EHCI_TT_NEWSCHED If unsure, say Y. +config USB_EHCI_HCD_PMC_MSP + tristate "EHCI support for on-chip PMC MSP USB controller" + depends on USB_EHCI_HCD && MSP_HAS_USB + default y + select USB_EHCI_BIG_ENDIAN_DESC + select USB_EHCI_BIG_ENDIAN_MMIO + ---help--- + Enables support for the onchip USB controller on the PMC_MSP7100 Family SoC's. + If unsure, say N. + config USB_EHCI_BIG_ENDIAN_MMIO bool depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || \ ARCH_IXP4XX || XPS_USB_HCD_XILINX || \ - PPC_MPC512x || CPU_CAVIUM_OCTEON) + PPC_MPC512x || CPU_CAVIUM_OCTEON || \ + PMC_MSP) default y config USB_EHCI_BIG_ENDIAN_DESC bool depends on USB_EHCI_HCD && (440EPX || ARCH_IXP4XX || XPS_USB_HCD_XILINX || \ - PPC_MPC512x) + PPC_MPC512x || PMC_MSP) default y config XPS_USB_HCD_XILINX
drivers/usb/host/ehci-hcd.c +5 -0
@@ -1250,6 +1250,11 @@ MODULE_LICENSE ("GPL");#define PLATFORM_DRIVER ehci_msm_driver#endif +#ifdef CONFIG_USB_EHCI_HCD_PMC_MSP +#include "ehci-pmcmsp.c" +#define PLATFORM_DRIVER ehci_hcd_msp_driver +#endif +#if !defined(PCI_DRIVER ) && !defined(PLATFORM_DRIVER ) && \ !defined(PS3_SYSTEM_BUS_DRIVER ) && !defined(OF_PLATFORM_DRIVER ) && \ !defined(XILINX_OF_PLATFORM_DRIVER )
drivers/usb/host/ehci-pmcmsp.c new file +524 -0
524 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Re: [PATCH v5] EHCI bus glue for on-chip PMC MSP USB controller
Quoted 10 lines · Anoop P.A
From: Anoop <paanoop1@paanoop1-desktop.(none)>
This patch add bus glue for USB controller commonly found in PMC-Sierra MSP71xx family of SoC's.
Signed-off-by Anoop P A <[email protected]>---
Changes.ehci-pmcmsp.cis based on latest ehci-pci.c.Addressed some stylistic issue pointed by Greg. Addressed comments from Matthieu CASTET.
Could you spell that out more completely next time?
drivers/usb/host/Kconfig config USB_EHCI_TT_NEWSCHED · line 95
Quoted 2 lines
drivers/usb/host/Kconfig +2
-0+config USB_EHCI_HCD_PMC_MSP + tristate "EHCI support for on-chip PMC MSP USB controller"
Better to say "EHCI support for on-chip PMC-Sierra MSP71xx USB controllers"
drivers/usb/host/Kconfig config USB_EHCI_TT_NEWSCHED · line 97
Quoted 2 lines
drivers/usb/host/Kconfig +2
-0+ depends on USB_EHCI_HCD && MSP_HAS_USB + default y
New features always default to No.
Quoted 1 line
+#include <
msp_usb.h>
Cannot find the msp_usb.h in linux-next. Doesn't compile.
Quoted 5 lines
drivers/usb/host/ehci-pmcmsp.c new file +5
-0+static void usb_hcd_tdi_set_mode (struct ehci_hcd *ehci) +{ +u8 *base; +u8 *statreg; +u8 *fiforeg;
drivers/usb/host/ehci-pmcmsp.c line 57
Quoted 10 lines
drivers/usb/host/ehci-pmcmsp.c new file +10
-0+u32 val; +struct ehci_regs *reg_base = ehci->regs; + +/* get register base */ + base = (u8 *)reg_base +USB_EHCI_REG_USB_MODE ; + statreg = (u8 *)reg_base +USB_EHCI_REG_USB_STATUS ; + fiforeg = (u8 *)reg_base +USB_EHCI_REG_USB_FIFO ; + +/* Disable controller mode stream */ + val =ehci_readl (ehci, (u32 *)base);
It doesn't compile so I can't test this, but I think that this will cause a sparse warning. "base" should have an __iomem tag. Please run sparse on this driver.
drivers/usb/host/ehci-pmcmsp.c line 81
Quoted 6 lines
drivers/usb/host/ehci-pmcmsp.c new file +6
-0+/* called after powerup, by probe or system-pm "wakeup" */ +static int ehci_msp_reinit (struct ehci_hcd *ehci) +{ +ehci_port_power (ehci,0 ); + +return 0 ;
Better to make this function void.
drivers/usb/host/ehci-pmcmsp.c line 89
Quoted 8 lines
drivers/usb/host/ehci-pmcmsp.c new file +8
-0+} + +/* called during probe() after chip reset completes */ +static int ehci_msp_setup (struct usb_hcd *hcd) +{ +struct ehci_hcd *ehci =hcd_to_ehci (hcd); +u32 temp; +int retval;
Needs a blank line here to separate declarations from code.
Quoted 6 lines
drivers/usb/host/ehci-pmcmsp.c new file +6
-0+ ehci->big_endian_mmio =1 ; + ehci->big_endian_desc =1 ; + + ehci->caps = hcd->regs; + ehci->regs = hcd->regs + +HC_LENGTH (ehci_readl (ehci, &ehci->caps->hc_capbase));
[snip]
drivers/usb/host/ehci-pmcmsp.c line 115
Quoted 7 lines
drivers/usb/host/ehci-pmcmsp.c new file +7
-0+/* data structure init */ + retval =ehci_init (hcd); +if (retval) +return retval; + + temp =HCS_N_CC (ehci->hcs_params) *HCS_N_PCC (ehci->hcs_params); + temp &=0x0f ;
companion HCs * ports per CC & 0xf?
What's the &= 0x0f for? It's left out of the printk.
Quoted 7 lines
drivers/usb/host/ehci-pmcmsp.c new file +7
-0+if (temp &&HCS_N_PORTS (ehci->hcs_params) > temp) { +ehci_dbg (ehci,"bogus port configuration: " +"cc=%d x pcc=%d < ports=%d\n" , +HCS_N_CC (ehci->hcs_params), +HCS_N_PCC (ehci->hcs_params), +HCS_N_PORTS (ehci->hcs_params)); + }
[snip]
Quoted 1 line
+/*-------------------------------------------------------------------------*/
No need for these blank comments.
drivers/usb/host/ehci-pmcmsp.c line 139
Quoted 9 lines
drivers/usb/host/ehci-pmcmsp.c new file +9
-0+ +static void msp_start_hc (struct platform_device *dev) +{ +} + +static void msp_stop_hc (struct platform_device *dev) +{ +} +
I don't understand the point of these empty functions.
drivers/usb/host/ehci-pmcmsp.c line 166
Quoted 12 lines
drivers/usb/host/ehci-pmcmsp.c new file +12
-0+static int ehci_msp_suspend (struct device *dev) +{ +struct usb_hcd *hcd =dev_get_drvdata (dev); +struct ehci_hcd *ehci =hcd_to_ehci (hcd); +unsigned long flags; +int rc; + +return 0 ; + rc =0 ; + +if (time_before (jiffies, ehci->next_statechange)) +usleep (10000 );
Is there still a usleep() function? Either way, can you send us something that compiles on linux-next?
regards,
dan carpenter
Re: [PATCH v5] EHCI bus glue for on-chip PMC MSP USB controller
Quoted 6 lines · Dan Carpenter
Quoted 5 lines · Anoop P.A
From: Anoop <paanoop1@paanoop1-desktop.(none)>
This patch add bus glue for USB controller commonly found in PMC-Sierra MSP71xx family of SoC's.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Anoop P A <[email protected]>---
Changes.ehci-pmcmsp.cis based on latest ehci-pci.c.Addressed some stylistic issue pointed by Greg. Addressed comments from Matthieu CASTET.Could you spell that out more completely next time?
OK
Quoted 5 lines
drivers/usb/host/Kconfig config USB_EHCI_TT_NEWSCHED · line 95
Quoted 3 lines
drivers/usb/host/Kconfig +2
-0+config USB_EHCI_HCD_PMC_MSP + tristate "EHCI support for on-chip PMC MSP USB controller"Better to say "EHCI support for on-chip PMC-Sierra MSP71xx USB controllers"
Ok will change that
Quoted 5 lines
drivers/usb/host/Kconfig config USB_EHCI_TT_NEWSCHED · line 97
Quoted 3 lines
drivers/usb/host/Kconfig +2
-0+ depends on USB_EHCI_HCD && MSP_HAS_USB + default yNew features always default to No.
O.k
Quoted 4 lines
Quoted 2 lines
+#include <
msp_usb.h>Cannot find the
msp_usb.hin linux-next. Doesn't compile.
msp_usb.h has made it's way to linux-mips queue tree along with the platform code
Quoted 12 lines
Quoted 12 lines
drivers/usb/host/ehci-pmcmsp.c new file +11
-0+static void usb_hcd_tdi_set_mode (struct ehci_hcd *ehci) +{ +u8 *base; +u8 *statreg; +u8 *fiforeg; +u32 val; +struct ehci_regs *reg_base = ehci->regs; + +/* get register base */ + base = (u8 *)reg_base +USB_EHCI_REG_USB_MODE ; + statreg = (u8 *)reg_base +USB_EHCI_REG_USB_STATUS ;
Quoted 8 lines
drivers/usb/host/ehci-pmcmsp.c line 57
Quoted 4 lines
drivers/usb/host/ehci-pmcmsp.c new file +4
-0+ fiforeg = (u8 *)reg_base +USB_EHCI_REG_USB_FIFO ; + +/* Disable controller mode stream */ + val =ehci_readl (ehci, (u32 *)base);It doesn't compile so I can't test this, but I think that this will cause a sparse warning. "base" should have an
__iomemtag. Please run sparse on this driver.
Looks like mips platform build has been broken on linux-next ( unable to configure) . However I have tested code with linux-queue tree ( mips) and didn't see any such warnings
Quoted 9 lines
drivers/usb/host/ehci-pmcmsp.c line 81
Quoted 7 lines
drivers/usb/host/ehci-pmcmsp.c new file +6
-0+/* called after powerup, by probe or system-pm "wakeup" */ +static int ehci_msp_reinit (struct ehci_hcd *ehci) +{ +ehci_port_power (ehci,0 ); + +return 0 ;Better to make this function void.
O.K
Quoted 11 lines
drivers/usb/host/ehci-pmcmsp.c line 89
Quoted 9 lines
drivers/usb/host/ehci-pmcmsp.c new file +8
-0+} + +/* called during probe() after chip reset completes */ +static int ehci_msp_setup (struct usb_hcd *hcd) +{ +struct ehci_hcd *ehci =hcd_to_ehci (hcd); +u32 temp; +int retval;Needs a blank line here to separate declarations from code.
O.K
Quoted 20 lines
Quoted 7 lines
drivers/usb/host/ehci-pmcmsp.c new file +6
-0+ ehci->big_endian_mmio =1 ; + ehci->big_endian_desc =1 ; + + ehci->caps = hcd->regs; + ehci->regs = hcd->regs + +HC_LENGTH (ehci_readl (ehci, &ehci->caps->hc_capbase));[snip]
drivers/usb/host/ehci-pmcmsp.c line 115
Quoted 7 lines
drivers/usb/host/ehci-pmcmsp.c new file +7
-0+/* data structure init */ + retval =ehci_init (hcd); +if (retval) +return retval; + + temp =HCS_N_CC (ehci->hcs_params) *HCS_N_PCC (ehci->hcs_params); + temp &=0x0f ;companion HCs * ports per CC &
0xf?
Quoted 1 line
What's the &=
0x0ffor? It's left out of the printk.
Code got carried forward from ehci-pci.c . Is that says ehci-pci.c is uptodate? .
Quoted 11 lines
Quoted 8 lines
drivers/usb/host/ehci-pmcmsp.c new file +7
-0+if (temp &&HCS_N_PORTS (ehci->hcs_params) > temp) { +ehci_dbg (ehci,"bogus port configuration: " +"cc=%d x pcc=%d < ports=%d\n" , +HCS_N_CC (ehci->hcs_params), +HCS_N_PCC (ehci->hcs_params), +HCS_N_PORTS (ehci->hcs_params)); + }[snip]
Quoted 3 lines
Quoted 1 line
+/*-------------------------------------------------------------------------*/
No need for these blank comments.
O.K
Quoted 12 lines
drivers/usb/host/ehci-pmcmsp.c line 139
Quoted 10 lines
drivers/usb/host/ehci-pmcmsp.c new file +9
-0+ +static void msp_start_hc (struct platform_device *dev) +{ +} + +static void msp_stop_hc (struct platform_device *dev) +{ +} +I don't understand the point of these empty functions.
Will remove it.
Quoted 16 lines
drivers/usb/host/ehci-pmcmsp.c line 166
Quoted 13 lines
drivers/usb/host/ehci-pmcmsp.c new file +12
-0+static int ehci_msp_suspend (struct device *dev) +{ +struct usb_hcd *hcd =dev_get_drvdata (dev); +struct ehci_hcd *ehci =hcd_to_ehci (hcd); +unsigned long flags; +int rc; + +return 0 ; + rc =0 ; + +if (time_before (jiffies, ehci->next_statechange)) +usleep (10000 );Is there still a
usleep()function? Either way, can you send us something that compiles on linux-next?
Again code got carried from ehci-pci.c .(changed msleep to usleep as checkpatch complained about it). I am unable to compile mips targets in linux-next tree . However this patch is tested with both linux-stable and linux-queue tree of l-m-o
Quoted 5 lines
regards,
dan carpenter
Re: [PATCH v5] EHCI bus glue for on-chip PMC MSP USB controller
Quoted 3 lines · Anoop P A
Quoted 1 line
Cannot find the
msp_usb.hin linux-next. Doesn't compile.
msp_usb.hhas made it's way to linux-mips queue tree along with the platform code
Hm... Ralf is on the CC list. Ralf, why are the "Patches queued for the next Linux kernel release." not included in linux-next?
Quoted 8 lines
Quoted 5 lines
drivers/usb/host/ehci-pmcmsp.c line 57
Quoted 1 line
drivers/usb/host/ehci-pmcmsp.c new file +1
-0+ val =ehci_readl (ehci, (u32 *)base);It doesn't compile so I can't test this, but I think that this will cause a sparse warning. "base" should have an
__iomemtag. Please run sparse on this driver.Looks like mips platform build has been broken on linux-next ( unable to configure) . However I have tested code with linux-queue tree ( mips) and didn't see any such warnings
Sparse is an external tool. You have to install it and build with make C=1 drivers/usb/file.o
Quoted 8 lines
Quoted 6 lines
drivers/usb/host/ehci-pmcmsp.c line 115
Quoted 2 lines
drivers/usb/host/ehci-pmcmsp.c new file +2
-0+ temp =HCS_N_CC (ehci->hcs_params) *HCS_N_PCC (ehci->hcs_params); + temp &=0x0f ;companion HCs * ports per CC &
0xf?What's the &=
0x0ffor? It's left out of the printk.Code got carried forward from
ehci-pci.c. Is that saysehci-pci.cis uptodate? .
My guess is that ehci-pci.c is buggy. Anyway this is just a work around to handle buggy hardware. Since the code here just prints some debug output and doesn't do the work arounds we might as well remove the whole thing? It seems unlikely that your mips hardware will have the same bug.
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
drivers/usb/host/ehci-pmcmsp.c new file +7
-0+static int ehci_msp_suspend (struct device *dev) +{ +struct usb_hcd *hcd =dev_get_drvdata (dev); +struct ehci_hcd *ehci =hcd_to_ehci (hcd); +unsigned long flags; +int rc; +Quoted 8 lines
drivers/usb/host/ehci-pmcmsp.c line 166
Quoted 5 lines
drivers/usb/host/ehci-pmcmsp.c new file +5
-0+return 0 ; + rc =0 ; + +if (time_before (jiffies, ehci->next_statechange)) +usleep (10000 );Is there still a
usleep()function? Either way, can you send us something that compiles on linux-next?
Quoted 4 lines
Again code got carried from
ehci-pci.c.(changed msleep to usleep as checkpatch complained about it). I am unable to compile mips targets in linux-next tree . However this patch is tested with both linux-stable and linux-queue tree of l-m-o
checkpatch.pl complains because msleep() is not accurate for tiny amounts of time. There is no usleep() function because trying to be that accurate is a lot of work and causes a lot of interrupts. There is a usleep_range() function instead which lets the scheduler group wakeups together. This is documented in Documentation/timers/timers-howto.txt
Also this is dead code. No one will complain, if you just delete it.
regards,
dan carpenter
Re: [PATCH v5] EHCI bus glue for on-chip PMC MSP USB controller
Quoted 9 lines · Dan Carpenter
Quoted 6 lines
Quoted 3 lines
It doesn't compile so I can't test this, but I think that this will cause a sparse warning. "base" should have an
__iomemtag. Please run sparse on this driver.Looks like mips platform build has been broken on linux-next ( unable to configure) . However I have tested code with linux-queue tree ( mips) and didn't see any such warnings
Sparse is an external tool. You have to install it and build with make C=1
drivers/usb/file.o
Ok. I found there was some issue in arch/mips/Makefile CHECKFLAGS
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/usb/host/ehci-pmcmsp.c line 115
Quoted 3 lines
drivers/usb/host/ehci-pmcmsp.c new file +2
-0+ temp =HCS_N_CC (ehci->hcs_params) *HCS_N_PCC (ehci->hcs_params); + temp &=0x0f ;companion HCs * ports per CC &
0xf?What's the &=
0x0ffor? It's left out of the printk.
Quoted 8 lines
Quoted 2 lines
Code got carried forward from
ehci-pci.c. Is that saysehci-pci.cis uptodate? .My guess is that
ehci-pci.cis buggy. Anyway this is just a work around to handle buggy hardware. Since the code here just prints some debug output and doesn't do the work arounds we might as well remove the whole thing? It seems unlikely that your mips hardware will have the same bug.
Ok I will remove the code block
Quoted 21 lines
Quoted 16 lines
Quoted 16 lines
drivers/usb/host/ehci-pmcmsp.c line 166
Quoted 13 lines
drivers/usb/host/ehci-pmcmsp.c new file +12
-0+static int ehci_msp_suspend (struct device *dev) +{ +struct usb_hcd *hcd =dev_get_drvdata (dev); +struct ehci_hcd *ehci =hcd_to_ehci (hcd); +unsigned long flags; +int rc; + +return 0 ; + rc =0 ; + +if (time_before (jiffies, ehci->next_statechange)) +usleep (10000 );Is there still a
usleep()function? Either way, can you send us something that compiles on linux-next?Quoted 4 lines
Again code got carried from
ehci-pci.c.(changed msleep to usleep as checkpatch complained about it). I am unable to compile mips targets in linux-next tree . However this patch is tested with both linux-stable and linux-queue tree of l-m-o
Quoted 8 lines
checkpatch.pl complains because
msleep()is not accurate for tiny amounts of time. There is nousleep()function because trying to be that accurate is a lot of work and causes a lot of interrupts. There is ausleep_range()function instead which lets the scheduler group wakeups together. This is documented inDocumentation/timers/timers-howto.txtAlso this is dead code. No one will complain, if you just delete it.
You mean entire ehci_msp_suspend() ??
Quoted 3 lines
regards,
dan carpenter
Re: [PATCH v5] EHCI bus glue for on-chip PMC MSP USB controller
Quoted 3 lines · Anoop P A
Quoted 1 line
Also this is dead code. No one will complain, if you just delete it.
You mean entire
ehci_msp_suspend()??
Sure why not? It's not really ready to submit. People can't complain about it if you don't submit it.
(Understand that I'm from the peanut gallery. I'm not in anyway a maintainer of this code and my suggestions carry very little weight).
regards,
dan carpenter
PATCH 1/1 EHCI bus glue for on-chip PMC MSP USB controller
From: Anoop <paanoop1@paanoop1-desktop.(none)>
This patch add bus glue for USB controller commonly found in PMC-Sierra MSP71xx family of SoC's.
---
Changes.ehci-pmcmsp.c is based on latest ehci-pci.c.Addressed some stylistic issue pointed by Greg.
Removed tdi reset quirk following the suggestion from Matthieu.
Removed power management code as it seems to be problematic.Removed some unwanted functions following the suggestions of Dan.
drivers/usb/host/Kconfig | 15 ++- drivers/usb/host/ehci-hcd.c | 5 + drivers/usb/host/ehci-pmcmsp.c | 383 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 401 insertions(+), 2 deletions(-) create mode 100644 drivers/usb/host/ehci-pmcmsp.c
drivers/usb/host/Kconfig +13 -2
@@ -91,17 +91,28 @@ config USB_EHCI_TT_NEWSCHED If unsure, say Y. +config USB_EHCI_HCD_PMC_MSP + tristate "EHCI support for on-chip PMC MSP71xx USB controller" + depends on USB_EHCI_HCD && MSP_HAS_USB + default n + select USB_EHCI_BIG_ENDIAN_DESC + select USB_EHCI_BIG_ENDIAN_MMIO + ---help--- + Enables support for the onchip USB controller on the PMC_MSP7100 Family SoC's. + If unsure, say N. + config USB_EHCI_BIG_ENDIAN_MMIO bool depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || \ ARCH_IXP4XX || XPS_USB_HCD_XILINX || \ - PPC_MPC512x || CPU_CAVIUM_OCTEON) + PPC_MPC512x || CPU_CAVIUM_OCTEON || \ + PMC_MSP) default y config USB_EHCI_BIG_ENDIAN_DESC bool depends on USB_EHCI_HCD && (440EPX || ARCH_IXP4XX || XPS_USB_HCD_XILINX || \ - PPC_MPC512x) + PPC_MPC512x || PMC_MSP) default y config XPS_USB_HCD_XILINX
drivers/usb/host/ehci-hcd.c +5 -0
@@ -1250,6 +1250,11 @@ MODULE_LICENSE ("GPL");#define PLATFORM_DRIVER ehci_msm_driver#endif +#ifdef CONFIG_USB_EHCI_HCD_PMC_MSP +#include "ehci-pmcmsp.c" +#define PLATFORM_DRIVER ehci_hcd_msp_driver +#endif +#if !defined(PCI_DRIVER ) && !defined(PLATFORM_DRIVER ) && \ !defined(PS3_SYSTEM_BUS_DRIVER ) && !defined(OF_PLATFORM_DRIVER ) && \ !defined(XILINX_OF_PLATFORM_DRIVER )
drivers/usb/host/ehci-pmcmsp.c new file +383 -0
383 lines not on this page · raw message
Signature · 1 line
1.7.0.4