Skip to contentSkip to conversation

Add USB HOST OHCI driver for Sunplus SP7021 SoC

PATCH In review Vincent Shih 3 participants 8 messages Mar 14, 2022 – Mar 24, 2022

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

cover Add USB HOST OHCI driver for Sunplus SP7021 SoC

This is a patch series for USB HOST OHCI driver for Sunplus SP7021 SoC.

Sunplus SP7021 is an ARM Cortex 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: ohci-sunplus: Add driver for USB HOST OHCI in Sunplus

    SP7021 SoC

dt-bindings: usb: Add bindings doc for Sunplus USB HOST OHCI driver

 .../bindings/usb/sunplus,sp7021-usb-ohci.yaml      |  69 +++++++
 MAINTAINERS                                        |   7 +
 drivers/usb/host/Kconfig                           |  10 +
 drivers/usb/host/Makefile                          |   1 +
 drivers/usb/host/ohci-sunplus.c                    | 202 +++++++++++++++++++++
 5 files changed, 289 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml
 create mode 100644 drivers/usb/host/ohci-sunplus.c
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 usb: host: ohci-sunplus: Add driver for USB HOST OHCI in Sunplus SP7021 SoC

Add driver for USB HOST OHCI in Sunplus SP7021 SoC

---
 MAINTAINERS                     |   6 ++
 drivers/usb/host/Kconfig        |  10 ++
 drivers/usb/host/Makefile       |   1 +
 drivers/usb/host/ohci-sunplus.c | 202 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 219 insertions(+)
 create mode 100644 drivers/usb/host/ohci-sunplus.c
MAINTAINERS +6 -0
index 3b79fd4..f7a9ed7 100644
@@ -17945,6 +17945,12 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/net/ethernet/dlink/sundance.c
 
+SUNPLUS USB OHCI DRIVER
+M:	Vincent Shih <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/usb/host/ohci-sunplus.c
+
 SUPERH
 M:	Yoshinori Sato <[email protected]>
 M:	Rich Felker <[email protected]>
drivers/usb/host/Kconfig +10 -0
index c4736d1..d0670fe 100644
@@ -500,6 +500,16 @@ config USB_OHCI_HCD_DAVINCI
 	  controller. This driver cannot currently be a loadable
 	  module because it lacks a proper PHY abstraction.
 
+config USB_OHCI_HCD_SUNPLUS
+	tristate "OHCI support for Sunplus SP7021"
+	depends on SOC_SP7021
+	help
+	  Enables support for the on-chip OHCI 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 ohci-sunplus.
+
 config USB_OHCI_HCD_PPC_OF_BE
 	bool "OHCI support for OF platform bus (big endian)"
 	depends on PPC
drivers/usb/host/Makefile +1 -0
index 171de4d..67f44c9 100644
@@ -63,6 +63,7 @@ obj-$(CONFIG_USB_OHCI_HCD_S3C2410)	+= ohci-s3c2410.o
 obj-$(CONFIG_USB_OHCI_HCD_LPC32XX)	+= ohci-nxp.o
 obj-$(CONFIG_USB_OHCI_HCD_PXA27X)	+= ohci-pxa27x.o
 obj-$(CONFIG_USB_OHCI_HCD_DAVINCI)	+= ohci-da8xx.o
+obj-$(CONFIG_USB_OHCI_HCD_SUNPLUS)+= ohci-sunplus.o
 
 obj-$(CONFIG_USB_UHCI_HCD)	+= uhci-hcd.o
 obj-$(CONFIG_USB_FHCI_HCD)	+= fhci.o
drivers/usb/host/ohci-sunplus.c new file +202 -0

202 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/2 dt-bindings: usb: Add bindings doc for Sunplus USB HOST OHCI driver

In reply to Vincent Shih

Add bindings doc for Sunplus USB HOST OHCI driver

---
 .../bindings/usb/sunplus,sp7021-usb-ohci.yaml      | 69 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 70 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml new file +69 -0
