pinctrl: Add NVIDIA Tegra XUSB pad controller support
Subsystems (3)
PATCH 1/4 pinctrl: Add NVIDIA Tegra XUSB pad controller support
From: Thierry Reding <[email protected]>
The XUSB pad controller found on NVIDIA Tegra SoCs provides several pads that lanes can be assigned to in order to support a variety of interface
options: USB 2.0, USB 3.0, PCIe and SATA.
In addition to the pin controller used to assign lanes to pads two PHYs are exposed to allow the bricks for PCIe and SATA to be powered up and down by PCIe and SATA drivers.
--- drivers/pinctrl/Kconfig | 6 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-tegra-xusb.c | 913 +++++++++++++++++++++++ include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h | 7 + 4 files changed, 927 insertions(+) create mode 100644 drivers/pinctrl/pinctrl-tegra-xusb.c create mode 100644 include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h
drivers/pinctrl/Kconfig +6 -0
@@ -328,6 +328,12 @@ config PINCTRL_TEGRA124 bool select PINCTRL_TEGRA +config PINCTRL_TEGRA_XUSB + bool + select GENERIC_PHY + select PINCONF + select PINMUX + config PINCTRL_TZ1090 bool "Toumaz Xenif TZ1090 pin control driver" depends on SOC_TZ1090
drivers/pinctrl/Makefile +1 -0
@@ -55,6 +55,7 @@ obj-$(CONFIG_PINCTRL_TEGRA20) += pinctrl-tegra20.o obj-$(CONFIG_PINCTRL_TEGRA30) += pinctrl-tegra30.o obj-$(CONFIG_PINCTRL_TEGRA114) += pinctrl-tegra114.o obj-$(CONFIG_PINCTRL_TEGRA124) += pinctrl-tegra124.o +obj-$(CONFIG_PINCTRL_TEGRA_XUSB) += pinctrl-tegra-xusb.o obj-$(CONFIG_PINCTRL_TZ1090) += pinctrl-tz1090.o obj-$(CONFIG_PINCTRL_TZ1090_PDC) += pinctrl-tz1090-pdc.o obj-$(CONFIG_PINCTRL_U300) += pinctrl-u300.o
drivers/pinctrl/pinctrl-tegra-xusb.c new file +913 -0
913 lines not on this page · raw message
include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef _DT_BINDINGS_PINCTRL_TEGRA_XUSB_H +#define _DT_BINDINGS_PINCTRL_TEGRA_XUSB_H 1 + +#define TEGRA_XUSB_PADCTL_PCIE 0 +#define TEGRA_XUSB_PADCTL_SATA 1 + +#endif /* _DT_BINDINGS_PINCTRL_TEGRA_XUSB_H */
Signature · 1 line
1.9.2
PATCH 2/4 of: Add NVIDIA Tegra XUSB pad controller binding
From: Thierry Reding <[email protected]>
This patch adds the device tree binding documentation for the XUSB pad controller found on NVIDIA Tegra SoCs. It exposes both pinmuxing and PHY capabilities.
--- .../pinctrl/nvidia,tegra124-xusb-padctl.txt | 135 +++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt
Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt new file +135 -0
@@ -0,0 +1,135 @@ +Device tree binding for NVIDIA Tegra XUSB pad controller +======================================================== + +The Tegra XUSB pad controller manages a set of lanes, each of which can be +assigned to one out of a set of different pads. Some of these pads have an +associated PHY that must be powered up before the pad can be used. + +This document defines the device-specific binding for the XUSB pad controller. + +Refer to pinctrl-bindings.txt in this directory for generic information about +pin controller device tree bindings and ../phy/phy-bindings.txt for details on +how to describe and reference PHYs in device trees. + +Required properties: +-------------------- +- compatible: should be "nvidia,tegra124-xusb-padctl" +- reg: Physical base address and length of the controller's registers. +- resets: Must contain an entry for each entry in reset-names. + See ../reset/reset.txt for details. +- reset-names: Must include the following entries: + - padctl +- #address-cells: Should be 0. +- #size-cells: Should be 0. +- #phy-cells: Should be 1. The specifier is the index of the PHY to reference. + Possible values are: + - 0: PCIe + - 1: SATA + +Lane muxing: +------------ + +Child nodes contain the pinmux configurations following the conventions from +the pinctrl-bindings.txt document. Typically a single, static configuration is +given and applied at boot time. + +Each subnode describes groups of lanes along with parameters and pads that +they should be assigned to. The name of these subnodes is not important. All +subnodes should be parsed solely based on their content. + +Each subnode only applies the parameters that are explicitly listed. In other +words, if a subnode that lists a function but no pin configuration parameters +implies no information about any pin configuration parameters. Similarly, a +subnode that describes only an IDDQ parameter implies no information about +what function the pins are assigned to. For this reason even seemingly boolean +values are actually tristates in this binding: unspecified, off or on. +Unspecified is represented as an absent property, and off/on are represented +as integer values 0 and 1. + +Required properties: +- nvidia,lanes: An array of strings. Each string is the name of a lane. + +Optional properties: +- nvidia,function: A string that is the name of the function (pad) that the + pin or group should be assigned to. Valid values for function names are + listed below. +- nvidia,iddq: Enables IDDQ mode of the lane. (0: no, 1: yes) + +Note that not all of these properties are valid for all lanes. Lanes can be +divided into three groups: + + - otg-0, otg-1, otg-2: + + Valid functions for this group are: "snps", "xusb", "uart", "rsvd". + + The nvidia,iddq property does not apply to this group. + + - ulpi-0, hsic-0, hsic-1: + + Valid functions for this group are: "snps", "xusb". + + The nvidia,iddq property does not apply to this group. + + - pcie-0, pcie-1, pcie-2, pcie-3, pcie-4, sata-0: + + Valid functions for this group are: "pcie", "usb3", "sata", "rsvd". + + +Example: +======== + +SoC file extract: +----------------- + + padctl at 0,7009f000 { + compatible = "nvidia,tegra124-xusb-padctl"; + reg = <0x0 0x7009f000 0x0 0x1000>; + resets = <&tegra_car 142>; + reset-names = "padctl"; + + #address-cells = <0>; + #size-cells = <0>; + #phy-cells = <1>; + }; + +Board file extract: +------------------- + + pcie-controller at 0,01003000 { + ... + + phys = <&padctl 0>; + phy-names = "pcie"; + + ... + }; + + ... + + padctl: padctl at 0,7009f000 { + pinmux { + pinctrl-0 = <&padctl_default>; + pinctrl-names = "default"; + + padctl_default: pinmux { + usb3 { + nvidia,lanes = "pcie-0", "pcie-1"; + nvidia,function = "usb3"; + nvidia,iddq = <0>; + }; + + pcie { + nvidia,lanes = "pcie-2", "pcie-3", + "pcie-4"; + nvidia,function = "pcie"; + nvidia,iddq = <0>; + }; + + sata { + nvidia,lanes = "sata-0"; + nvidia,function = "sata"; + nvidia,iddq = <0>; + }; + }; + }; + };
Signature · 1 line
1.9.2
Re: [PATCH 2/4] of: Add NVIDIA Tegra XUSB pad controller binding
Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt line 27
Quoted 12 lines · Thierry Reding
From: Thierry Reding <[email protected]>
This patch adds the device tree binding documentation for the XUSB pad controller found on NVIDIA Tegra SoCs. It exposes both pinmuxing and PHY capabilities.
Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt +4
-0+- #phy-cells: Should be 1. The specifier is the index of the PHY to reference. + Possible values are: + - 0: PCIe + - 1: SATA
Those values are defined in include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h. I personally consider the <dt-bindings/> header files to be part of the binding itself, rather than being derived from the binding. As such, I'd suggest the following changes:
* Make this patch 1 not patch 2
* Move pinctrl-tegra-xusb.h into this patch.
* Remove the list of values above, and replace it with the text "See <dt-bindings/pinctrl/pinctrl-tegra-xusb.h> for the set of valid values".
We'll need to make sure this patch is applied to a topic branch that can be merged into the pinctrl tree and the Tegra tree for 3.17, assuming that you'll be sending patches for 3.17 that use pinctrl-tegra-xusb.h.
Quoted 4 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt +4
-0+Example: +======== + +SoC file extract:
Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt line 91
Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt +10
-0+----------------- + + padctl at 0,7009f000 { + compatible = "nvidia,tegra124-xusb-padctl"; + reg = <0x0 0x7009f000 0x0 0x1000>; + resets = <&tegra_car 142>; + reset-names = "padctl"; + + #address-cells = <0>; + #size-cells = <0>;
Why are those two properties required? Yes, this node has sub-nodes, but those sub-nodes don't have a reg property or unit address. The main Tegra pinctrl nodes don't have #address/size-cells.
Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt line 112
Quoted 7 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt +6
-0+Board file extract: +------------------- + padctl: padctl at 0,7009f000 { + pinmux { + pinctrl-0 = <&padctl_default>; + pinctrl-names = "default";
Isn't there one extra level of nodes here. In the DT patches later in this series, pinctrl-0/pinctrl-names are directly inside the top-level padctl node.
Re: [PATCH 2/4] of: Add NVIDIA Tegra XUSB pad controller binding
Quoted 20 lines · Stephen Warren
Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt line 27
Quoted 12 lines · Thierry Reding
From: Thierry Reding <[email protected]>
This patch adds the device tree binding documentation for the XUSB pad controller found on NVIDIA Tegra SoCs. It exposes both pinmuxing and PHY capabilities.
Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt +4
-0+- #phy-cells: Should be 1. The specifier is the index of the PHY to reference. + Possible values are: + - 0: PCIe + - 1: SATAThose values are defined in
include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h. I personally consider the <dt-bindings/> header files to be part of the binding itself, rather than being derived from the binding. As such, I'd suggest the following changes:
Quoted 4 lines
* Make this patch 1 not patch 2
* Movepinctrl-tegra-xusb.hinto this patch.
* Remove the list of values above, and replace it with the text "See <dt-bindings/pinctrl/pinctrl-tegra-xusb.h> for the set of valid values".
I remember discussions where people explicitly said that relying on the symbolic names in the DT bindings was a mistake because it would mean that everyone would need to have access to a mechanism similar to what we have in the Linux kernel (and that the header files would always need to be shipped with the DT bindings).
Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt +10
-0+Example: +======== + +SoC file extract: +----------------- + + padctl at 0,7009f000 { + compatible = "nvidia,tegra124-xusb-padctl"; + reg = <0x0 0x7009f000 0x0 0x1000>; + resets = <&tegra_car 142>;
Quoted 8 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt line 91
Quoted 4 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt +4
-0+ reset-names = "padctl"; + + #address-cells = <0>; + #size-cells = <0>;Why are those two properties required? Yes, this node has sub-nodes, but those sub-nodes don't have a reg property or unit address. The main Tegra pinctrl nodes don't have #address/size-cells.
I seem to remember that there was a reason but I'm pulling a blank. I'll do some testing with those removed and verify that they are indeed not needed.
Quoted 11 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt line 112
Quoted 7 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt +6
-0+Board file extract: +------------------- + padctl: padctl at 0,7009f000 { + pinmux { + pinctrl-0 = <&padctl_default>; + pinctrl-names = "default";Isn't there one extra level of nodes here. In the DT patches later in this series, pinctrl-0/pinctrl-names are directly inside the top-level padctl node.
Yes, this is left-over from an earlier version of the patch. Thanks for catching this.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140606/09c8765f/attachment.sig>
Re: [PATCH 2/4] of: Add NVIDIA Tegra XUSB pad controller binding
Quoted 26 lines · Thierry Reding
Quoted 20 lines · Stephen Warren
Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt line 27
Quoted 12 lines · Thierry Reding
From: Thierry Reding <[email protected]>
This patch adds the device tree binding documentation for the XUSB pad controller found on NVIDIA Tegra SoCs. It exposes both pinmuxing and PHY capabilities.
Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt +4
-0+- #phy-cells: Should be 1. The specifier is the index of the PHY to reference. + Possible values are: + - 0: PCIe + - 1: SATAThose values are defined in
include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h. I personally consider the <dt-bindings/> header files to be part of the binding itself, rather than being derived from the binding. As such, I'd suggest the following changes:Quoted 4 lines
* Make this patch 1 not patch 2
* Movepinctrl-tegra-xusb.hinto this patch.
* Remove the list of values above, and replace it with the text "See <dt-bindings/pinctrl/pinctrl-tegra-xusb.h> for the set of valid values".
Quoted 5 lines
I remember discussions where people explicitly said that relying on the symbolic names in the DT bindings was a mistake because it would mean that everyone would need to have access to a mechanism similar to what we have in the Linux kernel (and that the header files would always need to be shipped with the DT bindings).
The entire point of the headers is so that the binding definitions and code using them can't get out of sync. In my opinion, the headers *are* part of the bindings, so of course anyone either reading DT bindings, or parsing DT, must have the headers, and hence the headers must be bundled with the DT files or with the bindings wherever they go.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140605/2628de6b/attachment.sig>
Re: [PATCH 2/4] of: Add NVIDIA Tegra XUSB pad controller binding
Quoted 4 lines · Stephen Warren
In my opinion, the headers *are*
part of the bindings, so of course anyone either reading DT bindings, or parsing DT, must have the headers, and hence the headers must be bundled with the DT files or with the bindings wherever they go.
I agree 100% with Stephen's stance. Reference the headers.
Yours,
Linus Walleij
PATCH 3/4 ARM: tegra: tegra124: Add XUSB pad controller
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
The device tree node in the SoC file contains only the resources (such as registers, resets, ...) but none of the lane assignment information since that's board specific and belongs in the board file.
--- arch/arm/boot/dts/tegra124.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm/boot/dts/tegra124.dtsi +11 -0
@@ -449,6 +449,17 @@ clock-names = "pclk", "clk32k_in"; }; + padctl at 0,7009f000 { + compatible = "nvidia,tegra124-xusb-padctl"; + reg = <0x0 0x7009f000 0x0 0x1000>; + resets = <&tegra_car 142>; + reset-names = "padctl"; + + #address-cells = <0>; + #size-cells = <0>; + #phy-cells = <1>; + }; + sdhci at 0,700b0000 { compatible = "nvidia,tegra124-sdhci"; reg = <0x0 0x700b0000 0x0 0x200>;
Signature · 1 line
1.9.2
PATCH 4/4 ARM: tegra: jetson-tk1: Add XUSB pad controller
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Assign lanes to the XUSB pads as used on the Jetson TK1.
--- arch/arm/boot/dts/tegra124-jetson-tk1.dts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
arch/arm/boot/dts/tegra124-jetson-tk1.dts +26 -0
@@ -1619,6 +1619,32 @@ nvidia,sys-clock-req-active-high; }; + padctl at 0,7009f000 { + pinctrl-0 = <&padctl_default>; + pinctrl-names = "default"; + + padctl_default: pinmux { + usb3 { + nvidia,lanes = "pcie-0", "pcie-1"; + nvidia,function = "usb3"; + nvidia,iddq = <0>; + }; + + pcie { + nvidia,lanes = "pcie-2", "pcie-3", + "pcie-4"; + nvidia,function = "pcie"; + nvidia,iddq = <0>; + }; + + sata { + nvidia,lanes = "sata-0"; + nvidia,function = "sata"; + nvidia,iddq = <0>; + }; + }; + }; + /* SD card */ sdhci at 0,700b0400 { status = "okay";
Signature · 1 line
1.9.2
Quoted 11 lines · Thierry Reding
From: Thierry Reding <[email protected]>
The XUSB pad controller found on NVIDIA Tegra SoCs provides several pads that lanes can be assigned to in order to support a variety of interface
options: USB 2.0, USB 3.0, PCIe and SATA.In addition to the pin controller used to assign lanes to pads two PHYs are exposed to allow the bricks for PCIe and SATA to be powered up and down by PCIe and SATA drivers.
drivers/pinctrl/pinctrl-tegra-xusb.c new file +1
-0+#define TEGRA124_GROUP (_funcs) \
drivers/pinctrl/pinctrl-tegra-xusb.c line 762
Quoted 10 lines
drivers/pinctrl/pinctrl-tegra-xusb.c new file +10
-0+ { \ + .num_funcs = ARRAY_SIZE(tegra124_##_funcs##_functions), \ + .funcs = tegra124_##_funcs##_functions, \ + } + +static const struct tegra_xusb_padctl_group tegra124_groups[] = { +TEGRA124_GROUP (otg), +TEGRA124_GROUP (usb), +TEGRA124_GROUP (pci), +};
I'm not sure what this set of groups is for.
pinctrl muxes functions onto groups, so given that each pin in padctl is individually configurable, we need 1 group per pin. As far as I can tell, tegra_xusb_padctl_get_groups_count()/name() implement this correctly, and this array isn't used anywhere?
Quoted 25 lines · Stephen Warren
Quoted 11 lines · Thierry Reding
From: Thierry Reding <[email protected]>
The XUSB pad controller found on NVIDIA Tegra SoCs provides several pads that lanes can be assigned to in order to support a variety of interface
options: USB 2.0, USB 3.0, PCIe and SATA.In addition to the pin controller used to assign lanes to pads two PHYs are exposed to allow the bricks for PCIe and SATA to be powered up and down by PCIe and SATA drivers.
drivers/pinctrl/pinctrl-tegra-xusb.c new file +1
-0+#define TEGRA124_GROUP (_funcs) \drivers/pinctrl/pinctrl-tegra-xusb.c line 762
Quoted 10 lines
drivers/pinctrl/pinctrl-tegra-xusb.c new file +10
-0+ { \ + .num_funcs = ARRAY_SIZE(tegra124_##_funcs##_functions), \ + .funcs = tegra124_##_funcs##_functions, \ + } + +static const struct tegra_xusb_padctl_group tegra124_groups[] = { +TEGRA124_GROUP (otg), +TEGRA124_GROUP (usb), +TEGRA124_GROUP (pci), +};I'm not sure what this set of groups is for.
Quoted 4 lines
pinctrl muxes functions onto groups, so given that each pin in padctl is individually configurable, we need 1 group per pin. As far as I can tell, tegra_xusb_padctl_get_groups_count()/name() implement this correctly, and this array isn't used anywhere?
Indeed, there seems to be no need for this anymore. Probably left-over from some prior version.
Thanks,
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140606/a29bd0dd/attachment.sig>