usb-phy support for the old rk3036 soc
Subsystems (3)
Heiko Stuebner
maintainercover usb-phy support for the old rk3036 soc
While trying to resurrect the rk3036 board in my boardfarm, I also implemented the up to now missing usb2phy support.
The implementation is quite similar to the rk3128, except the not- supported charger-detection, so its addition was quite simple.
Heiko Stuebner (3):
dt-bindings: phy: rockchip,inno-usb2phy: add rk3036 compatible
phy: rockchip: inno-usb2: add phy definition for rk3036
ARM: dts: rockchip: add rk3036 usb2phy nodes and enable them on kylin
.../bindings/phy/rockchip,inno-usb2phy.yaml | 2 ++ arch/arm/boot/dts/rockchip/rk3036-kylin.dts | 12 +++++++ arch/arm/boot/dts/rockchip/rk3036.dtsi | 35 +++++++++++++++++++ drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 32 +++++++++++++++++ 4 files changed, 81 insertions(+)
Signature · 1 line
2.47.2
Heiko Stuebner
maintainerPATCH 1/3 dt-bindings: phy: rockchip,inno-usb2phy: add rk3036 compatible
Add compatible for the USB2 phy in the Rockchip RK3036 SoC.
Apart from some bits that got swapped around in the phy registers, the block is nearly the same as the one on the rk3128.
--- .../devicetree/bindings/phy/rockchip,inno-usb2phy.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/phy/rockchip,inno-usb2phy.yaml +2 -0
@@ -13,6 +13,7 @@ properties: compatible: enum: - rockchip,px30-usb2phy + - rockchip,rk3036-usb2phy - rockchip,rk3128-usb2phy - rockchip,rk3228-usb2phy - rockchip,rk3308-usb2phy
@@ -184,6 +185,7 @@ allOf: contains: enum: - rockchip,px30-usb2phy + - rockchip,rk3036-usb2phy - rockchip,rk3128-usb2phy - rockchip,rk3228-usb2phy - rockchip,rk3308-usb2phy
Signature · 1 line
2.47.2
Re: [PATCH 1/3] dt-bindings: phy: rockchip,inno-usb2phy: add rk3036 compatible
Quoted 6 lines · Heiko Stuebner
Add compatible for the USB2 phy in the Rockchip RK3036 SoC.
Apart from some bits that got swapped around in the phy registers, the block is nearly the same as the one on the rk3128.
Signed-off-by Heiko Stuebner <[email protected]>
Heiko Stuebner
maintainerPATCH 2/3 phy: rockchip: inno-usb2: add phy definition for rk3036
In reply to Heiko StuebnerThe usb2phy on rk3036 is very similar to rk3128 but not 100% identical. While most registers and bits are the same, a small fraction did get moved around.
So we can re-use the phy-tuning function, but need a new set a bits. The biggest change might be that the phy on rk3036 does not support the charger detection, that rk3128 (and newer phys) have.
--- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +32 -0
@@ -1583,6 +1583,37 @@ static int rk3588_usb2phy_tuning(struct rockchip_usb2phy *rphy)return ret; } +static const struct rockchip_usb2phy_cfg rk3036_phy_cfgs[] = { + { + .reg =0x17c , + .num_ports =2 , + .phy_tuning = rk3128_usb2phy_tuning, + .clkout_ctl = {0x017c ,11 ,11 ,1 ,0 }, + .port_cfgs = { + [USB2PHY_PORT_OTG ] = { + .phy_sus = {0x017c ,8 ,0 ,0 ,0x1d1 }, + .bvalid_det_en = {0x017c ,14 ,14 ,0 ,1 }, + .bvalid_det_st = {0x017c ,15 ,15 ,0 ,1 }, + .bvalid_det_clr = {0x017c ,15 ,15 ,0 ,1 }, + .ls_det_en = {0x017c ,12 ,12 ,0 ,1 }, + .ls_det_st = {0x017c ,13 ,13 ,0 ,1 }, + .ls_det_clr = {0x017c ,13 ,13 ,0 ,1 }, + .utmi_bvalid = {0x014c ,8 ,8 ,0 ,1 }, + .utmi_id = {0x014c ,11 ,11 ,0 ,1 }, + .utmi_ls = {0x014c ,10 ,9 ,0 ,1 }, + + }, + [USB2PHY_PORT_HOST ] = { + .phy_sus = {0x0194 ,8 ,0 ,0 ,0x1d1 }, + .ls_det_en = {0x0194 ,14 ,14 ,0 ,1 }, + .ls_det_st = {0x0194 ,15 ,15 ,0 ,1 }, + .ls_det_clr = {0x0194 ,15 ,15 ,0 ,1 } + } + }, + }, + {/* sentinel */ } +}; +static const struct rockchip_usb2phy_cfg rk3128_phy_cfgs[] = { { .reg =0x17c ,
@@ -2204,6 +2235,7 @@ static const struct rockchip_usb2phy_cfg rv1108_phy_cfgs[] = {static const struct of_device_id rockchip_usb2phy_dt_match[] = { { .compatible ="rockchip,px30-usb2phy" , .data = &rk3328_phy_cfgs }, + { .compatible ="rockchip,rk3036-usb2phy" , .data = &rk3036_phy_cfgs }, { .compatible ="rockchip,rk3128-usb2phy" , .data = &rk3128_phy_cfgs }, { .compatible ="rockchip,rk3228-usb2phy" , .data = &rk3228_phy_cfgs }, { .compatible ="rockchip,rk3308-usb2phy" , .data = &rk3308_phy_cfgs },
Signature · 1 line
2.47.2
Heiko Stuebner
maintainerPATCH 3/3 ARM: dts: rockchip: add rk3036 usb2phy nodes and enable them on kylin
In reply to Heiko StuebnerThe rk3036 does contain a usb2phy, just until now it was just used implicitly without additional configuration. As we now have the bits in place for it getting actually controlled, add the necessary phy-node to the GRF simple-mfd.
Enable the phy-ports in the same patch to not create bisectability issues, as hooking up the phys to the usb controllers would create probe deferrals until a board enables them. Doing everything in one patch, solves that issue.
Only rk3036-kylin actually enabled the usb controllers, so is the only board affected.
--- arch/arm/boot/dts/rockchip/rk3036-kylin.dts | 12 +++++++ arch/arm/boot/dts/rockchip/rk3036.dtsi | 35 +++++++++++++++++++++ 2 files changed, 47 insertions(+)
arch/arm/boot/dts/rockchip/rk3036-kylin.dts +12 -0
@@ -382,6 +382,18 @@ &usb_otg { status = "okay"; }; +&usb2phy { + status = "okay"; +}; + +&usb2phy_host { + status = "okay"; +}; + +&usb2phy_otg { + status = "okay"; +}; + &vop { status = "okay"; };
arch/arm/boot/dts/rockchip/rk3036.dtsi +35 -0
@@ -213,6 +213,8 @@ usb_otg: usb@10180000 { g-np-tx-fifo-size = <16>; g-rx-fifo-size = <275>; g-tx-fifo-size = <256 128 128 64 64 32>; + phys = <&usb2phy_otg>; + phy-names = "usb2-phy"; status = "disabled"; };
@@ -224,6 +226,8 @@ usb_host: usb@101c0000 { clocks = <&cru HCLK_OTG1>; clock-names = "otg"; dr_mode = "host"; + phys = <&usb2phy_host>; + phy-names = "usb2-phy"; status = "disabled"; };
@@ -342,6 +346,37 @@ cru: clock-controller@20000000 { grf: syscon@20008000 { compatible = "rockchip,rk3036-grf", "syscon", "simple-mfd"; reg = <0x20008000 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + + usb2phy: usb2phy@17c { + compatible = "rockchip,rk3036-usb2phy"; + reg = <0x017c 0x20>; + clocks = <&cru SCLK_OTGPHY0>; + clock-names = "phyclk"; + clock-output-names = "usb480m_phy"; + assigned-clocks = <&cru SCLK_USB480M>; + assigned-clock-parents = <&usb2phy>; + #clock-cells = <0>; + status = "disabled"; + + usb2phy_host: host-port { + interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "linestate"; + #phy-cells = <0>; + status = "disabled"; + }; + + usb2phy_otg: otg-port { + interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "otg-bvalid", "otg-id", + "linestate"; + #phy-cells = <0>; + status = "disabled"; + }; + }; power: power-controller { compatible = "rockchip,rk3036-power-controller";
Signature · 1 line
2.47.2
Re: (subset) [PATCH 0/3] usb-phy support for the old rk3036 soc
In reply to Heiko StuebnerQuoted 8 lines · Heiko Stuebner
While trying to resurrect the rk3036 board in my boardfarm, I also implemented the up to now missing usb2phy support.
The implementation is quite similar to the rk3128, except the not- supported charger-detection, so its addition was quite simple.
[...]
Applied, thanks!
[1/3] dt-bindings: phy: rockchip,inno-usb2phy: add rk3036 compatible
commit: d78b565371314e48242cb9383d0f9d331119ab2e
[2/3] phy: rockchip: inno-usb2: add phy definition for rk3036
commit: 3ca48b955bb34a3b07dd915318d73a23740de282Best regards,
Signature · 1 line
~Vinod
Re: (subset) [PATCH 0/3] usb-phy support for the old rk3036 soc
In reply to Heiko StuebnerQuoted 8 lines · Heiko Stuebner
While trying to resurrect the rk3036 board in my boardfarm, I also implemented the up to now missing usb2phy support.
The implementation is quite similar to the rk3128, except the not- supported charger-detection, so its addition was quite simple.
[...]
Applied, thanks!
[3/3] ARM: dts: rockchip: add rk3036 usb2phy nodes and enable them on kylin
commit: 9e010737dd434e3eee1fa75938abea0dc2fab8e2
Best regards,
Signature · 1 line
Heiko Stuebner <[email protected]>