new file mode 100644
index 0000000..7583b68
@@ -0,0 +1,69 @@
+# 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-ohci.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sunplus SP7021 OHCI Controller Device Tree Bindings
+
+allOf:
+  - $ref: usb-hcd.yaml#
+
+maintainers:
+  - Vincent Shih <[email protected]>
+
+description:
+  Sunplus SP7021 USB HOST IP is a USB2.0 Host Controller. It supports both
+  Enhanced Host Controller Interface (EHCI) and Open Host Controller Interface
+  (OHCI).
+
+  It supports 32-bits address bus and 64bit data bus interface, compliant
+  to AMBA AXI interface for data transfer.
+
+  It supports 32-bits address and data bus interface, compliant to AMBA
+  AHB interface for register configurations.
+
+  It supports 32-bits address and data bus interface, compliant to AMBA
+  AXI interface for register alternative configurations.
+
+  The UTM Interface block generates PHY control signals, compliant to
+  USB2.0 Transceiver Macrocell Interface Specification Revision 1.0.
+
+properties:
+  compatible:
+    const: sunplus,sp7021-usb-ohci
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - resets
+  - interrupts
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    sp_ohci0: usb@9c102080 {
+      compatible = "sunplus,sp7021-usb-ohci";
+      reg = <0x9c102080 0x68>;
+      clocks = <&clkc 0x3a>;
+      resets = <&rstc 0x2a>;
+      interrupt-parent = <&intc>;
+      interrupts = <15 IRQ_TYPE_LEVEL_HIGH>;
+    };
MAINTAINERS +1 -0
index f7a9ed7..4c80c39 100644
@@ -17949,6 +17949,7 @@ SUNPLUS USB OHCI DRIVER
 M:	Vincent Shih <[email protected]>
 L:	[email protected]
 S:	Maintained
+F:	Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml
 F:	drivers/usb/host/ohci-sunplus.c
 
 SUPERH
Signature · 1 line
2.7.4
#3 lore raw

Re: [PATCH v1 2/2] dt-bindings: usb: Add bindings doc for Sunplus USB HOST OHCI driver

Quoted 15 lines · Vincent Shih

Add bindings doc for Sunplus USB HOST OHCI driver

---
 .../bindings/usb/sunplus,sp7021-usb-ohci.yaml      | 69 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 70 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml new file +0 -0
new file mode 100644
index 0000000..7583b68

Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml line 7

Quoted 7 lines
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml new file +7 -0
@@ -0,0 +1,69 @@
+# 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-ohci.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+

Looks good. Few minor nitpicks:

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

Quoted 1 line
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml new file +1 -0
+title: Sunplus SP7021 OHCI Controller Device Tree Bindings

Remove "Device Tree Bindings" words here. Title is about hardware.

Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml line 11

Quoted 3 lines
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml new file +3 -0
+
+allOf:
+  - $ref: usb-hcd.yaml#

Put entire "allOf:" just before "properties:".

Quoted 26 lines
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml new file +26 -0
+
+maintainers:
+  - Vincent Shih <[email protected]>
+
+description:
+  Sunplus SP7021 USB HOST IP is a USB2.0 Host Controller. It supports both
+  Enhanced Host Controller Interface (EHCI) and Open Host Controller Interface
+  (OHCI).
+
+  It supports 32-bits address bus and 64bit data bus interface, compliant
+  to AMBA AXI interface for data transfer.
+
+  It supports 32-bits address and data bus interface, compliant to AMBA
+  AHB interface for register configurations.
+
+  It supports 32-bits address and data bus interface, compliant to AMBA
+  AXI interface for register alternative configurations.
+
+  The UTM Interface block generates PHY control signals, compliant to
+  USB2.0 Transceiver Macrocell Interface Specification Revision 1.0.
+
+properties:
+  compatible:
+    const: sunplus,sp7021-usb-ohci
+
+  reg:

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

Quoted 10 lines
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml new file +10 -0
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1

You might need here phys. Are you sure you do not need to configure the phy for OHCI? You should not assume it would be configured by other driver.

Best regards,
Krzysztof

author
#4 lore raw

Re: [PATCH v1 2/2] dt-bindings: usb: Add bindings doc for Sunplus USB HOST OHCI driver

Hi, Krzysztof

Krzysztof Kozlowski <[email protected]> 於 2022年3月15日 週二 上午12:42寫道:

