Message ID | 1470646331-23227-6-git-send-email-peter.chen@nxp.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
Quoting Peter Chen (2016-08-08 01:52:10) > From: Peter Chen <peter.chen@freescale.com> > > At device tree, we have no device node for chipidea core, > the glue layer's node is the parent node for host and udc > device. But in related driver, the parent device is chipidea > core. So, in order to let the common driver get parent's node, > we let the core's device node equals glue layer device node. > > Signed-off-by: Peter Chen <peter.chen@freescale.com> > Tested-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name> > Tested-by Joshua Clayton <stillcompiling@gmail.com> > --- > drivers/usb/chipidea/core.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c > index 69426e6..b189dc7 100644 > --- a/drivers/usb/chipidea/core.c > +++ b/drivers/usb/chipidea/core.c > @@ -954,6 +954,15 @@ static int ci_hdrc_probe(struct platform_device *pdev) > dev_err(dev, "unable to init phy: %d\n", ret); > return ret; > } > + /* > + * At device tree, we have no device node for chipidea core, > + * the glue layer's node is the parent node for host and udc > + * device. But in related driver, the parent device is chipidea > + * core. So, in order to let the common driver get parent's node, > + * we let the core's device node equals glue layer's node. > + */ > + if (dev->parent && dev->parent->of_node) > + dev->of_node = dev->parent->of_node; Can this be done earlier? Perhaps after hw_device_init() in this probe routine? That would allow me to remove the awkward parent searching in my ULPI DT awareness patch. -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Aug 09, 2016 at 05:15:36PM -0700, Stephen Boyd wrote: > Quoting Peter Chen (2016-08-08 01:52:10) > > From: Peter Chen <peter.chen@freescale.com> > > > > At device tree, we have no device node for chipidea core, > > the glue layer's node is the parent node for host and udc > > device. But in related driver, the parent device is chipidea > > core. So, in order to let the common driver get parent's node, > > we let the core's device node equals glue layer device node. > > > > Signed-off-by: Peter Chen <peter.chen@freescale.com> > > Tested-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name> > > Tested-by Joshua Clayton <stillcompiling@gmail.com> > > --- > > drivers/usb/chipidea/core.c | 11 +++++++++++ > > 1 file changed, 11 insertions(+) > > > > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c > > index 69426e6..b189dc7 100644 > > --- a/drivers/usb/chipidea/core.c > > +++ b/drivers/usb/chipidea/core.c > > @@ -954,6 +954,15 @@ static int ci_hdrc_probe(struct platform_device *pdev) > > dev_err(dev, "unable to init phy: %d\n", ret); > > return ret; > > } > > + /* > > + * At device tree, we have no device node for chipidea core, > > + * the glue layer's node is the parent node for host and udc > > + * device. But in related driver, the parent device is chipidea > > + * core. So, in order to let the common driver get parent's node, > > + * we let the core's device node equals glue layer's node. > > + */ > > + if (dev->parent && dev->parent->of_node) > > + dev->of_node = dev->parent->of_node; > > Can this be done earlier? Perhaps after hw_device_init() in this probe > routine? That would allow me to remove the awkward parent searching in > my ULPI DT awareness patch. The reason why I locate it there is to avoid "goto label" for error path during PHY's get and initialization operation. Ok, to simplify your work, I will change it at next version.
Hi, Peter > -----Original Message----- > From: linux-usb-owner@vger.kernel.org [mailto:linux-usb- > owner@vger.kernel.org] On Behalf Of Peter Chen > Sent: Wednesday, August 10, 2016 11:12 AM > To: Stephen Boyd <stephen.boyd@linaro.org> > Cc: Peter Chen <peter.chen@nxp.com>; gregkh@linuxfoundation.org; > stern@rowland.harvard.edu; ulf.hansson@linaro.org; broonie@kernel.org; > sre@kernel.org; robh+dt@kernel.org; shawnguo@kernel.org; > dbaryshkov@gmail.com; dwmw3@infradead.org; k.kozlowski@samsung.com; linux- > arm-kernel@lists.infradead.org; p.zabel@pengutronix.de; > devicetree@vger.kernel.org; pawel.moll@arm.com; mark.rutland@arm.com; > linux-usb@vger.kernel.org; arnd@arndb.de; s.hauer@pengutronix.de; > mail@maciej.szmigiero.name; troy.kisky@boundarydevices.com; > festevam@gmail.com; oscar@naiandei.net; linux-pm@vger.kernel.org; > stillcompiling@gmail.com; linux-kernel@vger.kernel.org; mka@chromium.org; > Peter Chen <peter.chen@freescale.com> > Subject: Re: [PATCH v5 5/6] usb: chipidea: let chipidea core device > of_node equal's glue layer device of_node > > On Tue, Aug 09, 2016 at 05:15:36PM -0700, Stephen Boyd wrote: > > Quoting Peter Chen (2016-08-08 01:52:10) > > > From: Peter Chen <peter.chen@freescale.com> > > > > > > At device tree, we have no device node for chipidea core, the glue > > > layer's node is the parent node for host and udc device. But in > > > related driver, the parent device is chipidea core. So, in order to > > > let the common driver get parent's node, we let the core's device > > > node equals glue layer device node. > > > > > > Signed-off-by: Peter Chen <peter.chen@freescale.com> > > > Tested-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name> > > > Tested-by Joshua Clayton <stillcompiling@gmail.com> > > > --- > > > drivers/usb/chipidea/core.c | 11 +++++++++++ > > > 1 file changed, 11 insertions(+) > > > > > > diff --git a/drivers/usb/chipidea/core.c > > > b/drivers/usb/chipidea/core.c index 69426e6..b189dc7 100644 > > > --- a/drivers/usb/chipidea/core.c > > > +++ b/drivers/usb/chipidea/core.c > > > @@ -954,6 +954,15 @@ static int ci_hdrc_probe(struct platform_device > *pdev) > > > dev_err(dev, "unable to init phy: %d\n", ret); > > > return ret; > > > } > > > + /* > > > + * At device tree, we have no device node for chipidea core, > > > + * the glue layer's node is the parent node for host and udc > > > + * device. But in related driver, the parent device is > chipidea > > > + * core. So, in order to let the common driver get parent's > node, > > > + * we let the core's device node equals glue layer's node. > > > + */ > > > + if (dev->parent && dev->parent->of_node) > > > + dev->of_node = dev->parent->of_node; > > > > Can this be done earlier? Perhaps after hw_device_init() in this probe > > routine? That would allow me to remove the awkward parent searching in > > my ULPI DT awareness patch. > > The reason why I locate it there is to avoid "goto label" for error path > during PHY's get and initialization operation. > > Ok, to simplify your work, I will change it at next version. As iommu need this to be done even more earlier, will you consider to put it before adding the core's platform device? Li Jun > > -- > > Best Regards, > Peter Chen > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majordomo@vger.kernel.org More majordomo info at > http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Aug 10, 2016 at 09:00:15AM +0000, Jun Li wrote: > Hi, Peter > > > -----Original Message----- > > From: linux-usb-owner@vger.kernel.org [mailto:linux-usb- > > owner@vger.kernel.org] On Behalf Of Peter Chen > > Sent: Wednesday, August 10, 2016 11:12 AM > > To: Stephen Boyd <stephen.boyd@linaro.org> > > Cc: Peter Chen <peter.chen@nxp.com>; gregkh@linuxfoundation.org; > > stern@rowland.harvard.edu; ulf.hansson@linaro.org; broonie@kernel.org; > > sre@kernel.org; robh+dt@kernel.org; shawnguo@kernel.org; > > dbaryshkov@gmail.com; dwmw3@infradead.org; k.kozlowski@samsung.com; linux- > > arm-kernel@lists.infradead.org; p.zabel@pengutronix.de; > > devicetree@vger.kernel.org; pawel.moll@arm.com; mark.rutland@arm.com; > > linux-usb@vger.kernel.org; arnd@arndb.de; s.hauer@pengutronix.de; > > mail@maciej.szmigiero.name; troy.kisky@boundarydevices.com; > > festevam@gmail.com; oscar@naiandei.net; linux-pm@vger.kernel.org; > > stillcompiling@gmail.com; linux-kernel@vger.kernel.org; mka@chromium.org; > > Peter Chen <peter.chen@freescale.com> > > Subject: Re: [PATCH v5 5/6] usb: chipidea: let chipidea core device > > of_node equal's glue layer device of_node > > > > On Tue, Aug 09, 2016 at 05:15:36PM -0700, Stephen Boyd wrote: > > > Quoting Peter Chen (2016-08-08 01:52:10) > > > > From: Peter Chen <peter.chen@freescale.com> > > > > > > > > At device tree, we have no device node for chipidea core, the glue > > > > layer's node is the parent node for host and udc device. But in > > > > related driver, the parent device is chipidea core. So, in order to > > > > let the common driver get parent's node, we let the core's device > > > > node equals glue layer device node. > > > > > > > > Signed-off-by: Peter Chen <peter.chen@freescale.com> > > > > Tested-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name> > > > > Tested-by Joshua Clayton <stillcompiling@gmail.com> > > > > --- > > > > drivers/usb/chipidea/core.c | 11 +++++++++++ > > > > 1 file changed, 11 insertions(+) > > > > > > > > diff --git a/drivers/usb/chipidea/core.c > > > > b/drivers/usb/chipidea/core.c index 69426e6..b189dc7 100644 > > > > --- a/drivers/usb/chipidea/core.c > > > > +++ b/drivers/usb/chipidea/core.c > > > > @@ -954,6 +954,15 @@ static int ci_hdrc_probe(struct platform_device > > *pdev) > > > > dev_err(dev, "unable to init phy: %d\n", ret); > > > > return ret; > > > > } > > > > + /* > > > > + * At device tree, we have no device node for chipidea core, > > > > + * the glue layer's node is the parent node for host and udc > > > > + * device. But in related driver, the parent device is > > chipidea > > > > + * core. So, in order to let the common driver get parent's > > node, > > > > + * we let the core's device node equals glue layer's node. > > > > + */ > > > > + if (dev->parent && dev->parent->of_node) > > > > + dev->of_node = dev->parent->of_node; > > > > > > Can this be done earlier? Perhaps after hw_device_init() in this probe > > > routine? That would allow me to remove the awkward parent searching in > > > my ULPI DT awareness patch. > > > > The reason why I locate it there is to avoid "goto label" for error path > > during PHY's get and initialization operation. > > > > Ok, to simplify your work, I will change it at next version. > > As iommu need this to be done even more earlier, will you consider to > put it before adding the core's platform device? > I can't do it, it will introduce another issue that the pinctrl has already requested by parents. The warning is similar like below, but occurs at the probe. http://lkml.iu.edu/hypermail/linux/kernel/1607.2/03150.html I will see how iommu support can be added for platform devices which are created by runtime (like chipidea core device).
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 69426e6..b189dc7 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -954,6 +954,15 @@ static int ci_hdrc_probe(struct platform_device *pdev) dev_err(dev, "unable to init phy: %d\n", ret); return ret; } + /* + * At device tree, we have no device node for chipidea core, + * the glue layer's node is the parent node for host and udc + * device. But in related driver, the parent device is chipidea + * core. So, in order to let the common driver get parent's node, + * we let the core's device node equals glue layer's node. + */ + if (dev->parent && dev->parent->of_node) + dev->of_node = dev->parent->of_node; ci->hw_bank.phys = res->start; @@ -1057,6 +1066,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) stop: ci_role_destroy(ci); deinit_phy: + dev->of_node = NULL; ci_usb_phy_exit(ci); return ret; @@ -1076,6 +1086,7 @@ static int ci_hdrc_remove(struct platform_device *pdev) ci_extcon_unregister(ci); ci_role_destroy(ci); ci_hdrc_enter_lpm(ci, true); + ci->dev->of_node = NULL; ci_usb_phy_exit(ci); return 0;