[PATCH 1/1] usb: phy-generic: add the implementation of .set_suspend
Add clock enable/disable at .set_suspend if the PHY has suspend requirement, it can be benefit of power saving for phy and the whole system (parent clock may also be disabled). Signed-off-by: Peter Chen --- drivers/usb/phy/phy-generic.c | 10 ++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c index aa6d37b..4b20a97 100644 --- a/drivers/usb/phy/phy-generic.c +++ b/drivers/usb/phy/phy-generic.c @@ -65,6 +65,16 @@ EXPORT_SYMBOL(usb_nop_xceiv_unregister); static int nop_set_suspend(struct usb_phy *x, int suspend) { + struct usb_phy_gen_xceiv *nop = dev_get_drvdata(x->dev); + + if (IS_ERR(nop->clk)) + return 0; + + if (suspend) + clk_disable_unprepare(nop->clk); + else + clk_prepare_enable(nop->clk); + return 0; } -- 1.7.8 -- 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] usb/core: fix NULL pointer dereference in recursively_mark_NOTATTACHED
> > On Tue, 24 Dec 2013, Alan Stern wrote: > > I think this will fix it. Take a close look and do some careful testing. > > > > Alan Stern > > > > Index: usb-3.13/drivers/usb/core/hub.c > > > == > > --- usb-3.13.orig/drivers/usb/core/hub.c > > +++ usb-3.13/drivers/usb/core/hub.c > > @@ -1622,11 +1622,14 @@ static void hub_disconnect(struct usb_in > > hub->error = 0; > > hub_quiesce(hub, HUB_DISCONNECT); > > > > - usb_set_intfdata (intf, NULL); > > - > > for (i = 0; i < hdev->maxchild; i++) > > usb_hub_remove_port_device(hub, i + 1); > > + > > + /* Avoid races with recursively_mark_NOTATTACHED() */ > > + spin_lock_irq(&device_state_lock); > > hub->hdev->maxchild = 0; > > + usb_set_intfdata(intf, NULL); > > + spin_unlock_irq(&device_state_lock); > > > > if (hub->hdev->speed == USB_SPEED_HIGH) > > highspeed_hubs--; > > > > Sorry for late response. Agree with you. I will test your patch carefully and > let you know the result. Thanks! I can reproduce issue by adding a delay just after usb_set_intfdata(intf, NULL) (echo -1 > bConfigurationValue to trigger hub_dissconnect())without your patch. After patch applied, cannot reproduce and didn't found any other issue. Patch works well. Alan, need I update patch to v2 or you will do it? Du, Changbin -- 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 v5 4/9] usb: ehci-s5p: Change to use phy provided by the generic phy framework
Hi Kamil, On Fri, Dec 20, 2013 at 6:54 PM, Kamil Debski wrote: > Change the phy provider used from the old one using the USB phy > framework to a new one using the Generic phy framework. > > Signed-off-by: Kamil Debski > Signed-off-by: Kyungmin Park Commit title: s/ehci-s5p/ehci-exynos > --- > Documentation/devicetree/bindings/usb/usb-ehci.txt | 35 +++ > drivers/usb/host/ehci-exynos.c | 97 > +--- > 2 files changed, 98 insertions(+), 34 deletions(-) > > diff --git a/Documentation/devicetree/bindings/usb/usb-ehci.txt > b/Documentation/devicetree/bindings/usb/usb-ehci.txt > index fa18612..413f7cd 100644 > --- a/Documentation/devicetree/bindings/usb/usb-ehci.txt > +++ b/Documentation/devicetree/bindings/usb/usb-ehci.txt > @@ -14,6 +14,10 @@ If controller implementation operates with big endian > descriptors, > If both big endian registers and descriptors are used by the controller > implementation, "big-endian" property can be specified instead of having > both "big-endian-regs" and "big-endian-desc". > + - port: if in the SoC there are EHCI phys, they should be listed here. > +One phy per port. Each port should have its reg entry with a consecutive > +number. Also it should contain phys and phy-names entries specifying the > +phy used by the port. > > Example (Sequoia 440EPx): > ehci@e300 { > @@ -23,3 +27,34 @@ Example (Sequoia 440EPx): >reg = <0 e300 90 0 e390 70>; >big-endian; > }; > + > +Example (Exynos 4212): > +ehci@1258 { > +compatible = "samsung,exynos4210-ehci"; > +reg = <0x1258 0x2>; > +interrupts = <0 70 0>; > +clocks = <&clock 304>, <&clock 305>; > +clock-names = "usbhost", "otg"; > +status = "disabled"; > +#address-cells = <1>; > +#size-cells = <0>; > +port@0 { > +reg = <0>; > +phys = <&usb2phy 1>; > +phy-names = "host"; > +status = "disabled"; > +}; > +port@1 { > +reg = <1>; > +phys = <&usb2phy 2>; > +phy-names = "hsic0"; > +status = "disabled"; > +}; > +port@2 { > +reg = <2>; > +phys = <&usb2phy 3>; > +phy-names = "hsic1"; > +status = "disabled"; > +}; > +}; Should we place above documentation in "Documentation/devicetree/bindings/usb/exynos-usb.txt" ? or is it something that i am missing. > + > diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c > index d1d8c47..7c35501 100644 > --- a/drivers/usb/host/ehci-exynos.c > +++ b/drivers/usb/host/ehci-exynos.c > @@ -19,12 +19,12 @@ > #include > #include > #include > +#include > #include > #include > #include > #include > #include > -#include > > #include "ehci.h" > > @@ -42,10 +42,10 @@ > static const char hcd_name[] = "ehci-exynos"; > static struct hc_driver __read_mostly exynos_ehci_hc_driver; > > +#define PHY_NUMBER 3 > struct exynos_ehci_hcd { > struct clk *clk; > - struct usb_phy *phy; > - struct usb_otg *otg; > + struct phy *phy[PHY_NUMBER]; > }; > > #define to_exynos_ehci(hcd) (struct exynos_ehci_hcd > *)(hcd_to_ehci(hcd)->priv) > @@ -69,13 +69,43 @@ static void exynos_setup_vbus_gpio(struct platform_device > *pdev) > dev_err(dev, "can't request ehci vbus gpio %d", gpio); > } > > +static int exynos_phys_on(struct phy *p[]) > +{ > + int i; > + int ret = 0; > + > + for (i = 0; ret == 0 && i < PHY_NUMBER; i++) > + if (p[i]) > + ret = phy_power_on(p[i]); > + if (ret) > + for (i--; i > 0; i--) > + if (p[i]) > + phy_power_off(p[i]); So we are turning off, say, port0 phy in case port1 phy power_on fails; can't we still leave a usb2.0 phy(a normal host phy) 'on' in case the HSIC phy fails ? > + > + return ret; > +} > + > +static int exynos_phys_off(struct phy *p[]) > +{ > + int i; > + int ret = 0; > + > + for (i = 0; ret == 0 && i < PHY_NUMBER; i++) > + if (p[i]) > + ret = phy_power_off(p[i]); > + > + return ret; > +} > + > static int exynos_ehci_probe(struct platform_device *pdev) > { > struct exynos_ehci_hcd *exynos_ehci; > struct usb_hcd *hcd; > struct ehci_hcd *ehci; > struct resource *res; > - struct usb_phy *phy; > + struct phy *phy; > + struct device_node *child; > + int phy_number; > int irq; > int err; > > @@ -102,14 +132,26 @@ static int exynos_ehci_probe(struct platform_device > *pdev) > "samsung,exynos5440-ehci")) > goto skip_phy; > > - phy = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2); > - if (IS_ERR(phy)) { > - usb_put_h
Re: [PATCH v2 9/9] dts: Add usb2phy to Exynos 5250
Hi Kamil, On Fri, Dec 20, 2013 at 6:54 PM, Kamil Debski wrote: > Add support to PHY of USB2 of the Exynos 5250 SoC. > > Signed-off-by: Kamil Debski > --- > arch/arm/boot/dts/exynos5250.dtsi | 33 --- > drivers/phy/phy-exynos5250-usb2.c | 64 > + > 2 files changed, 78 insertions(+), 19 deletions(-) > > diff --git a/arch/arm/boot/dts/exynos5250.dtsi > b/arch/arm/boot/dts/exynos5250.dtsi > index 2f264ad..922e0ed 100644 > --- a/arch/arm/boot/dts/exynos5250.dtsi > +++ b/arch/arm/boot/dts/exynos5250.dtsi > @@ -163,6 +163,11 @@ > interrupts = <0 47 0>; > }; > > + sys_syscon: syscon@1004 { > + compatible = "samsung,exynos5250-sys", "syscon"; > + reg = <0x1005 0x5000>; > + }; > + > pmu_syscon: syscon@1004 { > compatible = "samsung,exynos5250-pmu", "syscon"; > reg = <0x1004 0x5000>; > @@ -505,6 +510,14 @@ > > clocks = <&clock 285>; > clock-names = "usbhost"; > + #address-cells = <1>; > + #size-cells = <0>; > + port@0 { > + reg = <0>; > + phys = <&usb2_phy 1>; > + phy-names = "host"; > + status = "ok"; > + }; > }; > > usb@1212 { > @@ -516,19 +529,15 @@ > clock-names = "usbhost"; > }; > > - usb2_phy: usbphy@1213 { > - compatible = "samsung,exynos5250-usb2phy"; > + usb2_phy: phy@1213 { > + compatible = "samsung,exynos5250-usb2-phy"; > reg = <0x1213 0x100>; > - clocks = <&clock 1>, <&clock 285>; > - clock-names = "ext_xtal", "usbhost"; > - #address-cells = <1>; > - #size-cells = <1>; > - ranges; > - > - usbphy-sys { > - reg = <0x10040704 0x8>, > - <0x10050230 0x4>; > - }; > + clocks = <&clock 285>, <&clock 1>, <&clock 1>, <&clock 1>, > + <&clock 1>; > + clock-names = "phy", "device", "host", "hsic0", "hsic1"; > + #phy-cells = <1>; > + samsung,sysreg-phandle = <&sys_syscon>; > + samsung,pmureg-phandle = <&pmu_syscon>; > }; > > amba { > diff --git a/drivers/phy/phy-exynos5250-usb2.c > b/drivers/phy/phy-exynos5250-usb2.c > index b9b3b98..337bf82 100644 > --- a/drivers/phy/phy-exynos5250-usb2.c > +++ b/drivers/phy/phy-exynos5250-usb2.c Separate patches for dt and driver ? I think you wanted to move these changes to : [PATCH v5 7/9] phy: Add Exynos 5250 support to the Exynos USB 2.0 PHY driver > @@ -58,7 +58,13 @@ > #define EXYNOS_5250_HOSTPHYCTRL2 0x20 Shouldn't we leave the naming as EXYNOS_5250_HSICPHYCTRL2 instead of EXYNOS_5250_HOSTPHYCTRL2 ? That will go in sync with the user-manual too. and similar for EXYNOS_5250_HOSTPHYCTRL1 and below bit definitions too ? > > #define EXYNOS_5250_HOSTPHYCTRLX_REFCLKSEL_MASK(0x3 << 23) > +#define EXYNOS_5250_HOSTPHYCTRLX_REFCLKSEL_DEFAULT (0x2 << 23) > #define EXYNOS_5250_HOSTPHYCTRLX_REFCLKDIV_MASK(0x7f << 16) > +#define EXYNOS_5250_HOSTPHYCTRLX_REFCLKDIV_12 (0x24 << 16) > +#define EXYNOS_5250_HOSTPHYCTRLX_REFCLKDIV_15 (0x1c << 16) > +#define EXYNOS_5250_HOSTPHYCTRLX_REFCLKDIV_16 (0x1a << 16) > +#define EXYNOS_5250_HOSTPHYCTRLX_REFCLKDIV_19_2(0x15 << 16) > +#define EXYNOS_5250_HOSTPHYCTRLX_REFCLKDIV_20 (0x14 << 16) > #define EXYNOS_5250_HOSTPHYCTRLX_SIDDQ BIT(6) > #define EXYNOS_5250_HOSTPHYCTRLX_FORCESLEEPBIT(5) > #define EXYNOS_5250_HOSTPHYCTRLX_FORCESUSPEND BIT(4) > @@ -191,13 +197,14 @@ static void exynos5250_isol(struct > samsung_usb2_phy_instance *inst, bool on) > regmap_update_bits(drv->reg_pmu, offset, mask, on ? 0 : mask); > } > > -static void exynos5250_phy_pwr(struct samsung_usb2_phy_instance *inst, bool > on) > +static int exynos5250_power_on(struct samsung_usb2_phy_instance *inst) void ? we really don't have much to return in this function. > { > struct samsung_usb2_phy_driver *drv = inst->drv; > u32 ctrl0; > u32 otg; > u32 ehci; > u32 ohci; > + u32 hsic; > > switch (inst->cfg->id) { > case EXYNOS5250_DEVICE: > @@ -234,6 +241,8 @@ static void exynos5250_phy_pwr(struct > samsung_usb2_phy_instance *inst, bool on) > > break; > case EXYNOS5250_HOST: > + case EXYNOS5250_HSIC0: > + case EXYNOS5250_HSIC1: > /* Host registers configuration */ > ctrl0 = readl(drv->reg_phy + EXYNOS_5250_HOSTPHYCTRL0); > /* The cloc
[PATCH 2/2] usb: musb: Rework USB and USB_GADGET dependency
This USB controller can work in as host-only, gadget-only or dual-role modes. Rework the dependency on the USB and USB_GADGET configs in order to allow building the driver when !USB or !USG_GADGET. Signed-off-by: Ezequiel Garcia --- This is just a resend of a recently sent, standalone patch. drivers/usb/Kconfig | 4 ++-- drivers/usb/musb/Kconfig | 8 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 2642b8a..a34fb98 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig @@ -94,8 +94,6 @@ source "drivers/usb/wusbcore/Kconfig" source "drivers/usb/host/Kconfig" -source "drivers/usb/musb/Kconfig" - source "drivers/usb/renesas_usbhs/Kconfig" source "drivers/usb/class/Kconfig" @@ -106,6 +104,8 @@ source "drivers/usb/image/Kconfig" endif +source "drivers/usb/musb/Kconfig" + source "drivers/usb/dwc3/Kconfig" source "drivers/usb/chipidea/Kconfig" diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 57dfc0c..a1d805f 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig @@ -6,7 +6,7 @@ # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller config USB_MUSB_HDRC tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' - depends on USB_GADGET + depends on (USB || USB_GADGET) help Say Y here if your system has a dual role high speed USB controller based on the Mentor Graphics silicon IP. Then @@ -35,21 +35,21 @@ choice config USB_MUSB_HOST bool "Host only mode" - depends on USB + depends on USB=y || USB=USB_MUSB_HDRC help Select this when you want to use MUSB in host mode only, thereby the gadget feature will be regressed. config USB_MUSB_GADGET bool "Gadget only mode" - depends on USB_GADGET + depends on USB_GADGET=y || USB_GADGET=USB_MUSB_HDRC help Select this when you want to use MUSB in gadget mode only, thereby the host feature will be regressed. config USB_MUSB_DUAL_ROLE bool "Dual Role mode" - depends on (USB && USB_GADGET) + depends on ((USB=y || USB=USB_MUSB_HDRC) && (USB_GADGET=y || USB_GADGET=USB_MUSB_HDRC)) help This is the default mode of working of MUSB controller where both host and gadget features are enabled. -- 1.8.1.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 0/2] musb: Rework USB and USB_GADGET config
I'm resending this configuration rework to include one more patch in the series, prior to the config change. The first patch removes the usb_disable() usage, allowing the build the module for gadget-only mode usage. Without the first patch, the build breaks when building for !USB && USB_GADGET. Hope it looks better now. Ezequiel Garcia (2): usb: musb: Remove usb_disable() check in module_init() usb: musb: Rework USB and USB_GADGET dependency drivers/usb/Kconfig | 4 ++-- drivers/usb/musb/Kconfig | 8 drivers/usb/musb/musb_core.c | 17 + 3 files changed, 7 insertions(+), 22 deletions(-) -- 1.8.1.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 1/2] usb: musb: Remove usb_disable() check in module_init()
Removing the check to usb_disable() before registering the platform driver allows to build this driver when !USB && USB_GADGET, to be used in gadget-only mode. Also, use module_platform_driver() to register the platform driver. Signed-off-by: Ezequiel Garcia --- drivers/usb/musb/musb_core.c | 17 + 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 4d4499b..74d547a 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2283,19 +2283,4 @@ static struct platform_driver musb_driver = { .shutdown = musb_shutdown, }; -/*-*/ - -static int __init musb_init(void) -{ - if (usb_disabled()) - return 0; - - return platform_driver_register(&musb_driver); -} -module_init(musb_init); - -static void __exit musb_cleanup(void) -{ - platform_driver_unregister(&musb_driver); -} -module_exit(musb_cleanup); +module_platform_driver(musb_driver); -- 1.8.1.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
Re: [PATCH 2/2] usb: musb: Rework USB and USB_GADGET dependency
Hello. On 26-12-2013 16:24, Ezequiel Garcia wrote: This USB controller can work in as host-only, gadget-only or dual-role modes. Rework the dependency on the USB and USB_GADGET configs in order to allow building the driver when !USB or !USG_GADGET. Signed-off-by: Ezequiel Garcia [...] diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 57dfc0c..a1d805f 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig @@ -6,7 +6,7 @@ # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller config USB_MUSB_HDRC tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' - depends on USB_GADGET + depends on (USB || USB_GADGET) Parens are not needed here. Be consistent with other entries MUSB please. help Say Y here if your system has a dual role high speed USB controller based on the Mentor Graphics silicon IP. Then @@ -35,21 +35,21 @@ choice config USB_MUSB_HOST bool "Host only mode" - depends on USB + depends on USB=y || USB=USB_MUSB_HDRC help Select this when you want to use MUSB in host mode only, thereby the gadget feature will be regressed. config USB_MUSB_GADGET bool "Gadget only mode" - depends on USB_GADGET + depends on USB_GADGET=y || USB_GADGET=USB_MUSB_HDRC help Select this when you want to use MUSB in gadget mode only, thereby the host feature will be regressed. config USB_MUSB_DUAL_ROLE bool "Dual Role mode" - depends on (USB && USB_GADGET) + depends on ((USB=y || USB=USB_MUSB_HDRC) && (USB_GADGET=y || USB_GADGET=USB_MUSB_HDRC)) Outer parens are not needed either... WBR, Sergei -- 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 1/1] usb: phy-generic: add the implementation of .set_suspend
On Thu, Dec 26, 2013 at 03:36:03PM +0800, Peter Chen wrote: > Add clock enable/disable at .set_suspend if the PHY has > suspend requirement, it can be benefit of power saving for > phy and the whole system (parent clock may also be disabled). > > Signed-off-by: Peter Chen > --- > drivers/usb/phy/phy-generic.c | 10 ++ > 1 files changed, 10 insertions(+), 0 deletions(-) > > diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c > index aa6d37b..4b20a97 100644 > --- a/drivers/usb/phy/phy-generic.c > +++ b/drivers/usb/phy/phy-generic.c > @@ -65,6 +65,16 @@ EXPORT_SYMBOL(usb_nop_xceiv_unregister); > > static int nop_set_suspend(struct usb_phy *x, int suspend) > { > + struct usb_phy_gen_xceiv *nop = dev_get_drvdata(x->dev); > + > + if (IS_ERR(nop->clk)) > + return 0; > + > + if (suspend) > + clk_disable_unprepare(nop->clk); > + else > + clk_prepare_enable(nop->clk); heh, this is why I don't like clk_enable_prepare(). usb_phy_set_suspend() can be called from atomic context. I can't take this patch as is, sorry. -- balbi signature.asc Description: Digital signature
Re: [PATCH v8 11/12] usb: phy-mxs: Add system suspend/resume API
Hi, On Tue, Dec 24, 2013 at 11:58:55AM +0800, Peter Chen wrote: > @@ -398,6 +433,29 @@ static int mxs_phy_remove(struct platform_device *pdev) > return 0; > } > > +static int mxs_phy_system_suspend(struct device *dev) > +{ > + struct mxs_phy *mxs_phy = dev_get_drvdata(dev); > + > + if (device_may_wakeup(dev)) > + mxs_phy_enable_ldo_in_suspend(mxs_phy, true); > + > + return 0; > +} > + > +static int mxs_phy_system_resume(struct device *dev) > +{ > + struct mxs_phy *mxs_phy = dev_get_drvdata(dev); > + > + if (device_may_wakeup(dev)) > + mxs_phy_enable_ldo_in_suspend(mxs_phy, false); > + > + return 0; > +} > + > +static SIMPLE_DEV_PM_OPS(mxs_phy_pm, mxs_phy_system_suspend, > + mxs_phy_system_resume); this will give "Defined but not used" warnings when !PM_SLEEP. -- balbi signature.asc Description: Digital signature
[ANNOUNCE] Tree closed for v3.14
Hi all, my tree is now closed for v3.14 merge window. I'm testing a few last patches then I'll merge everything on top of my 'next' branch and will send a pull request to Greg by the end of the week. I believe all major sparse errors have already been fixed. We have a total of 105 non-merge commits going upstream. Thanks everybody for the effort. cheers -- balbi signature.asc Description: Digital signature
RE: [PATCH] usb/core: fix NULL pointer dereference in recursively_mark_NOTATTACHED
On Thu, 26 Dec 2013, Du, ChangbinX wrote: > I can reproduce issue by adding a delay just after usb_set_intfdata(intf, > NULL) > (echo -1 > bConfigurationValue to trigger hub_dissconnect())without your > patch. > > After patch applied, cannot reproduce and didn't found any other issue. Patch > works well. > > Alan, need I update patch to v2 or you will do it? I will send in the updated patch next week, after I get back from vacation. Alan Stern -- 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
[GIT PULL] usb patches for v3.14 merge window
Hi Greg, Here's my overly extensive pull request for v3.14 merge window. Lots of work has happened for next merge window. All patches have been tested with all ARM defconfigs, i386_defconfig, kvm_guest.config, x86_64_defconfig, plus quite a few randconfigs. All latest 0-DAY reports have been fixed already a few days back. I have test-merged this on top of your usb-next and no conflicts showed up. Please, consider merging. Happy New Year The following changes since commit 413541dd66d51f791a0b169d9b9014e4f56be13c: Linux 3.13-rc5 (2013-12-22 13:08:32 -0800) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git tags/usb-for-v3.14 for you to fetch changes up to 836a2164491b19dcd4f29d574e548bcadd421a6a: usb: phy: keystone: remove redundant return value check of platform_get_resource() (2013-12-26 10:19:01 -0600) usb: changes for v3.14 merge window This pull request is quite extensive, containing 105 non-merge commits. Because of that, we describe the changes in sections below: New drivers: - Keystone PHY driver and DWC3 Glue Layer - Aeroflex Gaisler GRUSBDC - Tahvo PHY driver for N770 - JZ4740 MUSB gluer Layer - Broadcom PHY Driver Important new features: - MUSB DSPS learned about suspend/resume - New quirk_ep_out_aligned_size flag added to struct usb_gadget - DWC3 initializes the new quirk flag so gadget drivers can use it. - AM335x PHY Driver learns about remote wakeup - Renesas USBHS now requests DMA Engine only once - s3c-hsotg is now re-used on Broadcom devices - USB PHY layer now makes sure to initialize the notifier for all drivers - omap-control learned about TI's new AM437x devices - few other usb gadget/function drivers learned about the new configfs-based binding. Misc Fixes and Clean Ups: - Several sparse fixes all over the place - Removal of redundant of_match_ptr() - r-car gen2 phy now uses usb_add_phy_dev() - removal of DEFINE_PCI_DEVICE_TABLE() from a few drivers - conversion to clk_prepare/clk_unprepare on r8a66597-udc - some randconfig errors and build warnings were fixed - removal of unnecessary lock on dwc3-omap.c Signed-of-by: Felipe Balbi Aaro Koskinen (7): ARM: OMAP1: USB: move omap_usb_config to platform data usb: omap1: add extcon to platform data usb: omap1: OTG controller driver usb: omap1: Tahvo USB transceiver driver usb: phy: tahvo: fix smatch warnings usb: phy: isp1301-omap: fix smatch warnings usb: phy: fix some Kconfig descriptions Andreas Larsson (1): usb: gadget: Add UDC driver for Aeroflex Gaisler GRUSBDC Andrzej Pietrasiewicz (21): usb: gadget: composite: redirect setup requests usb: gadget: factor out alloc_ep_req usb: gadget: f_loopback: add configfs support usb: gadget: f_sourcesink: add configfs support usb: gadget: configfs: allow setting function instance's name usb: gadget: g_ffs: remove a reduntant gfs_ether_setup variable usb: gadget: g_ffs: convert to new interface of f_ecm usb: gadget: f_ecm: remove compatibility layer usb: gadget: g_ffs: convert to new interface of f_subset usb: gadget: f_subset: remove compatibility layer usb: gadget: g_ffs: convert to new interface of f_rndis usb: gadget: f_rndis: remove compatibility layer usb: gadget: rndis: merge u_rndis.ko with usb_f_rndis.ko usb: gadget: FunctionFS: Remove VLAIS usage from gadget code usb: gadget: FunctionFS: create utility file usb: gadget: FunctionFS: add devices management code usb: gadget: FunctionFS: convert to new function interface with backward compatibility usb: gadget: g_ffs: convert to new interface of f_fs usb: gadget: FunctionFS: Remove compatibility layer usb: gadget: FunctionFS: add configfs support usb: gadget: nokia: fix error recovery path for optional functions Anton Tikhomirov (5): usb: phy: fsm: protect against multiple inclusions usb: phy: replace spinlock with mutex in OTG FSM usb: phy: move OTG FSM header usb: phy: Add OTG FSM configuration option usb: phy: Fix double lock in OTG FSM Apelete Seketeli (2): usb: musb: add support for JZ4740 usb device controller usb: musb: fix setting JZ4740 gadget periphal mode on reset Bin Liu (1): usb: musb: dsps: polling ID pin status only in otg mode Dan Carpenter (1): usb: gadget: update some out of date comments Daniel Mack (7): usb: musb: unconditionally save and restore the context on suspend usb: musb: call musb_port_suspend from musb_bus_suspend usb: musb: dsps: add {tx,rx}_mode to wrapper u
[PATCH v2] usb: musb: Rework USB and USB_GADGET dependency
This USB controller can work in as host-only, gadget-only or dual-role modes. Rework the dependency on the USB and USB_GADGET configs in order to allow building the driver when !USB or !USG_GADGET. Signed-off-by: Ezequiel Garcia --- Changes from v1: Remove unneeded parenthesis drivers/usb/Kconfig | 4 ++-- drivers/usb/musb/Kconfig | 8 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 2642b8a..a34fb98 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig @@ -94,8 +94,6 @@ source "drivers/usb/wusbcore/Kconfig" source "drivers/usb/host/Kconfig" -source "drivers/usb/musb/Kconfig" - source "drivers/usb/renesas_usbhs/Kconfig" source "drivers/usb/class/Kconfig" @@ -106,6 +104,8 @@ source "drivers/usb/image/Kconfig" endif +source "drivers/usb/musb/Kconfig" + source "drivers/usb/dwc3/Kconfig" source "drivers/usb/chipidea/Kconfig" diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 57dfc0c..fff30b9 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig @@ -6,7 +6,7 @@ # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller config USB_MUSB_HDRC tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' - depends on USB_GADGET + depends on USB || USB_GADGET help Say Y here if your system has a dual role high speed USB controller based on the Mentor Graphics silicon IP. Then @@ -35,21 +35,21 @@ choice config USB_MUSB_HOST bool "Host only mode" - depends on USB + depends on USB=y || USB=USB_MUSB_HDRC help Select this when you want to use MUSB in host mode only, thereby the gadget feature will be regressed. config USB_MUSB_GADGET bool "Gadget only mode" - depends on USB_GADGET + depends on USB_GADGET=y || USB_GADGET=USB_MUSB_HDRC help Select this when you want to use MUSB in gadget mode only, thereby the host feature will be regressed. config USB_MUSB_DUAL_ROLE bool "Dual Role mode" - depends on (USB && USB_GADGET) + depends on (USB=y || USB=USB_MUSB_HDRC) && (USB_GADGET=y || USB_GADGET=USB_MUSB_HDRC) help This is the default mode of working of MUSB controller where both host and gadget features are enabled. -- 1.8.1.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
Re: [PATCH v4 00/15] usb: phy: msm: Fixes, cleanups and DT support
On 12/20, David Brown wrote: > On Thu, Dec 19, 2013 at 05:26:13PM -0600, Felipe Balbi wrote: > > >it's getting quite late for me. I still want to leave my stuff soaking > >in linux-next for a while. I'll try my best, though, if you ack it ASAP > > Thanks. Patch 1 already has my Ack in it, and I've sent an ack for > number 6. > Felipe, If this isn't picked up for 3.14 can we get an ack on patch 1 so we can send it through arm-soc as part of the multi-platform patches I have for MSM[1]? [1] https://lkml.org/lkml/2013/12/4/523 -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation -- 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 1/1] usb: phy-generic: add the implementation of .set_suspend
On Thu, Dec 26, 2013 at 09:58:01AM -0600, Felipe Balbi wrote: > On Thu, Dec 26, 2013 at 03:36:03PM +0800, Peter Chen wrote: > > Add clock enable/disable at .set_suspend if the PHY has > > suspend requirement, it can be benefit of power saving for > > phy and the whole system (parent clock may also be disabled). > > > > Signed-off-by: Peter Chen > > --- > > drivers/usb/phy/phy-generic.c | 10 ++ > > 1 files changed, 10 insertions(+), 0 deletions(-) > > > > diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c > > index aa6d37b..4b20a97 100644 > > --- a/drivers/usb/phy/phy-generic.c > > +++ b/drivers/usb/phy/phy-generic.c > > @@ -65,6 +65,16 @@ EXPORT_SYMBOL(usb_nop_xceiv_unregister); > > > > static int nop_set_suspend(struct usb_phy *x, int suspend) > > { > > + struct usb_phy_gen_xceiv *nop = dev_get_drvdata(x->dev); > > + > > + if (IS_ERR(nop->clk)) > > + return 0; > > + > > + if (suspend) > > + clk_disable_unprepare(nop->clk); > > + else > > + clk_prepare_enable(nop->clk); > > heh, this is why I don't like clk_enable_prepare(). > usb_phy_set_suspend() can be called from atomic context. > Oh, then, how can we disable/enable phy's clock at runtime/system-side pm? Create another APIs like usb_phy_set_clk()? What's our expectation the usb_phy_set_suspend does? Only set the registers? Peter > I can't take this patch as is, sorry. > > -- > balbi -- Best Regards, Peter Chen -- 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 v8 11/12] usb: phy-mxs: Add system suspend/resume API
On Thu, Dec 26, 2013 at 10:25:20AM -0600, Felipe Balbi wrote: > Hi, > > On Tue, Dec 24, 2013 at 11:58:55AM +0800, Peter Chen wrote: > > @@ -398,6 +433,29 @@ static int mxs_phy_remove(struct platform_device *pdev) > > return 0; > > } > > > > +static int mxs_phy_system_suspend(struct device *dev) > > +{ > > + struct mxs_phy *mxs_phy = dev_get_drvdata(dev); > > + > > + if (device_may_wakeup(dev)) > > + mxs_phy_enable_ldo_in_suspend(mxs_phy, true); > > + > > + return 0; > > +} > > + > > +static int mxs_phy_system_resume(struct device *dev) > > +{ > > + struct mxs_phy *mxs_phy = dev_get_drvdata(dev); > > + > > + if (device_may_wakeup(dev)) > > + mxs_phy_enable_ldo_in_suspend(mxs_phy, false); > > + > > + return 0; > > +} > > + > > +static SIMPLE_DEV_PM_OPS(mxs_phy_pm, mxs_phy_system_suspend, > > + mxs_phy_system_resume); > > this will give "Defined but not used" warnings when !PM_SLEEP. > Oh, sorry, will change. -- Best Regards, Peter Chen -- 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 1/1] usb: phy-generic: add the implementation of .set_suspend
Hi, On Fri, Dec 27, 2013 at 09:40:24AM +0800, Peter Chen wrote: > On Thu, Dec 26, 2013 at 09:58:01AM -0600, Felipe Balbi wrote: > > On Thu, Dec 26, 2013 at 03:36:03PM +0800, Peter Chen wrote: > > > Add clock enable/disable at .set_suspend if the PHY has > > > suspend requirement, it can be benefit of power saving for > > > phy and the whole system (parent clock may also be disabled). > > > > > > Signed-off-by: Peter Chen > > > --- > > > drivers/usb/phy/phy-generic.c | 10 ++ > > > 1 files changed, 10 insertions(+), 0 deletions(-) > > > > > > diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c > > > index aa6d37b..4b20a97 100644 > > > --- a/drivers/usb/phy/phy-generic.c > > > +++ b/drivers/usb/phy/phy-generic.c > > > @@ -65,6 +65,16 @@ EXPORT_SYMBOL(usb_nop_xceiv_unregister); > > > > > > static int nop_set_suspend(struct usb_phy *x, int suspend) > > > { > > > + struct usb_phy_gen_xceiv *nop = dev_get_drvdata(x->dev); > > > + > > > + if (IS_ERR(nop->clk)) > > > + return 0; > > > + > > > + if (suspend) > > > + clk_disable_unprepare(nop->clk); > > > + else > > > + clk_prepare_enable(nop->clk); > > > > heh, this is why I don't like clk_enable_prepare(). > > usb_phy_set_suspend() can be called from atomic context. > > > > Oh, then, how can we disable/enable phy's clock at runtime/system-side > pm? Create another APIs like usb_phy_set_clk()? clk_prepare() on probe, clk_unprepare() on remove, clk_enable()/disable() on set_suspend() -- balbi signature.asc Description: Digital signature
[PATCH net-next 0/6] Support new chip
Adjust the code to make it easy to add the settings for the new chip. Then, add the relative parameters of the RTL8153. Hayes Wang (6): r8152: move rtl8152_unload and ocp_reg_write r8152: modify the method of accessing PHY r8152: change some definitions r8152: add rtl_ops r8152: split rtl8152_enable r8152: support RTL8153 drivers/net/usb/cdc_ether.c | 10 + drivers/net/usb/r8152.c | 812 +++- drivers/net/usb/r815x.c | 2 +- 3 files changed, 741 insertions(+), 83 deletions(-) -- 1.8.3.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 net-next 1/6] r8152: move rtl8152_unload and ocp_reg_write
Change the locations of rtl8152_unload() and ocp_reg_write(). Signed-off-by: Hayes Wang --- drivers/net/usb/r8152.c | 58 - 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 5107372..79bb553 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -653,6 +653,20 @@ static void ocp_write_byte(struct r8152 *tp, u16 type, u16 index, u32 data) generic_ocp_write(tp, index, byen, sizeof(tmp), &tmp, type); } +static void ocp_reg_write(struct r8152 *tp, u16 addr, u16 data) +{ + u16 ocp_base, ocp_index; + + ocp_base = addr & 0xf000; + if (ocp_base != tp->ocp_base) { + ocp_write_word(tp, MCU_TYPE_PLA, PLA_OCP_GPHY_BASE, ocp_base); + tp->ocp_base = ocp_base; + } + + ocp_index = (addr & 0x0fff) | 0xb000; + ocp_write_word(tp, MCU_TYPE_PLA, ocp_index, data); +} + static void r8152_mdio_write(struct r8152 *tp, u32 reg_addr, u32 value) { u32 ocp_data; @@ -715,20 +729,6 @@ void write_mii_word(struct net_device *netdev, int phy_id, int reg, int val) r8152_mdio_write(tp, reg, val); } -static void ocp_reg_write(struct r8152 *tp, u16 addr, u16 data) -{ - u16 ocp_base, ocp_index; - - ocp_base = addr & 0xf000; - if (ocp_base != tp->ocp_base) { - ocp_write_word(tp, MCU_TYPE_PLA, PLA_OCP_GPHY_BASE, ocp_base); - tp->ocp_base = ocp_base; - } - - ocp_index = (addr & 0x0fff) | 0xb000; - ocp_write_word(tp, MCU_TYPE_PLA, ocp_index, data); -} - static int r8152_submit_rx(struct r8152 *tp, struct rx_agg *agg, gfp_t mem_flags); @@ -2079,6 +2079,21 @@ static void r8152b_get_version(struct r8152 *tp) } } +static void rtl8152_unload(struct r8152 *tp) +{ + u32 ocp_data; + + if (tp->version != RTL_VER_01) { + ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_UPS_CTRL); + ocp_data |= POWER_CUT; + ocp_write_word(tp, MCU_TYPE_USB, USB_UPS_CTRL, ocp_data); + } + + ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS); + ocp_data &= ~RWSUME_INDICATE; + ocp_write_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS, ocp_data); +} + static int rtl8152_probe(struct usb_interface *intf, const struct usb_device_id *id) { @@ -2150,21 +2165,6 @@ out: return ret; } -static void rtl8152_unload(struct r8152 *tp) -{ - u32 ocp_data; - - if (tp->version != RTL_VER_01) { - ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_UPS_CTRL); - ocp_data |= POWER_CUT; - ocp_write_word(tp, MCU_TYPE_USB, USB_UPS_CTRL, ocp_data); - } - - ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS); - ocp_data &= ~RWSUME_INDICATE; - ocp_write_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS, ocp_data); -} - static void rtl8152_disconnect(struct usb_interface *intf) { struct r8152 *tp = usb_get_intfdata(intf); -- 1.8.3.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 net-next 6/6] r8152: support RTL8153
Support new chip RTL8153 which is the USB 3.0 giga ethernet adapter. Signed-off-by: Hayes Wang --- drivers/net/usb/cdc_ether.c | 10 + drivers/net/usb/r8152.c | 615 +++- drivers/net/usb/r815x.c | 2 +- 3 files changed, 621 insertions(+), 6 deletions(-) diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 4b1c0f3..3e09887 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c @@ -486,6 +486,7 @@ static const struct driver_info wwan_info = { #define ZTE_VENDOR_ID 0x19D2 #define DELL_VENDOR_ID 0x413C #define REALTEK_VENDOR_ID 0x0bda +#define VENDOR_ID_SAMSUNG 0x04e8 static const struct usb_device_id products[] = { /* BLACKLIST !! @@ -652,6 +653,15 @@ static const struct usb_device_id products[] = { .driver_info = 0, }, +#if defined(CONFIG_USB_RTL8152) || defined(CONFIG_USB_RTL8152_MODULE) +/* Samsung USB Ethernet Adapters */ +{ + USB_DEVICE_AND_INTERFACE_INFO(VENDOR_ID_SAMSUNG, 0xa101, USB_CLASS_COMM, + USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), + .driver_info = 0, +}, +#endif + /* WHITELIST!!! * * CDC Ether uses two interfaces, not necessarily consecutive. diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 537..bc226e9 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -24,7 +24,7 @@ #include /* Version Information */ -#define DRIVER_VERSION "v1.02.0 (2013/10/28)" +#define DRIVER_VERSION "v1.03.0 (2013/12/26)" #define DRIVER_AUTHOR "Realtek linux nic maintainers " #define DRIVER_DESC "Realtek RTL8152 Based USB 2.0 Ethernet Adapters" #define MODULENAME "r8152" @@ -39,15 +39,24 @@ #define PLA_RXFIFO_CTRL2 0xc0a8 #define PLA_FMC0xc0b4 #define PLA_CFG_WOL0xc0b6 +#define PLA_TEREDO_CFG 0xc0bc #define PLA_MAR0xcd00 +#define PLA_BACKUP 0xd000 #define PAL_BDC_CR 0xd1a0 +#define PLA_TEREDO_TIMER 0xd2cc +#define PLA_REALWOW_TIMER 0xd2e8 #define PLA_LEDSEL 0xdd90 #define PLA_LED_FEATURE0xdd92 #define PLA_PHYAR 0xde00 +#define PLA_BOOT_CTRL 0xe004 #define PLA_GPHY_INTR_IMR 0xe022 #define PLA_EEE_CR 0xe040 #define PLA_EEEP_CR0xe080 #define PLA_MAC_PWR_CTRL 0xe0c0 +#define PLA_MAC_PWR_CTRL2 0xe0ca +#define PLA_MAC_PWR_CTRL3 0xe0cc +#define PLA_MAC_PWR_CTRL4 0xe0ce +#define PLA_WDT6_CTRL 0xe428 #define PLA_TCR0 0xe610 #define PLA_TCR1 0xe612 #define PLA_TXFIFO_CTRL0xe618 @@ -73,16 +82,25 @@ #define PLA_BP_5 0xfc32 #define PLA_BP_6 0xfc34 #define PLA_BP_7 0xfc36 +#define PLA_BP_EN 0xfc38 +#define USB_U2P3_CTRL 0xb460 #define USB_DEV_STAT 0xb808 #define USB_USB_CTRL 0xd406 #define USB_PHY_CTRL 0xd408 #define USB_TX_AGG 0xd40a #define USB_RX_BUF_TH 0xd40c #define USB_USB_TIMER 0xd428 +#define USB_RX_EARLY_AGG 0xd42c #define USB_PM_CTRL_STATUS 0xd432 #define USB_TX_DMA 0xd434 +#define USB_TOLERANCE 0xd490 +#define USB_LPM_CTRL 0xd41a #define USB_UPS_CTRL 0xd800 +#define USB_MISC_0 0xd81a +#define USB_POWER_CUT 0xd80a +#define USB_AFE_CTRL2 0xd824 +#define USB_WDT11_CTRL 0xe43c #define USB_BP_BA 0xfc26 #define USB_BP_0 0xfc28 #define USB_BP_1 0xfc2a @@ -92,6 +110,7 @@ #define USB_BP_5 0xfc32 #define USB_BP_6 0xfc34 #define USB_BP_7 0xfc36 +#define USB_BP_EN 0xfc38 /* OCP Registers */ #define OCP_ALDPS_CONFIG 0x2010 @@ -101,6 +120,20 @@ #define OCP_BASE_MII 0xa400 #define OCP_EEE_AR 0xa41a #define OCP_EEE_DATA 0xa41c +#define OCP_PHY_STATUS 0xa420 +#define OCP_POWER_CFG 0xa430 +#define OCP_EEE_CFG0xa432 +#define OCP_SRAM_ADDR 0xa436 +#define OCP_SRAM_DATA 0xa438 +#define OCP_DOWN_SPEED 0xa442 +#define OCP_EEE_CFG2 0xa5d0 +#define OCP_ADC_CFG0xbc06 + +/* SRAM Register */ +#define SRAM_LPF_CFG 0x8012 +#define SRAM_10M_AMP1 0x8080 +#define SRAM_10M_AMP2 0x8082 +#define SRAM_IMPEDANCE 0x8084 /* PLA_RCR */ #define RCR_AAP0x0001 @@ -117,14 +150,17 @@ #define RXFIFO_THR2_FULL 0x0060 #define RXFIFO_THR2_HIGH 0x0038 #define RXFIFO_THR2_OOB0x004a +#define RXFIFO_THR2_NORMAL 0x00a0 /* PLA_RXFIFO_CTRL2 */ #define RXFIFO_THR3_FULL 0x0078 #define RXFIFO_THR3_HIGH 0x0048 #define RXFIFO_THR3_OOB0x005a +#define RXFIFO_THR3_NORMAL
[PATCH net-next 4/6] r8152: add rtl_ops
The different chips may have different settings. This makes it easy to let different chips have the same flow with differnt settings. Signed-off-by: Hayes Wang --- drivers/net/usb/r8152.c | 56 ++--- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index a8ea848..040ef73 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -367,6 +367,15 @@ struct r8152 { spinlock_t rx_lock, tx_lock; struct delayed_work schedule; struct mii_if_info mii; + + struct rtl_ops { + void (*init)(struct r8152 *); + int (*enable)(struct r8152 *); + void (*disable)(struct r8152 *); + void (*down)(struct r8152 *); + void (*unload)(struct r8152 *); + } rtl_ops; + int intr_interval; u32 msg_enable; u32 tx_qlen; @@ -1751,7 +1760,7 @@ static void set_carrier(struct r8152 *tp) if (speed & LINK_STATUS) { if (!(tp->speed & LINK_STATUS)) { - rtl8152_enable(tp); + tp->rtl_ops.enable(tp); set_bit(RTL8152_SET_RX_MODE, &tp->flags); netif_carrier_on(netdev); } @@ -1759,7 +1768,7 @@ static void set_carrier(struct r8152 *tp) if (tp->speed & LINK_STATUS) { netif_carrier_off(netdev); tasklet_disable(&tp->tl); - rtl8152_disable(tp); + tp->rtl_ops.disable(tp); tasklet_enable(&tp->tl); } } @@ -1819,7 +1828,7 @@ static int rtl8152_close(struct net_device *netdev) cancel_delayed_work_sync(&tp->schedule); netif_stop_queue(netdev); tasklet_disable(&tp->tl); - rtl8152_disable(tp); + tp->rtl_ops.disable(tp); tasklet_enable(&tp->tl); return res; @@ -1945,7 +1954,7 @@ static int rtl8152_suspend(struct usb_interface *intf, pm_message_t message) tasklet_disable(&tp->tl); } - rtl8152_down(tp); + tp->rtl_ops.down(tp); return 0; } @@ -1954,7 +1963,7 @@ static int rtl8152_resume(struct usb_interface *intf) { struct r8152 *tp = usb_get_intfdata(intf); - r8152b_init(tp); + tp->rtl_ops.init(tp); netif_device_attach(tp->netdev); if (netif_running(tp->netdev)) { rtl8152_set_speed(tp, AUTONEG_ENABLE, SPEED_100, DUPLEX_FULL); @@ -2083,6 +2092,34 @@ static void rtl8152_unload(struct r8152 *tp) ocp_write_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS, ocp_data); } +static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) +{ + struct rtl_ops *ops = &tp->rtl_ops; + int ret = 0; + + switch (id->idVendor) { + case VENDOR_ID_REALTEK: + switch (id->idProduct) { + case PRODUCT_ID_RTL8152: + ops->init = r8152b_init; + ops->enable = rtl8152_enable; + ops->disable= rtl8152_disable; + ops->down = rtl8152_down; + ops->unload = rtl8152_unload; + break; + default: + ret = -EFAULT; + break; + } + break; + + default: + ret = -EFAULT; + break; + } + return ret; +} + static int rtl8152_probe(struct usb_interface *intf, const struct usb_device_id *id) { @@ -2106,6 +2143,11 @@ static int rtl8152_probe(struct usb_interface *intf, tp = netdev_priv(netdev); tp->msg_enable = 0x7FFF; + if (rtl_ops_init(tp, id)) { + netif_err(tp, probe, netdev, "Unknown Device"); + return -ENODEV; + } + tasklet_init(&tp->tl, bottom_half, (unsigned long)tp); INIT_DELAYED_WORK(&tp->schedule, rtl_work_func_t); @@ -2128,7 +2170,7 @@ static int rtl8152_probe(struct usb_interface *intf, tp->mii.supports_gmii = 0; r8152b_get_version(tp); - r8152b_init(tp); + tp->rtl_ops.init(tp); set_ethernet_addr(tp); ret = alloc_all_mem(tp); @@ -2163,7 +2205,7 @@ static void rtl8152_disconnect(struct usb_interface *intf) set_bit(RTL8152_UNPLUG, &tp->flags); tasklet_kill(&tp->tl); unregister_netdev(tp->netdev); - rtl8152_unload(tp); + tp->rtl_ops.unload(tp); free_all_mem(tp); free_netdev(tp->netdev); } -- 1.8.3.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/major
[PATCH net-next 5/6] r8152: split rtl8152_enable
Split the contents of rtl8152_enable() into rtl_set_eee_plus() and rtl_enable(). Signed-off-by: Hayes Wang --- drivers/net/usb/r8152.c | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 040ef73..537 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -1447,13 +1447,11 @@ static inline u8 rtl8152_get_speed(struct r8152 *tp) return ocp_read_byte(tp, MCU_TYPE_PLA, PLA_PHYSTATUS); } -static int rtl8152_enable(struct r8152 *tp) +static void rtl_set_eee_plus(struct r8152 *tp) { u32 ocp_data; - int i, ret; u8 speed; - set_tx_qlen(tp); speed = rtl8152_get_speed(tp); if (speed & _10bps) { ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_EEEP_CR); @@ -1464,6 +1462,12 @@ static int rtl8152_enable(struct r8152 *tp) ocp_data &= ~EEEP_CR_EEEP_TX; ocp_write_word(tp, MCU_TYPE_PLA, PLA_EEEP_CR, ocp_data); } +} + +static int rtl_enable(struct r8152 *tp) +{ + u32 ocp_data; + int i, ret; r8152b_reset_packet_filter(tp); @@ -1485,6 +1489,14 @@ static int rtl8152_enable(struct r8152 *tp) return ret; } +static int rtl8152_enable(struct r8152 *tp) +{ + set_tx_qlen(tp); + rtl_set_eee_plus(tp); + + return rtl_enable(tp); +} + static void rtl8152_disable(struct r8152 *tp) { struct net_device_stats *stats = rtl8152_get_stats(tp->netdev); -- 1.8.3.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 net-next 3/6] r8152: change some definitions
Replace RX_BUF_THR with RX_THR_HIGH. Replace RWSUME_INDICATE with RESUME_INDICATE. Add CRC_SIZE, TX_ALIGN, and RX_ALIGN. Signed-off-by: Hayes Wang --- drivers/net/usb/r8152.c | 27 --- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index b8bc3eb..a8ea848 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -209,7 +209,7 @@ #define TX_AGG_MAX_THRESHOLD 0x03 /* USB_RX_BUF_TH */ -#define RX_BUF_THR 0x7a120180 +#define RX_THR_HIGH0x7a120180 /* USB_TX_DMA */ #define TEST_MODE_DISABLE 0x0001 @@ -219,7 +219,7 @@ #define POWER_CUT 0x0100 /* USB_PM_CTRL_STATUS */ -#define RWSUME_INDICATE0x0001 +#define RESUME_INDICATE0x0001 /* USB_USB_CTRL */ #define RX_AGG_DISABLE 0x0010 @@ -274,6 +274,9 @@ enum rtl_register_content { #define RTL8152_MAX_TX 10 #define RTL8152_MAX_RX 10 #define INTBUFSIZE 2 +#define CRC_SIZE 4 +#define TX_ALIGN 4 +#define RX_ALIGN 8 #define INTR_LINK 0x0004 @@ -916,12 +919,12 @@ resubmit: static inline void *rx_agg_align(void *data) { - return (void *)ALIGN((uintptr_t)data, 8); + return (void *)ALIGN((uintptr_t)data, RX_ALIGN); } static inline void *tx_agg_align(void *data) { - return (void *)ALIGN((uintptr_t)data, 4); + return (void *)ALIGN((uintptr_t)data, TX_ALIGN); } static void free_all_mem(struct r8152 *tp) @@ -990,7 +993,8 @@ static int alloc_all_mem(struct r8152 *tp) if (buf != rx_agg_align(buf)) { kfree(buf); - buf = kmalloc_node(rx_buf_sz + 8, GFP_KERNEL, node); + buf = kmalloc_node(rx_buf_sz + RX_ALIGN, GFP_KERNEL, + node); if (!buf) goto err1; } @@ -1015,7 +1019,8 @@ static int alloc_all_mem(struct r8152 *tp) if (buf != tx_agg_align(buf)) { kfree(buf); - buf = kmalloc_node(rx_buf_sz + 4, GFP_KERNEL, node); + buf = kmalloc_node(rx_buf_sz + TX_ALIGN, GFP_KERNEL, + node); if (!buf) goto err1; } @@ -1215,7 +1220,7 @@ static void rx_bottom(struct r8152 *tp) stats = rtl8152_get_stats(netdev); - pkt_len -= 4; /* CRC */ + pkt_len -= CRC_SIZE; /* CRC */ rx_data += sizeof(struct rx_desc); skb = netdev_alloc_skb_ip_align(netdev, pkt_len); @@ -1230,7 +1235,7 @@ static void rx_bottom(struct r8152 *tp) stats->rx_packets++; stats->rx_bytes += pkt_len; - rx_data = rx_agg_align(rx_data + pkt_len + 4); + rx_data = rx_agg_align(rx_data + pkt_len + CRC_SIZE); rx_desc = (struct rx_desc *)rx_data; len_used = (int)(rx_data - (u8 *)agg->head); len_used += sizeof(struct rx_desc); @@ -1580,7 +1585,7 @@ static void r8152b_exit_oob(struct r8152 *tp) ocp_write_dword(tp, MCU_TYPE_PLA, PLA_TXFIFO_CTRL, TXFIFO_THR_NORMAL); ocp_write_byte(tp, MCU_TYPE_USB, USB_TX_AGG, TX_AGG_MAX_THRESHOLD); - ocp_write_dword(tp, MCU_TYPE_USB, USB_RX_BUF_TH, RX_BUF_THR); + ocp_write_dword(tp, MCU_TYPE_USB, USB_RX_BUF_TH, RX_THR_HIGH); ocp_write_dword(tp, MCU_TYPE_USB, USB_TX_DMA, TEST_MODE_DISABLE | TX_SIZE_ADJUST1); @@ -1893,7 +1898,7 @@ static void r8152b_init(struct r8152 *tp) ocp_write_word(tp, MCU_TYPE_USB, USB_UPS_CTRL, ocp_data); ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS); - ocp_data &= ~RWSUME_INDICATE; + ocp_data &= ~RESUME_INDICATE; ocp_write_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS, ocp_data); r8152b_exit_oob(tp); @@ -2074,7 +2079,7 @@ static void rtl8152_unload(struct r8152 *tp) } ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS); - ocp_data &= ~RWSUME_INDICATE; + ocp_data &= ~RESUME_INDICATE; ocp_write_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS, ocp_data); } -- 1.8.3.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 net-next 2/6] r8152: modify the method of accessing PHY
The old method to access PHY is through mdio channel. Replace it with the OCP channel. Signed-off-by: Hayes Wang --- drivers/net/usb/r8152.c | 52 + 1 file changed, 18 insertions(+), 34 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 79bb553..b8bc3eb 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -98,6 +98,7 @@ #define OCP_EEE_CONFIG10x2080 #define OCP_EEE_CONFIG20x2092 #define OCP_EEE_CONFIG30x2094 +#define OCP_BASE_MII 0xa400 #define OCP_EEE_AR 0xa41a #define OCP_EEE_DATA 0xa41c @@ -653,7 +654,7 @@ static void ocp_write_byte(struct r8152 *tp, u16 type, u16 index, u32 data) generic_ocp_write(tp, index, byen, sizeof(tmp), &tmp, type); } -static void ocp_reg_write(struct r8152 *tp, u16 addr, u16 data) +static u16 ocp_reg_read(struct r8152 *tp, u16 addr) { u16 ocp_base, ocp_index; @@ -664,48 +665,31 @@ static void ocp_reg_write(struct r8152 *tp, u16 addr, u16 data) } ocp_index = (addr & 0x0fff) | 0xb000; - ocp_write_word(tp, MCU_TYPE_PLA, ocp_index, data); + return ocp_read_word(tp, MCU_TYPE_PLA, ocp_index); } -static void r8152_mdio_write(struct r8152 *tp, u32 reg_addr, u32 value) +static void ocp_reg_write(struct r8152 *tp, u16 addr, u16 data) { - u32 ocp_data; - int i; - - ocp_data = PHYAR_FLAG | ((reg_addr & 0x1f) << 16) | - (value & 0x); - - ocp_write_dword(tp, MCU_TYPE_PLA, PLA_PHYAR, ocp_data); + u16 ocp_base, ocp_index; - for (i = 20; i > 0; i--) { - udelay(25); - ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_PHYAR); - if (!(ocp_data & PHYAR_FLAG)) - break; + ocp_base = addr & 0xf000; + if (ocp_base != tp->ocp_base) { + ocp_write_word(tp, MCU_TYPE_PLA, PLA_OCP_GPHY_BASE, ocp_base); + tp->ocp_base = ocp_base; } - udelay(20); + + ocp_index = (addr & 0x0fff) | 0xb000; + ocp_write_word(tp, MCU_TYPE_PLA, ocp_index, data); } -static int r8152_mdio_read(struct r8152 *tp, u32 reg_addr) +static inline void r8152_mdio_write(struct r8152 *tp, u32 reg_addr, u32 value) { - u32 ocp_data; - int i; - - ocp_data = (reg_addr & 0x1f) << 16; - ocp_write_dword(tp, MCU_TYPE_PLA, PLA_PHYAR, ocp_data); - - for (i = 20; i > 0; i--) { - udelay(25); - ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_PHYAR); - if (ocp_data & PHYAR_FLAG) - break; - } - udelay(20); - - if (!(ocp_data & PHYAR_FLAG)) - return -EAGAIN; + ocp_reg_write(tp, OCP_BASE_MII + reg_addr * 2, value); +} - return (u16)(ocp_data & 0x); +static inline int r8152_mdio_read(struct r8152 *tp, u32 reg_addr) +{ + return ocp_reg_read(tp, OCP_BASE_MII + reg_addr * 2); } static int read_mii_word(struct net_device *netdev, int phy_id, int reg) -- 1.8.3.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
Re: [PATCH 1/1] usb: phy-generic: add the implementation of .set_suspend
On Thu, Dec 26, 2013 at 08:25:29PM -0600, Felipe Balbi wrote: > Hi, > > On Fri, Dec 27, 2013 at 09:40:24AM +0800, Peter Chen wrote: > > On Thu, Dec 26, 2013 at 09:58:01AM -0600, Felipe Balbi wrote: > > > On Thu, Dec 26, 2013 at 03:36:03PM +0800, Peter Chen wrote: > > > > Add clock enable/disable at .set_suspend if the PHY has > > > > suspend requirement, it can be benefit of power saving for > > > > phy and the whole system (parent clock may also be disabled). > > > > > > > > Signed-off-by: Peter Chen > > > > --- > > > > drivers/usb/phy/phy-generic.c | 10 ++ > > > > 1 files changed, 10 insertions(+), 0 deletions(-) > > > > > > > > diff --git a/drivers/usb/phy/phy-generic.c > > > > b/drivers/usb/phy/phy-generic.c > > > > index aa6d37b..4b20a97 100644 > > > > --- a/drivers/usb/phy/phy-generic.c > > > > +++ b/drivers/usb/phy/phy-generic.c > > > > @@ -65,6 +65,16 @@ EXPORT_SYMBOL(usb_nop_xceiv_unregister); > > > > > > > > static int nop_set_suspend(struct usb_phy *x, int suspend) > > > > { > > > > + struct usb_phy_gen_xceiv *nop = dev_get_drvdata(x->dev); > > > > + > > > > + if (IS_ERR(nop->clk)) > > > > + return 0; > > > > + > > > > + if (suspend) > > > > + clk_disable_unprepare(nop->clk); > > > > + else > > > > + clk_prepare_enable(nop->clk); > > > > > > heh, this is why I don't like clk_enable_prepare(). > > > usb_phy_set_suspend() can be called from atomic context. > > > > > > > Oh, then, how can we disable/enable phy's clock at runtime/system-side > > pm? Create another APIs like usb_phy_set_clk()? > > clk_prepare() on probe, clk_unprepare() on remove, > clk_enable()/disable() on set_suspend() > It will keep phy's clock prepare_count is always 1, assume one use case, the pll clk is the parent of phy clk, it will cause the pll clk can't be unprepared during the runtime, it may cause the pll can't be powered off during the runtime. -- Best Regards, Peter Chen -- 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 v9 03/12] usb: phy-mxs: Add auto clock and power setting
The auto setting is used to open related power and clocks automatically after receiving wakeup signal. With this feature, the PHY's clock and power can be recovered correctly from low power mode, it is guaranteed by IC logic. Signed-off-by: Peter Chen --- drivers/usb/phy/phy-mxs-usb.c | 20 +--- 1 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 6d49040..0c6f3bc 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -31,6 +31,11 @@ #define BM_USBPHY_CTRL_SFTRST BIT(31) #define BM_USBPHY_CTRL_CLKGATE BIT(30) +#define BM_USBPHY_CTRL_ENAUTOSET_USBCLKS BIT(26) +#define BM_USBPHY_CTRL_ENAUTOCLR_USBCLKGATEBIT(25) +#define BM_USBPHY_CTRL_ENAUTOCLR_PHY_PWD BIT(20) +#define BM_USBPHY_CTRL_ENAUTOCLR_CLKGATE BIT(19) +#define BM_USBPHY_CTRL_ENAUTO_PWRON_PLLBIT(18) #define BM_USBPHY_CTRL_ENUTMILEVEL3BIT(15) #define BM_USBPHY_CTRL_ENUTMILEVEL2BIT(14) #define BM_USBPHY_CTRL_ENHOSTDISCONDETECT BIT(1) @@ -96,9 +101,18 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) /* Power up the PHY */ writel(0, base + HW_USBPHY_PWD); - /* enable FS/LS device */ - writel(BM_USBPHY_CTRL_ENUTMILEVEL2 | - BM_USBPHY_CTRL_ENUTMILEVEL3, + /* +* USB PHY Ctrl Setting +* - Auto clock/power on +* - Enable full/low speed support +*/ + writel(BM_USBPHY_CTRL_ENAUTOSET_USBCLKS | + BM_USBPHY_CTRL_ENAUTOCLR_USBCLKGATE | + BM_USBPHY_CTRL_ENAUTOCLR_PHY_PWD | + BM_USBPHY_CTRL_ENAUTOCLR_CLKGATE | + BM_USBPHY_CTRL_ENAUTO_PWRON_PLL | + BM_USBPHY_CTRL_ENUTMILEVEL2 | + BM_USBPHY_CTRL_ENUTMILEVEL3, base + HW_USBPHY_CTRL_SET); return 0; -- 1.7.8 -- 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 v9 00/12] Add power management support for mxs phy
Hi Felipe & Shawn, The serial adds power management support for MXS PHY, it includes: - Add one PHY API .set_wakeup, and related API implementation at mxs phy driver - misc changes and bug fixes for mxs phy to support low power mode and wakeup. It is based on the lastest Greg's usb-next, 3.13-rc5. Changes for v9: - Fix the build warning if CONFIG_SUSPEND is not set Changes for v8: - Shawn has already applied two dts patches, so delete them at v8 version, http://marc.info/?l=linux-arm-kernel&m=138785188404939&w=2 - Using of_get_property to avoid imx6 fail at probe when using old DTB [5/12] - Do not consider failure if alias id is not existed, it can avoid fail at probe when using old DTB [8/12] - We don't need more changes for [8/12] change due to we use "mxs_phy->port_id ==" as condition Changes for v7: - Fixed indentation problem at binding doc [1/14] - s/ganranteed/guaranteed, and add explanation for "auto setting" [3/14] - add static before SIMPLE_DEV_PM_OPS [13/14] - add one patch to change usb device description [7/14] - Delete the .nofity_suspend and .notify_resume due to Felipe does not agree to add them as PHY API, will use other ways to implement them in future. Changes for v6: - Add description for IC bug fixes logic. [9/15] - Move is_imx6q_phy and is_imx6sl_phy from [9/15] to [14/15] - %s/mxs_phy_clock_switch/mxs_phy_clock_switch_delay to reflect the function meaning more precise [15/15] Changes for v5: Add Marc and Michael Grzeschik's commnets - typo error at [2/15] - sqhash patches which introducing mxs_phy_disconnect_line and fixed but at this function. [13/15] - Introducing flag MXS_PHY_NEED_IP_FIX who stands for the SoCs who have IC fixes. [2/15, 8/15] - Delete one patch for low speed connection problem at every rare situations due to the root cause has still not found. Peter Chen (12): usb: doc: phy-mxs: Add more compatible strings usb: phy-mxs: Add platform judgement code usb: phy-mxs: Add auto clock and power setting usb: doc: phy-mxs: update binding for adding anatop phandle usb: phy-mxs: Add anatop regmap usb: phy-mxs: change description of usb device speed usb: phy-mxs: Enable IC fixes for related SoCs usb: phy-mxs: add controller id usb: phy: Add set_wakeup API usb: phy-mxs: Add implementation of set_wakeup usb: phy-mxs: Add system suspend/resume API usb: phy-mxs: Add sync time after controller clear phcd Documentation/devicetree/bindings/usb/mxs-phy.txt |5 +- drivers/usb/phy/phy-mxs-usb.c | 310 - include/linux/usb/phy.h | 16 + 3 files changed, 316 insertions(+), 15 deletions(-) -- 1.7.8 -- 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 v9 02/12] usb: phy-mxs: Add platform judgement code
The mxs-phy has several bugs and features at different versions, the driver code can get it through of_device_id.data. Signed-off-by: Peter Chen --- drivers/usb/phy/phy-mxs-usb.c | 58 ++-- 1 files changed, 49 insertions(+), 9 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 545844b..6d49040 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -1,5 +1,5 @@ /* - * Copyright 2012 Freescale Semiconductor, Inc. + * Copyright 2012-2013 Freescale Semiconductor, Inc. * Copyright (C) 2012 Marek Vasut * on behalf of DENX Software Engineering GmbH * @@ -20,6 +20,7 @@ #include #include #include +#include #define DRIVER_NAME "mxs_phy" @@ -34,13 +35,55 @@ #define BM_USBPHY_CTRL_ENUTMILEVEL2BIT(14) #define BM_USBPHY_CTRL_ENHOSTDISCONDETECT BIT(1) +#define to_mxs_phy(p) container_of((p), struct mxs_phy, phy) + +/* Do disconnection between PHY and controller without vbus */ +#define MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS BIT(0) + +/* + * The PHY will be in messy if there is a wakeup after putting + * bus to suspend (set portsc.suspendM) but before setting PHY to low + * power mode (set portsc.phcd). + */ +#define MXS_PHY_ABNORMAL_IN_SUSPENDBIT(1) + +/* + * The SOF sends too fast after resuming, it will cause disconnection + * between host and high speed device. + */ +#define MXS_PHY_SENDING_SOF_TOO_FAST BIT(2) + +struct mxs_phy_data { + unsigned int flags; +}; + +static const struct mxs_phy_data imx23_phy_data = { + .flags = MXS_PHY_ABNORMAL_IN_SUSPEND | MXS_PHY_SENDING_SOF_TOO_FAST, +}; + +static const struct mxs_phy_data imx6q_phy_data = { + .flags = MXS_PHY_SENDING_SOF_TOO_FAST | + MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS, +}; + +static const struct mxs_phy_data imx6sl_phy_data = { + .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS, +}; + +static const struct of_device_id mxs_phy_dt_ids[] = { + { .compatible = "fsl,imx6sl-usbphy", .data = &imx6sl_phy_data, }, + { .compatible = "fsl,imx6q-usbphy", .data = &imx6q_phy_data, }, + { .compatible = "fsl,imx23-usbphy", .data = &imx23_phy_data, }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, mxs_phy_dt_ids); + struct mxs_phy { struct usb_phy phy; struct clk *clk; + const struct mxs_phy_data *data; }; -#define to_mxs_phy(p) container_of((p), struct mxs_phy, phy) - static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) { int ret; @@ -131,6 +174,8 @@ static int mxs_phy_probe(struct platform_device *pdev) struct clk *clk; struct mxs_phy *mxs_phy; int ret; + const struct of_device_id *of_id = + of_match_device(mxs_phy_dt_ids, &pdev->dev); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(&pdev->dev, res); @@ -163,6 +208,7 @@ static int mxs_phy_probe(struct platform_device *pdev) ATOMIC_INIT_NOTIFIER_HEAD(&mxs_phy->phy.notifier); mxs_phy->clk = clk; + mxs_phy->data = of_id->data; platform_set_drvdata(pdev, mxs_phy); @@ -182,12 +228,6 @@ static int mxs_phy_remove(struct platform_device *pdev) return 0; } -static const struct of_device_id mxs_phy_dt_ids[] = { - { .compatible = "fsl,imx23-usbphy", }, - { /* sentinel */ } -}; -MODULE_DEVICE_TABLE(of, mxs_phy_dt_ids); - static struct platform_driver mxs_phy_driver = { .probe = mxs_phy_probe, .remove = mxs_phy_remove, -- 1.7.8 -- 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 v9 05/12] usb: phy-mxs: Add anatop regmap
It is needed by imx6 SoC series, but not for imx23 and imx28. Signed-off-by: Peter Chen --- drivers/usb/phy/phy-mxs-usb.c | 15 +++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 0c6f3bc..12671c5 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -21,6 +21,8 @@ #include #include #include +#include +#include #define DRIVER_NAME "mxs_phy" @@ -87,6 +89,7 @@ struct mxs_phy { struct usb_phy phy; struct clk *clk; const struct mxs_phy_data *data; + struct regmap *regmap_anatop; }; static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) @@ -190,6 +193,7 @@ static int mxs_phy_probe(struct platform_device *pdev) int ret; const struct of_device_id *of_id = of_match_device(mxs_phy_dt_ids, &pdev->dev); + struct device_node *np = pdev->dev.of_node; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(&pdev->dev, res); @@ -209,6 +213,17 @@ static int mxs_phy_probe(struct platform_device *pdev) return -ENOMEM; } + /* Some SoCs don't have anatop registers */ + if (of_get_property(np, "fsl,anatop", NULL)) { + mxs_phy->regmap_anatop = syscon_regmap_lookup_by_phandle + (np, "fsl,anatop"); + if (IS_ERR(mxs_phy->regmap_anatop)) { + dev_dbg(&pdev->dev, + "failed to find regmap for anatop\n"); + return PTR_ERR(mxs_phy->regmap_anatop); + } + } + mxs_phy->phy.io_priv= base; mxs_phy->phy.dev= &pdev->dev; mxs_phy->phy.label = DRIVER_NAME; -- 1.7.8 -- 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 v9 12/12] usb: phy-mxs: Add sync time after controller clear phcd
After clear portsc.phcd, PHY needs 200us stable time for switch 32K clock to AHB clock. Signed-off-by: Peter Chen --- drivers/usb/phy/phy-mxs-usb.c | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 53b8dad..4652fc9 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -151,6 +151,15 @@ static inline bool is_imx6sl_phy(struct mxs_phy *mxs_phy) return mxs_phy->data == &imx6sl_phy_data; } +/* + * PHY needs some 32K cycles to switch from 32K clock to + * bus (such as AHB/AXI, etc) clock. + */ +static void mxs_phy_clock_switch_delay(void) +{ + usleep_range(300, 400); +} + static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) { int ret; @@ -260,6 +269,7 @@ static int mxs_phy_init(struct usb_phy *phy) { struct mxs_phy *mxs_phy = to_mxs_phy(phy); + mxs_phy_clock_switch_delay(); clk_prepare_enable(mxs_phy->clk); return mxs_phy_hw_init(mxs_phy); } @@ -284,6 +294,7 @@ static int mxs_phy_suspend(struct usb_phy *x, int suspend) x->io_priv + HW_USBPHY_CTRL_SET); clk_disable_unprepare(mxs_phy->clk); } else { + mxs_phy_clock_switch_delay(); clk_prepare_enable(mxs_phy->clk); writel(BM_USBPHY_CTRL_CLKGATE, x->io_priv + HW_USBPHY_CTRL_CLR); -- 1.7.8 -- 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 v9 01/12] usb: doc: phy-mxs: Add more compatible strings
Add "fsl,imx6q-usbphy" for imx6dq and imx6dl, add "fsl,imx6sl-usbphy" for imx6sl. Signed-off-by: Peter Chen --- Documentation/devicetree/bindings/usb/mxs-phy.txt |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/mxs-phy.txt b/Documentation/devicetree/bindings/usb/mxs-phy.txt index 5835b27..b43d4c9e 100644 --- a/Documentation/devicetree/bindings/usb/mxs-phy.txt +++ b/Documentation/devicetree/bindings/usb/mxs-phy.txt @@ -1,7 +1,8 @@ * Freescale MXS USB Phy Device Required properties: -- compatible: Should be "fsl,imx23-usbphy" +- compatible: "fsl,imx23-usbphy" for imx23 and imx28, "fsl,imx6q-usbphy" + for imx6dq and imx6dl, "fsl,imx6sl-usbphy" for imx6sl - reg: Should contain registers location and length - interrupts: Should contain phy interrupt -- 1.7.8 -- 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 v9 04/12] usb: doc: phy-mxs: update binding for adding anatop phandle
Add anatop phandle which is used to access anatop registers to control PHY's power and other USB operations. Signed-off-by: Peter Chen --- Documentation/devicetree/bindings/usb/mxs-phy.txt |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/mxs-phy.txt b/Documentation/devicetree/bindings/usb/mxs-phy.txt index b43d4c9e..fc6659d 100644 --- a/Documentation/devicetree/bindings/usb/mxs-phy.txt +++ b/Documentation/devicetree/bindings/usb/mxs-phy.txt @@ -5,10 +5,12 @@ Required properties: for imx6dq and imx6dl, "fsl,imx6sl-usbphy" for imx6sl - reg: Should contain registers location and length - interrupts: Should contain phy interrupt +- fsl,anatop: phandle for anatop register, it is only for imx6 SoC series Example: usbphy1: usbphy@020c9000 { compatible = "fsl,imx6q-usbphy", "fsl,imx23-usbphy"; reg = <0x020c9000 0x1000>; interrupts = <0 44 0x04>; + fsl,anatop = <&anatop>; }; -- 1.7.8 -- 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 v9 11/12] usb: phy-mxs: Add system suspend/resume API
We need this to keep PHY's power on or off during the system suspend mode. If we need to enable USB wakeup, then we must keep PHY's power being on during the system suspend mode. Otherwise, we need to keep PHY's power being off to save power. Signed-off-by: Peter Chen --- drivers/usb/phy/phy-mxs-usb.c | 61 + 1 files changed, 61 insertions(+), 0 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 96aac05..53b8dad 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -57,6 +57,10 @@ #define BM_USBPHY_DEBUG_CLKGATEBIT(30) /* Anatop Registers */ +#define ANADIG_ANA_MISC0 0x150 +#define ANADIG_ANA_MISC0_SET 0x154 +#define ANADIG_ANA_MISC0_CLR 0x158 + #define ANADIG_USB1_VBUS_DET_STAT 0x1c0 #define ANADIG_USB2_VBUS_DET_STAT 0x220 @@ -65,6 +69,9 @@ #define ANADIG_USB2_LOOPBACK_SET 0x244 #define ANADIG_USB2_LOOPBACK_CLR 0x248 +#define BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG BIT(12) +#define BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG_SL BIT(11) + #define BM_ANADIG_USB1_VBUS_DET_STAT_VBUS_VALIDBIT(3) #define BM_ANADIG_USB2_VBUS_DET_STAT_VBUS_VALIDBIT(3) @@ -134,6 +141,16 @@ struct mxs_phy { int port_id; }; +static inline bool is_imx6q_phy(struct mxs_phy *mxs_phy) +{ + return mxs_phy->data == &imx6q_phy_data; +} + +static inline bool is_imx6sl_phy(struct mxs_phy *mxs_phy) +{ + return mxs_phy->data == &imx6sl_phy_data; +} + static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) { int ret; @@ -382,6 +399,8 @@ static int mxs_phy_probe(struct platform_device *pdev) platform_set_drvdata(pdev, mxs_phy); + device_set_wakeup_capable(&pdev->dev, true); + ret = usb_add_phy_dev(&mxs_phy->phy); if (ret) return ret; @@ -398,6 +417,47 @@ static int mxs_phy_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static void mxs_phy_enable_ldo_in_suspend(struct mxs_phy *mxs_phy, bool on) +{ + unsigned int reg = on ? ANADIG_ANA_MISC0_SET : ANADIG_ANA_MISC0_CLR; + + /* If the SoCs don't have anatop, quit */ + if (!mxs_phy->regmap_anatop) + return; + + if (is_imx6q_phy(mxs_phy)) + regmap_write(mxs_phy->regmap_anatop, reg, + BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG); + else if (is_imx6sl_phy(mxs_phy)) + regmap_write(mxs_phy->regmap_anatop, + reg, BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG_SL); +} + +static int mxs_phy_system_suspend(struct device *dev) +{ + struct mxs_phy *mxs_phy = dev_get_drvdata(dev); + + if (device_may_wakeup(dev)) + mxs_phy_enable_ldo_in_suspend(mxs_phy, true); + + return 0; +} + +static int mxs_phy_system_resume(struct device *dev) +{ + struct mxs_phy *mxs_phy = dev_get_drvdata(dev); + + if (device_may_wakeup(dev)) + mxs_phy_enable_ldo_in_suspend(mxs_phy, false); + + return 0; +} +#endif /* CONFIG_PM_SLEEP */ + +static SIMPLE_DEV_PM_OPS(mxs_phy_pm, mxs_phy_system_suspend, + mxs_phy_system_resume); + static struct platform_driver mxs_phy_driver = { .probe = mxs_phy_probe, .remove = mxs_phy_remove, @@ -405,6 +465,7 @@ static struct platform_driver mxs_phy_driver = { .name = DRIVER_NAME, .owner = THIS_MODULE, .of_match_table = mxs_phy_dt_ids, + .pm = &mxs_phy_pm, }, }; -- 1.7.8 -- 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 v9 06/12] usb: phy-mxs: change description of usb device speed
Change "high speed" to "HS" Change "non-high speed" to "FS/LS" Implementation of notify_suspend and notify_resume will be different according to mxs_phy_data->flags. Signed-off-by: Peter Chen --- drivers/usb/phy/phy-mxs-usb.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 12671c5..c53b327 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -161,8 +161,8 @@ static int mxs_phy_suspend(struct usb_phy *x, int suspend) static int mxs_phy_on_connect(struct usb_phy *phy, enum usb_device_speed speed) { - dev_dbg(phy->dev, "%s speed device has connected\n", - (speed == USB_SPEED_HIGH) ? "high" : "non-high"); + dev_dbg(phy->dev, "%s device has connected\n", + (speed == USB_SPEED_HIGH) ? "HS" : "FS/LS"); if (speed == USB_SPEED_HIGH) writel(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, @@ -174,8 +174,8 @@ static int mxs_phy_on_connect(struct usb_phy *phy, static int mxs_phy_on_disconnect(struct usb_phy *phy, enum usb_device_speed speed) { - dev_dbg(phy->dev, "%s speed device has disconnected\n", - (speed == USB_SPEED_HIGH) ? "high" : "non-high"); + dev_dbg(phy->dev, "%s device has disconnected\n", + (speed == USB_SPEED_HIGH) ? "HS" : "FS/LS"); if (speed == USB_SPEED_HIGH) writel(BM_USBPHY_CTRL_ENHOSTDISCONDETECT, -- 1.7.8 -- 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 v9 10/12] usb: phy-mxs: Add implementation of set_wakeup
When we need the PHY can be waken up by external signals, we can call this API. Besides, we call mxs_phy_disconnect_line at this API to close the connection between USB PHY and controller, after that, the line state from controller is SE0. Once the PHY is out of power, without calling mxs_phy_disconnect_line, there are unknown wakeups due to dp/dm floating at device mode. Signed-off-by: Peter Chen --- drivers/usb/phy/phy-mxs-usb.c | 116 + 1 files changed, 116 insertions(+), 0 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index c5300bc..96aac05 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -31,6 +31,9 @@ #define HW_USBPHY_CTRL_SET 0x34 #define HW_USBPHY_CTRL_CLR 0x38 +#define HW_USBPHY_DEBUG_SET0x54 +#define HW_USBPHY_DEBUG_CLR0x58 + #define HW_USBPHY_IP 0x90 #define HW_USBPHY_IP_SET 0x94 #define HW_USBPHY_IP_CLR 0x98 @@ -39,6 +42,9 @@ #define BM_USBPHY_CTRL_CLKGATE BIT(30) #define BM_USBPHY_CTRL_ENAUTOSET_USBCLKS BIT(26) #define BM_USBPHY_CTRL_ENAUTOCLR_USBCLKGATEBIT(25) +#define BM_USBPHY_CTRL_ENVBUSCHG_WKUP BIT(23) +#define BM_USBPHY_CTRL_ENIDCHG_WKUPBIT(22) +#define BM_USBPHY_CTRL_ENDPDMCHG_WKUP BIT(21) #define BM_USBPHY_CTRL_ENAUTOCLR_PHY_PWD BIT(20) #define BM_USBPHY_CTRL_ENAUTOCLR_CLKGATE BIT(19) #define BM_USBPHY_CTRL_ENAUTO_PWRON_PLLBIT(18) @@ -48,6 +54,25 @@ #define BM_USBPHY_IP_FIX (BIT(17) | BIT(18)) +#define BM_USBPHY_DEBUG_CLKGATEBIT(30) + +/* Anatop Registers */ +#define ANADIG_USB1_VBUS_DET_STAT 0x1c0 +#define ANADIG_USB2_VBUS_DET_STAT 0x220 + +#define ANADIG_USB1_LOOPBACK_SET 0x1e4 +#define ANADIG_USB1_LOOPBACK_CLR 0x1e8 +#define ANADIG_USB2_LOOPBACK_SET 0x244 +#define ANADIG_USB2_LOOPBACK_CLR 0x248 + +#define BM_ANADIG_USB1_VBUS_DET_STAT_VBUS_VALIDBIT(3) +#define BM_ANADIG_USB2_VBUS_DET_STAT_VBUS_VALIDBIT(3) + +#define BM_ANADIG_USB1_LOOPBACK_UTMI_DIG_TST1 BIT(2) +#define BM_ANADIG_USB1_LOOPBACK_TSTI_TX_EN BIT(5) +#define BM_ANADIG_USB2_LOOPBACK_UTMI_DIG_TST1 BIT(2) +#define BM_ANADIG_USB2_LOOPBACK_TSTI_TX_EN BIT(5) + #define to_mxs_phy(p) container_of((p), struct mxs_phy, phy) /* Do disconnection between PHY and controller without vbus */ @@ -141,6 +166,79 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) return 0; } +/* Return true if the vbus is there */ +static bool mxs_phy_get_vbus_status(struct mxs_phy *mxs_phy) +{ + unsigned int vbus_value; + + if (mxs_phy->port_id == 0) + regmap_read(mxs_phy->regmap_anatop, + ANADIG_USB1_VBUS_DET_STAT, + &vbus_value); + else if (mxs_phy->port_id == 1) + regmap_read(mxs_phy->regmap_anatop, + ANADIG_USB2_VBUS_DET_STAT, + &vbus_value); + + if (vbus_value & BM_ANADIG_USB1_VBUS_DET_STAT_VBUS_VALID) + return true; + else + return false; +} + +static void __mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool disconnect) +{ + void __iomem *base = mxs_phy->phy.io_priv; + u32 reg; + + if (disconnect) + writel_relaxed(BM_USBPHY_DEBUG_CLKGATE, + base + HW_USBPHY_DEBUG_CLR); + + if (mxs_phy->port_id == 0) { + reg = disconnect ? ANADIG_USB1_LOOPBACK_SET + : ANADIG_USB1_LOOPBACK_CLR; + regmap_write(mxs_phy->regmap_anatop, reg, + BM_ANADIG_USB1_LOOPBACK_UTMI_DIG_TST1 | + BM_ANADIG_USB1_LOOPBACK_TSTI_TX_EN); + } else if (mxs_phy->port_id == 1) { + reg = disconnect ? ANADIG_USB2_LOOPBACK_SET + : ANADIG_USB2_LOOPBACK_CLR; + regmap_write(mxs_phy->regmap_anatop, reg, + BM_ANADIG_USB2_LOOPBACK_UTMI_DIG_TST1 | + BM_ANADIG_USB2_LOOPBACK_TSTI_TX_EN); + } + + if (!disconnect) + writel_relaxed(BM_USBPHY_DEBUG_CLKGATE, + base + HW_USBPHY_DEBUG_SET); + + /* Delay some time, and let Linestate be SE0 for controller */ + if (disconnect) + usleep_range(500, 1000); +} + +static void mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool on) +{ + bool vbus_is_on = false; + + /* If the SoCs don't need to disconnect line without vbus, quit */ + if (!(mxs_phy->data->flags & MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS)) + return; + + /* If the SoCs don't have anatop, quit */ + if (!mxs_phy->regmap_anatop) +
[PATCH v9 09/12] usb: phy: Add set_wakeup API
This API is used to set wakeup enable at PHY registers, in that case, the PHY can be waken up from suspend due to external events, like vbus change, dp/dm change and id change. Signed-off-by: Peter Chen --- include/linux/usb/phy.h | 16 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h index 6c0b1c5..c2c6f49 100644 --- a/include/linux/usb/phy.h +++ b/include/linux/usb/phy.h @@ -111,6 +111,13 @@ struct usb_phy { int (*set_suspend)(struct usb_phy *x, int suspend); + /* +* Set wakeup enable for PHY, in that case, the PHY can be +* waken up from suspend status due to external events, +* like vbus change, dp/dm change and id. +*/ + int (*set_wakeup)(struct usb_phy *x, bool enabled); + /* notify phy connect status change */ int (*notify_connect)(struct usb_phy *x, enum usb_device_speed speed); @@ -265,6 +272,15 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend) } static inline int +usb_phy_set_wakeup(struct usb_phy *x, bool enabled) +{ + if (x && x->set_wakeup) + return x->set_wakeup(x, enabled); + else + return 0; +} + +static inline int usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed) { if (x && x->notify_connect) -- 1.7.8 -- 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 v9 08/12] usb: phy-mxs: add controller id
It is used to access un-regulator registers according to different controllers. Signed-off-by: Peter Chen --- drivers/usb/phy/phy-mxs-usb.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index bf22970..c5300bc 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -106,6 +106,7 @@ struct mxs_phy { struct clk *clk; const struct mxs_phy_data *data; struct regmap *regmap_anatop; + int port_id; }; static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) @@ -243,6 +244,11 @@ static int mxs_phy_probe(struct platform_device *pdev) } } + ret = of_alias_get_id(np, "usbphy"); + if (ret < 0) + dev_dbg(&pdev->dev, "failed to get alias id, errno %d\n", ret); + mxs_phy->port_id = ret; + mxs_phy->phy.io_priv= base; mxs_phy->phy.dev= &pdev->dev; mxs_phy->phy.label = DRIVER_NAME; -- 1.7.8 -- 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 v9 07/12] usb: phy-mxs: Enable IC fixes for related SoCs
Two PHY bugs are fixed by IC logic, but these bits are not enabled by default, so we enable them at driver. The two bugs are: MXS_PHY_ABNORMAL_IN_SUSPEND and MXS_PHY_SENDING_SOF_TOO_FAST which are described at code. Signed-off-by: Peter Chen --- drivers/usb/phy/phy-mxs-usb.c | 23 +-- 1 files changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index c53b327..bf22970 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -31,6 +31,10 @@ #define HW_USBPHY_CTRL_SET 0x34 #define HW_USBPHY_CTRL_CLR 0x38 +#define HW_USBPHY_IP 0x90 +#define HW_USBPHY_IP_SET 0x94 +#define HW_USBPHY_IP_CLR 0x98 + #define BM_USBPHY_CTRL_SFTRST BIT(31) #define BM_USBPHY_CTRL_CLKGATE BIT(30) #define BM_USBPHY_CTRL_ENAUTOSET_USBCLKS BIT(26) @@ -42,6 +46,8 @@ #define BM_USBPHY_CTRL_ENUTMILEVEL2BIT(14) #define BM_USBPHY_CTRL_ENHOSTDISCONDETECT BIT(1) +#define BM_USBPHY_IP_FIX (BIT(17) | BIT(18)) + #define to_mxs_phy(p) container_of((p), struct mxs_phy, phy) /* Do disconnection between PHY and controller without vbus */ @@ -60,6 +66,14 @@ */ #define MXS_PHY_SENDING_SOF_TOO_FAST BIT(2) +/* + * IC has bug fixes logic, they include + * MXS_PHY_ABNORMAL_IN_SUSPEND and MXS_PHY_SENDING_SOF_TOO_FAST + * which are described at above flags, the RTL will handle it + * according to different versions. + */ +#define MXS_PHY_NEED_IP_FIXBIT(3) + struct mxs_phy_data { unsigned int flags; }; @@ -70,11 +84,13 @@ static const struct mxs_phy_data imx23_phy_data = { static const struct mxs_phy_data imx6q_phy_data = { .flags = MXS_PHY_SENDING_SOF_TOO_FAST | - MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS, + MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS | + MXS_PHY_NEED_IP_FIX, }; static const struct mxs_phy_data imx6sl_phy_data = { - .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS, + .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS | + MXS_PHY_NEED_IP_FIX, }; static const struct of_device_id mxs_phy_dt_ids[] = { @@ -118,6 +134,9 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) BM_USBPHY_CTRL_ENUTMILEVEL3, base + HW_USBPHY_CTRL_SET); + if (mxs_phy->data->flags & MXS_PHY_NEED_IP_FIX) + writel(BM_USBPHY_IP_FIX, base + HW_USBPHY_IP_SET); + return 0; } -- 1.7.8 -- 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 0/7] Chipidea Fix for 3.13-rc2
On Thu, Dec 05, 2013 at 03:20:48PM +0800, Peter Chen wrote: > Hi Greg, > > This patchset includes chipidea fixes for 3.13-rc2, the mainly > fixes include add correct imx28 write register method, fixing > un-initialized variable, etc. > > Chris Ruehl (2): > usb: chipidea: Fix Internal error: : 808 [#1] ARM related to STS flag > usb: chipidea: put hw_phymode_configure before ci_usb_phy_init > > Fabio Estevam (1): > usb: chipidea: host: Only disable the vbus regulator if it is not > NULL > > Peter Chen (4): > usb: chipidea: fix nobody cared IRQ when booting with host role > usb: ehci: add freescale imx28 special write register method > usb: chipidea: add freescale imx28 special write register method > usb: chipidea: imx: set CI_HDRC_IMX28_WRITE_FIX for imx28 > Hi Greg, > usb: chipidea: host: Only disable the vbus regulator if it is not > NULL > usb: chipidea: fix nobody cared IRQ when booting with host role The above 2 patches are already at your usb-linus three. I will take 2 Chris's patches to 3.14, the below three imx28 special write patches are needed for 3.13 if the time is admitted. Thanks. > usb: ehci: add freescale imx28 special write register method > usb: chipidea: add freescale imx28 special write register method > usb: chipidea: imx: set CI_HDRC_IMX28_WRITE_FIX for imx28 -- Best Regards, Peter Chen -- 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