[PATCH 1/2] usb: storage: sddr09: initialize variables directly
Clean up the code a bit to initialize the variables directly when defining them. Signed-off-by: Emilio López --- Please note that this patch is untested. drivers/usb/storage/sddr09.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c index 732027f..073a2c3 100644 --- a/drivers/usb/storage/sddr09.c +++ b/drivers/usb/storage/sddr09.c @@ -219,11 +219,7 @@ static void nand_init_ecc(void) { /* compute 3-byte ecc on 256 bytes */ static void nand_compute_ecc(unsigned char *data, unsigned char *ecc) { int i, j, a; - unsigned char par, bit, bits[8]; - - par = 0; - for (j = 0; j < 8; j++) - bits[j] = 0; + unsigned char par = 0, bit, bits[8] = {0}; /* collect 16 checksum bits */ for (i = 0; i < 256; i++) { -- 1.8.2.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] usb: storage: alauda: initialize variables directly
Clean up the code a bit to initialize the variables directly when defining them. Signed-off-by: Emilio López --- Please note that this patch is untested. drivers/usb/storage/alauda.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c index 77a2ddf..6636a58 100644 --- a/drivers/usb/storage/alauda.c +++ b/drivers/usb/storage/alauda.c @@ -249,11 +249,7 @@ static void nand_init_ecc(void) { /* compute 3-byte ecc on 256 bytes */ static void nand_compute_ecc(unsigned char *data, unsigned char *ecc) { int i, j, a; - unsigned char par, bit, bits[8]; - - par = 0; - for (j = 0; j < 8; j++) - bits[j] = 0; + unsigned char par = 0, bit, bits[8] = {0}; /* collect 16 checksum bits */ for (i = 0; i < 256; i++) { -- 1.8.2.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: EHCI controller CS5536 hard disk disconnects
On 04/11/2012 19:34, Sergey Vlasov wrote: On Sat, Nov 03, 2012 at 09:14:08PM +0100, Miguel Dardenne wrote: On 2012-11-03 17:50, Alan Stern wrote: I get a USB disconnect of my external USB HDD about once per day. Enabling USB debug in the kernel shows the first error as 'ehci_hcd detected XactErr'. It happens only when the drive is idle. For example, I had a process writing on the HDD every 3 seconds and the problem did not occur for several weeks. Correction: These errors do not occur when the drive is idle. You can see in the log you attached: OK thanks for this. I then reformulate my statement: using the drive on a frequent basis (3s period) prevents the problem from occuring. Then the problem might be related to the power management in the drive itself, not in the host OS. 2.5" drives tend to have a short spindown timeout, and the first operation performed after such timeout causes the drive to spin up. The spinup process consumes a lot of power (more than during sustained operation), and current fluctuations during this process might cause problems if any components in the power supply chain are marginal (even a lousy cable with too thin conductors can be problematic). You might be able to change APM settings of the hard drive using utilities like hdparm; however, this might not work with your particular WD external drive for several reasons: - Not all USB-SATA bridges can pass low-level ATA commands needed to change APM settings. If you purchase an USB-SATA enclosure and HDD separately, you could work around this problem by attaching the drive to a SATA port directly to perform this configuration (APM settings are usually persistent), but doing this with an external USB drive sold as a single item will probably void the warranty. Even worse, some external drives made by WD have the USB port actually soldered to the drive PCB itself, and the SATA interface is not accessible directly. - WD drives often need undocumented vendor-specific commands to control spindown (google for "wdidle" used for 3.5" WD Green drives; not sure about their 2.5" drives). Even if the appropriate tools exist, they might not work with USB-attached drives. Did you try to use another drive with this system? Using a drive with a separate power supply might at least rule out the power-related problems. You can also try to attach the drive to a powered USB 2.0 hub instead of directly attaching to the onboard port. Hi all, Long story short : I bought a powered USB hub and have now had uptimes of more than two months without any HDD disconnect. So the issue was too high current drain from one of the disks when spinning up back of idle mode, which reset the USB port of the Alix board (not the whole board). Hoping this will help someone. Thanks for your support and best regards, Miguel -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 10/11] USB: ohci-spear: remove unnecessary platform_set_drvdata()
On 6 May 2013 15:44, Jingoo Han wrote: > The driver core clears the driver data to NULL after device_release > or on probe failure, since commit 0998d0631001288a5974afc0b2a5f568bcdecb4d > (device-core: Ensure drvdata = NULL when no driver is bound). > Thus, it is not needed to manually clear the device driver data to NULL. > > Signed-off-by: Jingoo Han > --- > drivers/usb/host/ohci-spear.c |2 -- > 1 files changed, 0 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c > index 9020bf0..6f9a1dc 100644 > --- a/drivers/usb/host/ohci-spear.c > +++ b/drivers/usb/host/ohci-spear.c > @@ -179,8 +179,6 @@ static int spear_ohci_hcd_drv_remove(struct > platform_device *pdev) > spear_stop_ohci(ohci_p); > > usb_put_hcd(hcd); > - > - platform_set_drvdata(pdev, NULL); > return 0; Acked-by: Viresh Kumar -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: musb throughput issues
Ming, The ehci controller is bogged down because the frames from the camera and other stuff are being relayed over ethernet. /Frederik On Friday 10 May 2013 23.24.32 Ming Lei wrote: > > Why do you think it's bogged down with ethernet? The ethernet throughput > can go beyond 90Mbps on Pandaboard, and the period transfer(used by UVC) > shouldn't be affected by async transfer of bulk(ethernet) since async > transfer has low priority than periodic transfer in USB2.0. > > > Thanks, -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/1] USB: quatech2: Staticize local symbol
'qt2_process_read_urb' is referenced only in this file. Make it static. Signed-off-by: Sachin Kamat --- drivers/usb/serial/quatech2.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c index 02b0803..b0a9478 100644 --- a/drivers/usb/serial/quatech2.c +++ b/drivers/usb/serial/quatech2.c @@ -523,7 +523,7 @@ static void qt2_process_flush(struct usb_serial_port *port, unsigned char *ch) return; } -void qt2_process_read_urb(struct urb *urb) +static void qt2_process_read_urb(struct urb *urb) { struct usb_serial *serial; struct qt2_serial_private *serial_priv; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCh V10 01/12] usb: phy: protect phy init and shutdown for mutiple deivces
Some USB devices will share same phy, so make the ->init and ->shutdown to be protected. Only first device will initialize the phy, and only last device can shutdown phy. Signed-off-by: Chao Xie --- drivers/usb/phy/phy.c |6 ++ include/linux/usb/phy.h | 22 ++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c index a9984c7..97dd396 100644 --- a/drivers/usb/phy/phy.c +++ b/drivers/usb/phy/phy.c @@ -329,6 +329,9 @@ int usb_add_phy(struct usb_phy *x, enum usb_phy_type type) return -EINVAL; } + mutex_init(&x->phy_mutex); + x->refcount = 0; + spin_lock_irqsave(&phy_lock, flags); list_for_each_entry(phy, &phy_list, head) { @@ -367,6 +370,9 @@ int usb_add_phy_dev(struct usb_phy *x) return -EINVAL; } + mutex_init(&x->phy_mutex); + x->refcount = 0; + spin_lock_irqsave(&phy_lock, flags); list_for_each_entry(phy_bind, &phy_bind_list, list) if (!(strcmp(phy_bind->phy_dev_name, dev_name(x->dev diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h index 6b5978f..b645520 100644 --- a/include/linux/usb/phy.h +++ b/include/linux/usb/phy.h @@ -87,6 +87,14 @@ struct usb_phy { /* to support controllers that have multiple transceivers */ struct list_headhead; + /* +* PHY may be shared by multiple devices. +* Being protected by phy_mutex and refcount, PHY is initialized +* or shut down only once. +*/ + struct mutexphy_mutex; + unsigned intrefcount; + /* initialize/shutdown the OTG controller */ int (*init)(struct usb_phy *x); void(*shutdown)(struct usb_phy *x); @@ -150,17 +158,23 @@ static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg) static inline int usb_phy_init(struct usb_phy *x) { - if (x->init) - return x->init(x); + int ret = 0; - return 0; + mutex_lock(&x->phy_mutex); + if (x->refcount++ == 0 && x->init) + ret = x->init(x); + mutex_unlock(&x->phy_mutex); + + return ret; } static inline void usb_phy_shutdown(struct usb_phy *x) { - if (x->shutdown) + mutex_lock(&x->phy_mutex); + if (--x->refcount == 0 && x->shutdown) x->shutdown(x); + mutex_unlock(&x->phy_mutex); } static inline int -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[V9 PATCH 00/12] mv-usb phy driver
The patches create the mv-usb phy driver The patches remove the callbacks in the platform data for phy initialization and shutdown, and directly write a phy driver and make udc/ehci/otg to call it. usb: phy: protect phy init and shutdown for mutiple deivces usb: phy: mv_usb2: add PHY driver for marvell usb2 controller Above patches are marvell usb PHY driver support. usb: gadget: mv_udc: use PHY driver for udc usb: ehci: ehci-mv: use PHY driver for ehci usb: phy: phy-mv-usb: use USB2 PHY driver for otg Above patches modify the udc/ehci/otg drivers to make use of PHY driver. usb: mv_u3d: usb phy drivers for phy operation Above patch is the fix for marvel usb3 gadget driver. It will make use of PHY driver. arm: mmp2: change the defintion of usb devices arm: pxa910: change the defintion of usb devices arm: ttc_dkb: modify usb support arm: mmp: remove unused usb devices arm: brownstone: add usb support for the board Above patches are the changes from SOCes. usb: mv_usb: remove the phy callbacks in pdata Above patch finally remove the callbacks for PHY in pdata. V2->V1: Change the Signed-off-by to be right email address v3->v2 re-format the patches to new code base v4->v3 1. make mv udc gadget driver depend on ARCH_PXA and ARCH_MMP 2. remove __devinit and __devexit 3. make the driver compiled successful if CONFIG_MV_USB2_PHY is not defined. The modified patches are usb: gadget: mv_udc: make mv_udc depends on ARCH_MMP or ARCH_PXA usb: phy: mv_usb2: add PHY driver for marvell usb2 controller v5->v4 make the struct mv_usb2_extern_chip member ->head to be struct atomic_notifier_head instead of struct atomic_notifier_head *. v6->v5 the bug fix patches are merged. Removed the dependcy of ARCH_MMP and ARCH_PXA, and make the driver can be compiled for x86. The device tree support patches need modification, remove them from this patch series, and they will be submitted in another series. v7->v6 Use usb_add_phy_dev and related APIs to add PHY drivers. Removed the device tree support in PHY driver. It will be added in another patch series. v8->v7 bugs fix in phy driver. directly use devm_usb_get_phy_dev return value for error return. v9->v8 Remove u2o_xxx. Add prefix for register definition Move mutex to common PHY layer Use module_platform_driver() to register driver Use usleep_range to replace udelay V10->V9 Grammar fix in comments. Chao Xie (12): usb: phy: protect phy init and shutdown for mutiple deivces usb: phy: mv_usb2: add PHY driver for marvell usb2 controller usb: gadget: mv_udc: use PHY driver for udc usb: ehci: ehci-mv: use PHY driver for ehci usb: phy: phy-mv-usb: use USB2 PHY driver for otg usb: mv_u3d: usb phy drivers for phy operation arm: mmp2: change the defintion of usb devices arm: pxa910: change the defintion of usb devices arm: ttc_dkb: modify usb support arm: mmp: remove unused usb devices arm: brownstone: add usb support for the board usb: mv_usb: remove the phy callbacks in pdata arch/arm/mach-mmp/brownstone.c | 56 + arch/arm/mach-mmp/include/mach/mmp2.h |4 + arch/arm/mach-mmp/include/mach/pxa910.h |7 +- arch/arm/mach-mmp/mmp2.c|4 + arch/arm/mach-mmp/pxa910.c |4 + arch/arm/mach-mmp/ttc_dkb.c | 39 +++- drivers/usb/gadget/mv_u3d.h |3 +- drivers/usb/gadget/mv_u3d_core.c| 54 ++--- drivers/usb/gadget/mv_udc.h |2 +- drivers/usb/gadget/mv_udc_core.c| 50 ++--- drivers/usb/host/ehci-mv.c | 49 ++--- drivers/usb/phy/Kconfig |6 + drivers/usb/phy/Makefile|1 + drivers/usb/phy/phy-mv-usb.c| 53 ++--- drivers/usb/phy/phy-mv-usb.h|2 +- drivers/usb/phy/phy-mv-usb2.c | 380 +++ drivers/usb/phy/phy.c |6 + include/linux/platform_data/mv_usb.h|3 - include/linux/usb/mv_usb2.h | 29 +++ include/linux/usb/phy.h | 22 ++- 20 files changed, 624 insertions(+), 150 deletions(-) create mode 100644 drivers/usb/phy/phy-mv-usb2.c create mode 100644 include/linux/usb/mv_usb2.h -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCh V10 03/12] usb: gadget: mv_udc: use PHY driver for udc
Originaly, udc driver will call the callbacks in platform data for PHY initialization and shut down. With PHY driver, it will call the APIs provided by PHY driver for PHY initialization and shut down. It removes the callbacks in platform data, and at same time it removes one block in the way of enabling device tree for udc driver. Signed-off-by: Chao Xie --- drivers/usb/gadget/mv_udc.h |2 +- drivers/usb/gadget/mv_udc_core.c | 50 +- 2 files changed, 18 insertions(+), 34 deletions(-) diff --git a/drivers/usb/gadget/mv_udc.h b/drivers/usb/gadget/mv_udc.h index be77f20..02f36fe 100644 --- a/drivers/usb/gadget/mv_udc.h +++ b/drivers/usb/gadget/mv_udc.h @@ -180,7 +180,6 @@ struct mv_udc { struct mv_cap_regs __iomem *cap_regs; struct mv_op_regs __iomem *op_regs; - void __iomem*phy_regs; unsigned intmax_eps; struct mv_dqh *ep_dqh; size_t ep_dqh_size; @@ -217,6 +216,7 @@ struct mv_udc { struct work_struct vbus_work; struct workqueue_struct *qwork; + struct usb_phy *phy; struct usb_phy *transceiver; struct mv_usb_platform_data *pdata; diff --git a/drivers/usb/gadget/mv_udc_core.c b/drivers/usb/gadget/mv_udc_core.c index c2a5702..a6beef6 100644 --- a/drivers/usb/gadget/mv_udc_core.c +++ b/drivers/usb/gadget/mv_udc_core.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include "mv_udc.h" @@ -1083,15 +1084,14 @@ static int mv_udc_enable_internal(struct mv_udc *udc) dev_dbg(&udc->dev->dev, "enable udc\n"); udc_clock_enable(udc); - if (udc->pdata->phy_init) { - retval = udc->pdata->phy_init(udc->phy_regs); - if (retval) { - dev_err(&udc->dev->dev, - "init phy error %d\n", retval); - udc_clock_disable(udc); - return retval; - } + retval = usb_phy_init(udc->phy); + if (retval) { + dev_err(&udc->dev->dev, + "init phy error %d\n", retval); + udc_clock_disable(udc); + return retval; } + udc->active = 1; return 0; @@ -1109,8 +1109,7 @@ static void mv_udc_disable_internal(struct mv_udc *udc) { if (udc->active) { dev_dbg(&udc->dev->dev, "disable udc\n"); - if (udc->pdata->phy_deinit) - udc->pdata->phy_deinit(udc->phy_regs); + usb_phy_shutdown(udc->phy); udc_clock_disable(udc); udc->active = 0; } @@ -2124,17 +2123,10 @@ static int mv_udc_probe(struct platform_device *pdev) udc->dev = pdev; if (pdata->mode == MV_USB_MODE_OTG) { - udc->transceiver = devm_usb_get_phy(&pdev->dev, - USB_PHY_TYPE_USB2); - if (IS_ERR(udc->transceiver)) { - retval = PTR_ERR(udc->transceiver); - - if (retval == -ENXIO) - return retval; - - udc->transceiver = NULL; - return -EPROBE_DEFER; - } + udc->transceiver = devm_usb_get_phy_dev(&pdev->dev, + MV_USB2_OTG_PHY_INDEX); + if (IS_ERR_OR_NULL(udc->transceiver)) + return PTR_ERR(udc->transceiver); } /* udc only have one sysclk. */ @@ -2142,7 +2134,7 @@ static int mv_udc_probe(struct platform_device *pdev) if (IS_ERR(udc->clk)) return PTR_ERR(udc->clk); - r = platform_get_resource_byname(udc->dev, IORESOURCE_MEM, "capregs"); + r = platform_get_resource(udc->dev, IORESOURCE_MEM, 0); if (r == NULL) { dev_err(&pdev->dev, "no I/O memory resource defined\n"); return -ENODEV; @@ -2155,17 +2147,9 @@ static int mv_udc_probe(struct platform_device *pdev) return -EBUSY; } - r = platform_get_resource_byname(udc->dev, IORESOURCE_MEM, "phyregs"); - if (r == NULL) { - dev_err(&pdev->dev, "no phy I/O memory resource defined\n"); - return -ENODEV; - } - - udc->phy_regs = ioremap(r->start, resource_size(r)); - if (udc->phy_regs == NULL) { - dev_err(&pdev->dev, "failed to map phy I/O memory\n"); - return -EBUSY; - } + udc->phy = devm_usb_get_phy_dev(&pdev->dev, MV_USB2_PHY_INDEX); + if (IS_ERR_OR_NULL(udc->phy)) + return PTR_ERR(udc->phy); /* we will acces controller register, so enable the clk */ retval = mv_udc_enable_internal(udc); -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb
[PATCh V10 04/12] usb: ehci: ehci-mv: use PHY driver for ehci
Originaly, ehci driver will call the callbacks in platform data for PHY initialization and shut down. With PHY driver, it will call the APIs provided by PHY driver for PHY initialization and shutdown. It removes the callbacks in platform data, and at same time it removes one block in the way of enabling device tree for ehci driver. Signed-off-by: Chao Xie --- drivers/usb/host/ehci-mv.c | 49 +++ 1 files changed, 17 insertions(+), 32 deletions(-) diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c index 6bad41a..adfc11f 100644 --- a/drivers/usb/host/ehci-mv.c +++ b/drivers/usb/host/ehci-mv.c @@ -15,17 +15,18 @@ #include #include #include +#include #include #define CAPLENGTH_MASK (0xff) struct ehci_hcd_mv { struct usb_hcd *hcd; + struct usb_phy *phy; /* Which mode does this ehci running OTG/Host ? */ int mode; - void __iomem *phy_regs; void __iomem *cap_regs; void __iomem *op_regs; @@ -48,22 +49,15 @@ static void ehci_clock_disable(struct ehci_hcd_mv *ehci_mv) static int mv_ehci_enable(struct ehci_hcd_mv *ehci_mv) { - int retval; - ehci_clock_enable(ehci_mv); - if (ehci_mv->pdata->phy_init) { - retval = ehci_mv->pdata->phy_init(ehci_mv->phy_regs); - if (retval) - return retval; - } - return 0; + return usb_phy_init(ehci_mv->phy); } static void mv_ehci_disable(struct ehci_hcd_mv *ehci_mv) { - if (ehci_mv->pdata->phy_deinit) - ehci_mv->pdata->phy_deinit(ehci_mv->phy_regs); + usb_phy_shutdown(ehci_mv->phy); + ehci_clock_disable(ehci_mv); } @@ -169,22 +163,7 @@ static int mv_ehci_probe(struct platform_device *pdev) goto err_clear_drvdata; } - r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phyregs"); - if (r == NULL) { - dev_err(&pdev->dev, "no phy I/O memory resource defined\n"); - retval = -ENODEV; - goto err_clear_drvdata; - } - - ehci_mv->phy_regs = devm_ioremap(&pdev->dev, r->start, -resource_size(r)); - if (ehci_mv->phy_regs == 0) { - dev_err(&pdev->dev, "failed to map phy I/O memory\n"); - retval = -EFAULT; - goto err_clear_drvdata; - } - - r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "capregs"); + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!r) { dev_err(&pdev->dev, "no I/O memory resource defined\n"); retval = -ENODEV; @@ -199,6 +178,14 @@ static int mv_ehci_probe(struct platform_device *pdev) goto err_clear_drvdata; } + ehci_mv->phy = devm_usb_get_phy_dev(&pdev->dev, MV_USB2_PHY_INDEX); + if (IS_ERR_OR_NULL(ehci_mv->phy)) { + retval = PTR_ERR(ehci_mv->phy); + if (retval != -EPROBE_DEFER) + dev_err(&pdev->dev, "failed to get the outer phy\n"); + goto err_clear_drvdata; + } + retval = mv_ehci_enable(ehci_mv); if (retval) { dev_err(&pdev->dev, "init phy error %d\n", retval); @@ -225,14 +212,15 @@ static int mv_ehci_probe(struct platform_device *pdev) ehci_mv->mode = pdata->mode; if (ehci_mv->mode == MV_USB_MODE_OTG) { - ehci_mv->otg = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2); + ehci_mv->otg = devm_usb_get_phy_dev(&pdev->dev, + MV_USB2_OTG_PHY_INDEX); if (IS_ERR(ehci_mv->otg)) { retval = PTR_ERR(ehci_mv->otg); if (retval == -ENXIO) dev_info(&pdev->dev, "MV_USB_MODE_OTG " "must have CONFIG_USB_PHY enabled\n"); - else + else if (retval != -EPROBE_DEFER) dev_err(&pdev->dev, "unable to find transceiver\n"); goto err_disable_clk; @@ -259,9 +247,6 @@ static int mv_ehci_probe(struct platform_device *pdev) } } - if (pdata->private_init) - pdata->private_init(ehci_mv->op_regs, ehci_mv->phy_regs); - dev_info(&pdev->dev, "successful find EHCI device with regs 0x%p irq %d" " working in %s mode\n", hcd->regs, hcd->irq, -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCh V10 08/12] arm: pxa910: change the defintion of usb devices
because phy is seperated from the usb controller driver, we can use the common pxa_device_desc for device register. Signed-off-by: Chao Xie --- arch/arm/mach-mmp/include/mach/pxa910.h |4 arch/arm/mach-mmp/pxa910.c |4 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h b/arch/arm/mach-mmp/include/mach/pxa910.h index b914afa..c695982 100644 --- a/arch/arm/mach-mmp/include/mach/pxa910.h +++ b/arch/arm/mach-mmp/include/mach/pxa910.h @@ -22,6 +22,10 @@ extern struct pxa_device_desc pxa910_device_nand; extern struct platform_device pxa168_device_u2o; extern struct platform_device pxa168_device_u2ootg; extern struct platform_device pxa168_device_u2oehci; +extern struct pxa_device_desc pxa910_device_u2o; +extern struct pxa_device_desc pxa910_device_u2ootg; +extern struct pxa_device_desc pxa910_device_u2oehci; +extern struct pxa_device_desc pxa910_device_u2ophy; extern struct pxa_device_desc pxa910_device_disp; extern struct pxa_device_desc pxa910_device_fb; extern struct pxa_device_desc pxa910_device_panel; diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c index 36cb321..28fdce5 100644 --- a/arch/arm/mach-mmp/pxa910.c +++ b/arch/arm/mach-mmp/pxa910.c @@ -134,6 +134,10 @@ PXA910_DEVICE(pwm2, "pxa910-pwm", 1, NONE, 0xd401a400, 0x10); PXA910_DEVICE(pwm3, "pxa910-pwm", 2, NONE, 0xd401a800, 0x10); PXA910_DEVICE(pwm4, "pxa910-pwm", 3, NONE, 0xd401ac00, 0x10); PXA910_DEVICE(nand, "pxa3xx-nand", -1, NAND, 0xd4283000, 0x80, 97, 99); +PXA910_DEVICE(u2ophy, "pxa910-usb-phy", -1, NONE, 0xd4207000, 0x1ff); +PXA910_DEVICE(u2o, "mv-udc", -1, USB1, 0xd4208100, 0x1ff); +PXA910_DEVICE(u2ootg, "mv-otg", -1, USB1, 0xd4208100, 0x1ff); +PXA910_DEVICE(u2oehci, "mv-ehci", -1, USB1, 0xd4208100, 0x1ff); PXA910_DEVICE(disp, "mmp-disp", 0, LCD, 0xd420b000, 0x1ec); PXA910_DEVICE(fb, "mmp-fb", -1, NONE, 0, 0); PXA910_DEVICE(panel, "tpo-hvga", -1, NONE, 0, 0); -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCh V10 11/12] arm: brownstone: add usb support for the board
for brownstone board, add the udc/otg/ehci support Signed-off-by: Chao Xie --- arch/arm/mach-mmp/brownstone.c | 56 1 files changed, 56 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-mmp/brownstone.c b/arch/arm/mach-mmp/brownstone.c index 2358011..aed553a 100644 --- a/arch/arm/mach-mmp/brownstone.c +++ b/arch/arm/mach-mmp/brownstone.c @@ -18,6 +18,9 @@ #include #include #include +#include +#include +#include #include #include @@ -195,6 +198,20 @@ static struct sram_platdata mmp2_isram_platdata = { .granularity= SRAM_GRANULARITY, }; +#ifdef CONFIG_USB_SUPPORT + +#if defined(CONFIG_USB_MV_UDC) || defined(CONFIG_USB_EHCI_MV_U2O) + +static struct mv_usb_platform_data brownstone_usb_pdata = { + .vbus = NULL, + .mode = MV_USB_MODE_OTG, + .otg_force_a_bus_req = 1, + .set_vbus = NULL, +}; +#endif +#endif + + static void __init brownstone_init(void) { mfp_config(ARRAY_AND_SIZE(brownstone_pin_config)); @@ -211,6 +228,45 @@ static void __init brownstone_init(void) /* enable 5v regulator */ platform_device_register(&brownstone_v_5vp_device); + +#ifdef CONFIG_USB_SUPPORT + pxa_register_device(&mmp2_device_u2ophy, NULL, 0); +#endif + +#ifdef CONFIG_USB_MV_UDC + /* for usb2 phy */ + usb_bind_phy(mmp2_device_u2o.drv_name, MV_USB2_PHY_INDEX, +mmp2_device_u2ophy.drv_name); +#ifdef CONFIG_USB_MV_OTG + /* for usb2 otg phy */ + usb_bind_phy(mmp2_device_u2o.drv_name, MV_USB2_OTG_PHY_INDEX, +mmp2_device_u2ootg.drv_name); +#endif + pxa_register_device(&mmp2_device_u2o, &brownstone_usb_pdata, + sizeof(brownstone_usb_pdata)); +#endif + +#ifdef CONFIG_USB_EHCI_MV_U2O + /* for usb2 phy */ + usb_bind_phy(mmp2_device_u2oehci.dev_name, MV_USB2_PHY_INDEX, +mmp2_device_u2ophy.dev_name); +#ifdef CONFIG_USB_MV_OTG + /* for usb2 otg phy */ + usb_bind_phy(mmp2_device_u2oehci.drv_name, MV_USB2_OTG_PHY_INDEX, +mmp2_device_u2ootg.drv_name); +#endif + pxa_register_device(&mmp2_device_u2oehci, &brownstone_usb_pdata, + sizeof(brownstone_usb_pdata)); +#endif + +#ifdef CONFIG_USB_MV_OTG + /* for usb2 phy */ + usb_bind_phy(mmp2_device_u2ootg.dev_name, MV_USB2_PHY_INDEX, +mmp2_device_u2ophy.dev_name); + pxa_register_device(&mmp2_device_u2ootg, &brownstone_usb_pdata, + sizeof(brownstone_usb_pdata)); +#endif + } MACHINE_START(BROWNSTONE, "Brownstone Development Platform") -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCh V10 02/12] usb: phy: mv_usb2: add PHY driver for marvell usb2 controller
The PHY is seperated from usb controller. The usb controller used in marvell pxa168/pxa910/mmp2 are same, but PHY initialization may be different. the usb controller can support udc/otg/ehci, and for each of the mode, it need PHY to initialized before use the controller. Direclty writing the phy driver will make the usb controller driver to be simple and portable. The PHY driver will be used by marvell udc/otg/ehci. Signed-off-by: Chao Xie --- drivers/usb/phy/Kconfig |9 + drivers/usb/phy/Makefile |1 + drivers/usb/phy/phy-mv-usb2.c | 379 + include/linux/usb/mv_usb2.h | 29 +++ 4 files changed, 418 insertions(+), 0 deletions(-) create mode 100644 drivers/usb/phy/phy-mv-usb2.c create mode 100644 include/linux/usb/mv_usb2.h diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 372db48..9c03da1 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig @@ -170,6 +170,15 @@ config USB_MV_OTG To compile this driver as a module, choose M here. +config MV_USB2_PHY + tristate "Marvell USB 2.0 PHY Driver" + help + Enable this to support Marvell USB 2.0 PHY driver for Marvell + SoC. This driver will do the PHY initialization and shutdown. + The PHY driver will be used by Marvell udc/ehci/otg driver. + + To compile this driver as a module, choose M here. + config USB_MXS_PHY tristate "Freescale MXS USB PHY support" depends on ARCH_MXC || ARCH_MXS diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile index 33863c0..90cc5f5 100644 --- a/drivers/usb/phy/Makefile +++ b/drivers/usb/phy/Makefile @@ -26,6 +26,7 @@ obj-$(CONFIG_USB_EHCI_TEGRA) += phy-tegra-usb.o obj-$(CONFIG_USB_GPIO_VBUS)+= phy-gpio-vbus-usb.o obj-$(CONFIG_USB_ISP1301) += phy-isp1301.o obj-$(CONFIG_USB_MSM_OTG) += phy-msm-usb.o +obj-$(CONFIG_MV_USB2_PHY) += phy-mv-usb2.o obj-$(CONFIG_USB_MV_OTG) += phy-mv-usb.o obj-$(CONFIG_USB_MXS_PHY) += phy-mxs-usb.o obj-$(CONFIG_USB_RCAR_PHY) += phy-rcar-usb.o diff --git a/drivers/usb/phy/phy-mv-usb2.c b/drivers/usb/phy/phy-mv-usb2.c new file mode 100644 index 000..43459ef --- /dev/null +++ b/drivers/usb/phy/phy-mv-usb2.c @@ -0,0 +1,379 @@ +/* + * Copyright (C) 2013 Marvell Inc. + * + * Author: + * Chao Xie + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* phy regs */ +/* for pxa910 and mmp2, there is no revision register */ +#define MV_USB2_UTMI_REVISION 0x0 +#define MV_USB2_UTMI_CTRL 0x4 +#define MV_USB2_UTMI_PLL 0x8 +#define MV_USB2_UTMI_TX0xc +#define MV_USB2_UTMI_RX0x10 +#define MV_USB2_UTMI_IVREF 0x14 +#define MV_USB2_UTMI_T00x18 +#define MV_USB2_UTMI_T10x1c +#define MV_USB2_UTMI_T20x20 +#define MV_USB2_UTMI_T30x24 +#define MV_USB2_UTMI_T40x28 +#define MV_USB2_UTMI_T50x2c +#define MV_USB2_UTMI_RESERVE 0x30 +#define MV_USB2_UTMI_USB_INT 0x34 +#define MV_USB2_UTMI_DBG_CTL 0x38 +#define MV_USB2_UTMI_OTG_ADDON 0x3c + +/* For UTMICTRL Register */ +#define MV_USB2_UTMI_CTRL_USB_CLK_EN (1 << 31) +/* pxa168 */ +#define MV_USB2_UTMI_CTRL_SUSPEND_SET1 (1 << 30) +#define MV_USB2_UTMI_CTRL_SUSPEND_SET2 (1 << 29) +#define MV_USB2_UTMI_CTRL_RXBUF_PDWN (1 << 24) +#define MV_USB2_UTMI_CTRL_TXBUF_PDWN (1 << 11) + +#define MV_USB2_UTMI_CTRL_INPKT_DELAY_SHIFT30 +#define MV_USB2_UTMI_CTRL_INPKT_DELAY_SOF_SHIFT28 +#define MV_USB2_UTMI_CTRL_PU_REF_SHIFT 20 +#define MV_USB2_UTMI_CTRL_ARC_PULLDN_SHIFT 12 +#define MV_USB2_UTMI_CTRL_PLL_PWR_UP_SHIFT 1 +#define MV_USB2_UTMI_CTRL_PWR_UP_SHIFT 0 + +/* For UTMI_PLL Register */ +#define MV_USB2_UTMI_PLL_PLLCALI12_SHIFT 29 +#define MV_USB2_UTMI_PLL_PLLCALI12_MASK(0x3 << 29) + +#define MV_USB2_UTMI_PLL_PLLVDD18_SHIFT27 +#define MV_USB2_UTMI_PLL_PLLVDD18_MASK (0x3 << 27) + +#define MV_USB2_UTMI_PLL_PLLVDD12_SHIFT
[V9 PATCH 00/12] mv-usb phy driver
The patches create the mv-usb phy driver The patches remove the callbacks in the platform data for phy initialization and shutdown, and directly write a phy driver and make udc/ehci/otg to call it. usb: phy: protect phy init and shutdown for mutiple deivces usb: phy: mv_usb2: add PHY driver for marvell usb2 controller Above patches are marvell usb PHY driver support. usb: gadget: mv_udc: use PHY driver for udc usb: ehci: ehci-mv: use PHY driver for ehci usb: phy: phy-mv-usb: use USB2 PHY driver for otg Above patches modify the udc/ehci/otg drivers to make use of PHY driver. usb: mv_u3d: usb phy drivers for phy operation Above patch is the fix for marvel usb3 gadget driver. It will make use of PHY driver. arm: mmp2: change the defintion of usb devices arm: pxa910: change the defintion of usb devices arm: ttc_dkb: modify usb support arm: mmp: remove unused usb devices arm: brownstone: add usb support for the board Above patches are the changes from SOCes. usb: mv_usb: remove the phy callbacks in pdata Above patch finally remove the callbacks for PHY in pdata. V2->V1: Change the Signed-off-by to be right email address v3->v2 re-format the patches to new code base v4->v3 1. make mv udc gadget driver depend on ARCH_PXA and ARCH_MMP 2. remove __devinit and __devexit 3. make the driver compiled successful if CONFIG_MV_USB2_PHY is not defined. The modified patches are usb: gadget: mv_udc: make mv_udc depends on ARCH_MMP or ARCH_PXA usb: phy: mv_usb2: add PHY driver for marvell usb2 controller v5->v4 make the struct mv_usb2_extern_chip member ->head to be struct atomic_notifier_head instead of struct atomic_notifier_head *. v6->v5 the bug fix patches are merged. Removed the dependcy of ARCH_MMP and ARCH_PXA, and make the driver can be compiled for x86. The device tree support patches need modification, remove them from this patch series, and they will be submitted in another series. v7->v6 Use usb_add_phy_dev and related APIs to add PHY drivers. Removed the device tree support in PHY driver. It will be added in another patch series. v8->v7 bugs fix in phy driver. directly use devm_usb_get_phy_dev return value for error return. v9->v8 Remove u2o_xxx. Add prefix for register definition Move mutex to common PHY layer Use module_platform_driver() to register driver Use usleep_range to replace udelay V10->V9 Grammar fix in comments. Chao Xie (12): usb: phy: protect phy init and shutdown for mutiple deivces usb: phy: mv_usb2: add PHY driver for marvell usb2 controller usb: gadget: mv_udc: use PHY driver for udc usb: ehci: ehci-mv: use PHY driver for ehci usb: phy: phy-mv-usb: use USB2 PHY driver for otg usb: mv_u3d: usb phy drivers for phy operation arm: mmp2: change the defintion of usb devices arm: pxa910: change the defintion of usb devices arm: ttc_dkb: modify usb support arm: mmp: remove unused usb devices arm: brownstone: add usb support for the board usb: mv_usb: remove the phy callbacks in pdata arch/arm/mach-mmp/brownstone.c | 56 + arch/arm/mach-mmp/include/mach/mmp2.h |4 + arch/arm/mach-mmp/include/mach/pxa910.h |7 +- arch/arm/mach-mmp/mmp2.c|4 + arch/arm/mach-mmp/pxa910.c |4 + arch/arm/mach-mmp/ttc_dkb.c | 39 +++- drivers/usb/gadget/mv_u3d.h |3 +- drivers/usb/gadget/mv_u3d_core.c| 54 ++--- drivers/usb/gadget/mv_udc.h |2 +- drivers/usb/gadget/mv_udc_core.c| 50 ++--- drivers/usb/host/ehci-mv.c | 49 ++--- drivers/usb/phy/Kconfig |6 + drivers/usb/phy/Makefile|1 + drivers/usb/phy/phy-mv-usb.c| 53 ++--- drivers/usb/phy/phy-mv-usb.h|2 +- drivers/usb/phy/phy-mv-usb2.c | 380 +++ drivers/usb/phy/phy.c |6 + include/linux/platform_data/mv_usb.h|3 - include/linux/usb/mv_usb2.h | 29 +++ include/linux/usb/phy.h | 22 ++- 20 files changed, 624 insertions(+), 150 deletions(-) create mode 100644 drivers/usb/phy/phy-mv-usb2.c create mode 100644 include/linux/usb/mv_usb2.h -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCh V10 05/12] usb: phy: phy-mv-usb: use USB2 PHY driver for otg
Originaly, otg driver will call the callbacks in platform data for PHY initialization and shut down. With PHY driver, it will call the APIs provided by PHY driver for PHY initialization and shutdown. It removes the callbacks in platform data, and at same time it removes one block in the way of enabling device tree for otg driver. Signed-off-by: Chao Xie --- drivers/usb/phy/phy-mv-usb.c | 53 ++--- drivers/usb/phy/phy-mv-usb.h |2 +- 2 files changed, 24 insertions(+), 31 deletions(-) diff --git a/drivers/usb/phy/phy-mv-usb.c b/drivers/usb/phy/phy-mv-usb.c index c987bbe..9938904 100644 --- a/drivers/usb/phy/phy-mv-usb.c +++ b/drivers/usb/phy/phy-mv-usb.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "phy-mv-usb.h" @@ -255,15 +256,14 @@ static int mv_otg_enable_internal(struct mv_otg *mvotg) dev_dbg(&mvotg->pdev->dev, "otg enabled\n"); otg_clock_enable(mvotg); - if (mvotg->pdata->phy_init) { - retval = mvotg->pdata->phy_init(mvotg->phy_regs); - if (retval) { - dev_err(&mvotg->pdev->dev, - "init phy error %d\n", retval); - otg_clock_disable(mvotg); - return retval; - } + retval = usb_phy_init(mvotg->outer_phy); + if (retval) { + dev_err(&mvotg->pdev->dev, + "failed to initialize phy %d\n", retval); + otg_clock_disable(mvotg); + return retval; } + mvotg->active = 1; return 0; @@ -282,8 +282,7 @@ static void mv_otg_disable_internal(struct mv_otg *mvotg) { if (mvotg->active) { dev_dbg(&mvotg->pdev->dev, "otg disabled\n"); - if (mvotg->pdata->phy_deinit) - mvotg->pdata->phy_deinit(mvotg->phy_regs); + usb_phy_shutdown(mvotg->outer_phy); otg_clock_disable(mvotg); mvotg->active = 0; } @@ -715,6 +714,7 @@ static int mv_otg_probe(struct platform_device *pdev) /* OTG common part */ mvotg->pdev = pdev; mvotg->phy.dev = &pdev->dev; + mvotg->phy.type = USB_PHY_TYPE_USB2; mvotg->phy.otg = otg; mvotg->phy.label = driver_name; mvotg->phy.state = OTG_STATE_UNDEFINED; @@ -727,23 +727,8 @@ static int mv_otg_probe(struct platform_device *pdev) for (i = 0; i < OTG_TIMER_NUM; i++) init_timer(&mvotg->otg_ctrl.timer[i]); - r = platform_get_resource_byname(mvotg->pdev, -IORESOURCE_MEM, "phyregs"); - if (r == NULL) { - dev_err(&pdev->dev, "no phy I/O memory resource defined\n"); - retval = -ENODEV; - goto err_destroy_workqueue; - } - - mvotg->phy_regs = devm_ioremap(&pdev->dev, r->start, resource_size(r)); - if (mvotg->phy_regs == NULL) { - dev_err(&pdev->dev, "failed to map phy I/O memory\n"); - retval = -EFAULT; - goto err_destroy_workqueue; - } - - r = platform_get_resource_byname(mvotg->pdev, -IORESOURCE_MEM, "capregs"); + r = platform_get_resource(mvotg->pdev, +IORESOURCE_MEM, 0); if (r == NULL) { dev_err(&pdev->dev, "no I/O memory resource defined\n"); retval = -ENODEV; @@ -757,6 +742,14 @@ static int mv_otg_probe(struct platform_device *pdev) goto err_destroy_workqueue; } + mvotg->outer_phy = devm_usb_get_phy_dev(&pdev->dev, MV_USB2_PHY_INDEX); + if (IS_ERR_OR_NULL(mvotg->outer_phy)) { + retval = PTR_ERR(mvotg->outer_phy); + if (retval != -EPROBE_DEFER) + dev_err(&pdev->dev, "can not find outer phy\n"); + goto err_destroy_workqueue; + } + /* we will acces controller register, so enable the udc controller */ retval = mv_otg_enable_internal(mvotg); if (retval) { @@ -816,7 +809,7 @@ static int mv_otg_probe(struct platform_device *pdev) goto err_disable_clk; } - retval = usb_add_phy(&mvotg->phy, USB_PHY_TYPE_USB2); + retval = usb_add_phy_dev(&mvotg->phy); if (retval < 0) { dev_err(&pdev->dev, "can't register transceiver, %d\n", retval); @@ -827,7 +820,7 @@ static int mv_otg_probe(struct platform_device *pdev) if (retval < 0) { dev_dbg(&pdev->dev, "Can't register sysfs attr group: %d\n", retval); - goto err_remove_phy; + goto err_remove_otg_phy; } spin_lock_init(&mvotg->wq_lock); @@ -842,7 +835,7 @@ static int mv_otg_probe(struct platform_device *pdev) return 0; -err_remove_phy: +err_remove_otg_p
[PATCh V10 06/12] usb: mv_u3d: usb phy drivers for phy operation
The phy_init and phy_deinit APIs are removed from the pdata. Directly get the phy driver and invoke the callbacks of phy drivers for phy initialization and shutdown. Signed-off-by: Chao Xie --- drivers/usb/gadget/mv_u3d.h |3 +- drivers/usb/gadget/mv_u3d_core.c | 54 ++--- 2 files changed, 23 insertions(+), 34 deletions(-) diff --git a/drivers/usb/gadget/mv_u3d.h b/drivers/usb/gadget/mv_u3d.h index e32a787..0a0c7e3 100644 --- a/drivers/usb/gadget/mv_u3d.h +++ b/drivers/usb/gadget/mv_u3d.h @@ -251,7 +251,6 @@ struct mv_u3d { struct mv_u3d_cap_regs __iomem *cap_regs; struct mv_u3d_op_regs __iomem *op_regs; struct mv_u3d_vuc_regs __iomem *vuc_regs; - void __iomem*phy_regs; unsigned intmax_eps; struct mv_u3d_ep_context*ep_context; @@ -283,6 +282,8 @@ struct mv_u3d { struct mv_usb_addon_irq *vbus; unsigned intpower; + struct usb_phy *phy; + struct clk *clk; }; diff --git a/drivers/usb/gadget/mv_u3d_core.c b/drivers/usb/gadget/mv_u3d_core.c index 58288e9..bb92c5b 100644 --- a/drivers/usb/gadget/mv_u3d_core.c +++ b/drivers/usb/gadget/mv_u3d_core.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -1109,7 +1110,6 @@ static int mv_u3d_controller_reset(struct mv_u3d *u3d) static int mv_u3d_enable(struct mv_u3d *u3d) { - struct mv_usb_platform_data *pdata = u3d->dev->platform_data; int retval; if (u3d->active) @@ -1122,14 +1122,12 @@ static int mv_u3d_enable(struct mv_u3d *u3d) dev_dbg(u3d->dev, "enable u3d\n"); clk_enable(u3d->clk); - if (pdata->phy_init) { - retval = pdata->phy_init(u3d->phy_regs); - if (retval) { - dev_err(u3d->dev, - "init phy error %d\n", retval); - clk_disable(u3d->clk); - return retval; - } + retval = usb_phy_init(u3d->phy); + if (retval) { + dev_err(u3d->dev, + "init phy error %d\n", retval); + clk_disable(u3d->clk); + return retval; } u3d->active = 1; @@ -1138,11 +1136,9 @@ static int mv_u3d_enable(struct mv_u3d *u3d) static void mv_u3d_disable(struct mv_u3d *u3d) { - struct mv_usb_platform_data *pdata = u3d->dev->platform_data; if (u3d->clock_gating && u3d->active) { dev_dbg(u3d->dev, "disable u3d\n"); - if (pdata->phy_deinit) - pdata->phy_deinit(u3d->phy_regs); + usb_phy_shutdown(u3d->phy); clk_disable(u3d->clk); u3d->active = 0; } @@ -1246,7 +1242,6 @@ static int mv_u3d_start(struct usb_gadget *g, struct usb_gadget_driver *driver) { struct mv_u3d *u3d = container_of(g, struct mv_u3d, gadget); - struct mv_usb_platform_data *pdata = u3d->dev->platform_data; unsigned long flags; if (u3d->driver) @@ -1256,8 +1251,7 @@ static int mv_u3d_start(struct usb_gadget *g, if (!u3d->clock_gating) { clk_enable(u3d->clk); - if (pdata->phy_init) - pdata->phy_init(u3d->phy_regs); + usb_phy_init(u3d->phy); } /* hook up the driver ... */ @@ -1277,7 +1271,6 @@ static int mv_u3d_stop(struct usb_gadget *g, struct usb_gadget_driver *driver) { struct mv_u3d *u3d = container_of(g, struct mv_u3d, gadget); - struct mv_usb_platform_data *pdata = u3d->dev->platform_data; unsigned long flags; u3d->vbus_valid_detect = 0; @@ -1285,8 +1278,7 @@ static int mv_u3d_stop(struct usb_gadget *g, /* enable clock to access controller register */ clk_enable(u3d->clk); - if (pdata->phy_init) - pdata->phy_init(u3d->phy_regs); + usb_phy_init(u3d->phy); mv_u3d_controller_stop(u3d); /* stop all usb activities */ @@ -1294,8 +1286,7 @@ static int mv_u3d_stop(struct usb_gadget *g, mv_u3d_stop_activity(u3d, driver); mv_u3d_disable(u3d); - if (pdata->phy_deinit) - pdata->phy_deinit(u3d->phy_regs); + usb_phy_shutdown(u3d->phy); clk_disable(u3d->clk); spin_unlock_irqrestore(&u3d->lock, flags); @@ -1827,7 +1818,7 @@ static int mv_u3d_probe(struct platform_device *dev) goto err_get_clk; } - r = platform_get_resource_byname(dev, IORESOURCE_MEM, "capregs"); + r = platform_get_resource_byname(dev, IORESOURCE_MEM, 0); if (!r) { dev_err(&dev->dev, "no I/O memory resource defined\n"); retval = -ENODEV; @@ -1846,15 +1837,14 @@ static int mv_u3d_probe(struct platform_device *dev) (uns
[PATCh V10 07/12] arm: mmp2: change the defintion of usb devices
add the udc/otg/ehci devices for mmp2 Signed-off-by: Chao Xie --- arch/arm/mach-mmp/include/mach/mmp2.h |4 arch/arm/mach-mmp/mmp2.c |4 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-mmp/include/mach/mmp2.h b/arch/arm/mach-mmp/include/mach/mmp2.h index 0764f4e..95b6bd7 100644 --- a/arch/arm/mach-mmp/include/mach/mmp2.h +++ b/arch/arm/mach-mmp/include/mach/mmp2.h @@ -29,6 +29,10 @@ extern struct pxa_device_desc mmp2_device_sdh2; extern struct pxa_device_desc mmp2_device_sdh3; extern struct pxa_device_desc mmp2_device_asram; extern struct pxa_device_desc mmp2_device_isram; +extern struct pxa_device_desc mmp2_device_u2o; +extern struct pxa_device_desc mmp2_device_u2ootg; +extern struct pxa_device_desc mmp2_device_u2oehci; +extern struct pxa_device_desc mmp2_device_u2ophy; extern struct platform_device mmp2_device_gpio; diff --git a/arch/arm/mach-mmp/mmp2.c b/arch/arm/mach-mmp/mmp2.c index d94d114..e7b7642 100644 --- a/arch/arm/mach-mmp/mmp2.c +++ b/arch/arm/mach-mmp/mmp2.c @@ -149,6 +149,10 @@ MMP2_DEVICE(sdh3, "sdhci-pxav3", 3, MMC4, 0xd4281800, 0x120); MMP2_DEVICE(asram, "asram", -1, NONE, 0xe000, 0x4000); /* 0xd100 ~ 0xd101 is reserved for secure processor */ MMP2_DEVICE(isram, "isram", -1, NONE, 0xd102, 0x18000); +MMP2_DEVICE(u2ophy, "mmp2-usb-phy", -1, NONE, 0xd4207000, 0x1ff); +MMP2_DEVICE(u2o, "mv-udc", -1, USB_OTG, 0xd4208100, 0x1ff); +MMP2_DEVICE(u2ootg, "mv-otg", -1, USB_OTG, 0xd4208100, 0x1ff); +MMP2_DEVICE(u2oehci, "mv-ehci", -1, USB_OTG, 0xd4208100, 0x1ff); struct resource mmp2_resource_gpio[] = { { -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCh V10 09/12] arm: ttc_dkb: modify usb support
for ttc_dkb board, we use phy driver for usb support. Modify the usb support for udc/otg/ehci support. Signed-off-by: Chao Xie --- arch/arm/mach-mmp/ttc_dkb.c | 39 ++- 1 files changed, 30 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c index 6528a5f..c8b9ed8 100644 --- a/arch/arm/mach-mmp/ttc_dkb.c +++ b/arch/arm/mach-mmp/ttc_dkb.c @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include #include #include @@ -29,7 +31,6 @@ #include #include #include -#include #include "common.h" @@ -166,8 +167,6 @@ static struct mv_usb_platform_data ttc_usb_pdata = { .vbus = NULL, .mode = MV_USB_MODE_OTG, .otg_force_a_bus_req = 1, - .phy_init = pxa_usb_phy_init, - .phy_deinit = pxa_usb_phy_deinit, .set_vbus = NULL, }; #endif @@ -280,19 +279,41 @@ static void __init ttc_dkb_init(void) pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info)); platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices)); +#ifdef CONFIG_USB_SUPPORT + pxa_register_device(&pxa910_device_u2ophy, NULL, 0); +#endif + #ifdef CONFIG_USB_MV_UDC - pxa168_device_u2o.dev.platform_data = &ttc_usb_pdata; - platform_device_register(&pxa168_device_u2o); + /* for usb2 phy */ + usb_bind_phy(pxa910_device_u2o.drv_name, MV_USB2_PHY_INDEX, +pxa910_device_u2ophy.drv_name); +#ifdef CONFIG_USB_MV_OTG + /* for usb2 otg phy */ + usb_bind_phy(pxa910_device_u2o.drv_name, MV_USB2_OTG_PHY_INDEX, +pxa910_device_u2ootg.drv_name); +#endif + pxa_register_device(&pxa910_device_u2o, &ttc_usb_pdata, + sizeof(ttc_usb_pdata)); #endif #ifdef CONFIG_USB_EHCI_MV_U2O - pxa168_device_u2oehci.dev.platform_data = &ttc_usb_pdata; - platform_device_register(&pxa168_device_u2oehci); + /* for usb2 phy */ + usb_bind_phy(pxa910_device_u2oehci.drv_name, MV_USB2_PHY_INDEX, +pxa910_device_u2ophy.drv_name); +#ifdef CONFIG_USB_MV_OTG + /* for usb2 otg phy */ + usb_bind_phy(pxa910_device_u2oehci.drv_name, MV_USB2_OTG_PHY_INDEX, +pxa910_device_u2ootg.drv_name); +#endif + pxa_register_device(&pxa910_device_u2oehci, &ttc_usb_pdata, + sizeof(ttc_usb_pdata)); #endif #ifdef CONFIG_USB_MV_OTG - pxa168_device_u2ootg.dev.platform_data = &ttc_usb_pdata; - platform_device_register(&pxa168_device_u2ootg); + usb_bind_phy(pxa910_device_u2ootg.drv_name, MV_USB2_PHY_INDEX, +pxa910_device_u2ophy.drv_name); + pxa_register_device(&pxa910_device_u2ootg, &ttc_usb_pdata, + sizeof(ttc_usb_pdata)); #endif #ifdef CONFIG_MMP_DISP -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCh V10 10/12] arm: mmp: remove unused usb devices
We defined new usb devices for usb ehci/udc/otg/phy. So remove the old definitions. Signed-off-by: Chao Xie --- arch/arm/mach-mmp/include/mach/pxa910.h |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h b/arch/arm/mach-mmp/include/mach/pxa910.h index c695982..d17ffee 100644 --- a/arch/arm/mach-mmp/include/mach/pxa910.h +++ b/arch/arm/mach-mmp/include/mach/pxa910.h @@ -19,9 +19,6 @@ extern struct pxa_device_desc pxa910_device_pwm2; extern struct pxa_device_desc pxa910_device_pwm3; extern struct pxa_device_desc pxa910_device_pwm4; extern struct pxa_device_desc pxa910_device_nand; -extern struct platform_device pxa168_device_u2o; -extern struct platform_device pxa168_device_u2ootg; -extern struct platform_device pxa168_device_u2oehci; extern struct pxa_device_desc pxa910_device_u2o; extern struct pxa_device_desc pxa910_device_u2ootg; extern struct pxa_device_desc pxa910_device_u2oehci; -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCh V10 12/12] usb: mv_usb: remove the phy callbacks in pdata
The phy initialization code will be done by phy driver. Signed-off-by: Chao Xie --- include/linux/platform_data/mv_usb.h |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/include/linux/platform_data/mv_usb.h b/include/linux/platform_data/mv_usb.h index 98b7925..b4b5d6f 100644 --- a/include/linux/platform_data/mv_usb.h +++ b/include/linux/platform_data/mv_usb.h @@ -45,9 +45,6 @@ struct mv_usb_platform_data { /* Force a_bus_req to be asserted */ unsigned intotg_force_a_bus_req:1; - int (*phy_init)(void __iomem *regbase); - void(*phy_deinit)(void __iomem *regbase); int (*set_vbus)(unsigned int vbus); - int (*private_init)(void __iomem *opregs, void __iomem *phyregs); }; #endif -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
why we need a msleep(5) in ehci_bus_suspend/resume
Hi, From the ehci-hub.c, I find that ehci_bus_suspend/resume have some code like this: if (time_before(jiffies, ehci->netx_statechange)) msleep(5); ... ehci->next_statechange = jiffies + msec_to_jiffies(10); and if (time_before(jiffies, ehci->netx_statechange)) msleep(5); ... ehci->next_statechange = jiffies + msec_to_jiffies(5); but I don't know why such a short sleep is needed, and why one is [ehci->next_statechange = jiffies + msec_to_jiffies(10)] and the other is [ehci->next_statechange = jiffies + msec_to_jiffies(5)], I googled for a long time, but it seems that there is no explanation. Anyone knows why and can give any explanation? Thanks very much! Best Regards! ShiJinghui -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html