[PATCH v1 1/4] rockchip: usb: gadget: add rk3066 product id

From: Paweł Jarosz paweljarosz3691@gmail.com
Product id of rk3066 usb otg is 0x300a.
Signed-off-by: Paweł Jarosz paweljarosz3691@gmail.com Signed-off-by: Johan Jonker jbx6244@gmail.com --- drivers/usb/gadget/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index d81a9c5a..8c6cf474 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -61,6 +61,7 @@ config USB_GADGET_PRODUCT_NUM hex "Product ID of the USB device" default 0x1010 if ARCH_SUNXI default 0x310a if ROCKCHIP_RK3036 + default 0x300a if ROCKCHIP_RK3066 default 0x310c if ROCKCHIP_RK3128 default 0x320a if ROCKCHIP_RK3229 || ROCKCHIP_RK3288 default 0x330a if ROCKCHIP_RK3328

Add rk3066a/rk3188 support to rockchip_usb2_phy.c They don't have completely identical usb phy registers, so separate comapatible strings and data.
Signed-off-by: Johan Jonker jbx6244@gmail.com --- drivers/usb/phy/rockchip_usb2_phy.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/drivers/usb/phy/rockchip_usb2_phy.c b/drivers/usb/phy/rockchip_usb2_phy.c index 93caa821..c46ad86d 100644 --- a/drivers/usb/phy/rockchip_usb2_phy.c +++ b/drivers/usb/phy/rockchip_usb2_phy.c @@ -42,6 +42,12 @@ struct rockchip_usb2_phy_dt_id { const void *data; };
+static const struct rockchip_usb2_phy_cfg rk3066a_pdata = { + .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_usb2_phy_cfg rk3288_pdata = { .port_reset = {0x00, 12, 12, 0, 1}, .soft_con = {0x08, 2, 2, 0, 1}, @@ -49,6 +55,8 @@ static const struct rockchip_usb2_phy_cfg rk3288_pdata = { };
static struct rockchip_usb2_phy_dt_id rockchip_usb2_phy_dt_ids[] = { + { .compatible = "rockchip,rk3066a-usb-phy", .data = &rk3066a_pdata }, + { .compatible = "rockchip,rk3188-usb-phy", .data = &rk3288_pdata }, { .compatible = "rockchip,rk3288-usb-phy", .data = &rk3288_pdata }, {} };

On 2022/4/30 05:40, Johan Jonker wrote:
Add rk3066a/rk3188 support to rockchip_usb2_phy.c They don't have completely identical usb phy registers, so separate comapatible strings and data.
Signed-off-by: Johan Jonker jbx6244@gmail.com
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
drivers/usb/phy/rockchip_usb2_phy.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/drivers/usb/phy/rockchip_usb2_phy.c b/drivers/usb/phy/rockchip_usb2_phy.c index 93caa821..c46ad86d 100644 --- a/drivers/usb/phy/rockchip_usb2_phy.c +++ b/drivers/usb/phy/rockchip_usb2_phy.c @@ -42,6 +42,12 @@ struct rockchip_usb2_phy_dt_id { const void *data; };
+static const struct rockchip_usb2_phy_cfg rk3066a_pdata = {
- .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_usb2_phy_cfg rk3288_pdata = { .port_reset = {0x00, 12, 12, 0, 1}, .soft_con = {0x08, 2, 2, 0, 1},
@@ -49,6 +55,8 @@ static const struct rockchip_usb2_phy_cfg rk3288_pdata = { };
static struct rockchip_usb2_phy_dt_id rockchip_usb2_phy_dt_ids[] = {
- { .compatible = "rockchip,rk3066a-usb-phy", .data = &rk3066a_pdata },
- { .compatible = "rockchip,rk3188-usb-phy", .data = &rk3288_pdata }, { .compatible = "rockchip,rk3288-usb-phy", .data = &rk3288_pdata }, {} };

Change define condition in board_usb_init() function to allow rk3066/rk3188 to use the USB PHY driver.
Signed-off-by: Johan Jonker jbx6244@gmail.com --- arch/arm/mach-rockchip/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index 5304eb05..cbe00d64 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -90,7 +90,7 @@ int board_usb_init(int index, enum usb_init_type init) } otg_data.regs_otg = ofnode_get_addr(node);
-#ifdef CONFIG_ROCKCHIP_RK3288 +#ifdef CONFIG_ROCKCHIP_USB2_PHY int ret; u32 phandle, offset; ofnode phy_node;

On 2022/4/30 05:40, Johan Jonker wrote:
Change define condition in board_usb_init() function to allow rk3066/rk3188 to use the USB PHY driver.
Signed-off-by: Johan Jonker jbx6244@gmail.com
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
arch/arm/mach-rockchip/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index 5304eb05..cbe00d64 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -90,7 +90,7 @@ int board_usb_init(int index, enum usb_init_type init) } otg_data.regs_otg = ofnode_get_addr(node);
-#ifdef CONFIG_ROCKCHIP_RK3288 +#ifdef CONFIG_ROCKCHIP_USB2_PHY int ret; u32 phandle, offset; ofnode phy_node;

With the conversion of rockchip-usb-phy.yaml a long time used fallback string for rk3066a/rk3188 was added. The linux driver doesn't do much with the GRF phy address range, however the u-boot driver rockchip_usb2_phy.c does. The bits in GRF_UOC0_CON2 for rk3066a/rk3188 and rk3288 for example don't match. Remove the usb-phy fallback string for rk3188 to prevent possible strange side effects.
Signed-off-by: Johan Jonker jbx6244@gmail.com --- arch/arm/dts/rk3188.dtsi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/arm/dts/rk3188.dtsi b/arch/arm/dts/rk3188.dtsi index 6764776c..9a80f83a 100644 --- a/arch/arm/dts/rk3188.dtsi +++ b/arch/arm/dts/rk3188.dtsi @@ -642,8 +642,7 @@ compatible = "rockchip,rk3188-grf", "syscon", "simple-mfd";
usbphy: usbphy { - compatible = "rockchip,rk3188-usb-phy", - "rockchip,rk3288-usb-phy"; + compatible = "rockchip,rk3188-usb-phy"; #address-cells = <1>; #size-cells = <0>; status = "disabled";

On 2022/4/30 05:40, Johan Jonker wrote:
With the conversion of rockchip-usb-phy.yaml a long time used fallback string for rk3066a/rk3188 was added. The linux driver doesn't do much with the GRF phy address range, however the u-boot driver rockchip_usb2_phy.c does. The bits in GRF_UOC0_CON2 for rk3066a/rk3188 and rk3288 for example don't match. Remove the usb-phy fallback string for rk3188 to prevent possible strange side effects.
Signed-off-by: Johan Jonker jbx6244@gmail.com
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
arch/arm/dts/rk3188.dtsi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/arm/dts/rk3188.dtsi b/arch/arm/dts/rk3188.dtsi index 6764776c..9a80f83a 100644 --- a/arch/arm/dts/rk3188.dtsi +++ b/arch/arm/dts/rk3188.dtsi @@ -642,8 +642,7 @@ compatible = "rockchip,rk3188-grf", "syscon", "simple-mfd";
usbphy: usbphy {
compatible = "rockchip,rk3188-usb-phy",
"rockchip,rk3288-usb-phy";
#address-cells = <1>; #size-cells = <0>; status = "disabled";compatible = "rockchip,rk3188-usb-phy";

On 2022/4/30 05:40, Johan Jonker wrote:
From: Paweł Jarosz paweljarosz3691@gmail.com
Product id of rk3066 usb otg is 0x300a.
Signed-off-by: Paweł Jarosz paweljarosz3691@gmail.com Signed-off-by: Johan Jonker jbx6244@gmail.com
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
drivers/usb/gadget/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index d81a9c5a..8c6cf474 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -61,6 +61,7 @@ config USB_GADGET_PRODUCT_NUM hex "Product ID of the USB device" default 0x1010 if ARCH_SUNXI default 0x310a if ROCKCHIP_RK3036
- default 0x300a if ROCKCHIP_RK3066 default 0x310c if ROCKCHIP_RK3128 default 0x320a if ROCKCHIP_RK3229 || ROCKCHIP_RK3288 default 0x330a if ROCKCHIP_RK3328
participants (2)
-
Johan Jonker
-
Kever Yang