linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] Add OTG support for Ingenic SoCs.
@ 2022-04-14 19:25 周琰杰 (Zhou Yanjie)
  2022-04-14 19:25 ` [PATCH v3 1/3] dt-bindings: dwc2: Add bindings for new " 周琰杰 (Zhou Yanjie)
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: 周琰杰 (Zhou Yanjie) @ 2022-04-14 19:25 UTC (permalink / raw)
  To: gregkh, hminas, robh+dt, krzk+dt, tsbogend, paul
  Cc: linux-usb, linux-mips, linux-kernel, devicetree, dragancecavac,
	hns, dongsheng.qiu, aric.pzqi, rick.tyliu, sernia.zhou,
	zhenwenjin, reimu

1.Add OTG support for the JZ4775 SoC, the JZ4780 SoC, the X1000
  SoC, the X1600 SoC, the X1700 SoC, the X1830 SoC, and the
  X2000 SoC.
2.Introduce support for disable Ingenic overcurrent detection,
  once selected it enables GOTGCTL register bits VbvalidOvEn
  and VbvalidOvVal to disable the VBUS overcurrent detection.

v1->v2:
1.Add Rob Herring's Acked-by.
2.Add Minas Harutyunyan's Acked-by.
3.Use "activate_ingenic_overcurrent_detection" instead
  "deactivate_ingenic_overcurrent_detection" as Greg's suggestion.

v2->v3:
Refresh USB nodes in device tree files, remove "snps,dwc2" since
it is nolonger needed.

周琰杰 (Zhou Yanjie) (3):
  dt-bindings: dwc2: Add bindings for new Ingenic SoCs.
  USB: dwc2: Add OTG support for Ingenic SoCs.
  MIPS: Ingenic: Refresh USB nodes to match driver changes.

 Documentation/devicetree/bindings/usb/dwc2.yaml |  7 ++++
 arch/mips/boot/dts/ingenic/jz4780.dtsi          |  2 +-
 arch/mips/boot/dts/ingenic/x1000.dtsi           |  2 +-
 arch/mips/boot/dts/ingenic/x1830.dtsi           |  2 +-
 drivers/usb/dwc2/core.c                         |  9 +++++
 drivers/usb/dwc2/core.h                         |  5 +++
 drivers/usb/dwc2/params.c                       | 50 ++++++++++++++++++++++++-
 7 files changed, 73 insertions(+), 4 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v3 1/3] dt-bindings: dwc2: Add bindings for new Ingenic SoCs.
  2022-04-14 19:25 [PATCH v3 0/3] Add OTG support for Ingenic SoCs 周琰杰 (Zhou Yanjie)
@ 2022-04-14 19:25 ` 周琰杰 (Zhou Yanjie)
  2022-04-16 16:34   ` Paul Cercueil
  2022-04-14 19:25 ` [PATCH v3 2/3] USB: dwc2: Add OTG support for " 周琰杰 (Zhou Yanjie)
  2022-04-14 19:25 ` [PATCH v3 3/3] MIPS: Ingenic: Refresh USB nodes to match driver changes 周琰杰 (Zhou Yanjie)
  2 siblings, 1 reply; 9+ messages in thread
From: 周琰杰 (Zhou Yanjie) @ 2022-04-14 19:25 UTC (permalink / raw)
  To: gregkh, hminas, robh+dt, krzk+dt, tsbogend, paul
  Cc: linux-usb, linux-mips, linux-kernel, devicetree, dragancecavac,
	hns, dongsheng.qiu, aric.pzqi, rick.tyliu, sernia.zhou,
	zhenwenjin, reimu

Add the dwc2 bindings for the JZ4775 SoC, the JZ4780 SoC, the X1000
SoC, the X1600 SoC, the X1700 SoC, the X1830 SoC, and the X2000 SoC
from Ingenic.

Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
Acked-by: Rob Herring <robh@kernel.org>
---

Notes:
    v1->v2:
    Add Rob Herring's Acked-by.
    
    v2->v3:
    No change.

 Documentation/devicetree/bindings/usb/dwc2.yaml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/dwc2.yaml b/Documentation/devicetree/bindings/usb/dwc2.yaml
index 4cebce6..c6e8c0b 100644
--- a/Documentation/devicetree/bindings/usb/dwc2.yaml
+++ b/Documentation/devicetree/bindings/usb/dwc2.yaml
@@ -17,6 +17,13 @@ properties:
     oneOf:
       - const: brcm,bcm2835-usb
       - const: hisilicon,hi6220-usb
+      - const: ingenic,jz4775-otg
+      - const: ingenic,jz4780-otg
+      - const: ingenic,x1000-otg
+      - const: ingenic,x1600-otg
+      - const: ingenic,x1700-otg
+      - const: ingenic,x1830-otg
+      - const: ingenic,x2000-otg
       - items:
           - const: rockchip,rk3066-usb
           - const: snps,dwc2
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 2/3] USB: dwc2: Add OTG support for Ingenic SoCs.
  2022-04-14 19:25 [PATCH v3 0/3] Add OTG support for Ingenic SoCs 周琰杰 (Zhou Yanjie)
  2022-04-14 19:25 ` [PATCH v3 1/3] dt-bindings: dwc2: Add bindings for new " 周琰杰 (Zhou Yanjie)
