All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Add OTG support for Ingenic SoCs.
@ 2022-04-12 18:29 周琰杰 (Zhou Yanjie)
  2022-04-12 18:30 ` [PATCH v2 1/2] dt-bindings: dwc2: Add bindings for new " 周琰杰 (Zhou Yanjie)
  2022-04-12 18:30 ` [PATCH v2 2/2] USB: dwc2: Add OTG support for " 周琰杰 (Zhou Yanjie)
  0 siblings, 2 replies; 10+ messages in thread
From: 周琰杰 (Zhou Yanjie) @ 2022-04-12 18:29 UTC (permalink / raw)
  To: gregkh, hminas, robh+dt, krzk+dt
  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.

周琰杰 (Zhou Yanjie) (2):
  dt-bindings: dwc2: Add bindings for new Ingenic SoCs.
  USB: dwc2: Add OTG support for Ingenic SoCs.

 Documentation/devicetree/bindings/usb/dwc2.yaml |  7 ++++
 drivers/usb/dwc2/core.c                         |  9 +++++
 drivers/usb/dwc2/core.h                         |  5 +++
 drivers/usb/dwc2/params.c                       | 50 ++++++++++++++++++++++++-
 4 files changed, 70 insertions(+), 1 deletion(-)

-- 
2.7.4


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

* [PATCH v2 1/2] dt-bindings: dwc2: Add bindings for new Ingenic SoCs.
  2022-04-12 18:29 [PATCH v2 0/2] Add OTG support for Ingenic SoCs 周琰杰 (Zhou Yanjie)
@ 2022-04-12 18:30 ` 周琰杰 (Zhou Yanjie)
  2022-04-13  7:22   ` H. Nikolaus Schaller
  2022-04-12 18:30 ` [PATCH v2 2/2] USB: dwc2: Add OTG support for " 周琰杰 (Zhou Yanjie)
  1 sibling, 1 reply; 10+ messages in thread
From: 周琰杰 (Zhou Yanjie) @ 2022-04-12 18:30 UTC (permalink / raw)
  To: gregkh, hminas, robh+dt, krzk+dt
  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.

 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] 10+ messages in thread

* [PATCH v2 2/2] USB: dwc2: Add OTG support for Ingenic SoCs.
  2022-04-12 18:29 [PATCH v2 0/2] Add OTG support for Ingenic SoCs 周琰杰 (Zhou Yanjie)
  2022-04-12 18:30 ` [PATCH v2 1/2] dt-bindings: dwc2: Add bindings for new " 周琰杰 (Zhou Yanjie)
@ 2022-04-12 18:30 ` 周琰杰 (Zhou Yanjie)
  1 sibling, 0 replies; 10+ messages in thread
From: 周琰杰 (Zhou Yanjie) @ 2022-04-12 18:30 UTC (permalink / raw)
  To: gregkh, hminas, robh+dt, krzk+dt
  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.

 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] 10+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: dwc2: Add bindings for new Ingenic SoCs.
  2022-04-12 18:30 ` [PATCH v2 1/2] dt-bindings: dwc2: Add bindings for new " 周琰杰 (Zhou Yanjie)
@ 2022-04-13  7:22   ` H. Nikolaus Schaller
       [not found]     ` <c79a8ff7-7a3f-9627-f910-dbbf942e34cb@wanyeetech.com>
  0 siblings, 1 reply; 10+ messages in thread
From: H. Nikolaus Schaller @ 2022-04-13  7:22 UTC (permalink / raw)
  To: "周琰杰 (Zhou Yanjie)"
  Cc: Greg Kroah-Hartman, hminas, robh+dt, krzk+dt, linux-usb,
	linux-mips, linux-kernel, devicetree, dragancecavac,
	dongsheng.qiu, aric.pzqi, rick.tyliu, sernia.zhou, zhenwenjin,
	reimu

Hi,

> Am 12.04.2022 um 20:30 schrieb 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>:
> 
> 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.
> 
> 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

