* [PATCH 1/2] dt-bindings: phy-imx8mq-usb: add reset-gpios property @ 2021-01-28 22:12 Adrien Grassein 2021-01-28 22:12 ` [PATCH 2/2] phy: fsl-imx8mq-usb: handle resettable hubs Adrien Grassein 2021-02-09 20:01 ` [PATCH 1/2] dt-bindings: phy-imx8mq-usb: add reset-gpios property Rob Herring 0 siblings, 2 replies; 4+ messages in thread From: Adrien Grassein @ 2021-01-28 22:12 UTC (permalink / raw) Cc: kishon, vkoul, robh+dt, shawnguo, s.hauer, kernel, festevam, linux-imx, rikard.falkeborn, peter.chen, jun.li, linux-kernel, devicetree, linux-arm-kernel, Adrien Grassein Add an optional GPIO in the dtb description that will be used to reset the connected hub (if any). Signed-off-by: Adrien Grassein <adrien.grassein@gmail.com> --- Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.txt b/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.txt index 7c70f2ad9942..6ee2b42e0f22 100644 --- a/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.txt +++ b/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.txt @@ -9,6 +9,7 @@ Required properties: Optional properties: - vbus-supply: A phandle to the regulator for USB VBUS. +- reset-gpios: A phandle to the reset signal of the connected hub (if any). Example: usb3_phy0: phy@381f0040 { -- 2.25.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] phy: fsl-imx8mq-usb: handle resettable hubs 2021-01-28 22:12 [PATCH 1/2] dt-bindings: phy-imx8mq-usb: add reset-gpios property Adrien Grassein @ 2021-01-28 22:12 ` Adrien Grassein 2021-02-02 2:01 ` Jun Li 2021-02-09 20:01 ` [PATCH 1/2] dt-bindings: phy-imx8mq-usb: add reset-gpios property Rob Herring 1 sibling, 1 reply; 4+ messages in thread From: Adrien Grassein @ 2021-01-28 22:12 UTC (permalink / raw) Cc: kishon, vkoul, robh+dt, shawnguo, s.hauer, kernel, festevam, linux-imx, rikard.falkeborn, peter.chen, jun.li, linux-kernel, devicetree, linux-arm-kernel, Adrien Grassein Add an optional GPIO in the dtb description that will be used to reset the connected hub (if any). Signed-off-by: Adrien Grassein <adrien.grassein@gmail.com> --- drivers/phy/freescale/phy-fsl-imx8mq-usb.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c index a29b4a6f7c24..00abf7814fe9 100644 --- a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c +++ b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c @@ -4,6 +4,7 @@ #include <linux/bitfield.h> #include <linux/clk.h> #include <linux/delay.h> +#include <linux/gpio/consumer.h> #include <linux/io.h> #include <linux/module.h> #include <linux/of_platform.h> @@ -36,6 +37,7 @@ struct imx8mq_usb_phy { struct clk *clk; void __iomem *base; struct regulator *vbus; + struct gpio_desc *reset_gpio; }; static int imx8mq_usb_phy_init(struct phy *phy) @@ -111,6 +113,9 @@ static int imx8mq_phy_power_on(struct phy *phy) if (ret) return ret; + if (imx_phy->reset_gpio) + gpiod_set_value_cansleep(imx_phy->reset_gpio, 0); + return clk_prepare_enable(imx_phy->clk); } @@ -120,6 +125,8 @@ static int imx8mq_phy_power_off(struct phy *phy) clk_disable_unprepare(imx_phy->clk); regulator_disable(imx_phy->vbus); + if (imx_phy->reset_gpio) + gpiod_set_value_cansleep(imx_phy->reset_gpio, 1); return 0; } @@ -153,6 +160,7 @@ static int imx8mq_usb_phy_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct imx8mq_usb_phy *imx_phy; const struct phy_ops *phy_ops; + int ret; imx_phy = devm_kzalloc(dev, sizeof(*imx_phy), GFP_KERNEL); if (!imx_phy) @@ -180,6 +188,15 @@ static int imx8mq_usb_phy_probe(struct platform_device *pdev) if (IS_ERR(imx_phy->vbus)) return PTR_ERR(imx_phy->vbus); + imx_phy->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(imx_phy->reset_gpio)) { + ret = PTR_ERR(imx_phy->reset_gpio); + if (ret == -ENXIO || ret == -ENODEV) + imx_phy->reset_gpio = NULL; + else + return PTR_ERR(imx_phy->reset_gpio); + } + phy_set_drvdata(imx_phy->phy, imx_phy); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); -- 2.25.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH 2/2] phy: fsl-imx8mq-usb: handle resettable hubs 2021-01-28 22:12 ` [PATCH 2/2] phy: fsl-imx8mq-usb: handle resettable hubs Adrien Grassein @ 2021-02-02 2:01 ` Jun Li 0 siblings, 0 replies; 4+ messages in thread From: Jun Li @ 2021-02-02 2:01 UTC (permalink / raw) To: Adrien Grassein Cc: kishon@ti.com, vkoul@kernel.org, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, dl-linux-imx, rikard.falkeborn@gmail.com, Peter Chen, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Hi, > -----Original Message----- > From: Adrien Grassein <adrien.grassein@gmail.com> > Sent: Friday, January 29, 2021 6:13 AM > Cc: kishon@ti.com; vkoul@kernel.org; robh+dt@kernel.org; shawnguo@kernel.org; > s.hauer@pengutronix.de; kernel@pengutronix.de; festevam@gmail.com; dl-linux-imx > <linux-imx@nxp.com>; rikard.falkeborn@gmail.com; Peter Chen <peter.chen@nxp.com>; > Jun Li <jun.li@nxp.com>; linux-kernel@vger.kernel.org; > devicetree@vger.kernel.org; linux-arm-kernel@lists.infradead.org; Adrien > Grassein <adrien.grassein@gmail.com> > Subject: [PATCH 2/2] phy: fsl-imx8mq-usb: handle resettable hubs > > Add an optional GPIO in the dtb description that will be used to reset the connected > hub (if any). Put the external usb device reset in host phy driver, this may not the right way, there was some attempts to handle this case(on board hub), I am not sure what's the status now. Li Jun > > Signed-off-by: Adrien Grassein <adrien.grassein@gmail.com> > --- > drivers/phy/freescale/phy-fsl-imx8mq-usb.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c > b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c > index a29b4a6f7c24..00abf7814fe9 100644 > --- a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c > +++ b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c > @@ -4,6 +4,7 @@ > #include <linux/bitfield.h> > #include <linux/clk.h> > #include <linux/delay.h> > +#include <linux/gpio/consumer.h> > #include <linux/io.h> > #include <linux/module.h> > #include <linux/of_platform.h> > @@ -36,6 +37,7 @@ struct imx8mq_usb_phy { > struct clk *clk; > void __iomem *base; > struct regulator *vbus; > + struct gpio_desc *reset_gpio; > }; > > static int imx8mq_usb_phy_init(struct phy *phy) @@ -111,6 +113,9 @@ static int > imx8mq_phy_power_on(struct phy *phy) > if (ret) > return ret; > > + if (imx_phy->reset_gpio) > + gpiod_set_value_cansleep(imx_phy->reset_gpio, 0); > + > return clk_prepare_enable(imx_phy->clk); } > > @@ -120,6 +125,8 @@ static int imx8mq_phy_power_off(struct phy *phy) > > clk_disable_unprepare(imx_phy->clk); > regulator_disable(imx_phy->vbus); > + if (imx_phy->reset_gpio) > + gpiod_set_value_cansleep(imx_phy->reset_gpio, 1); > > return 0; > } > @@ -153,6 +160,7 @@ static int imx8mq_usb_phy_probe(struct platform_device *pdev) > struct device *dev = &pdev->dev; > struct imx8mq_usb_phy *imx_phy; > const struct phy_ops *phy_ops; > + int ret; > > imx_phy = devm_kzalloc(dev, sizeof(*imx_phy), GFP_KERNEL); > if (!imx_phy) > @@ -180,6 +188,15 @@ static int imx8mq_usb_phy_probe(struct platform_device *pdev) > if (IS_ERR(imx_phy->vbus)) > return PTR_ERR(imx_phy->vbus); > > + imx_phy->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); > + if (IS_ERR(imx_phy->reset_gpio)) { > + ret = PTR_ERR(imx_phy->reset_gpio); > + if (ret == -ENXIO || ret == -ENODEV) > + imx_phy->reset_gpio = NULL; > + else > + return PTR_ERR(imx_phy->reset_gpio); > + } > + > phy_set_drvdata(imx_phy->phy, imx_phy); > > phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); > -- > 2.25.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] dt-bindings: phy-imx8mq-usb: add reset-gpios property 2021-01-28 22:12 [PATCH 1/2] dt-bindings: phy-imx8mq-usb: add reset-gpios property Adrien Grassein 2021-01-28 22:12 ` [PATCH 2/2] phy: fsl-imx8mq-usb: handle resettable hubs Adrien Grassein @ 2021-02-09 20:01 ` Rob Herring 1 sibling, 0 replies; 4+ messages in thread From: Rob Herring @ 2021-02-09 20:01 UTC (permalink / raw) To: Adrien Grassein Cc: kishon, vkoul, shawnguo, s.hauer, kernel, festevam, linux-imx, rikard.falkeborn, peter.chen, jun.li, linux-kernel, devicetree, linux-arm-kernel On Thu, Jan 28, 2021 at 11:12:54PM +0100, Adrien Grassein wrote: > Add an optional GPIO in the dtb description that will > be used to reset the connected hub (if any). > > Signed-off-by: Adrien Grassein <adrien.grassein@gmail.com> > --- > Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.txt | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.txt b/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.txt > index 7c70f2ad9942..6ee2b42e0f22 100644 > --- a/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.txt > +++ b/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.txt > @@ -9,6 +9,7 @@ Required properties: > > Optional properties: > - vbus-supply: A phandle to the regulator for USB VBUS. > +- reset-gpios: A phandle to the reset signal of the connected hub (if any). This should go in a hub node (or whatever device has a reset line). > > Example: > usb3_phy0: phy@381f0040 { > -- > 2.25.1 > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-02-09 20:39 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-01-28 22:12 [PATCH 1/2] dt-bindings: phy-imx8mq-usb: add reset-gpios property Adrien Grassein 2021-01-28 22:12 ` [PATCH 2/2] phy: fsl-imx8mq-usb: handle resettable hubs Adrien Grassein 2021-02-02 2:01 ` Jun Li 2021-02-09 20:01 ` [PATCH 1/2] dt-bindings: phy-imx8mq-usb: add reset-gpios property Rob Herring
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).