@ 2022-04-14 19:25 ` 周琰杰 (Zhou Yanjie)
  2022-04-14 19:25 ` [PATCH v3 3/3] MIPS: Ingenic: Refresh USB nodes to match driver changes 周琰杰 (Zhou Yanjie)
  2 siblings, 0 replies; 9+ messages in thread
From: 周琰杰 (Zhou Yanjie) @ 2022-04-14 19:25 UTC (permalink / raw)
  To: gregkh, hminas, robh+dt, krzk+dt, tsbogend, paul
  Cc: linux-usb, linux-mips, linux-kernel, devicetree, dragancecavac,
	hns, dongsheng.qiu, aric.pzqi, rick.tyliu, sernia.zhou,
	zhenwenjin, reimu

Add OTG support for the JZ4775 SoC, the JZ4780 SoC, the X1000 SoC,
the X1600 SoC, the X1700 SoC, the X1830 SoC, and the X2000 SoC
from Ingenic.

Introduce support for disable Ingenic overcurrent detection, once
selected, it enables the GOTGCTL register bits VbvalidOvEn and
VbvalidOvVal to disable the VBUS overcurrent detection.

This patch is derived from Dragan Čečavac (in the kernel 3.18.3
tree of CI20). It is very useful for the MIPS Creator CI20 (r1).
Without this patch, OTG port of CI20 has a great probability to
face overcurrent warning, which breaks the OTG functionality.

Signed-off-by: Dragan Čečavac <dragancecavac@yahoo.com>
Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
Acked-by: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
---

Notes:
    v1->v2:
    1.Add Minas Harutyunyan's Acked-by.
    2.Use "activate_ingenic_overcurrent_detection" instead
      "deactivate_ingenic_overcurrent_detection" as Greg's
      suggestion.
    
    v2->v3:
    No change.

 drivers/usb/dwc2/core.c   |  9 +++++++++
 drivers/usb/dwc2/core.h   |  5 +++++
 drivers/usb/dwc2/params.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