I have merged it with my recently proposed removal of
ingenic,jz4780-otg in jz4780.dtsi but there was no dtbscheck
complaint about missing snps,dwc2.

So I think should it be:

      - items:
          - enum:
              - 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
          - const: snps,dwc2

similar to the entry for amlogic?

>       - items:
>           - const: rockchip,rk3066-usb
>           - const: snps,dwc2
> -- 
> 2.7.4
> 

BR and thanks,
Nikolaus

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

* Re: [PATCH v2 1/2] dt-bindings: dwc2: Add bindings for new Ingenic SoCs.
       [not found]     ` <c79a8ff7-7a3f-9627-f910-dbbf942e34cb@wanyeetech.com>
@ 2022-04-13 19:30       ` H. Nikolaus Schaller
  2022-04-13 19:42         ` Zhou Yanjie
  2022-04-14  7:32         ` Krzysztof Kozlowski
  0 siblings, 2 replies; 10+ messages in thread
From: H. Nikolaus Schaller @ 2022-04-13 19:30 UTC (permalink / raw)
  To: Zhou Yanjie, Krzysztof Kozlowski
  Cc: Greg Kroah-Hartman, hminas, Rob Herring, linux-usb, linux-mips,
	Linux Kernel Mailing List,
	OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, dragancecavac,
	dongsheng.qiu, qipengzhen, rick.tyliu, sernia.zhou, zhenwenjin,
	reimu

Hi,


> Am 13.04.2022 um 20:55 schrieb Zhou Yanjie <zhouyanjie@wanyeetech.com>:
> 
> Hi Nikolaus,
> 
> On 2022/4/13 下午3:22, H. Nikolaus Schaller wrote:
>> Hi,
>> 
>> 
>>> Am 12.04.2022 um 20:30 schrieb 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
>>> :
>>> 
>>> 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.
>>> 
>>> 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
>>> 
>> I have merged it with my recently proposed removal of
>> ingenic,jz4780-otg in jz4780.dtsi but there was no dtbscheck
>> complaint about missing snps,dwc2.
>> 
>> So I think should it be:
>> 
>>       - items:
>>           - enum:
>>               - 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
>> 

PS: the const: above should be removed (I hadn't run it through the compiler).

>>           - const: snps,dwc2

here it is needed.

>> 
>> similar to the entry for amlogic?
>> 
> 
> 
> Or we can just remove the "snps,dwc2" from jz4780.dtsi?

Well, my recent proposal to fix dtbscheck was the other way round:
remove "ingenic,jz4780-otg" from jz4780.dtsi and leave it out here.

> I'm not too sure, but since we already have a dedicated "ingenic, jz4780-otg", it seems "snps,dwc2" is redundant.

As far as I see there is no driver specialization compatible to
"ingenic,jz4780-otg". `grep ingenic,jz4780-otg *` only shows the .dtsi (and the new .yaml).

So we need "snps,dwc2" to get any driver match and I thought the "ingenic,jz4780-otg" is redundant.

But maintainers convinced me to keep it as a dummy compatible in the .dtsi for potential future
specialization (which does not exist and seems not to be necessary). Unless I can convince them 
that this is never ever needed. Which is beyond my knowledge and almost everyone.

So we can't remove the "snps,dwc2" here.

Well, we can with more work elsewhere.
You have to extend the dwc2_of_match_table to include all ingenic devices.

Therefore we now know 3 potential solutions:
a) remove "ingenic,jz4780-otg" from jz4780.dtsi (my proposal)
b) add "ingenic,jz4780-otg" to dwc2.yaml together with "snps,dwc2" (your proposal + my suggestion here)
c) add only "ingenic,jz4780-otg" to dwc2.yaml and extend the match table in drivers//usb/dwc2/params.c (new proposals)

From consistency point of view I think variant b) is the right one. a) was rejected and c) only adds redundant code.

I am open to anything as long as the dtbscheck doesn't complain any more.

BR an thanks,
Nikolaus


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

