usb: tegra20-ehci: Add devicetree support.
Subsystems (6)
PATCH 1/3 usb: tegra20-ehci: Add devicetree support.
From: Andrew Chew <[email protected]>
Add code to try to get platform data information (register base, irq, modes, various tuning parameters) from device tree, if not present in board files.
--- .../devicetree/bindings/usb/tegra20-ehci.txt | 27 +++ arch/arm/mach-tegra/include/mach/usb_phy.h | 2 +- drivers/usb/host/ehci-tegra.c | 197 +++++++++++++++++++- 3 files changed, 219 insertions(+), 7 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/tegra20-ehci.txt
Documentation/devicetree/bindings/usb/tegra20-ehci.txt new file +27 -0
@@ -0,0 +1,27 @@ +NVIDIA Tegra20 SOC USB controllers + +The device node for a USB controller that is part of a Tegra20 +SOC is as described in the document "Open Firmware Recommended +Practice : Universal Serial Bus" with the following modifications +and additions : + +Required properties : + - compatible : Should be "tegra20-ehci". + - mode : Should be <1> for USB device, <2> for USB host, or <3> for USB OTG. + - power_down_on_bus_suspend : For host mode only, should be defined if you + want the USB phy to power down when the host is suspended. + - type : Should be one of "utmi" or "ulpi". + +Required properties for type = "utmi". These values are derived from +characterization by system engineering. + - hssync_start_delay + - idle_wait_delay + - elastic_limit + - term_range_adj + - xcvr_setup + - xcvr_lsfslew + - xcvr_lsrslew + +Required properties for type = "ulpi": + - reset_gpio : The GPIO used to drive reset + - clk
arch/arm/mach-tegra/include/mach/usb_phy.h +1 -1
@@ -32,7 +32,7 @@ struct tegra_utmip_config {struct tegra_ulpi_config {int reset_gpio; -const char *clk; +char *clk; };enum tegra_usb_phy_port_speed {
drivers/usb/host/ehci-tegra.c +191 -6
263 lines not on this page · raw message
Signature · 1 line
1.7.6
PATCH 2/3 dt: tegra20: Add ehci host controller nodes.
From: Andrew Chew <[email protected]>
These values were derived from various headers in arch/arm/mach-tegra.
--- arch/arm/boot/dts/tegra20.dtsi | 52 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 52 insertions(+), 0 deletions(-)
arch/arm/boot/dts/tegra20.dtsi +52 -0
@@ -160,5 +160,57 @@ interrupts = < 63 >; status = "disabled"; }; + + ehci@c5000000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "nvidia,tegra20-ehci"; + reg = <0xc5000000 0x4000>; + interrupts = < 52 >; + mode = < 1 >; + power_down_on_bus_suspend; + type = "utmi"; + hssync_start_delay = < 0 >; + idle_wait_delay = < 17 >; + elastic_limit = < 16 >; + term_range_adj = < 6 >; + xcvr_setup = < 15 >; + xcvr_lsfslew = < 2 >; + xcvr_lsrslew = < 2 >; + status = "disabled"; + }; + + ehci@c5004000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "nvidia,tegra20-ehci"; + reg = <0xc5004000 0x4000>; + interrupts = < 53 >; + mode = < 1 >; + power_down_on_bus_suspend; + type = "ulpi"; + reset_gpio = < 169 >; + clk = "cdev2"; + status = "disabled"; + }; + + ehci@c5008000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "nvidia,tegra20-ehci"; + reg = <0xc5008000 0x4000>; + interrupts = < 129 >; + mode = < 1 >; + power_down_on_bus_suspend; + type = "utmi"; + hssync_start_delay = < 0 >; + idle_wait_delay = < 17 >; + elastic_limit = < 16 >; + term_range_adj = < 6 >; + xcvr_setup = < 8 >; + xcvr_lsfslew = < 2 >; + xcvr_lsrslew = < 2 >; + status = "disabled"; + }; };
Signature · 1 line
1.7.6
RE: [PATCH 2/3] dt: tegra20: Add ehci host controller nodes.
[email protected] wrote at Tuesday, July 19, 2011 4:47 PM:
Quoted 14 lines
From: Andrew Chew <[email protected]>
These values were derived from various headers in
arch/arm/mach-tegra.Signed-off-by Andrew Chew <[email protected]>--- arch/arm/boot/dts/tegra20.dtsi | 52 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 52 insertions(+), 0 deletions(-)arch/arm/boot/dts/tegra20.dtsi +0
-0
arch/arm/boot/dts/tegra20.dtsi line 166
Quoted 7 lines
arch/arm/boot/dts/tegra20.dtsi +4
-0@@ -160,5 +160,57 @@ interrupts = < 63 >; status = "disabled"; }; + + ehci@c5000000 { + #address-cells = <1>; + #size-cells = <0>;
I don't think those two properties are needed for an EHCI node; children of the EHCI controller are probed rather than specified in device tree.
arch/arm/boot/dts/tegra20.dtsi line 170
Quoted 4 lines
arch/arm/boot/dts/tegra20.dtsi +4
-0+ compatible = "nvidia,tegra20-ehci"; + reg = <0xc5000000 0x4000>; + interrupts = < 52 >; + mode = < 1 >;
Should we make mode a string; device, host, or otg?
arch/arm/boot/dts/tegra20.dtsi line 180
Quoted 10 lines
arch/arm/boot/dts/tegra20.dtsi +10
-0+ power_down_on_bus_suspend; + type = "utmi"; + hssync_start_delay = < 0 >; + idle_wait_delay = < 17 >; + elastic_limit = < 16 >; + term_range_adj = < 6 >; + xcvr_setup = < 15 >; + xcvr_lsfslew = < 2 >; + xcvr_lsrslew = < 2 >; + status = "disabled";
In the latest devicetree/test, tegra20.dtsi doesn't specify status for any nodes, but leaves everything enabled. Instead, board-specific files disable any unused devices.
Quoted 38 lines
arch/arm/boot/dts/tegra20.dtsi +34
-1+ }; + + ehci@c5004000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "nvidia,tegra20-ehci"; + reg = <0xc5004000 0x4000>; + interrupts = < 53 >; + mode = < 1 >; + power_down_on_bus_suspend; + type = "ulpi"; + reset_gpio = < 169 >; + clk = "cdev2"; + status = "disabled"; + }; + + ehci@c5008000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "nvidia,tegra20-ehci"; + reg = <0xc5008000 0x4000>; + interrupts = < 129 >; + mode = < 1 >; + power_down_on_bus_suspend; + type = "utmi"; + hssync_start_delay = < 0 >; + idle_wait_delay = < 17 >; + elastic_limit = < 16 >; + term_range_adj = < 6 >; + xcvr_setup = < 8 >; + xcvr_lsfslew = < 2 >; + xcvr_lsrslew = < 2 >; + status = "disabled"; + }; }; --1.7.6
Signature · 1 line
nvpublic
RE: [PATCH 2/3] dt: tegra20: Add ehci host controller nodes.
Stephen Warren wrote at Tuesday, July 19, 2011 5:00 PM:
Quoted 4 lines
[email protected] wrote at Tuesday, July 19, 2011 4:47 PM:
Quoted 3 lines
From: Andrew Chew <[email protected]>
These values were derived from various headers in
arch/arm/mach-tegra.
...
Quoted 22 lines
Quoted 22 lines
arch/arm/boot/dts/tegra20.dtsi +14
-0@@ -160,5 +160,57 @@ interrupts = < 63 >; status = "disabled"; }; + + ehci@c5000000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "nvidia,tegra20-ehci"; + reg = <0xc5000000 0x4000>; + interrupts = < 52 >; + mode = < 1 >; + power_down_on_bus_suspend; + type = "utmi"; + hssync_start_delay = < 0 >; + idle_wait_delay = < 17 >; + elastic_limit = < 16 >; + term_range_adj = < 6 >;
Quoted 8 lines
arch/arm/boot/dts/tegra20.dtsi line 180
Quoted 4 lines
arch/arm/boot/dts/tegra20.dtsi +4
-0+ xcvr_setup = < 15 >; + xcvr_lsfslew = < 2 >; + xcvr_lsrslew = < 2 >; + status = "disabled";In the latest devicetree/test,
tegra20.dtsidoesn't specify status for any nodes, but leaves everything enabled. Instead, board-specific files disable any unused devices.
Andrew pointed out that isn't actually true right now. However, Grant did state that he was *going* to make Tegra work that way, so the comment basically still stands.
Signature · 6 lines
nvpublic -- 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 2/3] dt: tegra20: Add ehci host controller nodes.
In reply to [email protected]Hi,
Quoted 25 lines · On Tue, Jul 19, 2011 at 3:46 PM, <[email protected]> wrote:
From: Andrew Chew <[email protected]>
These values were derived from various headers in
arch/arm/mach-tegra.Signed-off-by Andrew Chew <[email protected]>---
arch/arm/boot/dts/tegra20.dtsi | 52 ++++++++++++++++++++++++++++++++++++++++1 files changed, 52 insertions(+), 0 deletions(-)arch/arm/boot/dts/tegra20.dtsi +8
-0@@ -160,5 +160,57 @@ interrupts = < 63 >; status = "disabled"; }; + + ehci@c5000000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "nvidia,tegra20-ehci"; + reg = <0xc5000000 0x4000>; + interrupts = < 52 >; + mode = < 1 >;
arch/arm/boot/dts/tegra20.dtsi line 180
Quoted 10 lines
arch/arm/boot/dts/tegra20.dtsi +10
-0+ power_down_on_bus_suspend; + type = "utmi"; + hssync_start_delay = < 0 >; + idle_wait_delay = < 17 >; + elastic_limit = < 16 >; + term_range_adj = < 6 >; + xcvr_setup = < 15 >; + xcvr_lsfslew = < 2 >; + xcvr_lsrslew = < 2 >; + status = "disabled";
These are mostly phy related settings, maybe do a phy subnode with them? That way the usb_phy code can probe on that.
-Olof
PATCH 3/3 dt: tegra20: Add ehci nodes to Seaboard.
In reply to [email protected]From: Andrew Chew <[email protected]>
--- arch/arm/boot/dts/tegra-seaboard.dts | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
arch/arm/boot/dts/tegra-seaboard.dts +12 -0
@@ -31,4 +31,16 @@ sdhci@c8000600 { status = "ok"; }; + + ehci@c5000000 { + status = "ok"; + }; + + ehci@c5004000 { + status = "ok"; + }; + + ehci@c5008000 { + status = "ok"; + }; };
Signature · 6 lines
1.7.6 -- 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 3/3] dt: tegra20: Add ehci nodes to Seaboard.
[email protected] wrote at Tuesday, July 19, 2011 4:47 PM:
Quoted 3 lines
From: Andrew Chew <[email protected]>
Signed-off-by Andrew Chew <[email protected]>
Removing status="disabled" from tegra20.dtsi makes this patch obsolete.
Although that said, since many of the USB properties are board-specific and determined by system characterization, they aren't generally applicable to all Tegra devices. As such, should those values be moved into tegra-seaboard.dts instead? Perhaps tegra20.dtsi should specify the default values that the driver currently uses if not supplied with platform data though... I think the Seaboard values are the defaults, which still would make this patch obsolete.
Quoted 27 lines
--- arch/arm/boot/dts/tegra-seaboard.dts | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)arch/arm/boot/dts/tegra-seaboard.dts +12
-1@@ -31,4 +31,16 @@ sdhci@c8000600 { status = "ok"; }; + + ehci@c5000000 { + status = "ok"; + }; + + ehci@c5004000 { + status = "ok"; + }; + + ehci@c5008000 { + status = "ok"; + }; }; --1.7.6
Signature · 6 lines
nvpublic -- 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 3/3] dt: tegra20: Add ehci nodes to Seaboard.
Quoted 8 lines
Although that said, since many of the USB properties are board-specific
and determined by system characterization, they aren't generally applicable to all Tegra devices. As such, should those values be moved intotegra-seaboard.dtsinstead? Perhapstegra20.dtsishould specify the default values that the driver currently uses if not supplied with platform data though... I think the Seaboard values are the defaults, which still would make this patch obsolete.
Turns out the ones I put in tegra20.dtsi are NOT the defaults. The defaults are in arch/arm/mach-tegra/usb_phy.c, contained in "utmip_defaults[]".
I think I'm going to put those utmip_defaults[] stuff into tegra20.dtsi, and override them in tegra-seaboard.dts. How's that sound?
And since there are defaults specified in tegra20.dtsi, does it really make sense to also have default values assigned in ehci-tegra.c (for when a property is not present)? I worry that the information is now duplicated. If those properties aren't present, then someone's mucked with the tegra20.dtsi ehci properties.
Re: [PATCH 3/3] dt: tegra20: Add ehci nodes to Seaboard.
Quoted 9 lines · Andrew Chew
Quoted 8 lines
Although that said, since many of the USB properties are board-specific
and determined by system characterization, they aren't generally applicable to all Tegra devices. As such, should those values be moved intotegra-seaboard.dtsinstead? Perhapstegra20.dtsishould specify the default values that the driver currently uses if not supplied with platform data though... I think the Seaboard values are the defaults, which still would make this patch obsolete.
Quoted 3 lines
Turns out the ones I put in
tegra20.dtsiare NOT the defaults. The defaults are inarch/arm/mach-tegra/usb_phy.c, contained in "utmip_defaults[]".I think I'm going to put those utmip_defaults[] stuff into
tegra20.dtsi, and override them integra-seaboard.dts. How's that sound?
Sounds good to me, or if they for sure will need tuning on all boards and there are no "safe" settings, leave them out from the generic config alltogether.
Quoted 1 line
And since there are defaults specified in
tegra20.dtsi, does it really make sense to also have default values assigned inehci-tegra.c(for when a property is not present)? I worry that the information is now duplicated. If those properties aren't present, then someone's mucked with thetegra20.dtsiehci properties.
Once all platforms are cut over to devicetree-only, that can be the case. Until that happens, there will be need for settings in the C code too. Is Nvidia switching to device trees for android/fastboot?
-Olof
RE: [PATCH 3/3] dt: tegra20: Add ehci nodes to Seaboard.
Quoted 10 lines
Quoted 1 line
And since there are defaults specified in
tegra20.dtsi,does it really make sense to also have default values assigned in
ehci-tegra.c(for when a property is not present)? I worry that the information is now duplicated. If those properties aren't present, then someone's mucked with thetegra20.dtsiehci properties.Once all platforms are cut over to devicetree-only, that can be the case. Until that happens, there will be need for settings in the C code too. Is Nvidia switching to device trees for android/fastboot?
I'm not talking about the defaults in arch/arm/mach-tegra/usb_phy.c. I understand that once we cut over to devicetree-only, the defaults there can go away.
The question is, if a property is not present, what should we do? The default value for that property SHOULD be present somewhere in the dts chain. But if it's not, should we error out, spit out a warning, or spit out a warning and assign a default? If it's the latter case, then we now have a set of defaults in dts, as well as C code, regardless of whether we've switched over to devicetree-only or not.
Re: [PATCH 3/3] dt: tegra20: Add ehci nodes to Seaboard.
Quoted 7 lines · Andrew Chew
Quoted 7 lines
Quoted 1 line
And since there are defaults specified in
tegra20.dtsi,does it really make sense to also have default values assigned in
ehci-tegra.c(for when a property is not present)? I worry that the information is now duplicated. If those properties aren't present, then someone's mucked with thetegra20.dtsiehci properties.
Quoted 7 lines
Quoted 3 lines
Once all platforms are cut over to devicetree-only, that can be the case. Until that happens, there will be need for settings in the C code too. Is Nvidia switching to device trees for android/fastboot?
I'm not talking about the defaults in
arch/arm/mach-tegra/usb_phy.c. I understand that once we cut over to devicetree-only, the defaults there can go away.The question is, if a property is not present, what should we do? The default value for that property SHOULD be present somewhere in the dts chain. But if it's not, should we error out, spit out a warning, or spit out a warning and assign a default? If it's the latter case, then we now have a set of defaults in dts, as well as C code, regardless of whether we've switched over to devicetree-only or not.
If there are no safe/sane defaults, then there isn't much to be done there. I'd say fail probe (i.e. error out) to avoid surprises.
-Olof
[email protected] wrote at Tuesday, July 19, 2011 4:47 PM:
Quoted 6 lines
From: Andrew Chew <[email protected]>
Add code to try to get platform data information (register base, irq, modes, various tuning parameters) from device tree, if not present in board files.
Quoted 7 lines
Signed-off-by Andrew Chew <[email protected]>--- .../devicetree/bindings/usb/tegra20-ehci.txt | 27 +++ arch/arm/mach-tegra/include/mach/usb_phy.h | 2 +- drivers/usb/host/ehci-tegra.c | 197 +++++++++++++++++++- 3 files changed, 219 insertions(+), 7 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/tegra20-ehci.txt
I sent a variety of comments on this patch internally to Andrew, but the email crossed paths with the posting to the public mailing lists. I won't bother repeating those comments here, but I assume they'll be addressed in a new version of this patch.
Signature · 1 line
nvpublic
Quoted 15 lines · Stephen Warren
[email protected] wrote at Tuesday, July 19, 2011 4:47 PM:
Quoted 6 lines
From: Andrew Chew <[email protected]>
Add code to try to get platform data information (register base, irq, modes, various tuning parameters) from device tree, if not present in board files.
Quoted 7 lines
Signed-off-by Andrew Chew <[email protected]>--- .../devicetree/bindings/usb/tegra20-ehci.txt | 27 +++ arch/arm/mach-tegra/include/mach/usb_phy.h | 2 +- drivers/usb/host/ehci-tegra.c | 197 +++++++++++++++++++- 3 files changed, 219 insertions(+), 7 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/tegra20-ehci.txt
Quoted 4 lines
I sent a variety of comments on this patch internally to Andrew, but the email crossed paths with the posting to the public mailing lists. I won't bother repeating those comments here, but I assume they'll be addressed in a new version of this patch.
Okay, I'll wait for the next version then.
g.