index cf0bcd0..dc4fc72 100644
--- a/drivers/usb/dwc2/core.c
+++ b/drivers/usb/dwc2/core.c
@@ -1153,6 +1153,7 @@ static void dwc2_set_turnaround_time(struct dwc2_hsotg *hsotg)
 int dwc2_phy_init(struct dwc2_hsotg *hsotg, bool select_phy)
 {
 	u32 usbcfg;
+	u32 otgctl;
 	int retval = 0;
 
 	if ((hsotg->params.speed == DWC2_SPEED_PARAM_FULL ||
@@ -1187,6 +1188,14 @@ int dwc2_phy_init(struct dwc2_hsotg *hsotg, bool select_phy)
 		dwc2_writel(hsotg, usbcfg, GUSBCFG);
 	}
 
+	if (!hsotg->params.activate_ingenic_overcurrent_detection) {
+		if (dwc2_is_host_mode(hsotg)) {
+			otgctl = readl(hsotg->regs + GOTGCTL);
+			otgctl |= GOTGCTL_VBVALOEN | GOTGCTL_VBVALOVAL;
+			writel(otgctl, hsotg->regs + GOTGCTL);
+		}
+	}
+
 	return retval;
 }
 
diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 88c337b..0683852 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -426,6 +426,10 @@ enum dwc2_ep0_state {
  *			detection using GGPIO register.
  *			0 - Deactivate the external level detection (default)
  *			1 - Activate the external level detection
+ * @activate_ingenic_overcurrent_detection: Activate Ingenic overcurrent
+ *			detection.
+ *			0 - Deactivate the overcurrent detection
+ *			1 - Activate the overcurrent detection (default)
  * @g_dma:              Enables gadget dma usage (default: autodetect).
  * @g_dma_desc:         Enables gadget descriptor DMA (default: autodetect).
  * @g_rx_fifo_size:	The periodic rx fifo size for the device, in
@@ -494,6 +498,7 @@ struct dwc2_core_params {
 	u8 hird_threshold;
 	bool activate_stm_fs_transceiver;
 	bool activate_stm_id_vb_detection;
+	bool activate_ingenic_overcurrent_detection;
 	bool ipg_isoc_en;
 	u16 max_packet_count;
 	u32 max_transfer_size;
diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
index 1306f4e..fdb8a42f 100644
--- a/drivers/usb/dwc2/params.c
+++ b/drivers/usb/dwc2/params.c
@@ -73,6 +73,47 @@ static void dwc2_set_his_params(struct dwc2_hsotg *hsotg)
 	p->power_down = DWC2_POWER_DOWN_PARAM_NONE;
 }
 
+static void dwc2_set_jz4775_params(struct dwc2_hsotg *hsotg)
+{
+	struct dwc2_core_params *p = &hsotg->params;
+
+	p->otg_caps.hnp_support = false;
+	p->speed = DWC2_SPEED_PARAM_HIGH;
+	p->phy_type = DWC2_PHY_TYPE_PARAM_UTMI;
+	p->phy_utmi_width = 16;
+	p->activate_ingenic_overcurrent_detection =
+		!device_property_read_bool(hsotg->dev, "disable-over-current");
+}
+
+static void dwc2_set_x1600_params(struct dwc2_hsotg *hsotg)
+{
+	struct dwc2_core_params *p = &hsotg->params;
+
+	p->otg_caps.hnp_support = false;
+	p->speed = DWC2_SPEED_PARAM_HIGH;
+	p->host_channels = 16;
+	p->phy_type = DWC2_PHY_TYPE_PARAM_UTMI;
+	p->phy_utmi_width = 16;
+	p->activate_ingenic_overcurrent_detection =
+		!device_property_read_bool(hsotg->dev, "disable-over-current");
+}
+
+static void dwc2_set_x2000_params(struct dwc2_hsotg *hsotg)
+{
+	struct dwc2_core_params *p = &hsotg->params;
+
+	p->otg_caps.hnp_support = false;
+	p->speed = DWC2_SPEED_PARAM_HIGH;
+	p->host_rx_fifo_size = 1024;
+	p->host_nperio_tx_fifo_size = 1024;
+	p->host_perio_tx_fifo_size = 1024;
+	p->host_channels = 16;
+	p->phy_type = DWC2_PHY_TYPE_PARAM_UTMI;
+	p->phy_utmi_width = 16;
+	p->activate_ingenic_overcurrent_detection =
+		!device_property_read_bool(hsotg->dev, "disable-over-current");
+}
+
 static void dwc2_set_s3c6400_params(struct dwc2_hsotg *hsotg)
 {
 	struct dwc2_core_params *p = &hsotg->params;
@@ -221,7 +262,14 @@ static void dwc2_set_stm32mp15_hsotg_params(struct dwc2_hsotg *hsotg)
 
 const struct of_device_id dwc2_of_match_table[] = {
 	{ .compatible = "brcm,bcm2835-usb", .data = dwc2_set_bcm_params },
-	{ .compatible = "hisilicon,hi6220-usb", .data = dwc2_set_his_params  },
+	{ .compatible = "hisilicon,hi6220-usb", .data = dwc2_set_his_params },
+	{ .compatible = "ingenic,jz4775-otg", .data = dwc2_set_jz4775_params },
+	{ .compatible = "ingenic,jz4780-otg", .data = dwc2_set_jz4775_params },
+	{ .compatible = "ingenic,x1000-otg", .data = dwc2_set_jz4775_params },
+	{ .compatible = "ingenic,x1600-otg", .data = dwc2_set_x1600_params },
+	{ .compatible = "ingenic,x1700-otg", .data = dwc2_set_x1600_params },
+	{ .compatible = "ingenic,x1830-otg", .data = dwc2_set_x1600_params },
+	{ .compatible = "ingenic,x2000-otg", .data = dwc2_set_x2000_params },
 	{ .compatible = "rockchip,rk3066-usb", .data = dwc2_set_rk_params },
 	{ .compatible = "lantiq,arx100-usb", .data = dwc2_set_ltq_params },
 	{ .compatible = "lantiq,xrx200-usb", .data = dwc2_set_ltq_params },
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 3/3] MIPS: Ingenic: Refresh USB nodes to match driver changes.
  2022-04-14 19:25 [PATCH v3 0/3] Add OTG support for Ingenic SoCs 周琰杰 (Zhou Yanjie)
  2022-04-14 19:25 ` [PATCH v3 1/3] dt-bindings: dwc2: Add bindings for new " 周琰杰 (Zhou Yanjie)
  2022-04-14 19:25 ` [PATCH v3 2/3] USB: dwc2: Add OTG support for " 周琰杰 (Zhou Yanjie)
@ 2022-04-14 19:25 ` 周琰杰 (Zhou Yanjie)
  2022-04-15 15:07   ` Paul Cercueil
  2 siblings, 1 reply; 9+ messages in thread
From: 周琰杰 (Zhou Yanjie) @ 2022-04-14 19:25 UTC (permalink / raw)
  To: gregkh, hminas, robh+dt, krzk+dt, tsbogend, paul
  Cc: linux-usb, linux-mips, linux-kernel, devicetree, dragancecavac,
	hns, dongsheng.qiu, aric.pzqi, rick.tyliu, sernia.zhou,
	zhenwenjin, reimu

Refresh USB nodes in the jz4780.dtsi, x1000.dtsi, and x1830.dtsi files.

Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
---

Notes:
    v3:
    New patch.

 arch/mips/boot/dts/ingenic/jz4780.dtsi | 2 +-
 arch/mips/boot/dts/ingenic/x1000.dtsi  | 2 +-
 arch/mips/boot/dts/ingenic/x1830.dtsi  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/mips/boot/dts/ingenic/jz4780.dtsi b/arch/mips/boot/dts/ingenic/jz4780.dtsi
index b998301..c182a65 100644
--- a/arch/mips/boot/dts/ingenic/jz4780.dtsi
+++ b/arch/mips/boot/dts/ingenic/jz4780.dtsi
@@ -577,7 +577,7 @@
 	};
 
 	otg: usb@13500000 {
-		compatible = "ingenic,jz4780-otg", "snps,dwc2";
+		compatible = "ingenic,jz4780-otg";
 		reg = <0x13500000 0x40000>;
 
 		interrupt-parent = <&intc>;
diff --git a/arch/mips/boot/dts/ingenic/x1000.dtsi b/arch/mips/boot/dts/ingenic/x1000.dtsi
index 8bd27ede..343818a2 100644
--- a/arch/mips/boot/dts/ingenic/x1000.dtsi
+++ b/arch/mips/boot/dts/ingenic/x1000.dtsi
@@ -366,7 +366,7 @@
 	};
 
 	otg: usb@13500000 {
-		compatible = "ingenic,x1000-otg", "snps,dwc2";
+		compatible = "ingenic,x1000-otg";
 		reg = <0x13500000 0x40000>;
 
 		interrupt-parent = <&intc>;
diff --git a/arch/mips/boot/dts/ingenic/x1830.dtsi b/arch/mips/boot/dts/ingenic/x1830.dtsi
index 2595df8..6aff19f 100644
--- a/arch/mips/boot/dts/ingenic/x1830.dtsi
+++ b/arch/mips/boot/dts/ingenic/x1830.dtsi
@@ -355,7 +355,7 @@
 	};
 
 	otg: usb@13500000 {
-		compatible = "ingenic,x1830-otg", "snps,dwc2";
+		compatible = "ingenic,x1830-otg";
 		reg = <0x13500000 0x40000>;
 
 		interrupt-parent = <&intc>;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 3/3] MIPS: Ingenic: Refresh USB nodes to match driver changes.
  2022-04-14 19:25 ` [PATCH v3 3/3] MIPS: Ingenic: Refresh USB nodes to match driver changes 周琰杰 (Zhou Yanjie)
@ 2022-04-15 15:07   ` Paul Cercueil
  2022-04-16 12:16     ` Zhou Yanjie
  0 siblings, 1 reply; 9+ messages in thread
From: Paul Cercueil @ 2022-04-15 15:07 UTC (permalink / raw)
  To: 周琰杰
  Cc: gregkh, hminas, robh+dt, krzk+dt, tsbogend, linux-usb,
	linux-mips, linux-kernel, devicetree, dragancecavac, hns,
	dongsheng.qiu, aric.pzqi, rick.tyliu, sernia.zhou, zhenwenjin,
	reimu

Hi Zhou,


Le ven., avril 15 2022 at 03:25:37 +0800, 周琰杰 (Zhou Yanjie) 
<zhouyanjie@wanyeetech.com> a écrit :
> Refresh USB nodes in the jz4780.dtsi, x1000.dtsi, and x1830.dtsi 
> files.
> 
> Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
> ---
> 
> Notes:
>     v3:
>     New patch.
> 
>  arch/mips/boot/dts/ingenic/jz4780.dtsi | 2 +-
>  arch/mips/boot/dts/ingenic/x1000.dtsi  | 2 +-
>  arch/mips/boot/dts/ingenic/x1830.dtsi  | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/mips/boot/dts/ingenic/jz4780.dtsi 
> b/arch/mips/boot/dts/ingenic/jz4780.dtsi
> index b998301..c182a65 100644
> --- a/arch/mips/boot/dts/ingenic/jz4780.dtsi
> +++ b/arch/mips/boot/dts/ingenic/jz4780.dtsi
> @@ -577,7 +577,7 @@
>  	};
> 
>  	otg: usb@13500000 {
> -		compatible = "ingenic,jz4780-otg", "snps,dwc2";
> +		compatible = "ingenic,jz4780-otg";

Could you refresh my memory - why are the "snps,dwc2" fallback strings 
removed?

To me it seems like they should be here, since the OTG IP in Ingenic 
SoCs is derived from the DWC2 IP.

Cheers,
-Paul

>  		reg = <0x13500000 0x40000>;
> 
>  		interrupt-parent = <&intc>;
> diff --git a/arch/mips/boot/dts/ingenic/x1000.dtsi 
> b/arch/mips/boot/dts/ingenic/x1000.dtsi
> index 8bd27ede..343818a2 100644
> --- a/arch/mips/boot/dts/ingenic/x1000.dtsi
> +++ b/arch/mips/boot/dts/ingenic/x1000.dtsi
> @@ -366,7 +366,7 @@
>  	};
> 
>  	otg: usb@13500000 {
> -		compatible = "ingenic,x1000-otg", "snps,dwc2";
> +		compatible = "ingenic,x1000-otg";
>  		reg = <0x13500000 0x40000>;
> 
>  		interrupt-parent = <&intc>;
> diff --git a/arch/mips/boot/dts/ingenic/x1830.dtsi 
> b/arch/mips/boot/dts/ingenic/x1830.dtsi
> index 2595df8..6aff19f 100644
> --- a/arch/mips/boot/dts/ingenic/x1830.dtsi
> +++ b/arch/mips/boot/dts/ingenic/x1830.dtsi
> @@ -355,7 +355,7 @@
>  	};
> 
>  	otg: usb@13500000 {
> -		compatible = "ingenic,x1830-otg", "snps,dwc2";
> +		compatible = "ingenic,x1830-otg";
>  		reg = <0x13500000 0x40000>;
> 
>  		interrupt-parent = <&intc>;
> --
> 2.7.4
> 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 3/3] MIPS: Ingenic: Refresh USB nodes to match driver changes.
  2022-04-15 15:07   ` Paul Cercueil
@ 2022-04-16 12:16     ` Zhou Yanjie
  2022-04-16 16:34       ` Paul Cercueil
  0 siblings, 1 reply; 9+ messages in thread
From: Zhou Yanjie @ 2022-04-16 12:16 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: gregkh, hminas, robh+dt, krzk+dt, tsbogend, linux-usb,
	linux-mips, linux-kernel, devicetree, dragancecavac, hns,
	dongsheng.qiu, aric.pzqi, rick.tyliu, sernia.zhou, zhenwenjin,
	reimu

Hi Paul,

On 2022/4/15 下午11:07, Paul Cercueil wrote:
> Hi Zhou,
>
>
> Le ven., avril 15 2022 at 03:25:37 +0800, 周琰杰 (Zhou Yanjie) 
> <zhouyanjie@wanyeetech.com> a écrit :
>> Refresh USB nodes in the jz4780.dtsi, x1000.dtsi, and x1830.dtsi files.
>>
>> Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
>> ---
>>
>> Notes:
>>     v3:
>>     New patch.
>>
>>  arch/mips/boot/dts/ingenic/jz4780.dtsi | 2 +-
>>  arch/mips/boot/dts/ingenic/x1000.dtsi  | 2 +-
>>  arch/mips/boot/dts/ingenic/x1830.dtsi  | 2 +-
>>  3 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/mips/boot/dts/ingenic/jz4780.dtsi 
>> b/arch/mips/boot/dts/ingenic/jz4780.dtsi
>> index b998301..c182a65 100644
>> --- a/arch/mips/boot/dts/ingenic/jz4780.dtsi
>> +++ b/arch/mips/boot/dts/ingenic/jz4780.dtsi
>> @@ -577,7 +577,7 @@
>>      };
>>
>>      otg: usb@13500000 {
>> -        compatible = "ingenic,jz4780-otg", "snps,dwc2";
>> +        compatible = "ingenic,jz4780-otg";
>
> Could you refresh my memory - why are the "snps,dwc2" fallback strings 
> removed?
>
> To me it seems like they should be here, since the OTG IP in Ingenic 
> SoCs is derived from the DWC2 IP.


The reason is that Nikolaus found that the current jz4780.dtsi will cause
dtbscheck to complain. After discussion, Nikolaus concluded three feasible
solutions, see here:
https://lkml.org/lkml/2022/4/13/1097

And it seems that Krzysztof prefers the c) option.


Thanks and best regards!


>
> Cheers,
> -Paul
>
>>          reg = <0x13500000 0x40000>;
>>
>>          interrupt-parent = <&intc>;
>> diff --git a/arch/mips/boot/dts/ingenic/x1000.dtsi 
>> b/arch/mips/boot/dts/ingenic/x1000.dtsi
>> index 8bd27ede..343818a2 100644
>> --- a/arch/mips/boot/dts/ingenic/x1000.dtsi
>> +++ b/arch/mips/boot/dts/ingenic/x1000.dtsi
>> @@ -366,7 +366,7 @@
>>      };
>>
>>      otg: usb@13500000 {
>> -        compatible = "ingenic,x1000-otg", "snps,dwc2";
>> +        compatible = "ingenic,x1000-otg";
>>          reg = <0x13500000 0x40000>;
>>
>>          interrupt-parent = <&intc>;
>> diff --git a/arch/mips/boot/dts/ingenic/x1830.dtsi 
>> b/arch/mips/boot/dts/ingenic/x1830.dtsi
>> index 2595df8..6aff19f 100644
>> --- a/arch/mips/boot/dts/ingenic/x1830.dtsi
>> +++ b/arch/mips/boot/dts/ingenic/x1830.dtsi
>> @@ -355,7 +355,7 @@
>>      };
>>
>>      otg: usb@13500000 {
>> -        compatible = "ingenic,x1830-otg", "snps,dwc2";
>> +        compatible = "ingenic,x1830-otg";
>>          reg = <0x13500000 0x40000>;
>>
>>          interrupt-parent = <&intc>;
>> -- 
>> 2.7.4
>>
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 1/3] dt-bindings: dwc2: Add bindings for new Ingenic SoCs.
  2022-04-14 19:25 ` [PATCH v3 1/3] dt-bindings: dwc2: Add bindings for new " 周琰杰 (Zhou Yanjie)
@ 2022-04-16 16:34   ` Paul Cercueil
  2022-04-17  9:27     ` Zhou Yanjie
  0 siblings, 1 reply; 9+ messages in thread
From: Paul Cercueil @ 2022-04-16 16:34 UTC (permalink / raw)
  To: 周琰杰
  Cc: gregkh, hminas, robh+dt, krzk+dt, tsbogend, linux-usb,
	linux-mips, linux-kernel, devicetree, dragancecavac, hns,
	dongsheng.qiu, aric.pzqi, rick.tyliu, sernia.zhou, zhenwenjin,
	reimu

Hi Zhou,

Le ven., avril 15 2022 at 03:25:35 +0800, 周琰杰 (Zhou Yanjie) 
<zhouyanjie@wanyeetech.com> a écrit :
> Add the dwc2 bindings for the JZ4775 SoC, the JZ4780 SoC, the X1000
> SoC, the X1600 SoC, the X1700 SoC, the X1830 SoC, and the X2000 SoC
> from Ingenic.
> 
> Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
> Acked-by: Rob Herring <robh@kernel.org>
> ---
> 
> Notes:
>     v1->v2:
>     Add Rob Herring's Acked-by.
> 
>     v2->v3:
>     No change.
> 
>  Documentation/devicetree/bindings/usb/dwc2.yaml | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/usb/dwc2.yaml 
> b/Documentation/devicetree/bindings/usb/dwc2.yaml
> index 4cebce6..c6e8c0b 100644
> --- a/Documentation/devicetree/bindings/usb/dwc2.yaml
> +++ b/Documentation/devicetree/bindings/usb/dwc2.yaml
> @@ -17,6 +17,13 @@ properties:
>      oneOf:
>        - const: brcm,bcm2835-usb
>        - const: hisilicon,hi6220-usb
> +      - const: ingenic,jz4775-otg
> +      - const: ingenic,jz4780-otg
> +      - const: ingenic,x1000-otg

The driver handles the JZ4775, JZ4780 and X1000 the exact same way. 
Maybe the latter two should use the JZ4775 string as the fallback? Do 
you know if the IP cores are any different?

> +      - const: ingenic,x1600-otg
> +      - const: ingenic,x1700-otg
> +      - const: ingenic,x1830-otg

Same here (and btw, first time I hear about the X1600 and X1700 ;))

Cheers,
-Paul

> +      - const: ingenic,x2000-otg
>        - items:
>            - const: rockchip,rk3066-usb
>            - const: snps,dwc2
> --
> 2.7.4
> 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 3/3] MIPS: Ingenic: Refresh USB nodes to match driver changes.
  2022-04-16 12:16     ` Zhou Yanjie
