Add Rockchip USBPHY DM driver
Subsystems (7)
v3 cover Add Rockchip USBPHY DM driver
The Rockchip SoCs with an USB node and compatible = "snps,dwc2" can be HOST or OTG while the PHY driver is hard coded and initiated in the board.c file. Above construction is not very U-boot DM alike. This is an attempt to decouple the USBPHY into a DM driver.
On older Rockchip SOCs an usbphy DT node is placed under a SYSCOM node.
grf: grf@20008000 {
usbphy: usbphy {
usbphy0: usb-phy@17c {
};
usbphy1: usb-phy@188 {
};
};
};The usbphy node does not show up in the DM tree to be found by the generic_phy_get_by_index() function. Only by manual transfer to the DT root is gets detected.
=> dm tree
Class Seq Probed Driver Name
-----------------------------------------------------------
root 0 [ + ] root_driver root_driver nop 1 [ + ] rockchip_usbphy |-- usbphy phy 0 [ + ] rockchip_usbphy_port | |-- usb-phy@17c phy 1 [ + ] rockchip_usbphy_port | `-- usb-phy@188
Changed V2:
Add grf function that binds the usbphy driver to the grf syscom driver.
=> dm tree
Class Seq Probed Driver Name
-----------------------------------------------------------
syscon 9 [ + ] rk3066_syscon |-- grf@20008000 nop 0 [ + ] rockchip_usbphy | `-- usbphy phy 0 [ + ] rockchip_usbphy_port | |-- usb-phy@17c phy 1 [ + ] rockchip_usbphy_port | `-- usb-phy@188
Changed V3:
rebase
compile rk3066 SPL with SPL_OF_REAL
add SCLK_OTGPHYx enable and disable
make drivers available in SPL
enable USB in SPL for MK808
Johan Jonker (12):
rockchip: configs: compile rk3066 SPL with SPL_OF_REAL
rockchip: clk: rk3066: add SCLK_OTGPHYx enable and disable
rockchip: clk: rk3188: add SCLK_OTGPHYx enable and disable
rockchip: clk: rk3288: add SCLK_OTGPHYx enable and disable
phy: rockchip: add phy-rockchip-usb2.c
usb: phy: remove rockchip_usb2_phy.c
rockchip: reset: make reset-rockchip available in SPL
rockchip: phy: make phy-rockchip-usb2 available in SPL
usb: make dwc2_usb available in SPL
rockchip: spl-boot-order: add usb boot option
arm: dts: rockchip: add USB required properties in SPL for mk808
rockchip: configs: enable USB in SPL for mk808
arch/arm/dts/rk3066a-mk808-u-boot.dtsi | 18 + arch/arm/mach-rockchip/board.c | 28 -- arch/arm/mach-rockchip/rk3066/syscon_rk3066.c | 26 ++ arch/arm/mach-rockchip/rk3188/syscon_rk3188.c | 27 ++ arch/arm/mach-rockchip/rk3288/syscon_rk3288.c | 27 ++ arch/arm/mach-rockchip/spl-boot-order.c | 3 + configs/chromebit_mickey_defconfig | 2 +- configs/chromebook_jerry_defconfig | 2 +- configs/chromebook_minnie_defconfig | 2 +- configs/chromebook_speedy_defconfig | 2 +- configs/evb-rk3288-rk808_defconfig | 2 +- configs/firefly-rk3288_defconfig | 4 +- configs/miqi-rk3288_defconfig | 4 +- configs/mk808_defconfig | 18 +- configs/phycore-rk3288_defconfig | 3 +- configs/popmetal-rk3288_defconfig | 3 +- configs/rock-pi-n8-rk3288_defconfig | 2 +- configs/rock2_defconfig | 3 +- configs/rock_defconfig | 3 +- configs/tinker-rk3288_defconfig | 4 +- configs/tinker-s-rk3288_defconfig | 4 +- configs/vyasa-rk3288_defconfig | 2 +- drivers/Makefile | 3 +- drivers/clk/rockchip/clk_rk3066.c | 12 + drivers/clk/rockchip/clk_rk3188.c | 34 ++ drivers/clk/rockchip/clk_rk3288.c | 40 ++ drivers/phy/rockchip/Kconfig | 38 +- drivers/phy/rockchip/Makefile | 5 +- drivers/phy/rockchip/phy-rockchip-usb2.c | 371 ++++++++++++++++++ drivers/reset/Kconfig | 9 + drivers/reset/Makefile | 4 +- drivers/usb/common/Makefile | 2 +- drivers/usb/host/Kconfig | 11 + drivers/usb/host/Makefile | 2 +- drivers/usb/phy/Kconfig | 3 - drivers/usb/phy/Makefile | 1 - drivers/usb/phy/rockchip_usb2_phy.c | 113 ------ include/usb/dwc2_udc.h | 1 - 38 files changed, 646 insertions(+), 192 deletions(-) create mode 100644 drivers/phy/rockchip/phy-rockchip-usb2.c delete mode 100644 drivers/usb/phy/rockchip_usb2_phy.c
--
2.39.5
PATCH v3 1/12 rockchip: configs: compile rk3066 SPL with SPL_OF_REAL
Unlike later Rockchip models the rk3066 SOC has no build-in support for SD/MMC cards in the boot phase. The current workaround in SPL probes the rockchip_dwmmc driver with OF_PLATDATA. For a simple board as MK808 with MMC that just works fine, but for more complex boot options not all required drivers come with OF_PLATDATA support, so compile rk3066 SPL with SPL_OF_REAL. Update mk808_defconfig.
--- configs/mk808_defconfig | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
configs/mk808_defconfig +3 -9
@@ -16,16 +16,17 @@ CONFIG_SF_DEFAULT_SPEED=20000000 CONFIG_ENV_SIZE=0x8000 CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3066a-mk808" CONFIG_DM_RESET=y +CONFIG_SPL_SYS_MALLOC_F_LEN=0x8000 CONFIG_ROCKCHIP_RK3066=y # CONFIG_ROCKCHIP_STIMER is not set CONFIG_TPL_TEXT_BASE=0x10080c00 CONFIG_TPL_STACK=0x1008FFFF +CONFIG_TPL_SYS_MALLOC_F_LEN=0x0800 CONFIG_TARGET_MK808=y CONFIG_SPL_STACK_R_ADDR=0x70000000 -CONFIG_SPL_STACK=0x1008ffff CONFIG_SPL_TEXT_BASE=0x60000000 CONFIG_SPL_STACK_R=y -CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x200000 +CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x300000 CONFIG_SYS_LOAD_ADDR=0x70800800 CONFIG_DEBUG_UART_BASE=0x20064000 CONFIG_DEBUG_UART_CLOCK=24000000
@@ -43,9 +44,6 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_BOARD_LATE_INIT=y CONFIG_SPL_MAX_SIZE=0x32000 CONFIG_SPL_NO_BSS_LIMIT=y -# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set -CONFIG_SPL_HAVE_INIT_STACK=y -CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_FS_EXT4=y CONFIG_SYS_MMCSD_FS_BOOT_PARTITION=2 CONFIG_TPL_HAVE_INIT_STACK=y
@@ -65,14 +63,10 @@ CONFIG_SPL_OF_CONTROL=y CONFIG_TPL_OF_CONTROL=y CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" CONFIG_OF_DTB_PROPS_REMOVE=y -CONFIG_SPL_OF_PLATDATA=y CONFIG_TPL_OF_PLATDATA=y CONFIG_ENV_RELOC_GD_ENV_ADDR=y CONFIG_NO_NET=y CONFIG_TPL_DM=y -CONFIG_REGMAP=y -CONFIG_SPL_REGMAP=y -CONFIG_TPL_REGMAP=y CONFIG_SYSCON=y CONFIG_SPL_SYSCON=y CONFIG_TPL_SYSCON=y
--
2.39.5
PATCH v3 2/12 rockchip: clk: rk3066: add SCLK_OTGPHYx enable and disable
In reply to Johan JonkerAdd rk3066 SCLK_OTGPHYx enable and disable.
---
GATE(SCLK_OTGPHY0, "sclk_otgphy0", "xin24m", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(1), 5, GFLAGS), GATE(SCLK_OTGPHY1, "sclk_otgphy1", "xin24m", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(1), 6, GFLAGS), --- drivers/clk/rockchip/clk_rk3066.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/clk/rockchip/clk_rk3066.c +12 -0
@@ -592,6 +592,12 @@ static int rk3066_clk_enable(struct clk *clk)struct rk3066_clk_priv *priv =dev_get_priv (clk->dev);switch (clk->id) { +case SCLK_OTGPHY0 : +rk_clrreg (&priv->cru->cru_clkgate_con[1 ],BIT (5 )); +break ; +case SCLK_OTGPHY1 : +rk_clrreg (&priv->cru->cru_clkgate_con[1 ],BIT (6 )); +break ;case HCLK_NANDC0 :rk_clrreg (&priv->cru->cru_clkgate_con[5 ],BIT (9 ));break ;
@@ -611,6 +617,12 @@ static int rk3066_clk_disable(struct clk *clk)struct rk3066_clk_priv *priv =dev_get_priv (clk->dev);switch (clk->id) { +case SCLK_OTGPHY0 : +rk_setreg (&priv->cru->cru_clkgate_con[1 ],BIT (5 )); +break ; +case SCLK_OTGPHY1 : +rk_setreg (&priv->cru->cru_clkgate_con[1 ],BIT (6 )); +break ;case HCLK_NANDC0 :rk_setreg (&priv->cru->cru_clkgate_con[5 ],BIT (9 ));break ;
--
2.39.5
PATCH v3 3/12 rockchip: clk: rk3188: add SCLK_OTGPHYx enable and disable
In reply to Johan JonkerAdd rk3188 SCLK_OTGPHYx enable and disable.
---
GATE(SCLK_OTGPHY0, "sclk_otgphy0", "xin24m", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(1), 5, GFLAGS), GATE(SCLK_OTGPHY1, "sclk_otgphy1", "xin24m", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(1), 6, GFLAGS), --- drivers/clk/rockchip/clk_rk3188.c | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
drivers/clk/rockchip/clk_rk3188.c +34 -0
@@ -531,7 +531,41 @@ static ulong rk3188_clk_set_rate(struct clk *clk, ulong rate)return new_rate; } +static int rk3188_clk_enable (struct clk *clk) +{ +struct rk3188_clk_priv *priv =dev_get_priv (clk->dev); + +switch (clk->id) { +case SCLK_OTGPHY0 : +rk_clrreg (&priv->cru->cru_clkgate_con[1 ],BIT (5 )); +break ; +case SCLK_OTGPHY1 : +rk_clrreg (&priv->cru->cru_clkgate_con[1 ],BIT (6 )); +break ; + } + +return 0 ; +} + +static int rk3188_clk_disable (struct clk *clk) +{ +struct rk3188_clk_priv *priv =dev_get_priv (clk->dev); + +switch (clk->id) { +case SCLK_OTGPHY0 : +rk_setreg (&priv->cru->cru_clkgate_con[1 ],BIT (5 )); +break ; +case SCLK_OTGPHY1 : +rk_setreg (&priv->cru->cru_clkgate_con[1 ],BIT (6 )); +break ; + } + +return 0 ; +} +static struct clk_ops rk3188_clk_ops = { + .disable = rk3188_clk_disable, + .enable = rk3188_clk_enable, .get_rate = rk3188_clk_get_rate, .set_rate = rk3188_clk_set_rate, };
--
2.39.5
PATCH v3 4/12 rockchip: clk: rk3288: add SCLK_OTGPHYx enable and disable
In reply to Johan JonkerAdd rk3288 SCLK_OTGPHYx enable and disable.
---
GATE(SCLK_OTGPHY0, "sclk_otgphy0", "xin24m", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(13), 4, GFLAGS), GATE(SCLK_OTGPHY1, "sclk_otgphy1", "xin24m", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(13), 5, GFLAGS), GATE(SCLK_OTGPHY2, "sclk_otgphy2", "xin24m", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(13), 6, GFLAGS), --- drivers/clk/rockchip/clk_rk3288.c | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
drivers/clk/rockchip/clk_rk3288.c +40 -0
@@ -946,7 +946,47 @@ static int __maybe_unused rk3288_clk_set_parent(struct clk *clk, struct clk *parreturn -ENOENT ; } +static int rk3288_clk_enable (struct clk *clk) +{ +struct rk3288_clk_priv *priv =dev_get_priv (clk->dev); + +switch (clk->id) { +case SCLK_OTGPHY0 : +rk_clrreg (&priv->cru->cru_clkgate_con[13 ],BIT (4 )); +break ; +case SCLK_OTGPHY1 : +rk_clrreg (&priv->cru->cru_clkgate_con[13 ],BIT (5 )); +break ; +case SCLK_OTGPHY2 : +rk_clrreg (&priv->cru->cru_clkgate_con[13 ],BIT (6 )); +break ; + } + +return 0 ; +} + +static int rk3288_clk_disable (struct clk *clk) +{ +struct rk3288_clk_priv *priv =dev_get_priv (clk->dev); + +switch (clk->id) { +case SCLK_OTGPHY0 : +rk_setreg (&priv->cru->cru_clkgate_con[13 ],BIT (4 )); +break ; +case SCLK_OTGPHY1 : +rk_setreg (&priv->cru->cru_clkgate_con[13 ],BIT (5 )); +break ; +case SCLK_OTGPHY2 : +rk_setreg (&priv->cru->cru_clkgate_con[13 ],BIT (6 )); +break ; + } + +return 0 ; +} +static struct clk_ops rk3288_clk_ops = { + .disable = rk3288_clk_disable, + .enable = rk3288_clk_enable, .get_rate = rk3288_clk_get_rate, .set_rate = rk3288_clk_set_rate, #if CONFIG_IS_ENABLED(OF_REAL)
--
2.39.5
PATCH v3 5/12 phy: rockchip: add phy-rockchip-usb2.c
In reply to Johan JonkerAdd phy-rockchip-usb2.c driver with support
for RK3066, RK3188 and RK3288 pdata.
---
Changed V2:
add DM_FLAG_PROBE_AFTER_BIND
restyle
--- drivers/phy/rockchip/Kconfig | 28 +- drivers/phy/rockchip/Makefile | 5 +- drivers/phy/rockchip/phy-rockchip-usb2.c | 371 +++++++++++++++++++++++ 3 files changed, 392 insertions(+), 12 deletions(-) create mode 100644 drivers/phy/rockchip/phy-rockchip-usb2.c
drivers/phy/rockchip/Kconfig +18 -10
@@ -27,7 +27,7 @@ config PHY_ROCKCHIP_INNO_USB2 Support for Rockchip USB2.0 PHY with Innosilicon IP block. config PHY_ROCKCHIP_NANENG_COMBOPHY - bool "Support Rockchip NANENG combo PHY Driver" + bool "Rockchip NANENG combo PHY Driver" depends on ARCH_ROCKCHIP select PHY help
@@ -41,26 +41,34 @@ config PHY_ROCKCHIP_PCIE Enable this to support the Rockchip PCIe PHY. config PHY_ROCKCHIP_SNPS_PCIE3 - bool "Rockchip Snps PCIe3 PHY Driver" - depends on PHY && ARCH_ROCKCHIP + bool "Rockchip SNPS PCIe3 PHY Driver" + depends on ARCH_ROCKCHIP + select PHY help Support for Rockchip PCIe3 PHY with Synopsys IP block. It could support PCIe Gen3 single root complex, and could also be able splited into multiple combinations of lanes. -config PHY_ROCKCHIP_USBDP - tristate "Rockchip USBDP COMBO PHY Driver" +config PHY_ROCKCHIP_TYPEC + bool "Rockchip TYPEC PHY Driver" depends on ARCH_ROCKCHIP select PHY help - Enable this to support the Rockchip USB3.0/DP - combo PHY with Samsung IP block. + Enable this to support the Rockchip USB TYPEC PHY. -config PHY_ROCKCHIP_TYPEC - bool "Rockchip TYPEC PHY Driver" +config PHY_ROCKCHIP_USB2 + bool "Rockchip USB2 PHY" depends on ARCH_ROCKCHIP select PHY help - Enable this to support the Rockchip USB TYPEC PHY. + Support for Rockchip USB 2.0 PHY. + +config PHY_ROCKCHIP_USBDP + tristate "Rockchip USBDP COMBO PHY Driver" + depends on ARCH_ROCKCHIP + select PHY + help + Enable this to support the Rockchip USB3.0/DP + combo PHY with Samsung IP block. endmenu
drivers/phy/rockchip/Makefile +3 -2
@@ -3,11 +3,12 @@ # Copyright (C) 2020 Amarula Solutions(India) # +obj-$(CONFIG_PHY_ROCKCHIP_INNO_DSIDPHY) += phy-rockchip-inno-dsidphy.o obj-$(CONFIG_PHY_ROCKCHIP_INNO_HDMI) += phy-rockchip-inno-hdmi.o obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB2) += phy-rockchip-inno-usb2.o obj-$(CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY) += phy-rockchip-naneng-combphy.o obj-$(CONFIG_PHY_ROCKCHIP_PCIE) += phy-rockchip-pcie.o obj-$(CONFIG_PHY_ROCKCHIP_SNPS_PCIE3) += phy-rockchip-snps-pcie3.o obj-$(CONFIG_PHY_ROCKCHIP_TYPEC) += phy-rockchip-typec.o -obj-$(CONFIG_PHY_ROCKCHIP_INNO_DSIDPHY) += phy-rockchip-inno-dsidphy.o -obj-$(CONFIG_PHY_ROCKCHIP_USBDP) += phy-rockchip-usbdp.o +obj-$(CONFIG_PHY_ROCKCHIP_USB2) += phy-rockchip-usb2.o +obj-$(CONFIG_PHY_ROCKCHIP_USBDP) += phy-rockchip-usbdp.o
drivers/phy/rockchip/phy-rockchip-usb2.c new file +371 -0
371 lines not on this page · raw message
--
2.39.5
Re: [PATCH v3 05/12] phy: rockchip: add phy-rockchip-usb2.c
Hi Johan,
Quoted 61 lines · Johan Jonker
Add
phy-rockchip-usb2.cdriver with support
for RK3066, RK3188 and RK3288 pdata.Signed-off-by Johan Jonker <[email protected]>---
Changed V2:
addDM_FLAG_PROBE_AFTER_BIND
restyle--- drivers/phy/rockchip/Kconfig | 28 +- drivers/phy/rockchip/Makefile | 5 +- drivers/phy/rockchip/phy-rockchip-usb2.c | 371 +++++++++++++++++++++++ 3 files changed, 392 insertions(+), 12 deletions(-) create mode 100644 drivers/phy/rockchip/phy-rockchip-usb2.cdrivers/phy/rockchip/Kconfig +9
-9@@ -27,7 +27,7 @@ config PHY_ROCKCHIP_INNO_USB2 Support for Rockchip USB2.0 PHY with Innosilicon IP block. config PHY_ROCKCHIP_NANENG_COMBOPHY - bool "Support Rockchip NANENG combo PHY Driver" + bool "Rockchip NANENG combo PHY Driver" depends on ARCH_ROCKCHIP select PHY help@@ -41,26 +41,34 @@ config PHY_ROCKCHIP_PCIE Enable this to support the Rockchip PCIe PHY. config PHY_ROCKCHIP_SNPS_PCIE3 - bool "Rockchip Snps PCIe3 PHY Driver" - depends on PHY && ARCH_ROCKCHIP + bool "Rockchip SNPS PCIe3 PHY Driver" + depends on ARCH_ROCKCHIP + select PHY help Support for Rockchip PCIe3 PHY with Synopsys IP block. It could support PCIe Gen3 single root complex, and could also be able splited into multiple combinations of lanes. -config PHY_ROCKCHIP_USBDP - tristate "Rockchip USBDP COMBO PHY Driver" +config PHY_ROCKCHIP_TYPEC + bool "Rockchip TYPEC PHY Driver" depends on ARCH_ROCKCHIP select PHY help - Enable this to support the Rockchip USB3.0/DP - combo PHY with Samsung IP block. + Enable this to support the Rockchip USB TYPEC PHY. -config PHY_ROCKCHIP_TYPEC - bool "Rockchip TYPEC PHY Driver" +config PHY_ROCKCHIP_USB2 + bool "Rockchip USB2 PHY" depends on ARCH_ROCKCHIP select PHY help
drivers/phy/rockchip/Kconfig config PHY_ROCKCHIP_PCIE · line 72
Quoted 10 lines
drivers/phy/rockchip/Kconfig +9
-1- Enable this to support the Rockchip USB TYPEC PHY. + Support for Rockchip USB 2.0 PHY. + +config PHY_ROCKCHIP_USBDP + tristate "Rockchip USBDP COMBO PHY Driver" + depends on ARCH_ROCKCHIP + select PHY + help + Enable this to support the Rockchip USB3.0/DP + combo PHY with Samsung IP block.
Please do the reorder and style change in a separate patch, this patch should just add the new phy driver.
Quoted 11 lines
drivers/phy/rockchip/Kconfig +0
-0endmenudrivers/phy/rockchip/Makefile +1
-0@@ -3,11 +3,12 @@ # Copyright (C) 2020 Amarula Solutions(India) # +obj-$(CONFIG_PHY_ROCKCHIP_INNO_DSIDPHY) += phy-rockchip-inno-dsidphy.o
drivers/phy/rockchip/Makefile line 14
Quoted 10 lines
drivers/phy/rockchip/Makefile +2
-2obj-$(CONFIG_PHY_ROCKCHIP_INNO_HDMI) += phy-rockchip-inno-hdmi.o obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB2) += phy-rockchip-inno-usb2.o obj-$(CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY) += phy-rockchip-naneng-combphy.o obj-$(CONFIG_PHY_ROCKCHIP_PCIE) += phy-rockchip-pcie.o obj-$(CONFIG_PHY_ROCKCHIP_SNPS_PCIE3) += phy-rockchip-snps-pcie3.o obj-$(CONFIG_PHY_ROCKCHIP_TYPEC) += phy-rockchip-typec.o -obj-$(CONFIG_PHY_ROCKCHIP_INNO_DSIDPHY) += phy-rockchip-inno-dsidphy.o -obj-$(CONFIG_PHY_ROCKCHIP_USBDP) += phy-rockchip-usbdp.o +obj-$(CONFIG_PHY_ROCKCHIP_USB2) += phy-rockchip-usb2.o +obj-$(CONFIG_PHY_ROCKCHIP_USBDP) += phy-rockchip-usbdp.o
Same here, could possible be in same Kconfig reorder patch.
Quoted 9 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +3
-0@@ -0,0 +1,371 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include <clk.h>
drivers/phy/rockchip/phy-rockchip-usb2.c line 13
Quoted 10 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +10
-0+#include <dm.h> +#include <dm/device.h> +#include <dm/lists.h> +#include <generic-phy.h> +#include <power/regulator.h> +#include <regmap.h> +#include <reset.h> +#include <syscon.h> + +DECLARE_GLOBAL_DATA_PTR ;
global data, gd->, is or should not be used in this file.
Quoted 29 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +29
-0+ +#define BIT_WRITEABLE_SHIFT 16 +#define usleep_range (a, b) udelay((b)) + +struct usbphy_reg { +unsigned int offset; +unsigned int bitend; +unsigned int bitstart; +unsigned int disable; +unsigned int enable; +}; + +struct rockchip_usbphy_port_cfg { +int num_phys; +struct usbphy_reg port_reset; +struct usbphy_reg soft_con; +struct usbphy_reg suspend; +}; + +struct rockchip_usb_phy { +ofnode node; +unsigned int reg; +struct clk clock; +struct reset_ctl reset; +struct udevice *vbus_supply; +}; + +struct rockchip_usbphy_priv { +struct device *dev;
drivers/phy/rockchip/phy-rockchip-usb2.c line 52
Quoted 10 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +10
-0+struct regmap *grf_regmap; +const struct rockchip_usbphy_port_cfg *port_cfg; +struct rockchip_usb_phy *usb_phy; +}; + +static void rockchip_usbphy_property_enable (struct phy *phy,const struct usbphy_reg *reg,bool en) +{ +struct udevice *parent = phy->dev->parent; +struct rockchip_usbphy_priv *priv =dev_get_priv (parent); +unsigned int val, mask, tmp;
Please add something like following to protect against a blank struct usbphy_reg.
if (!reg->offset && !reg->enable && !reg->disable) return;
drivers/phy/rockchip/phy-rockchip-usb2.c line 65
Quoted 13 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +13
-0+ + tmp = en ? reg->enable : reg->disable; + mask =GENMASK (reg->bitend, reg->bitstart); + val = (tmp << reg->bitstart) | (mask <<BIT_WRITEABLE_SHIFT ); + +regmap_write (priv->grf_regmap, + priv->usb_phy[phy->id].reg + reg->offset, val); +} + +static const struct rockchip_usbphy_port_cfg *rockchip_usbphy_get_port_cfg (struct phy *phy) +{ +struct udevice *parent = phy->dev->parent; +struct rockchip_usbphy_priv *priv =dev_get_priv (parent);
Please do not use same strange setup as inno-usb2 phy driver, bind priv data to the phy port device, not its parent device. There is really no need for this port_cfg[phy-id] dance, keep each port independent from each other.
drivers/phy/rockchip/phy-rockchip-usb2.c line 78
Quoted 13 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +13
-0+ +return priv->port_cfg; +} + +static int rockchip_usbphy_power_on (struct phy *phy) +{ +struct udevice *parent = phy->dev->parent; +struct rockchip_usbphy_priv *priv =dev_get_priv (parent); +const struct rockchip_usbphy_port_cfg *port_cfg =rockchip_usbphy_get_port_cfg (phy); +int ret; + +if (priv->usb_phy[phy->id].vbus_supply) { + ret =regulator_set_enable (priv->usb_phy[phy->id].vbus_supply, true);
Please use regulator_set_enable_if_allowed(), regulator_set_enable() should really only be used by core or helper functions.
Quoted 14 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +14
-0+if (ret) +return ret; + } + +/* Exit suspend. */ +rockchip_usbphy_property_enable (phy, &port_cfg->suspend, false); +usleep_range (1500 ,2000 ); + +return 0 ; +} + +static int rockchip_usbphy_power_off (struct phy *phy) +{ +struct udevice *parent = phy->dev->parent;
drivers/phy/rockchip/phy-rockchip-usb2.c line 102
Quoted 10 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +10
-0+struct rockchip_usbphy_priv *priv =dev_get_priv (parent); +const struct rockchip_usbphy_port_cfg *port_cfg =rockchip_usbphy_get_port_cfg (phy); + +/* Enter suspend. */ +rockchip_usbphy_property_enable (phy, &port_cfg->suspend, true); + +if (!priv->usb_phy[phy->id].vbus_supply) +return 0 ; + +return regulator_set_enable (priv->usb_phy[phy->id].vbus_supply, false);
Please use regulator_set_enable_if_allowed().
Quoted 10 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +10
-0+} + +static inline int rockchip_usbphy_reset_assert (struct reset_ctl *rst) +{ +if (rst) +return reset_assert (rst); +else +return 0 ; +} +
drivers/phy/rockchip/phy-rockchip-usb2.c line 122
Quoted 10 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +10
-0+static inline int rockchip_usbphy_reset_deassert (struct reset_ctl *rst) +{ +if (rst) +return reset_deassert (rst); +else +return 0 ; +} + +#define reset_control_assert (rst) rockchip_usbphy_reset_assert(rst) +#define reset_control_deassert (rst) rockchip_usbphy_reset_deassert(rst)
No, please use correct functions or reset_x_bulk() functions.
Quoted 67 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +67
-0+ +static int rockchip_usbphy_reset (struct phy *phy) +{ +struct udevice *parent = phy->dev->parent; +struct rockchip_usbphy_priv *priv =dev_get_priv (parent); + +if (reset_valid (&priv->usb_phy[phy->id].reset)) { +reset_control_assert (&priv->usb_phy[phy->id].reset); +udelay (10 ); +reset_control_deassert (&priv->usb_phy[phy->id].reset); + } + +return 0 ; +} + +static int rockchip_usbphy_init (struct phy *phy) +{ +struct udevice *parent = phy->dev->parent; +struct rockchip_usbphy_priv *priv =dev_get_priv (parent); +const struct rockchip_usbphy_port_cfg *port_cfg =rockchip_usbphy_get_port_cfg (phy); +int ret; + + ret =clk_enable (&priv->usb_phy[phy->id].clock); +if (ret) { +debug ("failed to enable phyclk\n" ); +return ret; + } + +/* Disable software control. */ +rockchip_usbphy_property_enable (phy, &port_cfg->soft_con, false); + +/* Reset OTG port. */ +rockchip_usbphy_property_enable (phy, &port_cfg->port_reset, true); +mdelay (1 ); +rockchip_usbphy_property_enable (phy, &port_cfg->port_reset, false); +udelay (1 ); +return 0 ; +} + +static int rockchip_usbphy_exit (struct phy *phy) +{ +struct udevice *parent = phy->dev->parent; +struct rockchip_usbphy_priv *priv =dev_get_priv (parent); +const struct rockchip_usbphy_port_cfg *port_cfg =rockchip_usbphy_get_port_cfg (phy); + +/* Enable software control. */ +rockchip_usbphy_property_enable (phy, &port_cfg->soft_con, true); + +clk_disable (&priv->usb_phy[phy->id].clock); + +return 0 ; +} + +static int rockchip_usbphy_of_xlate (struct phy *phy,struct ofnode_phandle_args *args) +{ +struct udevice *parent = phy->dev->parent; +struct rockchip_usbphy_priv *priv =dev_get_priv (parent); +int id; + +if (args->args_count !=0 ) { +debug ("invalid number of arguments\n" ); +return -EINVAL ; + } + +for (id =0 ; id < priv->port_cfg->num_phys; id++) { +if (of_live_active ()) { +if (args->node.np == priv->usb_phy[id].node.np) {
drivers/phy/rockchip/phy-rockchip-usb2.c line 199
Quoted 10 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +10
-0+ phy->id = id; +break ; + } + }else { +if (args->node.of_offset == priv->usb_phy[id].node.of_offset) { + phy->id = id; +break ; + } + } + }
This looks overly complex, you likely do not need this, each port already has its own node and udevice, so you can just set phy->id = 0 or use default of_xlate.
Quoted 45 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +45
-0+ +if (id >= priv->port_cfg->num_phys) { +debug ("failed to get phy id\n" ); +return -EINVAL ; + } + +return 0 ; +} + +static int rockchip_usbphy_get_regulator (ofnode node,char *supply_name, +struct udevice **regulator) +{ +struct ofnode_phandle_args regulator_phandle; +int ret; + + ret =ofnode_parse_phandle_with_args (node, supply_name, +NULL ,0 ,0 , + ®ulator_phandle); +if (ret) +return ret; + + ret =uclass_get_device_by_ofnode (UCLASS_REGULATOR , + regulator_phandle.node, + regulator); +if (ret) +return ret; + +return 0 ; +} + +static int rockchip_usbphy_init_port (struct rockchip_usbphy_priv *priv, +ofnode node,unsigned int id) +{ +unsigned int reg; +int ret; + +if (ofnode_read_u32 (node,"reg" , ®)) { +debug ("missing reg property\n" ); +return -EINVAL ; + } + + priv->usb_phy[id].node = node; + priv->usb_phy[id].reg = reg; + + ret =reset_get_by_index_nodev (node,0 , &priv->usb_phy[id].reset);
drivers/phy/rockchip/phy-rockchip-usb2.c line 254
Quoted 10 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +10
-0+if (ret) +debug ("failed to get phy-reset\n" ); + + ret =clk_get_by_index_nodev (node,0 , &priv->usb_phy[id].clock); +if (ret) { +debug ("failed to get phyclk clock\n" ); +return ret; + } + + ret =rockchip_usbphy_get_regulator (node,"vbus-supply" , &priv->usb_phy[id].vbus_supply);
Please use device_get_supply_regulator() instead.
Quoted 27 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +27
-0+if (ret) +debug ("failed to get vbus-supply\n" ); + +return 0 ; +} + +static int rockchip_usbphy_probe (struct udevice *dev) +{ +struct rockchip_usbphy_priv *priv =dev_get_priv (dev); +const struct rockchip_usbphy_port_cfg *port_cfg; +int ret, i =0 ; +ofnode node; + + port_cfg = (const struct rockchip_usbphy_port_cfg *)dev_get_driver_data (dev); +if (!port_cfg) +return -EINVAL ; + + priv->port_cfg = port_cfg; + + priv->usb_phy =kcalloc (port_cfg->num_phys,sizeof (struct rockchip_usb_phy ),GFP_KERNEL ); +if (!priv->usb_phy) +return -ENOMEM ; + + priv->grf_regmap =syscon_get_regmap (dev_get_parent (dev)); +if (IS_ERR (priv->grf_regmap)) +return PTR_ERR (priv->grf_regmap); +
drivers/phy/rockchip/phy-rockchip-usb2.c line 291
Quoted 10 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +10
-0+dev_for_each_subnode (node, dev) { +if (!ofnode_is_enabled (node)) +continue ; + +if (i >= port_cfg->num_phys) { +debug ("subnode max:%d\n" , port_cfg->num_phys); +return -ENXIO ; + } + + ret =rockchip_usbphy_init_port (priv, node, i++);
Please init the port in the port probe function.
Quoted 11 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +11
-0+if (ret) +return ret; + } + +return 0 ; +} + +static int rockchip_usbphy_bind (struct udevice *dev) +{ +ofnode node; +int ret;
drivers/phy/rockchip/phy-rockchip-usb2.c line 312
Quoted 10 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +10
-0+ +dev_for_each_subnode (node, dev) { +if (!ofnode_is_enabled (node)) +continue ; + + ret =device_bind_driver_to_node (dev,"rockchip_usbphy_port" , +ofnode_get_name (node), node,NULL ); +if (ret) { +debug ("cannot bind rockchip_usbphy_port\n" ); +return ret;
Please add proper rollback, in case first node bind and second fails.
drivers/phy/rockchip/phy-rockchip-usb2.c line 316
Quoted 4 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +4
-0+ } + } + +dev_or_flags (dev,DM_FLAG_PROBE_AFTER_BIND );
This should not be needed, please re-work driver to not need it.
Quoted 42 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +42
-0+ +return 0 ; +} + +static struct phy_ops rockchip_usbphy_ops = { + .init = rockchip_usbphy_init, + .exit = rockchip_usbphy_exit, + .power_on = rockchip_usbphy_power_on, + .power_off = rockchip_usbphy_power_off, + .reset = rockchip_usbphy_reset, + .of_xlate = rockchip_usbphy_of_xlate, +}; + +static const struct rockchip_usbphy_port_cfg rk3066a_pdata = { + .num_phys =2 , + .port_reset = {0x00 ,12 ,12 ,0 ,1 }, + .soft_con = {0x08 ,2 ,2 ,0 ,1 }, + .suspend = {0x08 ,8 ,3 , (0x01 <<3 ), (0x2A <<3 )}, +}; + +static const struct rockchip_usbphy_port_cfg rk3188_pdata = { + .num_phys =2 , + .port_reset = {0x00 ,12 ,12 ,0 ,1 }, + .soft_con = {0x08 ,2 ,2 ,0 ,1 }, + .suspend = {0x0c ,5 ,0 ,0x01 ,0x2A }, +}; + +static const struct rockchip_usbphy_port_cfg rk3288_pdata = { + .num_phys =3 , + .port_reset = {0x00 ,12 ,12 ,0 ,1 }, + .soft_con = {0x08 ,2 ,2 ,0 ,1 }, + .suspend = {0x0c ,5 ,0 ,0x01 ,0x2A }, +}; + +static const struct udevice_id rockchip_usbphy_ids[] = { + { .compatible ="rockchip,rk3066a-usb-phy" , .data = (ulong)&rk3066a_pdata }, + { .compatible ="rockchip,rk3188-usb-phy" , .data = (ulong)&rk3188_pdata }, + { .compatible ="rockchip,rk3288-usb-phy" , .data = (ulong)&rk3288_pdata }, + {} +}; + +U_BOOT_DRIVER (rockchip_usbphy_port) = {
drivers/phy/rockchip/phy-rockchip-usb2.c line 368
Quoted 10 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +10
-0+ .name = "rockchip_usbphy_port", + .id = UCLASS_PHY, + .ops = &rockchip_usbphy_ops, +}; + +U_BOOT_DRIVER (rockchip_usbphy) = { + .name ="rockchip_usbphy" , + .id =UCLASS_NOP , + .of_match = rockchip_usbphy_ids, + .probe = rockchip_usbphy_probe,
The probe should likely be at the port level.
drivers/phy/rockchip/phy-rockchip-usb2.c line 371
Quoted 3 lines
drivers/phy/rockchip/phy-rockchip-usb2.c new file +3
-0+ .bind = rockchip_usbphy_bind, + .priv_auto = sizeof(struct rockchip_usbphy_priv), +};
Below is what I played around with a few weeks/months ago, not fully working but probed correctly and priv data is tied to each port.
struct rockchip_usb_phy_priv {
void __iomem *reg_base;
u32 reg_offset;
struct reset_ctl_bulk resets;
};static int rockchip_usb_phy_reset(struct phy *phy)
{
struct rockchip_usb_phy_priv *priv = dev_get_priv(phy->dev);
reset_assert_bulk(&priv->resets);
udelay(10);
reset_deassert_bulk(&priv->resets);
return 0;
}static struct phy_ops rockchip_usb_phy_ops = {
.reset = rockchip_usb_phy_reset,
};
static int rockchip_usb_phy_probe(struct udevice *dev)
{
struct rockchip_usb_phy_priv *priv = dev_get_priv(dev);
int ret;
priv->reg_base = dev_read_addr_ptr(dev_get_parent(dev_get_parent(dev)));
if (!priv->reg_base)
return -EINVAL;
ret = dev_read_u32(dev, "reg", &priv->reg_offset);
if (ret)
return ret;
return reset_get_bulk(dev, &priv->resets);
}static int rockchip_usb_phy_bind(struct udevice *dev)
{
const char *name;
ofnode node;
int ret = 0;
dev_for_each_subnode(node, dev) {
if (!ofnode_is_enabled(node))
continue;
name = ofnode_get_name(node);
dev_dbg(dev, "subnode %s\n", name);
ret = device_bind_driver_to_node(dev, "rockchip_usb_phy_port",
name, node, NULL);
if (ret) {
dev_err(dev,
"'%s' cannot bind 'rockchip_usb_phy_port'\n", name);
goto bind_fail;
}
}
return 0;bind_fail:
device_chld_unbind(dev, NULL); return ret; }
static const struct udevice_id rockchip_usb_phy_ids[] = {
{ .compatible = "rockchip,rk3288-usb-phy" },
{ /* sentinel */ }
};U_BOOT_DRIVER(rockchip_usb_phy_port) = {
.name = "rockchip_usb_phy_port",
.id = UCLASS_PHY,
.ops = &rockchip_usb_phy_ops,
.probe = rockchip_usb_phy_probe,
.priv_auto = sizeof(struct rockchip_usb_phy_priv),
};U_BOOT_DRIVER(rockchip_usb_phy) = {
.name = "rockchip_usb_phy",
.id = UCLASS_NOP,
.of_match = rockchip_usb_phy_ids,
.bind = rockchip_usb_phy_bind,
};Regards,
Jonas
PATCH v3 6/12 usb: phy: remove rockchip_usb2_phy.c
In reply to Johan JonkerRemove rockchip_usb2_phy.c and replace it by phy-rockchip-usb2.c Adjust defconfigs. Enable CONFIG_DM_RESET where needed to compile the phy driver. Add grf bind function for usbphy node. Remove a variable no longer needed from an include file.
---
Changed V3:
rebase
use CONFIG_IS_ENABLED
Changed V2 RESEND:
Add include
Add grf bind function
Restyle
--- arch/arm/mach-rockchip/board.c | 28 ----- arch/arm/mach-rockchip/rk3066/syscon_rk3066.c | 26 ++++ arch/arm/mach-rockchip/rk3188/syscon_rk3188.c | 27 +++++ arch/arm/mach-rockchip/rk3288/syscon_rk3288.c | 27 +++++ configs/chromebit_mickey_defconfig | 2 +- configs/chromebook_jerry_defconfig | 2 +- configs/chromebook_minnie_defconfig | 2 +- configs/chromebook_speedy_defconfig | 2 +- configs/evb-rk3288-rk808_defconfig | 2 +- configs/firefly-rk3288_defconfig | 4 +- configs/miqi-rk3288_defconfig | 4 +- configs/mk808_defconfig | 2 +- configs/phycore-rk3288_defconfig | 3 +- configs/popmetal-rk3288_defconfig | 3 +- configs/rock-pi-n8-rk3288_defconfig | 2 +- configs/rock2_defconfig | 3 +- configs/rock_defconfig | 3 +- configs/tinker-rk3288_defconfig | 4 +- configs/tinker-s-rk3288_defconfig | 4 +- configs/vyasa-rk3288_defconfig | 2 +- drivers/usb/phy/Kconfig | 3 - drivers/usb/phy/Makefile | 1 - drivers/usb/phy/rockchip_usb2_phy.c | 113 ------------------ include/usb/dwc2_udc.h | 1 - 24 files changed, 104 insertions(+), 166 deletions(-) delete mode 100644 drivers/usb/phy/rockchip_usb2_phy.c
arch/arm/mach-rockchip/board.c +0 -28
@@ -269,34 +269,6 @@ int board_usb_init(int index, enum usb_init_type init) } otg_data.regs_otg =ofnode_get_addr (node); -#ifdef CONFIG_ROCKCHIP_USB2_PHY -int ret; -u32 phandle, offset; -ofnode phy_node; - - ret =ofnode_read_u32 (node,"phys" , &phandle); -if (ret) -return ret; - - node =ofnode_get_by_phandle (phandle); -if (!ofnode_valid (node)) { -debug ("Not found usb phy device\n" ); -return -ENODEV ; - } - - phy_node =ofnode_get_parent (node); -if (!ofnode_valid (node)) { -debug ("Not found usb phy device\n" ); -return -ENODEV ; - } - - otg_data.phy_of_node = phy_node; - ret =ofnode_read_u32 (node,"reg" , &offset); -if (ret) -return ret; - otg_data.regs_phy = offset + - (u32 )syscon_get_first_range (ROCKCHIP_SYSCON_GRF ); -#endif return dwc2_udc_probe (&otg_data); }
arch/arm/mach-rockchip/rk3066/syscon_rk3066.c +26 -0
@@ -5,10 +5,33 @@*/ #include <dm.h> +#include <dm/lists.h> #include <log.h> #include <syscon.h> #include <asm/arch-rockchip/clock.h> +#if CONFIG_IS_ENABLED (OF_REAL ) &&CONFIG_IS_ENABLED (PHY_ROCKCHIP_USB2 ) +static int rk3066_syscon_bind (struct udevice *dev) +{ +if (dev->driver_data ==ROCKCHIP_SYSCON_GRF ) { +ofnode subnode =ofnode_find_subnode (dev_ofnode (dev),"usbphy" ); + +if (ofnode_valid (subnode)) { +struct udevice *usbphy_dev; +int ret; + + ret =device_bind_driver_to_node (dev,"rockchip_usbphy" ,"usbphy" , + subnode, &usbphy_dev); +if (ret) +return ret; + + usbphy_dev->driver_data = usbphy_dev->driver->of_match->data; + } + } + +return 0 ; +} +#endif static const struct udevice_id rk3066_syscon_ids[] = { { .compatible ="rockchip,rk3066-noc" , .data =ROCKCHIP_SYSCON_NOC }, { .compatible ="rockchip,rk3066-grf" , .data =ROCKCHIP_SYSCON_GRF },
@@ -20,6 +43,9 @@ U_BOOT_DRIVER(syscon_rk3066) = { .name = "rk3066_syscon", .id = UCLASS_SYSCON, .of_match = rk3066_syscon_ids, +#if CONFIG_IS_ENABLED (OF_REAL ) &&CONFIG_IS_ENABLED (PHY_ROCKCHIP_USB2 ) + .bind = rk3066_syscon_bind, +#endif };#if CONFIG_IS_ENABLED (OF_PLATDATA )
arch/arm/mach-rockchip/rk3188/syscon_rk3188.c +27 -0
@@ -5,10 +5,34 @@*/ #include <dm.h> +#include <dm/lists.h> #include <log.h> #include <syscon.h> #include <asm/arch-rockchip/clock.h> +#if CONFIG_IS_ENABLED (OF_REAL ) &&CONFIG_IS_ENABLED (PHY_ROCKCHIP_USB2 ) +static int rk3188_syscon_bind (struct udevice *dev) +{ +if (dev->driver_data ==ROCKCHIP_SYSCON_GRF ) { +ofnode subnode =ofnode_find_subnode (dev_ofnode (dev),"usbphy" ); + +if (ofnode_valid (subnode)) { +struct udevice *usbphy_dev; +int ret; + + ret =device_bind_driver_to_node (dev,"rockchip_usbphy" ,"usbphy" , + subnode, &usbphy_dev); +if (ret) +return ret; + + usbphy_dev->driver_data = usbphy_dev->driver->of_match->data; + } + } + +return 0 ; +} +#endif +static const struct udevice_id rk3188_syscon_ids[] = { { .compatible ="rockchip,rk3188-noc" , .data =ROCKCHIP_SYSCON_NOC }, { .compatible ="rockchip,rk3188-grf" , .data =ROCKCHIP_SYSCON_GRF },
@@ -20,6 +44,9 @@ U_BOOT_DRIVER(syscon_rk3188) = { .name = "rk3188_syscon", .id = UCLASS_SYSCON, .of_match = rk3188_syscon_ids, +#if CONFIG_IS_ENABLED (OF_REAL ) &&CONFIG_IS_ENABLED (PHY_ROCKCHIP_USB2 ) + .bind = rk3188_syscon_bind, +#endif };#if CONFIG_IS_ENABLED (OF_PLATDATA )
arch/arm/mach-rockchip/rk3288/syscon_rk3288.c +27 -0
@@ -5,6 +5,7 @@*/ #include <dm.h> +#include <dm/lists.h> #include <dt-structs.h> #include <log.h> #include <malloc.h>
@@ -12,6 +13,29 @@#include <syscon.h> #include <asm/arch-rockchip/clock.h> +#if CONFIG_IS_ENABLED (OF_REAL ) &&CONFIG_IS_ENABLED (PHY_ROCKCHIP_USB2 ) +static int rk3288_syscon_bind (struct udevice *dev) +{ +if (dev->driver_data ==ROCKCHIP_SYSCON_GRF ) { +ofnode subnode =ofnode_find_subnode (dev_ofnode (dev),"usbphy" ); + +if (ofnode_valid (subnode)) { +struct udevice *usbphy_dev; +int ret; + + ret =device_bind_driver_to_node (dev,"rockchip_usbphy" ,"usbphy" , + subnode, &usbphy_dev); +if (ret) +return ret; + + usbphy_dev->driver_data = usbphy_dev->driver->of_match->data; + } + } + +return 0 ; +} +#endif +static const struct udevice_id rk3288_syscon_ids[] = { { .compatible ="rockchip,rk3288-noc" , .data =ROCKCHIP_SYSCON_NOC }, { .compatible ="rockchip,rk3288-grf" , .data =ROCKCHIP_SYSCON_GRF },
@@ -24,6 +48,9 @@ U_BOOT_DRIVER(syscon_rk3288) = { .name = "rk3288_syscon", .id = UCLASS_SYSCON, .of_match = rk3288_syscon_ids, +#if CONFIG_IS_ENABLED (OF_REAL ) &&CONFIG_IS_ENABLED (PHY_ROCKCHIP_USB2 ) + .bind = rk3288_syscon_bind, +#endif };#if CONFIG_IS_ENABLED (OF_PLATDATA )
configs/chromebit_mickey_defconfig +1 -1
@@ -82,6 +82,7 @@ CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_SPI_FLASH_GIGADEVICE=y CONFIG_SPI_FLASH_WINBOND=y +CONFIG_PHY_ROCKCHIP_USB2=y CONFIG_PINCTRL=y CONFIG_PINCONF=y CONFIG_SPL_PINCTRL=y
@@ -102,7 +103,6 @@ CONFIG_SYSRESET=y CONFIG_USB=y # CONFIG_SPL_DM_USB is not set CONFIG_USB_DWC2=y -CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_VIDEO=y # CONFIG_VIDEO_BPP8 is not set CONFIG_CONSOLE_TRUETYPE=y
configs/chromebook_jerry_defconfig +1 -1
@@ -82,6 +82,7 @@ CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_SPI_FLASH_GIGADEVICE=y CONFIG_SPI_FLASH_WINBOND=y +CONFIG_PHY_ROCKCHIP_USB2=y CONFIG_PINCTRL=y CONFIG_PINCONF=y CONFIG_SPL_PINCTRL=y
@@ -106,7 +107,6 @@ CONFIG_SYSRESET=y CONFIG_USB=y # CONFIG_SPL_DM_USB is not set CONFIG_USB_DWC2=y -CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_VIDEO=y # CONFIG_VIDEO_BPP8 is not set CONFIG_CONSOLE_TRUETYPE=y
configs/chromebook_minnie_defconfig +1 -1
@@ -83,6 +83,7 @@ CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_SPI_FLASH_GIGADEVICE=y CONFIG_SPI_FLASH_WINBOND=y +CONFIG_PHY_ROCKCHIP_USB2=y CONFIG_PINCTRL=y CONFIG_PINCONF=y CONFIG_SPL_PINCTRL=y
@@ -107,7 +108,6 @@ CONFIG_SYSRESET=y CONFIG_USB=y # CONFIG_SPL_DM_USB is not set CONFIG_USB_DWC2=y -CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_VIDEO=y # CONFIG_VIDEO_BPP8 is not set CONFIG_CONSOLE_TRUETYPE=y
configs/chromebook_speedy_defconfig +1 -1
@@ -83,6 +83,7 @@ CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_SPI_FLASH_GIGADEVICE=y CONFIG_SPI_FLASH_WINBOND=y +CONFIG_PHY_ROCKCHIP_USB2=y CONFIG_PINCTRL=y CONFIG_PINCONF=y CONFIG_SPL_PINCTRL=y
@@ -107,7 +108,6 @@ CONFIG_SYSRESET=y CONFIG_USB=y # CONFIG_SPL_DM_USB is not set CONFIG_USB_DWC2=y -CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_VIDEO=y # CONFIG_VIDEO_BPP8 is not set CONFIG_CONSOLE_TRUETYPE=y
configs/evb-rk3288-rk808_defconfig +1 -1
@@ -71,6 +71,7 @@ CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y +CONFIG_PHY_ROCKCHIP_USB2=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_DM_PMIC=y
@@ -85,7 +86,6 @@ CONFIG_SYS_NS16550_MEM32=y CONFIG_SYSRESET=y CONFIG_USB=y CONFIG_USB_DWC2=y -CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_VIDEO=y
configs/firefly-rk3288_defconfig +2 -2
@@ -62,11 +62,12 @@ CONFIG_MISC=y CONFIG_ROCKCHIP_EFUSE=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y -CONFIG_PHY_REALTEK=y CONFIG_DM_ETH_PHY=y CONFIG_PHY_GIGE=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y +CONFIG_PHY_REALTEK=y +CONFIG_PHY_ROCKCHIP_USB2=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_DM_PMIC=y
@@ -82,7 +83,6 @@ CONFIG_SYS_NS16550_MEM32=y CONFIG_SYSRESET=y CONFIG_USB=y CONFIG_USB_DWC2=y -CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_KEYBOARD=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y
configs/miqi-rk3288_defconfig +2 -2
@@ -59,11 +59,12 @@ CONFIG_MISC=y CONFIG_ROCKCHIP_EFUSE=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y -CONFIG_PHY_REALTEK=y CONFIG_DM_ETH_PHY=y CONFIG_PHY_GIGE=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y +CONFIG_PHY_REALTEK=y +CONFIG_PHY_ROCKCHIP_USB2=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_DM_PMIC=y
@@ -79,7 +80,6 @@ CONFIG_SYS_NS16550_MEM32=y CONFIG_SYSRESET=y CONFIG_USB=y CONFIG_USB_DWC2=y -CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_KEYBOARD=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y
configs/mk808_defconfig +1 -1
@@ -86,6 +86,7 @@ CONFIG_MMC_UHS_SUPPORT=y CONFIG_SPL_MMC_UHS_SUPPORT=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y +CONFIG_PHY_ROCKCHIP_USB2=y CONFIG_PINCTRL=y CONFIG_DM_PMIC=y # CONFIG_SPL_PMIC_CHILDREN is not set
@@ -105,7 +106,6 @@ CONFIG_TPL_TIMER=y CONFIG_DESIGNWARE_APB_TIMER=y CONFIG_USB=y CONFIG_USB_DWC2=y -CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_USB_FUNCTION_ROCKUSB=y
configs/phycore-rk3288_defconfig +2 -1
@@ -9,6 +9,7 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x100000 CONFIG_SF_DEFAULT_SPEED=20000000 CONFIG_ENV_OFFSET=0x3F8000 CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3288-phycore-rdk" +CONFIG_DM_RESET=y CONFIG_SYS_MONITOR_LEN=614400 CONFIG_ROCKCHIP_RK3288=y CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y
@@ -68,6 +69,7 @@ CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y +CONFIG_PHY_ROCKCHIP_USB2=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_DM_PMIC=y
@@ -82,7 +84,6 @@ CONFIG_SYS_NS16550_MEM32=y CONFIG_SYSRESET=y CONFIG_USB=y CONFIG_USB_DWC2=y -CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_USB_ETHER_SMSC95XX=y
configs/popmetal-rk3288_defconfig +2 -1
@@ -9,6 +9,7 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x100000 CONFIG_SF_DEFAULT_SPEED=20000000 CONFIG_ENV_OFFSET=0x3F8000 CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3288-popmetal" +CONFIG_DM_RESET=y CONFIG_SYS_MONITOR_LEN=614400 CONFIG_ROCKCHIP_RK3288=y CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y
@@ -64,6 +65,7 @@ CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y +CONFIG_PHY_ROCKCHIP_USB2=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_DM_PMIC=y
@@ -78,7 +80,6 @@ CONFIG_SYS_NS16550_MEM32=y CONFIG_SYSRESET=y CONFIG_USB=y CONFIG_USB_DWC2=y -CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_USB_ETHER_SMSC95XX=y
configs/rock-pi-n8-rk3288_defconfig +1 -1
@@ -63,6 +63,7 @@ CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y +CONFIG_PHY_ROCKCHIP_USB2=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_DM_PMIC=y
@@ -81,7 +82,6 @@ CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_GENERIC=y CONFIG_USB_DWC2=y -CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_KEYBOARD=y # CONFIG_USB_KEYBOARD_FN_KEYS is not set CONFIG_USB_GADGET=y
configs/rock2_defconfig +2 -1
@@ -9,6 +9,7 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x100000 CONFIG_SF_DEFAULT_SPEED=20000000 CONFIG_ENV_OFFSET=0x3F8000 CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3288-rock2-square" +CONFIG_DM_RESET=y CONFIG_SYS_MONITOR_LEN=614400 CONFIG_ROCKCHIP_RK3288=y CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y
@@ -65,6 +66,7 @@ CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y +CONFIG_PHY_ROCKCHIP_USB2=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_DM_PMIC=y
@@ -80,7 +82,6 @@ CONFIG_SYS_NS16550_MEM32=y CONFIG_SYSRESET=y CONFIG_USB=y CONFIG_USB_DWC2=y -CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_KEYBOARD=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_DWC2_OTG=y
configs/rock_defconfig +2 -1
@@ -12,6 +12,7 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x60100000 CONFIG_SF_DEFAULT_SPEED=20000000 CONFIG_ENV_OFFSET=0x3F8000 CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3188-radxarock" +CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3188=y # CONFIG_ROCKCHIP_STIMER is not set CONFIG_TARGET_ROCK=y
@@ -53,6 +54,7 @@ CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_LED=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y +CONFIG_PHY_ROCKCHIP_USB2=y CONFIG_PINCTRL=y CONFIG_DM_PMIC=y # CONFIG_SPL_PMIC_CHILDREN is not set
@@ -68,7 +70,6 @@ CONFIG_TIMER=y CONFIG_SPL_TIMER=y CONFIG_ROCKCHIP_TIMER=y CONFIG_USB=y -CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_RANDOM_UUID=y CONFIG_SPL_TINY_MEMSET=y CONFIG_CMD_DHRYSTONE=y
configs/tinker-rk3288_defconfig +2 -2
@@ -62,11 +62,12 @@ CONFIG_ROCKCHIP_EFUSE=y CONFIG_I2C_EEPROM=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y -CONFIG_PHY_REALTEK=y CONFIG_DM_ETH_PHY=y CONFIG_PHY_GIGE=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y +CONFIG_PHY_REALTEK=y +CONFIG_PHY_ROCKCHIP_USB2=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_DM_PMIC=y
@@ -81,7 +82,6 @@ CONFIG_SYS_NS16550_MEM32=y CONFIG_SYSRESET=y CONFIG_USB=y CONFIG_USB_DWC2=y -CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_KEYBOARD=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y
configs/tinker-s-rk3288_defconfig +2 -2
@@ -62,11 +62,12 @@ CONFIG_ROCKCHIP_EFUSE=y CONFIG_I2C_EEPROM=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y -CONFIG_PHY_REALTEK=y CONFIG_DM_ETH_PHY=y CONFIG_PHY_GIGE=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y +CONFIG_PHY_REALTEK=y +CONFIG_PHY_ROCKCHIP_USB2=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_DM_PMIC=y
@@ -81,7 +82,6 @@ CONFIG_SYS_NS16550_MEM32=y CONFIG_SYSRESET=y CONFIG_USB=y CONFIG_USB_DWC2=y -CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_KEYBOARD=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y
configs/vyasa-rk3288_defconfig +1 -1
@@ -72,6 +72,7 @@ CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y +CONFIG_PHY_ROCKCHIP_USB2=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_DM_PMIC=y
@@ -87,7 +88,6 @@ CONFIG_SYS_NS16550_MEM32=y CONFIG_SYSRESET=y CONFIG_USB=y CONFIG_USB_DWC2=y -CONFIG_ROCKCHIP_USB2_PHY=y CONFIG_USB_KEYBOARD=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y
drivers/usb/phy/Kconfig +0 -3
@@ -7,6 +7,3 @@ comment "USB Phy" config TWL4030_USB bool "TWL4030 PHY" - -config ROCKCHIP_USB2_PHY - bool "Rockchip USB2 PHY"
drivers/usb/phy/Makefile +0 -1
@@ -4,4 +4,3 @@ # Tom Rix <[email protected]> obj-$(CONFIG_TWL4030_USB) += twl4030.o -obj-$(CONFIG_ROCKCHIP_USB2_PHY) += rockchip_usb2_phy.o
drivers/usb/phy/rockchip_usb2_phy.c deleted +0 -113
113 lines not on this page · raw message
include/usb/dwc2_udc.h +0 -1
@@ -15,7 +15,6 @@struct dwc2_plat_otg_data {void *priv; -ofnode phy_of_node;int (*phy_control)(int on);uintptr_t regs_phy;uintptr_t regs_otg;
--
2.39.5
Re: [PATCH v3 06/12] usb: phy: remove rockchip_usb2_phy.c
Hi Johan,
Quoted 4 lines · Johan Jonker
Remove
rockchip_usb2_phy.cand replace it byphy-rockchip-usb2.cAdjust defconfigs. EnableCONFIG_DM_RESETwhere needed to compile the phy driver. Add grf bind function for usbphy node. Remove a variable no longer needed from an include file.
This patch is trying to do too much at once, please split this into something like:
- Add .bind = dm_scan_fdt_dev to syscon_rk drivers
- Adjust defconfigs to use the new phy driver
- Remove old code
Quoted 39 lines
Signed-off-by Johan Jonker <[email protected]>---
Changed V3:
rebase
useCONFIG_IS_ENABLEDChanged V2 RESEND:
Add include
Add grf bind function
Restyle--- arch/arm/mach-rockchip/board.c | 28 ----- arch/arm/mach-rockchip/rk3066/syscon_rk3066.c | 26 ++++ arch/arm/mach-rockchip/rk3188/syscon_rk3188.c | 27 +++++ arch/arm/mach-rockchip/rk3288/syscon_rk3288.c | 27 +++++ configs/chromebit_mickey_defconfig | 2 +- configs/chromebook_jerry_defconfig | 2 +- configs/chromebook_minnie_defconfig | 2 +- configs/chromebook_speedy_defconfig | 2 +- configs/evb-rk3288-rk808_defconfig | 2 +- configs/firefly-rk3288_defconfig | 4 +- configs/miqi-rk3288_defconfig | 4 +- configs/mk808_defconfig | 2 +- configs/phycore-rk3288_defconfig | 3 +- configs/popmetal-rk3288_defconfig | 3 +- configs/rock-pi-n8-rk3288_defconfig | 2 +- configs/rock2_defconfig | 3 +- configs/rock_defconfig | 3 +- configs/tinker-rk3288_defconfig | 4 +- configs/tinker-s-rk3288_defconfig | 4 +- configs/vyasa-rk3288_defconfig | 2 +- drivers/usb/phy/Kconfig | 3 - drivers/usb/phy/Makefile | 1 - drivers/usb/phy/rockchip_usb2_phy.c | 113 ------------------ include/usb/dwc2_udc.h | 1 - 24 files changed, 104 insertions(+), 166 deletions(-) delete mode 100644 drivers/usb/phy/rockchip_usb2_phy.c
[snip]
Quoted 39 lines
arch/arm/mach-rockchip/rk3066/syscon_rk3066.c +23
-0@@ -5,10 +5,33 @@*/ #include <dm.h> +#include <dm/lists.h> #include <log.h> #include <syscon.h> #include <asm/arch-rockchip/clock.h> +#if CONFIG_IS_ENABLED (OF_REAL ) &&CONFIG_IS_ENABLED (PHY_ROCKCHIP_USB2 ) +static int rk3066_syscon_bind (struct udevice *dev) +{ +if (dev->driver_data ==ROCKCHIP_SYSCON_GRF ) { +ofnode subnode =ofnode_find_subnode (dev_ofnode (dev),"usbphy" ); + +if (ofnode_valid (subnode)) { +struct udevice *usbphy_dev; +int ret; + + ret =device_bind_driver_to_node (dev,"rockchip_usbphy" ,"usbphy" , + subnode, &usbphy_dev); +if (ret) +return ret; + + usbphy_dev->driver_data = usbphy_dev->driver->of_match->data; + } + } + +return 0 ; +} +#endif static const struct udevice_id rk3066_syscon_ids[] = { { .compatible ="rockchip,rk3066-noc" , .data =ROCKCHIP_SYSCON_NOC }, { .compatible ="rockchip,rk3066-grf" , .data =ROCKCHIP_SYSCON_GRF },
arch/arm/mach-rockchip/rk3066/syscon_rk3066.c U_BOOT_DRIVER(syscon_rk3066) = { · line 48
Quoted 6 lines
arch/arm/mach-rockchip/rk3066/syscon_rk3066.c +3
-0@@ -20,6 +43,9 @@ U_BOOT_DRIVER(syscon_rk3066) = { .name = "rk3066_syscon", .id = UCLASS_SYSCON, .of_match = rk3066_syscon_ids, +#if CONFIG_IS_ENABLED (OF_REAL ) &&CONFIG_IS_ENABLED (PHY_ROCKCHIP_USB2 ) + .bind = rk3066_syscon_bind, +#endif
Please use what the other rk syscon drivers are using:
#if CONFIG_IS_ENABLED(OF_REAL)
.bind = dm_scan_fdt_dev,
#endif
Or are there any reason why you try to restrict this to just usbphy?
Regards,
Jonas
Quoted 3 lines
arch/arm/mach-rockchip/rk3066/syscon_rk3066.c +0
-0};#if CONFIG_IS_ENABLED (OF_PLATDATA )
[snip]
PATCH v3 7/12 rockchip: reset: make reset-rockchip available in SPL
In reply to Johan JonkerMake reset-rockchip available for use with dwc2 phy in SPL to load U-boot (full) from a USB disk.
--- drivers/reset/Kconfig | 9 +++++++++ drivers/reset/Makefile | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-)
drivers/reset/Kconfig +9 -0
@@ -100,6 +100,15 @@ config RESET_ROCKCHIP though is that some reset signals, like I2C or MISC reset multiple devices. +config SPL_RESET_ROCKCHIP + bool "Reset controller driver for Rockchip SoCs in SPL" + depends on SPL_DM_RESET && ARCH_ROCKCHIP && SPL_CLK + default n + help + Support for reset controller on rockchip SoC. The main limitation + though is that some reset signals, like I2C or MISC reset multiple + devices. + config RESET_HSDK bool "Synopsys HSDK Reset Driver" depends on DM_RESET && TARGET_HSDK
drivers/reset/Makefile +2 -2
@@ -3,7 +3,7 @@ # Copyright (c) 2016, NVIDIA CORPORATION. # -obj-$(CONFIG_DM_RESET) += reset-uclass.o +obj-$(CONFIG_$(PHASE_)DM_RESET) += reset-uclass.o obj-$(CONFIG_SANDBOX_MBOX) += sandbox-reset.o obj-$(CONFIG_SANDBOX_MBOX) += sandbox-reset-test.o obj-$(CONFIG_STI_RESET) += sti-reset.o
@@ -16,7 +16,7 @@ obj-$(CONFIG_RESET_BCM6345) += reset-bcm6345.o obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o obj-$(CONFIG_RESET_AST2500) += reset-ast2500.o obj-$(CONFIG_RESET_AST2600) += reset-ast2600.o -obj-$(CONFIG_RESET_ROCKCHIP) += reset-rockchip.o rst-rk3506.o rst-rk3528.o rst-rk3576.o rst-rk3588.o +obj-$(CONFIG_$(PHASE_)RESET_ROCKCHIP) += reset-rockchip.o rst-rk3506.o rst-rk3528.o rst-rk3576.o rst-rk3588.o obj-$(CONFIG_RESET_MESON) += reset-meson.o obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o obj-$(CONFIG_RESET_MEDIATEK) += reset-mediatek.o
--
2.39.5
Re: [PATCH v3 07/12] rockchip: reset: make reset-rockchip available in SPL
Hi Johan,
Quoted 2 lines · Johan Jonker
Make reset-rockchip available for use with dwc2 phy in SPL to load U-boot (full) from a USB disk.
This does not seem to match what the patch does. The patch seem to do the opposite, make it possible to disable inclusion of reset driver in SPL.
Quoted 12 lines
Signed-off-by Johan Jonker <[email protected]>--- drivers/reset/Kconfig | 9 +++++++++ drivers/reset/Makefile | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-)drivers/reset/Kconfig +0
-0
drivers/reset/Kconfig config RESET_ROCKCHIP · line 106
Quoted 7 lines
drivers/reset/Kconfig +4
-0@@ -100,6 +100,15 @@ config RESET_ROCKCHIP though is that some reset signals, like I2C or MISC reset multiple devices. +config SPL_RESET_ROCKCHIP + bool "Reset controller driver for Rockchip SoCs in SPL" + depends on SPL_DM_RESET && ARCH_ROCKCHIP && SPL_CLK + default n
Default should likely make this default RESET_ROCKCHIP to match existing behavior before this patch.
Quoted 13 lines
drivers/reset/Kconfig +5
-0+ help + Support for reset controller on rockchip SoC. The main limitation + though is that some reset signals, like I2C or MISC reset multiple + devices. + config RESET_HSDK bool "Synopsys HSDK Reset Driver" depends on DM_RESET && TARGET_HSDKdrivers/reset/Makefile +0
-0
drivers/reset/Makefile line 6
Quoted 5 lines
drivers/reset/Makefile +1
-1@@ -3,7 +3,7 @@ # Copyright (c) 2016, NVIDIA CORPORATION. # -obj-$(CONFIG_DM_RESET) += reset-uclass.o +obj-$(CONFIG_$(PHASE_)DM_RESET) += reset-uclass.o
This could have affects on many other platforms/devices and should likely be in a separate patch, if this really is needed.
Regards,
Jonas
Quoted 15 lines
drivers/reset/Makefile +1
-2obj-$(CONFIG_SANDBOX_MBOX) += sandbox-reset.o obj-$(CONFIG_SANDBOX_MBOX) += sandbox-reset-test.o obj-$(CONFIG_STI_RESET) += sti-reset.o@@ -16,7 +16,7 @@ obj-$(CONFIG_RESET_BCM6345) += reset-bcm6345.o obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o obj-$(CONFIG_RESET_AST2500) += reset-ast2500.o obj-$(CONFIG_RESET_AST2600) += reset-ast2600.o -obj-$(CONFIG_RESET_ROCKCHIP) += reset-rockchip.o rst-rk3506.o rst-rk3528.o rst-rk3576.o rst-rk3588.o +obj-$(CONFIG_$(PHASE_)RESET_ROCKCHIP) += reset-rockchip.o rst-rk3506.o rst-rk3528.o rst-rk3576.o rst-rk3588.o obj-$(CONFIG_RESET_MESON) += reset-meson.o obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o obj-$(CONFIG_RESET_MEDIATEK) += reset-mediatek.o --2.39.5
PATCH v3 8/12 rockchip: phy: make phy-rockchip-usb2 available in SPL
In reply to Johan JonkerMake phy-rockchip-usb2 available as phy for dwc2 USB in SPL to load U-boot (full) from a USB disk.
--- drivers/phy/rockchip/Kconfig | 10 ++++++++++ drivers/phy/rockchip/Makefile | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/phy/rockchip/Kconfig +10 -0
@@ -60,6 +60,16 @@ config PHY_ROCKCHIP_USB2 bool "Rockchip USB2 PHY" depends on ARCH_ROCKCHIP select PHY + select RESET_ROCKCHIP + help + Support for Rockchip USB 2.0 PHY. + +config SPL_PHY_ROCKCHIP_USB2 + bool "Rockchip USB2 PHY in SPL" + depends on ARCH_ROCKCHIP && SPL + default n + select SPL_PHY + select SPL_RESET_ROCKCHIP help Support for Rockchip USB 2.0 PHY.
drivers/phy/rockchip/Makefile +1 -1
@@ -10,5 +10,5 @@ obj-$(CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY) += phy-rockchip-naneng-combphy.o obj-$(CONFIG_PHY_ROCKCHIP_PCIE) += phy-rockchip-pcie.o obj-$(CONFIG_PHY_ROCKCHIP_SNPS_PCIE3) += phy-rockchip-snps-pcie3.o obj-$(CONFIG_PHY_ROCKCHIP_TYPEC) += phy-rockchip-typec.o -obj-$(CONFIG_PHY_ROCKCHIP_USB2) += phy-rockchip-usb2.o +obj-$(CONFIG_$(PHASE_)PHY_ROCKCHIP_USB2) += phy-rockchip-usb2.o obj-$(CONFIG_PHY_ROCKCHIP_USBDP) += phy-rockchip-usbdp.o
--
2.39.5
Re: [PATCH v3 08/12] rockchip: phy: make phy-rockchip-usb2 available in SPL
Hi Johan,
Quoted 2 lines · Johan Jonker
Make phy-rockchip-usb2 available as phy for dwc2 USB in SPL to load U-boot (full) from a USB disk.
This patch can be merged with the addition of the new phy driver, why the need to keep it separate?
Quoted 12 lines
Signed-off-by Johan Jonker <[email protected]>--- drivers/phy/rockchip/Kconfig | 10 ++++++++++ drivers/phy/rockchip/Makefile | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-)drivers/phy/rockchip/Kconfig +0
-0
drivers/phy/rockchip/Kconfig config PHY_ROCKCHIP_USB2 · line 63
Quoted 4 lines
drivers/phy/rockchip/Kconfig +1
-0@@ -60,6 +60,16 @@ config PHY_ROCKCHIP_USB2 bool "Rockchip USB2 PHY" depends on ARCH_ROCKCHIP select PHY + select RESET_ROCKCHIP
The code in driver did not seem to depend on the reset feature, so we should likely not need to select the RESET_ROCKCHIP driver here, if you think it is needed, please only imply and try the driver compiles with RESET_ROCKCHIP=n.
Regards,
Jonas
Quoted 26 lines
drivers/phy/rockchip/Kconfig +9
-0+ help + Support for Rockchip USB 2.0 PHY. + +config SPL_PHY_ROCKCHIP_USB2 + bool "Rockchip USB2 PHY in SPL" + depends on ARCH_ROCKCHIP && SPL + default n + select SPL_PHY + select SPL_RESET_ROCKCHIP help Support for Rockchip USB 2.0 PHY.drivers/phy/rockchip/Makefile +1
-2@@ -10,5 +10,5 @@ obj-$(CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY) += phy-rockchip-naneng-combphy.o obj-$(CONFIG_PHY_ROCKCHIP_PCIE) += phy-rockchip-pcie.o obj-$(CONFIG_PHY_ROCKCHIP_SNPS_PCIE3) += phy-rockchip-snps-pcie3.o obj-$(CONFIG_PHY_ROCKCHIP_TYPEC) += phy-rockchip-typec.o -obj-$(CONFIG_PHY_ROCKCHIP_USB2) += phy-rockchip-usb2.o +obj-$(CONFIG_$(PHASE_)PHY_ROCKCHIP_USB2) += phy-rockchip-usb2.o obj-$(CONFIG_PHY_ROCKCHIP_USBDP) += phy-rockchip-usbdp.o --2.39.5
PATCH v3 9/12 usb: make dwc2_usb available in SPL
In reply to Johan JonkerMake the dwc2_usb driver available in SPL to load U-boot (full) from a USB disk.
--- drivers/Makefile | 3 ++- drivers/usb/common/Makefile | 2 +- drivers/usb/host/Kconfig | 11 +++++++++++ drivers/usb/host/Makefile | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-)
drivers/Makefile +2 -1
@@ -68,8 +68,9 @@ obj-$(CONFIG_SPL_MUSB_NEW) += usb/musb-new/ obj-$(CONFIG_SPL_USB_GADGET) += usb/gadget/ obj-$(CONFIG_SPL_USB_GADGET) += usb/common/ obj-$(CONFIG_SPL_USB_GADGET) += usb/gadget/udc/ -obj-$(CONFIG_SPL_WATCHDOG) += watchdog/ +obj-$(CONFIG_SPL_USB_HOST) += usb/common/ obj-$(CONFIG_SPL_USB_HOST) += usb/host/ +obj-$(CONFIG_SPL_WATCHDOG) += watchdog/ obj-$(CONFIG_SPL_SATA) += ata/ scsi/ obj-$(CONFIG_SPL_LEGACY_BLOCK) += block/ obj-$(CONFIG_SPL_THERMAL) += thermal/
drivers/usb/common/Makefile +1 -1
@@ -4,7 +4,7 @@ # obj-$(CONFIG_$(PHASE_)DM_USB) += common.o -obj-$(CONFIG_USB_DWC2) += dwc2_core.o +obj-$(CONFIG_$(PHASE_)USB_DWC2) += dwc2_core.o obj-$(CONFIG_USB_GADGET_DWC2_OTG) += dwc2_core.o obj-$(CONFIG_USB_ISP1760) += usb_urb.o obj-$(CONFIG_USB_MUSB_HOST) += usb_urb.o
drivers/usb/host/Kconfig +11 -0
@@ -417,6 +417,17 @@ config USB_DWC2 operation is compliant to the controller Supplement. If you want to enable this controller in host mode, say Y. +config SPL_USB_DWC2 + bool "DesignWare USB2 Core support in SPL" + depends on SPL_DM && SPL_OF_CONTROL + select SPL_USB_HOST + ---help--- + The DesignWare USB 2.0 controller is compliant with the + USB-Implementers Forum (USB-IF) USB 2.0 specifications. + Hi-Speed (480 Mbps), Full-Speed (12 Mbps), and Low-Speed (1.5 Mbps) + operation is compliant to the controller Supplement. If you want to + enable this controller in host mode, say Y. + if USB_DWC2 config USB_DWC2_BUFFER_SIZE int "Data buffer size in kB"
drivers/usb/host/Makefile +1 -1
@@ -57,4 +57,4 @@ obj-$(CONFIG_USB_XHCI_RCAR) += xhci-rcar.o obj-$(CONFIG_USB_XHCI_OCTEON) += dwc3-octeon-glue.o # designware -obj-$(CONFIG_USB_DWC2) += dwc2.o +obj-$(CONFIG_$(PHASE_)USB_DWC2) += dwc2.o
--
2.39.5
Re: [PATCH v3 09/12] usb: make dwc2_usb available in SPL
Hi Johan,
Quoted 2 lines · Johan Jonker
Make the
dwc2_usbdriver available in SPL to load U-boot (full) from a USB disk.
This seem to make it possible to disable inclusion of USB_DWC2 in SPL, not make it available. It already looks to be available in SPL?
Quoted 42 lines
Signed-off-by Johan Jonker <[email protected]>--- drivers/Makefile | 3 ++- drivers/usb/common/Makefile | 2 +- drivers/usb/host/Kconfig | 11 +++++++++++ drivers/usb/host/Makefile | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-)drivers/Makefile +2
-1@@ -68,8 +68,9 @@ obj-$(CONFIG_SPL_MUSB_NEW) += usb/musb-new/ obj-$(CONFIG_SPL_USB_GADGET) += usb/gadget/ obj-$(CONFIG_SPL_USB_GADGET) += usb/common/ obj-$(CONFIG_SPL_USB_GADGET) += usb/gadget/udc/ -obj-$(CONFIG_SPL_WATCHDOG) += watchdog/ +obj-$(CONFIG_SPL_USB_HOST) += usb/common/ obj-$(CONFIG_SPL_USB_HOST) += usb/host/ +obj-$(CONFIG_SPL_WATCHDOG) += watchdog/ obj-$(CONFIG_SPL_SATA) += ata/ scsi/ obj-$(CONFIG_SPL_LEGACY_BLOCK) += block/ obj-$(CONFIG_SPL_THERMAL) += thermal/drivers/usb/common/Makefile +1
-1@@ -4,7 +4,7 @@ # obj-$(CONFIG_$(PHASE_)DM_USB) += common.o -obj-$(CONFIG_USB_DWC2) += dwc2_core.o +obj-$(CONFIG_$(PHASE_)USB_DWC2) += dwc2_core.o obj-$(CONFIG_USB_GADGET_DWC2_OTG) += dwc2_core.o obj-$(CONFIG_USB_ISP1760) += usb_urb.o obj-$(CONFIG_USB_MUSB_HOST) += usb_urb.odrivers/usb/host/Kconfig +0
-0
drivers/usb/host/Kconfig config USB_DWC2 · line 422
Quoted 6 lines
drivers/usb/host/Kconfig +3
-0@@ -417,6 +417,17 @@ config USB_DWC2 operation is compliant to the controller Supplement. If you want to enable this controller in host mode, say Y. +config SPL_USB_DWC2 + bool "DesignWare USB2 Core support in SPL" + depends on SPL_DM && SPL_OF_CONTROL
This should likely be default USB_DWC2 to not break any existing platform/device already using this in SPL.
drivers/usb/host/Kconfig config USB_DWC2 · line 424
Quoted 2 lines
drivers/usb/host/Kconfig +2
-0+ select SPL_USB_HOST + ---help---
Please use plain help keyword, use of --help-- is deprecated.
Regards,
Jonas
Quoted 22 lines
drivers/usb/host/Kconfig +6
-0+ The DesignWare USB 2.0 controller is compliant with the + USB-Implementers Forum (USB-IF) USB 2.0 specifications. + Hi-Speed (480 Mbps), Full-Speed (12 Mbps), and Low-Speed (1.5 Mbps) + operation is compliant to the controller Supplement. If you want to + enable this controller in host mode, say Y. + if USB_DWC2 config USB_DWC2_BUFFER_SIZE int "Data buffer size in kB"drivers/usb/host/Makefile +1
-2@@ -57,4 +57,4 @@ obj-$(CONFIG_USB_XHCI_RCAR) += xhci-rcar.o obj-$(CONFIG_USB_XHCI_OCTEON) += dwc3-octeon-glue.o # designware -obj-$(CONFIG_USB_DWC2) += dwc2.o +obj-$(CONFIG_$(PHASE_)USB_DWC2) += dwc2.o --2.39.5
PATCH v3 10/12 rockchip: spl-boot-order: add usb boot option
In reply to Johan JonkerAdd usb boot option to spl-boot-order.c
--- arch/arm/mach-rockchip/spl-boot-order.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/mach-rockchip/spl-boot-order.c +3 -0
@@ -76,6 +76,9 @@ static int spl_node_to_boot_device(int node)if (!uclass_find_device_by_of_offset (UCLASS_SPI_FLASH , node, &parent))return BOOT_DEVICE_SPI ; +if (!uclass_get_device_by_of_offset (UCLASS_USB , node, &parent)) +return BOOT_DEVICE_USB ; +return -1 ; }
--
2.39.5
Re: [PATCH v3 10/12] rockchip: spl-boot-order: add usb boot option
Hi Johan,
Quoted 12 lines · Johan Jonker
Add usb boot option to
spl-boot-order.cSigned-off-by Johan Jonker <[email protected]>--- arch/arm/mach-rockchip/spl-boot-order.c | 3 +++ 1 file changed, 3 insertions(+)arch/arm/mach-rockchip/spl-boot-order.c +0
-0
arch/arm/mach-rockchip/spl-boot-order.c static int spl_node_to_boot_device(int node) · line 79
Quoted 4 lines
arch/arm/mach-rockchip/spl-boot-order.c +1
-0@@ -76,6 +76,9 @@ static int spl_node_to_boot_device(int node)if (!uclass_find_device_by_of_offset (UCLASS_SPI_FLASH , node, &parent))return BOOT_DEVICE_SPI ; +if (!uclass_get_device_by_of_offset (UCLASS_USB , node, &parent))
Please use uclass_find_device_by_of_offset() like the other ones. There should be no need to probe the device here, with find() here the probe happen a little bit later when the boot device method is run.
Regards,
Jonas
Quoted 8 lines
arch/arm/mach-rockchip/spl-boot-order.c +2
-1+return BOOT_DEVICE_USB ; +return -1 ; } --2.39.5
PATCH v3 11/12 arm: dts: rockchip: add USB required properties in SPL for mk808
In reply to Johan JonkerAdd USB required properties in SPL for mk808.
--- arch/arm/dts/rk3066a-mk808-u-boot.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
arch/arm/dts/rk3066a-mk808-u-boot.dtsi +18 -0
@@ -2,6 +2,12 @@ #include "rk3066a-u-boot.dtsi" +/ { + chosen { + u-boot,spl-boot-order = &mmc0, &usb_host; + }; +}; + &cru { bootph-all; };
@@ -41,3 +47,15 @@ &uart2 { bootph-all; }; + +&usb_host { + bootph-pre-ram; +}; + +&usbphy { + bootph-pre-ram; +}; + +&usbphy1 { + bootph-pre-ram; +};
--
2.39.5
PATCH v3 12/12 rockchip: configs: enable USB in SPL for mk808
In reply to Johan JonkerEnable USB in SPL support for mk808.
--- configs/mk808_defconfig | 4 ++++ 1 file changed, 4 insertions(+)
configs/mk808_defconfig +4 -0
@@ -46,6 +46,7 @@ CONFIG_SPL_MAX_SIZE=0x32000 CONFIG_SPL_NO_BSS_LIMIT=y CONFIG_SPL_FS_EXT4=y CONFIG_SYS_MMCSD_FS_BOOT_PARTITION=2 +CONFIG_SPL_DM_RESET=y CONFIG_TPL_HAVE_INIT_STACK=y # CONFIG_BOOTM_PLAN9 is not set # CONFIG_BOOTM_RTEMS is not set
@@ -87,6 +88,7 @@ CONFIG_SPL_MMC_UHS_SUPPORT=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_PHY_ROCKCHIP_USB2=y +CONFIG_SPL_PHY_ROCKCHIP_USB2=y CONFIG_PINCTRL=y CONFIG_DM_PMIC=y # CONFIG_SPL_PMIC_CHILDREN is not set
@@ -106,6 +108,8 @@ CONFIG_TPL_TIMER=y CONFIG_DESIGNWARE_APB_TIMER=y CONFIG_USB=y CONFIG_USB_DWC2=y +CONFIG_SPL_USB_DWC2=y +CONFIG_SPL_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_DWC2_OTG=y CONFIG_USB_FUNCTION_ROCKUSB=y
--
2.39.5