mv-usb phy driver
Subsystems (5)
v9 cover 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
Signature · 1 line
1.7.4.1
PATCH v10 1/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.
--- drivers/usb/phy/phy.c | 6 ++++++ include/linux/usb/phy.h | 22 ++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-)
drivers/usb/phy/phy.c +6 -0
@@ -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))))
include/linux/usb/phy.h +18 -4
@@ -87,6 +87,14 @@ struct usb_phy {/* to support controllers that have multiple transceivers */ struct list_head head; +/* +* PHY may be shared by multiple devices. +* Being protected by phy_mutex and refcount, PHY is initialized +* or shut down only once. +*/ +struct mutex phy_mutex; +unsigned int refcount; +/* 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
Signature · 1 line
1.7.4.1
PATCH v10 2/12 usb: phy: mv_usb2: add PHY driver for marvell usb2 controller
In reply to Chao XieThe 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.
--- 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
drivers/usb/phy/Kconfig +9 -0
@@ -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
drivers/usb/phy/Makefile +1 -0
@@ -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
drivers/usb/phy/phy-mv-usb2.c new file +379 -0
379 lines not on this page · raw message
include/linux/usb/mv_usb2.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* Copyright (C) 2013 Marvell Inc. +* +* 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. +* +*/ + +#ifndef __MV_USB2_H +#define __MV_USB2_H + +#define MV_USB2_PHY_INDEX 0 +#define MV_USB2_OTG_PHY_INDEX 1 + +struct mv_usb2_phy { +struct usb_phy phy; +struct platform_device *pdev; +unsigned int type; +void __iomem *base; +struct clk *clk; +}; + +#endif
Signature · 1 line
1.7.4.1
PATCH v10 3/12 usb: gadget: mv_udc: use PHY driver for udc
In reply to Chao XieOriginaly, 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.
--- drivers/usb/gadget/mv_udc.h | 2 +- drivers/usb/gadget/mv_udc_core.c | 50 +++++++++++++------------------------- 2 files changed, 18 insertions(+), 34 deletions(-)
drivers/usb/gadget/mv_udc.h +1 -1
@@ -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 int max_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;
drivers/usb/gadget/mv_udc_core.c +17 -33
87 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH v10 4/12 usb: ehci: ehci-mv: use PHY driver for ehci
In reply to Chao XieOriginaly, 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.
--- drivers/usb/host/ehci-mv.c | 49 +++++++++++++++---------------------------- 1 files changed, 17 insertions(+), 32 deletions(-)
drivers/usb/host/ehci-mv.c +17 -32
@@ -15,17 +15,18 @@#include <linux/clk.h> #include <linux/err.h> #include <linux/usb/otg.h> +#include <linux/usb/mv_usb2.h> #include <linux/platform_data/mv_usb.h> #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,
Signature · 1 line
1.7.4.1
Alan Stern
maintainerPATCH v10 4/12 usb: ehci: ehci-mv: use PHY driver for ehci
Quoted 6 lines · Chao Xie
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.
I wonder if this is the sort of thing that should be handled in ehci-hcd.c rather than in all the different platform glue drivers.
Felipe, what do you think? Are the required actions now sufficiently generic that a single source file can take care of them?
Alan Stern
PATCH v10 4/12 usb: ehci: ehci-mv: use PHY driver for ehci
Hi,
Quoted 9 lines · Alan Stern
Quoted 6 lines · Chao Xie
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.
Quoted 5 lines
I wonder if this is the sort of thing that should be handled in
ehci-hcd.crather than in all the different platform glue drivers.Felipe, what do you think? Are the required actions now sufficiently generic that a single source file can take care of them?
Sorry for the delay, was on business trip and now on vacations. Anyway, I agree with you. Our PHY layer should be generic enough that it should be usable by ehci-hcd itself. If we have any missing method, let's add it generically.
cheers
ps: dropping this from my queue for now.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130528/39627b15/attachment.sig>
PATCH v10 4/12 usb: ehci: ehci-mv: use PHY driver for ehci
Quoted 15 lines · Felipe Balbi
Hi,
Quoted 12 lines · Alan Stern
Quoted 6 lines · Chao Xie
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.I wonder if this is the sort of thing that should be handled in
ehci-hcd.crather than in all the different platform glue drivers.
Quoted 8 lines
Quoted 2 lines
Felipe, what do you think? Are the required actions now sufficiently generic that a single source file can take care of them?
Sorry for the delay, was on business trip and now on vacations. Anyway, I agree with you. Our PHY layer should be generic enough that it should be usable by ehci-hcd itself. If we have any missing method, let's add it generically.
So what are your idea about making the PHY layer more generic? How ehci-hcd will make use of PHY layer?
Quoted 6 lines
cheers
ps: dropping this from my queue for now.
--
balbi
PATCH v10 4/12 usb: ehci: ehci-mv: use PHY driver for ehci
Hi,
Quoted 19 lines · Chao Xie
Quoted 18 lines · Felipe Balbi
Hi,
Quoted 14 lines · Alan Stern
Quoted 6 lines · Chao Xie
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.I wonder if this is the sort of thing that should be handled in
ehci-hcd.crather than in all the different platform glue drivers.Felipe, what do you think? Are the required actions now sufficiently generic that a single source file can take care of them?
Quoted 7 lines
Quoted 5 lines
Sorry for the delay, was on business trip and now on vacations. Anyway, I agree with you. Our PHY layer should be generic enough that it should be usable by ehci-hcd itself. If we have any missing method, let's add it generically.
So what are your idea about making the PHY layer more generic? How ehci-hcd will make use of PHY layer?
on probe grab the phy and initialize it. On suspend/resume, suspend/resume the PHY and so on. Whatever you were going to do on your ehci glue, do it on generic ehci-hcd.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130529/fc3b51af/attachment.sig>
PATCH v10 4/12 usb: ehci: ehci-mv: use PHY driver for ehci
Quoted 27 lines · Felipe Balbi
Hi,
Quoted 24 lines · Chao Xie
Quoted 23 lines · Felipe Balbi
Hi,
Quoted 9 lines · Alan Stern
Quoted 6 lines · Chao Xie
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.Quoted 5 lines
I wonder if this is the sort of thing that should be handled in
ehci-hcd.crather than in all the different platform glue drivers.Felipe, what do you think? Are the required actions now sufficiently generic that a single source file can take care of them?
Sorry for the delay, was on business trip and now on vacations. Anyway, I agree with you. Our PHY layer should be generic enough that it should be usable by ehci-hcd itself. If we have any missing method, let's add it generically.
Quoted 8 lines
Quoted 2 lines
So what are your idea about making the PHY layer more generic? How ehci-hcd will make use of PHY layer?
on probe grab the phy and initialize it. On suspend/resume, suspend/resume the PHY and so on. Whatever you were going to do on your ehci glue, do it on generic ehci-hcd.
These operations sound generic enough to be done at HCD layer, no? So no need to replicate the same stuff in ohci, ehci, xhci, etc.
cheers,
-roger
Alan Stern
maintainerPATCH v10 4/12 usb: ehci: ehci-mv: use PHY driver for ehci
Quoted 11 lines · Roger Quadros
Quoted 8 lines
Quoted 2 lines
So what are your idea about making the PHY layer more generic? How ehci-hcd will make use of PHY layer?
on probe grab the phy and initialize it. On suspend/resume, suspend/resume the PHY and so on. Whatever you were going to do on your ehci glue, do it on generic ehci-hcd.
These operations sound generic enough to be done at HCD layer, no? So no need to replicate the same stuff in ohci, ehci, xhci, etc.
The HCD layer handles suspend and resume only for PCI host controllers. Not for other types.
I don't know if the acquire/start and stop/release parts can be moved into the USB core. Maybe they can.
Alan Stern
PATCH v10 4/12 usb: ehci: ehci-mv: use PHY driver for ehci
Quoted 14 lines · Alan Stern
Quoted 11 lines · Roger Quadros
Quoted 8 lines
Quoted 2 lines
So what are your idea about making the PHY layer more generic? How ehci-hcd will make use of PHY layer?
on probe grab the phy and initialize it. On suspend/resume, suspend/resume the PHY and so on. Whatever you were going to do on your ehci glue, do it on generic ehci-hcd.
These operations sound generic enough to be done at HCD layer, no? So no need to replicate the same stuff in ohci, ehci, xhci, etc.
Quoted 8 lines
The HCD layer handles suspend and resume only for PCI host controllers. Not for other types.
I don't know if the acquire/start and stop/release parts can be moved into the USB core. Maybe they can.
Alan Stern
hi
The following is my understanding.
I think for PHY initialization and shutdown part, it is generic for other parts.
PHY initialization need to be called before hc_driver->reset is called. I think it can be added at usb_add_hcd.
For PHY shutdown, it can be added at usb_remove_hcd.
For suspend/resume, i do not know how to add it. For our EHCI driver, when system goes to deep idle states, we just directly shutdown the hcd and initialize it again when the system goes back.
Alan Stern
maintainerPATCH v10 4/12 usb: ehci: ehci-mv: use PHY driver for ehci
Quoted 11 lines · Chao Xie
Quoted 11 lines
Quoted 2 lines
These operations sound generic enough to be done at HCD layer, no? So no need to replicate the same stuff in ohci, ehci, xhci, etc.
The HCD layer handles suspend and resume only for PCI host controllers. Not for other types.
I don't know if the acquire/start and stop/release parts can be moved into the USB core. Maybe they can.
Alan Stern
Quoted 7 lines
hi
The following is my understanding.
I think for PHY initialization and shutdown part, it is generic for other parts.
PHY initialization need to be called beforehc_driver->resetis called. I think it can be added atusb_add_hcd.
For PHY shutdown, it can be added atusb_remove_hcd.
Yes, that should work.
Quoted 3 lines
For suspend/resume, i do not know how to add it. For our EHCI driver, when system goes to deep idle states, we just directly shutdown the hcd and initialize it again when the system goes back.
You shut down the host controller? Then how does it detect wakeup events? And how does it know if a device was disconnected while the power was off?
Alan Stern
PATCH v10 4/12 usb: ehci: ehci-mv: use PHY driver for ehci
Quoted 21 lines · Alan Stern
Quoted 11 lines · Chao Xie
Quoted 11 lines
Quoted 2 lines
These operations sound generic enough to be done at HCD layer, no? So no need to replicate the same stuff in ohci, ehci, xhci, etc.
The HCD layer handles suspend and resume only for PCI host controllers. Not for other types.
I don't know if the acquire/start and stop/release parts can be moved into the USB core. Maybe they can.
Alan Stern
Quoted 7 lines
hi
The following is my understanding.
I think for PHY initialization and shutdown part, it is generic for other parts.
PHY initialization need to be called beforehc_driver->resetis called. I think it can be added atusb_add_hcd.
For PHY shutdown, it can be added atusb_remove_hcd.
Quoted 2 lines
Yes, that should work.
Fine, i can add a patch for that. My usb phy patches are pending on it.
Quoted 8 lines
Quoted 3 lines
For suspend/resume, i do not know how to add it. For our EHCI driver, when system goes to deep idle states, we just directly shutdown the hcd and initialize it again when the system goes back.
You shut down the host controller? Then how does it detect wakeup events? And how does it know if a device was disconnected while the power was off?
Hi
I think maybe my suspend/resume is not same as what you think. The suspend/resume i mean is the peripharal sub system suspend/resume states. When SOC enter this low power mode,
the clock to usb, power to usb are all shut down.
When the controller is shut down, i think that usb_remove_hcd will help to remove all the attached devices.
We do not rely on usb host controller to wake up the whole sub system. If a device is disconnected while the power was off, when the host controller is powered again, it will do initialization again, and all the attached devices are susposed be removed already.
Quoted 2 lines
Alan Stern
PATCH v10 4/12 usb: ehci: ehci-mv: use PHY driver for ehci
Quoted 34 lines · Chao Xie
Quoted 21 lines · Alan Stern
Quoted 11 lines · Chao Xie
Quoted 11 lines
Quoted 2 lines
These operations sound generic enough to be done at HCD layer, no? So no need to replicate the same stuff in ohci, ehci, xhci, etc.
The HCD layer handles suspend and resume only for PCI host controllers. Not for other types.
I don't know if the acquire/start and stop/release parts can be moved into the USB core. Maybe they can.
Alan Stern
Quoted 7 lines
hi
The following is my understanding.
I think for PHY initialization and shutdown part, it is generic for other parts.
PHY initialization need to be called beforehc_driver->resetis called. I think it can be added atusb_add_hcd.
For PHY shutdown, it can be added atusb_remove_hcd.Quoted 2 lines
Yes, that should work.
Fine, i can add a patch for that. My usb phy patches are pending on it.
Quoted 8 lines
Quoted 3 lines
For suspend/resume, i do not know how to add it. For our EHCI driver, when system goes to deep idle states, we just directly shutdown the hcd and initialize it again when the system goes back.
You shut down the host controller? Then how does it detect wakeup events? And how does it know if a device was disconnected while the power was off?
Quoted 13 lines
Hi
I think maybe my suspend/resume is not same as what you think. The suspend/resume i mean is the peripharal sub system suspend/resume states. When SOC enter this low power mode,
the clock to usb, power to usb are all shut down.
When the controller is shut down, i think thatusb_remove_hcdwill help to remove all the attached devices.
We do not rely on usb host controller to wake up the whole sub system. If a device is disconnected while the power was off, when the host controller is powered again, it will do initialization again, and all the attached devices are susposed be removed already.
hi
I am sorry that i unerstand it wrong.
I checked with the code in our 3.4 git. we really did a lot of things when suspend/resume, and at that point the patch for ehci_resume and ehci_suspend are not added.
i think the driver can make use of ehci_resume/ehci_suspend. For PHY, we have to initialize it and shutdown it when do suspend/resume. Our PHY do not have any suspend states.
I suppose these phy operation have to be handled by each ehci driver owner only, or you think it can be handled at ehci-hce level?.
Quoted 2 lines
Quoted 2 lines
Alan Stern
Alan Stern
maintainerPATCH v10 4/12 usb: ehci: ehci-mv: use PHY driver for ehci
Quoted 8 lines · Chao Xie
I checked with the code in our 3.4 git. we really did a lot of things when suspend/resume, and at that point the patch for
ehci_resumeandehci_suspendare not added.
i think the driver can make use of ehci_resume/ehci_suspend. For PHY, we have to initialize it and shutdown it when do suspend/resume. Our PHY do not have any suspend states.
I suppose these phy operation have to be handled by each ehci driver owner only, or you think it can be handled at ehci-hce level?.
If the operations are the same for each platform, then yes -- they could be done in ehci-hcd. But if different platforms handle their PHYs differently then each glue module will need to do this on its own.
Alan Stern
PATCH v10 4/12 usb: ehci: ehci-mv: use PHY driver for ehci
In reply to Alan SternQuoted 21 lines · Alan Stern
Quoted 11 lines · Chao Xie
Quoted 11 lines
Quoted 2 lines
These operations sound generic enough to be done at HCD layer, no? So no need to replicate the same stuff in ohci, ehci, xhci, etc.
The HCD layer handles suspend and resume only for PCI host controllers. Not for other types.
I don't know if the acquire/start and stop/release parts can be moved into the USB core. Maybe they can.
Alan Stern
Quoted 7 lines
hi
The following is my understanding.
I think for PHY initialization and shutdown part, it is generic for other parts.
PHY initialization need to be called beforehc_driver->resetis called. I think it can be added atusb_add_hcd.
For PHY shutdown, it can be added atusb_remove_hcd.
Quoted 1 line
Yes, that should work.
I don't think this will work with OMAP USB host controller when used in Transceiver-less mode (e.g. HSIC). In this mode we need to release the HSIC reset (mapped to PHY init), after the EHCI controller is up and running.
On the other hand, in the PHY mode, the PHY needs to be initialized (brought out of reset) before the EHCI controller starts.
This behavior might be different on other controllers. Generalization is good as long as there is an override available for the controllers to handle the PHY init/shutdown themselves.
Quoted 9 lines
Quoted 4 lines
For suspend/resume, i do not know how to add it. For our EHCI driver, when system goes to deep idle states, we just directly shutdown the hcd and initialize it again when the system goes back.
You shut down the host controller? Then how does it detect wakeup events? And how does it know if a device was disconnected while the power was off?
On OMAP as well we are aiming to cut clocks to the host controller (state saved) during bus/system suspend. PHY is in low power mode capable of detecting wakeup events. The SoC is configured to wake up on any I/O activity on the PHY pins. Upon detection of PHY related I/O event, SoC wakes up, we restore the host controller state and proceed as normal.
cheers,
-roger
Alan Stern
maintainerPATCH v10 4/12 usb: ehci: ehci-mv: use PHY driver for ehci
Quoted 8 lines · Roger Quadros
Quoted 8 lines
Quoted 7 lines
hi
The following is my understanding.
I think for PHY initialization and shutdown part, it is generic for other parts.
PHY initialization need to be called beforehc_driver->resetis called. I think it can be added atusb_add_hcd.
For PHY shutdown, it can be added atusb_remove_hcd.
Quoted 8 lines
Quoted 1 line
Yes, that should work.
I don't think this will work with OMAP USB host controller when used in Transceiver-less mode (e.g. HSIC). In this mode we need to release the HSIC reset (mapped to PHY init), after the EHCI controller is up and running.
On the other hand, in the PHY mode, the PHY needs to be initialized (brought out of reset) before the EHCI controller starts.
In other words, transceiver-less mode effectively works without using a software-controlled PHY?
Quoted 3 lines
This behavior might be different on other controllers. Generalization is good as long as there is an override available for the controllers to handle the PHY init/shutdown themselves.
To avoid PHY init/shutdown, the platform driver should simply leave the generic PHY pointer (which has not yet been added to struct hcd) set to NULL.
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
For suspend/resume, i do not know how to add it. For our EHCI driver, when system goes to deep idle states, we just directly shutdown the hcd and initialize it again when the system goes back.
You shut down the host controller? Then how does it detect wakeup events? And how does it know if a device was disconnected while the power was off?
Quoted 5 lines
On OMAP as well we are aiming to cut clocks to the host controller (state saved) during bus/system suspend. PHY is in low power mode capable of detecting wakeup events. The SoC is configured to wake up on any I/O activity on the PHY pins. Upon detection of PHY related I/O event, SoC wakes up, we restore the host controller state and proceed as normal.
Maybe it's just me, but turning off USB Vbus power during suspend seems like a bad idea. Except for the case where all the root-hub ports are disabled (such as when no devices are plugged in) -- in that case it's fine.
But turning off power to an enabled device should be avoided, even though the kernel does a decent job of recovering when this happens. Not all devices respond well to this sort of treatment.
Alan Stern
PATCH v10 4/12 usb: ehci: ehci-mv: use PHY driver for ehci
Quoted 22 lines · Alan Stern
Quoted 8 lines · Roger Quadros
Quoted 8 lines
Quoted 7 lines
hi
The following is my understanding.
I think for PHY initialization and shutdown part, it is generic for other parts.
PHY initialization need to be called beforehc_driver->resetis called. I think it can be added atusb_add_hcd.
For PHY shutdown, it can be added atusb_remove_hcd.Quoted 8 lines
Quoted 1 line
Yes, that should work.
I don't think this will work with OMAP USB host controller when used in Transceiver-less mode (e.g. HSIC). In this mode we need to release the HSIC reset (mapped to PHY init), after the EHCI controller is up and running.
On the other hand, in the PHY mode, the PHY needs to be initialized (brought out of reset) before the EHCI controller starts.
In other words, transceiver-less mode effectively works without using a software-controlled PHY?
Quoted 8 lines
Quoted 3 lines
This behavior might be different on other controllers. Generalization is good as long as there is an override available for the controllers to handle the PHY init/shutdown themselves.
To avoid PHY init/shutdown, the platform driver should simply leave the generic PHY pointer (which has not yet been added to struct hcd) set to NULL.
So does it mean that i need add adtional usb_phy to struct hcd?
I think we can still make use of struct hcd->phy without add addtional members. For OMAP transceiver-less mode, you can still use your own phy init/shutdown and leave the hcd->phy to be NULL, and for the PHY mode, hcd->phy can be set. It will
do ->init at usb_add_hcd and ->shutdown at usb_remove_hcd.
Quoted 3 lines
Alan Stern
Alan Stern
maintainerPATCH v10 4/12 usb: ehci: ehci-mv: use PHY driver for ehci
Quoted 5 lines · Chao Xie
Quoted 4 lines
To avoid PHY init/shutdown, the platform driver should simply leave the generic PHY pointer (which has not yet been added to struct hcd) set to NULL.
So does it mean that i need add adtional
usb_phyto struct hcd?
Ah, I was wrong. There already is a PHY pointer in struct usb_hcd. You don't need to add another one.
Quoted 5 lines
I think we can still make use of struct
hcd->phywithout add addtional members. For OMAP transceiver-less mode, you can still use your own phy init/shutdown and leave thehcd->phyto be NULL, and for the PHY mode,hcd->phycan be set. It will
do ->init atusb_add_hcdand ->shutdown atusb_remove_hcd.
That's right.
Alan Stern
PATCH v10 4/12 usb: ehci: ehci-mv: use PHY driver for ehci
In reply to Alan SternQuoted 16 lines · Alan Stern
Quoted 14 lines · Roger Quadros
Quoted 9 lines
Quoted 7 lines
hi
The following is my understanding.
I think for PHY initialization and shutdown part, it is generic for other parts.
PHY initialization need to be called beforehc_driver->resetis called. I think it can be added atusb_add_hcd.
For PHY shutdown, it can be added atusb_remove_hcd.Yes, that should work.
I don't think this will work with OMAP USB host controller when used in Transceiver-less mode (e.g. HSIC). In this mode we need to release the HSIC reset (mapped to PHY init), after the EHCI controller is up and running.
Quoted 6 lines
Quoted 2 lines
On the other hand, in the PHY mode, the PHY needs to be initialized (brought out of reset) before the EHCI controller starts.
In other words, transceiver-less mode effectively works without using a software-controlled PHY?
Right.
Quoted 23 lines
Quoted 3 lines
This behavior might be different on other controllers. Generalization is good as long as there is an override available for the controllers to handle the PHY init/shutdown themselves.
To avoid PHY init/shutdown, the platform driver should simply leave the generic PHY pointer (which has not yet been added to struct hcd) set to NULL.
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
For suspend/resume, i do not know how to add it. For our EHCI driver, when system goes to deep idle states, we just directly shutdown the hcd and initialize it again when the system goes back.
You shut down the host controller? Then how does it detect wakeup events? And how does it know if a device was disconnected while the power was off?
Quoted 5 lines
On OMAP as well we are aiming to cut clocks to the host controller (state saved) during bus/system suspend. PHY is in low power mode capable of detecting wakeup events. The SoC is configured to wake up on any I/O activity on the PHY pins. Upon detection of PHY related I/O event, SoC wakes up, we restore the host controller state and proceed as normal.
Quoted 4 lines
Maybe it's just me, but turning off USB Vbus power during suspend seems like a bad idea. Except for the case where all the root-hub ports are disabled (such as when no devices are plugged in) -- in that case it's fine.
We don't turn off Vbus power at all. Just the USB controller IPs clocks (internal to our SoC) are cut off.
cheers,
-roger
PATCH v10 5/12 usb: phy: phy-mv-usb: use USB2 PHY driver for otg
In reply to Chao XieOriginaly, 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.
--- drivers/usb/phy/phy-mv-usb.c | 53 ++++++++++++++++++----------------------- drivers/usb/phy/phy-mv-usb.h | 2 +- 2 files changed, 24 insertions(+), 31 deletions(-)
drivers/usb/phy/phy-mv-usb.c +23 -30
@@ -25,6 +25,7 @@#include <linux/usb/otg.h> #include <linux/usb/gadget.h> #include <linux/usb/hcd.h> +#include <linux/usb/mv_usb2.h> #include <linux/platform_data/mv_usb.h> #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_phy:usb_remove_phy (&mvotg->phy); err_disable_clk:mv_otg_disable_internal (mvotg);
drivers/usb/phy/phy-mv-usb.h +1 -1
@@ -137,10 +137,10 @@ struct mv_otg_regs {struct mv_otg {struct usb_phy phy; +struct usb_phy *outer_phy;struct mv_otg_ctrl otg_ctrl;/* base address */ -void __iomem *phy_regs;void __iomem *cap_regs;struct mv_otg_regs __iomem *op_regs;
Signature · 1 line
1.7.4.1
PATCH v10 6/12 usb: mv_u3d: usb phy drivers for phy operation
In reply to Chao XieThe 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.
--- drivers/usb/gadget/mv_u3d.h | 3 +- drivers/usb/gadget/mv_u3d_core.c | 54 ++++++++++++++----------------------- 2 files changed, 23 insertions(+), 34 deletions(-)
drivers/usb/gadget/mv_u3d.h +2 -1
@@ -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 int max_eps;struct mv_u3d_ep_context *ep_context;
@@ -283,6 +282,8 @@ struct mv_u3d {struct mv_usb_addon_irq *vbus;unsigned int power; +struct usb_phy *phy; +struct clk *clk; };
drivers/usb/gadget/mv_u3d_core.c +21 -33
135 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH v10 7/12 arm: mmp2: change the defintion of usb devices
In reply to Chao Xieadd the udc/otg/ehci devices for mmp2
--- arch/arm/mach-mmp/include/mach/mmp2.h | 4 ++++ arch/arm/mach-mmp/mmp2.c | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-)
arch/arm/mach-mmp/include/mach/mmp2.h +4 -0
@@ -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;
arch/arm/mach-mmp/mmp2.c +4 -0
@@ -149,6 +149,10 @@ MMP2_DEVICE(sdh3, "sdhci-pxav3", 3, MMC4, 0xd4281800, 0x120);MMP2_DEVICE (asram,"asram" ,-1 ,NONE ,0xe0000000 ,0x4000 );/* 0xd1000000 ~ 0xd101ffff is reserved for secure processor */ MMP2_DEVICE (isram,"isram" ,-1 ,NONE ,0xd1020000 ,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[] = { {
Signature · 1 line
1.7.4.1
PATCH v10 8/12 arm: pxa910: change the defintion of usb devices
In reply to Chao Xiebecause phy is seperated from the usb controller driver, we can use the common pxa_device_desc for device register.
--- arch/arm/mach-mmp/include/mach/pxa910.h | 4 ++++ arch/arm/mach-mmp/pxa910.c | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-)
arch/arm/mach-mmp/include/mach/pxa910.h +4 -0
@@ -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;
arch/arm/mach-mmp/pxa910.c +4 -0
@@ -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 );
Signature · 1 line
1.7.4.1
PATCH v10 9/12 arm: ttc_dkb: modify usb support
In reply to Chao Xiefor ttc_dkb board, we use phy driver for usb support. Modify the usb support for udc/otg/ehci support.
--- arch/arm/mach-mmp/ttc_dkb.c | 39 ++++++++++++++++++++++++++++++--------- 1 files changed, 30 insertions(+), 9 deletions(-)
arch/arm/mach-mmp/ttc_dkb.c +30 -9
@@ -18,6 +18,8 @@#include <linux/i2c/pca953x.h> #include <linux/gpio.h> #include <linux/mfd/88pm860x.h> +#include <linux/usb/phy.h> +#include <linux/usb/mv_usb2.h> #include <linux/platform_data/mv_usb.h> #include <linux/spi/spi.h> #include <linux/delay.h>
@@ -29,7 +31,6 @@#include <mach/mfp-pxa910.h> #include <mach/pxa910.h> #include <mach/irqs.h> -#include <mach/regs-usb.h> #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
Signature · 1 line
1.7.4.1
PATCH v10 10/12 arm: mmp: remove unused usb devices
In reply to Chao XieWe defined new usb devices for usb ehci/udc/otg/phy. So remove the old definitions.
--- arch/arm/mach-mmp/include/mach/pxa910.h | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
arch/arm/mach-mmp/include/mach/pxa910.h +0 -3
@@ -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;
Signature · 1 line
1.7.4.1
PATCH v10 11/12 arm: brownstone: add usb support for the board
In reply to Chao Xiefor brownstone board, add the udc/otg/ehci support
--- arch/arm/mach-mmp/brownstone.c | 56 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-)
arch/arm/mach-mmp/brownstone.c +56 -0
@@ -18,6 +18,9 @@#include <linux/regulator/max8649.h> #include <linux/regulator/fixed.h> #include <linux/mfd/max8925.h> +#include <linux/usb/phy.h> +#include <linux/usb/mv_usb2.h> +#include <linux/platform_data/mv_usb.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -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" )
Signature · 1 line
1.7.4.1
PATCH v10 12/12 usb: mv_usb: remove the phy callbacks in pdata
In reply to Chao XieThe phy initialization code will be done by phy driver.
--- include/linux/platform_data/mv_usb.h | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
include/linux/platform_data/mv_usb.h +0 -3
@@ -45,9 +45,6 @@ struct mv_usb_platform_data {/* Force a_bus_req to be asserted */ unsigned int otg_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
Signature · 1 line
1.7.4.1