* Re: [PATCH v2 1/2] dt-bindings: dwc2: Add bindings for new Ingenic SoCs.
  2022-04-13 19:30       ` H. Nikolaus Schaller
@ 2022-04-13 19:42         ` Zhou Yanjie
  2022-04-14  7:32         ` Krzysztof Kozlowski
  1 sibling, 0 replies; 10+ messages in thread
From: Zhou Yanjie @ 2022-04-13 19:42 UTC (permalink / raw)
  To: H. Nikolaus Schaller, Krzysztof Kozlowski
  Cc: Greg Kroah-Hartman, hminas, Rob Herring, linux-usb, linux-mips,
	Linux Kernel Mailing List,
	OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, dragancecavac,
	dongsheng.qiu, qipengzhen, rick.tyliu, sernia.zhou, zhenwenjin,
	reimu

Hi Nikolaus,

On 2022/4/14 上午3:30, H. Nikolaus Schaller wrote:
> Hi,
>
>
>> Am 13.04.2022 um 20:55 schrieb Zhou Yanjie <zhouyanjie@wanyeetech.com>:
>>
>> Hi Nikolaus,
>>
>> On 2022/4/13 下午3:22, H. Nikolaus Schaller wrote:
>>> Hi,
>>>
>>>
>>>> Am 12.04.2022 um 20:30 schrieb 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
>>>> :
>>>>
>>>> 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.
>>>>
>>>> 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
>>>>
>>> I have merged it with my recently proposed removal of
>>> ingenic,jz4780-otg in jz4780.dtsi but there was no dtbscheck
>>> complaint about missing snps,dwc2.
>>>
>>> So I think should it be:
>>>
>>>        - items:
>>>            - enum:
>>>                - 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
>>>
> PS: the const: above should be removed (I hadn't run it through the compiler).
>
>>>            - const: snps,dwc2
> here it is needed.
>
>>> similar to the entry for amlogic?
>>>
>>
>> Or we can just remove the "snps,dwc2" from jz4780.dtsi?
> Well, my recent proposal to fix dtbscheck was the other way round:
> remove "ingenic,jz4780-otg" from jz4780.dtsi and leave it out here.
>
>> I'm not too sure, but since we already have a dedicated "ingenic, jz4780-otg", it seems "snps,dwc2" is redundant.
> As far as I see there is no driver specialization compatible to
> "ingenic,jz4780-otg". `grep ingenic,jz4780-otg *` only shows the .dtsi (and the new .yaml).
>
> So we need "snps,dwc2" to get any driver match and I thought the "ingenic,jz4780-otg" is redundant.
>
> But maintainers convinced me to keep it as a dummy compatible in the .dtsi for potential future
> specialization (which does not exist and seems not to be necessary). Unless I can convince them
> that this is never ever needed. Which is beyond my knowledge and almost everyone.
>
> So we can't remove the "snps,dwc2" here.
>
> Well, we can with more work elsewhere.
> You have to extend the dwc2_of_match_table to include all ingenic devices.
>
> Therefore we now know 3 potential solutions:
> a) remove "ingenic,jz4780-otg" from jz4780.dtsi (my proposal)
> b) add "ingenic,jz4780-otg" to dwc2.yaml together with "snps,dwc2" (your proposal + my suggestion here)
> c) add only "ingenic,jz4780-otg" to dwc2.yaml and extend the match table in drivers//usb/dwc2/params.c (new proposals)
>
>  From consistency point of view I think variant b) is the right one. a) was rejected and c) only adds redundant code.


You are probably right, I forgot that the OTG driver only exists in my local
repository and is not merged into the mainline. If we remove "snps,dwc2",
the OTG of the JZ4780 in the current version will not work properly.

I will send v3 tomorrow.


Thanks and best regards!


> I am open to anything as long as the dtbscheck doesn't complain any more.
>
> BR an thanks,
> Nikolaus

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

* Re: [PATCH v2 1/2] dt-bindings: dwc2: Add bindings for new Ingenic SoCs.
  2022-04-13 19:30       ` H. Nikolaus Schaller
  2022-04-13 19:42         ` Zhou Yanjie
@ 2022-04-14  7:32         ` Krzysztof Kozlowski
  2022-04-14 10:00           ` H. Nikolaus Schaller
  1 sibling, 1 reply; 10+ messages in thread
From: Krzysztof Kozlowski @ 2022-04-14  7:32 UTC (permalink / raw)
  To: H. Nikolaus Schaller, Zhou Yanjie, Krzysztof Kozlowski
  Cc: Greg Kroah-Hartman, hminas, Rob Herring, linux-usb, linux-mips,
	Linux Kernel Mailing List,
	OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, dragancecavac,
	dongsheng.qiu, qipengzhen, rick.tyliu, sernia.zhou, zhenwenjin,
	reimu

On 13/04/2022 21:30, H. Nikolaus Schaller wrote:
> So we need "snps,dwc2" to get any driver match and I thought the "ingenic,jz4780-otg" is redundant.
> 
> But maintainers convinced me to keep it as a dummy compatible in the .dtsi for potential future
> specialization (which does not exist and seems not to be necessary). 

Isn't exactly the next patch 2/2 using such specialization?

> Unless I can convince them 
> that this is never ever needed. Which is beyond my knowledge and almost everyone.
> 
> So we can't remove the "snps,dwc2" here.
> 
> Well, we can with more work elsewhere.
> You have to extend the dwc2_of_match_table to include all ingenic devices.
> 
> Therefore we now know 3 potential solutions:
> a) remove "ingenic,jz4780-otg" from jz4780.dtsi (my proposal)
> b) add "ingenic,jz4780-otg" to dwc2.yaml together with "snps,dwc2" (your proposal + my suggestion here)
> c) add only "ingenic,jz4780-otg" to dwc2.yaml and extend the match table in drivers//usb/dwc2/params.c (new proposals)
> 
> From consistency point of view I think variant b) is the right one. a) was rejected and c) only adds redundant code.

c) was already proposed by Zhou, so if you think the code is not correct
(the params for jz4780) maybe nack it there, so we will know that driver
needs fixes.

Best regards,
Krzysztof

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

* Re: [PATCH v2 1/2] dt-bindings: dwc2: Add bindings for new Ingenic SoCs.
  2022-04-14  7:32         ` Krzysztof Kozlowski
