* [PATCH v2 0/2] usb: host: ehci-platform: fix usb 1.1 device is not connected in system resume @ 2017-02-21 10:59 Yoshihiro Shimoda 2017-02-21 10:59 ` [PATCH v2 1/2] usb: of: add functions to bind a companion controller Yoshihiro Shimoda [not found] ` <1487674788-12599-1-git-send-email-yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org> 0 siblings, 2 replies; 6+ messages in thread From: Yoshihiro Shimoda @ 2017-02-21 10:59 UTC (permalink / raw) To: stern, gregkh, robh+dt, mark.rutland Cc: linux-usb, devicetree, linux-renesas-soc, Yoshihiro Shimoda This patch set is based on Greg's usb.git / usb-next branch (the commit id = 0df8a3dbacb585bb9c8b2e55de43c6aac9d86488). This patch set is related to the following email threads: http://marc.info/?t=148653514200001&r=1&w=2 http://marc.info/?t=148712534300005&r=1&w=2 Changes from v1 as RFC: - Remove usb_of_has_companion() API. Yoshihiro Shimoda (2): usb: of: add functions to bind a companion controller usb: host: ehci-platform: fix usb 1.1 device is not connected in system resume Documentation/devicetree/bindings/usb/generic.txt | 1 + drivers/usb/core/of.c | 23 +++++++++++++++++++++++ drivers/usb/host/ehci-platform.c | 7 +++++++ include/linux/usb/of.h | 5 +++++ 4 files changed, 36 insertions(+) -- 1.9.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] usb: of: add functions to bind a companion controller 2017-02-21 10:59 [PATCH v2 0/2] usb: host: ehci-platform: fix usb 1.1 device is not connected in system resume Yoshihiro Shimoda @ 2017-02-21 10:59 ` Yoshihiro Shimoda 2017-02-27 20:50 ` Rob Herring 2017-02-28 1:03 ` Peter Chen [not found] ` <1487674788-12599-1-git-send-email-yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org> 1 sibling, 2 replies; 6+ messages in thread From: Yoshihiro Shimoda @ 2017-02-21 10:59 UTC (permalink / raw) To: stern, gregkh, robh+dt, mark.rutland Cc: linux-usb, devicetree, linux-renesas-soc, Yoshihiro Shimoda EHCI controllers will have a companion controller. However, on platform bus, there was difficult to bind them in previous code. So, this patch adds helper functions to bind them using a "companion" property. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> --- Documentation/devicetree/bindings/usb/generic.txt | 1 + drivers/usb/core/of.c | 23 +++++++++++++++++++++++ include/linux/usb/of.h | 5 +++++ 3 files changed, 29 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/generic.txt b/Documentation/devicetree/bindings/usb/generic.txt index bfadeb1..0a74ab8 100644 --- a/Documentation/devicetree/bindings/usb/generic.txt +++ b/Documentation/devicetree/bindings/usb/generic.txt @@ -22,6 +22,7 @@ Optional properties: property is used if any real OTG features(HNP/SRP/ADP) is enabled, if ADP is required, otg-rev should be 0x0200 or above. + - companion: phandle of a companion - hnp-disable: tells OTG controllers we want to disable OTG HNP, normally HNP is the basic function of real OTG except you want it to be a srp-capable only B device. diff --git a/drivers/usb/core/of.c b/drivers/usb/core/of.c index 3de4f88..d787f19 100644 --- a/drivers/usb/core/of.c +++ b/drivers/usb/core/of.c @@ -18,6 +18,7 @@ */ #include <linux/of.h> +#include <linux/of_platform.h> #include <linux/usb/of.h> /** @@ -46,3 +47,25 @@ struct device_node *usb_of_get_child_node(struct device_node *parent, } EXPORT_SYMBOL_GPL(usb_of_get_child_node); +/** + * usb_of_get_companion_dev - Find the companion device + * @dev: the device pointer to find a companion + * + * Find the companion device from platform bus. + * + * Return: On success, a pointer to the companion device, %NULL on failure. + */ +struct device *usb_of_get_companion_dev(struct device *dev) +{ + struct device_node *node; + struct platform_device *pdev = NULL; + + node = of_parse_phandle(dev->of_node, "companion", 0); + if (node) + pdev = of_find_device_by_node(node); + + of_node_put(node); + + return pdev ? &pdev->dev : NULL; +} +EXPORT_SYMBOL_GPL(usb_of_get_companion_dev); diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h index 5ff9032..4031f47 100644 --- a/include/linux/usb/of.h +++ b/include/linux/usb/of.h @@ -18,6 +18,7 @@ int of_usb_update_otg_caps(struct device_node *np, struct usb_otg_caps *otg_caps); struct device_node *usb_of_get_child_node(struct device_node *parent, int portnum); +struct device *usb_of_get_companion_dev(struct device *dev); #else static inline enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *np, int arg0) @@ -38,6 +39,10 @@ static inline int of_usb_update_otg_caps(struct device_node *np, { return NULL; } +static inline struct device *usb_of_get_companion_dev(struct device *dev) +{ + return NULL; +} #endif #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT) -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] usb: of: add functions to bind a companion controller 2017-02-21 10:59 ` [PATCH v2 1/2] usb: of: add functions to bind a companion controller Yoshihiro Shimoda @ 2017-02-27 20:50 ` Rob Herring 2017-02-28 1:03 ` Peter Chen 1 sibling, 0 replies; 6+ messages in thread From: Rob Herring @ 2017-02-27 20:50 UTC (permalink / raw) To: Yoshihiro Shimoda Cc: stern, gregkh, mark.rutland, linux-usb, devicetree, linux-renesas-soc On Tue, Feb 21, 2017 at 07:59:47PM +0900, Yoshihiro Shimoda wrote: > EHCI controllers will have a companion controller. However, on platform > bus, there was difficult to bind them in previous code. So, this > patch adds helper functions to bind them using a "companion" property. > > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> > --- > Documentation/devicetree/bindings/usb/generic.txt | 1 + > drivers/usb/core/of.c | 23 +++++++++++++++++++++++ > include/linux/usb/of.h | 5 +++++ > 3 files changed, 29 insertions(+) Acked-by: Rob Herring <robh@kernel.org> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] usb: of: add functions to bind a companion controller 2017-02-21 10:59 ` [PATCH v2 1/2] usb: of: add functions to bind a companion controller Yoshihiro Shimoda 2017-02-27 20:50 ` Rob Herring @ 2017-02-28 1:03 ` Peter Chen 1 sibling, 0 replies; 6+ messages in thread From: Peter Chen @ 2017-02-28 1:03 UTC (permalink / raw) To: Yoshihiro Shimoda Cc: stern, gregkh, robh+dt, mark.rutland, linux-usb, devicetree, linux-renesas-soc On Tue, Feb 21, 2017 at 07:59:47PM +0900, Yoshihiro Shimoda wrote: > EHCI controllers will have a companion controller. However, on platform > bus, there was difficult to bind them in previous code. So, this > patch adds helper functions to bind them using a "companion" property. > > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> > --- > Documentation/devicetree/bindings/usb/generic.txt | 1 + > drivers/usb/core/of.c | 23 +++++++++++++++++++++++ > include/linux/usb/of.h | 5 +++++ > 3 files changed, 29 insertions(+) > > diff --git a/Documentation/devicetree/bindings/usb/generic.txt b/Documentation/devicetree/bindings/usb/generic.txt > index bfadeb1..0a74ab8 100644 > --- a/Documentation/devicetree/bindings/usb/generic.txt > +++ b/Documentation/devicetree/bindings/usb/generic.txt > @@ -22,6 +22,7 @@ Optional properties: > property is used if any real OTG features(HNP/SRP/ADP) > is enabled, if ADP is required, otg-rev should be > 0x0200 or above. > + - companion: phandle of a companion > - hnp-disable: tells OTG controllers we want to disable OTG HNP, normally HNP > is the basic function of real OTG except you want it > to be a srp-capable only B device. > diff --git a/drivers/usb/core/of.c b/drivers/usb/core/of.c > index 3de4f88..d787f19 100644 > --- a/drivers/usb/core/of.c > +++ b/drivers/usb/core/of.c > @@ -18,6 +18,7 @@ > */ > > #include <linux/of.h> > +#include <linux/of_platform.h> > #include <linux/usb/of.h> > > /** > @@ -46,3 +47,25 @@ struct device_node *usb_of_get_child_node(struct device_node *parent, > } > EXPORT_SYMBOL_GPL(usb_of_get_child_node); > > +/** > + * usb_of_get_companion_dev - Find the companion device > + * @dev: the device pointer to find a companion > + * > + * Find the companion device from platform bus. > + * > + * Return: On success, a pointer to the companion device, %NULL on failure. > + */ > +struct device *usb_of_get_companion_dev(struct device *dev) > +{ > + struct device_node *node; > + struct platform_device *pdev = NULL; > + > + node = of_parse_phandle(dev->of_node, "companion", 0); > + if (node) > + pdev = of_find_device_by_node(node); > + > + of_node_put(node); > + > + return pdev ? &pdev->dev : NULL; > +} > +EXPORT_SYMBOL_GPL(usb_of_get_companion_dev); > diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h > index 5ff9032..4031f47 100644 > --- a/include/linux/usb/of.h > +++ b/include/linux/usb/of.h > @@ -18,6 +18,7 @@ int of_usb_update_otg_caps(struct device_node *np, > struct usb_otg_caps *otg_caps); > struct device_node *usb_of_get_child_node(struct device_node *parent, > int portnum); > +struct device *usb_of_get_companion_dev(struct device *dev); > #else > static inline enum usb_dr_mode > of_usb_get_dr_mode_by_phy(struct device_node *np, int arg0) > @@ -38,6 +39,10 @@ static inline int of_usb_update_otg_caps(struct device_node *np, > { > return NULL; > } > +static inline struct device *usb_of_get_companion_dev(struct device *dev) > +{ > + return NULL; > +} > #endif > > #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT) Acked-by: Peter Chen <peter.chen@nxp.com> -- Best Regards, Peter Chen ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <1487674788-12599-1-git-send-email-yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>]
* [PATCH v2 2/2] usb: host: ehci-platform: fix usb 1.1 device is not connected in system resume [not found] ` <1487674788-12599-1-git-send-email-yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org> @ 2017-02-21 10:59 ` Yoshihiro Shimoda 2017-02-28 1:04 ` Peter Chen 0 siblings, 1 reply; 6+ messages in thread From: Yoshihiro Shimoda @ 2017-02-21 10:59 UTC (permalink / raw) To: stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8 Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA, Yoshihiro Shimoda This patch fixes an issue that a usb 1.1 device is not connected in system resume and then the following message appeared if debug messages are enabled: usb 2-1: Waited 2000ms for CONNECT To resolve this issue, the EHCI controller must be resumed after its companion controllers. So, this patch adds such code on the driver. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org> --- drivers/usb/host/ehci-platform.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index a268d9e..3214300 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -34,6 +34,7 @@ #include <linux/usb.h> #include <linux/usb/hcd.h> #include <linux/usb/ehci_pdriver.h> +#include <linux/usb/of.h> #include "ehci.h" @@ -297,6 +298,7 @@ static int ehci_platform_probe(struct platform_device *dev) goto err_power; device_wakeup_enable(hcd->self.controller); + device_enable_async_suspend(hcd->self.controller); platform_set_drvdata(dev, hcd); return err; @@ -370,6 +372,7 @@ static int ehci_platform_resume(struct device *dev) struct usb_ehci_pdata *pdata = dev_get_platdata(dev); struct platform_device *pdev = to_platform_device(dev); struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd); + struct device *companion_dev; if (pdata->power_on) { int err = pdata->power_on(pdev); @@ -377,6 +380,10 @@ static int ehci_platform_resume(struct device *dev) return err; } + companion_dev = usb_of_get_companion_dev(hcd->self.controller); + if (companion_dev) + device_pm_wait_for_dev(hcd->self.controller, companion_dev); + ehci_resume(hcd, priv->reset_on_resume); return 0; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] usb: host: ehci-platform: fix usb 1.1 device is not connected in system resume 2017-02-21 10:59 ` [PATCH v2 2/2] usb: host: ehci-platform: fix usb 1.1 device is not connected in system resume Yoshihiro Shimoda @ 2017-02-28 1:04 ` Peter Chen 0 siblings, 0 replies; 6+ messages in thread From: Peter Chen @ 2017-02-28 1:04 UTC (permalink / raw) To: Yoshihiro Shimoda Cc: stern, gregkh, robh+dt, mark.rutland, linux-usb, devicetree, linux-renesas-soc On Tue, Feb 21, 2017 at 07:59:48PM +0900, Yoshihiro Shimoda wrote: > This patch fixes an issue that a usb 1.1 device is not connected in > system resume and then the following message appeared if debug messages > are enabled: > usb 2-1: Waited 2000ms for CONNECT > > To resolve this issue, the EHCI controller must be resumed after its > companion controllers. So, this patch adds such code on the driver. > > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> > --- > drivers/usb/host/ehci-platform.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c > index a268d9e..3214300 100644 > --- a/drivers/usb/host/ehci-platform.c > +++ b/drivers/usb/host/ehci-platform.c > @@ -34,6 +34,7 @@ > #include <linux/usb.h> > #include <linux/usb/hcd.h> > #include <linux/usb/ehci_pdriver.h> > +#include <linux/usb/of.h> > > #include "ehci.h" > > @@ -297,6 +298,7 @@ static int ehci_platform_probe(struct platform_device *dev) > goto err_power; > > device_wakeup_enable(hcd->self.controller); > + device_enable_async_suspend(hcd->self.controller); > platform_set_drvdata(dev, hcd); > > return err; > @@ -370,6 +372,7 @@ static int ehci_platform_resume(struct device *dev) > struct usb_ehci_pdata *pdata = dev_get_platdata(dev); > struct platform_device *pdev = to_platform_device(dev); > struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd); > + struct device *companion_dev; > > if (pdata->power_on) { > int err = pdata->power_on(pdev); > @@ -377,6 +380,10 @@ static int ehci_platform_resume(struct device *dev) > return err; > } > > + companion_dev = usb_of_get_companion_dev(hcd->self.controller); > + if (companion_dev) > + device_pm_wait_for_dev(hcd->self.controller, companion_dev); > + > ehci_resume(hcd, priv->reset_on_resume); > return 0; Reviewed-by: Peter Chen <peter.chen@nxp.com> -- Best Regards, Peter Chen ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-02-28 1:04 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-02-21 10:59 [PATCH v2 0/2] usb: host: ehci-platform: fix usb 1.1 device is not connected in system resume Yoshihiro Shimoda 2017-02-21 10:59 ` [PATCH v2 1/2] usb: of: add functions to bind a companion controller Yoshihiro Shimoda 2017-02-27 20:50 ` Rob Herring 2017-02-28 1:03 ` Peter Chen [not found] ` <1487674788-12599-1-git-send-email-yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org> 2017-02-21 10:59 ` [PATCH v2 2/2] usb: host: ehci-platform: fix usb 1.1 device is not connected in system resume Yoshihiro Shimoda 2017-02-28 1:04 ` Peter Chen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).