History

Merge tag 'usb-3.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull more USB fixes from Greg Kroah-Hartman: "Here are some more USB fixes for the 3.8-rc4 tree. Some gadget driver fixes, and finally resolved the ehci-mxc driver build issues (it's just some code moving around and being deleted)." * tag 'usb-3.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: USB: EHCI: fix build error in ehci-mxc USB: EHCI: add a name for the platform-private field USB: EHCI: fix incorrect configuration test USB: EHCI: Move definition of EHCI_STATS to ehci.h USB: UHCI: fix IRQ race during initialization usb: gadget: FunctionFS: Fix missing braces in parse_opts usb: dwc3: gadget: fix ep->maxburst for ep0 ARM: i.MX clock: Change the connection-id for fsl-usb2-udc usb: gadget: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap usb: gadget: fsl-mxc-udc: replace cpu_is_xxx() with platform_device_id usb: musb: cppi_dma: drop '__init' annotation

Linus Torvalds committed 13 years ago

Commit ff7532c2 parents ae763db dba63b219 files · +154 −147Browse files

Unified · Split

19 files
  1. arch/arm/mach-imx/clk-imx25.c +3 −3
  2. arch/arm/mach-imx/clk-imx27.c +3 −3
  3. arch/arm/mach-imx/clk-imx31.c +3 −3
  4. arch/arm/mach-imx/clk-imx35.c +3 −3
  5. arch/arm/mach-imx/clk-imx51-imx53.c +3 −3
  6. arch/arm/mach-imx/devices/devices-common.h +1 −0
  7. arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c +8 −7
  8. drivers/usb/dwc3/gadget.c +1 −0
  9. drivers/usb/gadget/f_fs.c +3 −3
  10. drivers/usb/gadget/fsl_mxc_udc.c +26 −14
  11. drivers/usb/gadget/fsl_udc_core.c +25 −17
  12. drivers/usb/gadget/fsl_usb2_udc.h +3 −2
  13. drivers/usb/host/Kconfig +1 −1
  14. drivers/usb/host/Makefile +1 −0
  15. drivers/usb/host/ehci-hcd.c +2 −10
  16. drivers/usb/host/ehci-mxc.c +50 −70
  17. drivers/usb/host/ehci.h +7 −0
  18. drivers/usb/host/uhci-hcd.c +9 −6
  19. drivers/usb/musb/cppi_dma.c +2 −2
