ARM: dts: rockchip: rk3588-rock-5b-u-boot: add USB 2.0 host
Subsystems (3)
PATCH 1/3 ARM: dts: rockchip: rk3588-rock-5b-u-boot: add USB 2.0 host
Add USB 2.0 host nodes and PHYs.
--- arch/arm/dts/rk3588-rock-5b-u-boot.dtsi | 169 ++++++++++++++++++++++++ 1 file changed, 169 insertions(+)
arch/arm/dts/rk3588-rock-5b-u-boot.dtsi +169 -0
@@ -4,6 +4,9 @@ */ #include "rk3588-u-boot.dtsi" +#include <dt-bindings/pinctrl/rockchip.h> +#include <dt-bindings/input/input.h> +#include <dt-bindings/gpio/gpio.h> / { aliases {
@@ -13,6 +16,105 @@ chosen { u-boot,spl-boot-order = &sdmmc; }; + + vcc5v0_host: vcc5v0-host-regulator { + u-boot,dm-pre-reloc; + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_host"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_host_en>; + vin-supply = <&vcc5v0_sys>; + }; + + usb_host0_ehci: usb@fc800000 { + compatible = "generic-ehci"; + reg = <0x0 0xfc800000 0x0 0x40000>; + interrupts = <GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&cru HCLK_HOST0>, <&cru HCLK_HOST_ARB0>; + clock-names = "usbhost", "arbiter"; + power-domains = <&power RK3588_PD_USB>; + status = "disabled"; + }; + + usb_host0_ohci: usb@fc840000 { + compatible = "generic-ohci"; + reg = <0x0 0xfc840000 0x0 0x40000>; + interrupts = <GIC_SPI 216 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&cru HCLK_HOST0>, <&cru HCLK_HOST_ARB0>; + clock-names = "usbhost", "arbiter"; + power-domains = <&power RK3588_PD_USB>; + status = "disabled"; + }; + + usb_host1_ehci: usb@fc880000 { + compatible = "generic-ehci"; + reg = <0x0 0xfc880000 0x0 0x40000>; + interrupts = <GIC_SPI 218 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&cru HCLK_HOST1>, <&cru HCLK_HOST_ARB1>; + clock-names = "usbhost", "arbiter"; + power-domains = <&power RK3588_PD_USB>; + status = "disabled"; + }; + + usb_host1_ohci: usb@fc8c0000 { + compatible = "generic-ohci"; + reg = <0x0 0xfc8c0000 0x0 0x40000>; + interrupts = <GIC_SPI 219 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&cru HCLK_HOST1>, <&cru HCLK_HOST_ARB1>; + clock-names = "usbhost", "arbiter"; + power-domains = <&power RK3588_PD_USB>; + status = "disabled"; + }; + + usb2phy2_grf: syscon@fd5d8000 { + compatible = "rockchip,rk3588-usb2phy-grf", "syscon", + "simple-mfd"; + reg = <0x0 0xfd5d8000 0x0 0x4000>; + #address-cells = <1>; + #size-cells = <1>; + + u2phy2: usb2-phy@8000 { + compatible = "rockchip,rk3588-usb2phy"; + reg = <0x8000 0x10>; + interrupts = <GIC_SPI 391 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&cru CLK_USB2PHY_HDPTXRXPHY_REF>; + clock-names = "phyclk"; + #clock-cells = <0>; + status = "disabled"; + + u2phy2_host: host-port { + #phy-cells = <0>; + status = "disabled"; + }; + }; + }; + + usb2phy3_grf: syscon@fd5dc000 { + compatible = "rockchip,rk3588-usb2phy-grf", "syscon", + "simple-mfd"; + reg = <0x0 0xfd5dc000 0x0 0x4000>; + #address-cells = <1>; + #size-cells = <1>; + + u2phy3: usb2-phy@c000 { + compatible = "rockchip,rk3588-usb2phy"; + reg = <0xc000 0x10>; + interrupts = <GIC_SPI 392 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&cru CLK_USB2PHY_HDPTXRXPHY_REF>; + clock-names = "phyclk"; + #clock-cells = <0>; + status = "disabled"; + + u2phy3_host: host-port { + #phy-cells = <0>; + status = "disabled"; + }; + }; + }; }; &sdmmc {
@@ -20,3 +122,70 @@ u-boot,dm-spl; status = "okay"; }; + +&pinctrl { + usb { + vcc5v0_host_en: vcc5v0-host-en { + rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&usb_host0_ehci { + companion = <&usb_host0_ohci>; + phys = <&u2phy2_host>; + phy-names = "usb2-phy"; + status = "okay"; +}; + +&usb_host0_ohci { + phys = <&u2phy2_host>; + phy-names = "usb2-phy"; + status = "okay"; +}; + +&usb2phy2_grf { + status = "okay"; +}; + +&u2phy2 { + resets = <&cru SRST_OTGPHY_U2_0>, <&cru SRST_P_USB2PHY_U2_0_GRF0>; + reset-names = "phy", "apb"; + clock-output-names = "usb480m_phy2"; + status = "okay"; +}; + +&u2phy2_host { + phy-supply = <&vcc5v0_host>; + status = "okay"; +}; + +&usb_host1_ehci { + companion = <&usb_host1_ohci>; + phys = <&u2phy3_host>; + phy-names = "usb2-phy"; + status = "okay"; +}; + +&usb_host1_ohci { + phys = <&u2phy3_host>; + phy-names = "usb2-phy"; + status = "okay"; +}; + +&usb2phy3_grf { + status = "okay"; +}; + +&u2phy3 { + resets = <&cru SRST_OTGPHY_U2_1>, <&cru SRST_P_USB2PHY_U2_1_GRF0>; + reset-names = "phy", "apb"; + clock-output-names = "usb480m_phy3"; + status = "okay"; +}; + +&u2phy3_host { + phy-supply = <&vcc5v0_host>; + status = "okay"; +}; +
Signature · 1 line
2.34.1
PATCH 2/3 phy: rockchip-inno-usb2: add initial support for rk3588 PHY
Add initial support for the rk3588 PHY variant.
The driver now looks for phy-supply and enables/disables the vbus accordingly.
The lookup for the host-port reg inside the struct now does a do {} while() instead of a while() {} in order to allow a first check for reg == 0.
--- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 109 +++++++++++++++++- 1 file changed, 104 insertions(+), 5 deletions(-)
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +104 -5
@@ -13,6 +13,7 @@#include <dm/device_compat.h> #include <dm/lists.h> #include <generic-phy.h> +#include <power/regulator.h> #include <reset.h> #include <syscon.h> #include <asm/gpio.h>
@@ -61,6 +62,7 @@ struct rockchip_usb2phy_cfg {struct rockchip_usb2phy {void *reg_base;struct clk phyclk; +struct udevice *vbus_supply[USB2PHY_NUM_PORTS ];const struct rockchip_usb2phy_cfg *phy_cfg; };
@@ -86,11 +88,34 @@ struct rockchip_usb2phy_port_cfg *us2phy_get_port(struct phy *phy)return &phy_cfg->port_cfgs[phy->id]; } +static struct udevice *rockchip_usb2phy_check_vbus (struct phy *phy) +{ +struct udevice *parent = phy->dev->parent; +struct rockchip_usb2phy *priv =dev_get_priv (parent); +struct udevice *vbus =NULL ; + +if (phy->id ==USB2PHY_PORT_HOST ) + vbus = priv->vbus_supply[USB2PHY_PORT_HOST ]; + +return vbus; +} +static int rockchip_usb2phy_power_on (struct phy *phy) {struct udevice *parent =dev_get_parent (phy->dev);struct rockchip_usb2phy *priv =dev_get_priv (parent);const struct rockchip_usb2phy_port_cfg *port_cfg =us2phy_get_port (phy); +struct udevice *vbus =NULL ; +int ret; + + vbus =rockchip_usb2phy_check_vbus (phy); +if (vbus) { + ret =regulator_set_enable (vbus, true); +if (ret) { +dev_err (phy->dev,"vbus enable failed: %d\n" , ret); +return ret; + } + }property_enable (priv->reg_base, &port_cfg->phy_sus, false);
@@ -105,6 +130,17 @@ static int rockchip_usb2phy_power_off(struct phy *phy)struct udevice *parent =dev_get_parent (phy->dev);struct rockchip_usb2phy *priv =dev_get_priv (parent);const struct rockchip_usb2phy_port_cfg *port_cfg =us2phy_get_port (phy); +struct udevice *vbus =NULL ; +int ret; + + vbus =rockchip_usb2phy_check_vbus (phy); +if (vbus) { + ret =regulator_set_enable (vbus, false); +if (ret) { +dev_err (phy->dev,"vbus disable failed: %d\n" , ret); +return ret; + } + }property_enable (priv->reg_base, &port_cfg->phy_sus, true);
@@ -149,13 +185,20 @@ static int rockchip_usb2phy_of_xlate(struct phy *phy, struct ofnode_phandle_args *args) {const char *name = phy->dev->name; +struct udevice *parent = phy->dev->parent; +struct rockchip_usb2phy *priv =dev_get_priv (parent); -if (!strcasecmp (name,"host-port" )) +if (!strcasecmp (name,"host-port" )) { phy->id =USB2PHY_PORT_HOST ; -else if (!strcasecmp (name,"otg-port" )) +device_get_supply_regulator (phy->dev,"phy-supply" , + &priv->vbus_supply[USB2PHY_PORT_HOST ]); + }else if (!strcasecmp (name,"otg-port" )) { phy->id =USB2PHY_PORT_OTG ; -else +device_get_supply_regulator (phy->dev,"phy-supply" , + &priv->vbus_supply[USB2PHY_PORT_OTG ]); + }else {dev_err (phy->dev,"improper %s device\n" , name); + }return 0 ; }
@@ -201,14 +244,14 @@ static int rockchip_usb2phy_probe(struct udevice *dev)/* find out a proper config which can be matched with dt. */ index =0 ; -while (phy_cfgs[index].reg) { +do {if (phy_cfgs[index].reg == reg) { priv->phy_cfg = &phy_cfgs[index];break ; } ++index; - } + }while (phy_cfgs[index].reg);if (!priv->phy_cfg) {dev_err (dev,"failed find proper phy-cfg\n" );
@@ -348,6 +391,58 @@ static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = { {/* sentinel */ } }; +static const struct rockchip_usb2phy_cfg rk3588_phy_cfgs[] = { + { + .reg =0x0000 , + .port_cfgs = { + [USB2PHY_PORT_OTG ] = { + .phy_sus = {0x000c ,11 ,11 ,0 ,1 }, + .ls_det_en = {0x0080 ,0 ,0 ,0 ,1 }, + .ls_det_st = {0x0084 ,0 ,0 ,0 ,1 }, + .ls_det_clr = {0x0088 ,0 ,0 ,0 ,1 }, + .utmi_ls = {0x00c0 ,10 ,9 ,0 ,1 }, + } + }, + }, + { + .reg =0x4000 , + .port_cfgs = { + [USB2PHY_PORT_OTG ] = { + .phy_sus = {0x000c ,11 ,11 ,0 ,0 }, + .ls_det_en = {0x0080 ,0 ,0 ,0 ,1 }, + .ls_det_st = {0x0084 ,0 ,0 ,0 ,1 }, + .ls_det_clr = {0x0088 ,0 ,0 ,0 ,1 }, + .utmi_ls = {0x00c0 ,10 ,9 ,0 ,1 }, + } + }, + }, + { + .reg =0x8000 , + .port_cfgs = { + [USB2PHY_PORT_HOST ] = { + .phy_sus = {0x0008 ,2 ,2 ,0 ,1 }, + .ls_det_en = {0x0080 ,0 ,0 ,0 ,1 }, + .ls_det_st = {0x0084 ,0 ,0 ,0 ,1 }, + .ls_det_clr = {0x0088 ,0 ,0 ,0 ,1 }, + .utmi_ls = {0x00c0 ,10 ,9 ,0 ,1 }, + } + }, + }, + { + .reg =0xc000 , + .port_cfgs = { + [USB2PHY_PORT_HOST ] = { + .phy_sus = {0x0008 ,2 ,2 ,0 ,1 }, + .ls_det_en = {0x0080 ,0 ,0 ,0 ,1 }, + .ls_det_st = {0x0084 ,0 ,0 ,0 ,1 }, + .ls_det_clr = {0x0088 ,0 ,0 ,0 ,1 }, + .utmi_ls = {0x00c0 ,10 ,9 ,0 ,1 }, + } + }, + }, + {/* sentinel */ } +}; +static const struct udevice_id rockchip_usb2phy_ids[] = { { .compatible ="rockchip,rk3399-usb2phy" ,
@@ -357,6 +452,10 @@ static const struct udevice_id rockchip_usb2phy_ids[] = { .compatible = "rockchip,rk3568-usb2phy", .data = (ulong)&rk3568_phy_cfgs, }, + { + .compatible = "rockchip,rk3588-usb2phy", + .data = (ulong)&rk3588_phy_cfgs, + }, {/* sentinel */ } };
Signature · 1 line
2.34.1
Re: [PATCH 2/3] phy: rockchip-inno-usb2: add initial support for rk3588 PHY
Quoted 9 lines · Eugen Hristev
Add initial support for the rk3588 PHY variant.
The driver now looks for phy-supply and enables/disables the vbus accordingly.
The lookup for the host-port reg inside the struct now does a do {}while()instead of awhile(){} in order to allow a first check for reg == 0.Co-developed-by Frank Wang <[email protected]>Signed-off-by Frank Wang <[email protected]>Signed-off-by Eugen Hristev <[email protected]>
Thanks,
- Kever
Quoted 188 lines
--- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 109 +++++++++++++++++- 1 file changed, 104 insertions(+), 5 deletions(-)drivers/phy/rockchip/phy-rockchip-inno-usb2.c +104
-5@@ -13,6 +13,7 @@#include <dm/device_compat.h> #include <dm/lists.h> #include <generic-phy.h> +#include <power/regulator.h> #include <reset.h> #include <syscon.h> #include <asm/gpio.h> @@ -61,6 +62,7 @@ struct rockchip_usb2phy_cfg {struct rockchip_usb2phy {void *reg_base;struct clk phyclk; +struct udevice *vbus_supply[USB2PHY_NUM_PORTS ];const struct rockchip_usb2phy_cfg *phy_cfg; };@@ -86,11 +88,34 @@ struct rockchip_usb2phy_port_cfg *us2phy_get_port(struct phy *phy)return &phy_cfg->port_cfgs[phy->id]; } +static struct udevice *rockchip_usb2phy_check_vbus (struct phy *phy) +{ +struct udevice *parent = phy->dev->parent; +struct rockchip_usb2phy *priv =dev_get_priv (parent); +struct udevice *vbus =NULL ; + +if (phy->id ==USB2PHY_PORT_HOST ) + vbus = priv->vbus_supply[USB2PHY_PORT_HOST ]; + +return vbus; +} +static int rockchip_usb2phy_power_on (struct phy *phy) {struct udevice *parent =dev_get_parent (phy->dev);struct rockchip_usb2phy *priv =dev_get_priv (parent);const struct rockchip_usb2phy_port_cfg *port_cfg =us2phy_get_port (phy); +struct udevice *vbus =NULL ; +int ret; + + vbus =rockchip_usb2phy_check_vbus (phy); +if (vbus) { + ret =regulator_set_enable (vbus, true); +if (ret) { +dev_err (phy->dev,"vbus enable failed: %d\n" , ret); +return ret; + } + }property_enable (priv->reg_base, &port_cfg->phy_sus, false);@@ -105,6 +130,17 @@ static int rockchip_usb2phy_power_off(struct phy *phy)struct udevice *parent =dev_get_parent (phy->dev);struct rockchip_usb2phy *priv =dev_get_priv (parent);const struct rockchip_usb2phy_port_cfg *port_cfg =us2phy_get_port (phy); +struct udevice *vbus =NULL ; +int ret; + + vbus =rockchip_usb2phy_check_vbus (phy); +if (vbus) { + ret =regulator_set_enable (vbus, false); +if (ret) { +dev_err (phy->dev,"vbus disable failed: %d\n" , ret); +return ret; + } + }property_enable (priv->reg_base, &port_cfg->phy_sus, true);@@ -149,13 +185,20 @@ static int rockchip_usb2phy_of_xlate(struct phy *phy, struct ofnode_phandle_args *args) {const char *name = phy->dev->name; +struct udevice *parent = phy->dev->parent; +struct rockchip_usb2phy *priv =dev_get_priv (parent); -if (!strcasecmp (name,"host-port" )) +if (!strcasecmp (name,"host-port" )) { phy->id =USB2PHY_PORT_HOST ; -else if (!strcasecmp (name,"otg-port" )) +device_get_supply_regulator (phy->dev,"phy-supply" , + &priv->vbus_supply[USB2PHY_PORT_HOST ]); + }else if (!strcasecmp (name,"otg-port" )) { phy->id =USB2PHY_PORT_OTG ; -else +device_get_supply_regulator (phy->dev,"phy-supply" , + &priv->vbus_supply[USB2PHY_PORT_OTG ]); + }else {dev_err (phy->dev,"improper %s device\n" , name); + }return 0 ; }@@ -201,14 +244,14 @@ static int rockchip_usb2phy_probe(struct udevice *dev)/* find out a proper config which can be matched with dt. */ index =0 ; -while (phy_cfgs[index].reg) { +do {if (phy_cfgs[index].reg == reg) { priv->phy_cfg = &phy_cfgs[index];break ; } ++index; - } + }while (phy_cfgs[index].reg);if (!priv->phy_cfg) {dev_err (dev,"failed find proper phy-cfg\n" );@@ -348,6 +391,58 @@ static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = { {/* sentinel */ } }; +static const struct rockchip_usb2phy_cfg rk3588_phy_cfgs[] = { + { + .reg =0x0000 , + .port_cfgs = { + [USB2PHY_PORT_OTG ] = { + .phy_sus = {0x000c ,11 ,11 ,0 ,1 }, + .ls_det_en = {0x0080 ,0 ,0 ,0 ,1 }, + .ls_det_st = {0x0084 ,0 ,0 ,0 ,1 }, + .ls_det_clr = {0x0088 ,0 ,0 ,0 ,1 }, + .utmi_ls = {0x00c0 ,10 ,9 ,0 ,1 }, + } + }, + }, + { + .reg =0x4000 , + .port_cfgs = { + [USB2PHY_PORT_OTG ] = { + .phy_sus = {0x000c ,11 ,11 ,0 ,0 }, + .ls_det_en = {0x0080 ,0 ,0 ,0 ,1 }, + .ls_det_st = {0x0084 ,0 ,0 ,0 ,1 }, + .ls_det_clr = {0x0088 ,0 ,0 ,0 ,1 }, + .utmi_ls = {0x00c0 ,10 ,9 ,0 ,1 }, + } + }, + }, + { + .reg =0x8000 , + .port_cfgs = { + [USB2PHY_PORT_HOST ] = { + .phy_sus = {0x0008 ,2 ,2 ,0 ,1 }, + .ls_det_en = {0x0080 ,0 ,0 ,0 ,1 }, + .ls_det_st = {0x0084 ,0 ,0 ,0 ,1 }, + .ls_det_clr = {0x0088 ,0 ,0 ,0 ,1 }, + .utmi_ls = {0x00c0 ,10 ,9 ,0 ,1 }, + } + }, + }, + { + .reg =0xc000 , + .port_cfgs = { + [USB2PHY_PORT_HOST ] = { + .phy_sus = {0x0008 ,2 ,2 ,0 ,1 }, + .ls_det_en = {0x0080 ,0 ,0 ,0 ,1 }, + .ls_det_st = {0x0084 ,0 ,0 ,0 ,1 }, + .ls_det_clr = {0x0088 ,0 ,0 ,0 ,1 }, + .utmi_ls = {0x00c0 ,10 ,9 ,0 ,1 }, + } + }, + }, + {/* sentinel */ } +}; +static const struct udevice_id rockchip_usb2phy_ids[] = { { .compatible ="rockchip,rk3399-usb2phy" ,@@ -357,6 +452,10 @@ static const struct udevice_id rockchip_usb2phy_ids[] = { .compatible = "rockchip,rk3568-usb2phy", .data = (ulong)&rk3568_phy_cfgs, }, + { + .compatible = "rockchip,rk3588-usb2phy", + .data = (ulong)&rk3588_phy_cfgs, + }, {/* sentinel */ } };
Re: [PATCH 2/3] phy: rockchip-inno-usb2: add initial support for rk3588 PHY
In reply to Eugen HristevQuoted 10 lines · Eugen Hristev
Add initial support for the rk3588 PHY variant.
The driver now looks for phy-supply and enables/disables the vbus accordingly.
The lookup for the host-port reg inside the struct now does a do {}while()instead of awhile(){} in order to allow a first check for reg == 0.Co-developed-by Frank Wang <[email protected]>Signed-off-by Frank Wang <[email protected]>Signed-off-by Eugen Hristev <[email protected]>
Quoted 191 lines
--- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 109 +++++++++++++++++- 1 file changed, 104 insertions(+), 5 deletions(-)drivers/phy/rockchip/phy-rockchip-inno-usb2.c +104
-6@@ -13,6 +13,7 @@#include <dm/device_compat.h> #include <dm/lists.h> #include <generic-phy.h> +#include <power/regulator.h> #include <reset.h> #include <syscon.h> #include <asm/gpio.h> @@ -61,6 +62,7 @@ struct rockchip_usb2phy_cfg {struct rockchip_usb2phy {void *reg_base;struct clk phyclk; +struct udevice *vbus_supply[USB2PHY_NUM_PORTS ];const struct rockchip_usb2phy_cfg *phy_cfg; };@@ -86,11 +88,34 @@ struct rockchip_usb2phy_port_cfg *us2phy_get_port(struct phy *phy)return &phy_cfg->port_cfgs[phy->id]; } +static struct udevice *rockchip_usb2phy_check_vbus (struct phy *phy) +{ +struct udevice *parent = phy->dev->parent; +struct rockchip_usb2phy *priv =dev_get_priv (parent); +struct udevice *vbus =NULL ; + +if (phy->id ==USB2PHY_PORT_HOST ) + vbus = priv->vbus_supply[USB2PHY_PORT_HOST ]; + +return vbus; +} +static int rockchip_usb2phy_power_on (struct phy *phy) {struct udevice *parent =dev_get_parent (phy->dev);struct rockchip_usb2phy *priv =dev_get_priv (parent);const struct rockchip_usb2phy_port_cfg *port_cfg =us2phy_get_port (phy); +struct udevice *vbus =NULL ; +int ret; + + vbus =rockchip_usb2phy_check_vbus (phy); +if (vbus) { + ret =regulator_set_enable (vbus, true); +if (ret) { +dev_err (phy->dev,"vbus enable failed: %d\n" , ret); +return ret; + } + }property_enable (priv->reg_base, &port_cfg->phy_sus, false);@@ -105,6 +130,17 @@ static int rockchip_usb2phy_power_off(struct phy *phy)struct udevice *parent =dev_get_parent (phy->dev);struct rockchip_usb2phy *priv =dev_get_priv (parent);const struct rockchip_usb2phy_port_cfg *port_cfg =us2phy_get_port (phy); +struct udevice *vbus =NULL ; +int ret; + + vbus =rockchip_usb2phy_check_vbus (phy); +if (vbus) { + ret =regulator_set_enable (vbus, false); +if (ret) { +dev_err (phy->dev,"vbus disable failed: %d\n" , ret); +return ret; + } + }property_enable (priv->reg_base, &port_cfg->phy_sus, true);@@ -149,13 +185,20 @@ static int rockchip_usb2phy_of_xlate(struct phy *phy, struct ofnode_phandle_args *args) {const char *name = phy->dev->name; +struct udevice *parent = phy->dev->parent; +struct rockchip_usb2phy *priv =dev_get_priv (parent); -if (!strcasecmp (name,"host-port" )) +if (!strcasecmp (name,"host-port" )) { phy->id =USB2PHY_PORT_HOST ; -else if (!strcasecmp (name,"otg-port" )) +device_get_supply_regulator (phy->dev,"phy-supply" , + &priv->vbus_supply[USB2PHY_PORT_HOST ]); + }else if (!strcasecmp (name,"otg-port" )) { phy->id =USB2PHY_PORT_OTG ; -else +device_get_supply_regulator (phy->dev,"phy-supply" , + &priv->vbus_supply[USB2PHY_PORT_OTG ]); + }else {dev_err (phy->dev,"improper %s device\n" , name); + }return 0 ; }@@ -201,14 +244,14 @@ static int rockchip_usb2phy_probe(struct udevice *dev)/* find out a proper config which can be matched with dt. */ index =0 ; -while (phy_cfgs[index].reg) { +do {if (phy_cfgs[index].reg == reg) { priv->phy_cfg = &phy_cfgs[index];break ; } ++index; - } + }while (phy_cfgs[index].reg);if (!priv->phy_cfg) {dev_err (dev,"failed find proper phy-cfg\n" );@@ -348,6 +391,58 @@ static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = { {/* sentinel */ } }; +static const struct rockchip_usb2phy_cfg rk3588_phy_cfgs[] = { + { + .reg =0x0000 , + .port_cfgs = { + [USB2PHY_PORT_OTG ] = { + .phy_sus = {0x000c ,11 ,11 ,0 ,1 }, + .ls_det_en = {0x0080 ,0 ,0 ,0 ,1 }, + .ls_det_st = {0x0084 ,0 ,0 ,0 ,1 }, + .ls_det_clr = {0x0088 ,0 ,0 ,0 ,1 }, + .utmi_ls = {0x00c0 ,10 ,9 ,0 ,1 }, + } + }, + }, + { + .reg =0x4000 , + .port_cfgs = { + [USB2PHY_PORT_OTG ] = { + .phy_sus = {0x000c ,11 ,11 ,0 ,0 }, + .ls_det_en = {0x0080 ,0 ,0 ,0 ,1 }, + .ls_det_st = {0x0084 ,0 ,0 ,0 ,1 }, + .ls_det_clr = {0x0088 ,0 ,0 ,0 ,1 }, + .utmi_ls = {0x00c0 ,10 ,9 ,0 ,1 }, + } + }, + }, + { + .reg =0x8000 , + .port_cfgs = { + [USB2PHY_PORT_HOST ] = { + .phy_sus = {0x0008 ,2 ,2 ,0 ,1 }, + .ls_det_en = {0x0080 ,0 ,0 ,0 ,1 }, + .ls_det_st = {0x0084 ,0 ,0 ,0 ,1 }, + .ls_det_clr = {0x0088 ,0 ,0 ,0 ,1 }, + .utmi_ls = {0x00c0 ,10 ,9 ,0 ,1 }, + } + }, + }, + { + .reg =0xc000 , + .port_cfgs = { + [USB2PHY_PORT_HOST ] = { + .phy_sus = {0x0008 ,2 ,2 ,0 ,1 }, + .ls_det_en = {0x0080 ,0 ,0 ,0 ,1 }, + .ls_det_st = {0x0084 ,0 ,0 ,0 ,1 }, + .ls_det_clr = {0x0088 ,0 ,0 ,0 ,1 }, + .utmi_ls = {0x00c0 ,10 ,9 ,0 ,1 }, + } + }, + }, + {/* sentinel */ } +}; +static const struct udevice_id rockchip_usb2phy_ids[] = { { .compatible ="rockchip,rk3399-usb2phy" ,@@ -357,6 +452,10 @@ static const struct udevice_id rockchip_usb2phy_ids[] = { .compatible = "rockchip,rk3568-usb2phy", .data = (ulong)&rk3568_phy_cfgs, }, + { + .compatible = "rockchip,rk3588-usb2phy", + .data = (ulong)&rk3588_phy_cfgs, + }, {/* sentinel */ } }; --2.34.1
Re: [PATCH 2/3] phy: rockchip-inno-usb2: add initial support for rk3588 PHY
In reply to Eugen HristevEl Fri, Mar 03, 2023 at 09:31:33AM +0200, Eugen Hristev deia:
drivers/phy/rockchip/phy-rockchip-inno-usb2.c static int rockchip_usb2phy_power_off(struct phy *phy) · line 139
Quoted 11 lines
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +7
-0@@ -105,6 +130,17 @@ static int rockchip_usb2phy_power_off(struct phy *phy)struct udevice *parent =dev_get_parent (phy->dev);struct rockchip_usb2phy *priv =dev_get_priv (parent);const struct rockchip_usb2phy_port_cfg *port_cfg =us2phy_get_port (phy); +struct udevice *vbus =NULL ; +int ret; + + vbus =rockchip_usb2phy_check_vbus (phy); +if (vbus) { + ret =regulator_set_enable (vbus, false); +if (ret) {
Could we have
if (ret && ret != -EACCES ) {instead here ?
(reason below)
drivers/phy/rockchip/phy-rockchip-inno-usb2.c static int rockchip_usb2phy_power_off(struct phy *phy) · line 146
Quoted 7 lines
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +4
-0+dev_err (phy->dev,"vbus disable failed: %d\n" , ret); +return ret; + } + }property_enable (priv->reg_base, &port_cfg->phy_sus, true);
Thank you.
I've tested a little your patch (on an older master, 4eb7c5030d3f3c70 (2023-02-19) and some minor config changes that don't seem to matter). I could try on current master if needed, but I thought I'd ask already.
In a Rock-pi 4B the ehci ports weren't working without your patch and they still don't work with your patch.
With my patch (v5, [1]) they worked, but with my patch and yours usb reset fails:
resetting USB...rockchip_usb2phy_port host-port: vbus disable failed: -13 rockchip_usb2phy_port host-port: PHY: Failed to power off host-port: -13.device_remove: Device 'usb@fe38 ' failed to remove, but children are gonerockchip_usb2phy_port host-port: vbus disable failed: -13 rockchip_usb2phy_port host-port: PHY: Failed to power off host-port: -13.device_remove: Device 'usb@fe3c0000' failed to remove, but children are gone Bus usb@fe380000: Bus usb@fe3c0000: Bus usb@fe800000: Register 2000140 NbrPorts 2 Starting the controller
USB XHCI 1.10
Bus usb@fe900000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb@fe380000 for devices... "Synchronous Abort" handler, esr 0x96000010
elr: 000000000021de20 lr : 000000000021de20 (reloc)
elr: 00000000f3f56e20 lr : 00000000f3f56e20
x0 : 0000000000000000 x1 : 00000000f1f19fef
x2 : 00000000f1f19fee x3 : 00000000f1f53bc0
x4 : 0000000000000000 x5 : 0000000000000000
x6 : 0000000000000000 x7 : 00000000f1f60000
x8 : 0000000000000100 x9 : 0000000000000008
x10: 0000000000000006 x11: 0000000000000080
x12: 000000000001869f x13: 000000000000869c
x14: 0000000000000000 x15: 0000000000000002
x16: 000000007e4f2113 x17: 000000009a11f13e
x18: 00000000f1f30d90 x19: 00000000f1f323c0
x20: 00000000f1f1a680 x21: 00000000f1f19fee
x22: 00000000f1f19fef x23: 0000000088404000
x24: 00000000f1f1a280 x25: 0000000000000001
x26: 00000000f1f1a680 x27: 00000000f1f1a0c0
x28: 0000000008400000 x29: 00000000f1f19f90
Code: aa0203f5 f944a413 aa1303e0 94003d8f (b9400401)
Resetting CPU ...
resetting ...
The apparent reason is that arch/arm/dts/rk3399-rock-pi-4.dtsi says
vcc5v0_host: vcc5v0-host-regulator {
compatible = "regulator-fixed";
enable-active-high;
gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&vcc5v0_host_en>;
regulator-name = "vcc5v0_host";/*****/ regulator-always-on; /*****/
vin-supply = <&vcc5v0_sys>;
};
[...]
&u2phy0 {
status = "okay";
u2phy0_otg: otg-port {
status = "okay";
};
u2phy0_host: host-port {
phy-supply = <&vcc5v0_host>;
status = "okay";
};
};&u2phy1 {
status = "okay";
u2phy1_otg: otg-port {
status = "okay";
};
u2phy1_host: host-port {
phy-supply = <&vcc5v0_host>;
status = "okay";
};
};and the regulator_set_enable() in regulator-uclass.c when passed enable==0 will return -EACCES (meaning you can't turn off an always-on regulator).
Now my patch is not accepted, so EHCI isn't working on Rock-pi-4, so the error won't show.
But I suspect it may bite if v5 is ever accepted. And I think it would fail if EHCI is fixed in any other way. I may try my v1, v2 or v3 with your patch if you think it's worth it.
Now I don't know what the right solution is :
- ignore -EACCES in rockchip_usb2phy_power_off() (as above, seems easiest?)
- check always_on in rockchip_usb2phy_power_off() before calling regulator_set_enable()
- change .dts (but they come from linux, don't they?)
- make sure somehow that things don't break even if rockchip_usb2phy_power_off() exits early with error.
Btw, my v5 seems not to be correctly in patchwork, should I resend ? I guess I messed up subject lines ?
I think there are other rk3399 boards that have similar .dtsi files, but I haven't investigated thoroughly. Do they all have broken EHCI ? If someone has a rk3399 board with working EHCI maybe they should test your patch and try usb start ; usb stop and usb start ; usb reset ?
[1] https://lists.denx.de/pipermail/u-boot/2023-February/510672.html
Thanks,
--
Xavier Drudis Ferran
Re: [PATCH 2/3] phy: rockchip-inno-usb2: add initial support for rk3588 PHY
Quoted 14 lines · Xavier Drudis Ferran
El Fri, Mar 03, 2023 at 09:31:33AM +0200, Eugen Hristev deia:
drivers/phy/rockchip/phy-rockchip-inno-usb2.c static int rockchip_usb2phy_power_off(struct phy *phy) · line 139
Quoted 11 lines
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +7
-0@@ -105,6 +130,17 @@ static int rockchip_usb2phy_power_off(struct phy *phy)struct udevice *parent =dev_get_parent (phy->dev);struct rockchip_usb2phy *priv =dev_get_priv (parent);const struct rockchip_usb2phy_port_cfg *port_cfg =us2phy_get_port (phy); +struct udevice *vbus =NULL ; +int ret; + + vbus =rockchip_usb2phy_check_vbus (phy); +if (vbus) { + ret =regulator_set_enable (vbus, false); +if (ret) {Could we have
Quoted 3 lines
if (ret && ret != -EACCES ) {instead here ?
(reason below)
Hi,
I have nothing against it, the regulator should be all the way optional IMO
Quoted 70 lines
drivers/phy/rockchip/phy-rockchip-inno-usb2.c static int rockchip_usb2phy_power_off(struct phy *phy) · line 146
Quoted 8 lines
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +4
-0+dev_err (phy->dev,"vbus disable failed: %d\n" , ret); +return ret; + } + }property_enable (priv->reg_base, &port_cfg->phy_sus, true);Thank you.
I've tested a little your patch (on an older master,
4eb7c5030d3f3c70(2023-02-19) and some minor config changes that don't seem to matter). I could try on current master if needed, but I thought I'd ask already.In a Rock-pi 4B the ehci ports weren't working without your patch and they still don't work with your patch.
With my patch (v5, [1]) they worked, but with my patch and yours usb reset fails:
resetting USB...
rockchip_usb2phy_porthost-port: vbus disable failed: -13rockchip_usb2phy_porthost-port: PHY: Failed to power off host-port: -13.device_remove: Device 'usb@fe38 ' failed to remove, but children are gonerockchip_usb2phy_porthost-port: vbus disable failed: -13rockchip_usb2phy_porthost-port: PHY: Failed to power off host-port: -13.device_remove: Device 'usb@fe3c0000' failed to remove, but children are gone Bus usb@fe380000: Bus usb@fe3c0000: Bus usb@fe800000: Register 2000140 NbrPorts 2 Starting the controller
USB XHCI 1.10
Bus usb@fe900000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb@fe380000 for devices... "Synchronous Abort" handler, esr0x96000010
elr:000000000021de20lr :000000000021de20(reloc)
elr:00000000f3f56e20lr :00000000f3f56e20
x0 : 0000000000000000 x1 :00000000f1f19fef
x2 :00000000f1f19feex3 :00000000f1f53bc0
x4 : 0000000000000000 x5 : 0000000000000000
x6 : 0000000000000000 x7 :00000000f1f60000
x8 : 0000000000000100 x9 : 0000000000000008
x10: 0000000000000006 x11: 0000000000000080
x12:000000000001869fx13:000000000000869c
x14: 0000000000000000 x15: 0000000000000002
x16:000000007e4f2113x17:000000009a11f13e
x18:00000000f1f30d90x19:00000000f1f323c0
x20:00000000f1f1a680x21:00000000f1f19fee
x22:00000000f1f19fefx23: 0000000088404000
x24:00000000f1f1a280x25: 0000000000000001
x26:00000000f1f1a680x27:00000000f1f1a0c0
x28: 0000000008400000 x29:00000000f1f19f90Code: aa0203f5 f944a413 aa1303e0 94003d8f (b9400401)Resetting CPU ...
resetting ...
The apparent reason is that
arch/arm/dts/rk3399-rock-pi-4.dtsisaysvcc5v0_host: vcc5v0-host-regulator { compatible = "regulator-fixed"; enable-active-high; gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; pinctrl-names = "default"; pinctrl-0 = <&vcc5v0_host_en>; regulator-name = "vcc5v0_host";
Quoted 1 line
/*****/ regulator-always-on; /*****/
Pretty weird that a regulator that can be turned on/off via a GPIO is 'regulator-always-on'. I find this odd and i think it's not correctly described at DT level.
Quoted 31 lines
vin-supply = <&vcc5v0_sys>; }; [...] &u2phy0 { status = "okay"; u2phy0_otg: otg-port { status = "okay"; }; u2phy0_host: host-port { phy-supply = <&vcc5v0_host>; status = "okay"; }; };&u2phy1 { status = "okay"; u2phy1_otg: otg-port { status = "okay"; }; u2phy1_host: host-port { phy-supply = <&vcc5v0_host>; status = "okay"; }; };
Quoted 2 lines
and the
regulator_set_enable()inregulator-uclass.cwhen passed enable==0 will return-EACCES(meaning you can't turn off an always-on regulator).
Anyway, maybe we should move on even if we can't disable the regulator in any case ? We should just dev_err and continue ?
Kever, do you have any preference ?
Eugen
Quoted 33 lines
Now my patch is not accepted, so EHCI isn't working on Rock-pi-4, so the error won't show.
But I suspect it may bite if v5 is ever accepted. And I think it would fail if EHCI is fixed in any other way. I may try my v1, v2 or v3 with your patch if you think it's worth it.
Now I don't know what the right solution is :
- ignore
-EACCESinrockchip_usb2phy_power_off()(as above, seems easiest?)- check
always_oninrockchip_usb2phy_power_off()before callingregulator_set_enable()- change .dts (but they come from linux, don't they?)
- make sure somehow that things don't break even if
rockchip_usb2phy_power_off()exits early with error.Btw, my v5 seems not to be correctly in patchwork, should I resend ? I guess I messed up subject lines ?
I think there are other rk3399 boards that have similar .dtsi files, but I haven't investigated thoroughly. Do they all have broken EHCI ? If someone has a rk3399 board with working EHCI maybe they should test your patch and try usb start ; usb stop and usb start ; usb reset ?
[1] https://lists.denx.de/pipermail/u-boot/2023-February/510672.html
Thanks,
--
Xavier Drudis Ferran
Re: [PATCH 2/3] phy: rockchip-inno-usb2: add initial support for rk3588 PHY
El Wed, Mar 08, 2023 at 01:59:54PM +0200, Eugen Hristev deia:
Quoted 18 lines · Xavier Drudis Ferran
Quoted 14 lines
El Fri, Mar 03, 2023 at 09:31:33AM +0200, Eugen Hristev deia:
drivers/phy/rockchip/phy-rockchip-inno-usb2.c static int rockchip_usb2phy_power_off(struct phy *phy) · line 139
Quoted 11 lines
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +7
-0@@ -105,6 +130,17 @@ static int rockchip_usb2phy_power_off(struct phy *phy)struct udevice *parent =dev_get_parent (phy->dev);struct rockchip_usb2phy *priv =dev_get_priv (parent);const struct rockchip_usb2phy_port_cfg *port_cfg =us2phy_get_port (phy); +struct udevice *vbus =NULL ; +int ret; + + vbus =rockchip_usb2phy_check_vbus (phy); +if (vbus) { + ret =regulator_set_enable (vbus, false); +if (ret) {Could we have
Quoted 3 lines
if (ret && ret != -EACCES ) {instead here ?
(reason below)
Quoted 4 lines
Hi,
I have nothing against it, the regulator should be all the way optional IMO
Well, at least if it is always-on for whatever reason, then it is not an error that it cannot be turned off.
Quoted 11 lines
Quoted 11 lines
The apparent reason is that
arch/arm/dts/rk3399-rock-pi-4.dtsisaysvcc5v0_host: vcc5v0-host-regulator { compatible = "regulator-fixed"; enable-active-high; gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; pinctrl-names = "default"; pinctrl-0 = <&vcc5v0_host_en>; regulator-name = "vcc5v0_host";
Quoted 6 lines
Quoted 1 line
/*****/ regulator-always-on; /*****/
Pretty weird that a regulator that can be turned on/off via a GPIO is 'regulator-always-on'. I find this odd and i think it's not correctly described at DT level.
I don't know enough to tell. I've just looked a little and it seems to be used for USB only (on rock pi 4, firefly, eaidk-610, khadas-edge, leez-p710, nanopc-t4, orangepi, puma, rock960, rockpro64)
Curiously rk3399-evb does NOT have regulator-always-on in vcc5v0_host
and roc-pc seems to add it in u-boot.dtsi only, since it was preserved at some u-boot - linux sync.
pinebook-pro has regulator-always-on, but then has regulator-state-mem, regulator-off-in-suspend...
Quoted 4 lines
Anyway, maybe we should move on even if we can't disable the regulator in any case ? We should just
dev_errand continue ?
dev_err or not dev_err depends on whether always-on is always a bug there or may be a feature, I don't know. But moving on would be nice, yes.
Quoted 3 lines
Kever, do you have any preference ?
Eugen
Thanks
Re: [PATCH 2/3] phy: rockchip-inno-usb2: add initial support for rk3588 PHY
Quoted 58 lines · Xavier Drudis Ferran
El Wed, Mar 08, 2023 at 01:59:54PM +0200, Eugen Hristev deia:
Quoted 18 lines · Xavier Drudis Ferran
Quoted 14 lines
El Fri, Mar 03, 2023 at 09:31:33AM +0200, Eugen Hristev deia:
drivers/phy/rockchip/phy-rockchip-inno-usb2.c static int rockchip_usb2phy_power_off(struct phy *phy) · line 139
Quoted 11 lines
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +7
-0@@ -105,6 +130,17 @@ static int rockchip_usb2phy_power_off(struct phy *phy)struct udevice *parent =dev_get_parent (phy->dev);struct rockchip_usb2phy *priv =dev_get_priv (parent);const struct rockchip_usb2phy_port_cfg *port_cfg =us2phy_get_port (phy); +struct udevice *vbus =NULL ; +int ret; + + vbus =rockchip_usb2phy_check_vbus (phy); +if (vbus) { + ret =regulator_set_enable (vbus, false); +if (ret) {Could we have
Quoted 3 lines
if (ret && ret != -EACCES ) {instead here ?
(reason below)Quoted 4 lines
Hi,
I have nothing against it, the regulator should be all the way optional IMO
Well, at least if it is always-on for whatever reason, then it is not an error that it cannot be turned off.
Quoted 11 lines
Quoted 11 lines
The apparent reason is that
arch/arm/dts/rk3399-rock-pi-4.dtsisaysvcc5v0_host: vcc5v0-host-regulator { compatible = "regulator-fixed"; enable-active-high; gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; pinctrl-names = "default"; pinctrl-0 = <&vcc5v0_host_en>; regulator-name = "vcc5v0_host";Quoted 6 lines
Quoted 1 line
/*****/ regulator-always-on; /*****/
Pretty weird that a regulator that can be turned on/off via a GPIO is 'regulator-always-on'. I find this odd and i think it's not correctly described at DT level.
I don't know enough to tell. I've just looked a little and it seems to be used for USB only (on rock pi 4, firefly, eaidk-610, khadas-edge, leez-p710, nanopc-t4, orangepi, puma, rock960, rockpro64)
Curiously rk3399-evb does NOT have regulator-always-on in
vcc5v0_hostand roc-pc seems to add it in
u-boot.dtsionly, since it was preserved at some u-boot - linux sync.pinebook-pro has regulator-always-on, but then has regulator-state-mem, regulator-off-in-suspend...
Quoted 1 line
Quoted 6 lines
Quoted 3 lines
Anyway, maybe we should move on even if we can't disable the regulator in any case ? We should just
dev_errand continue ?
dev_error notdev_errdepends on whether always-on is always a bug there or may be a feature, I don't know. But moving on would be nice, yes.
Have you tested your case with
if (ret && ret != -EACCES ) {
and it solves your usb reset problem ?
Quoted 6 lines
Quoted 4 lines
Kever, do you have any preference ?
Eugen
Thanks
PATCH 3/3 configs: rockchip: rock5b-rk3588: enable USB and regulators
In reply to Eugen HristevEnable USB command, USB drivers, PHY and regulators, for USB host operations.
--- configs/rock5b-rk3588_defconfig | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
configs/rock5b-rk3588_defconfig +17 -1
@@ -41,12 +41,13 @@ CONFIG_SPL_STACK_R=y CONFIG_SPL_ATF=y CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y +CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set +CONFIG_CMD_REGULATOR=y # CONFIG_SPL_DOS_PARTITION is not set CONFIG_SPL_OF_CONTROL=y CONFIG_OF_LIVE=y CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" -CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_REGMAP=y CONFIG_SPL_SYSCON=y CONFIG_SPL_CLK=y
@@ -61,11 +62,26 @@ CONFIG_MMC_SDHCI_SDMA=y CONFIG_MMC_SDHCI_ROCKCHIP=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y +CONFIG_PHY_ROCKCHIP_INNO_USB2=y CONFIG_REGULATOR_PWM=y +CONFIG_DM_REGULATOR_FIXED=y CONFIG_PWM_ROCKCHIP=y CONFIG_SPL_RAM=y CONFIG_BAUDRATE=1500000 CONFIG_DEBUG_UART_SHIFT=2 CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_SYSRESET=y +CONFIG_USB=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_GENERIC=y +CONFIG_USB_OHCI_HCD=y +CONFIG_USB_OHCI_GENERIC=y +CONFIG_USB_HOST_ETHER=y +CONFIG_USB_ETHER_ASIX=y +CONFIG_USB_ETHER_ASIX88179=y +CONFIG_USB_ETHER_LAN75XX=y +CONFIG_USB_ETHER_LAN78XX=y +CONFIG_USB_ETHER_MCS7830=y +CONFIG_USB_ETHER_RTL8152=y +CONFIG_USB_ETHER_SMSC95XX=y CONFIG_ERRNO_STR=y
Signature · 1 line
2.34.1
Re: [PATCH 3/3] configs: rockchip: rock5b-rk3588: enable USB and regulators
Quoted 4 lines · Eugen Hristev
Enable USB command, USB drivers, PHY and regulators, for USB host operations.
Signed-off-by Eugen Hristev <[email protected]>
Thanks,
- Kever
Quoted 50 lines
--- configs/rock5b-rk3588_defconfig | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)configs/rock5b-rk3588_defconfig +17
-1@@ -41,12 +41,13 @@ CONFIG_SPL_STACK_R=y CONFIG_SPL_ATF=y CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y +CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set +CONFIG_CMD_REGULATOR=y # CONFIG_SPL_DOS_PARTITION is not set CONFIG_SPL_OF_CONTROL=y CONFIG_OF_LIVE=y CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" -CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_REGMAP=y CONFIG_SPL_SYSCON=y CONFIG_SPL_CLK=y@@ -61,11 +62,26 @@ CONFIG_MMC_SDHCI_SDMA=y CONFIG_MMC_SDHCI_ROCKCHIP=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y +CONFIG_PHY_ROCKCHIP_INNO_USB2=y CONFIG_REGULATOR_PWM=y +CONFIG_DM_REGULATOR_FIXED=y CONFIG_PWM_ROCKCHIP=y CONFIG_SPL_RAM=y CONFIG_BAUDRATE=1500000 CONFIG_DEBUG_UART_SHIFT=2 CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_SYSRESET=y +CONFIG_USB=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_GENERIC=y +CONFIG_USB_OHCI_HCD=y +CONFIG_USB_OHCI_GENERIC=y +CONFIG_USB_HOST_ETHER=y +CONFIG_USB_ETHER_ASIX=y +CONFIG_USB_ETHER_ASIX88179=y +CONFIG_USB_ETHER_LAN75XX=y +CONFIG_USB_ETHER_LAN78XX=y +CONFIG_USB_ETHER_MCS7830=y +CONFIG_USB_ETHER_RTL8152=y +CONFIG_USB_ETHER_SMSC95XX=y CONFIG_ERRNO_STR=y
Quoted 5 lines · Eugen Hristev
Add USB 2.0 host nodes and PHYs.
Co-developed-by William Wu <[email protected]>Signed-off-by William Wu <[email protected]>Signed-off-by Eugen Hristev <[email protected]>
Thanks,
- Kever
Quoted 195 lines
--- arch/arm/dts/rk3588-rock-5b-u-boot.dtsi | 169 ++++++++++++++++++++++++ 1 file changed, 169 insertions(+)arch/arm/dts/rk3588-rock-5b-u-boot.dtsi +169
-0@@ -4,6 +4,9 @@ */ #include "rk3588-u-boot.dtsi" +#include <dt-bindings/pinctrl/rockchip.h> +#include <dt-bindings/input/input.h> +#include <dt-bindings/gpio/gpio.h> / { aliases {@@ -13,6 +16,105 @@ chosen { u-boot,spl-boot-order = &sdmmc; }; + + vcc5v0_host: vcc5v0-host-regulator { + u-boot,dm-pre-reloc; + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_host"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_host_en>; + vin-supply = <&vcc5v0_sys>; + }; + + usb_host0_ehci: usb@fc800000 { + compatible = "generic-ehci"; + reg = <0x0 0xfc800000 0x0 0x40000>; + interrupts = <GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&cru HCLK_HOST0>, <&cru HCLK_HOST_ARB0>; + clock-names = "usbhost", "arbiter"; + power-domains = <&power RK3588_PD_USB>; + status = "disabled"; + }; + + usb_host0_ohci: usb@fc840000 { + compatible = "generic-ohci"; + reg = <0x0 0xfc840000 0x0 0x40000>; + interrupts = <GIC_SPI 216 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&cru HCLK_HOST0>, <&cru HCLK_HOST_ARB0>; + clock-names = "usbhost", "arbiter"; + power-domains = <&power RK3588_PD_USB>; + status = "disabled"; + }; + + usb_host1_ehci: usb@fc880000 { + compatible = "generic-ehci"; + reg = <0x0 0xfc880000 0x0 0x40000>; + interrupts = <GIC_SPI 218 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&cru HCLK_HOST1>, <&cru HCLK_HOST_ARB1>; + clock-names = "usbhost", "arbiter"; + power-domains = <&power RK3588_PD_USB>; + status = "disabled"; + }; + + usb_host1_ohci: usb@fc8c0000 { + compatible = "generic-ohci"; + reg = <0x0 0xfc8c0000 0x0 0x40000>; + interrupts = <GIC_SPI 219 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&cru HCLK_HOST1>, <&cru HCLK_HOST_ARB1>; + clock-names = "usbhost", "arbiter"; + power-domains = <&power RK3588_PD_USB>; + status = "disabled"; + }; + + usb2phy2_grf: syscon@fd5d8000 { + compatible = "rockchip,rk3588-usb2phy-grf", "syscon", + "simple-mfd"; + reg = <0x0 0xfd5d8000 0x0 0x4000>; + #address-cells = <1>; + #size-cells = <1>; + + u2phy2: usb2-phy@8000 { + compatible = "rockchip,rk3588-usb2phy"; + reg = <0x8000 0x10>; + interrupts = <GIC_SPI 391 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&cru CLK_USB2PHY_HDPTXRXPHY_REF>; + clock-names = "phyclk"; + #clock-cells = <0>; + status = "disabled"; + + u2phy2_host: host-port { + #phy-cells = <0>; + status = "disabled"; + }; + }; + }; + + usb2phy3_grf: syscon@fd5dc000 { + compatible = "rockchip,rk3588-usb2phy-grf", "syscon", + "simple-mfd"; + reg = <0x0 0xfd5dc000 0x0 0x4000>; + #address-cells = <1>; + #size-cells = <1>; + + u2phy3: usb2-phy@c000 { + compatible = "rockchip,rk3588-usb2phy"; + reg = <0xc000 0x10>; + interrupts = <GIC_SPI 392 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&cru CLK_USB2PHY_HDPTXRXPHY_REF>; + clock-names = "phyclk"; + #clock-cells = <0>; + status = "disabled"; + + u2phy3_host: host-port { + #phy-cells = <0>; + status = "disabled"; + }; + }; + }; }; &sdmmc {@@ -20,3 +122,70 @@ u-boot,dm-spl; status = "okay"; }; + +&pinctrl { + usb { + vcc5v0_host_en: vcc5v0-host-en { + rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&usb_host0_ehci { + companion = <&usb_host0_ohci>; + phys = <&u2phy2_host>; + phy-names = "usb2-phy"; + status = "okay"; +}; + +&usb_host0_ohci { + phys = <&u2phy2_host>; + phy-names = "usb2-phy"; + status = "okay"; +}; + +&usb2phy2_grf { + status = "okay"; +}; + +&u2phy2 { + resets = <&cru SRST_OTGPHY_U2_0>, <&cru SRST_P_USB2PHY_U2_0_GRF0>; + reset-names = "phy", "apb"; + clock-output-names = "usb480m_phy2"; + status = "okay"; +}; + +&u2phy2_host { + phy-supply = <&vcc5v0_host>; + status = "okay"; +}; + +&usb_host1_ehci { + companion = <&usb_host1_ohci>; + phys = <&u2phy3_host>; + phy-names = "usb2-phy"; + status = "okay"; +}; + +&usb_host1_ohci { + phys = <&u2phy3_host>; + phy-names = "usb2-phy"; + status = "okay"; +}; + +&usb2phy3_grf { + status = "okay"; +}; + +&u2phy3 { + resets = <&cru SRST_OTGPHY_U2_1>, <&cru SRST_P_USB2PHY_U2_1_GRF0>; + reset-names = "phy", "apb"; + clock-output-names = "usb480m_phy3"; + status = "okay"; +}; + +&u2phy3_host { + phy-supply = <&vcc5v0_host>; + status = "okay"; +}; +