Message ID | 20220920133954.1.Iff08cf94aa6c6d3678acb28a8dd012d466184b42@changeid |
---|---|
State | Accepted |
Commit | 91dae6d0a19e4d19715243487f0d0f8ca5b0c443 |
Delegated to: | Patrice Chotard |
Headers | show |
Series | phy: usbphyc: use regulator_set_enable_if_allowed for disabling vbus supply | expand |
Hi Patrick On 9/20/22 13:39, Patrick Delaunay wrote: > Use regulator_set_enable_if_allowed() api instead of regulator_set_enable() > while disabling vbus supply. This way the driver doesn't see an error > when it disable an always-on regulator for VBUS. > > This patch is needed for STM32MP157C-DK2 board when the regulator > v3v3: buck4 used as the phy vbus supply in kernel device tree > is always on with the next hack for low power use-case: > > &usbphyc_port0 { > ... > /* > * Hack to keep hub active until all connected devices are suspended > * otherwise the hub will be powered off as soon as the v3v3 is disabled > * and it can disturb connected devices. > */ > connector { > compatible = "usb-a-connector"; > vbus-supply = <&v3v3>; > }; > }; > > Without this patch and the previous update in DT the command > "usb stop" failed and the next command "usb start" cause a crash. > > Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> > --- > > drivers/phy/phy-stm32-usbphyc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/phy/phy-stm32-usbphyc.c b/drivers/phy/phy-stm32-usbphyc.c > index 9f0b7d71187..dcf2194e9a7 100644 > --- a/drivers/phy/phy-stm32-usbphyc.c > +++ b/drivers/phy/phy-stm32-usbphyc.c > @@ -375,7 +375,7 @@ static int stm32_usbphyc_phy_power_off(struct phy *phy) > return 0; > > if (usbphyc_phy->vbus) { > - ret = regulator_set_enable(usbphyc_phy->vbus, false); > + ret = regulator_set_enable_if_allowed(usbphyc_phy->vbus, false); > if (ret) > return ret; > } Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Thanks Patrice
Hi Marek, On 9/20/22 13:39, Patrick Delaunay wrote: > Use regulator_set_enable_if_allowed() api instead of regulator_set_enable() > while disabling vbus supply. This way the driver doesn't see an error > when it disable an always-on regulator for VBUS. > > This patch is needed for STM32MP157C-DK2 board when the regulator > v3v3: buck4 used as the phy vbus supply in kernel device tree > is always on with the next hack for low power use-case: > > &usbphyc_port0 { > ... > /* > * Hack to keep hub active until all connected devices are suspended > * otherwise the hub will be powered off as soon as the v3v3 is disabled > * and it can disturb connected devices. > */ > connector { > compatible = "usb-a-connector"; > vbus-supply = <&v3v3>; > }; > }; > > Without this patch and the previous update in DT the command > "usb stop" failed and the next command "usb start" cause a crash. > > Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> > --- > > drivers/phy/phy-stm32-usbphyc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/phy/phy-stm32-usbphyc.c b/drivers/phy/phy-stm32-usbphyc.c > index 9f0b7d71187..dcf2194e9a7 100644 > --- a/drivers/phy/phy-stm32-usbphyc.c > +++ b/drivers/phy/phy-stm32-usbphyc.c > @@ -375,7 +375,7 @@ static int stm32_usbphyc_phy_power_off(struct phy *phy) > return 0; > > if (usbphyc_phy->vbus) { > - ret = regulator_set_enable(usbphyc_phy->vbus, false); > + ret = regulator_set_enable_if_allowed(usbphyc_phy->vbus, false); > if (ret) > return ret; > } Can you reviewed this minor patch for v2023.01-rc1 ? Thanks. Patrick
On 10/26/22 15:09, Patrick DELAUNAY wrote: > Hi Marek, > > On 9/20/22 13:39, Patrick Delaunay wrote: >> Use regulator_set_enable_if_allowed() api instead of >> regulator_set_enable() >> while disabling vbus supply. This way the driver doesn't see an error >> when it disable an always-on regulator for VBUS. >> >> This patch is needed for STM32MP157C-DK2 board when the regulator >> v3v3: buck4 used as the phy vbus supply in kernel device tree >> is always on with the next hack for low power use-case: >> >> &usbphyc_port0 { >> ... >> /* >> * Hack to keep hub active until all connected devices are suspended >> * otherwise the hub will be powered off as soon as the v3v3 is >> disabled >> * and it can disturb connected devices. >> */ >> connector { >> compatible = "usb-a-connector"; >> vbus-supply = <&v3v3>; >> }; >> }; >> >> Without this patch and the previous update in DT the command >> "usb stop" failed and the next command "usb start" cause a crash. >> >> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> >> --- >> >> drivers/phy/phy-stm32-usbphyc.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/phy/phy-stm32-usbphyc.c >> b/drivers/phy/phy-stm32-usbphyc.c >> index 9f0b7d71187..dcf2194e9a7 100644 >> --- a/drivers/phy/phy-stm32-usbphyc.c >> +++ b/drivers/phy/phy-stm32-usbphyc.c >> @@ -375,7 +375,7 @@ static int stm32_usbphyc_phy_power_off(struct phy >> *phy) >> return 0; >> if (usbphyc_phy->vbus) { >> - ret = regulator_set_enable(usbphyc_phy->vbus, false); >> + ret = regulator_set_enable_if_allowed(usbphyc_phy->vbus, false); >> if (ret) >> return ret; >> } > > > Can you reviewed this minor patch for v2023.01-rc1 ? Seems OK to me: Reviewed-by: Marek Vasut <marex@denx.de> Thanks
Hi Patrick On 9/26/22 09:07, Patrice CHOTARD wrote: > Hi Patrick > > On 9/20/22 13:39, Patrick Delaunay wrote: >> Use regulator_set_enable_if_allowed() api instead of regulator_set_enable() >> while disabling vbus supply. This way the driver doesn't see an error >> when it disable an always-on regulator for VBUS. >> >> This patch is needed for STM32MP157C-DK2 board when the regulator >> v3v3: buck4 used as the phy vbus supply in kernel device tree >> is always on with the next hack for low power use-case: >> >> &usbphyc_port0 { >> ... >> /* >> * Hack to keep hub active until all connected devices are suspended >> * otherwise the hub will be powered off as soon as the v3v3 is disabled >> * and it can disturb connected devices. >> */ >> connector { >> compatible = "usb-a-connector"; >> vbus-supply = <&v3v3>; >> }; >> }; >> >> Without this patch and the previous update in DT the command >> "usb stop" failed and the next command "usb start" cause a crash. >> >> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> >> --- >> >> drivers/phy/phy-stm32-usbphyc.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/phy/phy-stm32-usbphyc.c b/drivers/phy/phy-stm32-usbphyc.c >> index 9f0b7d71187..dcf2194e9a7 100644 >> --- a/drivers/phy/phy-stm32-usbphyc.c >> +++ b/drivers/phy/phy-stm32-usbphyc.c >> @@ -375,7 +375,7 @@ static int stm32_usbphyc_phy_power_off(struct phy *phy) >> return 0; >> >> if (usbphyc_phy->vbus) { >> - ret = regulator_set_enable(usbphyc_phy->vbus, false); >> + ret = regulator_set_enable_if_allowed(usbphyc_phy->vbus, false); >> if (ret) >> return ret; >> } > Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> > > Thanks > Patrice > _______________________________________________ > Uboot-stm32 mailing list > Uboot-stm32@st-md-mailman.stormreply.com > https://st-md-mailman.stormreply.com/mailman/listinfo/uboot-stm32 Applied to u-boot-stm/master Thanks Patrice
diff --git a/drivers/phy/phy-stm32-usbphyc.c b/drivers/phy/phy-stm32-usbphyc.c index 9f0b7d71187..dcf2194e9a7 100644 --- a/drivers/phy/phy-stm32-usbphyc.c +++ b/drivers/phy/phy-stm32-usbphyc.c @@ -375,7 +375,7 @@ static int stm32_usbphyc_phy_power_off(struct phy *phy) return 0; if (usbphyc_phy->vbus) { - ret = regulator_set_enable(usbphyc_phy->vbus, false); + ret = regulator_set_enable_if_allowed(usbphyc_phy->vbus, false); if (ret) return ret; }
Use regulator_set_enable_if_allowed() api instead of regulator_set_enable() while disabling vbus supply. This way the driver doesn't see an error when it disable an always-on regulator for VBUS. This patch is needed for STM32MP157C-DK2 board when the regulator v3v3: buck4 used as the phy vbus supply in kernel device tree is always on with the next hack for low power use-case: &usbphyc_port0 { ... /* * Hack to keep hub active until all connected devices are suspended * otherwise the hub will be powered off as soon as the v3v3 is disabled * and it can disturb connected devices. */ connector { compatible = "usb-a-connector"; vbus-supply = <&v3v3>; }; }; Without this patch and the previous update in DT the command "usb stop" failed and the next command "usb start" cause a crash. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> --- drivers/phy/phy-stm32-usbphyc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)