arch/arm/mach-imx/clk-imx25.c+3−3
@@ -254,9 +254,9 @@ int __init mx25_clocks_init(void) · 253 unmodified lines
254254 clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.2");
255255 clk_register_clkdev(clk[usbotg_ahb], "ahb", "mxc-ehci.2");
256256 clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.2");
257− clk_register_clkdev(clk[ipg], "ipg", "fsl-usb2-udc");
258− clk_register_clkdev(clk[usbotg_ahb], "ahb", "fsl-usb2-udc");
259− clk_register_clkdev(clk[usb_div], "per", "fsl-usb2-udc");
257+ clk_register_clkdev(clk[ipg], "ipg", "imx-udc-mx27");
258+ clk_register_clkdev(clk[usbotg_ahb], "ahb", "imx-udc-mx27");
259+ clk_register_clkdev(clk[usb_div], "per", "imx-udc-mx27");
260260 clk_register_clkdev(clk[nfc_ipg_per], NULL, "imx25-nand.0");
261261 /* i.mx25 has the i.mx35 type cspi */
262262 clk_register_clkdev(clk[cspi1_ipg], NULL, "imx35-cspi.0");
arch/arm/mach-imx/clk-imx27.c+3−3
@@ -236,9 +236,9 @@ int __init mx27_clocks_init(unsigned long fref) · 235 unmodified lines
236236 clk_register_clkdev(clk[lcdc_ahb_gate], "ahb", "imx21-fb.0");
237237 clk_register_clkdev(clk[csi_ahb_gate], "ahb", "imx27-camera.0");
238238 clk_register_clkdev(clk[per4_gate], "per", "imx27-camera.0");
239− clk_register_clkdev(clk[usb_div], "per", "fsl-usb2-udc");
240− clk_register_clkdev(clk[usb_ipg_gate], "ipg", "fsl-usb2-udc");
241− clk_register_clkdev(clk[usb_ahb_gate], "ahb", "fsl-usb2-udc");
239+ clk_register_clkdev(clk[usb_div], "per", "imx-udc-mx27");
240+ clk_register_clkdev(clk[usb_ipg_gate], "ipg", "imx-udc-mx27");
241+ clk_register_clkdev(clk[usb_ahb_gate], "ahb", "imx-udc-mx27");
242242 clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.0");
243243 clk_register_clkdev(clk[usb_ipg_gate], "ipg", "mxc-ehci.0");
244244 clk_register_clkdev(clk[usb_ahb_gate], "ahb", "mxc-ehci.0");
arch/arm/mach-imx/clk-imx31.c+3−3
@@ -139,9 +139,9 @@ int __init mx31_clocks_init(unsigned long fref) · 138 unmodified lines
139139 clk_register_clkdev(clk[usb_div_post], "per", "mxc-ehci.2");
140140 clk_register_clkdev(clk[usb_gate], "ahb", "mxc-ehci.2");
141141 clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.2");
142− clk_register_clkdev(clk[usb_div_post], "per", "fsl-usb2-udc");
143− clk_register_clkdev(clk[usb_gate], "ahb", "fsl-usb2-udc");
144− clk_register_clkdev(clk[ipg], "ipg", "fsl-usb2-udc");
142+ clk_register_clkdev(clk[usb_div_post], "per", "imx-udc-mx27");
143+ clk_register_clkdev(clk[usb_gate], "ahb", "imx-udc-mx27");
144+ clk_register_clkdev(clk[ipg], "ipg", "imx-udc-mx27");
145145 clk_register_clkdev(clk[csi_gate], NULL, "mx3-camera.0");
146146 /* i.mx31 has the i.mx21 type uart */
147147 clk_register_clkdev(clk[uart1_gate], "per", "imx21-uart.0");
arch/arm/mach-imx/clk-imx35.c+3−3
@@ -251,9 +251,9 @@ int __init mx35_clocks_init() · 250 unmodified lines
251251 clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.2");
252252 clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.2");
253253 clk_register_clkdev(clk[usbotg_gate], "ahb", "mxc-ehci.2");
254− clk_register_clkdev(clk[usb_div], "per", "fsl-usb2-udc");
255− clk_register_clkdev(clk[ipg], "ipg", "fsl-usb2-udc");
256− clk_register_clkdev(clk[usbotg_gate], "ahb", "fsl-usb2-udc");
254+ clk_register_clkdev(clk[usb_div], "per", "imx-udc-mx27");
255+ clk_register_clkdev(clk[ipg], "ipg", "imx-udc-mx27");
256+ clk_register_clkdev(clk[usbotg_gate], "ahb", "imx-udc-mx27");
257257 clk_register_clkdev(clk[wdog_gate], NULL, "imx2-wdt.0");
258258 clk_register_clkdev(clk[nfc_div], NULL, "imx25-nand.0");
259259 clk_register_clkdev(clk[csi_gate], NULL, "mx3-camera.0");
arch/arm/mach-imx/clk-imx51-imx53.c+3−3
@@ -269,9 +269,9 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil, · 268 unmodified lines
269269 clk_register_clkdev(clk[usboh3_per_gate], "per", "mxc-ehci.2");
270270 clk_register_clkdev(clk[usboh3_gate], "ipg", "mxc-ehci.2");
271271 clk_register_clkdev(clk[usboh3_gate], "ahb", "mxc-ehci.2");
272− clk_register_clkdev(clk[usboh3_per_gate], "per", "fsl-usb2-udc");
273− clk_register_clkdev(clk[usboh3_gate], "ipg", "fsl-usb2-udc");
274− clk_register_clkdev(clk[usboh3_gate], "ahb", "fsl-usb2-udc");
272+ clk_register_clkdev(clk[usboh3_per_gate], "per", "imx-udc-mx51");
273+ clk_register_clkdev(clk[usboh3_gate], "ipg", "imx-udc-mx51");
274+ clk_register_clkdev(clk[usboh3_gate], "ahb", "imx-udc-mx51");
275275 clk_register_clkdev(clk[nfc_gate], NULL, "imx51-nand");
276276 clk_register_clkdev(clk[ssi1_ipg_gate], NULL, "imx-ssi.0");
277277 clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1");
arch/arm/mach-imx/devices/devices-common.h+1−0
@@ -63,6 +63,7 @@ struct platform_device *__init imx_add_flexcan( · 62 unmodified lines
6363
6464 #include <linux/fsl_devices.h>
6565 struct imx_fsl_usb2_udc_data {
66+ const char *devid;
6667 resource_size_t iobase;
6768 resource_size_t irq;
6869 };
arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c+8−7
@@ -11,35 +11,36 @@ · 10 unmodified lines
1111 #include "../hardware.h"
1212 #include "devices-common.h"
1313
14−#define imx_fsl_usb2_udc_data_entry_single(soc) \
14+#define imx_fsl_usb2_udc_data_entry_single(soc, _devid) \
1515 { \
16+ .devid = _devid, \
1617 .iobase = soc ## _USB_OTG_BASE_ADDR, \
1718 .irq = soc ## _INT_USB_OTG, \
1819 }
1920
2021 #ifdef CONFIG_SOC_IMX25
2122 const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data __initconst =
22− imx_fsl_usb2_udc_data_entry_single(MX25);
23+ imx_fsl_usb2_udc_data_entry_single(MX25, "imx-udc-mx27");
2324 #endif /* ifdef CONFIG_SOC_IMX25 */
2425
2526 #ifdef CONFIG_SOC_IMX27
2627 const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst =
27− imx_fsl_usb2_udc_data_entry_single(MX27);
28+ imx_fsl_usb2_udc_data_entry_single(MX27, "imx-udc-mx27");
2829 #endif /* ifdef CONFIG_SOC_IMX27 */
2930
3031 #ifdef CONFIG_SOC_IMX31
3132 const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst =
32− imx_fsl_usb2_udc_data_entry_single(MX31);
33+ imx_fsl_usb2_udc_data_entry_single(MX31, "imx-udc-mx27");
3334 #endif /* ifdef CONFIG_SOC_IMX31 */
3435
3536 #ifdef CONFIG_SOC_IMX35
3637 const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst =
37− imx_fsl_usb2_udc_data_entry_single(MX35);
38+ imx_fsl_usb2_udc_data_entry_single(MX35, "imx-udc-mx27");
3839 #endif /* ifdef CONFIG_SOC_IMX35 */
3940
4041 #ifdef CONFIG_SOC_IMX51
4142 const struct imx_fsl_usb2_udc_data imx51_fsl_usb2_udc_data __initconst =
42− imx_fsl_usb2_udc_data_entry_single(MX51);
43+ imx_fsl_usb2_udc_data_entry_single(MX51, "imx-udc-mx51");
4344 #endif
4445
4546 struct platform_device *__init imx_add_fsl_usb2_udc(
@@ -57,7 +58,7 @@ struct platform_device *__init imx_add_fsl_usb2_udc( · 11 unmodified lines
5758 .flags = IORESOURCE_IRQ,
5859 },
5960 };
60− return imx_add_platform_device_dmamask("fsl-usb2-udc", -1,
61+ return imx_add_platform_device_dmamask(data->devid, -1,
6162 res, ARRAY_SIZE(res),
6263 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
6364 }
drivers/usb/dwc3/gadget.c+1−0
@@ -1605,6 +1605,7 @@ static int dwc3_gadget_init_endpoints(struct dwc3 *dwc) · 1604 unmodified lines
16051605
16061606 if (epnum == 0 || epnum == 1) {
16071607 dep->endpoint.maxpacket = 512;
1608+ dep->endpoint.maxburst = 1;
16081609 dep->endpoint.ops = &dwc3_gadget_ep0_ops;
16091610 if (!epnum)
16101611 dwc->gadget.ep0 = &dep->endpoint;
drivers/usb/gadget/f_fs.c+3−3
@@ -1153,15 +1153,15 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts) · 1152 unmodified lines
11531153 pr_err("%s: unmapped value: %lu\n", opts, value);
11541154 return -EINVAL;
11551155 }
1156− }
1157− else if (!memcmp(opts, "gid", 3))
1156+ } else if (!memcmp(opts, "gid", 3)) {
11581157 data->perms.gid = make_kgid(current_user_ns(), value);
11591158 if (!gid_valid(data->perms.gid)) {
11601159 pr_err("%s: unmapped value: %lu\n", opts, value);
11611160 return -EINVAL;
11621161 }
1163− else
1162+ } else {
11641163 goto invalid;
1164+ }
11651165 break;
11661166
11671167 default:
drivers/usb/gadget/fsl_mxc_udc.c+26−14
@@ -18,14 +18,13 @@ · 17 unmodified lines
1818 #include <linux/platform_device.h>
1919 #include <linux/io.h>
2020
21−#include <mach/hardware.h>
22−
2321 static struct clk *mxc_ahb_clk;
2422 static struct clk *mxc_per_clk;
2523 static struct clk *mxc_ipg_clk;
2624
2725 /* workaround ENGcm09152 for i.MX35 */
28−#define USBPHYCTRL_OTGBASE_OFFSET 0x608
26+#define MX35_USBPHYCTRL_OFFSET 0x600
27+#define USBPHYCTRL_OTGBASE_OFFSET 0x8
2928 #define USBPHYCTRL_EVDO (1 << 23)
3029
3130 int fsl_udc_clk_init(struct platform_device *pdev)
@@ -59,7 +58,7 @@ int fsl_udc_clk_init(struct platform_device *pdev) · 27 unmodified lines
5958 clk_prepare_enable(mxc_per_clk);
6059
6160 /* make sure USB_CLK is running at 60 MHz +/- 1000 Hz */
62− if (!cpu_is_mx51()) {
61+ if (!strcmp(pdev->id_entry->name, "imx-udc-mx27")) {
6362 freq = clk_get_rate(mxc_per_clk);
6463 if (pdata->phy_mode != FSL_USB2_PHY_ULPI &&
6564 (freq < 59999000 || freq > 60001000)) {
@@ -79,27 +78,40 @@ eclkrate: · 13 unmodified lines
7978 return ret;
8079 }
8180
82−void fsl_udc_clk_finalize(struct platform_device *pdev)
81+int fsl_udc_clk_finalize(struct platform_device *pdev)
8382 {
8483 struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;
85− if (cpu_is_mx35()) {
86− unsigned int v;
84+ int ret = 0;
8785
88− /* workaround ENGcm09152 for i.MX35 */
89− if (pdata->workaround & FLS_USB2_WORKAROUND_ENGCM09152) {
90− v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR +
91− USBPHYCTRL_OTGBASE_OFFSET));
92− writel(v | USBPHYCTRL_EVDO,
93− MX35_IO_ADDRESS(MX35_USB_BASE_ADDR +
94− USBPHYCTRL_OTGBASE_OFFSET));
86+ /* workaround ENGcm09152 for i.MX35 */
87+ if (pdata->workaround & FLS_USB2_WORKAROUND_ENGCM09152) {
88+ unsigned int v;
89+ struct resource *res = platform_get_resource
90+ (pdev, IORESOURCE_MEM, 0);
91+ void __iomem *phy_regs = ioremap(res->start +
92+ MX35_USBPHYCTRL_OFFSET, 512);
93+ if (!phy_regs) {
94+ dev_err(&pdev->dev, "ioremap for phy address fails\n");
95+ ret = -EINVAL;
96+ goto ioremap_err;
9597 }
98+
99+ v = readl(phy_regs + USBPHYCTRL_OTGBASE_OFFSET);
100+ writel(v | USBPHYCTRL_EVDO,
101+ phy_regs + USBPHYCTRL_OTGBASE_OFFSET);
102+
103+ iounmap(phy_regs);
96104 }
97105
106+
107+ioremap_err:
98108 /* ULPI transceivers don't need usbpll */
99109 if (pdata->phy_mode == FSL_USB2_PHY_ULPI) {
100110 clk_disable_unprepare(mxc_per_clk);
101111 mxc_per_clk = NULL;
102112 }
113+
114+ return ret;
103115 }
104116
105117 void fsl_udc_clk_release(void)
drivers/usb/gadget/fsl_udc_core.c+25−17
@@ -41,6 +41,7 @@ · 40 unmodified lines
4141 #include <linux/fsl_devices.h>
4242 #include <linux/dmapool.h>
4343 #include <linux/delay.h>
44+#include <linux/of_device.h>
4445
4546 #include <asm/byteorder.h>
4647 #include <asm/io.h>
@@ -2438,11 +2439,6 @@ static int __init fsl_udc_probe(struct platform_device *pdev) · 2391 unmodified lines
24382439 unsigned int i;
24392440 u32 dccparams;
24402441
2441− if (strcmp(pdev->name, driver_name)) {
2442− VDBG("Wrong device");
2443− return -ENODEV;
2444− }
2445−
24462442 udc_controller = kzalloc(sizeof(struct fsl_udc), GFP_KERNEL);
24472443 if (udc_controller == NULL) {
24482444 ERR("malloc udc failed\n");
@@ -2547,7 +2543,9 @@ static int __init fsl_udc_probe(struct platform_device *pdev) · 98 unmodified lines
25472543 dr_controller_setup(udc_controller);
25482544 }
25492545
2550− fsl_udc_clk_finalize(pdev);
2546+ ret = fsl_udc_clk_finalize(pdev);
2547+ if (ret)
2548+ goto err_free_irq;
25512549
25522550 /* Setup gadget structure */
25532551 udc_controller->gadget.ops = &fsl_gadget_ops;
@@ -2756,22 +2754,32 @@ static int fsl_udc_otg_resume(struct device *dev) · 202 unmodified lines
27562754
27572755 return fsl_udc_resume(NULL);
27582756 }
2759−
27602757 /*-------------------------------------------------------------------------
27612758 Register entry point for the peripheral controller driver
27622759 --------------------------------------------------------------------------*/
2763−
2760+static const struct platform_device_id fsl_udc_devtype[] = {
2761+ {
2762+ .name = "imx-udc-mx27",
2763+ }, {
2764+ .name = "imx-udc-mx51",
2765+ }, {
2766+ /* sentinel */
2767+ }
2768+};
2769+MODULE_DEVICE_TABLE(platform, fsl_udc_devtype);
27642770 static struct platform_driver udc_driver = {
2765− .remove = __exit_p(fsl_udc_remove),
2771+ .remove = __exit_p(fsl_udc_remove),
2772+ /* Just for FSL i.mx SoC currently */
2773+ .id_table = fsl_udc_devtype,
27662774 /* these suspend and resume are not usb suspend and resume */
2767− .suspend = fsl_udc_suspend,
2768− .resume = fsl_udc_resume,
2769− .driver = {
2770− .name = (char *)driver_name,
2771− .owner = THIS_MODULE,
2772− /* udc suspend/resume called from OTG driver */
2773− .suspend = fsl_udc_otg_suspend,
2774− .resume = fsl_udc_otg_resume,
2775+ .suspend = fsl_udc_suspend,
2776+ .resume = fsl_udc_resume,
2777+ .driver = {
2778+ .name = (char *)driver_name,
2779+ .owner = THIS_MODULE,
2780+ /* udc suspend/resume called from OTG driver */
2781+ .suspend = fsl_udc_otg_suspend,
2782+ .resume = fsl_udc_otg_resume,
27752783 },
27762784 };
27772785
drivers/usb/gadget/fsl_usb2_udc.h+3−2
@@ -592,15 +592,16 @@ static inline struct ep_queue_head *get_qh_by_ep(struct fsl_ep *ep) · 591 unmodified lines
592592 struct platform_device;
593593 #ifdef CONFIG_ARCH_MXC
594594 int fsl_udc_clk_init(struct platform_device *pdev);
595−void fsl_udc_clk_finalize(struct platform_device *pdev);
595+int fsl_udc_clk_finalize(struct platform_device *pdev);
596596 void fsl_udc_clk_release(void);
597597 #else
598598 static inline int fsl_udc_clk_init(struct platform_device *pdev)
599599 {
600600 return 0;
601601 }
602−static inline void fsl_udc_clk_finalize(struct platform_device *pdev)
602+static inline int fsl_udc_clk_finalize(struct platform_device *pdev)
603603 {
604+ return 0;
604605 }
605606 static inline void fsl_udc_clk_release(void)
606607 {
drivers/usb/host/Kconfig+1−1
@@ -148,7 +148,7 @@ config USB_EHCI_FSL · 147 unmodified lines
148148 Variation of ARC USB block used in some Freescale chips.
149149
150150 config USB_EHCI_MXC
151− bool "Support for Freescale i.MX on-chip EHCI USB controller"
151+ tristate "Support for Freescale i.MX on-chip EHCI USB controller"
152152 depends on USB_EHCI_HCD && ARCH_MXC
153153 select USB_EHCI_ROOT_HUB_TT
154154 ---help---
drivers/usb/host/Makefile+1−0
@@ -26,6 +26,7 @@ obj-$(CONFIG_PCI) += pci-quirks.o · 25 unmodified lines
2626 obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o
2727 obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
2828 obj-$(CONFIG_USB_EHCI_HCD_PLATFORM) += ehci-platform.o
29+obj-$(CONFIG_USB_EHCI_MXC) += ehci-mxc.o
2930
3031 obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o
3132 obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
drivers/usb/host/ehci-hcd.c+2−10
@@ -74,10 +74,6 @@ static const char hcd_name [] = "ehci_hcd"; · 73 unmodified lines
7474 #undef VERBOSE_DEBUG
7575 #undef EHCI_URB_TRACE
7676
77−#ifdef DEBUG
78−#define EHCI_STATS
79−#endif
80−
8177 /* magic numbers that can affect system performance */
8278 #define EHCI_TUNE_CERR 3 /* 0-3 qtd retries; 0 == don't stop */
8379 #define EHCI_TUNE_RL_HS 4 /* nak throttle; see 4.9 */
@@ -1250,11 +1246,6 @@ MODULE_LICENSE ("GPL"); · 1166 unmodified lines
12501246 #define PLATFORM_DRIVER ehci_fsl_driver
12511247 #endif
12521248
1253−#ifdef CONFIG_USB_EHCI_MXC
1254−#include "ehci-mxc.c"
1255−#define PLATFORM_DRIVER ehci_mxc_driver
1256−#endif
1257−
12581249 #ifdef CONFIG_USB_EHCI_SH
12591250 #include "ehci-sh.c"
12601251 #define PLATFORM_DRIVER ehci_hcd_sh_driver
@@ -1352,7 +1343,8 @@ MODULE_LICENSE ("GPL"); · 91 unmodified lines
13521343
13531344 #if !IS_ENABLED(CONFIG_USB_EHCI_PCI) && \
13541345 !IS_ENABLED(CONFIG_USB_EHCI_HCD_PLATFORM) && \
1355− !defined(CONFIG_USB_CHIPIDEA_HOST) && \
1346+ !IS_ENABLED(CONFIG_USB_CHIPIDEA_HOST) && \
1347+ !IS_ENABLED(CONFIG_USB_EHCI_MXC) && \
13561348 !defined(PLATFORM_DRIVER) && \
13571349 !defined(PS3_SYSTEM_BUS_DRIVER) && \
13581350 !defined(OF_PLATFORM_DRIVER) && \
drivers/usb/host/ehci-mxc.c+50−70
@@ -17,75 +17,38 @@ · 16 unmodified lines
1717 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1818 */
1919
20+#include <linux/kernel.h>
21+#include <linux/module.h>
22+#include <linux/io.h>
2023 #include <linux/platform_device.h>
2124 #include <linux/clk.h>
2225 #include <linux/delay.h>
2326 #include <linux/usb/otg.h>
2427 #include <linux/usb/ulpi.h>
2528 #include <linux/slab.h>
29+#include <linux/usb.h>
30+#include <linux/usb/hcd.h>
2631
2732 #include <linux/platform_data/usb-ehci-mxc.h>
2833
2934 #include <asm/mach-types.h>
3035
36+#include "ehci.h"
37+
38+#define DRIVER_DESC "Freescale On-Chip EHCI Host driver"
39+
40+static const char hcd_name[] = "ehci-mxc";
41+
3142 #define ULPI_VIEWPORT_OFFSET 0x170
3243
3344 struct ehci_mxc_priv {
3445 struct clk *usbclk, *ahbclk, *phyclk;
35− struct usb_hcd *hcd;
3646 };
3747
38−/* called during probe() after chip reset completes */
39−static int ehci_mxc_setup(struct usb_hcd *hcd)
40−{
41− hcd->has_tt = 1;
42−
43− return ehci_setup(hcd);
44−}
48+static struct hc_driver __read_mostly ehci_mxc_hc_driver;
4549
46−static const struct hc_driver ehci_mxc_hc_driver = {
47− .description = hcd_name,
48− .product_desc = "Freescale On-Chip EHCI Host Controller",
49− .hcd_priv_size = sizeof(struct ehci_hcd),
50−
51− /*
52− * generic hardware linkage
53− */
54− .irq = ehci_irq,
55− .flags = HCD_USB2 | HCD_MEMORY,
56−
57− /*
58− * basic lifecycle operations
59− */
60− .reset = ehci_mxc_setup,
61− .start = ehci_run,
62− .stop = ehci_stop,
63− .shutdown = ehci_shutdown,
64−
65− /*
66− * managing i/o requests and associated device resources
67− */
68− .urb_enqueue = ehci_urb_enqueue,
69− .urb_dequeue = ehci_urb_dequeue,
70− .endpoint_disable = ehci_endpoint_disable,
71− .endpoint_reset = ehci_endpoint_reset,
72−
73− /*
74− * scheduling support
75− */
76− .get_frame_number = ehci_get_frame,
77−
78− /*
79− * root hub support
80− */
81− .hub_status_data = ehci_hub_status_data,
82− .hub_control = ehci_hub_control,
83− .bus_suspend = ehci_bus_suspend,
84− .bus_resume = ehci_bus_resume,
85− .relinquish_port = ehci_relinquish_port,
86− .port_handed_over = ehci_port_handed_over,
87−
88− .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
50+static const struct ehci_driver_overrides ehci_mxc_overrides __initdata = {
51+ .extra_priv_size = sizeof(struct ehci_mxc_priv),
8952 };
9053
9154 static int ehci_mxc_drv_probe(struct platform_device *pdev)
@@ -112,12 +75,6 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) · 20 unmodified lines
11275 if (!hcd)
11376 return -ENOMEM;
11477
115− priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
116− if (!priv) {
117− ret = -ENOMEM;
118− goto err_alloc;
119− }
120−
12178 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
12279 if (!res) {
12380 dev_err(dev, "Found HC with no register addr. Check setup!\n");
@@ -135,6 +92,10 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) · 11 unmodified lines
13592 goto err_alloc;
13693 }
13794
95+ hcd->has_tt = 1;
96+ ehci = hcd_to_ehci(hcd);
97+ priv = (struct ehci_mxc_priv *) ehci->priv;
98+
13899 /* enable clocks */
139100 priv->usbclk = devm_clk_get(&pdev->dev, "ipg");
140101 if (IS_ERR(priv->usbclk)) {
@@ -169,8 +130,6 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) · 28 unmodified lines
169130 mdelay(10);
170131 }
171132
172− ehci = hcd_to_ehci(hcd);
173−
174133 /* EHCI registers start at offset 0x100 */
175134 ehci->caps = hcd->regs + 0x100;
176135 ehci->regs = hcd->regs + 0x100 +
@@ -198,8 +157,7 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) · 21 unmodified lines
198157 }
199158 }
200159
201− priv->hcd = hcd;
202− platform_set_drvdata(pdev, priv);
160+ platform_set_drvdata(pdev, hcd);
203161
204162 ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
205163 if (ret)
@@ -244,8 +202,11 @@ err_alloc: · 38 unmodified lines
244202 static int __exit ehci_mxc_drv_remove(struct platform_device *pdev)
245203 {
246204 struct mxc_usbh_platform_data *pdata = pdev->dev.platform_data;
247− struct ehci_mxc_priv *priv = platform_get_drvdata(pdev);
248− struct usb_hcd *hcd = priv->hcd;
205+ struct usb_hcd *hcd = platform_get_drvdata(pdev);
206+ struct ehci_hcd *ehci = hcd_to_ehci(hcd);
207+ struct ehci_mxc_priv *priv = (struct ehci_mxc_priv *) ehci->priv;
208+
209+ usb_remove_hcd(hcd);
249210
250211 if (pdata && pdata->exit)
251212 pdata->exit(pdev);
@@ -253,23 +214,20 @@ static int __exit ehci_mxc_drv_remove(struct platform_device *pdev) · 1 unmodified line
253214 if (pdata->otg)
254215 usb_phy_shutdown(pdata->otg);
255216
256− usb_remove_hcd(hcd);
257− usb_put_hcd(hcd);
258− platform_set_drvdata(pdev, NULL);
259−
260217 clk_disable_unprepare(priv->usbclk);
261218 clk_disable_unprepare(priv->ahbclk);
262219
263220 if (priv->phyclk)
264221 clk_disable_unprepare(priv->phyclk);
265222
223+ usb_put_hcd(hcd);
224+ platform_set_drvdata(pdev, NULL);
266225 return 0;
267226 }
268227
269228 static void ehci_mxc_drv_shutdown(struct platform_device *pdev)
270229 {
271− struct ehci_mxc_priv *priv = platform_get_drvdata(pdev);
272− struct usb_hcd *hcd = priv->hcd;
230+ struct usb_hcd *hcd = platform_get_drvdata(pdev);
273231
274232 if (hcd->driver->shutdown)
275233 hcd->driver->shutdown(hcd);
@@ -279,9 +237,31 @@ MODULE_ALIAS("platform:mxc-ehci"); · 3 unmodified lines
279237
280238 static struct platform_driver ehci_mxc_driver = {
281239 .probe = ehci_mxc_drv_probe,
282− .remove = __exit_p(ehci_mxc_drv_remove),
240+ .remove = ehci_mxc_drv_remove,
283241 .shutdown = ehci_mxc_drv_shutdown,
284242 .driver = {
285243 .name = "mxc-ehci",
286244 },
287245 };
246+
247+static int __init ehci_mxc_init(void)
248+{
249+ if (usb_disabled())
250+ return -ENODEV;
251+
252+ pr_info("%s: " DRIVER_DESC "\n", hcd_name);
253+
254+ ehci_init_driver(&ehci_mxc_hc_driver, &ehci_mxc_overrides);
255+ return platform_driver_register(&ehci_mxc_driver);
256+}
257+module_init(ehci_mxc_init);
258+
259+static void __exit ehci_mxc_cleanup(void)
260+{
261+ platform_driver_unregister(&ehci_mxc_driver);
262+}
263+module_exit(ehci_mxc_cleanup);
264+
265+MODULE_DESCRIPTION(DRIVER_DESC);
266+MODULE_AUTHOR("Sascha Hauer");
267+MODULE_LICENSE("GPL");
drivers/usb/host/ehci.h+7−0
@@ -38,6 +38,10 @@ typedef __u16 __bitwise __hc16; · 37 unmodified lines
3838 #endif
3939
4040 /* statistics can be kept for tuning/monitoring */
41+#ifdef DEBUG
42+#define EHCI_STATS
43+#endif
44+
4145 struct ehci_stats {
4246 /* irq usage */
4347 unsigned long normal;
@@ -221,6 +225,9 @@ struct ehci_hcd { /* one per controller */ · 177 unmodified lines
221225 #ifdef DEBUG
222226 struct dentry *debug_dir;
223227 #endif
228+
229+ /* platform-specific data -- must come last */
230+ unsigned long priv[0] __aligned(sizeof(s64));
224231 };
225232
226233 /* convert between an HCD pointer and the corresponding EHCI_HCD */
drivers/usb/host/uhci-hcd.c+9−6
@@ -447,6 +447,10 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd) · 446 unmodified lines
447447 return IRQ_NONE;
448448 uhci_writew(uhci, status, USBSTS); /* Clear it */
449449
450+ spin_lock(&uhci->lock);
451+ if (unlikely(!uhci->is_initialized)) /* not yet configured */
452+ goto done;
453+
450454 if (status & ~(USBSTS_USBINT | USBSTS_ERROR | USBSTS_RD)) {
451455 if (status & USBSTS_HSE)
452456 dev_err(uhci_dev(uhci), "host system error, "
@@ -455,7 +459,6 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd) · 2 unmodified lines
455459 dev_err(uhci_dev(uhci), "host controller process "
456460 "error, something bad happened!\n");
457461 if (status & USBSTS_HCH) {
458− spin_lock(&uhci->lock);
459462 if (uhci->rh_state >= UHCI_RH_RUNNING) {
460463 dev_err(uhci_dev(uhci),
461464 "host controller halted, "
@@ -473,15 +476,15 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd) · 11 unmodified lines
473476 * pending unlinks */
474477 mod_timer(&hcd->rh_timer, jiffies);
475478 }
476− spin_unlock(&uhci->lock);
477479 }
478480 }
479481
480− if (status & USBSTS_RD)
482+ if (status & USBSTS_RD) {
483+ spin_unlock(&uhci->lock);
481484 usb_hcd_poll_rh_status(hcd);
482− else {
483− spin_lock(&uhci->lock);
485+ } else {
484486 uhci_scan_schedule(uhci);
487+ done:
485488 spin_unlock(&uhci->lock);
486489 }
487490
@@ -662,9 +665,9 @@ static int uhci_start(struct usb_hcd *hcd) · 174 unmodified lines
662665 */
663666 mb();
664667
668+ spin_lock_irq(&uhci->lock);
665669 configure_hc(uhci);
666670 uhci->is_initialized = 1;
667− spin_lock_irq(&uhci->lock);
668671 start_rh(uhci);
669672 spin_unlock_irq(&uhci->lock);
670673 return 0;
drivers/usb/musb/cppi_dma.c+2−2
@@ -105,7 +105,7 @@ static void cppi_reset_tx(struct cppi_tx_stateram __iomem *tx, u32 ptr) · 104 unmodified lines
105105 musb_writel(&tx->tx_complete, 0, ptr);
106106 }
107107
108−static void __init cppi_pool_init(struct cppi *cppi, struct cppi_channel *c)
108+static void cppi_pool_init(struct cppi *cppi, struct cppi_channel *c)
109109 {
110110 int j;
111111
@@ -150,7 +150,7 @@ static void cppi_pool_free(struct cppi_channel *c) · 38 unmodified lines
150150 c->last_processed = NULL;
151151 }
152152
153−static int __init cppi_controller_start(struct dma_controller *c)
153+static int cppi_controller_start(struct dma_controller *c)
154154 {
155155 struct cppi *controller;
156156 void __iomem *tibase;