Enable USB host and device functions on Jetson
Subsystems (9)
v3 cover Enable USB host and device functions on Jetson
The patch series enable the USB host and devie functions on Jetson AGX Orin and depend on the following change
https://lore.kernel.org/all/[email protected]/
Sing-Han Chen (3):
phy: tegra: xusb: Add Tegra234 support
usb: host: xhci-tegra: Add Tegra234 XHCI support
usb: gadget: tegra-xudc: Add Tegra234 support
Wayne Chang (10):
dt-bindings: usb: tegra-xudc: Add Tegra234 XUSB controller support
dt-bindings: usb: Add NVIDIA Tegra234 XUSB host controller binding
dt-bindings: usb: Add binding for Cypress cypd4226 I2C driver
arm64: tegra: Enable XUSB host and device on Jetson AGX Orin
usb: typec: ucsi_ccg: Add OF support
usb: typec: ucsi_ccg: Add cypress,firmware-build as a well-known regex
i2c: nvidia-gpu: Add cypress,firmware-build as a well-known regex
usb: typec: ucsi_ccg: Remove ccgx,firmware-build property
i2c: nvidia-gpu: Remove ccgx,firmware-build property
phy: tegra: xusb: Disable trk clk when not in use
.../bindings/usb/cypress,cypd4226.yaml | 86 ++++++ .../bindings/usb/nvidia,tegra-xudc.yaml | 24 +- .../bindings/usb/nvidia,tegra234-xusb.yaml | 159 +++++++++++ .../boot/dts/nvidia/tegra234-p3701-0000.dtsi | 48 ++++ .../nvidia/tegra234-p3737-0000+p3701-0000.dts | 175 ++++++++++++ arch/arm64/boot/dts/nvidia/tegra234.dtsi | 170 +++++++++++ drivers/i2c/busses/i2c-nvidia-gpu.c | 4 +- drivers/phy/tegra/Makefile | 1 + drivers/phy/tegra/xusb-tegra186.c | 64 ++++- drivers/phy/tegra/xusb.c | 6 + drivers/phy/tegra/xusb.h | 22 ++ drivers/usb/gadget/udc/tegra-xudc.c | 17 ++ drivers/usb/host/xhci-tegra.c | 270 +++++++++++++++--- drivers/usb/typec/ucsi/ucsi_ccg.c | 22 +- 14 files changed, 1014 insertions(+), 54 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml create mode 100644 Documentation/devicetree/bindings/usb/nvidia,tegra234-xusb.yaml
base-commit: 094226ad94f471a9f19e8f8e7140a09c2625abaa
Signature · 1 line
2.25.1
PATCH v3 1/13 dt-bindings: usb: tegra-xudc: Add Tegra234 XUSB controller support
Extend the Tegra XUSB controller device tree binding with Tegra234 support.
---
V2 -> V3:nothing has changed
V1 -> V2:address the issue on phy-names property
.../bindings/usb/nvidia,tegra-xudc.yaml | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/usb/nvidia,tegra-xudc.yaml +16 -8
@@ -22,6 +22,7 @@ properties: - nvidia,tegra210-xudc # For Tegra210 - nvidia,tegra186-xudc # For Tegra186 - nvidia,tegra194-xudc # For Tegra194 + - nvidia,tegra234-xudc # For Tegra234 reg: minItems: 2
@@ -90,21 +91,27 @@ properties: phys: minItems: 1 + maxItems: 8 description: Must contain an entry for each entry in phy-names. See ../phy/phy-bindings.txt for details. phy-names: minItems: 1 + maxItems: 8 items: - - const: usb2-0 - - const: usb2-1 - - const: usb2-2 - - const: usb2-3 - - const: usb3-0 - - const: usb3-1 - - const: usb3-2 - - const: usb3-3 + enum: + - usb2-0 + - usb2-1 + - usb2-2 + - usb2-3 + - usb3-0 + - usb3-1 + - usb3-2 + - usb3-3 + + dma-coherent: + type: boolean avddio-usb-supply: description: PCIe/USB3 analog logic power supply. Must supply 1.05 V.
@@ -153,6 +160,7 @@ allOf: enum: - nvidia,tegra186-xudc - nvidia,tegra194-xudc + - nvidia,tegra234-xudc then: properties: reg:
Signature · 1 line
2.25.1
Re: [PATCH v3 01/13] dt-bindings: usb: tegra-xudc: Add Tegra234 XUSB controller support
Quoted 59 lines · Wayne Chang
Extend the Tegra XUSB controller device tree binding with Tegra234 support.
Signed-off-by Wayne Chang <[email protected]>---
V2 -> V3:nothing has changed
V1 -> V2:address the issue on phy-names property.../bindings/usb/nvidia,tegra-xudc.yaml | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-)Documentation/devicetree/bindings/usb/nvidia,tegra-xudc.yaml +15
-8@@ -22,6 +22,7 @@ properties: - nvidia,tegra210-xudc # For Tegra210 - nvidia,tegra186-xudc # For Tegra186 - nvidia,tegra194-xudc # For Tegra194 + - nvidia,tegra234-xudc # For Tegra234 reg: minItems: 2@@ -90,21 +91,27 @@ properties: phys: minItems: 1 + maxItems: 8 description: Must contain an entry for each entry in phy-names. See ../phy/phy-bindings.txt for details. phy-names: minItems: 1 + maxItems: 8 items: - - const: usb2-0 - - const: usb2-1 - - const: usb2-2 - - const: usb2-3 - - const: usb3-0 - - const: usb3-1 - - const: usb3-2 - - const: usb3-3 + enum: + - usb2-0 + - usb2-1 + - usb2-2 + - usb2-3 + - usb3-0 + - usb3-1 + - usb3-2 + - usb3-3 + + dma-coherent: + type: boolean avddio-usb-supply: description: PCIe/USB3 analog logic power supply. Must supply 1.05 V.
Documentation/devicetree/bindings/usb/nvidia,tegra-xudc.yaml allOf: · line 166
Quoted 7 lines
Documentation/devicetree/bindings/usb/nvidia,tegra-xudc.yaml +1
-0@@ -153,6 +160,7 @@ allOf: enum: - nvidia,tegra186-xudc - nvidia,tegra194-xudc + - nvidia,tegra234-xudc then: properties: reg:
Thanks
Jon
Signature · 1 line
nvpublic
Rob Herring
maintainerRe: [PATCH v3 01/13] dt-bindings: usb: tegra-xudc: Add Tegra234 XUSB controller support
In reply to Wayne ChangQuoted 2 lines · Wayne Chang
Extend the Tegra XUSB controller device tree binding with Tegra234 support.
Why do you need any order and number of phys? Please explain in the commit msg.
Quoted 68 lines
Signed-off-by Wayne Chang <[email protected]>---
V2 -> V3:nothing has changed
V1 -> V2:address the issue on phy-names property.../bindings/usb/nvidia,tegra-xudc.yaml | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-)Documentation/devicetree/bindings/usb/nvidia,tegra-xudc.yaml +16
-8@@ -22,6 +22,7 @@ properties: - nvidia,tegra210-xudc # For Tegra210 - nvidia,tegra186-xudc # For Tegra186 - nvidia,tegra194-xudc # For Tegra194 + - nvidia,tegra234-xudc # For Tegra234 reg: minItems: 2@@ -90,21 +91,27 @@ properties: phys: minItems: 1 + maxItems: 8 description: Must contain an entry for each entry in phy-names. See ../phy/phy-bindings.txt for details. phy-names: minItems: 1 + maxItems: 8 items: - - const: usb2-0 - - const: usb2-1 - - const: usb2-2 - - const: usb2-3 - - const: usb3-0 - - const: usb3-1 - - const: usb3-2 - - const: usb3-3 + enum: + - usb2-0 + - usb2-1 + - usb2-2 + - usb2-3 + - usb3-0 + - usb3-1 + - usb3-2 + - usb3-3 + + dma-coherent: + type: boolean avddio-usb-supply: description: PCIe/USB3 analog logic power supply. Must supply 1.05 V.@@ -153,6 +160,7 @@ allOf: enum: - nvidia,tegra186-xudc - nvidia,tegra194-xudc + - nvidia,tegra234-xudc then: properties: reg:Signature · 1 line
2.25.1
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Jon Hunter
maintainerRe: [PATCH v3 01/13] dt-bindings: usb: tegra-xudc: Add Tegra234 XUSB controller support
Quoted 6 lines · Rob Herring
Quoted 2 lines · Wayne Chang
Extend the Tegra XUSB controller device tree binding with Tegra234 support.
Why do you need any order and number of phys? Please explain in the commit msg.
I have been having a quick look at this and for the devices that this binding is applicable to, they only support one port for USB2 and one port for USB3. So I don't think that we should have all these ports defined in this binding doc. So ideally, we should have
...
Documentation/devicetree/bindings/usb/nvidia,tegra-xudc.yaml +2 -10
@@ -98,17 +98,9 @@ properties: phy-names: minItems: 1 - maxItems: 8 items: - enum: - - usb2-0 - - usb2-1 - - usb2-2 - - usb2-3 - - usb3-0 - - usb3-1 - - usb3-2 - - usb3-3 + - const: usb2 + - const: usb3 dma-coherent: type: boolean
arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts +1 -1
@@ -2128,7 +2128,7 @@ usb@3550000 { phys = <&{/bus@0/padctl@3520000/pads/usb2/lanes/usb2-0}>, <&{/bus@0/padctl@3520000/pads/usb3/lanes/usb3-1}>; - phy-names = "usb2-0", "usb3-1"; + phy-names = "usb2", "usb3"; }; usb@3610000 {
Jon
Signature · 6 lines
nvpublic -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v3 2/13 dt-bindings: usb: Add NVIDIA Tegra234 XUSB host controller binding
In reply to Wayne ChangAdd device-tree binding documentation for the XUSB host controller present on Tegra234 SoC. This controller supports the USB 3.1 specification.
---
depends on the following change
https://lore.kernel.org/all/[email protected]/
V2 -> V3:nothing has changed but added the dependency here V1 -> V2:new change for adding nvidia,tegra234-xusb.yaml
.../bindings/usb/nvidia,tegra234-xusb.yaml | 159 ++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/nvidia,tegra234-xusb.yaml
Documentation/devicetree/bindings/usb/nvidia,tegra234-xusb.yaml new file +159 -0
@@ -0,0 +1,159 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/nvidia,tegra234-xusb.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NVIDIA Tegra234 xHCI controller + +maintainers: + - Thierry Reding <[email protected]> + - Jon Hunter <[email protected]> + +description: The Tegra xHCI controller supports both USB2 and USB3 interfaces + exposed by the Tegra XUSB pad controller. + +properties: + compatible: + const: nvidia,tegra234-xusb + + reg: + items: + - description: base and length of the xHCI host registers + - description: base and length of the XUSB FPCI registers + - description: base and length of the XUSB bar2 registers + + reg-names: + items: + - const: hcd + - const: fpci + - const: bar2 + + interrupts: + items: + - description: xHCI host interrupt + - description: mailbox interrupt + + clocks: + items: + - description: XUSB host clock + - description: XUSB Falcon source clock + - description: XUSB SuperSpeed clock + - description: XUSB SuperSpeed source clock + - description: XUSB HighSpeed clock source + - description: XUSB FullSpeed clock source + - description: USB PLL + - description: reference clock + - description: I/O PLL + + clock-names: + items: + - const: xusb_host + - const: xusb_falcon_src + - const: xusb_ss + - const: xusb_ss_src + - const: xusb_hs_src + - const: xusb_fs_src + - const: pll_u_480m + - const: clk_m + - const: pll_e + + interconnects: + items: + - description: read client + - description: write client + + interconnect-names: + items: + - const: dma-mem # read + - const: write + + iommus: + maxItems: 1 + + nvidia,xusb-padctl: + $ref: /schemas/types.yaml#/definitions/phandle + description: phandle to the XUSB pad controller that is used to configure + the USB pads used by the XHCI controller + + phys: + minItems: 1 + maxItems: 8 + + phy-names: + minItems: 1 + maxItems: 8 + items: + enum: + - usb2-0 + - usb2-1 + - usb2-2 + - usb2-3 + - usb3-0 + - usb3-1 + - usb3-2 + - usb3-3 + + power-domains: + items: + - description: XUSBC power domain + - description: XUSBA power domain + + power-domain-names: + items: + - const: xusb_host + - const: xusb_ss + + dma-coherent: + type: boolean + +allOf: + - $ref: usb-xhci.yaml + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/tegra234-gpio.h> + #include <dt-bindings/clock/tegra234-clock.h> + #include <dt-bindings/memory/tegra234-mc.h> + #include <dt-bindings/power/tegra234-powergate.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + usb@3610000 { + compatible = "nvidia,tegra234-xusb"; + reg = <0x03610000 0x40000>, + <0x03600000 0x10000>, + <0x03650000 0x10000>; + reg-names = "hcd", "fpci", "bar2"; + + interrupts = <GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>; + + clocks = <&bpmp TEGRA234_CLK_XUSB_CORE_HOST>, + <&bpmp TEGRA234_CLK_XUSB_FALCON>, + <&bpmp TEGRA234_CLK_XUSB_CORE_SS>, + <&bpmp TEGRA234_CLK_XUSB_SS>, + <&bpmp TEGRA234_CLK_CLK_M>, + <&bpmp TEGRA234_CLK_XUSB_FS>, + <&bpmp TEGRA234_CLK_UTMIP_PLL>, + <&bpmp TEGRA234_CLK_CLK_M>, + <&bpmp TEGRA234_CLK_PLLE>; + clock-names = "xusb_host", "xusb_falcon_src", + "xusb_ss", "xusb_ss_src", "xusb_hs_src", + "xusb_fs_src", "pll_u_480m", "clk_m", + "pll_e"; + interconnects = <&mc TEGRA234_MEMORY_CLIENT_XUSB_HOSTR &emc>, + <&mc TEGRA234_MEMORY_CLIENT_XUSB_HOSTW &emc>; + interconnect-names = "dma-mem", "write"; + iommus = <&smmu_niso1 TEGRA234_SID_XUSB_HOST>; + + power-domains = <&bpmp TEGRA234_POWER_DOMAIN_XUSBC>, + <&bpmp TEGRA234_POWER_DOMAIN_XUSBA>; + power-domain-names = "xusb_host", "xusb_ss"; + + nvidia,xusb-padctl = <&xusb_padctl>; + + phys = <&pad_lanes_usb2_0>; + phy-names = "usb2-0"; + + };
Signature · 1 line
2.25.1
Rob Herring
maintainerRe: [PATCH v3 02/13] dt-bindings: usb: Add NVIDIA Tegra234 XUSB host controller binding
Quoted 4 lines · Wayne Chang
Add device-tree binding documentation for the XUSB host controller present on Tegra234 SoC. This controller supports the USB 3.1 specification.
Signed-off-by Wayne Chang <[email protected]>
Quoted 9 lines
---
depends on the following change
https://lore.kernel.org/all/[email protected]/
V2 -> V3:nothing has changed but added the dependency here V1 -> V2:new change for adding nvidia,tegra234-xusb.yaml.../bindings/usb/nvidia,tegra234-xusb.yaml | 159 ++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/nvidia,tegra234-xusb.yaml
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
Error: Documentation/devicetree/bindings/usb/nvidia,tegra234-xusb.example.dts:36.27-28 syntax error FATAL ERROR: Unable to parse input tree
make[1]: *** [scripts/Makefile.lib:406: Documentation/devicetree/bindings/usb/nvidia,tegra234-xusb.example.dtb] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1492: dt_binding_check] Error 2
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/patch/
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit.
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Jon Hunter
maintainerRe: [PATCH v3 02/13] dt-bindings: usb: Add NVIDIA Tegra234 XUSB host controller binding
Hi Rob,
Quoted 35 lines · Rob Herring
Quoted 4 lines · Wayne Chang
Add device-tree binding documentation for the XUSB host controller present on Tegra234 SoC. This controller supports the USB 3.1 specification.
Signed-off-by Wayne Chang <[email protected]>Quoted 9 lines
---
depends on the following change
https://lore.kernel.org/all/[email protected]/
V2 -> V3:nothing has changed but added the dependency here V1 -> V2:new change for adding nvidia,tegra234-xusb.yaml.../bindings/usb/nvidia,tegra234-xusb.yaml | 159 ++++++++++++++++++ 1 file changed, 159 insertions(+)create mode 100644
Documentation/devicetree/bindings/usb/nvidia,tegra234-xusb.yamlMy bot found errors running 'make DT_CHECKER_FLAGS=-m
dt_binding_check' on your patch (DT_CHECKER_FLAGSis new in v5.13):yamllint warnings/errors:
dtschema/dtc warnings/errors:
Error: Documentation/devicetree/bindings/usb/nvidia,tegra234-xusb.example.dts:36.27-28 syntax error FATAL ERROR: Unable to parse input tree
make[1]: *** [scripts/Makefile.lib:406:Documentation/devicetree/bindings/usb/nvidia,tegra234-xusb.example.dtb] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1492:dt_binding_check] Error 2doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/patch/
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
Quoted 7 lines
If you already ran 'make
dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:pip3 install dtschema --upgrade
Please check and re-submit.
I am very much responsible for this because of my patch [0] to get all the necessary headers for Tegra234. I was hoping this would be a good thing, but now I see this is a bit of a headache for maintainers.
So I am not sure what is a good way to handle this. We would like to get this merged for v6.2, and so please let me know if this is OK with you? Please note that this is similar to the other Tegra USB bindings you have reviewed for v6.2.
Thanks
Jon
[0] https://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux.git/commit/?h=for-6.2/dt-bindings&id=ea4777f6715016168cb72a1edc835dad480c8cfb
[1] https://lore.kernel.org/linux-tegra/[email protected]/
Signature · 1 line
nvpublic
Re: [PATCH v3 02/13] dt-bindings: usb: Add NVIDIA Tegra234 XUSB host controller binding
Quoted 47 lines · Jon Hunter
Hi Rob,
Quoted 35 lines · Rob Herring
Quoted 4 lines · Wayne Chang
Add device-tree binding documentation for the XUSB host controller present on Tegra234 SoC. This controller supports the USB 3.1 specification.
Signed-off-by Wayne Chang <[email protected]>Quoted 9 lines
---
depends on the following change
https://lore.kernel.org/all/[email protected]/
V2 -> V3:nothing has changed but added the dependency here V1 -> V2:new change for adding nvidia,tegra234-xusb.yaml.../bindings/usb/nvidia,tegra234-xusb.yaml | 159 ++++++++++++++++++ 1 file changed, 159 insertions(+)create mode 100644
Documentation/devicetree/bindings/usb/nvidia,tegra234-xusb.yamlMy bot found errors running 'make DT_CHECKER_FLAGS=-m
dt_binding_check' on your patch (DT_CHECKER_FLAGSis new in v5.13):yamllint warnings/errors:
dtschema/dtc warnings/errors:
Error: Documentation/devicetree/bindings/usb/nvidia,tegra234-xusb.example.dts:36.27-28 syntax error FATAL ERROR: Unable to parse input tree
make[1]: *** [scripts/Makefile.lib:406:Documentation/devicetree/bindings/usb/nvidia,tegra234-xusb.example.dtb] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1492:dt_binding_check] Error 2doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/patch/
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
Quoted 7 lines
If you already ran 'make
dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:pip3 install dtschema --upgrade
Please check and re-submit.
Quoted 8 lines
I am very much responsible for this because of my patch [0] to get all the necessary headers for Tegra234. I was hoping this would be a good thing, but now I see this is a bit of a headache for maintainers.
So I am not sure what is a good way to handle this. We would like to get this merged for v6.2, and so please let me know if this is OK with you? Please note that this is similar to the other Tegra USB bindings you have reviewed for v6.2.
I think it'd be best for me to pick these up into the Tegra tree where the dependency exists and where I already have the XUSB bindings conversion patches for earlier chips. Looks like this is also not very different from, say, the Tegra194 XUSB bindings, so should fit right in there.
Thierry
Re: [PATCH v3 02/13] dt-bindings: usb: Add NVIDIA Tegra234 XUSB host controller binding
In reply to Wayne ChangQuoted 168 lines · Wayne Chang
Add device-tree binding documentation for the XUSB host controller present on Tegra234 SoC. This controller supports the USB 3.1 specification.
Signed-off-by Wayne Chang <[email protected]>---
depends on the following change
https://lore.kernel.org/all/[email protected]/
V2 -> V3:nothing has changed but added the dependency here V1 -> V2:new change for adding nvidia,tegra234-xusb.yaml.../bindings/usb/nvidia,tegra234-xusb.yaml | 159 ++++++++++++++++++ 1 file changed, 159 insertions(+)create mode 100644
Documentation/devicetree/bindings/usb/nvidia,tegra234-xusb.yamlDocumentation/devicetree/bindings/usb/nvidia,tegra234-xusb.yaml new file +149
-0@@ -0,0 +1,159 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/nvidia,tegra234-xusb.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NVIDIA Tegra234 xHCI controller + +maintainers: + - Thierry Reding <[email protected]> + - Jon Hunter <[email protected]> + +description: The Tegra xHCI controller supports both USB2 and USB3 interfaces + exposed by the Tegra XUSB pad controller. + +properties: + compatible: + const: nvidia,tegra234-xusb + + reg: + items: + - description: base and length of the xHCI host registers + - description: base and length of the XUSB FPCI registers + - description: base and length of the XUSB bar2 registers + + reg-names: + items: + - const: hcd + - const: fpci + - const: bar2 + + interrupts: + items: + - description: xHCI host interrupt + - description: mailbox interrupt + + clocks: + items: + - description: XUSB host clock + - description: XUSB Falcon source clock + - description: XUSB SuperSpeed clock + - description: XUSB SuperSpeed source clock + - description: XUSB HighSpeed clock source + - description: XUSB FullSpeed clock source + - description: USB PLL + - description: reference clock + - description: I/O PLL + + clock-names: + items: + - const: xusb_host + - const: xusb_falcon_src + - const: xusb_ss + - const: xusb_ss_src + - const: xusb_hs_src + - const: xusb_fs_src + - const: pll_u_480m + - const: clk_m + - const: pll_e + + interconnects: + items: + - description: read client + - description: write client + + interconnect-names: + items: + - const: dma-mem # read + - const: write + + iommus: + maxItems: 1 + + nvidia,xusb-padctl: + $ref: /schemas/types.yaml#/definitions/phandle + description: phandle to the XUSB pad controller that is used to configure + the USB pads used by the XHCI controller + + phys: + minItems: 1 + maxItems: 8 + + phy-names: + minItems: 1 + maxItems: 8 + items: + enum: + - usb2-0 + - usb2-1 + - usb2-2 + - usb2-3 + - usb3-0 + - usb3-1 + - usb3-2 + - usb3-3 + + power-domains: + items: + - description: XUSBC power domain + - description: XUSBA power domain + + power-domain-names: + items: + - const: xusb_host + - const: xusb_ss + + dma-coherent: + type: boolean + +allOf: + - $ref: usb-xhci.yaml + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/tegra234-gpio.h> + #include <dt-bindings/clock/tegra234-clock.h> + #include <dt-bindings/memory/tegra234-mc.h> + #include <dt-bindings/power/tegra234-powergate.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + usb@3610000 { + compatible = "nvidia,tegra234-xusb"; + reg = <0x03610000 0x40000>, + <0x03600000 0x10000>, + <0x03650000 0x10000>; + reg-names = "hcd", "fpci", "bar2"; + + interrupts = <GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>; + + clocks = <&bpmp TEGRA234_CLK_XUSB_CORE_HOST>, + <&bpmp TEGRA234_CLK_XUSB_FALCON>, + <&bpmp TEGRA234_CLK_XUSB_CORE_SS>, + <&bpmp TEGRA234_CLK_XUSB_SS>, + <&bpmp TEGRA234_CLK_CLK_M>, + <&bpmp TEGRA234_CLK_XUSB_FS>, + <&bpmp TEGRA234_CLK_UTMIP_PLL>, + <&bpmp TEGRA234_CLK_CLK_M>, + <&bpmp TEGRA234_CLK_PLLE>; + clock-names = "xusb_host", "xusb_falcon_src", + "xusb_ss", "xusb_ss_src", "xusb_hs_src", + "xusb_fs_src", "pll_u_480m", "clk_m", + "pll_e"; + interconnects = <&mc TEGRA234_MEMORY_CLIENT_XUSB_HOSTR &emc>, + <&mc TEGRA234_MEMORY_CLIENT_XUSB_HOSTW &emc>; + interconnect-names = "dma-mem", "write"; + iommus = <&smmu_niso1 TEGRA234_SID_XUSB_HOST>; +
Documentation/devicetree/bindings/usb/nvidia,tegra234-xusb.yaml line 159
Quoted 10 lines
Documentation/devicetree/bindings/usb/nvidia,tegra234-xusb.yaml new file +10
-0+ power-domains = <&bpmp TEGRA234_POWER_DOMAIN_XUSBC>, + <&bpmp TEGRA234_POWER_DOMAIN_XUSBA>; + power-domain-names = "xusb_host", "xusb_ss"; + + nvidia,xusb-padctl = <&xusb_padctl>; + + phys = <&pad_lanes_usb2_0>; + phy-names = "usb2-0"; + + };
Thanks
Jon
Signature · 1 line
nvpublic
PATCH v3 3/13 dt-bindings: usb: Add binding for Cypress cypd4226 I2C driver
In reply to Wayne Changadd device-tree binding documentation for Cypress cypd4226 type-C controller's I2C interface. It is a standard I2C slave with GPIO input as IRQ interface.
---
V2 -> V3:fix additionalProperties warning on new schema
V1 -> V2:based on the review comments. Fix some addressed issues on description, interrupts, cypress,firmware-build, connector, and additionalProperties properties. And also remove the status in the example.
.../bindings/usb/cypress,cypd4226.yaml | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml new file +86 -0
@@ -0,0 +1,86 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/cypress,cypd4226.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Cypress cypd4226 UCSI I2C Type-C Controller + +maintainers: + - Wayne Chang <[email protected]> + +description: + The Cypress cypd4226 UCSI I2C type-C controller is a I2C interface type-C + controller. + +properties: + compatible: + const: cypress,cypd4226 + + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + reg: + const: 0x08 + + interrupts: + items: + - description: cypd4226 I2C interrupt + + cypress,firmware-build: + enum: + - nvidia,gpu + - nvidia,jetson-agx-xavier + description: | + the name of the CCGx firmware built for product series. + should be set one of following: + - "nvidia,gpu" for the NVIDIA RTX product series + - "nvidia,jetson-agx-xavier" for the NVIDIA Jetson product series + +patternProperties: + '^connector@[0-1]+$': + $ref: /schemas/connector/usb-connector.yaml# + properties: + reg: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/tegra194-gpio.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + i2c { + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <2>; + + ucsi-ccg@8 { + compatible = "cypress,cypd4226"; + interrupt-parent = <&gpio_aon>; + interrupts = <TEGRA194_AON_GPIO(BB, 2) IRQ_TYPE_LEVEL_LOW>; + reg = <0x08>; + cypress,firmware-build = "nvidia,jetson-agx-xavier"; + #address-cells = <1>; + #size-cells = <0>; + ccg_typec_con0: connector@0 { + compatible = "usb-c-connector"; + reg = <0>; + label = "USB-C"; + data-role = "dual"; + port { + ucsi_ccg_p0: endpoint { + remote-endpoint = <&usb_role_switch0>; + }; + }; + }; + }; + };
Signature · 1 line
2.25.1
Re: [PATCH v3 03/13] dt-bindings: usb: Add binding for Cypress cypd4226 I2C driver
Quoted 96 lines · Wayne Chang
add device-tree binding documentation for Cypress cypd4226 type-C controller's I2C interface. It is a standard I2C slave with GPIO input as IRQ interface.
Signed-off-by Wayne Chang <[email protected]>---
V2 -> V3:fix additionalProperties warning on new schema
V1 -> V2:based on the review comments. Fix some addressed issues on description, interrupts, cypress,firmware-build, connector, and additionalProperties properties. And also remove the status in the example..../bindings/usb/cypress,cypd4226.yaml | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+)create mode 100644
Documentation/devicetree/bindings/usb/cypress,cypd4226.yamlDocumentation/devicetree/bindings/usb/cypress,cypd4226.yaml new file +76
-0@@ -0,0 +1,86 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/cypress,cypd4226.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Cypress cypd4226 UCSI I2C Type-C Controller + +maintainers: + - Wayne Chang <[email protected]> + +description: + The Cypress cypd4226 UCSI I2C type-C controller is a I2C interface type-C + controller. + +properties: + compatible: + const: cypress,cypd4226 + + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + reg: + const: 0x08 + + interrupts: + items: + - description: cypd4226 I2C interrupt + + cypress,firmware-build: + enum: + - nvidia,gpu + - nvidia,jetson-agx-xavier + description: | + the name of the CCGx firmware built for product series. + should be set one of following: + - "nvidia,gpu" for the NVIDIA RTX product series + - "nvidia,jetson-agx-xavier" for the NVIDIA Jetson product series + +patternProperties: + '^connector@[0-1]+$': + $ref: /schemas/connector/usb-connector.yaml# + properties: + reg: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/tegra194-gpio.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + i2c { + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <2>; + + ucsi-ccg@8 { + compatible = "cypress,cypd4226"; + interrupt-parent = <&gpio_aon>; + interrupts = <TEGRA194_AON_GPIO(BB, 2) IRQ_TYPE_LEVEL_LOW>; + reg = <0x08>; + cypress,firmware-build = "nvidia,jetson-agx-xavier"; + #address-cells = <1>; + #size-cells = <0>; + ccg_typec_con0: connector@0 { + compatible = "usb-c-connector"; + reg = <0>;
Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml line 86
Quoted 10 lines
Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml new file +10
-0+ label = "USB-C"; + data-role = "dual"; + port { + ucsi_ccg_p0: endpoint { + remote-endpoint = <&usb_role_switch0>; + }; + }; + }; + }; + };
Thanks
Jon
Signature · 6 lines
nvpublic -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Rob Herring
maintainerRe: [PATCH v3 03/13] dt-bindings: usb: Add binding for Cypress cypd4226 I2C driver
In reply to Wayne ChangQuoted 3 lines · Wayne Chang
add device-tree binding documentation for Cypress cypd4226 type-C controller's I2C interface. It is a standard I2C slave with GPIO input as IRQ interface.
For the subject:
dt-bindings: usb: Add Cypress cypd4226 Type-C controller
Quoted 48 lines
Signed-off-by Wayne Chang <[email protected]>---
V2 -> V3:fix additionalProperties warning on new schema
V1 -> V2:based on the review comments. Fix some addressed issues on description, interrupts, cypress,firmware-build, connector, and additionalProperties properties. And also remove the status in the example..../bindings/usb/cypress,cypd4226.yaml | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/cypress,cypd4226.yamlDocumentation/devicetree/bindings/usb/cypress,cypd4226.yaml new file +31
-0@@ -0,0 +1,86 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/cypress,cypd4226.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Cypress cypd4226 UCSI I2C Type-C Controller + +maintainers: + - Wayne Chang <[email protected]> + +description: + The Cypress cypd4226 UCSI I2C type-C controller is a I2C interface type-C + controller. + +properties: + compatible: + const: cypress,cypd4226 + + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + reg: + const: 0x08 + + interrupts: + items: + - description: cypd4226 I2C interrupt
Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml line 41
Quoted 10 lines
Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml new file +10
-0+ + cypress,firmware-build: + enum: + - nvidia,gpu + - nvidia,jetson-agx-xavier + description: | + the name of the CCGx firmware built for product series. + should be set one of following: + - "nvidia,gpu" for the NVIDIA RTX product series + - "nvidia,jetson-agx-xavier" for the NVIDIA Jetson product series
Standard 'firmware-name' property doesn't work for you?
Quoted 49 lines
Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml new file +45
-0+ +patternProperties: + '^connector@[0-1]+$': + $ref: /schemas/connector/usb-connector.yaml# + properties: + reg: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/tegra194-gpio.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + i2c { + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <2>; + + ucsi-ccg@8 { + compatible = "cypress,cypd4226"; + interrupt-parent = <&gpio_aon>; + interrupts = <TEGRA194_AON_GPIO(BB, 2) IRQ_TYPE_LEVEL_LOW>; + reg = <0x08>; + cypress,firmware-build = "nvidia,jetson-agx-xavier"; + #address-cells = <1>; + #size-cells = <0>; + ccg_typec_con0: connector@0 { + compatible = "usb-c-connector"; + reg = <0>; + label = "USB-C"; + data-role = "dual"; + port { + ucsi_ccg_p0: endpoint { + remote-endpoint = <&usb_role_switch0>; + }; + }; + }; + }; + };Signature · 1 line
2.25.1
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v3 4/13 arm64: tegra: Enable XUSB host and device on Jetson AGX Orin
In reply to Wayne ChangThis commit enables XUSB host, device, and pad controller on Jetson AGX Orin.
---
depends on the following change
https://lore.kernel.org/all/[email protected]/
V2 -> V3:nothing has changed but added the dependency here V1 -> V2:removed the redundant cells and status in ucsi-ccg. Using dash instead of underscore in the ucsi-ccg node name. Using representive name in cypress,firmware-build property.
.../boot/dts/nvidia/tegra234-p3701-0000.dtsi | 48 +++++ .../nvidia/tegra234-p3737-0000+p3701-0000.dts | 175 ++++++++++++++++++ arch/arm64/boot/dts/nvidia/tegra234.dtsi | 170 +++++++++++++++++ 3 files changed, 393 insertions(+)
arch/arm64/boot/dts/nvidia/tegra234-p3701-0000.dtsi +48 -0
@@ -61,6 +61,29 @@ mmc@3460000 { non-removable; }; + padctl@3520000 { + vclamp-usb-supply = <&vdd_ao_1v8>; + avdd-usb-supply = <&vdd_ao_3v3>; + + ports { + usb2-0 { + vbus-supply = <&vdd_5v0_sys>; + }; + + usb2-1 { + vbus-supply = <&vdd_5v0_sys>; + }; + + usb2-2 { + vbus-supply = <&vdd_5v0_sys>; + }; + + usb2-3 { + vbus-supply = <&vdd_5v0_sys>; + }; + }; + }; + rtc@c2a0000 { status = "okay"; };
@@ -69,4 +92,29 @@ pmc@c360000 { nvidia,invert-interrupt; }; }; + + vdd_5v0_sys: regulator@0 { + compatible = "regulator-fixed"; + regulator-name = "VIN_SYS_5V0"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + regulator-boot-on; + }; + + vdd_ao_1v8: regulator@1 { + compatible = "regulator-fixed"; + regulator-name = "vdd-AO-1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + + vdd_ao_3v3: regulator@2 { + compatible = "regulator-fixed"; + regulator-name = "vdd-AO-3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; };
arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts +175 -0
181 lines not on this page · raw message
arch/arm64/boot/dts/nvidia/tegra234.dtsi +170 -0
182 lines not on this page · raw message
Signature · 7 lines
2.25.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH v3 04/13] arm64: tegra: Enable XUSB host and device on Jetson AGX Orin
Quoted 446 lines · Wayne Chang
This commit enables XUSB host, device, and pad controller on Jetson AGX Orin.
Signed-off-by Wayne Chang <[email protected]>---
depends on the following change
https://lore.kernel.org/all/[email protected]/
V2 -> V3:nothing has changed but added the dependency here V1 -> V2:removed the redundant cells and status in ucsi-ccg. Using dash instead of underscore in the ucsi-ccg node name. Using representive name in cypress,firmware-build property..../boot/dts/nvidia/tegra234-p3701-0000.dtsi | 48 +++++ .../nvidia/tegra234-p3737-0000+p3701-0000.dts | 175 ++++++++++++++++++ arch/arm64/boot/dts/nvidia/tegra234.dtsi | 170 +++++++++++++++++ 3 files changed, 393 insertions(+)arch/arm64/boot/dts/nvidia/tegra234-p3701-0000.dtsi +48
-0@@ -61,6 +61,29 @@ mmc@3460000 { non-removable; }; + padctl@3520000 { + vclamp-usb-supply = <&vdd_ao_1v8>; + avdd-usb-supply = <&vdd_ao_3v3>; + + ports { + usb2-0 { + vbus-supply = <&vdd_5v0_sys>; + }; + + usb2-1 { + vbus-supply = <&vdd_5v0_sys>; + }; + + usb2-2 { + vbus-supply = <&vdd_5v0_sys>; + }; + + usb2-3 { + vbus-supply = <&vdd_5v0_sys>; + }; + }; + }; + rtc@c2a0000 { status = "okay"; };@@ -69,4 +92,29 @@ pmc@c360000 { nvidia,invert-interrupt; }; }; + + vdd_5v0_sys: regulator@0 { + compatible = "regulator-fixed"; + regulator-name = "VIN_SYS_5V0"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + regulator-boot-on; + }; + + vdd_ao_1v8: regulator@1 { + compatible = "regulator-fixed"; + regulator-name = "vdd-AO-1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + + vdd_ao_3v3: regulator@2 { + compatible = "regulator-fixed"; + regulator-name = "vdd-AO-3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; };arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts +175
-0@@ -2011,6 +2011,181 @@ hda@3510000 { nvidia,model = "NVIDIA Jetson AGX Orin HDA"; status = "okay"; }; + + padctl@3520000 { + status = "okay"; + + pads { + usb2 { + lanes { + usb2-0 { + status = "okay"; + }; + + usb2-1 { + status = "okay"; + }; + + usb2-2 { + status = "okay"; + }; + + usb2-3 { + status = "okay"; + }; + }; + }; + + usb3 { + lanes { + usb3-0 { + status = "okay"; + }; + + usb3-1 { + status = "okay"; + }; + + usb3-2 { + status = "okay"; + }; + }; + }; + }; + + ports { + usb2-0 { + mode = "otg"; + usb-role-switch; + status = "okay"; + port { + hs_typec_p1: endpoint { + remote-endpoint = <&hs_ucsi_ccg_p1>; + }; + }; + }; + + usb2-1 { + mode = "host"; + status = "okay"; + port { + hs_typec_p0: endpoint { + remote-endpoint = <&hs_ucsi_ccg_p0>; + }; + }; + }; + + usb2-2 { + mode = "host"; + status = "okay"; + }; + + usb2-3 { + mode = "host"; + status = "okay"; + }; + + usb3-0 { + nvidia,usb2-companion = <1>; + status = "okay"; + port { + ss_typec_p0: endpoint { + remote-endpoint = <&ss_ucsi_ccg_p0>; + }; + }; + }; + + usb3-1 { + nvidia,usb2-companion = <0>; + status = "okay"; + port { + ss_typec_p1: endpoint { + remote-endpoint = <&ss_ucsi_ccg_p1>; + }; + }; + }; + + usb3-2 { + nvidia,usb2-companion = <3>; + status = "okay"; + }; + }; + }; + + usb@3550000 { + status = "okay"; + + phys = <&{/bus@0/padctl@3520000/pads/usb2/lanes/usb2-0}>, + <&{/bus@0/padctl@3520000/pads/usb3/lanes/usb3-1}>; + phy-names = "usb2-0", "usb3-1"; + }; + + usb@3610000 { + status = "okay"; + + phys = <&{/bus@0/padctl@3520000/pads/usb2/lanes/usb2-0}>, + <&{/bus@0/padctl@3520000/pads/usb2/lanes/usb2-1}>, + <&{/bus@0/padctl@3520000/pads/usb2/lanes/usb2-2}>, + <&{/bus@0/padctl@3520000/pads/usb2/lanes/usb2-3}>, + <&{/bus@0/padctl@3520000/pads/usb3/lanes/usb3-0}>, + <&{/bus@0/padctl@3520000/pads/usb3/lanes/usb3-1}>, + <&{/bus@0/padctl@3520000/pads/usb3/lanes/usb3-2}>; + phy-names = "usb2-0", "usb2-1", "usb2-2", "usb2-3", + "usb3-0", "usb3-1", "usb3-2"; + }; + + i2c@c240000 { + status = "okay"; + ucsi-ccg@8 { + compatible = "cypress,cypd4226"; + cypress,firmware-build = "nvidia,jetson-agx-xavier"; + interrupt-parent = <&gpio>; + interrupts = <TEGRA234_MAIN_GPIO(Y, 4) IRQ_TYPE_LEVEL_LOW>; + reg = <0x08>; + #address-cells = <1>; + #size-cells = <0>; + ccg_typec_con0: connector@0 { + compatible = "usb-c-connector"; + reg = <0>; + label = "USB-C"; + data-role = "host"; + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + hs_ucsi_ccg_p0: endpoint { + remote-endpoint = <&hs_typec_p0>; + }; + }; + port@1 { + reg = <1>; + ss_ucsi_ccg_p0: endpoint { + remote-endpoint = <&ss_typec_p0>; + }; + }; + }; + ccg_typec_con1: connector@1 { + compatible = "usb-c-connector"; + reg = <1>; + label = "USB-C"; + data-role = "dual"; + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + hs_ucsi_ccg_p1: endpoint { + remote-endpoint = <&hs_typec_p1>; + }; + }; + port@1 { + reg = <1>; + ss_ucsi_ccg_p1: endpoint { + remote-endpoint = <&ss_typec_p1>; + }; + }; + }; + }; + }; }; chosen {arch/arm64/boot/dts/nvidia/tegra234.dtsi +168
-0@@ -942,6 +942,174 @@ hda@3510000 { status = "disabled"; }; + xusb_padctl: padctl@3520000 { + compatible = "nvidia,tegra234-xusb-padctl"; + reg = <0x03520000 0x20000>, + <0x03540000 0x10000>; + reg-names = "padctl", "ao"; + interrupts = <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>; + + resets = <&bpmp TEGRA234_RESET_XUSB_PADCTL>; + reset-names = "padctl"; + + status = "disabled"; + + pads { + usb2 { + clocks = <&bpmp TEGRA234_CLK_USB2_TRK>; + clock-names = "trk"; + + lanes { + usb2-0 { + nvidia,function = "xusb"; + status = "disabled"; + #phy-cells = <0>; + }; + + usb2-1 { + nvidia,function = "xusb"; + status = "disabled"; + #phy-cells = <0>; + }; + + usb2-2 { + nvidia,function = "xusb"; + status = "disabled"; + #phy-cells = <0>; + }; + + usb2-3 { + nvidia,function = "xusb"; + status = "disabled"; + #phy-cells = <0>; + }; + }; + }; + + usb3 { + lanes { + usb3-0 { + nvidia,function = "xusb"; + status = "disabled"; + #phy-cells = <0>; + }; + + usb3-1 { + nvidia,function = "xusb"; + status = "disabled"; + #phy-cells = <0>; + }; + + usb3-2 { + nvidia,function = "xusb"; + status = "disabled"; + #phy-cells = <0>; + }; + + usb3-3 { + nvidia,function = "xusb"; + status = "disabled"; + #phy-cells = <0>; + }; + }; + }; + }; + + ports { + usb2-0 { + status = "disabled"; + }; + + usb2-1 { + status = "disabled"; + }; + + usb2-2 { + status = "disabled"; + }; + + usb2-3 { + status = "disabled"; + }; + + usb3-0 { + status = "disabled"; + }; + + usb3-1 { + status = "disabled"; + }; + + usb3-2 { + status = "disabled"; + }; + + usb3-3 { + status = "disabled"; + }; + }; + }; + + usb@3550000 { + compatible = "nvidia,tegra234-xudc"; + reg = <0x03550000 0x8000>, + <0x03558000 0x8000>; + reg-names = "base", "fpci"; + interrupts = <GIC_SPI 166 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&bpmp TEGRA234_CLK_XUSB_CORE_DEV>, + <&bpmp TEGRA234_CLK_XUSB_CORE_SS>, + <&bpmp TEGRA234_CLK_XUSB_SS>, + <&bpmp TEGRA234_CLK_XUSB_FS>; + clock-names = "dev", "ss", "ss_src", "fs_src"; + interconnects = <&mc TEGRA234_MEMORY_CLIENT_XUSB_DEVR &emc>, + <&mc TEGRA234_MEMORY_CLIENT_XUSB_DEVW &emc>; + interconnect-names = "dma-mem", "write"; + iommus = <&smmu_niso1 TEGRA234_SID_XUSB_DEV>; + power-domains = <&bpmp TEGRA234_POWER_DOMAIN_XUSBB>, + <&bpmp TEGRA234_POWER_DOMAIN_XUSBA>; + power-domain-names = "dev", "ss"; + nvidia,xusb-padctl = <&xusb_padctl>; + dma-coherent; + status = "disabled"; + }; + + usb@3610000 { + compatible = "nvidia,tegra234-xusb"; + reg = <0x03610000 0x40000>, + <0x03600000 0x10000>, + <0x03650000 0x10000>; + reg-names = "hcd", "fpci", "bar2"; + + interrupts = <GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>; + + clocks = <&bpmp TEGRA234_CLK_XUSB_CORE_HOST>, + <&bpmp TEGRA234_CLK_XUSB_FALCON>, + <&bpmp TEGRA234_CLK_XUSB_CORE_SS>, + <&bpmp TEGRA234_CLK_XUSB_SS>, + <&bpmp TEGRA234_CLK_CLK_M>, + <&bpmp TEGRA234_CLK_XUSB_FS>, + <&bpmp TEGRA234_CLK_UTMIP_PLL>, + <&bpmp TEGRA234_CLK_CLK_M>, + <&bpmp TEGRA234_CLK_PLLE>; + clock-names = "xusb_host", "xusb_falcon_src", + "xusb_ss", "xusb_ss_src", "xusb_hs_src", + "xusb_fs_src", "pll_u_480m", "clk_m", + "pll_e"; + interconnects = <&mc TEGRA234_MEMORY_CLIENT_XUSB_HOSTR &emc>, + <&mc TEGRA234_MEMORY_CLIENT_XUSB_HOSTW &emc>; + interconnect-names = "dma-mem", "write"; + iommus = <&smmu_niso1 TEGRA234_SID_XUSB_HOST>; + + power-domains = <&bpmp TEGRA234_POWER_DOMAIN_XUSBC>, + <&bpmp TEGRA234_POWER_DOMAIN_XUSBA>; + power-domain-names = "xusb_host", "xusb_ss"; + + nvidia,xusb-padctl = <&xusb_padctl>; + dma-coherent; + status = "disabled"; + }; + fuse@3810000 { compatible = "nvidia,tegra234-efuse"; reg = <0x03810000 0x10000>;
arch/arm64/boot/dts/nvidia/tegra234.dtsi gen2_i2c: i2c@c240000 { · line 1645
Quoted 8 lines
arch/arm64/boot/dts/nvidia/tegra234.dtsi +2
-0@@ -1470,6 +1638,8 @@ gen2_i2c: i2c@c240000 { compatible = "nvidia,tegra194-i2c"; reg = <0xc240000 0x100>; interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; status = "disabled"; clock-frequency = <100000>; clocks = <&bpmp TEGRA234_CLK_I2C2
Thanks
Jon
Signature · 1 line
nvpublic
PATCH v3 5/13 usb: typec: ucsi_ccg: Add OF support
In reply to Wayne ChangThe change enables the device tree infrastructure support.
---
V2 -> V3:nothing has changed
V1 -> V2:nothing has changed
drivers/usb/typec/ucsi/ucsi_ccg.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/usb/typec/ucsi/ucsi_ccg.c +8 -1
@@ -643,7 +643,7 @@ static int ccg_request_irq(struct ucsi_ccg *uc) {unsigned long flags =IRQF_ONESHOT ; -if (!has_acpi_companion (uc->dev)) +if (!dev_fwnode (uc->dev)) flags |=IRQF_TRIGGER_HIGH ;return request_threaded_irq (uc->irq,NULL , ccg_irq_handler, flags,dev_name (uc->dev), uc);
@@ -1427,6 +1427,12 @@ static void ucsi_ccg_remove(struct i2c_client *client)free_irq (uc->irq, uc); } +static const struct of_device_id ucsi_ccg_of_match_table[] = { + { .compatible ="cypress,cypd4226" , }, + {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (of, ucsi_ccg_of_match_table); +static const struct i2c_device_id ucsi_ccg_device_id[] = { {"ccgx-ucsi" ,0 }, {}
@@ -1481,6 +1487,7 @@ static struct i2c_driver ucsi_ccg_driver = { .pm = &ucsi_ccg_pm, .dev_groups = ucsi_ccg_groups, .acpi_match_table = amd_i2c_ucsi_match, + .of_match_table = ucsi_ccg_of_match_table, }, .probe = ucsi_ccg_probe, .remove = ucsi_ccg_remove,
Signature · 7 lines
2.25.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH v3 05/13] usb: typec: ucsi_ccg: Add OF support
Quoted 36 lines · Wayne Chang
The change enables the device tree infrastructure support.
Signed-off-by Wayne Chang <[email protected]>---
V2 -> V3:nothing has changed
V1 -> V2:nothing has changeddrivers/usb/typec/ucsi/ucsi_ccg.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)drivers/usb/typec/ucsi/ucsi_ccg.c +7
-1@@ -643,7 +643,7 @@ static int ccg_request_irq(struct ucsi_ccg *uc) {unsigned long flags =IRQF_ONESHOT ; -if (!has_acpi_companion (uc->dev)) +if (!dev_fwnode (uc->dev)) flags |=IRQF_TRIGGER_HIGH ;return request_threaded_irq (uc->irq,NULL , ccg_irq_handler, flags,dev_name (uc->dev), uc);@@ -1427,6 +1427,12 @@ static void ucsi_ccg_remove(struct i2c_client *client)free_irq (uc->irq, uc); } +static const struct of_device_id ucsi_ccg_of_match_table[] = { + { .compatible ="cypress,cypd4226" , }, + {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (of, ucsi_ccg_of_match_table); +static const struct i2c_device_id ucsi_ccg_device_id[] = { {"ccgx-ucsi" ,0 }, {}
drivers/usb/typec/ucsi/ucsi_ccg.c static struct i2c_driver ucsi_ccg_driver = { · line 1493
Quoted 7 lines
drivers/usb/typec/ucsi/ucsi_ccg.c +1
-0@@ -1481,6 +1487,7 @@ static struct i2c_driver ucsi_ccg_driver = { .pm = &ucsi_ccg_pm, .dev_groups = ucsi_ccg_groups, .acpi_match_table = amd_i2c_ucsi_match, + .of_match_table = ucsi_ccg_of_match_table, }, .probe = ucsi_ccg_probe, .remove = ucsi_ccg_remove,
Thanks
Jon
Signature · 6 lines
nvpublic -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH v3 05/13] usb: typec: ucsi_ccg: Add OF support
In reply to Wayne ChangQuoted 3 lines · Wayne Chang
The change enables the device tree infrastructure support.
Signed-off-by Wayne Chang <[email protected]>
Quoted 33 lines
---
V2 -> V3:nothing has changed
V1 -> V2:nothing has changeddrivers/usb/typec/ucsi/ucsi_ccg.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)drivers/usb/typec/ucsi/ucsi_ccg.c +7
-1@@ -643,7 +643,7 @@ static int ccg_request_irq(struct ucsi_ccg *uc) {unsigned long flags =IRQF_ONESHOT ; -if (!has_acpi_companion (uc->dev)) +if (!dev_fwnode (uc->dev)) flags |=IRQF_TRIGGER_HIGH ;return request_threaded_irq (uc->irq,NULL , ccg_irq_handler, flags,dev_name (uc->dev), uc);@@ -1427,6 +1427,12 @@ static void ucsi_ccg_remove(struct i2c_client *client)free_irq (uc->irq, uc); } +static const struct of_device_id ucsi_ccg_of_match_table[] = { + { .compatible ="cypress,cypd4226" , }, + {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (of, ucsi_ccg_of_match_table); +static const struct i2c_device_id ucsi_ccg_device_id[] = { {"ccgx-ucsi" ,0 }, {}
drivers/usb/typec/ucsi/ucsi_ccg.c static struct i2c_driver ucsi_ccg_driver = { · line 1493
Quoted 7 lines
drivers/usb/typec/ucsi/ucsi_ccg.c +1
-0@@ -1481,6 +1487,7 @@ static struct i2c_driver ucsi_ccg_driver = { .pm = &ucsi_ccg_pm, .dev_groups = ucsi_ccg_groups, .acpi_match_table = amd_i2c_ucsi_match, + .of_match_table = ucsi_ccg_of_match_table, }, .probe = ucsi_ccg_probe, .remove = ucsi_ccg_remove,
thanks,
Signature · 1 line
heikki
Heikki Krogerus
maintainerRe: [PATCH v3 05/13] usb: typec: ucsi_ccg: Add OF support
In reply to Wayne ChangQuoted 14 lines · Wayne Chang
The change enables the device tree infrastructure support.
Signed-off-by Wayne Chang <[email protected]>---
V2 -> V3:nothing has changed
V1 -> V2:nothing has changeddrivers/usb/typec/ucsi/ucsi_ccg.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)drivers/usb/typec/ucsi/ucsi_ccg.c +0
-0
drivers/usb/typec/ucsi/ucsi_ccg.c static int ccg_request_irq(struct ucsi_ccg *uc) · line 647
Quoted 6 lines
drivers/usb/typec/ucsi/ucsi_ccg.c +1
-1@@ -643,7 +643,7 @@ static int ccg_request_irq(struct ucsi_ccg *uc) {unsigned long flags =IRQF_ONESHOT ; -if (!has_acpi_companion (uc->dev)) +if (!dev_fwnode (uc->dev)) flags |=IRQF_TRIGGER_HIGH ;
Sorry, I had to double check this, and the above does not work after all. In the function i2c_new_ccgx_ucsi() the device is given a fwnode (of type software_node).
So that probable has to be changed to:
if (is_software_node(dev_fwnode(uc->dev)))
flags |= IRQF_TRIGGER_HIGH;Quoted 15 lines
drivers/usb/typec/ucsi/ucsi_ccg.c +6
-0return request_threaded_irq (uc->irq,NULL , ccg_irq_handler, flags,dev_name (uc->dev), uc);@@ -1427,6 +1427,12 @@ static void ucsi_ccg_remove(struct i2c_client *client)free_irq (uc->irq, uc); } +static const struct of_device_id ucsi_ccg_of_match_table[] = { + { .compatible ="cypress,cypd4226" , }, + {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (of, ucsi_ccg_of_match_table); +static const struct i2c_device_id ucsi_ccg_device_id[] = { {"ccgx-ucsi" ,0 }, {}
drivers/usb/typec/ucsi/ucsi_ccg.c static struct i2c_driver ucsi_ccg_driver = { · line 1493
Quoted 7 lines
drivers/usb/typec/ucsi/ucsi_ccg.c +1
-0@@ -1481,6 +1487,7 @@ static struct i2c_driver ucsi_ccg_driver = { .pm = &ucsi_ccg_pm, .dev_groups = ucsi_ccg_groups, .acpi_match_table = amd_i2c_ucsi_match, + .of_match_table = ucsi_ccg_of_match_table, }, .probe = ucsi_ccg_probe, .remove = ucsi_ccg_remove,
thanks,
Signature · 1 line
heikki
PATCH v3 6/13 usb: typec: ucsi_ccg: Add cypress,firmware-build as a well-known regex
In reply to Wayne Changccgx is refer to the cypress cypd4226 typec controller. add cypress,firmware-build as a well-known regex.
16-bit value is not sufficient for descriptiva names. Using string instead of u16 to make it more descriptive.
---
V2 -> V3:nothing has changed
V1 -> V2:new change added for adding cypress,firmware-build
drivers/usb/typec/ucsi/ucsi_ccg.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/usb/typec/ucsi/ucsi_ccg.c +12 -0
@@ -1343,6 +1343,7 @@ static int ucsi_ccg_probe(struct i2c_client *client, {struct device *dev = &client->dev;struct ucsi_ccg *uc; +const char *of_fw_build;int status; uc =devm_kzalloc (dev,sizeof (*uc),GFP_KERNEL );
@@ -1363,6 +1364,17 @@ static int ucsi_ccg_probe(struct i2c_client *client,if (status)dev_err (uc->dev,"failed to get FW build information\n" ); + status =device_property_read_string (dev,"cypress,firmware-build" , + &of_fw_build); +if (!status) { +if (!strcmp (of_fw_build,"nvidia,jetson-agx-xavier" )) + uc->fw_build =CCG_FW_BUILD_NVIDIA_TEGRA ; +else if (!strcmp (of_fw_build,"nvidia,gpu" )) + uc->fw_build =CCG_FW_BUILD_NVIDIA ; + }else { +dev_err (uc->dev,"failed to get FW build information\n" ); + } +/* reset ccg device and initialize ucsi */ status =ucsi_ccg_init (uc);if (status <0 ) {
Signature · 7 lines
2.25.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH v3 06/13] usb: typec: ucsi_ccg: Add cypress,firmware-build as a well-known regex
Quoted 33 lines · Wayne Chang
ccgx is refer to the cypress cypd4226 typec controller. add cypress,firmware-build as a well-known regex.
16-bit value is not sufficient for descriptiva names. Using string instead of u16 to make it more descriptive.
Signed-off-by Wayne Chang <[email protected]>---
V2 -> V3:nothing has changed
V1 -> V2:new change added for adding cypress,firmware-builddrivers/usb/typec/ucsi/ucsi_ccg.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/usb/typec/ucsi/ucsi_ccg.c +5
-0@@ -1343,6 +1343,7 @@ static int ucsi_ccg_probe(struct i2c_client *client, {struct device *dev = &client->dev;struct ucsi_ccg *uc; +const char *of_fw_build;int status; uc =devm_kzalloc (dev,sizeof (*uc),GFP_KERNEL );@@ -1363,6 +1364,17 @@ static int ucsi_ccg_probe(struct i2c_client *client,if (status)dev_err (uc->dev,"failed to get FW build information\n" ); + status =device_property_read_string (dev,"cypress,firmware-build" , + &of_fw_build); +if (!status) { +if (!strcmp (of_fw_build,"nvidia,jetson-agx-xavier" ))
drivers/usb/typec/ucsi/ucsi_ccg.c static int ucsi_ccg_probe(struct i2c_client *client, · line 1380
Quoted 10 lines
drivers/usb/typec/ucsi/ucsi_ccg.c +7
-0+ uc->fw_build =CCG_FW_BUILD_NVIDIA_TEGRA ; + else if (!strcmp(of_fw_build, "nvidia,gpu")) + uc->fw_build =CCG_FW_BUILD_NVIDIA ; + }else { +dev_err (uc->dev,"failed to get FW build information\n" ); + } +/* reset ccg device and initialize ucsi */ status =ucsi_ccg_init (uc);if (status <0 ) {
Thanks
Jon
Signature · 6 lines
nvpublic -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Jon Hunter
maintainerRe: [PATCH v3 06/13] usb: typec: ucsi_ccg: Add cypress,firmware-build as a well-known regex
In reply to Wayne ChangQuoted 30 lines · Wayne Chang
ccgx is refer to the cypress cypd4226 typec controller. add cypress,firmware-build as a well-known regex.
16-bit value is not sufficient for descriptiva names. Using string instead of u16 to make it more descriptive.
Signed-off-by Wayne Chang <[email protected]>---
V2 -> V3:nothing has changed
V1 -> V2:new change added for adding cypress,firmware-builddrivers/usb/typec/ucsi/ucsi_ccg.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/usb/typec/ucsi/ucsi_ccg.c +2
-0@@ -1343,6 +1343,7 @@ static int ucsi_ccg_probe(struct i2c_client *client, {struct device *dev = &client->dev;struct ucsi_ccg *uc; +const char *of_fw_build;int status; uc =devm_kzalloc (dev,sizeof (*uc),GFP_KERNEL );@@ -1363,6 +1364,17 @@ static int ucsi_ccg_probe(struct i2c_client *client,if (status)dev_err (uc->dev,"failed to get FW build information\n" ); + status = device_property_read_string(dev, "cypress,firmware-build",
drivers/usb/typec/ucsi/ucsi_ccg.c static int ucsi_ccg_probe(struct i2c_client *client, · line 1377
Quoted 10 lines
drivers/usb/typec/ucsi/ucsi_ccg.c +10
-0+ &of_fw_build); +if (!status) { +if (!strcmp (of_fw_build,"nvidia,jetson-agx-xavier" )) + uc->fw_build =CCG_FW_BUILD_NVIDIA_TEGRA ; +else if (!strcmp (of_fw_build,"nvidia,gpu" )) + uc->fw_build =CCG_FW_BUILD_NVIDIA ; + }else { +dev_err (uc->dev,"failed to get FW build information\n" ); + } +
Instead of having the 'else' clause above, we should just ...
if (!uc->fw_build)
dev_err(uc->dev, "failed to get FW build information\n");
It is possible that status == 0, but the fw_build is not recognised/supported and so 'uc->fw_build' is not set.
Jon
Signature · 1 line
nvpublic
PATCH v3 7/13 i2c: nvidia-gpu: Add cypress,firmware-build as a well-known regex
In reply to Wayne Changccgx is refer to the cypress cypd4226 typec controller. add cypress,firmware-build as a well-known regex.
16-bit value is not sufficient for descriptiva names. Using string instead of u16 to make it more descriptive.
---
V2 -> V3:nothing has changed
V1 -> V2:New change for adding cypress,firmware-build
drivers/i2c/busses/i2c-nvidia-gpu.c | 1 + 1 file changed, 1 insertion(+)
drivers/i2c/busses/i2c-nvidia-gpu.c +1 -0
@@ -261,6 +261,7 @@ MODULE_DEVICE_TABLE(pci, gpu_i2c_ids);static const struct property_entry ccgx_props[] = {/* Use FW built for NVIDIA (nv) only */ PROPERTY_ENTRY_U16 ("ccgx,firmware-build" , ('n' <<8 ) |'v' ), +PROPERTY_ENTRY_STRING ("cypress,firmware-build" ,"nvidia,gpu" ), { } };
Signature · 7 lines
2.25.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH v3 07/13] i2c: nvidia-gpu: Add cypress,firmware-build as a well-known regex
Quoted 18 lines · Wayne Chang
ccgx is refer to the cypress cypd4226 typec controller. add cypress,firmware-build as a well-known regex.
16-bit value is not sufficient for descriptiva names. Using string instead of u16 to make it more descriptive.
Signed-off-by Wayne Chang <[email protected]>---
V2 -> V3:nothing has changed
V1 -> V2:New change for adding cypress,firmware-builddrivers/i2c/busses/i2c-nvidia-gpu.c | 1 + 1 file changed, 1 insertion(+)drivers/i2c/busses/i2c-nvidia-gpu.c +0
-0
drivers/i2c/busses/i2c-nvidia-gpu.c MODULE_DEVICE_TABLE(pci, gpu_i2c_ids); · line 267
Quoted 7 lines
drivers/i2c/busses/i2c-nvidia-gpu.c +1
-0@@ -261,6 +261,7 @@ MODULE_DEVICE_TABLE(pci, gpu_i2c_ids);static const struct property_entry ccgx_props[] = {/* Use FW built for NVIDIA (nv) only */ PROPERTY_ENTRY_U16 ("ccgx,firmware-build" , ('n' <<8 ) |'v' ), +PROPERTY_ENTRY_STRING ("cypress,firmware-build" ,"nvidia,gpu" ), { } };
Thanks
Jon
Signature · 6 lines
nvpublic -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH v3 07/13] i2c: nvidia-gpu: Add cypress,firmware-build as a well-known regex
In reply to Wayne ChangQuoted 7 lines · Wayne Chang
ccgx is refer to the cypress cypd4226 typec controller. add cypress,firmware-build as a well-known regex.
16-bit value is not sufficient for descriptiva names. Using string instead of u16 to make it more descriptive.
Signed-off-by Wayne Chang <[email protected]>
I assume this series goes upstream as a whole via some tree. So, for the I2C changes:
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v3 8/13 usb: typec: ucsi_ccg: Remove ccgx,firmware-build property
In reply to Wayne ChangRemove the property ccgx,firmware-build as we have added well-known regex cypress,firmware-build.
---
V2 -> V3:nothing has changed
V1 -> V2:nothing has changed
drivers/usb/typec/ucsi/ucsi_ccg.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/usb/typec/ucsi/ucsi_ccg.c +0 -5
@@ -1359,11 +1359,6 @@ static int ucsi_ccg_probe(struct i2c_client *client,INIT_WORK (&uc->pm_work, ccg_pm_workaround_work);/* Only fail FW flashing when FW build information is not provided */ - status =device_property_read_u16 (dev,"ccgx,firmware-build" , - &uc->fw_build); -if (status) -dev_err (uc->dev,"failed to get FW build information\n" ); - status =device_property_read_string (dev,"cypress,firmware-build" , &of_fw_build);if (!status) {
Signature · 7 lines
2.25.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH v3 08/13] usb: typec: ucsi_ccg: Remove ccgx,firmware-build property
Quoted 16 lines · Wayne Chang
Remove the property ccgx,firmware-build as we have added well-known regex cypress,firmware-build.
Signed-off-by Wayne Chang <[email protected]>---
V2 -> V3:nothing has changed
V1 -> V2:nothing has changeddrivers/usb/typec/ucsi/ucsi_ccg.c | 5 ----- 1 file changed, 5 deletions(-)drivers/usb/typec/ucsi/ucsi_ccg.c +0
-0@@ -1359,11 +1359,6 @@ static int ucsi_ccg_probe(struct i2c_client *client,INIT_WORK (&uc->pm_work, ccg_pm_workaround_work);
drivers/usb/typec/ucsi/ucsi_ccg.c static int ucsi_ccg_probe(struct i2c_client *client, · line 1364
Quoted 10 lines
drivers/usb/typec/ucsi/ucsi_ccg.c +0
-5/* Only fail FW flashing when FW build information is not provided */ - status =device_property_read_u16 (dev,"ccgx,firmware-build" , - &uc->fw_build); -if (status) -dev_err (uc->dev,"failed to get FW build information\n" ); - status =device_property_read_string (dev,"cypress,firmware-build" , &of_fw_build);if (!status) {
Thanks
Jon
Signature · 1 line
nvpublic
PATCH v3 9/13 i2c: nvidia-gpu: Remove ccgx,firmware-build property
In reply to Wayne ChangRemove the property ccgx,firmware-build as we have added well-known regex cypress,firmware-build.
---
V2 -> V3:nothing has changed
V1 -> V2:New added for bisectablility
drivers/i2c/busses/i2c-nvidia-gpu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/i2c/busses/i2c-nvidia-gpu.c +1 -2
@@ -259,8 +259,7 @@ static const struct pci_device_id gpu_i2c_ids[] = {MODULE_DEVICE_TABLE (pci, gpu_i2c_ids);static const struct property_entry ccgx_props[] = { -/* Use FW built for NVIDIA (nv) only */ -PROPERTY_ENTRY_U16 ("ccgx,firmware-build" , ('n' <<8 ) |'v' ), +/* Use FW built for NVIDIA GPU only */ PROPERTY_ENTRY_STRING ("cypress,firmware-build" ,"nvidia,gpu" ), { } };
Signature · 7 lines
2.25.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH v3 09/13] i2c: nvidia-gpu: Remove ccgx,firmware-build property
Quoted 15 lines · Wayne Chang
Remove the property ccgx,firmware-build as we have added well-known regex cypress,firmware-build.
Signed-off-by Wayne Chang <[email protected]>---
V2 -> V3:nothing has changed
V1 -> V2:New added for bisectablilitydrivers/i2c/busses/i2c-nvidia-gpu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/i2c/busses/i2c-nvidia-gpu.c +0
-0
drivers/i2c/busses/i2c-nvidia-gpu.c static const struct pci_device_id gpu_i2c_ids[] = { · line 265
Quoted 9 lines
drivers/i2c/busses/i2c-nvidia-gpu.c +1
-2@@ -259,8 +259,7 @@ static const struct pci_device_id gpu_i2c_ids[] = {MODULE_DEVICE_TABLE (pci, gpu_i2c_ids);static const struct property_entry ccgx_props[] = { -/* Use FW built for NVIDIA (nv) only */ -PROPERTY_ENTRY_U16 ("ccgx,firmware-build" , ('n' <<8 ) |'v' ), +/* Use FW built for NVIDIA GPU only */ PROPERTY_ENTRY_STRING ("cypress,firmware-build" ,"nvidia,gpu" ), { } };
Thanks
Jon
Signature · 6 lines
nvpublic -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH v3 09/13] i2c: nvidia-gpu: Remove ccgx,firmware-build property
In reply to Wayne ChangQuoted 4 lines · Wayne Chang
Remove the property ccgx,firmware-build as we have added well-known regex cypress,firmware-build.
Signed-off-by Wayne Chang <[email protected]>
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v3 10/13 phy: tegra: xusb: Disable trk clk when not in use
In reply to Wayne ChangPad tracking is a one-time calibration for Tegra186 and Tegra194. Clk should be disabled after calibration.
Disable clk after calibration.
While at it add 100us delay for HW recording the calibration value.
---
V2 -> V3:nothing has changed
V1 -> V2:update the commit message.
drivers/phy/tegra/xusb-tegra186.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/phy/tegra/xusb-tegra186.c +4 -2
@@ -609,6 +609,10 @@ static void tegra186_utmi_bias_pad_power_on(struct tegra_xusb_padctl *padctl) value &= ~USB2_PD_TRK ;padctl_writel (padctl, value,XUSB_PADCTL_USB2_BIAS_PAD_CTL1 ); +udelay (100 ); + +clk_disable_unprepare (priv->usb2_trk_clk); +mutex_unlock (&padctl->lock); }
@@ -633,8 +637,6 @@ static void tegra186_utmi_bias_pad_power_off(struct tegra_xusb_padctl *padctl) value |=USB2_PD_TRK ;padctl_writel (padctl, value,XUSB_PADCTL_USB2_BIAS_PAD_CTL1 ); -clk_disable_unprepare (priv->usb2_trk_clk); -mutex_unlock (&padctl->lock); }
Signature · 7 lines
2.25.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH v3 10/13] phy: tegra: xusb: Disable trk clk when not in use
Quoted 29 lines · Wayne Chang
Pad tracking is a one-time calibration for Tegra186 and Tegra194. Clk should be disabled after calibration.
Disable clk after calibration.
While at it add 100us delay for HW recording the calibration value.Signed-off-by Wayne Chang <[email protected]>---
V2 -> V3:nothing has changed
V1 -> V2:update the commit message.drivers/phy/tegra/xusb-tegra186.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/phy/tegra/xusb-tegra186.c +4
-0@@ -609,6 +609,10 @@ static void tegra186_utmi_bias_pad_power_on(struct tegra_xusb_padctl *padctl) value &= ~USB2_PD_TRK ;padctl_writel (padctl, value,XUSB_PADCTL_USB2_BIAS_PAD_CTL1 ); +udelay (100 ); + +clk_disable_unprepare (priv->usb2_trk_clk); +mutex_unlock (&padctl->lock); }
drivers/phy/tegra/xusb-tegra186.c static void tegra186_utmi_bias_pad_power_off(struct tegra_xusb_padctl *padctl) · line 642
Quoted 8 lines
drivers/phy/tegra/xusb-tegra186.c +0
-2@@ -633,8 +637,6 @@ static void tegra186_utmi_bias_pad_power_off(struct tegra_xusb_padctl *padctl) value |=USB2_PD_TRK ;padctl_writel (padctl, value,XUSB_PADCTL_USB2_BIAS_PAD_CTL1 ); -clk_disable_unprepare (priv->usb2_trk_clk); -mutex_unlock (&padctl->lock); }
Thanks
Jon
Signature · 6 lines
nvpublic -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH v3 10/13] phy: tegra: xusb: Disable trk clk when not in use
In reply to Wayne ChangQuoted 5 lines · Wayne Chang
Pad tracking is a one-time calibration for Tegra186 and Tegra194. Clk should be disabled after calibration.
Disable clk after calibration.
While at it add 100us delay for HW recording the calibration value.
Applied, thanks
Signature · 6 lines
~Vinod -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v3 11/13 phy: tegra: xusb: Add Tegra234 support
In reply to Wayne ChangFrom: Sing-Han Chen <[email protected]>
Add support for the XUSB pad controller found on Tegra234 SoCs. It is mostly similar to the same IP found on Tegra194, because most of the Tegra234 XUSB PADCTL registers definition and programming sequence are the same as Tegra194, Tegra234 XUSB PADCTL can share the same driver with Tegra186 and Tegra194 XUSB PADCTL.
Introduce a new feature, USB2 HW tracking, for Tegra234. The feature is to enable HW periodical PAD tracking which measure and capture the electric parameters of USB2.0 PAD.
---
V2 -> V3:nothing has changed
V1 -> V2:remove atomic and the helper in padctl_readl_poll func.
drivers/phy/tegra/Makefile | 1 + drivers/phy/tegra/xusb-tegra186.c | 64 +++++++++++++++++++++++++++++-- drivers/phy/tegra/xusb.c | 6 +++ drivers/phy/tegra/xusb.h | 22 +++++++++++ 4 files changed, 90 insertions(+), 3 deletions(-)
drivers/phy/tegra/Makefile +1 -0
@@ -7,4 +7,5 @@ phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_132_SOC) += xusb-tegra124.o phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_210_SOC) += xusb-tegra210.o phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_186_SOC) += xusb-tegra186.o phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_194_SOC) += xusb-tegra186.o +phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_234_SOC) += xusb-tegra186.o obj-$(CONFIG_PHY_TEGRA194_P2U) += phy-tegra194-p2u.o
drivers/phy/tegra/xusb-tegra186.c +61 -3
97 lines not on this page · raw message
drivers/phy/tegra/xusb.c +6 -0
@@ -71,6 +71,12 @@ static const struct of_device_id tegra_xusb_padctl_of_match[] = { .compatible = "nvidia,tegra194-xusb-padctl", .data = &tegra194_xusb_padctl_soc, }, +#endif +#if defined(CONFIG_ARCH_TEGRA_234_SOC ) + { + .compatible = "nvidia,tegra234-xusb-padctl", + .data = &tegra234_xusb_padctl_soc, + }, #endif { } };
drivers/phy/tegra/xusb.h +22 -0
@@ -8,6 +8,7 @@#define __PHY_TEGRA_XUSB_H#include <linux/io.h> +#include <linux/iopoll.h> #include <linux/mutex.h> #include <linux/workqueue.h>
@@ -433,6 +434,8 @@ struct tegra_xusb_padctl_soc {unsigned int num_supplies;bool supports_gen2;bool need_fake_usb3_port; +bool poll_trk_completed; +bool trk_hw_mode; };struct tegra_xusb_padctl {
@@ -475,6 +478,22 @@ static inline u32 padctl_readl(struct tegra_xusb_padctl *padctl,return value; } +static inline u32 padctl_readl_poll (struct tegra_xusb_padctl *padctl, +unsigned long offset,u32 val,u32 mask,int us) +{ +u32 regval; +int err; + + err =readl_poll_timeout (padctl->regs + offset, regval, + (regval & mask) == val,1 , us); +if (err) { +dev_err (padctl->dev,"%08lx poll timeout > %08x\n" , offset, + regval); + } + +return err; +} +struct tegra_xusb_lane *tegra_xusb_find_lane (struct tegra_xusb_padctl *padctl,const char *name,unsigned int index);
@@ -491,5 +510,8 @@ extern const struct tegra_xusb_padctl_soc tegra186_xusb_padctl_soc;#if defined(CONFIG_ARCH_TEGRA_194_SOC )extern const struct tegra_xusb_padctl_soc tegra194_xusb_padctl_soc;#endif +#if defined(CONFIG_ARCH_TEGRA_234_SOC ) +extern const struct tegra_xusb_padctl_soc tegra234_xusb_padctl_soc; +#endif #endif /* __PHY_TEGRA_XUSB_H */
Signature · 7 lines
2.25.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH v3 11/13] phy: tegra: xusb: Add Tegra234 support
Quoted 202 lines · Wayne Chang
From: Sing-Han Chen <[email protected]>
Add support for the XUSB pad controller found on Tegra234 SoCs. It is mostly similar to the same IP found on Tegra194, because most of the Tegra234 XUSB PADCTL registers definition and programming sequence are the same as Tegra194, Tegra234 XUSB PADCTL can share the same driver with Tegra186 and Tegra194 XUSB PADCTL.
Introduce a new feature, USB2 HW tracking, for Tegra234. The feature is to enable HW periodical PAD tracking which measure and capture the electric parameters of USB2.0 PAD.
Signed-off-by Sing-Han Chen <[email protected]>Co-developed-by Wayne Chang <[email protected]>Signed-off-by Wayne Chang <[email protected]>---
V2 -> V3:nothing has changed
V1 -> V2:remove atomic and the helper inpadctl_readl_pollfunc.drivers/phy/tegra/Makefile | 1 + drivers/phy/tegra/xusb-tegra186.c | 64 +++++++++++++++++++++++++++++-- drivers/phy/tegra/xusb.c | 6 +++ drivers/phy/tegra/xusb.h | 22 +++++++++++ 4 files changed, 90 insertions(+), 3 deletions(-)drivers/phy/tegra/Makefile +1
-0@@ -7,4 +7,5 @@ phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_132_SOC) += xusb-tegra124.o phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_210_SOC) += xusb-tegra210.o phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_186_SOC) += xusb-tegra186.o phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_194_SOC) += xusb-tegra186.o +phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_234_SOC) += xusb-tegra186.o obj-$(CONFIG_PHY_TEGRA194_P2U) += phy-tegra194-p2u.odrivers/phy/tegra/xusb-tegra186.c +61
-3@@ -89,6 +89,11 @@#define USB2_TRK_START_TIMER (x) (((x) & 0x7f) << 12)#define USB2_TRK_DONE_RESET_TIMER (x) (((x) & 0x7f) << 19)#define USB2_PD_TRK BIT(26) +#define USB2_TRK_COMPLETED BIT(31) + +#define XUSB_PADCTL_USB2_BIAS_PAD_CTL2 0x28c +#define USB2_TRK_HW_MODE BIT(0) +#define CYA_TRK_CODE_UPDATE_ON_IDLE BIT(31)#define XUSB_PADCTL_HSIC_PADX_CTL0 (x) (0x300 + (x) * 0x20)#define HSIC_PD_TX_DATA0 BIT(1)@@ -609,9 +614,31 @@ static void tegra186_utmi_bias_pad_power_on(struct tegra_xusb_padctl *padctl) value &= ~USB2_PD_TRK ;padctl_writel (padctl, value,XUSB_PADCTL_USB2_BIAS_PAD_CTL1 ); -udelay (100 ); +if (padctl->soc->poll_trk_completed) { + err =padctl_readl_poll (padctl,XUSB_PADCTL_USB2_BIAS_PAD_CTL1 , +USB2_TRK_COMPLETED ,USB2_TRK_COMPLETED ,100 ); +if (err) { +/* The failure with polling on trk complete will not +* cause the failure of powering on the bias pad. +*/ +dev_warn (dev,"failed to poll USB2 trk completed: %d\n" , err); + } -clk_disable_unprepare (priv->usb2_trk_clk); + value =padctl_readl (padctl,XUSB_PADCTL_USB2_BIAS_PAD_CTL1 ); + value |=USB2_TRK_COMPLETED ; +padctl_writel (padctl, value,XUSB_PADCTL_USB2_BIAS_PAD_CTL1 ); + }else { +udelay (100 ); + } + +if (padctl->soc->trk_hw_mode) { + value =padctl_readl (padctl,XUSB_PADCTL_USB2_BIAS_PAD_CTL2 ); + value |=USB2_TRK_HW_MODE ; + value &= ~CYA_TRK_CODE_UPDATE_ON_IDLE ; +padctl_writel (padctl, value,XUSB_PADCTL_USB2_BIAS_PAD_CTL2 ); + }else { +clk_disable_unprepare (priv->usb2_trk_clk); + }mutex_unlock (&padctl->lock); }@@ -637,6 +664,13 @@ static void tegra186_utmi_bias_pad_power_off(struct tegra_xusb_padctl *padctl) value |=USB2_PD_TRK ;padctl_writel (padctl, value,XUSB_PADCTL_USB2_BIAS_PAD_CTL1 ); +if (padctl->soc->trk_hw_mode) { + value =padctl_readl (padctl,XUSB_PADCTL_USB2_BIAS_PAD_CTL2 ); + value &= ~USB2_TRK_HW_MODE ; +padctl_writel (padctl, value,XUSB_PADCTL_USB2_BIAS_PAD_CTL2 ); +clk_disable_unprepare (priv->usb2_trk_clk); + } +mutex_unlock (&padctl->lock); }@@ -1560,7 +1594,8 @@ const struct tegra_xusb_padctl_soc tegra186_xusb_padctl_soc = {EXPORT_SYMBOL_GPL (tegra186_xusb_padctl_soc);#endif -#if IS_ENABLED (CONFIG_ARCH_TEGRA_194_SOC ) +#if IS_ENABLED (CONFIG_ARCH_TEGRA_194_SOC ) || \ +IS_ENABLED (CONFIG_ARCH_TEGRA_234_SOC )static const char *const tegra194_xusb_padctl_supply_names[] = {"avdd-usb" , "vclamp-usb",@@ -1616,8 +1651,31 @@ const struct tegra_xusb_padctl_soc tegra194_xusb_padctl_soc = { .supply_names = tegra194_xusb_padctl_supply_names, .num_supplies = ARRAY_SIZE(tegra194_xusb_padctl_supply_names), .supports_gen2 = true, + .poll_trk_completed = true, };EXPORT_SYMBOL_GPL (tegra194_xusb_padctl_soc); + +const struct tegra_xusb_padctl_soc tegra234_xusb_padctl_soc = { + .num_pads =ARRAY_SIZE (tegra194_pads), + .pads = tegra194_pads, + .ports = { + .usb2 = { + .ops = &tegra186_usb2_port_ops, + .count =4 , + }, + .usb3 = { + .ops = &tegra186_usb3_port_ops, + .count =4 , + }, + }, + .ops = &tegra186_xusb_padctl_ops, + .supply_names = tegra194_xusb_padctl_supply_names, + .num_supplies =ARRAY_SIZE (tegra194_xusb_padctl_supply_names), + .supports_gen2 = true, + .poll_trk_completed = true, + .trk_hw_mode = true, +}; +EXPORT_SYMBOL_GPL (tegra234_xusb_padctl_soc);#endif MODULE_AUTHOR ("JC Kuo <[email protected]>" );drivers/phy/tegra/xusb.c +6
-0@@ -71,6 +71,12 @@ static const struct of_device_id tegra_xusb_padctl_of_match[] = { .compatible = "nvidia,tegra194-xusb-padctl", .data = &tegra194_xusb_padctl_soc, }, +#endif +#if defined(CONFIG_ARCH_TEGRA_234_SOC ) + { + .compatible = "nvidia,tegra234-xusb-padctl", + .data = &tegra234_xusb_padctl_soc, + }, #endif { } };drivers/phy/tegra/xusb.h +19
-0@@ -8,6 +8,7 @@#define __PHY_TEGRA_XUSB_H#include <linux/io.h> +#include <linux/iopoll.h> #include <linux/mutex.h> #include <linux/workqueue.h> @@ -433,6 +434,8 @@ struct tegra_xusb_padctl_soc {unsigned int num_supplies;bool supports_gen2;bool need_fake_usb3_port; +bool poll_trk_completed; +bool trk_hw_mode; };struct tegra_xusb_padctl {@@ -475,6 +478,22 @@ static inline u32 padctl_readl(struct tegra_xusb_padctl *padctl,return value; } +static inline u32 padctl_readl_poll (struct tegra_xusb_padctl *padctl, +unsigned long offset,u32 val,u32 mask,int us) +{ +u32 regval; +int err; + + err =readl_poll_timeout (padctl->regs + offset, regval, + (regval & mask) == val,1 , us); +if (err) { +dev_err (padctl->dev,"%08lx poll timeout > %08x\n" , offset, + regval); + } + +return err; +} +struct tegra_xusb_lane *tegra_xusb_find_lane (struct tegra_xusb_padctl *padctl,const char *name,unsigned int index);
drivers/phy/tegra/xusb.h extern const struct tegra_xusb_padctl_soc tegra186_xusb_padctl_soc; · line 517
Quoted 8 lines
drivers/phy/tegra/xusb.h +3
-0@@ -491,5 +510,8 @@ extern const struct tegra_xusb_padctl_soc tegra186_xusb_padctl_soc;#if defined(CONFIG_ARCH_TEGRA_194_SOC )extern const struct tegra_xusb_padctl_soc tegra194_xusb_padctl_soc;#endif +#if defined(CONFIG_ARCH_TEGRA_234_SOC ) +extern const struct tegra_xusb_padctl_soc tegra234_xusb_padctl_soc; +#endif #endif /* __PHY_TEGRA_XUSB_H */
Thanks
Jon
Signature · 6 lines
nvpublic -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v3 12/13 usb: host: xhci-tegra: Add Tegra234 XHCI support
In reply to Wayne ChangFrom: Sing-Han Chen <[email protected]>
This change adds Tegra234 XUSB host mode controller support.
In Tegra234, some of the registers have moved to bar2 space. The new soc variable has_bar2 indicates the chip with bar2 area. This patch adds new reg helper to let the driver reuse the same code for those chips with bar2 support.
---
V2 -> V3:nothing has changed
V1 -> V2:fix some issues on coding style extract tegra_xusb_load_firmware function refine has_bar2 and remove has_ifr/firmware on Tegra234
drivers/usb/host/xhci-tegra.c | 270 +++++++++++++++++++++++++++++----- 1 file changed, 232 insertions(+), 38 deletions(-)
drivers/usb/host/xhci-tegra.c +232 -38
@@ -44,6 +44,9 @@#define XUSB_CFG_4 0x010#define XUSB_BASE_ADDR_SHIFT 15#define XUSB_BASE_ADDR_MASK 0x1ffff +#define XUSB_CFG_7 0x01c +#define XUSB_BASE2_ADDR_SHIFT 16 +#define XUSB_BASE2_ADDR_MASK 0xffff#define XUSB_CFG_16 0x040#define XUSB_CFG_24 0x060#define XUSB_CFG_AXI_CFG 0x0f8
@@ -75,6 +78,20 @@#define MBOX_SMI_INTR_FW_HANG BIT(1)#define MBOX_SMI_INTR_EN BIT(3) +/* BAR2 registers */ +#define XUSB_BAR2_ARU_MBOX_CMD 0x004 +#define XUSB_BAR2_ARU_MBOX_DATA_IN 0x008 +#define XUSB_BAR2_ARU_MBOX_DATA_OUT 0x00c +#define XUSB_BAR2_ARU_MBOX_OWNER 0x010 +#define XUSB_BAR2_ARU_SMI_INTR 0x014 +#define XUSB_BAR2_ARU_SMI_ARU_FW_SCRATCH_DATA0 0x01c +#define XUSB_BAR2_ARU_IFRDMA_CFG0 0x0e0 +#define XUSB_BAR2_ARU_IFRDMA_CFG1 0x0e4 +#define XUSB_BAR2_ARU_IFRDMA_STREAMID_FIELD 0x0e8 +#define XUSB_BAR2_ARU_C11_CSBRANGE 0x9c +#define XUSB_BAR2_ARU_FW_SCRATCH 0x1000 +#define XUSB_BAR2_CSB_BASE_ADDR 0x2000 +/* IPFS registers */ #define IPFS_XUSB_HOST_MSI_BAR_SZ_0 0x0c0#define IPFS_XUSB_HOST_MSI_AXI_BAR_ST_0 0x0c4
@@ -111,6 +128,9 @@#define IMFILLRNG1_TAG_HI_SHIFT 16#define XUSB_FALC_IMFILLCTL 0x158 +/* CSB ARU registers */ +#define XUSB_CSB_ARU_SCRATCH0 0x100100 +/* MP CSB registers */ #define XUSB_CSB_MP_ILOAD_ATTR 0x101a00#define XUSB_CSB_MP_ILOAD_BASE_LO 0x101a04
@@ -131,6 +151,9 @@#define IMEM_BLOCK_SIZE 256 +#define FW_IOCTL_TYPE_SHIFT 24 +#define FW_IOCTL_CFGTBL_READ 17 +struct tegra_xusb_fw_header {__le32 boot_loadaddr_in_imem;__le32 boot_codedfi_offset;
@@ -175,6 +198,7 @@ struct tegra_xusb_mbox_regs {u16 data_in;u16 data_out;u16 owner; +u16 smi_intr; };struct tegra_xusb_context_soc {
@@ -189,6 +213,18 @@ struct tegra_xusb_context_soc { } fpci; }; +struct tegra_xusb ; +struct tegra_xusb_soc_ops { +u32 (*mbox_reg_readl)(struct tegra_xusb *tegra, +unsigned int offset); +void (*mbox_reg_writel)(struct tegra_xusb *tegra, +u32 value,unsigned int offset); +u32 (*csb_reg_readl)(struct tegra_xusb *tegra, +unsigned int offset); +void (*csb_reg_writel)(struct tegra_xusb *tegra, +u32 value,unsigned int offset); +}; +struct tegra_xusb_soc {const char *firmware;const char *const *supply_names;
@@ -205,11 +241,14 @@ struct tegra_xusb_soc { } ports;struct tegra_xusb_mbox_regs mbox; +const struct tegra_xusb_soc_ops *ops;bool scale_ss_clock;bool has_ipfs;bool lpm_support;bool otg_reset_sspi; + +bool has_bar2; };struct tegra_xusb_context {
@@ -230,6 +269,8 @@ struct tegra_xusb {void __iomem *ipfs_base;void __iomem *fpci_base; +void __iomem *bar2_base; +struct resource *bar2;const struct tegra_xusb_soc *soc;
@@ -300,7 +341,33 @@ static inline void ipfs_writel(struct tegra_xusb *tegra, u32 value,writel (value, tegra->ipfs_base + offset); } +static inline u32 bar2_readl (struct tegra_xusb *tegra,unsigned int offset) +{ +return readl (tegra->bar2_base + offset); +} + +static inline void bar2_writel (struct tegra_xusb *tegra,u32 value, +unsigned int offset) +{ +writel (value, tegra->bar2_base + offset); +} +static u32 csb_readl (struct tegra_xusb *tegra,unsigned int offset) +{ +const struct tegra_xusb_soc_ops *ops = tegra->soc->ops; + +return ops->csb_reg_readl (tegra, offset); +} + +static void csb_writel (struct tegra_xusb *tegra,u32 value, +unsigned int offset) +{ +const struct tegra_xusb_soc_ops *ops = tegra->soc->ops; + + ops->csb_reg_writel (tegra, value, offset); +} + +static u32 fpci_csb_readl (struct tegra_xusb *tegra,unsigned int offset) {u32 page =CSB_PAGE_SELECT (offset);u32 ofs =CSB_PAGE_OFFSET (offset);
@@ -310,7 +377,7 @@ static u32 csb_readl(struct tegra_xusb *tegra, unsigned int offset)return fpci_readl (tegra,XUSB_CFG_CSB_BASE_ADDR + ofs); } -static void csb_writel (struct tegra_xusb *tegra,u32 value, +static void fpci_csb_writel (struct tegra_xusb *tegra,u32 value,unsigned int offset) {u32 page =CSB_PAGE_SELECT (offset);
@@ -320,6 +387,26 @@ static void csb_writel(struct tegra_xusb *tegra, u32 value,fpci_writel (tegra, value,XUSB_CFG_CSB_BASE_ADDR + ofs); } +static u32 bar2_csb_readl (struct tegra_xusb *tegra,unsigned int offset) +{ +u32 page =CSB_PAGE_SELECT (offset); +u32 ofs =CSB_PAGE_OFFSET (offset); + +bar2_writel (tegra, page,XUSB_BAR2_ARU_C11_CSBRANGE ); + +return bar2_readl (tegra,XUSB_BAR2_CSB_BASE_ADDR + ofs); +} + +static void bar2_csb_writel (struct tegra_xusb *tegra,u32 value, +unsigned int offset) +{ +u32 page =CSB_PAGE_SELECT (offset); +u32 ofs =CSB_PAGE_OFFSET (offset); + +bar2_writel (tegra, page,XUSB_BAR2_ARU_C11_CSBRANGE ); +bar2_writel (tegra, value,XUSB_BAR2_CSB_BASE_ADDR + ofs); +} +static int tegra_xusb_set_ss_clk (struct tegra_xusb *tegra,unsigned long rate) {
@@ -451,6 +538,7 @@ static bool tegra_xusb_mbox_cmd_requires_ack(enum tegra_xusb_mbox_cmd cmd)static int tegra_xusb_mbox_send (struct tegra_xusb *tegra,const struct tegra_xusb_mbox_msg *msg) { +const struct tegra_xusb_soc_ops *ops = tegra->soc->ops;bool wait_for_idle = false;u32 value;
@@ -459,15 +547,15 @@ static int tegra_xusb_mbox_send(struct tegra_xusb *tegra,* ACK/NAK messages. */ if (!(msg->cmd ==MBOX_CMD_ACK || msg->cmd ==MBOX_CMD_NAK )) { - value =fpci_readl (tegra, tegra->soc->mbox.owner); + value = ops->mbox_reg_readl (tegra, tegra->soc->mbox.owner);if (value !=MBOX_OWNER_NONE ) {dev_err (tegra->dev,"mailbox is busy\n" );return -EBUSY ; } -fpci_writel (tegra,MBOX_OWNER_SW , tegra->soc->mbox.owner); + ops->mbox_reg_writel (tegra,MBOX_OWNER_SW , tegra->soc->mbox.owner); - value =fpci_readl (tegra, tegra->soc->mbox.owner); + value = ops->mbox_reg_readl (tegra, tegra->soc->mbox.owner);if (value !=MBOX_OWNER_SW ) {dev_err (tegra->dev,"failed to acquire mailbox\n" );return -EBUSY ;
@@ -477,17 +565,17 @@ static int tegra_xusb_mbox_send(struct tegra_xusb *tegra, } value =tegra_xusb_mbox_pack (msg); -fpci_writel (tegra, value, tegra->soc->mbox.data_in); + ops->mbox_reg_writel (tegra, value, tegra->soc->mbox.data_in); - value =fpci_readl (tegra, tegra->soc->mbox.cmd); + value = ops->mbox_reg_readl (tegra, tegra->soc->mbox.cmd); value |=MBOX_INT_EN |MBOX_DEST_FALC ; -fpci_writel (tegra, value, tegra->soc->mbox.cmd); + ops->mbox_reg_writel (tegra, value, tegra->soc->mbox.cmd);if (wait_for_idle) {unsigned long timeout = jiffies +msecs_to_jiffies (250 );while (time_before (jiffies, timeout)) { - value =fpci_readl (tegra, tegra->soc->mbox.owner); + value = ops->mbox_reg_readl (tegra, tegra->soc->mbox.owner);if (value ==MBOX_OWNER_NONE )break ;
@@ -495,7 +583,7 @@ static int tegra_xusb_mbox_send(struct tegra_xusb *tegra, }if (time_after (jiffies, timeout)) - value =fpci_readl (tegra, tegra->soc->mbox.owner); + value = ops->mbox_reg_readl (tegra, tegra->soc->mbox.owner);if (value !=MBOX_OWNER_NONE )return -ETIMEDOUT ;
@@ -507,11 +595,12 @@ static int tegra_xusb_mbox_send(struct tegra_xusb *tegra,static irqreturn_t tegra_xusb_mbox_irq (int irq,void *data) {struct tegra_xusb *tegra = data; +const struct tegra_xusb_soc_ops *ops = tegra->soc->ops;u32 value;/* clear mailbox interrupts */ - value =fpci_readl (tegra,XUSB_CFG_ARU_SMI_INTR ); -fpci_writel (tegra, value,XUSB_CFG_ARU_SMI_INTR ); + value = ops->mbox_reg_readl (tegra, tegra->soc->mbox.smi_intr); + ops->mbox_reg_writel (tegra, value, tegra->soc->mbox.smi_intr);if (value &MBOX_SMI_INTR_FW_HANG )dev_err (tegra->dev,"controller firmware hang\n" );
@@ -664,6 +753,7 @@ static void tegra_xusb_mbox_handle(struct tegra_xusb *tegra,static irqreturn_t tegra_xusb_mbox_thread (int irq,void *data) {struct tegra_xusb *tegra = data; +const struct tegra_xusb_soc_ops *ops = tegra->soc->ops;struct tegra_xusb_mbox_msg msg;u32 value;
@@ -672,16 +762,16 @@ static irqreturn_t tegra_xusb_mbox_thread(int irq, void *data)if (pm_runtime_suspended (tegra->dev) || tegra->suspended) goto out; - value =fpci_readl (tegra, tegra->soc->mbox.data_out); + value = ops->mbox_reg_readl (tegra, tegra->soc->mbox.data_out);tegra_xusb_mbox_unpack (&msg, value); - value =fpci_readl (tegra, tegra->soc->mbox.cmd); + value = ops->mbox_reg_readl (tegra, tegra->soc->mbox.cmd); value &= ~MBOX_DEST_SMI ; -fpci_writel (tegra, value, tegra->soc->mbox.cmd); + ops->mbox_reg_writel (tegra, value, tegra->soc->mbox.cmd);/* clear mailbox owner if no ACK/NAK is required */ if (!tegra_xusb_mbox_cmd_requires_ack (msg.cmd)) -fpci_writel (tegra,MBOX_OWNER_NONE , tegra->soc->mbox.owner); + ops->mbox_reg_writel (tegra,MBOX_OWNER_NONE , tegra->soc->mbox.owner);tegra_xusb_mbox_handle (tegra, &msg);
@@ -709,6 +799,15 @@ static void tegra_xusb_config(struct tegra_xusb *tegra) value |= regs & (XUSB_BASE_ADDR_MASK <<XUSB_BASE_ADDR_SHIFT );fpci_writel (tegra, value,XUSB_CFG_4 ); +/* Program BAR2 space */ +if (tegra->bar2) { + value =fpci_readl (tegra,XUSB_CFG_7 ); + value &= ~(XUSB_BASE2_ADDR_MASK <<XUSB_BASE2_ADDR_SHIFT ); + value |= tegra->bar2->start & + (XUSB_BASE2_ADDR_MASK <<XUSB_BASE2_ADDR_SHIFT ); +fpci_writel (tegra, value,XUSB_CFG_7 ); + } +usleep_range (100 ,200 );/* Enable bus master */
@@ -881,21 +980,36 @@ static int tegra_xusb_request_firmware(struct tegra_xusb *tegra)return 0 ; } -static int tegra_xusb_load_firmware (struct tegra_xusb *tegra) +static int tegra_xusb_wait_for_falcon (struct tegra_xusb *tegra) +{ +struct xhci_cap_regs __iomem *cap_regs; +struct xhci_op_regs __iomem *op_regs; +int ret; +u32 value; + + cap_regs = tegra->regs; + op_regs = tegra->regs +HC_LENGTH (readl (&cap_regs->hc_capbase)); + + ret =readl_poll_timeout (&op_regs->status, value, !(value &STS_CNR ),1000 ,200000 ); + +if (ret) +dev_err (tegra->dev,"XHCI Controller not ready. Falcon state: 0x%x\n" , +csb_readl (tegra,XUSB_FALC_CPUCTL )); + +return ret; +} + +static int tegra_xusb_load_firmware_rom (struct tegra_xusb *tegra) {unsigned int code_tag_blocks, code_size_blocks, code_blocks; -struct xhci_cap_regs __iomem *cap = tegra->regs;struct tegra_xusb_fw_header *header;struct device *dev = tegra->dev; -struct xhci_op_regs __iomem *op; -unsigned long timeout;time64_t timestamp;u64 address;u32 value;int err; header = (struct tegra_xusb_fw_header *)tegra->fw.virt; - op = tegra->regs +HC_LENGTH (readl (&cap->hc_capbase));if (csb_readl (tegra,XUSB_CSB_MP_ILOAD_BASE_LO ) !=0 ) { dev_info(dev, "Firmware already loaded, Falcon state %#x\n",
@@ -968,30 +1082,55 @@ static int tegra_xusb_load_firmware(struct tegra_xusb *tegra)/* Boot Falcon CPU and wait for USBSTS_CNR to get cleared. */ csb_writel (tegra,CPUCTL_STARTCPU ,XUSB_FALC_CPUCTL ); - timeout = jiffies +msecs_to_jiffies (200 ); +if (tegra_xusb_wait_for_falcon (tegra)) +return -EIO ; + + timestamp =le32_to_cpu (header->fwimg_created_time); -do { - value =readl (&op->status); -if ((value &STS_CNR ) ==0 ) -break ; +dev_info (dev,"Firmware timestamp: %ptTs UTC\n" , ×tamp); + +return 0 ; +} + +static u32 tegra_xusb_read_firmware_header (struct tegra_xusb *tegra,u32 offset) +{ +/* +* We only accept reading the firmware config table +* The offset should not exceed the fw header structure +*/ +if (offset >=sizeof (struct tegra_xusb_fw_header )) +return 0 ; -usleep_range (1000 ,2000 ); - }while (time_is_after_jiffies (timeout)); +bar2_writel (tegra, (FW_IOCTL_CFGTBL_READ <<FW_IOCTL_TYPE_SHIFT ) | offset, +XUSB_BAR2_ARU_FW_SCRATCH ); +return bar2_readl (tegra,XUSB_BAR2_ARU_SMI_ARU_FW_SCRATCH_DATA0 ); +} + +static int tegra_xusb_init_ifr_firmware (struct tegra_xusb *tegra) +{ +time64_t timestamp; - value =readl (&op->status); -if (value &STS_CNR ) { - value =csb_readl (tegra,XUSB_FALC_CPUCTL ); -dev_err (dev,"XHCI controller not read: %#010x\n" , value); +if (tegra_xusb_wait_for_falcon (tegra))return -EIO ; - } - timestamp =le32_to_cpu (header->fwimg_created_time); +#define offsetof_32 (X ,Y ) ((u8)(offsetof(X, Y) / sizeof(__le32))) + timestamp =tegra_xusb_read_firmware_header (tegra, + offsetof_32(struct tegra_xusb_fw_header, + fwimg_created_time) <<2 ); -dev_info (dev,"Firmware timestamp: %ptTs UTC\n" , ×tamp); +dev_info (tegra->dev,"Firmware timestamp: %ptTs UTC\n" , ×tamp);return 0 ; } +static int tegra_xusb_load_firmware (struct tegra_xusb *tegra) +{ +if (!tegra->soc->firmware) +return tegra_xusb_init_ifr_firmware (tegra); +else +return tegra_xusb_load_firmware_rom (tegra); +} +static void tegra_xusb_powerdomain_remove (struct device *dev,struct tegra_xusb *tegra) {
@@ -1435,6 +1574,10 @@ static int tegra_xusb_probe(struct platform_device *pdev) tegra->ipfs_base =devm_platform_ioremap_resource (pdev,2 );if (IS_ERR (tegra->ipfs_base))return PTR_ERR (tegra->ipfs_base); + }else if (tegra->soc->has_bar2) { + tegra->bar2_base =devm_platform_get_and_ioremap_resource (pdev,2 , &tegra->bar2); +if (IS_ERR (tegra->bar2_base)) +return PTR_ERR (tegra->bar2_base); } tegra->xhci_irq =platform_get_irq (pdev,0 );
@@ -1651,10 +1794,13 @@ static int tegra_xusb_probe(struct platform_device *pdev) goto disable_phy; } - err =tegra_xusb_request_firmware (tegra); -if (err <0 ) { -dev_err (&pdev->dev,"failed to request firmware: %d\n" , err); - goto disable_phy; +if (tegra->soc->firmware) { + err =tegra_xusb_request_firmware (tegra); +if (err <0 ) { +dev_err (&pdev->dev, +"failed to request firmware: %d\n" , err); + goto disable_phy; + } } err =tegra_xusb_unpowergate_partitions (tegra);
@@ -2271,6 +2417,13 @@ static const struct tegra_xusb_context_soc tegra124_xusb_context = { }, }; +static const struct tegra_xusb_soc_ops tegra124_ops = { + .mbox_reg_readl = &fpci_readl, + .mbox_reg_writel = &fpci_writel, + .csb_reg_readl = &fpci_csb_readl, + .csb_reg_writel = &fpci_csb_writel, +}; +static const struct tegra_xusb_soc tegra124_soc = { .firmware ="nvidia/tegra124/xusb.bin" , .supply_names = tegra124_supply_names,
@@ -2286,11 +2439,13 @@ static const struct tegra_xusb_soc tegra124_soc = { .scale_ss_clock = true, .has_ipfs = true, .otg_reset_sspi = false, + .ops = &tegra124_ops, .mbox = { .cmd = 0xe4, .data_in = 0xe8, .data_out = 0xec, .owner = 0xf0, + .smi_intr = XUSB_CFG_ARU_SMI_INTR, }, };MODULE_FIRMWARE ("nvidia/tegra124/xusb.bin" );
@@ -2322,11 +2477,13 @@ static const struct tegra_xusb_soc tegra210_soc = { .scale_ss_clock = false, .has_ipfs = true, .otg_reset_sspi = true, + .ops = &tegra124_ops, .mbox = { .cmd = 0xe4, .data_in = 0xe8, .data_out = 0xec, .owner = 0xf0, + .smi_intr = XUSB_CFG_ARU_SMI_INTR, }, };MODULE_FIRMWARE ("nvidia/tegra210/xusb.bin" );
@@ -2363,11 +2520,13 @@ static const struct tegra_xusb_soc tegra186_soc = { .scale_ss_clock = false, .has_ipfs = false, .otg_reset_sspi = false, + .ops = &tegra124_ops, .mbox = { .cmd = 0xe4, .data_in = 0xe8, .data_out = 0xec, .owner = 0xf0, + .smi_intr = XUSB_CFG_ARU_SMI_INTR, }, .lpm_support = true, };
@@ -2394,21 +2553,56 @@ static const struct tegra_xusb_soc tegra194_soc = { .scale_ss_clock = false, .has_ipfs = false, .otg_reset_sspi = false, + .ops = &tegra124_ops, .mbox = { .cmd = 0x68, .data_in = 0x6c, .data_out = 0x70, .owner = 0x74, + .smi_intr = XUSB_CFG_ARU_SMI_INTR, }, .lpm_support = true, };MODULE_FIRMWARE ("nvidia/tegra194/xusb.bin" ); +static const struct tegra_xusb_soc_ops tegra234_ops = { + .mbox_reg_readl = &bar2_readl, + .mbox_reg_writel = &bar2_writel, + .csb_reg_readl = &bar2_csb_readl, + .csb_reg_writel = &bar2_csb_writel, +}; + +static const struct tegra_xusb_soc tegra234_soc = { + .supply_names = tegra194_supply_names, + .num_supplies =ARRAY_SIZE (tegra194_supply_names), + .phy_types = tegra194_phy_types, + .num_types =ARRAY_SIZE (tegra194_phy_types), + .context = &tegra186_xusb_context, + .ports = { + .usb3 = { .offset =0 , .count =4 , }, + .usb2 = { .offset =4 , .count =4 , }, + }, + .scale_ss_clock = false, + .has_ipfs = false, + .otg_reset_sspi = false, + .ops = &tegra234_ops, + .mbox = { + .cmd =XUSB_BAR2_ARU_MBOX_CMD , + .data_in =XUSB_BAR2_ARU_MBOX_DATA_IN , + .data_out =XUSB_BAR2_ARU_MBOX_DATA_OUT , + .owner =XUSB_BAR2_ARU_MBOX_OWNER , + .smi_intr =XUSB_BAR2_ARU_SMI_INTR , + }, + .lpm_support = true, + .has_bar2 = true, +}; +static const struct of_device_id tegra_xusb_of_match[] = { { .compatible ="nvidia,tegra124-xusb" , .data = &tegra124_soc }, { .compatible ="nvidia,tegra210-xusb" , .data = &tegra210_soc }, { .compatible ="nvidia,tegra186-xusb" , .data = &tegra186_soc }, { .compatible ="nvidia,tegra194-xusb" , .data = &tegra194_soc }, + { .compatible ="nvidia,tegra234-xusb" , .data = &tegra234_soc }, { }, };MODULE_DEVICE_TABLE (of, tegra_xusb_of_match);
Signature · 7 lines
2.25.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH v3 12/13] usb: host: xhci-tegra: Add Tegra234 XHCI support
Quoted 558 lines · Wayne Chang
From: Sing-Han Chen <[email protected]>
This change adds Tegra234 XUSB host mode controller support.
In Tegra234, some of the registers have moved to bar2 space. The new soc variable
has_bar2indicates the chip with bar2 area. This patch adds new reg helper to let the driver reuse the same code for those chips with bar2 support.Signed-off-by Sing-Han Chen <[email protected]>Co-developed-by Wayne Chang <[email protected]>Signed-off-by Wayne Chang <[email protected]>---
V2 -> V3:nothing has changed
V1 -> V2:fix some issues on coding style extracttegra_xusb_load_firmwarefunction refinehas_bar2and remove has_ifr/firmware on Tegra234drivers/usb/host/xhci-tegra.c | 270 +++++++++++++++++++++++++++++----- 1 file changed, 232 insertions(+), 38 deletions(-)drivers/usb/host/xhci-tegra.c +230
-38@@ -44,6 +44,9 @@#define XUSB_CFG_4 0x010#define XUSB_BASE_ADDR_SHIFT 15#define XUSB_BASE_ADDR_MASK 0x1ffff +#define XUSB_CFG_7 0x01c +#define XUSB_BASE2_ADDR_SHIFT 16 +#define XUSB_BASE2_ADDR_MASK 0xffff#define XUSB_CFG_16 0x040#define XUSB_CFG_24 0x060#define XUSB_CFG_AXI_CFG 0x0f8@@ -75,6 +78,20 @@#define MBOX_SMI_INTR_FW_HANG BIT(1)#define MBOX_SMI_INTR_EN BIT(3) +/* BAR2 registers */ +#define XUSB_BAR2_ARU_MBOX_CMD 0x004 +#define XUSB_BAR2_ARU_MBOX_DATA_IN 0x008 +#define XUSB_BAR2_ARU_MBOX_DATA_OUT 0x00c +#define XUSB_BAR2_ARU_MBOX_OWNER 0x010 +#define XUSB_BAR2_ARU_SMI_INTR 0x014 +#define XUSB_BAR2_ARU_SMI_ARU_FW_SCRATCH_DATA0 0x01c +#define XUSB_BAR2_ARU_IFRDMA_CFG0 0x0e0 +#define XUSB_BAR2_ARU_IFRDMA_CFG1 0x0e4 +#define XUSB_BAR2_ARU_IFRDMA_STREAMID_FIELD 0x0e8 +#define XUSB_BAR2_ARU_C11_CSBRANGE 0x9c +#define XUSB_BAR2_ARU_FW_SCRATCH 0x1000 +#define XUSB_BAR2_CSB_BASE_ADDR 0x2000 +/* IPFS registers */ #define IPFS_XUSB_HOST_MSI_BAR_SZ_0 0x0c0#define IPFS_XUSB_HOST_MSI_AXI_BAR_ST_0 0x0c4@@ -111,6 +128,9 @@#define IMFILLRNG1_TAG_HI_SHIFT 16#define XUSB_FALC_IMFILLCTL 0x158 +/* CSB ARU registers */ +#define XUSB_CSB_ARU_SCRATCH0 0x100100 +/* MP CSB registers */ #define XUSB_CSB_MP_ILOAD_ATTR 0x101a00#define XUSB_CSB_MP_ILOAD_BASE_LO 0x101a04@@ -131,6 +151,9 @@#define IMEM_BLOCK_SIZE 256 +#define FW_IOCTL_TYPE_SHIFT 24 +#define FW_IOCTL_CFGTBL_READ 17 +struct tegra_xusb_fw_header {__le32 boot_loadaddr_in_imem;__le32 boot_codedfi_offset;@@ -175,6 +198,7 @@ struct tegra_xusb_mbox_regs {u16 data_in;u16 data_out;u16 owner; +u16 smi_intr; };struct tegra_xusb_context_soc {@@ -189,6 +213,18 @@ struct tegra_xusb_context_soc { } fpci; }; +struct tegra_xusb ; +struct tegra_xusb_soc_ops { +u32 (*mbox_reg_readl)(struct tegra_xusb *tegra, +unsigned int offset); +void (*mbox_reg_writel)(struct tegra_xusb *tegra, +u32 value,unsigned int offset); +u32 (*csb_reg_readl)(struct tegra_xusb *tegra, +unsigned int offset); +void (*csb_reg_writel)(struct tegra_xusb *tegra, +u32 value,unsigned int offset); +}; +struct tegra_xusb_soc {const char *firmware;const char *const *supply_names;@@ -205,11 +241,14 @@ struct tegra_xusb_soc { } ports;struct tegra_xusb_mbox_regs mbox; +const struct tegra_xusb_soc_ops *ops;bool scale_ss_clock;bool has_ipfs;bool lpm_support;bool otg_reset_sspi; + +bool has_bar2; };struct tegra_xusb_context {@@ -230,6 +269,8 @@ struct tegra_xusb {void __iomem *ipfs_base;void __iomem *fpci_base; +void __iomem *bar2_base; +struct resource *bar2;const struct tegra_xusb_soc *soc;@@ -300,7 +341,33 @@ static inline void ipfs_writel(struct tegra_xusb *tegra, u32 value,writel (value, tegra->ipfs_base + offset); } +static inline u32 bar2_readl (struct tegra_xusb *tegra,unsigned int offset) +{ +return readl (tegra->bar2_base + offset); +} + +static inline void bar2_writel (struct tegra_xusb *tegra,u32 value, +unsigned int offset) +{ +writel (value, tegra->bar2_base + offset); +} +static u32 csb_readl (struct tegra_xusb *tegra,unsigned int offset) +{ +const struct tegra_xusb_soc_ops *ops = tegra->soc->ops; + +return ops->csb_reg_readl (tegra, offset); +} + +static void csb_writel (struct tegra_xusb *tegra,u32 value, +unsigned int offset) +{ +const struct tegra_xusb_soc_ops *ops = tegra->soc->ops; + + ops->csb_reg_writel (tegra, value, offset); +} + +static u32 fpci_csb_readl (struct tegra_xusb *tegra,unsigned int offset) {u32 page =CSB_PAGE_SELECT (offset);u32 ofs =CSB_PAGE_OFFSET (offset);@@ -310,7 +377,7 @@ static u32 csb_readl(struct tegra_xusb *tegra, unsigned int offset)return fpci_readl (tegra,XUSB_CFG_CSB_BASE_ADDR + ofs); } -static void csb_writel (struct tegra_xusb *tegra,u32 value, +static void fpci_csb_writel (struct tegra_xusb *tegra,u32 value,unsigned int offset) {u32 page =CSB_PAGE_SELECT (offset);@@ -320,6 +387,26 @@ static void csb_writel(struct tegra_xusb *tegra, u32 value,fpci_writel (tegra, value,XUSB_CFG_CSB_BASE_ADDR + ofs); } +static u32 bar2_csb_readl (struct tegra_xusb *tegra,unsigned int offset) +{ +u32 page =CSB_PAGE_SELECT (offset); +u32 ofs =CSB_PAGE_OFFSET (offset); + +bar2_writel (tegra, page,XUSB_BAR2_ARU_C11_CSBRANGE ); + +return bar2_readl (tegra,XUSB_BAR2_CSB_BASE_ADDR + ofs); +} + +static void bar2_csb_writel (struct tegra_xusb *tegra,u32 value, +unsigned int offset) +{ +u32 page =CSB_PAGE_SELECT (offset); +u32 ofs =CSB_PAGE_OFFSET (offset); + +bar2_writel (tegra, page,XUSB_BAR2_ARU_C11_CSBRANGE ); +bar2_writel (tegra, value,XUSB_BAR2_CSB_BASE_ADDR + ofs); +} +static int tegra_xusb_set_ss_clk (struct tegra_xusb *tegra,unsigned long rate) {@@ -451,6 +538,7 @@ static bool tegra_xusb_mbox_cmd_requires_ack(enum tegra_xusb_mbox_cmd cmd)static int tegra_xusb_mbox_send (struct tegra_xusb *tegra,const struct tegra_xusb_mbox_msg *msg) { +const struct tegra_xusb_soc_ops *ops = tegra->soc->ops;bool wait_for_idle = false;u32 value;@@ -459,15 +547,15 @@ static int tegra_xusb_mbox_send(struct tegra_xusb *tegra,* ACK/NAK messages. */ if (!(msg->cmd ==MBOX_CMD_ACK || msg->cmd ==MBOX_CMD_NAK )) { - value =fpci_readl (tegra, tegra->soc->mbox.owner); + value = ops->mbox_reg_readl (tegra, tegra->soc->mbox.owner);if (value !=MBOX_OWNER_NONE ) {dev_err (tegra->dev,"mailbox is busy\n" );return -EBUSY ; } -fpci_writel (tegra,MBOX_OWNER_SW , tegra->soc->mbox.owner); + ops->mbox_reg_writel (tegra,MBOX_OWNER_SW , tegra->soc->mbox.owner); - value =fpci_readl (tegra, tegra->soc->mbox.owner); + value = ops->mbox_reg_readl (tegra, tegra->soc->mbox.owner);if (value !=MBOX_OWNER_SW ) {dev_err (tegra->dev,"failed to acquire mailbox\n" );return -EBUSY ;@@ -477,17 +565,17 @@ static int tegra_xusb_mbox_send(struct tegra_xusb *tegra, } value =tegra_xusb_mbox_pack (msg); -fpci_writel (tegra, value, tegra->soc->mbox.data_in); + ops->mbox_reg_writel (tegra, value, tegra->soc->mbox.data_in); - value =fpci_readl (tegra, tegra->soc->mbox.cmd); + value = ops->mbox_reg_readl (tegra, tegra->soc->mbox.cmd); value |=MBOX_INT_EN |MBOX_DEST_FALC ; -fpci_writel (tegra, value, tegra->soc->mbox.cmd); + ops->mbox_reg_writel (tegra, value, tegra->soc->mbox.cmd);if (wait_for_idle) {unsigned long timeout = jiffies +msecs_to_jiffies (250 );while (time_before (jiffies, timeout)) { - value =fpci_readl (tegra, tegra->soc->mbox.owner); + value = ops->mbox_reg_readl (tegra, tegra->soc->mbox.owner);if (value ==MBOX_OWNER_NONE )break ;@@ -495,7 +583,7 @@ static int tegra_xusb_mbox_send(struct tegra_xusb *tegra, }if (time_after (jiffies, timeout)) - value =fpci_readl (tegra, tegra->soc->mbox.owner); + value = ops->mbox_reg_readl (tegra, tegra->soc->mbox.owner);if (value !=MBOX_OWNER_NONE )return -ETIMEDOUT ;@@ -507,11 +595,12 @@ static int tegra_xusb_mbox_send(struct tegra_xusb *tegra,static irqreturn_t tegra_xusb_mbox_irq (int irq,void *data) {struct tegra_xusb *tegra = data; +const struct tegra_xusb_soc_ops *ops = tegra->soc->ops;u32 value;/* clear mailbox interrupts */ - value =fpci_readl (tegra,XUSB_CFG_ARU_SMI_INTR ); -fpci_writel (tegra, value,XUSB_CFG_ARU_SMI_INTR ); + value = ops->mbox_reg_readl (tegra, tegra->soc->mbox.smi_intr); + ops->mbox_reg_writel (tegra, value, tegra->soc->mbox.smi_intr);if (value &MBOX_SMI_INTR_FW_HANG )dev_err (tegra->dev,"controller firmware hang\n" );@@ -664,6 +753,7 @@ static void tegra_xusb_mbox_handle(struct tegra_xusb *tegra,static irqreturn_t tegra_xusb_mbox_thread (int irq,void *data) {struct tegra_xusb *tegra = data; +const struct tegra_xusb_soc_ops *ops = tegra->soc->ops;struct tegra_xusb_mbox_msg msg;u32 value;@@ -672,16 +762,16 @@ static irqreturn_t tegra_xusb_mbox_thread(int irq, void *data)if (pm_runtime_suspended (tegra->dev) || tegra->suspended) goto out; - value =fpci_readl (tegra, tegra->soc->mbox.data_out); + value = ops->mbox_reg_readl (tegra, tegra->soc->mbox.data_out);tegra_xusb_mbox_unpack (&msg, value); - value =fpci_readl (tegra, tegra->soc->mbox.cmd); + value = ops->mbox_reg_readl (tegra, tegra->soc->mbox.cmd); value &= ~MBOX_DEST_SMI ; -fpci_writel (tegra, value, tegra->soc->mbox.cmd); + ops->mbox_reg_writel (tegra, value, tegra->soc->mbox.cmd);/* clear mailbox owner if no ACK/NAK is required */ if (!tegra_xusb_mbox_cmd_requires_ack (msg.cmd)) -fpci_writel (tegra,MBOX_OWNER_NONE , tegra->soc->mbox.owner); + ops->mbox_reg_writel (tegra,MBOX_OWNER_NONE , tegra->soc->mbox.owner);tegra_xusb_mbox_handle (tegra, &msg);@@ -709,6 +799,15 @@ static void tegra_xusb_config(struct tegra_xusb *tegra) value |= regs & (XUSB_BASE_ADDR_MASK <<XUSB_BASE_ADDR_SHIFT );fpci_writel (tegra, value,XUSB_CFG_4 ); +/* Program BAR2 space */ +if (tegra->bar2) { + value =fpci_readl (tegra,XUSB_CFG_7 ); + value &= ~(XUSB_BASE2_ADDR_MASK <<XUSB_BASE2_ADDR_SHIFT ); + value |= tegra->bar2->start & + (XUSB_BASE2_ADDR_MASK <<XUSB_BASE2_ADDR_SHIFT ); +fpci_writel (tegra, value,XUSB_CFG_7 ); + } +usleep_range (100 ,200 );/* Enable bus master */ @@ -881,21 +980,36 @@ static int tegra_xusb_request_firmware(struct tegra_xusb *tegra)return 0 ; } -static int tegra_xusb_load_firmware (struct tegra_xusb *tegra) +static int tegra_xusb_wait_for_falcon (struct tegra_xusb *tegra) +{ +struct xhci_cap_regs __iomem *cap_regs; +struct xhci_op_regs __iomem *op_regs; +int ret; +u32 value; + + cap_regs = tegra->regs; + op_regs = tegra->regs +HC_LENGTH (readl (&cap_regs->hc_capbase)); + + ret =readl_poll_timeout (&op_regs->status, value, !(value &STS_CNR ),1000 ,200000 ); + +if (ret) +dev_err (tegra->dev,"XHCI Controller not ready. Falcon state: 0x%x\n" , +csb_readl (tegra,XUSB_FALC_CPUCTL )); + +return ret; +} + +static int tegra_xusb_load_firmware_rom (struct tegra_xusb *tegra) {unsigned int code_tag_blocks, code_size_blocks, code_blocks; -struct xhci_cap_regs __iomem *cap = tegra->regs;struct tegra_xusb_fw_header *header;struct device *dev = tegra->dev; -struct xhci_op_regs __iomem *op; -unsigned long timeout;time64_t timestamp;u64 address;u32 value;int err; header = (struct tegra_xusb_fw_header *)tegra->fw.virt; - op = tegra->regs +HC_LENGTH (readl (&cap->hc_capbase));if (csb_readl (tegra,XUSB_CSB_MP_ILOAD_BASE_LO ) !=0 ) { dev_info(dev, "Firmware already loaded, Falcon state %#x\n",@@ -968,30 +1082,55 @@ static int tegra_xusb_load_firmware(struct tegra_xusb *tegra)/* Boot Falcon CPU and wait for USBSTS_CNR to get cleared. */ csb_writel (tegra,CPUCTL_STARTCPU ,XUSB_FALC_CPUCTL ); - timeout = jiffies +msecs_to_jiffies (200 ); +if (tegra_xusb_wait_for_falcon (tegra)) +return -EIO ; + + timestamp =le32_to_cpu (header->fwimg_created_time); -do { - value =readl (&op->status); -if ((value &STS_CNR ) ==0 ) -break ; +dev_info (dev,"Firmware timestamp: %ptTs UTC\n" , ×tamp); + +return 0 ; +} + +static u32 tegra_xusb_read_firmware_header (struct tegra_xusb *tegra,u32 offset) +{ +/* +* We only accept reading the firmware config table +* The offset should not exceed the fw header structure +*/ +if (offset >=sizeof (struct tegra_xusb_fw_header )) +return 0 ; -usleep_range (1000 ,2000 ); - }while (time_is_after_jiffies (timeout)); +bar2_writel (tegra, (FW_IOCTL_CFGTBL_READ <<FW_IOCTL_TYPE_SHIFT ) | offset, +XUSB_BAR2_ARU_FW_SCRATCH ); +return bar2_readl (tegra,XUSB_BAR2_ARU_SMI_ARU_FW_SCRATCH_DATA0 ); +} + +static int tegra_xusb_init_ifr_firmware (struct tegra_xusb *tegra) +{ +time64_t timestamp; - value =readl (&op->status); -if (value &STS_CNR ) { - value =csb_readl (tegra,XUSB_FALC_CPUCTL ); -dev_err (dev,"XHCI controller not read: %#010x\n" , value); +if (tegra_xusb_wait_for_falcon (tegra))return -EIO ; - } - timestamp =le32_to_cpu (header->fwimg_created_time); +#define offsetof_32 (X ,Y ) ((u8)(offsetof(X, Y) / sizeof(__le32))) + timestamp =tegra_xusb_read_firmware_header (tegra, + offsetof_32(struct tegra_xusb_fw_header, + fwimg_created_time) <<2 ); -dev_info (dev,"Firmware timestamp: %ptTs UTC\n" , ×tamp); +dev_info (tegra->dev,"Firmware timestamp: %ptTs UTC\n" , ×tamp);return 0 ; } +static int tegra_xusb_load_firmware (struct tegra_xusb *tegra) +{ +if (!tegra->soc->firmware) +return tegra_xusb_init_ifr_firmware (tegra); +else +return tegra_xusb_load_firmware_rom (tegra); +} +static void tegra_xusb_powerdomain_remove (struct device *dev,struct tegra_xusb *tegra) {@@ -1435,6 +1574,10 @@ static int tegra_xusb_probe(struct platform_device *pdev) tegra->ipfs_base =devm_platform_ioremap_resource (pdev,2 );if (IS_ERR (tegra->ipfs_base))return PTR_ERR (tegra->ipfs_base); + }else if (tegra->soc->has_bar2) { + tegra->bar2_base =devm_platform_get_and_ioremap_resource (pdev,2 , &tegra->bar2); +if (IS_ERR (tegra->bar2_base)) +return PTR_ERR (tegra->bar2_base); } tegra->xhci_irq =platform_get_irq (pdev,0 );@@ -1651,10 +1794,13 @@ static int tegra_xusb_probe(struct platform_device *pdev) goto disable_phy; } - err =tegra_xusb_request_firmware (tegra); -if (err <0 ) { -dev_err (&pdev->dev,"failed to request firmware: %d\n" , err); - goto disable_phy; +if (tegra->soc->firmware) { + err =tegra_xusb_request_firmware (tegra); +if (err <0 ) { +dev_err (&pdev->dev, +"failed to request firmware: %d\n" , err); + goto disable_phy; + } } err =tegra_xusb_unpowergate_partitions (tegra);@@ -2271,6 +2417,13 @@ static const struct tegra_xusb_context_soc tegra124_xusb_context = { }, }; +static const struct tegra_xusb_soc_ops tegra124_ops = { + .mbox_reg_readl = &fpci_readl, + .mbox_reg_writel = &fpci_writel, + .csb_reg_readl = &fpci_csb_readl, + .csb_reg_writel = &fpci_csb_writel, +}; +static const struct tegra_xusb_soc tegra124_soc = { .firmware ="nvidia/tegra124/xusb.bin" , .supply_names = tegra124_supply_names,@@ -2286,11 +2439,13 @@ static const struct tegra_xusb_soc tegra124_soc = { .scale_ss_clock = true, .has_ipfs = true, .otg_reset_sspi = false, + .ops = &tegra124_ops, .mbox = { .cmd = 0xe4, .data_in = 0xe8, .data_out = 0xec, .owner = 0xf0, + .smi_intr = XUSB_CFG_ARU_SMI_INTR, }, };MODULE_FIRMWARE ("nvidia/tegra124/xusb.bin" );@@ -2322,11 +2477,13 @@ static const struct tegra_xusb_soc tegra210_soc = { .scale_ss_clock = false, .has_ipfs = true, .otg_reset_sspi = true, + .ops = &tegra124_ops, .mbox = { .cmd = 0xe4, .data_in = 0xe8, .data_out = 0xec, .owner = 0xf0, + .smi_intr = XUSB_CFG_ARU_SMI_INTR, }, };MODULE_FIRMWARE ("nvidia/tegra210/xusb.bin" );@@ -2363,11 +2520,13 @@ static const struct tegra_xusb_soc tegra186_soc = { .scale_ss_clock = false, .has_ipfs = false, .otg_reset_sspi = false, + .ops = &tegra124_ops, .mbox = { .cmd = 0xe4, .data_in = 0xe8, .data_out = 0xec, .owner = 0xf0, + .smi_intr = XUSB_CFG_ARU_SMI_INTR, }, .lpm_support = true, };@@ -2394,21 +2553,56 @@ static const struct tegra_xusb_soc tegra194_soc = { .scale_ss_clock = false, .has_ipfs = false, .otg_reset_sspi = false, + .ops = &tegra124_ops, .mbox = { .cmd = 0x68, .data_in = 0x6c, .data_out = 0x70, .owner = 0x74, + .smi_intr = XUSB_CFG_ARU_SMI_INTR, }, .lpm_support = true, };MODULE_FIRMWARE ("nvidia/tegra194/xusb.bin" ); +static const struct tegra_xusb_soc_ops tegra234_ops = { + .mbox_reg_readl = &bar2_readl, + .mbox_reg_writel = &bar2_writel, + .csb_reg_readl = &bar2_csb_readl, + .csb_reg_writel = &bar2_csb_writel, +}; + +static const struct tegra_xusb_soc tegra234_soc = { + .supply_names = tegra194_supply_names, + .num_supplies =ARRAY_SIZE (tegra194_supply_names), + .phy_types = tegra194_phy_types, + .num_types =ARRAY_SIZE (tegra194_phy_types), + .context = &tegra186_xusb_context, + .ports = { + .usb3 = { .offset =0 , .count =4 , }, + .usb2 = { .offset =4 , .count =4 , }, + }, + .scale_ss_clock = false, + .has_ipfs = false, + .otg_reset_sspi = false, + .ops = &tegra234_ops, + .mbox = { + .cmd =XUSB_BAR2_ARU_MBOX_CMD , + .data_in =XUSB_BAR2_ARU_MBOX_DATA_IN , + .data_out =XUSB_BAR2_ARU_MBOX_DATA_OUT , + .owner =XUSB_BAR2_ARU_MBOX_OWNER , + .smi_intr =XUSB_BAR2_ARU_SMI_INTR , + }, + .lpm_support = true, + .has_bar2 = true, +};
drivers/usb/host/xhci-tegra.c static const struct tegra_xusb_soc tegra194_soc = { · line 2608
Quoted 10 lines
drivers/usb/host/xhci-tegra.c +2
-0+static const struct of_device_id tegra_xusb_of_match[] = { { .compatible ="nvidia,tegra124-xusb" , .data = &tegra124_soc }, { .compatible ="nvidia,tegra210-xusb" , .data = &tegra210_soc }, { .compatible ="nvidia,tegra186-xusb" , .data = &tegra186_soc }, { .compatible ="nvidia,tegra194-xusb" , .data = &tegra194_soc }, + { .compatible ="nvidia,tegra234-xusb" , .data = &tegra234_soc }, { }, };MODULE_DEVICE_TABLE (of, tegra_xusb_of_match);
Thanks
Jon
Signature · 1 line
nvpublic
PATCH v3 13/13 usb: gadget: tegra-xudc: Add Tegra234 support
In reply to Wayne ChangFrom: Sing-Han Chen <[email protected]>
This commit adds support for XUSB device mode controller support on Tegra234 SoC. This is very similar to the existing Tegra194 XUDC.
---
V2 -> V3:nothing has changed
V1 -> V2:nothing has changed
drivers/usb/gadget/udc/tegra-xudc.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/usb/gadget/udc/tegra-xudc.c +17 -0
@@ -3660,6 +3660,19 @@ static struct tegra_xudc_soc tegra194_xudc_soc_data = { .has_ipfs = false, }; +static struct tegra_xudc_soc tegra234_xudc_soc_data = { + .clock_names = tegra186_xudc_clock_names, + .num_clks =ARRAY_SIZE (tegra186_xudc_clock_names), + .num_phys =4 , + .u1_enable = true, + .u2_enable = true, + .lpm_enable = true, + .invalid_seq_num = false, + .pls_quirk = false, + .port_reset_quirk = false, + .has_ipfs = false, +}; +static const struct of_device_id tegra_xudc_of_match[] = { { .compatible ="nvidia,tegra210-xudc" ,
@@ -3673,6 +3686,10 @@ static const struct of_device_id tegra_xudc_of_match[] = { .compatible = "nvidia,tegra194-xudc", .data = &tegra194_xudc_soc_data }, + { + .compatible = "nvidia,tegra234-xudc", + .data = &tegra234_xudc_soc_data + }, { } };MODULE_DEVICE_TABLE (of, tegra_xudc_of_match);
Signature · 7 lines
2.25.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH v3 13/13] usb: gadget: tegra-xudc: Add Tegra234 support
Quoted 38 lines · Wayne Chang
From: Sing-Han Chen <[email protected]>
This commit adds support for XUSB device mode controller support on Tegra234 SoC. This is very similar to the existing Tegra194 XUDC.
Signed-off-by Sing-Han Chen <[email protected]>Signed-off-by Wayne Chang <[email protected]>---
V2 -> V3:nothing has changed
V1 -> V2:nothing has changeddrivers/usb/gadget/udc/tegra-xudc.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)drivers/usb/gadget/udc/tegra-xudc.c +13
-0@@ -3660,6 +3660,19 @@ static struct tegra_xudc_soc tegra194_xudc_soc_data = { .has_ipfs = false, }; +static struct tegra_xudc_soc tegra234_xudc_soc_data = { + .clock_names = tegra186_xudc_clock_names, + .num_clks =ARRAY_SIZE (tegra186_xudc_clock_names), + .num_phys =4 , + .u1_enable = true, + .u2_enable = true, + .lpm_enable = true, + .invalid_seq_num = false, + .pls_quirk = false, + .port_reset_quirk = false, + .has_ipfs = false, +}; +static const struct of_device_id tegra_xudc_of_match[] = { { .compatible ="nvidia,tegra210-xudc" ,
drivers/usb/gadget/udc/tegra-xudc.c static const struct of_device_id tegra_xudc_of_match[] = { · line 3695
Quoted 10 lines
drivers/usb/gadget/udc/tegra-xudc.c +4
-0@@ -3673,6 +3686,10 @@ static const struct of_device_id tegra_xudc_of_match[] = { .compatible = "nvidia,tegra194-xudc", .data = &tegra194_xudc_soc_data }, + { + .compatible = "nvidia,tegra234-xudc", + .data = &tegra234_xudc_soc_data + }, { } };MODULE_DEVICE_TABLE (of, tegra_xudc_of_match);
Thanks
Jon
Signature · 6 lines
nvpublic -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Jon Hunter
maintainerQuoted 3 lines · Wayne Chang
The patch series enable the USB host and devie functions on Jetson AGX Orin and depend on the following change
https://lore.kernel.org/all/[email protected]/
I have been talking to Wayne about this series and for now we want to see if we can get the USB host support merged. Then we will work on the USB device support next. I have sent out the USB host patches on Wayne's behalf.
Jon
Signature · 1 line
nvpublic