@ 2022-04-14 10:00           ` H. Nikolaus Schaller
  2022-04-14 17:11             ` Zhou Yanjie
  0 siblings, 1 reply; 10+ messages in thread
From: H. Nikolaus Schaller @ 2022-04-14 10:00 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Zhou Yanjie, Krzysztof Kozlowski, Greg Kroah-Hartman, hminas,
	Rob Herring, linux-usb, linux-mips, Linux Kernel Mailing List,
	OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, dragancecavac,
	dongsheng.qiu, qipengzhen, rick.tyliu, sernia.zhou, zhenwenjin,
	reimu



> Am 14.04.2022 um 09:32 schrieb Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>:
> 
> On 13/04/2022 21:30, H. Nikolaus Schaller wrote:
>> So we need "snps,dwc2" to get any driver match and I thought the "ingenic,jz4780-otg" is redundant.
>> 
>> But maintainers convinced me to keep it as a dummy compatible in the .dtsi for potential future
>> specialization (which does not exist and seems not to be necessary). 
> 
> Isn't exactly the next patch 2/2 using such specialization?
> 
>> Unless I can convince them 
>> that this is never ever needed. Which is beyond my knowledge and almost everyone.
>> 
>> So we can't remove the "snps,dwc2" here.
>> 
>> Well, we can with more work elsewhere.
>> You have to extend the dwc2_of_match_table to include all ingenic devices.
>> 
>> Therefore we now know 3 potential solutions:
>> a) remove "ingenic,jz4780-otg" from jz4780.dtsi (my proposal)
>> b) add "ingenic,jz4780-otg" to dwc2.yaml together with "snps,dwc2" (your proposal + my suggestion here)
>> c) add only "ingenic,jz4780-otg" to dwc2.yaml and extend the match table in drivers//usb/dwc2/params.c (new proposals)
>> 
>> From consistency point of view I think variant b) is the right one. a) was rejected and c) only adds redundant code.
> 
> c) was already proposed by Zhou, so if you think the code is not correct
> (the params for jz4780) maybe nack it there, so we will know that driver
> needs fixes.

