Skip to contentSkip to conversation

rockchip: usb: gadget: add rk3066 product id

PATCH In review Johan Jonker 2 participants 8 messages Apr 29, 2022 – May 26, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

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

From: Paweł Jarosz <[email protected]>

Product id of rk3066 usb otg is 0x300a.

---
 drivers/usb/gadget/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/gadget/Kconfig +1 -0
index d81a9c5a..8c6cf474 100644
@@ -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
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/4 rockchip: usb: phy: add rk3066/rk3188 support

Add rk3066a/rk3188 support to rockchip_usb2_phy.c They don't have completely identical usb phy registers, so separate comapatible strings and data.

---
 drivers/usb/phy/rockchip_usb2_phy.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/usb/phy/rockchip_usb2_phy.c +8 -0
index 93caa821..c46ad86d 100644
@@ -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 },
 	{}
 };
Signature · 1 line
2.20.1
Reviewed-by on v1 2/4
#2 lore raw

Re: [PATCH v1 2/4] rockchip: usb: phy: add rk3066/rk3188 support

Quoted 5 lines · Johan Jonker

Add rk3066a/rk3188 support to rockchip_usb2_phy.c They don't have completely identical usb phy registers, so separate comapatible strings and data.

Thanks,
- Kever

Quoted 30 lines
---
  drivers/usb/phy/rockchip_usb2_phy.c | 8 ++++++++
  1 file changed, 8 insertions(+)
drivers/usb/phy/rockchip_usb2_phy.c +8 -0
index 93caa821..c46ad86d 100644
@@ -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 },
  	{}
  };
#3 lore raw

PATCH 3/4 rockchip: board: change condition board_usb_init() in function

In reply to Johan Jonker

Change define condition in board_usb_init() function to allow rk3066/rk3188 to use the USB PHY driver.

---
 arch/arm/mach-rockchip/board.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/board.c +1 -1
index 5304eb05..cbe00d64 100644
@@ -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;
Signature · 1 line
2.20.1
Reviewed-by on v1 3/4
#4 lore raw

Re: [PATCH v1 3/4] rockchip: board: change condition board_usb_init() in function

Quoted 4 lines · Johan Jonker

Change define condition in board_usb_init() function to allow rk3066/rk3188 to use the USB PHY driver.

Thanks,
- Kever

Quoted 17 lines
---
  arch/arm/mach-rockchip/board.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/board.c +1 -1
index 5304eb05..cbe00d64 100644
@@ -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;
#5 lore raw

PATCH 4/4 arm: dts: rockchip: remove usb-phy fallback string for rk3188

In reply to Johan Jonker

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.

---
 arch/arm/dts/rk3188.dtsi | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/dts/rk3188.dtsi +1 -2
index 6764776c..9a80f83a 100644
@@ -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";
Signature · 1 line
2.20.1
Reviewed-by on v1 4/4
#6 lore raw

Re: [PATCH v1 4/4] arm: dts: rockchip: remove usb-phy fallback string for rk3188

Quoted 8 lines · Johan Jonker

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.

Thanks,
- Kever

Quoted 18 lines
---
  arch/arm/dts/rk3188.dtsi | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/dts/rk3188.dtsi +1 -2
index 6764776c..9a80f83a 100644
@@ -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";
Reviewed-by on v1 1/4
#7 lore raw
In reply to Johan Jonker
Quoted 6 lines · Johan Jonker

From: Paweł Jarosz <[email protected]>

Product id of rk3066 usb otg is 0x300a.

Thanks,
- Kever

Quoted 16 lines
---
  drivers/usb/gadget/Kconfig | 1 +
  1 file changed, 1 insertion(+)
drivers/usb/gadget/Kconfig +1 -0
index d81a9c5a..8c6cf474 100644
@@ -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