@ 2022-04-16 16:34       ` Paul Cercueil
  0 siblings, 0 replies; 9+ messages in thread
From: Paul Cercueil @ 2022-04-16 16:34 UTC (permalink / raw)
  To: Zhou Yanjie
  Cc: gregkh, hminas, robh+dt, krzk+dt, tsbogend, linux-usb,
	linux-mips, linux-kernel, devicetree, dragancecavac, hns,
	dongsheng.qiu, aric.pzqi, rick.tyliu, sernia.zhou, zhenwenjin,
	reimu

Hi Zhou,

Le sam., avril 16 2022 at 20:16:33 +0800, Zhou Yanjie 
<zhouyanjie@wanyeetech.com> a écrit :
> Hi Paul,
> 
> On 2022/4/15 下午11:07, Paul Cercueil wrote:
>> Hi Zhou,
>> 
>> 
>> Le ven., avril 15 2022 at 03:25:37 +0800, 周琰杰 (Zhou Yanjie) 
>> \x7f<zhouyanjie@wanyeetech.com> a écrit :
>>> Refresh USB nodes in the jz4780.dtsi, x1000.dtsi, and x1830.dtsi 
>>> files.
>>> 
>>> Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
>>> ---
>>> 
>>> Notes:
>>>     v3:
>>>     New patch.
>>> 
>>>  arch/mips/boot/dts/ingenic/jz4780.dtsi | 2 +-
>>>  arch/mips/boot/dts/ingenic/x1000.dtsi  | 2 +-
>>>  arch/mips/boot/dts/ingenic/x1830.dtsi  | 2 +-
>>>  3 files changed, 3 insertions(+), 3 deletions(-)
>>> 
>>> diff --git a/arch/mips/boot/dts/ingenic/jz4780.dtsi 
>>> \x7f\x7fb/arch/mips/boot/dts/ingenic/jz4780.dtsi
>>> index b998301..c182a65 100644
>>> --- a/arch/mips/boot/dts/ingenic/jz4780.dtsi
>>> +++ b/arch/mips/boot/dts/ingenic/jz4780.dtsi
>>> @@ -577,7 +577,7 @@
>>>      };
>>> 
>>>      otg: usb@13500000 {
>>> -        compatible = "ingenic,jz4780-otg", "snps,dwc2";
>>> +        compatible = "ingenic,jz4780-otg";
>> 
>> Could you refresh my memory - why are the "snps,dwc2" fallback 
>> strings \x7fremoved?
>> 
>> To me it seems like they should be here, since the OTG IP in Ingenic 
>> \x7fSoCs is derived from the DWC2 IP.
> 
> 
> The reason is that Nikolaus found that the current jz4780.dtsi will 
> cause
> dtbscheck to complain. After discussion, Nikolaus concluded three 
> feasible
> solutions, see here:
> https://lkml.org/lkml/2022/4/13/1097
> 
> And it seems that Krzysztof prefers the c) option.

Understood.

-Paul

> 
> Thanks and best regards!
> 
> 
>> 
>> Cheers,
>> -Paul
>> 
>>>          reg = <0x13500000 0x40000>;
>>> 
>>>          interrupt-parent = <&intc>;
>>> diff --git a/arch/mips/boot/dts/ingenic/x1000.dtsi 
>>> \x7f\x7fb/arch/mips/boot/dts/ingenic/x1000.dtsi
>>> index 8bd27ede..343818a2 100644
>>> --- a/arch/mips/boot/dts/ingenic/x1000.dtsi
>>> +++ b/arch/mips/boot/dts/ingenic/x1000.dtsi
>>> @@ -366,7 +366,7 @@
>>>      };
>>> 
>>>      otg: usb@13500000 {
>>> -        compatible = "ingenic,x1000-otg", "snps,dwc2";
>>> +        compatible = "ingenic,x1000-otg";
>>>          reg = <0x13500000 0x40000>;
>>> 
>>>          interrupt-parent = <&intc>;
>>> diff --git a/arch/mips/boot/dts/ingenic/x1830.dtsi 
>>> \x7f\x7fb/arch/mips/boot/dts/ingenic/x1830.dtsi
>>> index 2595df8..6aff19f 100644
>>> --- a/arch/mips/boot/dts/ingenic/x1830.dtsi
>>> +++ b/arch/mips/boot/dts/ingenic/x1830.dtsi
>>> @@ -355,7 +355,7 @@
>>>      };
>>> 
>>>      otg: usb@13500000 {
>>> -        compatible = "ingenic,x1830-otg", "snps,dwc2";
>>> +        compatible = "ingenic,x1830-otg";
>>>          reg = <0x13500000 0x40000>;
>>> 
>>>          interrupt-parent = <&intc>;
>>> --
>>> 2.7.4
>>> 
>> 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 1/3] dt-bindings: dwc2: Add bindings for new Ingenic SoCs.
  2022-04-16 16:34   ` Paul Cercueil