Ah, ok. Now I see. I was just focussed on this patch and related dtbscheck
messages and did not read patch 2/2.

Yes, looking at both, they are variant c). Sorry that I didn't see it earlier.

As said: I am open to anything as long as the dtbscheck doesn't complain any more.

BR and sorry for the confusion,
Nikolaus


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

* Re: [PATCH v2 1/2] dt-bindings: dwc2: Add bindings for new Ingenic SoCs.
  2022-04-14 10:00           ` H. Nikolaus Schaller
@ 2022-04-14 17:11             ` Zhou Yanjie
  2022-04-14 17:18               ` H. Nikolaus Schaller
  0 siblings, 1 reply; 10+ messages in thread
From: Zhou Yanjie @ 2022-04-14 17:11 UTC (permalink / raw)
  To: H. Nikolaus Schaller, Krzysztof Kozlowski
  Cc: Krzysztof Kozlowski, Greg Kroah-Hartman, hminas, Rob Herring,
	linux-usb, linux-mips, Linux Kernel Mailing List,
	OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, dragancecavac,
	dongsheng.qiu, qipengzhen, rick.tyliu, sernia.zhou, zhenwenjin,
	reimu

Hi,

On 2022/4/14 下午6:00, H. Nikolaus Schaller wrote:
>
>> Am 14.04.2022 um 09:32 schrieb Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>:
>>
>> On 13/04/2022 21:30, H. Nikolaus Schaller wrote:
>>> So we need "snps,dwc2" to get any driver match and I thought the "ingenic,jz4780-otg" is redundant.
>>>
>>> But maintainers convinced me to keep it as a dummy compatible in the .dtsi for potential future
>>> specialization (which does not exist and seems not to be necessary).
>> Isn't exactly the next patch 2/2 using such specialization?
>>
>>> Unless I can convince them
>>> that this is never ever needed. Which is beyond my knowledge and almost everyone.
>>>
>>> So we can't remove the "snps,dwc2" here.
>>>
>>> Well, we can with more work elsewhere.
>>> You have to extend the dwc2_of_match_table to include all ingenic devices.
>>>
>>> Therefore we now know 3 potential solutions:
>>> a) remove "ingenic,jz4780-otg" from jz4780.dtsi (my proposal)
>>> b) add "ingenic,jz4780-otg" to dwc2.yaml together with "snps,dwc2" (your proposal + my suggestion here)
>>> c) add only "ingenic,jz4780-otg" to dwc2.yaml and extend the match table in drivers//usb/dwc2/params.c (new proposals)
>>>
>>>  From consistency point of view I think variant b) is the right one. a) was rejected and c) only adds redundant code.
>> c) was already proposed by Zhou, so if you think the code is not correct
>> (the params for jz4780) maybe nack it there, so we will know that driver
>> needs fixes.
> Ah, ok. Now I see. I was just focussed on this patch and related dtbscheck
> messages and did not read patch 2/2.
>
> Yes, looking at both, they are variant c). Sorry that I didn't see it earlier.

It looks like we need a [3/3] to remove "snps,dwc2", which not only solves
the dtbscheck complaining problem, but also doesn't affect normal use after
removing "snps,dwc2".


>
> As said: I am open to anything as long as the dtbscheck doesn't complain any more.
>
> BR and sorry for the confusion,
> Nikolaus

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

* Re: [PATCH v2 1/2] dt-bindings: dwc2: Add bindings for new Ingenic SoCs.
  2022-04-14 17:11             ` Zhou Yanjie
