enable usb support on rk356x
Subsystems (4)
v2 cover enable usb support on rk356x
Good Morning,
This is my patch series that I have maintained out of tree until the combophy driver landed.
Patch 1 fixes the grf dt binding from the combophy merge. Patches 2 and 3 add the dt bindings for the grf changes necessary for this series.
Patch 4 adds support to the grf driver to set the rk3566 otg clock source.
Patch 5 is a downstream patch ported forward to shut down the usb3 clock when the controller is operating in usb2 mode.
Patches 6, 7, and 8 clean up the dwc3-of-simple driver, allow the use of of-match-data, and add the compatible for the rk3568.
Patch 9 adds the dwc3 nodes to the rk356x device tree includes. Patch 10 enables the dwc3 nodes on the Quartz64 Model A. Patch 11 enables the dwc3 nodes on the rk3568-evb.
Please review and apply.
Very Respectfully,
Peter Geis
Changelog:
v2:
- Add a dt-bindings fix for grf.yaml
- Unify the reset names.
- Constrain the force usb2 clock dwc3 patch to only supported variants of the ip.
- Change dwc3-of-simple to support of-match-data.
- Drop the PCLK-PIPE clk.
- Rename the usb nodes to be more friendly.
- Add the rk3568-evb enable patch.
Bin Yang (1):
usb: dwc3: core: do not use 3.0 clock when operating in 2.0 mode
Michael Riesch (1):
arm64: dts: rockchip: add usb3 support to rk3568-evb1-v10
Peter Geis (9):
dt-bindings: soc: grf: fix rk3568 usb definitions
dt-bindings: soc: grf: add rk3566-pipe-grf compatible
dt-bindings: usb: dwc3: add description for rk3568
soc: rockchip: set dwc3 clock for rk3566
usb: dwc3: reorder dwc-of-simple compatibles
usb: dwc3: convert dwc3-of-simple to use match-data
usb: dwc3: add rk3568 dwc3 support
arm64: dts: rockchip: add rk356x dwc3 usb3 nodes
arm64: dts: rockchip: enable dwc3 on quartz64-a
.../devicetree/bindings/soc/rockchip/grf.yaml | 5 +- .../bindings/usb/rockchip,dwc3.yaml | 2 + .../boot/dts/rockchip/rk3566-quartz64-a.dts | 37 +++++++++++++++ arch/arm64/boot/dts/rockchip/rk3566.dtsi | 12 +++++ .../boot/dts/rockchip/rk3568-evb1-v10.dts | 46 +++++++++++++++++++ arch/arm64/boot/dts/rockchip/rk3568.dtsi | 9 ++++ arch/arm64/boot/dts/rockchip/rk356x.dtsi | 45 +++++++++++++++++- drivers/soc/rockchip/grf.c | 17 +++++++ drivers/usb/dwc3/core.c | 5 ++ drivers/usb/dwc3/core.h | 1 + drivers/usb/dwc3/dwc3-of-simple.c | 43 +++++++++++++---- 11 files changed, 210 insertions(+), 12 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/11 dt-bindings: soc: grf: fix rk3568 usb definitions
The rockchip,rk3568-pipe-grf and rockchip,rk3568-pipe-phy-grf compatibles were incorrectly assigned to the syscon, simple-mfd enumeration, vice only the syscon enumeration.
This leads a dtbs_check failure.
Move these to the syscon enumeration.
--- Documentation/devicetree/bindings/soc/rockchip/grf.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/soc/rockchip/grf.yaml +2 -2
@@ -15,6 +15,8 @@ properties: - items: - enum: - rockchip,rk3288-sgrf + - rockchip,rk3568-pipe-grf + - rockchip,rk3568-pipe-phy-grf - rockchip,rk3568-usb2phy-grf - rockchip,rv1108-usbgrf - const: syscon
@@ -39,8 +41,6 @@ properties: - rockchip,rk3399-grf - rockchip,rk3399-pmugrf - rockchip,rk3568-grf - - rockchip,rk3568-pipe-grf - - rockchip,rk3568-pipe-phy-grf - rockchip,rk3568-pmugrf - rockchip,rv1108-grf - rockchip,rv1108-pmugrf
Signature · 1 line
2.25.1
PATCH v2 2/11 dt-bindings: soc: grf: add rk3566-pipe-grf compatible
In reply to Peter GeisThe rk3566 requires special handling for the dwc3-otg clock in order for the port to function correctly.
Add a binding for the rk3566-pipe-grf so we can handle setup with the grf driver.
--- Documentation/devicetree/bindings/soc/rockchip/grf.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/soc/rockchip/grf.yaml +1 -0
@@ -15,6 +15,7 @@ properties: - items: - enum: - rockchip,rk3288-sgrf + - rockchip,rk3566-pipe-grf - rockchip,rk3568-pipe-grf - rockchip,rk3568-pipe-phy-grf - rockchip,rk3568-usb2phy-grf
Signature · 1 line
2.25.1
PATCH v2 3/11 dt-bindings: usb: dwc3: add description for rk3568
In reply to Peter GeisThe rk3568 dwc3 controllers are backwards compatible with the rk3399. Add the device tree description for it.
--- Documentation/devicetree/bindings/usb/rockchip,dwc3.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/usb/rockchip,dwc3.yaml +2 -0
@@ -30,6 +30,7 @@ select: enum: - rockchip,rk3328-dwc3 - rockchip,rk3399-dwc3 + - rockchip,rk3568-dwc3 required: - compatible
@@ -39,6 +40,7 @@ properties: - enum: - rockchip,rk3328-dwc3 - rockchip,rk3399-dwc3 + - rockchip,rk3568-dwc3 - const: snps,dwc3 reg:
Signature · 1 line
2.25.1
Re: [PATCH v2 03/11] dt-bindings: usb: dwc3: add description for rk3568
Quoted 8 lines · Peter Geis
The rk3568 dwc3 controllers are backwards compatible with the rk3399. Add the device tree description for it.
Signed-off-by Peter Geis <[email protected]>--- Documentation/devicetree/bindings/usb/rockchip,dwc3.yaml | 2 ++ 1 file changed, 2 insertions(+)
PATCH v2 4/11 soc: rockchip: set dwc3 clock for rk3566
In reply to Peter GeisThe rk3566 dwc3 otg port clock is unavailable at boot, as it defaults to the combophy as the clock source. As combophy0 doesn't exist on rk3566, we need to set the clock source to the usb2 phy instead.
Add handling to the grf driver to handle this on boot.
--- drivers/soc/rockchip/grf.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/soc/rockchip/grf.c +17 -0
@@ -108,6 +108,20 @@ static const struct rockchip_grf_info rk3399_grf __initconst = { .num_values = ARRAY_SIZE(rk3399_defaults), }; +#define RK3566_GRF_USB3OTG0_CON1 0x0104 + +static const struct rockchip_grf_value rk3566_defaults[]__initconst = { + {"usb3otg port switch" ,RK3566_GRF_USB3OTG0_CON1 ,HIWORD_UPDATE (0 ,1 ,12 ) }, + {"usb3otg clock switch" ,RK3566_GRF_USB3OTG0_CON1 ,HIWORD_UPDATE (1 ,1 ,7 ) }, + {"usb3otg disable usb3" ,RK3566_GRF_USB3OTG0_CON1 ,HIWORD_UPDATE (1 ,1 ,0 ) }, +}; + +static const struct rockchip_grf_info rk3566_pipegrf__initconst = { + .values = rk3566_defaults, + .num_values =ARRAY_SIZE (rk3566_defaults), +}; + +static const struct of_device_id rockchip_grf_dt_match[]__initconst = { { .compatible ="rockchip,rk3036-grf" ,
@@ -130,6 +144,9 @@ static const struct of_device_id rockchip_grf_dt_match[] __initconst = { }, { .compatible = "rockchip,rk3399-grf", .data = (void *)&rk3399_grf, + }, { + .compatible = "rockchip,rk3566-pipe-grf", + .data = (void *)&rk3566_pipegrf, }, { /* sentinel */ }, };
Signature · 1 line
2.25.1
PATCH v2 5/11 usb: dwc3: core: do not use 3.0 clock when operating in 2.0 mode
In reply to Peter GeisFrom: Bin Yang <[email protected]>
In the 3.0 device core, if the core is programmed to operate in 2.0 only, then setting the GUCTL1.DEV_FORCE_20_CLK_FOR_30_CLK makes the internal 2.0(utmi/ulpi) clock to be routed as the 3.0 (pipe) clock. Enabling this feature allows the pipe3 clock to be not-running when forcibly operating in 2.0 device mode.
--- drivers/usb/dwc3/core.c | 5 +++++ drivers/usb/dwc3/core.h | 1 + 2 files changed, 6 insertions(+)
drivers/usb/dwc3/core.c +5 -0
@@ -1167,6 +1167,11 @@ static int dwc3_core_init(struct dwc3 *dwc)if (dwc->parkmode_disable_ss_quirk) reg |=DWC3_GUCTL1_PARKMODE_DISABLE_SS ; + if (DWC3_VER_IS_WITHIN(DWC3, 290A, ANY) && + (dwc->maximum_speed ==USB_SPEED_HIGH || + dwc->maximum_speed ==USB_SPEED_FULL )) + reg |=DWC3_GUCTL1_DEV_FORCE_20_CLK_FOR_30_CLK ; +dwc3_writel (dwc->regs,DWC3_GUCTL1 , reg); }
drivers/usb/dwc3/core.h +1 -0
@@ -259,6 +259,7 @@/* Global User Control 1 Register */ #define DWC3_GUCTL1_DEV_DECOUPLE_L1L2_EVT BIT(31)#define DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS BIT(28) +#define DWC3_GUCTL1_DEV_FORCE_20_CLK_FOR_30_CLK BIT(26)#define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24)#define DWC3_GUCTL1_PARKMODE_DISABLE_SS BIT(17)
Signature · 1 line
2.25.1
PATCH v2 6/11 usb: dwc3: reorder dwc-of-simple compatibles
In reply to Peter GeisThe dwc3-of-simple driver is getting rather disorganized with the new inclusions.
Reorder the dwc3-of-simple compatibles to be alphabetical.
--- drivers/usb/dwc3/dwc3-of-simple.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/dwc3/dwc3-of-simple.c +3 -3
@@ -171,12 +171,12 @@ static const struct dev_pm_ops dwc3_of_simple_dev_pm_ops = { };static const struct of_device_id of_dwc3_simple_match[] = { - { .compatible ="rockchip,rk3399-dwc3" }, - { .compatible ="cavium,octeon-7130-usb-uctl" }, - { .compatible ="sprd,sc9860-dwc3" }, { .compatible ="allwinner,sun50i-h6-dwc3" }, + { .compatible ="cavium,octeon-7130-usb-uctl" }, { .compatible ="hisilicon,hi3670-dwc3" }, { .compatible ="intel,keembay-dwc3" }, + { .compatible ="rockchip,rk3399-dwc3" }, + { .compatible ="sprd,sc9860-dwc3" }, {/* Sentinel */ } };MODULE_DEVICE_TABLE (of, of_dwc3_simple_match);
Signature · 7 lines
2.25.1 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH v2 7/11 usb: dwc3: convert dwc3-of-simple to use match-data
In reply to Peter GeisThe upcoming support for rk3568 will reuse data from rk3399. Instead of adding a bunch of of_device_is_compatible as we add support for new devices, lets get ahead of the problem and use of_match_data instead.
--- drivers/usb/dwc3/dwc3-of-simple.c | 39 ++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 9 deletions(-)
drivers/usb/dwc3/dwc3-of-simple.c +30 -9
@@ -30,12 +30,16 @@ struct dwc3_of_simple {bool need_reset; }; +struct dwc3_of_simple_data { +bool need_reset; +}; +static int dwc3_of_simple_probe (struct platform_device *pdev) {struct dwc3_of_simple *simple;struct device *dev = &pdev->dev;struct device_node *np = dev->of_node; - +const struct dwc3_of_simple_data *data =of_device_get_match_data (dev);int ret; simple =devm_kzalloc (dev,sizeof (*simple),GFP_KERNEL );
@@ -49,8 +53,8 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)* Some controllers need to toggle the usb3-otg reset before trying to * initialize the PHY, otherwise the PHY times out. */ -if (of_device_is_compatible (np,"rockchip,rk3399-dwc3" )) - simple->need_reset = true; +if (data->need_reset) + simple->need_reset = data->need_reset; simple->resets =of_reset_control_array_get (np, false, true, true);
@@ -170,13 +174,30 @@ static const struct dev_pm_ops dwc3_of_simple_dev_pm_ops = { dwc3_of_simple_runtime_resume, NULL) }; +static const struct dwc3_of_simple_data dwc3_of_simple_data_rk3399 = { + .need_reset = true, +}; +static const struct of_device_id of_dwc3_simple_match[] = { - { .compatible ="allwinner,sun50i-h6-dwc3" }, - { .compatible ="cavium,octeon-7130-usb-uctl" }, - { .compatible ="hisilicon,hi3670-dwc3" }, - { .compatible ="intel,keembay-dwc3" }, - { .compatible ="rockchip,rk3399-dwc3" }, - { .compatible ="sprd,sc9860-dwc3" }, + { + .compatible ="allwinner,sun50i-h6-dwc3" , + }, + { + .compatible ="cavium,octeon-7130-usb-uctl" , + }, + { + .compatible ="hisilicon,hi3670-dwc3" , + }, + { + .compatible ="intel,keembay-dwc3" , + }, + { + .compatible ="rockchip,rk3399-dwc3" , + .data = &dwc3_of_simple_data_rk3399, + }, + { + .compatible ="sprd,sc9860-dwc3" , + }, {/* Sentinel */ } };MODULE_DEVICE_TABLE (of, of_dwc3_simple_match);
Signature · 7 lines
2.25.1 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH v2 8/11 usb: dwc3: add rk3568 dwc3 support
In reply to Peter GeisThe rk3568 dwc3 controller is backwards compatible with the rk3399 dwc3 controller.
Add support for it to the dwc3-of-simple driver.
--- drivers/usb/dwc3/dwc3-of-simple.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/dwc3/dwc3-of-simple.c +4 -0
@@ -195,6 +195,10 @@ static const struct of_device_id of_dwc3_simple_match[] = { .compatible = "rockchip,rk3399-dwc3", .data = &dwc3_of_simple_data_rk3399, }, + { + .compatible = "rockchip,rk3568-dwc3", + .data = &dwc3_of_simple_data_rk3399, + }, { .compatible = "sprd,sc9860-dwc3", },
Signature · 1 line
2.25.1
Re: [PATCH v2 08/11] usb: dwc3: add rk3568 dwc3 support
Hi Peter,
See comments by rob+dt:
Quoted 3 lines
Presumably you are getting lucky here (with link order). The kernel has no logic to decide which driver to bind to if there are 2 matching drivers.
Due to the fall back string you make a mess with two drivers. Don't use dwc3-of-simple.c
(only for rk3399 and legacy support. Not for new SoCs), because core.c has now reset support.
You are creating a race which driver get probed first. Handle your quirks in core.
Johan
Quoted 24 lines · Peter Geis
The rk3568 dwc3 controller is backwards compatible with the rk3399 dwc3 controller.
Add support for it to the dwc3-of-simple driver.Signed-off-by Peter Geis <[email protected]>--- drivers/usb/dwc3/dwc3-of-simple.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/usb/dwc3/dwc3-of-simple.c +4
-0@@ -195,6 +195,10 @@ static const struct of_device_id of_dwc3_simple_match[] = { .compatible = "rockchip,rk3399-dwc3", .data = &dwc3_of_simple_data_rk3399, }, + { + .compatible = "rockchip,rk3568-dwc3", + .data = &dwc3_of_simple_data_rk3399, + }, { .compatible = "sprd,sc9860-dwc3", },
Re: [PATCH v2 08/11] usb: dwc3: add rk3568 dwc3 support
Quoted 11 lines · Johan Jonker
Hi Peter,
See comments by rob+dt:
Quoted 3 lines
Presumably you are getting lucky here (with link order). The kernel has no logic to decide which driver to bind to if there are 2 matching drivers.
Quoted 6 lines
Due to the fall back string you make a mess with two drivers. Don't use
dwc3-of-simple.c
(only for rk3399 and legacy support. Not for new SoCs), becausecore.chas now reset support.
You are creating a race which driver get probed first. Handle your quirks in core.
I finally understood what you were trying to get at here.
After some testing, it seems the core driver handles everything we need now. This makes me want to revisit the rk3399 support.
Thanks!
Quoted 28 lines
Johan
Quoted 24 lines · Peter Geis
The rk3568 dwc3 controller is backwards compatible with the rk3399 dwc3 controller.
Add support for it to the dwc3-of-simple driver.Signed-off-by Peter Geis <[email protected]>--- drivers/usb/dwc3/dwc3-of-simple.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/usb/dwc3/dwc3-of-simple.c +4
-0@@ -195,6 +195,10 @@ static const struct of_device_id of_dwc3_simple_match[] = { .compatible = "rockchip,rk3399-dwc3", .data = &dwc3_of_simple_data_rk3399, }, + { + .compatible = "rockchip,rk3568-dwc3", + .data = &dwc3_of_simple_data_rk3399, + }, { .compatible = "sprd,sc9860-dwc3", },
PATCH v2 9/11 arm64: dts: rockchip: add rk356x dwc3 usb3 nodes
In reply to Peter GeisAdd the dwc3 device nodes to the rk356x device trees.
The rk3566 has one usb2 capable dwc3 otg controller and one usb3 capable dwc3 host controller.
The rk3568 has one usb3 capable dwc3 otg controller and one usb3 capable dwc3 host controller.
--- arch/arm64/boot/dts/rockchip/rk3566.dtsi | 12 +++++++ arch/arm64/boot/dts/rockchip/rk3568.dtsi | 9 +++++ arch/arm64/boot/dts/rockchip/rk356x.dtsi | 45 +++++++++++++++++++++++- 3 files changed, 65 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3566.dtsi +12 -0
@@ -6,6 +6,10 @@ / { compatible = "rockchip,rk3566"; }; +&pipegrf { + compatible = "rockchip,rk3566-pipe-grf", "syscon"; +}; + &power { power-domain@RK3568_PD_PIPE { reg = <RK3568_PD_PIPE>;
@@ -18,3 +22,11 @@ power-domain@RK3568_PD_PIPE { #power-domain-cells = <0>; }; }; + +&usb_host0_xhci { + phys = <&usb2phy0_otg>; + phy-names = "usb2-phy"; + extcon = <&usb2phy0>; + maximum-speed = "high-speed"; + snps,dis_u2_susphy_quirk; +};
arch/arm64/boot/dts/rockchip/rk3568.dtsi +9 -0
@@ -99,6 +99,10 @@ opp-1992000000 { }; }; +&pipegrf { + compatible = "rockchip,rk3568-pipe-grf", "syscon"; +}; + &power { power-domain@RK3568_PD_PIPE { reg = <RK3568_PD_PIPE>;
@@ -114,3 +118,8 @@ power-domain@RK3568_PD_PIPE { #power-domain-cells = <0>; }; }; + +&usb_host0_xhci { + phys = <&usb2phy0_otg>, <&combphy0 PHY_TYPE_USB3>; + phy-names = "usb2-phy", "usb3-phy"; +};
arch/arm64/boot/dts/rockchip/rk356x.dtsi +44 -1
57 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v2 09/11] arm64: dts: rockchip: add rk356x dwc3 usb3 nodes
Quoted 74 lines · Peter Geis
Add the dwc3 device nodes to the rk356x device trees.
The rk3566 has one usb2 capable dwc3 otg controller and one usb3 capable dwc3 host controller.
The rk3568 has one usb3 capable dwc3 otg controller and one usb3 capable dwc3 host controller.Signed-off-by Peter Geis <[email protected]>--- arch/arm64/boot/dts/rockchip/rk3566.dtsi | 12 +++++++ arch/arm64/boot/dts/rockchip/rk3568.dtsi | 9 +++++ arch/arm64/boot/dts/rockchip/rk356x.dtsi | 45 +++++++++++++++++++++++- 3 files changed, 65 insertions(+), 1 deletion(-)arch/arm64/boot/dts/rockchip/rk3566.dtsi +12
-0@@ -6,6 +6,10 @@ / { compatible = "rockchip,rk3566"; }; +&pipegrf { + compatible = "rockchip,rk3566-pipe-grf", "syscon"; +}; + &power { power-domain@RK3568_PD_PIPE { reg = <RK3568_PD_PIPE>;@@ -18,3 +22,11 @@ power-domain@RK3568_PD_PIPE { #power-domain-cells = <0>; }; }; + +&usb_host0_xhci { + phys = <&usb2phy0_otg>; + phy-names = "usb2-phy"; + extcon = <&usb2phy0>; + maximum-speed = "high-speed"; + snps,dis_u2_susphy_quirk; +};arch/arm64/boot/dts/rockchip/rk3568.dtsi +9
-0@@ -99,6 +99,10 @@ opp-1992000000 { }; }; +&pipegrf { + compatible = "rockchip,rk3568-pipe-grf", "syscon"; +}; + &power { power-domain@RK3568_PD_PIPE { reg = <RK3568_PD_PIPE>;@@ -114,3 +118,8 @@ power-domain@RK3568_PD_PIPE { #power-domain-cells = <0>; }; }; + +&usb_host0_xhci { + phys = <&usb2phy0_otg>, <&combphy0 PHY_TYPE_USB3>; + phy-names = "usb2-phy", "usb3-phy"; +};arch/arm64/boot/dts/rockchip/rk356x.dtsi +2
-0@@ -230,6 +230,50 @@ scmi_shmem: sram@0 { }; }; + usb_host0_xhci: usb@fcc00000 { + compatible = "rockchip,rk3568-dwc3", "snps,dwc3";
arch/arm64/boot/dts/rockchip/rk356x.dtsi scmi_shmem: sram@0 { · line 244
Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +9
-0+ reg = <0x0 0xfcc00000 0x0 0x400000>; + interrupts = <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru CLK_USB3OTG0_REF>, <&cru CLK_USB3OTG0_SUSPEND>, + <&cru ACLK_USB3OTG0>; + clock-names = "ref_clk", "suspend_clk", + "bus_clk"; + dr_mode = "host"; + phy_type = "utmi_wide"; + power-domains = <&power RK3568_PD_PIPE>;
When both usb_host0_xhci and usb_host1_xhci are connected to a usb2phy and the combphy's disabled there's no PCLK_PIPE enabled. Fix logic for RK3568_PD_PIPE by adding the USB3 clocks.
arch/arm64/boot/dts/rockchip/rk356x.dtsi scmi_shmem: sram@0 { · line 245
Quoted 3 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +2
-0+ resets = <&cru SRST_USB3OTG0>; + reset-names = "usb3-otg";
remove
snps,dwc3.yaml only mentions the "resets" because devm_reset_control_array_get_optional_shared is used. reset-names is only a rk3399 legacy that I included due to the YAML conversion.
With unevaluatedProperties now working "resets" also could be removed from rockchip,dwc3.yaml I think.
https://github.com/torvalds/linux/commit/2f8e928408885dad5d8d6afefacb82100b6b62c7
Added properties for rk3399 are:
power-domains
resets
reset-names
arch/arm64/boot/dts/rockchip/rk356x.dtsi scmi_shmem: sram@0 { · line 249
Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +4
-0+ snps,dis_enblslpm_quirk; + snps,dis-u2-freeclk-exists-quirk; + snps,dis-del-phy-power-chg-quirk; + snps,dis-tx-ipgap-linecheck-quirk;
sort
arch/arm64/boot/dts/rockchip/rk356x.dtsi scmi_shmem: sram@0 { · line 250
Quoted 1 line
arch/arm64/boot/dts/rockchip/rk356x.dtsi +1
-0+ snps,xhci-trb-ent-quirk;
???
check snps,dwc3.yaml
Quoted 7 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +7
-0+ status = "disabled"; + }; + + usb_host1_xhci: usb@fd000000 { + compatible = "rockchip,rk3568-dwc3", "snps,dwc3"; + reg = <0x0 0xfd000000 0x0 0x400000>; + interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>;
arch/arm64/boot/dts/rockchip/rk356x.dtsi scmi_shmem: sram@0 { · line 266
Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +9
-0+ clocks = <&cru CLK_USB3OTG1_REF>, <&cru CLK_USB3OTG1_SUSPEND>, + <&cru ACLK_USB3OTG1>; + clock-names = "ref_clk", "suspend_clk", + "bus_clk"; + dr_mode = "host"; + phys = <&usb2phy0_host>, <&combphy1 PHY_TYPE_USB3>; + phy-names = "usb2-phy", "usb3-phy"; + phy_type = "utmi_wide"; + power-domains = <&power RK3568_PD_PIPE>;
dito
arch/arm64/boot/dts/rockchip/rk356x.dtsi scmi_shmem: sram@0 { · line 268
Quoted 3 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +2
-0+ resets = <&cru SRST_USB3OTG1>; + reset-names = "usb3-otg";
remove
arch/arm64/boot/dts/rockchip/rk356x.dtsi scmi_shmem: sram@0 { · line 273
Quoted 5 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +5
-0+ snps,dis_enblslpm_quirk; + snps,dis-u2-freeclk-exists-quirk; + snps,dis_u2_susphy_quirk; + snps,dis-del-phy-power-chg-quirk; + snps,dis-tx-ipgap-linecheck-quirk;
sort
Quoted 14 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +3
-1+ status = "disabled"; + }; + gic: interrupt-controller@fd400000 { compatible = "arm,gic-v3"; reg = <0x0 0xfd400000 0 0x10000>, /* GICD */@@ -297,7 +341,6 @@ pmu_io_domains: io-domains { }; pipegrf: syscon@fdc50000 { - compatible = "rockchip,rk3568-pipe-grf", "syscon"; reg = <0x0 0xfdc50000 0x0 0x1000>; };
Re: [PATCH v2 09/11] arm64: dts: rockchip: add rk356x dwc3 usb3 nodes
Quoted 98 lines · Johan Jonker
Quoted 74 lines · Peter Geis
Add the dwc3 device nodes to the rk356x device trees.
The rk3566 has one usb2 capable dwc3 otg controller and one usb3 capable dwc3 host controller.
The rk3568 has one usb3 capable dwc3 otg controller and one usb3 capable dwc3 host controller.Signed-off-by Peter Geis <[email protected]>--- arch/arm64/boot/dts/rockchip/rk3566.dtsi | 12 +++++++ arch/arm64/boot/dts/rockchip/rk3568.dtsi | 9 +++++ arch/arm64/boot/dts/rockchip/rk356x.dtsi | 45 +++++++++++++++++++++++- 3 files changed, 65 insertions(+), 1 deletion(-)arch/arm64/boot/dts/rockchip/rk3566.dtsi +12
-0@@ -6,6 +6,10 @@ / { compatible = "rockchip,rk3566"; }; +&pipegrf { + compatible = "rockchip,rk3566-pipe-grf", "syscon"; +}; + &power { power-domain@RK3568_PD_PIPE { reg = <RK3568_PD_PIPE>;@@ -18,3 +22,11 @@ power-domain@RK3568_PD_PIPE { #power-domain-cells = <0>; }; }; + +&usb_host0_xhci { + phys = <&usb2phy0_otg>; + phy-names = "usb2-phy"; + extcon = <&usb2phy0>; + maximum-speed = "high-speed"; + snps,dis_u2_susphy_quirk; +};arch/arm64/boot/dts/rockchip/rk3568.dtsi +9
-0@@ -99,6 +99,10 @@ opp-1992000000 { }; }; +&pipegrf { + compatible = "rockchip,rk3568-pipe-grf", "syscon"; +}; + &power { power-domain@RK3568_PD_PIPE { reg = <RK3568_PD_PIPE>;@@ -114,3 +118,8 @@ power-domain@RK3568_PD_PIPE { #power-domain-cells = <0>; }; }; + +&usb_host0_xhci { + phys = <&usb2phy0_otg>, <&combphy0 PHY_TYPE_USB3>; + phy-names = "usb2-phy", "usb3-phy"; +};arch/arm64/boot/dts/rockchip/rk356x.dtsi +2
-0@@ -230,6 +230,50 @@ scmi_shmem: sram@0 { }; }; + usb_host0_xhci: usb@fcc00000 { + compatible = "rockchip,rk3568-dwc3", "snps,dwc3";arch/arm64/boot/dts/rockchip/rk356x.dtsi scmi_shmem: sram@0 { · line 244
Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +9
-0+ reg = <0x0 0xfcc00000 0x0 0x400000>; + interrupts = <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru CLK_USB3OTG0_REF>, <&cru CLK_USB3OTG0_SUSPEND>, + <&cru ACLK_USB3OTG0>; + clock-names = "ref_clk", "suspend_clk", + "bus_clk"; + dr_mode = "host"; + phy_type = "utmi_wide"; + power-domains = <&power RK3568_PD_PIPE>;When both
usb_host0_xhciandusb_host1_xhciare connected to a usb2phy and the combphy's disabled there's noPCLK_PIPEenabled. Fix logic forRK3568_PD_PIPEby adding the USB3 clocks.arch/arm64/boot/dts/rockchip/rk356x.dtsi scmi_shmem: sram@0 { · line 245
Quoted 3 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +2
-0+ resets = <&cru SRST_USB3OTG0>; + reset-names = "usb3-otg";
Quoted 8 lines
remove
snps,dwc3.yaml only mentions the "resets" because
devm_reset_control_array_get_optional_sharedis used. reset-names is only a rk3399 legacy that I included due to the YAML conversion.
With unevaluatedProperties now working "resets" also could be removed from rockchip,dwc3.yaml I think.
I've tested removing the reset entirely, and it seems the issues that affected the rk3399 do not affect us here.
Quoted 12 lines
https://github.com/torvalds/linux/commit/2f8e928408885dad5d8d6afefacb82100b6b62c7
Added properties for rk3399 are:
power-domains
resets
reset-namesarch/arm64/boot/dts/rockchip/rk356x.dtsi scmi_shmem: sram@0 { · line 249
Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +4
-0+ snps,dis_enblslpm_quirk; + snps,dis-u2-freeclk-exists-quirk; + snps,dis-del-phy-power-chg-quirk; + snps,dis-tx-ipgap-linecheck-quirk;
Quoted 7 lines
sort
arch/arm64/boot/dts/rockchip/rk356x.dtsi scmi_shmem: sram@0 { · line 250
Quoted 1 line
arch/arm64/boot/dts/rockchip/rk356x.dtsi +1
-0+ snps,xhci-trb-ent-quirk;???
check snps,dwc3.yaml
I've tried dropping all of these and testing all the configurations I can think of.
The only one we seem to absolutely need is snps,dis_u2_susphy_quirk, without which sometimes devices fail to enumerate after being removed. The only weird behavior I found was on the Pinenote, where there is only the OTG port and when a state change happens from host to device mode the controller locks up the AXI bus for a few seconds until it times out and gets reset by core.
OTG support is still a work in progress here though and is not supported yet.
TLDR: I'll be dropping all the quirks that have no apparent effect in the v3, they can be added in if needed following broader testing.
Thanks for all the insight here!
Quoted 49 lines
Quoted 8 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +7
-0+ status = "disabled"; + }; + + usb_host1_xhci: usb@fd000000 { + compatible = "rockchip,rk3568-dwc3", "snps,dwc3"; + reg = <0x0 0xfd000000 0x0 0x400000>; + interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>;arch/arm64/boot/dts/rockchip/rk356x.dtsi scmi_shmem: sram@0 { · line 266
Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +9
-0+ clocks = <&cru CLK_USB3OTG1_REF>, <&cru CLK_USB3OTG1_SUSPEND>, + <&cru ACLK_USB3OTG1>; + clock-names = "ref_clk", "suspend_clk", + "bus_clk"; + dr_mode = "host"; + phys = <&usb2phy0_host>, <&combphy1 PHY_TYPE_USB3>; + phy-names = "usb2-phy", "usb3-phy"; + phy_type = "utmi_wide"; + power-domains = <&power RK3568_PD_PIPE>;dito
arch/arm64/boot/dts/rockchip/rk356x.dtsi scmi_shmem: sram@0 { · line 268
Quoted 3 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +2
-0+ resets = <&cru SRST_USB3OTG1>; + reset-names = "usb3-otg";remove
arch/arm64/boot/dts/rockchip/rk356x.dtsi scmi_shmem: sram@0 { · line 273
Quoted 5 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +5
-0+ snps,dis_enblslpm_quirk; + snps,dis-u2-freeclk-exists-quirk; + snps,dis_u2_susphy_quirk; + snps,dis-del-phy-power-chg-quirk; + snps,dis-tx-ipgap-linecheck-quirk;sort
Quoted 14 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +3
-1+ status = "disabled"; + }; + gic: interrupt-controller@fd400000 { compatible = "arm,gic-v3"; reg = <0x0 0xfd400000 0 0x10000>, /* GICD */@@ -297,7 +341,6 @@ pmu_io_domains: io-domains { }; pipegrf: syscon@fdc50000 { - compatible = "rockchip,rk3568-pipe-grf", "syscon"; reg = <0x0 0xfdc50000 0x0 0x1000>; };
PATCH v2 10/11 arm64: dts: rockchip: enable dwc3 on quartz64-a
In reply to Peter GeisThe quartz64 model a has support for both the dwc3 otg port and the dwc3 host port. Add the otg power supply and dwc3 nodes to the device tree to enable support for these.
--- .../boot/dts/rockchip/rk3566-quartz64-a.dts | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+)
arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts +37 -0
@@ -151,6 +151,16 @@ vcc5v0_usb20_host: vcc5v0_usb20_host { vin-supply = <&vcc5v0_usb>; }; + vcc5v0_usb20_otg: vcc5v0_usb20_otg { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio4 RK_PB5 GPIO_ACTIVE_HIGH>; + regulator-name = "vcc5v0_usb20_otg"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&dcdc_boost>; + }; + vcc3v3_sd: vcc3v3_sd { compatible = "regulator-fixed"; enable-active-low;
@@ -187,6 +197,10 @@ vcc_wl: vcc_wl { }; }; +&combphy1 { + status = "okay"; +}; + &cpu0 { cpu-supply = <&vdd_cpu>; };
@@ -672,6 +686,29 @@ &usb_host1_ohci { status = "okay"; }; +&usb_host0_xhci { + status = "okay"; +}; + +/* usb3 controller is muxed with sata1 */ +&usb_host1_xhci { + status = "okay"; +}; + +&usb2phy0 { + status = "okay"; +}; + +&usb2phy0_host { + phy-supply = <&vcc5v0_usb20_host>; + status = "okay"; +}; + +&usb2phy0_otg { + phy-supply = <&vcc5v0_usb20_otg>; + status = "okay"; +}; + &usb2phy1 { status = "okay"; };
Signature · 1 line
2.25.1
PATCH v2 11/11 arm64: dts: rockchip: add usb3 support to rk3568-evb1-v10
In reply to Peter GeisFrom: Michael Riesch <[email protected]>
The Rockchip RK3568 EVB1 features one USB 3.0 device-only (USB 2.0 OTG) port and one USB 3.0 host-only port. Activate the USB 3.0 controller nodes and phy nodes in the device tree.
--- .../boot/dts/rockchip/rk3568-evb1-v10.dts | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+)
arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts +46 -0
@@ -103,6 +103,18 @@ vcc5v0_usb_host: vcc5v0-usb-host { vin-supply = <&vcc5v0_usb>; }; + vcc5v0_usb_otg: vcc5v0-usb-otg { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_usb_otg_en>; + regulator-name = "vcc5v0_usb_otg"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_usb>; + }; + vcc3v3_lcd0_n: vcc3v3-lcd0-n { compatible = "regulator-fixed"; regulator-name = "vcc3v3_lcd0_n";
@@ -136,6 +148,14 @@ regulator-state-mem { }; }; +&combphy0 { + status = "okay"; +}; + +&combphy1 { + status = "okay"; +}; + &cpu0 { cpu-supply = <&vdd_cpu>; };
@@ -507,6 +527,9 @@ usb { vcc5v0_usb_host_en: vcc5v0_usb_host_en { rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; }; + vcc5v0_usb_otg_en: vcc5v0_usb_otg_en { + rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; + }; }; };
@@ -568,6 +591,11 @@ &usb_host0_ohci { status = "okay"; }; +&usb_host0_xhci { + extcon = <&usb2phy0>; + status = "okay"; +}; + &usb_host1_ehci { status = "okay"; };
@@ -576,6 +604,24 @@ &usb_host1_ohci { status = "okay"; }; +&usb_host1_xhci { + status = "okay"; +}; + +&usb2phy0 { + status = "okay"; +}; + +&usb2phy0_host { + phy-supply = <&vcc5v0_usb_host>; + status = "okay"; +}; + +&usb2phy0_otg { + vbus-supply = <&vcc5v0_usb_otg>; + status = "okay"; +}; + &usb2phy1 { status = "okay"; };
Signature · 1 line
2.25.1