Skip to contentSkip to conversation

Add driver for ehci in Sunplus SP7021

PATCH Superseded Vincent Shih 3 participants 5 messages Mar 6, 2022 – Mar 7, 2022

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover Add driver for ehci in Sunplus SP7021

This is a patch series for ehci driver for Sunplus SP7021 SoC.

Sunplus SP7021 is an ARM Coretex A7 (4 cores) based SoC. It integrates many peripherals (ex: UART, I2C, SPI, SDIO, eMMC, USB, SD Card and etc.) into a single chip. It is designed for industrial control.

Refer to:
https://sunplus-tibbo.atlassian.net/wiki/spaces/doc/overview
https://tibbo.com/store/plus1.html

Vincent Shih (2):
usb: host: ehci-sunplus: Add driver for ehci in Sunplus SP7021
dt-bindings: usb: Add bindings doc for Sunplus EHCI driver

 .../bindings/usb/sunplus,sp7021-usb-ehci.yaml      |  63 ++++++
 MAINTAINERS                                        |   7 +
 drivers/usb/host/Kconfig                           |  12 +
 drivers/usb/host/Makefile                          |   1 +
 drivers/usb/host/ehci-sunplus.c                    | 241 +++++++++++++++++++++
 5 files changed, 324 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.yaml
 create mode 100644 drivers/usb/host/ehci-sunplus.c
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 1/2 usb: host: ehci-sunplus: Add driver for ehci in Sunplus SP7021

Add driver for ehci in Sunplus SP7021

---
Changes in v2:
- Address the comments by Alan Stern.
- Address the comments by Rob Herring.
- Address the comments by Krzysztof Kozlowski.
- Implement phy binding.
- Clean up codes.

 MAINTAINERS                     |   6 +
 drivers/usb/host/Kconfig        |  12 ++
 drivers/usb/host/Makefile       |   1 +
 drivers/usb/host/ehci-sunplus.c | 241 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 260 insertions(+)
 create mode 100644 drivers/usb/host/ehci-sunplus.c
MAINTAINERS +6 -0
index 80eebc1..6c2faf3 100644
@@ -17947,6 +17947,12 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/net/ethernet/dlink/sundance.c
 
+SUNPLUS USB EHCI DRIVER
+M:	Vincent Shih <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/usb/host/ehci-sunplus.c
+
 SUPERH
 M:	Yoshinori Sato <[email protected]>
 M:	Rich Felker <[email protected]>
drivers/usb/host/Kconfig +12 -0
index c4736d1..ad13fdd 100644
@@ -339,6 +339,18 @@ config USB_OCTEON_EHCI
 	  USB 2.0 device support.  All CN6XXX based chips with USB are
 	  supported.
 
+config USB_EHCI_SUNPLUS
+	tristate "EHCI support for Sunplus USB controller"
+	depends on SOC_SP7021
+	select NVMEM_SUNPLUS_OCOTP
+	select PHY_SUNPLUS_USB
+	help
+	  Enables support for the on-chip EHCI controller in Sunplus
+	  SoCs. It supports 32-bit AHB/AXI config bus and 64-bit AXI
+	  data bus.
+	  This driver can also be built as a module. If so, the module
+	  will be called ehci-sunplus.
+
 endif # USB_EHCI_HCD
 
 config USB_OXU210HP_HCD
drivers/usb/host/Makefile +1 -0
index 171de4d..7e9b5f1 100644
@@ -46,6 +46,7 @@ obj-$(CONFIG_USB_EHCI_HCD_STI)	+= ehci-st.o
 obj-$(CONFIG_USB_EHCI_EXYNOS)	+= ehci-exynos.o
 obj-$(CONFIG_USB_EHCI_HCD_AT91) += ehci-atmel.o
 obj-$(CONFIG_USB_EHCI_BRCMSTB)	+= ehci-brcm.o
+obj-$(CONFIG_USB_EHCI_SUNPLUS)	+= ehci-sunplus.o
 
 obj-$(CONFIG_USB_OXU210HP_HCD)	+= oxu210hp-hcd.o
 obj-$(CONFIG_USB_ISP116X_HCD)	+= isp116x-hcd.o
drivers/usb/host/ehci-sunplus.c new file +241 -0

241 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw

PATCH v3 2/2 dt-bindings: usb: Add bindings doc for Sunplus EHCI driver

In reply to Vincent Shih

Add bindings doc for Sunplus EHCI driver