Quoted 27 lines · Vincent Shih
Quoted 15 lines

Add bindings doc for Sunplus USB HOST OHCI driver

---
 .../bindings/usb/sunplus,sp7021-usb-ohci.yaml      | 69 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 70 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml new file +0 -0
new file mode 100644
index 0000000..7583b68

Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml line 7

Quoted 7 lines
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml new file +7 -0
@@ -0,0 +1,69 @@
+# 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-ohci.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+

Looks good. Few minor nitpicks:

Quoted 4 lines

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

Quoted 1 line
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml new file +1 -0
+title: Sunplus SP7021 OHCI Controller Device Tree Bindings

Remove "Device Tree Bindings" words here. Title is about hardware.

Yes, I will remove it.

Quoted 5 lines

Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml line 11

Quoted 3 lines
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml new file +3 -0
+
+allOf:
+  - $ref: usb-hcd.yaml#

Put entire "allOf:" just before "properties:".

Yes, I will modify it.

Quoted 32 lines
Quoted 32 lines
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml new file +31 -0
+
+maintainers:
+  - Vincent Shih <[email protected]>
+
+description:
+  Sunplus SP7021 USB HOST IP is a USB2.0 Host Controller. It supports both
+  Enhanced Host Controller Interface (EHCI) and Open Host Controller Interface
+  (OHCI).
+
+  It supports 32-bits address bus and 64bit data bus interface, compliant
+  to AMBA AXI interface for data transfer.
+
+  It supports 32-bits address and data bus interface, compliant to AMBA
+  AHB interface for register configurations.
+
+  It supports 32-bits address and data bus interface, compliant to AMBA
+  AXI interface for register alternative configurations.
+
+  The UTM Interface block generates PHY control signals, compliant to
+  USB2.0 Transceiver Macrocell Interface Specification Revision 1.0.
+
+properties:
+  compatible:
+    const: sunplus,sp7021-usb-ohci
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
Quoted 9 lines

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

Quoted 5 lines
Documentation/devicetree/bindings/usb/sunplus,sp7021-usb-ohci.yaml new file +5 -0
+  resets:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1

You might need here phys. Are you sure you do not need to configure the phy for OHCI? You should not assume it would be configured by other driver.

Yes, OHCI driver does not need to configure phy according to the suggestion of our RD.
The default status of phy after power-on is good enough for OHCI.

Quoted 2 lines

Best regards,
Krzysztof

Thanks for your review.

maintainer
#5 lore raw
In reply to Vincent Shih
Quoted 5 lines · Vincent Shih

This is a patch series for USB HOST OHCI driver for Sunplus SP7021 SoC.

Sunplus SP7021 is an ARM Cortex 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.

Looks to me like the generic-ohci binding and driver should work for this?

Rob

author
#6 lore raw

Rob Herring <[email protected]> 於 2022年3月24日 週四 上午2:07寫道:

Quoted 11 lines · Vincent Shih
Quoted 5 lines

This is a patch series for USB HOST OHCI driver for Sunplus SP7021 SoC.

Sunplus SP7021 is an ARM Cortex 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.

Looks to me like the generic-ohci binding and driver should work for this?

The generic-ohci binding and driver did work for Sunplus SP7021. And do I need to submit the patch for the ohci driver and binding doc for Sunplus
SP7021 SoC ?

Quoted 1 line

Rob

maintainer
#7 lore raw
Quoted 9 lines · 施錕鴻

Rob Herring <[email protected]> 於 2022年3月24日 週四 上午2:07寫道:

Quoted 8 lines · Vincent Shih
Quoted 5 lines

This is a patch series for USB HOST OHCI driver for Sunplus SP7021 SoC.

Sunplus SP7021 is an ARM Cortex 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.

Quoted 7 lines
Quoted 3 lines

Looks to me like the generic-ohci binding and driver should work for this?

The generic-ohci binding and driver did work for Sunplus SP7021. And do I need to submit the patch for the ohci driver and binding doc for Sunplus
SP7021 SoC ?

Just need to add the compatible string to the generic-ohci binding. For the driver, I don't know, did you have to change anything?

Rob