usb: tegra: Replace nvidia,vbus-gpio property with vbus-supply
Subsystems (4)
v2 cover usb: tegra: Replace nvidia,vbus-gpio property with vbus-supply
This patchset removes the ehci-tegra device tree property nvidia,vbus-gpio and adds support for the vbus-supply property to phy-tegra-usb.
Mikko Perttunen (3):
usb: phy,host: tegra: Use regulators instead of GPIOs for USB PHY VBUS
Documentation: devicetree: phy-tegra-usb: Add vbus-supply property for
host mode PHYs
ARM: dts: tegra20: Remove obsolete nvidia,vbus-gpio properties
.../bindings/usb/nvidia,tegra20-usb-phy.txt | 2 +- arch/arm/boot/dts/tegra20-seaboard.dts | 1 - arch/arm/boot/dts/tegra20-trimslice.dts | 1 - arch/arm/boot/dts/tegra20-whistler.dts | 2 -- drivers/usb/host/ehci-tegra.c | 34 +--------------------- drivers/usb/phy/phy-tegra-usb.c | 23 +++++++++++++++ include/linux/usb/tegra_usb_phy.h | 1 + 7 files changed, 26 insertions(+), 38 deletions(-)
Signature · 1 line
1.8.1.5
A message that is not in the archive (sent off-list or not yet received): 1372422796-23524-1-git-send-email-mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
PATCH v2 1/3 usb: phy,host: tegra: Use regulators instead of GPIOs for USB PHY VBUS
The tegra ehci driver has enabled USB vbus regulators directly using GPIOs and the device tree attribute nvidia,vbus-gpio. This is ugly and causes error messages on boot when both the regulator driver and the ehci driver want access to the same GPIO.
After this patch, usb vbus regulators for tegra usb phy devices are specified with the device tree attribute vbus-supply = <&x> where x is a regulator defined in the device tree. The old nvidia,vbus-gpio property is no longer supported.
--- drivers/usb/host/ehci-tegra.c | 34 +--------------------------------- drivers/usb/phy/phy-tegra-usb.c | 23 +++++++++++++++++++++++ include/linux/usb/tegra_usb_phy.h | 1 + 3 files changed, 25 insertions(+), 33 deletions(-)
drivers/usb/host/ehci-tegra.c +1 -33
@@ -328,33 +328,6 @@ static void tegra_ehci_unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb)free_dma_aligned_buffer (urb); } -static int setup_vbus_gpio (struct platform_device *pdev, -struct tegra_ehci_platform_data *pdata) -{ -int err =0 ; -int gpio; - - gpio = pdata->vbus_gpio; -if (!gpio_is_valid (gpio)) - gpio =of_get_named_gpio (pdev->dev.of_node, -"nvidia,vbus-gpio" ,0 ); -if (!gpio_is_valid (gpio)) -return 0 ; - - err =gpio_request (gpio,"vbus_gpio" ); -if (err) { -dev_err (&pdev->dev,"can't request vbus gpio %d" , gpio); -return err; - } - err =gpio_direction_output (gpio,1 ); -if (err) { -dev_err (&pdev->dev,"can't enable vbus\n" ); -return err; - } - -return err; -} -static int tegra_ehci_probe (struct platform_device *pdev) {struct resource *res;
@@ -382,14 +355,11 @@ static int tegra_ehci_probe(struct platform_device *pdev)if (!pdev->dev.coherent_dma_mask) pdev->dev.coherent_dma_mask =DMA_BIT_MASK (32 ); -setup_vbus_gpio (pdev, pdata); - hcd =usb_create_hcd (&tegra_ehci_hc_driver, &pdev->dev,dev_name (&pdev->dev));if (!hcd) {dev_err (&pdev->dev,"Unable to create HCD\n" ); - err = -ENOMEM ; - goto cleanup_vbus_gpio; +return -ENOMEM ; }platform_set_drvdata (pdev, hcd); ehci =hcd_to_ehci (hcd);
@@ -505,8 +475,6 @@ cleanup_clk_get:clk_put (tegra->clk); cleanup_hcd_create:usb_put_hcd (hcd); -cleanup_vbus_gpio: -/* FIXME: Undo setup_vbus_gpio() here */ return err; }
drivers/usb/phy/phy-tegra-usb.c +23 -0
@@ -34,6 +34,7 @@#include <asm/mach-types.h> #include <linux/usb/ehci_def.h> #include <linux/usb/tegra_usb_phy.h> +#include <linux/regulator/consumer.h> #define ULPI_VIEWPORT 0x170
@@ -673,6 +674,9 @@ static void tegra_usb_phy_close(struct usb_phy *x) { struct tegra_usb_phy *phy = container_of(x, struct tegra_usb_phy, u_phy); +if (!IS_ERR (phy->vbus)) +regulator_disable (phy->vbus); +clk_disable_unprepare (phy->pll_u); }
@@ -772,6 +776,15 @@ static int tegra_usb_phy_init(struct tegra_usb_phy *phy) goto fail; } +if (!IS_ERR (phy->vbus)) { + err =regulator_enable (phy->vbus); +if (err) { +dev_err (phy->dev, +"failed to enable usb vbus regulator: %d\n" , err); + goto fail; + } + } +if (phy->is_ulpi_phy) err =ulpi_open (phy);else
@@ -890,6 +903,16 @@ static int tegra_usb_phy_probe(struct platform_device *pdev) }else tegra_phy->mode =TEGRA_USB_PHY_MODE_OTG ; +/* On some boards, the VBUS regulator doesn't need to be controlled */ +if (of_find_property (np,"vbus-supply" ,NULL )) { + tegra_phy->vbus =devm_regulator_get (&pdev->dev,"vbus" ); +if (IS_ERR (tegra_phy->vbus)) +return PTR_ERR (tegra_phy->vbus); + }else { +dev_notice (&pdev->dev,"no vbus regulator" ); + tegra_phy->vbus =ERR_PTR (-ENODEV ); + } + tegra_phy->dev = &pdev->dev; err =tegra_usb_phy_init (tegra_phy);if (err <0 )
include/linux/usb/tegra_usb_phy.h +1 -0
@@ -55,6 +55,7 @@ struct tegra_usb_phy {struct clk *clk;struct clk *pll_u;struct clk *pad_clk; +struct regulator *vbus;enum tegra_usb_phy_mode mode;void *config;struct usb_phy *ulpi;
Signature · 1 line
1.8.1.5
PATCH v2 2/3 Documentation: devicetree: phy-tegra-usb: Add vbus-supply property for host mode PHYs
In reply to a message not in the archiveAdd vbus-supply as an optional property for host mode phy-tegra-usb PHYs.
--- Documentation/devicetree/bindings/usb/nvidia,tegra20-usb-phy.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/usb/nvidia,tegra20-usb-phy.txt +1 -1
@@ -48,5 +48,5 @@ Optional properties: peripheral means it is device controller otg means it can operate as either ("on the go") -Required properties for dr_mode == otg: +VBUS control (required for dr_mode == host, optional for dr_mode == otg): - vbus-supply: regulator for VBUS
Signature · 6 lines
1.8.1.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1372422796-23524-3-git-send-email-mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Re: [PATCH v2 2/3] Documentation: devicetree: phy-tegra-usb: Add vbus-supply property for host mode PHYs
Quoted 1 line · Mikko Perttunen
Add vbus-supply as an optional property for host mode phy-tegra-usb PHYs.
Felipe, I see that you didn't merge this one patch from this series. Was there a reason for that? At this stage, I would consider it reasonable for DT binding documentation changes to go through the same tree as driver changes.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 2/3] Documentation: devicetree: phy-tegra-usb: Add vbus-supply property for host mode PHYs
Quoted 7 lines · Stephen Warren
Quoted 1 line · Mikko Perttunen
Add vbus-supply as an optional property for host mode phy-tegra-usb PHYs.
Felipe, I see that you didn't merge this one patch from this series. Was there a reason for that? At this stage, I would consider it reasonable for DT binding documentation changes to go through the same tree as driver changes.
no reason, just missed it. Will apply now.
Signature · 1 line
balbi
Re: [PATCH v2 2/3] Documentation: devicetree: phy-tegra-usb: Add vbus-supply property for host mode PHYs
Hi,
Quoted 10 lines · Felipe Balbi
Quoted 7 lines · Stephen Warren
Quoted 1 line · Mikko Perttunen
Add vbus-supply as an optional property for host mode phy-tegra-usb PHYs.
Felipe, I see that you didn't merge this one patch from this series. Was there a reason for that? At this stage, I would consider it reasonable for DT binding documentation changes to go through the same tree as driver changes.
no reason, just missed it. Will apply now.
actually, patch _is_ in my tree:
commit 80bd8a94712a0a9f2baeb03ad0546dd70f27ac4e
Author: Mikko Perttunen <[email protected]> Date: Wed Jul 17 10:37:50 2013 +0300
usb: tegra: Add vbus-supply property for host mode PHYs
Document vbus-supply as an optional property for host mode phy-tegra-usb PHYs.
Documentation/devicetree/bindings/usb/nvidia,tegra20-usb-phy.txt +1 -1
@@ -48,5 +48,5 @@ Optional properties: peripheral means it is device controller otg means it can operate as either ("on the go") -Required properties for dr_mode == otg: +VBUS control (required for dr_mode == host, optional for dr_mode == otg): - vbus-supply: regulator for VBUS
Signature · 1 line
balbi
Re: [PATCH v2 2/3] Documentation: devicetree: phy-tegra-usb: Add vbus-supply property for host mode PHYs
Quoted 13 lines · Felipe Balbi
Hi,
Quoted 10 lines · Felipe Balbi
Quoted 8 lines · Stephen Warren
Quoted 2 lines · Mikko Perttunen
Add vbus-supply as an optional property for host mode phy-tegra-usb PHYs.
Felipe, I see that you didn't merge this one patch from this series. Was there a reason for that? At this stage, I would consider it reasonable for DT binding documentation changes to go through the same tree as driver changes.
Quoted 5 lines
Quoted 1 line
no reason, just missed it. Will apply now.
actually, patch _is_ in my tree:
Oh
Quoted 1 line
so it is, thanks. I was thrown off by the modified patch subject; sorry.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 2/3] Documentation: devicetree: phy-tegra-usb: Add vbus-supply property for host mode PHYs
In reply to Felipe BalbiQuoted 39 lines · Felipe Balbi
* PGP Signed by an unknown key
Hi,
Quoted 10 lines · Felipe Balbi
Quoted 7 lines · Stephen Warren
Quoted 1 line · Mikko Perttunen
Add vbus-supply as an optional property for host mode phy-tegra-usb PHYs.
Felipe, I see that you didn't merge this one patch from this series. Was there a reason for that? At this stage, I would consider it reasonable for DT binding documentation changes to go through the same tree as driver changes.
no reason, just missed it. Will apply now.
actually, patch _is_ in my tree:
commit
80bd8a94712a0a9f2baeb03ad0546dd70f27ac4eAuthor: Mikko Perttunen <[email protected]> Date: Wed Jul 17 10:37:50 2013 +0300usb: tegra: Add vbus-supply property for host mode PHYs
Document vbus-supply as an optional property for host mode phy-tegra-usb PHYs.
Signed-off-by Mikko Perttunen <[email protected]>Reviewed-by Stephen Warren <[email protected]>Tested-by Stephen Warren <[email protected]>Signed-off-by Felipe Balbi <[email protected]>Documentation/devicetree/bindings/usb/nvidia,tegra20-usb-phy.txt +0
-0
Documentation/devicetree/bindings/usb/nvidia,tegra20-usb-phy.txt Optional properties: · line 52
Quoted 6 lines
Documentation/devicetree/bindings/usb/nvidia,tegra20-usb-phy.txt +1
-1@@ -48,5 +48,5 @@ Optional properties: peripheral means it is device controller otg means it can operate as either ("on the go") -Required properties for dr_mode == otg: +VBUS control (required for dr_mode == host, optional for dr_mode == otg): - vbus-supply: regulator for VBUS
Oops, looks like I've made a typo there while making the v2. This should be, optional for dr_mode == host, required for dr_mode == otg instead of the other way around. Can this fixup still be made?
Thanks, Mikko
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 2/3] Documentation: devicetree: phy-tegra-usb: Add vbus-supply property for host mode PHYs
Quoted 42 lines · Mikko Perttunen
Quoted 41 lines · Felipe Balbi
* PGP Signed by an unknown key
Hi,
Quoted 10 lines · Felipe Balbi
Quoted 7 lines · Stephen Warren
Quoted 1 line · Mikko Perttunen
Add vbus-supply as an optional property for host mode phy-tegra-usb PHYs.
Felipe, I see that you didn't merge this one patch from this series. Was there a reason for that? At this stage, I would consider it reasonable for DT binding documentation changes to go through the same tree as driver changes.
no reason, just missed it. Will apply now.
actually, patch _is_ in my tree:
commit
80bd8a94712a0a9f2baeb03ad0546dd70f27ac4eAuthor: Mikko Perttunen <[email protected]> Date: Wed Jul 17 10:37:50 2013 +0300usb: tegra: Add vbus-supply property for host mode PHYs
Document vbus-supply as an optional property for host mode phy-tegra-usb PHYs.
Signed-off-by Mikko Perttunen <[email protected]>Reviewed-by Stephen Warren <[email protected]>Tested-by Stephen Warren <[email protected]>Signed-off-by Felipe Balbi <[email protected]>Documentation/devicetree/bindings/usb/nvidia,tegra20-usb-phy.txt +0
-0@@ -48,5 +48,5 @@ Optional properties: peripheral means it is device controller otg means it can operate as either ("on the go")
Quoted 8 lines
Documentation/devicetree/bindings/usb/nvidia,tegra20-usb-phy.txt Optional properties: · line 52
Quoted 4 lines
Documentation/devicetree/bindings/usb/nvidia,tegra20-usb-phy.txt +1
-1-Required properties for dr_mode == otg: +VBUS control (required for dr_mode == host, optional for dr_mode == otg): - vbus-supply: regulator for VBUSOops, looks like I've made a typo there while making the v2. This should be, optional for
dr_mode== host, required fordr_mode== otg instead of the other way around. Can this fixup still be made?
send a patch on top of that, please.
Signature · 1 line
balbi
PATCH 1/1 Fix switched around host, otg in tegra20-usb-phy documentation
--- Documentation/devicetree/bindings/usb/nvidia,tegra20-usb-phy.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/usb/nvidia,tegra20-usb-phy.txt +1 -1
@@ -48,5 +48,5 @@ Optional properties: peripheral means it is device controller otg means it can operate as either ("on the go") -VBUS control (required for dr_mode == host, optional for dr_mode == otg): +VBUS control (required for dr_mode == otg, optional for dr_mode == host): - vbus-supply: regulator for VBUS
Signature · 1 line
1.8.1.5
A message that is not in the archive (sent off-list or not yet received): 1375166324-30521-1-git-send-email-mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Re: [PATCH] Fix switched around host, otg in tegra20-usb-phy documentation
Quoted 1 line · Mikko Perttunen
Signed-off-by Mikko Perttunen <[email protected]>
return -ENOLOG;
sorry, I can't apply without a commit log. Please mention that the previous commit had a typo which you're fixing.
Signature · 1 line
balbi
Re: [PATCH] Fix switched around host, otg in tegra20-usb-phy documentation
Quoted 10 lines · Felipe Balbi
* PGP Signed by an unknown key
Quoted 1 line · Mikko Perttunen
Signed-off-by Mikko Perttunen <[email protected]>return
-ENOLOG;sorry, I can't apply without a commit log. Please mention that the previous commit had a typo which you're fixing.
Sorry, for some reason I was thinking you could squash it. But of course that's not advisable since the repo is public.
PATCH 1/1 usb: tegra: Fix typo in tegra20-usb-phy documentation
In reply to Felipe BalbiThe device tree binding documentation for tegra20-usb-phy used to claim that the vbus-supply property is required for host phys and optional for otg phys. This should be the other way around.
--- Documentation/devicetree/bindings/usb/nvidia,tegra20-usb-phy.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/usb/nvidia,tegra20-usb-phy.txt +1 -1
@@ -48,5 +48,5 @@ Optional properties: peripheral means it is device controller otg means it can operate as either ("on the go") -VBUS control (required for dr_mode == host, optional for dr_mode == otg): +VBUS control (required for dr_mode == otg, optional for dr_mode == host): - vbus-supply: regulator for VBUS
Signature · 1 line
1.8.1.5
PATCH v2 3/3 ARM: dts: tegra20: Remove obsolete nvidia,vbus-gpio properties
In reply to a message not in the archiveUSB VBUS regulators are now specified with the vbus-supply property instead of nvidia,vbus-gpio, so remove the obsolete properties.
The equivalent vbus-supply properties were already added in patch "ARM: tegra: update device trees for USB binding rework".
--- arch/arm/boot/dts/tegra20-seaboard.dts | 1 - arch/arm/boot/dts/tegra20-trimslice.dts | 1 - arch/arm/boot/dts/tegra20-whistler.dts | 2 -- 3 files changed, 4 deletions(-)
arch/arm/boot/dts/tegra20-seaboard.dts +0 -1
@@ -566,7 +566,6 @@ usb@c5000000 { status = "okay"; - nvidia,vbus-gpio = <&gpio TEGRA_GPIO(D, 0) GPIO_ACTIVE_HIGH>; dr_mode = "otg"; };
arch/arm/boot/dts/tegra20-trimslice.dts +0 -1
@@ -312,7 +312,6 @@ usb@c5000000 { status = "okay"; - nvidia,vbus-gpio = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_HIGH>; }; usb-phy@c5000000 {
arch/arm/boot/dts/tegra20-whistler.dts +0 -2
@@ -509,7 +509,6 @@ usb@c5000000 { status = "okay"; - nvidia,vbus-gpio = <&tca6416 0 GPIO_ACTIVE_HIGH>; }; usb-phy@c5000000 {
@@ -519,7 +518,6 @@ usb@c5008000 { status = "okay"; - nvidia,vbus-gpio = <&tca6416 1 GPIO_ACTIVE_HIGH>; }; usb-phy@c5008000 {
Signature · 6 lines
1.8.1.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1372422796-23524-4-git-send-email-mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Re: [PATCH v2 3/3] ARM: dts: tegra20: Remove obsolete nvidia,vbus-gpio properties
Quoted 5 lines · Mikko Perttunen
USB VBUS regulators are now specified with the vbus-supply property instead of nvidia,vbus-gpio, so remove the obsolete properties.
The equivalent vbus-supply properties were already added in patch "ARM: tegra: update device trees for USB binding rework".
(which is in v3.11-rc1, so there aren't any dependencies to worry about)
So, I think the chances of this patch causing any difficult conflicts are minimal, so it's simplest to just take this series through the USB tree rather than screwing around with cross-subsystem merge branches.
As such, this one patch,
And the whole series,
I would guess that since this series was sent a long time ago almost during the merge window, it has fallen out of Felipe's and Greg's inbox, so a resend might be in order. Mikko, if so, please cut/paste the acked-/reviewed-/tested-by lines above into the commit description to make life easier for Felipe and/or Greg. Thanks.
Stephen Warren
Tested-byQuoted 2 lines · Mikko Perttunen
This patchset removes the ehci-tegra device tree property nvidia,vbus-gpio and adds support for the vbus-supply property to phy-tegra-usb.
With bug-fix patch "ARM: tegra: fix VBUS regulator GPIO polarity in DT" (which I just sent) applied first, this series,
A message that is not in the archive (sent off-list or not yet received): [email protected]
Thanks for testing!
Quoted 9 lines · Stephen Warren
Quoted 2 lines · Mikko Perttunen
This patchset removes the ehci-tegra device tree property nvidia,vbus-gpio and adds support for the vbus-supply property to phy-tegra-usb.
With bug-fix patch "ARM: tegra: fix VBUS regulator GPIO polarity in DT" (which I just sent) applied first, this series,
Tested-by Stephen Warren <[email protected]>
Hey Felipe/Stephen,
what's the status of this patchset and the other one ("usb: phy: tegra: Read UTMI parameters from device tree")? Can I consider them accepted/pulled for 3.12?
Thanks, Mikko
Quoted 9 lines · Mikko Perttunen
This patchset removes the ehci-tegra device tree property nvidia,vbus-gpio and adds support for the vbus-supply property to phy-tegra-usb.
Mikko Perttunen (3):
usb: phy,host: tegra: Use regulators instead of GPIOs for USB PHY VBUS
Documentation: devicetree: phy-tegra-usb: Add vbus-supply property for
host mode PHYs
ARM: dts: tegra20: Remove obsolete nvidia,vbus-gpio properties
Quoted 9 lines
.../bindings/usb/nvidia,tegra20-usb-phy.txt | 2 +- arch/arm/boot/dts/tegra20-seaboard.dts | 1 - arch/arm/boot/dts/tegra20-trimslice.dts | 1 - arch/arm/boot/dts/tegra20-whistler.dts | 2 -- drivers/usb/host/ehci-tegra.c | 34 +--------------------- drivers/usb/phy/phy-tegra-usb.c | 23 +++++++++++++++ include/linux/usb/tegra_usb_phy.h | 1 + 7 files changed, 26 insertions(+), 38 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 5 lines · Mikko Perttunen
Hey Felipe/Stephen,
what's the status of this patchset and the other one ("usb: phy: tegra: Read UTMI parameters from device tree")? Can I consider them accepted/pulled for 3.12?
3.11-rc1 was just released over the weekend. Patches for 3.12 can only just be applied now. I'm planning to look through all the USB cleanup patches that have been posted recently, test them, and work out the best way to merge them and handle any dependencies. I'll post mail once I've done that.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html