ohci and ehci-platform clks, phy and dt support
Subsystems (4)
v7 cover ohci and ehci-platform clks, phy and dt support
Hi All,
This version of my ohci and ehci-platform clks, phy and dt support patch-set, really fixes the 2 small bugs Alan found.
Regards,
Hans
PATCH v7 1/2 ohci-platform: Add support for devicetree instantiation
Add support for ohci-platform instantiation from devicetree, including optionally getting clks and a phy from devicetree, and enabling / disabling those on power_on / off.
This should allow using ohci-platform from devicetree in various cases. Specifically after this commit it can be used for the ohci controller found on Allwinner sunxi SoCs.
--- Documentation/devicetree/bindings/usb/usb-ohci.txt | 22 +++ drivers/usb/host/ohci-platform.c | 164 ++++++++++++++++++--- 2 files changed, 162 insertions(+), 24 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/usb-ohci.txt
Documentation/devicetree/bindings/usb/usb-ohci.txt new file +22 -0
@@ -0,0 +1,22 @@ +USB OHCI controllers + +Required properties: +- compatible : "usb-ohci" +- reg : ohci controller register range (address and length) +- interrupts : ohci controller interrupt + +Optional properties: +- clocks : a list of phandle + clock specifier pairs +- phys : phandle + phy specifier pair +- phy-names : "usb" + +Example: + + ohci0: ohci at 0x01c14400 { + compatible = "allwinner,sun4i-a10-ohci", "usb-ohci"; + reg = <0x01c14400 0x100>; + interrupts = <64>; + clocks = <&usb_clk 6>, <&ahb_gates 2>; + phys = <&usbphy 1>; + phy-names = "usb"; + };
drivers/usb/host/ohci-platform.c +140 -24
254 lines not on this page · raw message
Signature · 1 line
1.8.4.2
PATCH v7 1/2 ohci-platform: Add support for devicetree instantiation
Hello.
Quoted 10 lines · Hans de Goede
Add support for ohci-platform instantiation from devicetree, including optionally getting clks and a phy from devicetree, and enabling / disabling those on
power_on/ off.This should allow using ohci-platform from devicetree in various cases. Specifically after this commit it can be used for the ohci controller found on Allwinner sunxi SoCs.
Signed-off-by Hans de Goede <[email protected]>Acked-by Alan Stern <[email protected]>
[...]
Have only found time to fully read the patches just now...
Quoted 11 lines
Documentation/devicetree/bindings/usb/usb-ohci.txt new file +5
-0@@ -0,0 +1,22 @@ +USB OHCI controllers + +Required properties: +- compatible : "usb-ohci" +- reg : ohci controller register range (address and length)
Documentation/devicetree/bindings/usb/usb-ohci.txt line 15
Quoted 10 lines
Documentation/devicetree/bindings/usb/usb-ohci.txt new file +10
-0+- interrupts : ohci controller interrupt + +Optional properties: +- clocks : a list of phandle + clock specifier pairs +- phys : phandle + phy specifier pair +- phy-names : "usb" + +Example: + + ohci0: ohci at 0x01c14400 {
Two minor nits: there should be no "0x" in the address part of the node
name. And according to ePAPR [1], "the name of a node should be somewhat generic, reflecting the function of the device and not its precise programming model. If appropriate, the name should be one of the following choices:
[...]
- usb".
Same comments for "usb-ehci" binding.
Documentation/devicetree/bindings/usb/usb-ohci.txt line 22
Quoted 7 lines
Documentation/devicetree/bindings/usb/usb-ohci.txt new file +7
-0+ compatible = "allwinner,sun4i-a10-ohci", "usb-ohci"; + reg = <0x01c14400 0x100>; + interrupts = <64>; + clocks = <&usb_clk 6>, <&ahb_gates 2>; + phys = <&usbphy 1>; + phy-names = "usb"; + };
[1] http://www.power.org/resources/downloads/Power_ePAPR_APPROVED_v1.0.pdf
WBR, Sergei
PATCH v7 1/2 ohci-platform: Add support for devicetree instantiation
Hi,
Quoted 41 lines · Sergei Shtylyov
Hello.
Quoted 10 lines · Hans de Goede
Add support for ohci-platform instantiation from devicetree, including optionally getting clks and a phy from devicetree, and enabling / disabling those on
power_on/ off.This should allow using ohci-platform from devicetree in various cases. Specifically after this commit it can be used for the ohci controller found on Allwinner sunxi SoCs.
Signed-off-by Hans de Goede <[email protected]>Acked-by Alan Stern <[email protected]>[...]
Have only found time to fully read the patches just now...
Quoted 11 lines
Documentation/devicetree/bindings/usb/usb-ohci.txt new file +5
-0@@ -0,0 +1,22 @@ +USB OHCI controllers + +Required properties: +- compatible : "usb-ohci" +- reg : ohci controller register range (address and length)Documentation/devicetree/bindings/usb/usb-ohci.txt line 15
Quoted 10 lines
Documentation/devicetree/bindings/usb/usb-ohci.txt new file +10
-0+- interrupts : ohci controller interrupt + +Optional properties: +- clocks : a list of phandle + clock specifier pairs +- phys : phandle + phy specifier pair +- phy-names : "usb" + +Example: + + ohci0: ohci at 0x01c14400 {Two minor nits: there should be no "0x" in the address part of the node name. And according to ePAPR [1], "the name of a node should be somewhat generic, reflecting the function of the device and not its precise programming model. If appropriate, the name should be one of the following choices:
Quoted 4 lines
[...]
- usb".Same comments for "usb-ehci" binding.
You're right on both accounts, I'll do a v8 tomorrow, including a re-spin of the big-endian patches.
Regards,
Hans
PATCH v7 2/2 ehci-platform: Add support for clks and phy passed through devicetree
In reply to Hans de GoedeCurrently ehci-platform is only used in combination with devicetree when used with some Via socs. By extending it to (optionally) get clks and a phy from devicetree, and enabling / disabling those on power_on / off, it can be used more generically. Specifically after this commit it can be used for the ehci controller on Allwinner sunxi SoCs.
Since ehci-platform is intended to handle any generic enough non pci ehci device, add a "usb-ehci" compatibility string.
There already is a usb-ehci device-tree bindings document, update this with clks and phy bindings info.
Although actually quite generic so far the via,vt8500 compatibilty string had its own bindings document. Somehow we even ended up with 2 of them. Since these provide no extra information over the generic usb-ehci documentation, this patch removes them.
The ehci-ppc-of.c driver also claims the usb-ehci compatibility string, even though it mostly is ibm,usb-ehci-440epx specific. ehci-platform.c is not needed on ppc platforms, so add a !PPC_OF dependency to it to avoid 2 drivers claiming the same compatibility string getting build on ppc.
--- Documentation/devicetree/bindings/usb/usb-ehci.txt | 25 +++- .../devicetree/bindings/usb/via,vt8500-ehci.txt | 15 --- .../devicetree/bindings/usb/vt8500-ehci.txt | 12 -- drivers/usb/host/Kconfig | 1 + drivers/usb/host/ehci-platform.c | 149 +++++++++++++++++---- 5 files changed, 142 insertions(+), 60 deletions(-) delete mode 100644 Documentation/devicetree/bindings/usb/via,vt8500-ehci.txt delete mode 100644 Documentation/devicetree/bindings/usb/vt8500-ehci.txt
Documentation/devicetree/bindings/usb/usb-ehci.txt +18 -7
@@ -7,13 +7,14 @@ Required properties: (debug-port or other) can be also specified here, but only after definition of standard EHCI registers. - interrupts : one EHCI interrupt should be described here. -If device registers are implemented in big endian mode, the device -node should have "big-endian-regs" property. -If controller implementation operates with big endian descriptors, -"big-endian-desc" property should be specified. -If both big endian registers and descriptors are used by the controller -implementation, "big-endian" property can be specified instead of having -both "big-endian-regs" and "big-endian-desc". + +Optional properties: + - big-endian-regs : boolean, set this for hcds with big-endian registers + - big-endian-desc : boolean, set this for hcds with big-endian descriptors + - big-endian : boolean, for hcds with big-endian-regs + big-endian-desc + - clocks : a list of phandle + clock specifier pairs + - phys : phandle + phy specifier pair + - phy-names : "usb" Example (Sequoia 440EPx): ehci at e0000300 {
@@ -23,3 +24,13 @@ Example (Sequoia 440EPx): reg = <0 e0000300 90 0 e0000390 70>; big-endian; }; + +Example (Allwinner sun4i A10 SoC): + ehci0: ehci at 0x01c14000 { + compatible = "allwinner,sun4i-a10-ehci", "usb-ehci"; + reg = <0x01c14000 0x100>; + interrupts = <39>; + clocks = <&ahb_gates 1>; + phys = <&usbphy 1>; + phy-names = "usb"; + };
Documentation/devicetree/bindings/usb/via,vt8500-ehci.txt deleted +0 -15
@@ -1,15 +0,0 @@ -VIA/Wondermedia VT8500 EHCI Controller ------------------------------------------------------ - -Required properties: -- compatible : "via,vt8500-ehci" -- reg : Should contain 1 register ranges(address and length) -- interrupts : ehci controller interrupt - -Example: - - ehci at d8007900 { - compatible = "via,vt8500-ehci"; - reg = <0xd8007900 0x200>; - interrupts = <43>; - };
Documentation/devicetree/bindings/usb/vt8500-ehci.txt deleted +0 -12
@@ -1,12 +0,0 @@ -VIA VT8500 and Wondermedia WM8xxx SoC USB controllers. - -Required properties: - - compatible: Should be "via,vt8500-ehci" or "wm,prizm-ehci". - - reg: Address range of the ehci registers. size should be 0x200 - - interrupts: Should contain the ehci interrupt. - -usb: ehci at D8007100 { - compatible = "wm,prizm-ehci", "usb-ehci"; - reg = <0xD8007100 0x200>; - interrupts = <1>; -};
drivers/usb/host/Kconfig +1 -0
@@ -255,6 +255,7 @@ config USB_EHCI_ATH79 config USB_EHCI_HCD_PLATFORM tristate "Generic EHCI driver for a platform device" + depends on !PPC_OF default n ---help--- Adds an EHCI host driver for a generic platform device, which
drivers/usb/host/ehci-platform.c +123 -26
244 lines not on this page · raw message
Signature · 1 line
1.8.4.2
PATCH v7 2/2 ehci-platform: Add support for clks and phy passed through devicetree
2014/1/15 Hans de Goede <[email protected]>:
Quoted 44 lines
Currently ehci-platform is only used in combination with devicetree when used with some Via socs. By extending it to (optionally) get clks and a phy from devicetree, and enabling / disabling those on
power_on/ off, it can be used more generically. Specifically after this commit it can be used for the ehci controller on Allwinner sunxi SoCs.Since ehci-platform is intended to handle any generic enough non pci ehci device, add a "usb-ehci" compatibility string.
There already is a usb-ehci device-tree bindings document, update this with clks and phy bindings info.
Although actually quite generic so far the via,vt8500 compatibilty string had its own bindings document. Somehow we even ended up with 2 of them. Since these provide no extra information over the generic usb-ehci documentation, this patch removes them.
The
ehci-ppc-of.cdriver also claims the usb-ehci compatibility string, even though it mostly is ibm,usb-ehci-440epx specific.ehci-platform.cis not needed on ppc platforms, so add a !PPC_OF dependency to it to avoid 2 drivers claiming the same compatibility string getting build on ppc.Signed-off-by Hans de Goede <[email protected]>Acked-by Alan Stern <[email protected]>--- Documentation/devicetree/bindings/usb/usb-ehci.txt | 25 +++- .../devicetree/bindings/usb/via,vt8500-ehci.txt | 15 --- .../devicetree/bindings/usb/vt8500-ehci.txt | 12 -- drivers/usb/host/Kconfig | 1 + drivers/usb/host/ehci-platform.c | 149 +++++++++++++++++---- 5 files changed, 142 insertions(+), 60 deletions(-) delete mode 100644 Documentation/devicetree/bindings/usb/via,vt8500-ehci.txt delete mode 100644 Documentation/devicetree/bindings/usb/vt8500-ehci.txtDocumentation/devicetree/bindings/usb/usb-ehci.txt +0
-2@@ -7,13 +7,14 @@ Required properties: (debug-port or other) can be also specified here, but only after definition of standard EHCI registers. - interrupts : one EHCI interrupt should be described here. -If device registers are implemented in big endian mode, the device -node should have "big-endian-regs" property.
Documentation/devicetree/bindings/usb/usb-ehci.txt Required properties: · line 14
Quoted 10 lines
Documentation/devicetree/bindings/usb/usb-ehci.txt +5
-5-If controller implementation operates with big endian descriptors, -"big-endian-desc" property should be specified. -If both big endian registers and descriptors are used by the controller -implementation, "big-endian" property can be specified instead of having -both "big-endian-regs" and "big-endian-desc". + +Optional properties: + - big-endian-regs : boolean, set this for hcds with big-endian registers + - big-endian-desc : boolean, set this for hcds with big-endian descriptors + - big-endian : boolean, for hcds with big-endian-regs + big-endian-desc
These properties are specified here in the documentation binding, but they are not handled by the ehci-platform driver, is that intentional? Fairly quickly people will start adopting the ehci-platform driver on DT-aware platforms, so it would be nice to support those 2 (3) properties right away?
Signature · 1 line
Florian
Alan Stern
maintainerv7 cover ohci and ehci-platform clks, phy and dt support
In reply to Hans de GoedeQuoted 4 lines · Hans de Goede
Hi All,
This version of my ohci and ehci-platform clks, phy and dt support patch-set, really fixes the 2 small bugs Alan found.
All okay -- this time I can't find anything to complain about. :-)
Alan Stern
v7 cover ohci and ehci-platform clks, phy and dt support
Le mercredi 15 janvier 2014, 15:26:21 Alan Stern a ?crit :
Quoted 7 lines · Hans de Goede
Quoted 4 lines
Hi All,
This version of my ohci and ehci-platform clks, phy and dt support patch-set, really fixes the 2 small bugs Alan found.
All okay -- this time I can't find anything to complain about. :-)
There is one minor issue; which is that the ehci binding claims the driver supports the following optional boolean properties:
- big-endian-regs : boolean, set this for hcds with big-endian registers
- big-endian-desc : boolean, set this for hcds with big-endian descriptors
- big-endian : boolean, for hcds with big-endian-regs + big-endian-desc
while it does not (yet) so this is misleading. Can we at get that fixed before merging? Copy pasting the PPC ehci driver should do the job.
Signature · 1 line
Florian
Alan Stern
maintainerv7 cover ohci and ehci-platform clks, phy and dt support
Quoted 12 lines · Florian Fainelli
Le mercredi 15 janvier 2014, 15:26:21 Alan Stern a ?crit :
Quoted 7 lines · Hans de Goede
Quoted 4 lines
Hi All,
This version of my ohci and ehci-platform clks, phy and dt support patch-set, really fixes the 2 small bugs Alan found.
All okay -- this time I can't find anything to complain about. :-)
There is one minor issue; which is that the ehci binding claims the driver supports the following optional boolean properties:
Quoted 6 lines
- big-endian-regs : boolean, set this for hcds with big-endian registers
- big-endian-desc : boolean, set this for hcds with big-endian descriptors
- big-endian : boolean, for hcds with big-endian-regs + big-endian-descwhile it does not (yet) so this is misleading. Can we at get that fixed before merging? Copy pasting the PPC ehci driver should do the job.
I agree it needs to be fixed. This can be done in a follow-up patch, though. It doesn't have to be in this one because nobody is using ehci-platform with DT yet.
A simple copy from the PPC driver isn't quite enough, because the platform data settings would override the DT values. ehci_platform_reset has to be changed so that it sets ehci->big_endian_desc and _mmio if the pdata flags are set, but otherwise leaves them alone.
Hans, would you like to write another patch to take care of this?
Alan Stern
v7 cover ohci and ehci-platform clks, phy and dt support
Hi,
Quoted 25 lines · Alan Stern
Quoted 12 lines · Florian Fainelli
Le mercredi 15 janvier 2014, 15:26:21 Alan Stern a ?crit :
Quoted 7 lines · Hans de Goede
Quoted 4 lines
Hi All,
This version of my ohci and ehci-platform clks, phy and dt support patch-set, really fixes the 2 small bugs Alan found.
All okay -- this time I can't find anything to complain about. :-)
There is one minor issue; which is that the ehci binding claims the driver supports the following optional boolean properties:
Quoted 6 lines
- big-endian-regs : boolean, set this for hcds with big-endian registers
- big-endian-desc : boolean, set this for hcds with big-endian descriptors
- big-endian : boolean, for hcds with big-endian-regs + big-endian-descwhile it does not (yet) so this is misleading. Can we at get that fixed before merging? Copy pasting the PPC ehci driver should do the job.
I agree it needs to be fixed. This can be done in a follow-up patch, though. It doesn't have to be in this one because nobody is using ehci-platform with DT yet.
Quoted 7 lines
A simple copy from the PPC driver isn't quite enough, because the platform data settings would override the DT values.
ehci_platform_resethas to be changed so that it setsehci->big_endian_descand_mmioif the pdata flags are set, but otherwise leaves them alone.Hans, would you like to write another patch to take care of this?
I already took a quick look at this, setting the ehci->big_endian* flags is easy, the problem is that they won't work unless we also define CONFIG_USB_EHCI_BIG_ENDIAN_DESC and CONFIG_USB_EHCI_BIG_ENDIAN_MMIO
I would like to avoid doing something like the ugliness we've with USB_OHCI_HCD_PPC_OF_BE and USB_OHCI_HCD_PPC_OF_LE, which means just selecting these 2 config options whenever USB_EHCI_HCD_PLATFORM is enabled, but I'm not sure if that is acceptable.
The same goes for the ohci code btw.
Regards,
Hans
Alan Stern
maintainerv7 cover ohci and ehci-platform clks, phy and dt support
Quoted 11 lines · Hans de Goede
Quoted 7 lines
A simple copy from the PPC driver isn't quite enough, because the platform data settings would override the DT values.
ehci_platform_resethas to be changed so that it setsehci->big_endian_descand_mmioif the pdata flags are set, but otherwise leaves them alone.Hans, would you like to write another patch to take care of this?
I already took a quick look at this, setting the ehci->big_endian* flags is easy, the problem is that they won't work unless we also define
CONFIG_USB_EHCI_BIG_ENDIAN_DESCandCONFIG_USB_EHCI_BIG_ENDIAN_MMIO
That's right. The platforms have to define those symbols if they use big-endian values (or even worse, mixed endian).
Quoted 4 lines
I would like to avoid doing something like the ugliness we've with
USB_OHCI_HCD_PPC_OF_BEandUSB_OHCI_HCD_PPC_OF_LE, which means just selecting these 2 config options wheneverUSB_EHCI_HCD_PLATFORMis enabled, but I'm not sure if that is acceptable.
At the moment, I don't think it's so terrible. That ohci_ppc ugliness probably could have been avoided originally. It looks like an attempt to make sure you don't end up matching the hardware to a driver built with the wrong endianness. I imagine it would be less messy to detect that sort of problem at runtime.
Quoted 1 line
The same goes for the ohci code btw.
Certainly.
Alan Stern