@ 2022-04-17  9:27     ` Zhou Yanjie
  0 siblings, 0 replies; 9+ messages in thread
From: Zhou Yanjie @ 2022-04-17  9:27 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: gregkh, hminas, robh+dt, krzk+dt, tsbogend, linux-usb,
	linux-mips, linux-kernel, devicetree, dragancecavac, hns,
	dongsheng.qiu, aric.pzqi, rick.tyliu, sernia.zhou, zhenwenjin,
	reimu

Hi Paul,

On 2022/4/17 上午12:34, Paul Cercueil wrote:
> Hi Zhou,
>
> Le ven., avril 15 2022 at 03:25:35 +0800, 周琰杰 (Zhou Yanjie) 
> <zhouyanjie@wanyeetech.com> a écrit :
>> Add the dwc2 bindings for the JZ4775 SoC, the JZ4780 SoC, the X1000
>> SoC, the X1600 SoC, the X1700 SoC, the X1830 SoC, and the X2000 SoC
>> from Ingenic.
>>
>> Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
>> Acked-by: Rob Herring <robh@kernel.org>
>> ---
>>
>> Notes:
>>     v1->v2:
>>     Add Rob Herring's Acked-by.
>>
>>     v2->v3:
>>     No change.
>>
>>  Documentation/devicetree/bindings/usb/dwc2.yaml | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/dwc2.yaml 
>> b/Documentation/devicetree/bindings/usb/dwc2.yaml
>> index 4cebce6..c6e8c0b 100644
>> --- a/Documentation/devicetree/bindings/usb/dwc2.yaml
>> +++ b/Documentation/devicetree/bindings/usb/dwc2.yaml
>> @@ -17,6 +17,13 @@ properties:
>>      oneOf:
>>        - const: brcm,bcm2835-usb
>>        - const: hisilicon,hi6220-usb
>> +      - const: ingenic,jz4775-otg
>> +      - const: ingenic,jz4780-otg
>> +      - const: ingenic,x1000-otg
>
> The driver handles the JZ4775, JZ4780 and X1000 the exact same way. 
> Maybe the latter two should use the JZ4775 string as the fallback? Do 
> you know if the IP cores are any different?
>

 From the manual, it seems that JZ4775 and JZ4780 should have the same 
specifications,
but in fact, the behavior of JZ4775 and JZ4780 is different, especially 
if the JZ4780
does not turn off overcurrent detection, there will be a high 
probability of affecting
the use, while the JZ4775 does not have this problem, so I think they 
should actually
be different.

The manual of X1000 shows that it has only 8 endpoints, which is 
different from JZ4775
and JZ4780.

 From the experimental results, it seems that the three of them can use 
the same set of
parameters, but in order to avoid hidden dangers that have not been 
found for the time
being, I think it seems necessary to keep three independent compatible 
strings.


>> +      - const: ingenic,x1600-otg
>> +      - const: ingenic,x1700-otg
>> +      - const: ingenic,x1830-otg
>
> Same here (and btw, first time I hear about the X1600 and X1700 ;))


The OTG of X1600 and X1700 seem to be the same, I will remove the 
compatibility string
of X1700 in the next version, but the device tree of X1830 in Ingenic 
SDK is configured
with different parameters from X1600/X1700, so I believe the X1830 
should be a little
different from the X1600/X1700, so although the experimental results 
show that the three
of them seem to be able to use the same parameters, it seems that it is 
more appropriate
to keep the compatibe string of X1830.

I also heard about the X1600 and X1700 not long ago. From the existing 
information, the
X1600 should be the only SoC with CAN in the known models of Ingenic. 
And the X1700 is
more like an SoC that focuses on display applications.


Thanks and best regards!


>
> Cheers,
> -Paul
>
>> +      - const: ingenic,x2000-otg
>>        - items:
>>            - const: rockchip,rk3066-usb
>>            - const: snps,dwc2
>> -- 
>> 2.7.4
>>
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-04-17  9:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-14 19:25 [PATCH v3 0/3] Add OTG support for Ingenic SoCs 周琰杰 (Zhou Yanjie)
2022-04-14 19:25 ` [PATCH v3 1/3] dt-bindings: dwc2: Add bindings for new " 周琰杰 (Zhou Yanjie)
2022-04-16 16:34   ` Paul Cercueil
2022-04-17  9:27     ` Zhou Yanjie
2022-04-14 19:25 ` [PATCH v3 2/3] USB: dwc2: Add OTG support for " 周琰杰 (Zhou Yanjie)
2022-04-14 19:25 ` [PATCH v3 3/3] MIPS: Ingenic: Refresh USB nodes to match driver changes 周琰杰 (Zhou Yanjie)
2022-04-15 15:07   ` Paul Cercueil
2022-04-16 12:16     ` Zhou Yanjie
2022-04-16 16:34       ` Paul Cercueil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).