@ 2022-04-14 17:18               ` H. Nikolaus Schaller
  0 siblings, 0 replies; 10+ messages in thread
From: H. Nikolaus Schaller @ 2022-04-14 17:18 UTC (permalink / raw)
  To: Zhou Yanjie
  Cc: Krzysztof Kozlowski, Krzysztof Kozlowski, Greg Kroah-Hartman,
	hminas, Rob Herring, linux-usb, linux-mips,
	Linux Kernel Mailing List,
	OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, dragancecavac,
	dongsheng.qiu, qipengzhen, rick.tyliu, sernia.zhou, zhenwenjin,
	reimu

Hi,

> Am 14.04.2022 um 19:11 schrieb Zhou Yanjie <zhouyanjie@wanyeetech.com>:
> 
> Hi,
> 
> On 2022/4/14 下午6:00, H. Nikolaus Schaller wrote:
>> 
>>> Am 14.04.2022 um 09:32 schrieb Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>:
>>> 
>>> On 13/04/2022 21:30, H. Nikolaus Schaller wrote:
>>>> So we need "snps,dwc2" to get any driver match and I thought the "ingenic,jz4780-otg" is redundant.
>>>> 
>>>> But maintainers convinced me to keep it as a dummy compatible in the .dtsi for potential future
>>>> specialization (which does not exist and seems not to be necessary).
>>> Isn't exactly the next patch 2/2 using such specialization?
>>> 
>>>> Unless I can convince them
>>>> that this is never ever needed. Which is beyond my knowledge and almost everyone.
>>>> 
>>>> So we can't remove the "snps,dwc2" here.
>>>> 
>>>> Well, we can with more work elsewhere.
>>>> You have to extend the dwc2_of_match_table to include all ingenic devices.
>>>> 
>>>> Therefore we now know 3 potential solutions:
>>>> a) remove "ingenic,jz4780-otg" from jz4780.dtsi (my proposal)
>>>> b) add "ingenic,jz4780-otg" to dwc2.yaml together with "snps,dwc2" (your proposal + my suggestion here)
>>>> c) add only "ingenic,jz4780-otg" to dwc2.yaml and extend the match table in drivers//usb/dwc2/params.c (new proposals)
>>>> 
>>>> From consistency point of view I think variant b) is the right one. a) was rejected and c) only adds redundant code.
>>> c) was already proposed by Zhou, so if you think the code is not correct
>>> (the params for jz4780) maybe nack it there, so we will know that driver
>>> needs fixes.
>> Ah, ok. Now I see. I was just focussed on this patch and related dtbscheck
>> messages and did not read patch 2/2.
>> 
>> Yes, looking at both, they are variant c). Sorry that I didn't see it earlier.
> 
> It looks like we need a [3/3] to remove "snps,dwc2", which not only solves
> the dtbscheck complaining problem, but also doesn't affect normal use after
> removing "snps,dwc2".

Yes, that seems to be the right thing to do.

BR and thanks,
Nikolaus


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

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

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-12 18:29 [PATCH v2 0/2] Add OTG support for Ingenic SoCs 周琰杰 (Zhou Yanjie)
2022-04-12 18:30 ` [PATCH v2 1/2] dt-bindings: dwc2: Add bindings for new " 周琰杰 (Zhou Yanjie)
2022-04-13  7:22   ` H. Nikolaus Schaller
     [not found]     ` <c79a8ff7-7a3f-9627-f910-dbbf942e34cb@wanyeetech.com>
2022-04-13 19:30       ` H. Nikolaus Schaller
2022-04-13 19:42         ` Zhou Yanjie
2022-04-14  7:32         ` Krzysztof Kozlowski
2022-04-14 10:00           ` H. Nikolaus Schaller
2022-04-14 17:11             ` Zhou Yanjie
2022-04-14 17:18               ` H. Nikolaus Schaller
2022-04-12 18:30 ` [PATCH v2 2/2] USB: dwc2: Add OTG support for " 周琰杰 (Zhou Yanjie)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.