---
Changes in v2:
- Address the comments by Rob Herring.

 .../bindings/usb/sunplus,sp7021-usb-ehci.yaml      | 63 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.yaml
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.yaml new file +63 -0
new file mode 100644
index 0000000..905f68c
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) Sunplus Co., Ltd. 2021
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/sunplus,sp7021-usb-ehci.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sunplus SP7021 EHCI Controller Device Tree bindings
+
+allOf:
+  - $ref: usb-hcd.yaml#
+
+maintainers:
+  - Vincent Shih <[email protected]>
+
+properties:
+  compatible:
+    const: sunplus,sp7021-usb2-ehci
+
+  clocks:
+    maxItems: 1
+
+  resets:
+    minItems: 1
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  phys:
+    maxItems: 1
+
+  phy-names:
+    maxItems: 1
+
+required:
+  - compatible
+  - clocks
+  - resets
+  - reg
+  - interrupts
+  - phys
+  - phy-names
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    sp_ehci0: usb@9c102100 {
+      compatible = "sunplus,sp7021-usb-ehci";
+      clocks = <&clkc 0x3a>;
+      resets = <&rstc 0x2a>;
+      reg = <0x9c102100 0x68>;
+      interrupt-parent = <&intc>;
+      interrupts = <14 IRQ_TYPE_LEVEL_HIGH>;
+      phys = <&sp_uphy0>;
+      phy-names = "uphy";
+    };
+    ...
MAINTAINERS +1 -0
index 6c2faf3..4e66993 100644
@@ -17951,6 +17951,7 @@ SUNPLUS USB EHCI DRIVER
 M:	Vincent Shih <[email protected]>
 L:	[email protected]
 S:	Maintained
+F:	Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.yaml
 F:	drivers/usb/host/ehci-sunplus.c
 
 SUPERH
Signature · 1 line
2.7.4
#3 lore raw

Re: [PATCH v3 2/2] dt-bindings: usb: Add bindings doc for Sunplus EHCI driver

Quoted 18 lines · Vincent Shih

Add bindings doc for Sunplus EHCI driver

---
Changes in v2:
- Address the comments by Rob Herring.

 .../bindings/usb/sunplus,sp7021-usb-ehci.yaml      | 63 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.yaml
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.yaml new file +0 -0
new file mode 100644
index 0000000..905f68c

Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.yaml line 8

Quoted 8 lines
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.yaml new file +8 -0
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) Sunplus Co., Ltd. 2021
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/sunplus,sp7021-usb-ehci.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sunplus SP7021 EHCI Controller Device Tree bindings

s/Device Tree bindings//
(title describes hardware)

Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.yaml line 18

Quoted 10 lines
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.yaml new file +10 -0
+
+allOf:
+  - $ref: usb-hcd.yaml#
+
+maintainers:
+  - Vincent Shih <[email protected]>
+
+properties:
+  compatible:
+    const: sunplus,sp7021-usb2-ehci

You do not use this compatible in the driver.

Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.yaml line 24

Quoted 6 lines
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.yaml new file +6 -0
+
+  clocks:
+    maxItems: 1
+
+  resets:
+    minItems: 1

Suddenly it became minItems. This looks odd, it should be maxItems: 1 rather. How many reset lines do you have there?

Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.yaml line 36

Quoted 12 lines
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.yaml new file +12 -0
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  phys:
+    maxItems: 1
+
+  phy-names:
+    maxItems: 1

phy-names needs list of names.

Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.yaml line 47

Quoted 11 lines
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.yaml new file +11 -0
+
+required:
+  - compatible
+  - clocks
+  - resets
+  - reg
+  - interrupts
+  - phys
+  - phy-names
+
+additionalProperties: false

This should be unevaluatedProperties:false, because you reference usb-hcd schema.

Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.yaml line 57

Quoted 10 lines
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.yaml new file +10 -0
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    sp_ehci0: usb@9c102100 {
+      compatible = "sunplus,sp7021-usb-ehci";
+      clocks = <&clkc 0x3a>;
+      resets = <&rstc 0x2a>;
+      reg = <0x9c102100 0x68>;

reg goes after compatible in DTS.

Best regards,
Krzysztof

maintainer
#4 lore raw

Re: [PATCH v3 2/2] dt-bindings: usb: Add bindings doc for Sunplus EHCI driver

In reply to Vincent Shih
Quoted 12 lines · Vincent Shih

Add bindings doc for Sunplus EHCI driver

---
Changes in v2:
- Address the comments by Rob Herring.

 .../bindings/usb/sunplus,sp7021-usb-ehci.yaml      | 63 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.yaml

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Error: Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.example.dts:37.5-6 syntax error FATAL ERROR: Unable to parse input tree
make[1]: *** [scripts/Makefile.lib:378: Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ehci.example.dt.yaml] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1398: dt_binding_check] Error 2

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/1601662

This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit.