Skip to contentSkip to conversation

Add iop driver for Sunplus SP7021

PATCH Superseded Tony Huang 3 participants 5 messages Feb 21, 2022 – Mar 2, 2022

Subsystems (2)

v9 of 12 Superseded Latest is v12 →

lore
Share & tools
lore

Tony Huang

author
#0 lore raw

v9 cover Add iop driver for Sunplus SP7021

Add iop driver for Sunplus SP7021 SOC

This is a patch series for iop 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

Tony Huang (2):
dt-binding: misc: Add iop yaml file for Sunplus SP7021
misc: Add iop driver for Sunplus SP7021

 .../devicetree/bindings/misc/sunplus-iop.yaml      |  76 ++++
 MAINTAINERS                                        |   6 +
 drivers/misc/Kconfig                               |  20 +
 drivers/misc/Makefile                              |   1 +
 drivers/misc/sunplus_iop.c                         | 420 +++++++++++++++++++++
 5 files changed, 523 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/sunplus-iop.yaml
 create mode 100644 drivers/misc/sunplus_iop.c
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v9 1/2 dt-binding: misc: Add iop yaml file for Sunplus SP7021

Add iop yaml file for Sunplus SP7021

---
Changes in v8:
-No change

 .../devicetree/bindings/misc/sunplus-iop.yaml      | 76 ++++++++++++++++++++++
 MAINTAINERS                                        |  5 ++
 2 files changed, 81 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/sunplus-iop.yaml
Documentation/devicetree/bindings/misc/sunplus-iop.yaml new file +76 -0
new file mode 100644
index 0000000..b37e697
@@ -0,0 +1,76 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) Sunplus Ltd. Co. 2021
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/misc/sunplus-iop.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sunplus IOP(8051) controller
+
+maintainers:
+  - Tony Huang <[email protected]>
+
+description: |
+  Processor for I/O control, RTC wake-up procedure management,
+  and cooperation with CPU&PMC in power management.
+
+properties:
+  compatible:
+    enum:
+      - sunplus,sp7021-iop
+
+  reg:
+    items:
+      - description: IOP registers regions
+      - description: PMC registers regions
+      - description: MOON0 registers regions
+
+  reg-names:
+    items:
+      - const: iop
+      - const: iop_pmc
+      - const: moon0
+
+  interrupts:
+    items:
+      - description: IOP_INT0. IOP to system Interrupt 0.
+                     Sent by IOP to system RISC.
+      - description: IOP_INT1. IOP to System Interrupt 1.
+                     Sent by IOP to system RISC.
+
+  memory-region:
+    maxItems: 1
+
+  wakeup-gpios:
+    description: When the linux kernel system is powered off.
+      8051 is always powered. 8051 cand receive external signals
+      according to this gpio pin. 8051 receives external signal
+      through gpio pin. 8051 can power on linux kernel system.
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - interrupts
+  - memory-region
+  - wakeup-gpios
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/gpio/gpio.h>
+    iop: iop@9c000400 {
+        compatible = "sunplus,sp7021-iop";
+        reg = <0x9c000400 0x80>, <0x9c003100 0x80>, <0x9c000000 0x80>;
+        reg-names = "iop", "iop_pmc", "moon0";
+        interrupt-parent = <&intc>;
+        interrupts = <41 IRQ_TYPE_LEVEL_HIGH>, <42 IRQ_TYPE_LEVEL_HIGH>;
+        memory-region = <&iop_reserve>;
+        pinctrl-names = "default";
+        pinctrl-0 = <&iop_pins>;
+        wakeup-gpios = <&pctl 1 GPIO_ACTIVE_HIGH>;
+    };
+...
MAINTAINERS +5 -0
index fb18ce7..6f336c9 100644
@@ -18242,6 +18242,11 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/net/ethernet/dlink/sundance.c
 
+SUNPLUS IOP DRIVER
+M:	Tony Huang <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/misc/sunplu-iop.yaml
+
 SUPERH
 M:	Yoshinori Sato <[email protected]>
 M:	Rich Felker <[email protected]>
Signature · 1 line
2.7.4
author
#2 lore raw

PATCH v9 2/2 misc: Add iop driver for Sunplus SP7021

In reply to Tony Huang

IOP(8051) embedded inside SP7021 which is used as Processor for I/O control, monitor RTC interrupt and cooperation with CPU & PMC in power management purpose. The IOP core is DQ8051, so also named IOP8051,
it supports dedicated JTAG debug pins which share with SP7021. In standby mode operation, the power spec reach 400uA.

---
Changes in v9:
- Remove custom attributes sysfs.

 MAINTAINERS                |   1 +
 drivers/misc/Kconfig       |  20 +++
 drivers/misc/Makefile      |   1 +
 drivers/misc/sunplus_iop.c | 420 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 442 insertions(+)
 create mode 100644 drivers/misc/sunplus_iop.c
MAINTAINERS +1 -0
index 6f336c9..11ecefa 100644
@@ -18246,6 +18246,7 @@ SUNPLUS IOP DRIVER
 M:	Tony Huang <[email protected]>
 S:	Maintained
 F:	Documentation/devicetree/bindings/misc/sunplu-iop.yaml
+F:	drivers/misc/sunplus_iop.c
 
 SUPERH
 M:	Yoshinori Sato <[email protected]>
drivers/misc/Kconfig +20 -0
index 0f5a49f..c1d790e 100644
@@ -470,6 +470,26 @@ config HISI_HIKEY_USB
 	  switching between the dual-role USB-C port and the USB-A host ports
 	  using only one USB controller.
 
+config SUNPLUS_IOP
+	tristate "Sunplus IOP support"
+	default ARCH_SUNPLUS
+	help
+	  Sunplus I/O processor (8051) driver.
+	  Processor for I/O control, monitor RTC interrupt
+	  and cooperation with CPU&PMC in power management.
+
+	  The IOP core is DQ8051, so also named IOP8051.
+	  Need Install DQ8051, The DQ8051 bin file generated by keil C.
+	  We will provide users with 8051 normal and standby source code.
+	  Path: https://sunplus.atlassian.net/wiki/spaces/doc/pages/610172933/
+	  How+to+use+I+O+processor+8051+of+SP7021#5.-Write-C-or-assembly-source-files-for-IOP
+	  Users can follow the operation steps to generate normal.bin and standby.bin.
+	  Path: https://sunplus.atlassian.net/wiki/spaces/doc/pages/466190338/26.+IOP8051
+	  26.5?How To Create 8051 bin file
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called sunplus_iop.
+
 source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +1 -0
index a086197..eafeab6 100644
@@ -52,6 +52,7 @@ obj-$(CONFIG_DW_XDATA_PCIE)	+= dw-xdata-pcie.o
 obj-$(CONFIG_PCI_ENDPOINT_TEST)	+= pci_endpoint_test.o
 obj-$(CONFIG_OCXL)		+= ocxl/
 obj-$(CONFIG_BCM_VK)		+= bcm-vk/
+obj-$(CONFIG_SUNPLUS_IOP)	+= sunplus_iop.o
 obj-y				+= cardreader/
 obj-$(CONFIG_PVPANIC)   	+= pvpanic/
 obj-$(CONFIG_HABANA_AI)		+= habanalabs/
drivers/misc/sunplus_iop.c new file +420 -0

420 lines not on this page · raw message

Signature · 1 line
2.7.4
maintainer
#3 lore raw

Re: [PATCH v9 2/2] misc: Add iop driver for Sunplus SP7021

Quoted 8 lines · Tony Huang

IOP(8051) embedded inside SP7021 which is used as Processor for I/O control, monitor RTC interrupt and cooperation with CPU & PMC in power management purpose. The IOP core is DQ8051, so also named IOP8051,
it supports dedicated JTAG debug pins which share with SP7021. In standby mode operation, the power spec reach 400uA.

Quoted 4 lines

---
Changes in v9:
- Remove custom attributes sysfs.

You are now back to a driver that does nothing at all, please make it use at least one kernel subsystem that it can hook up to before you send it again.

Also, when listing the functionality above, describe which subsystems you want to use for those in the long run, this would make it clearer to see which direction you want to take this driver when you add back the features.

Arnd

#4 lore raw

RE: [PATCH v9 2/2] misc: Add iop driver for Sunplus SP7021

Dear Arnd, Gregkh:

Quoted 22 lines

-----Original Message-----
From: Arnd Bergmann <[email protected]>
Sent: Monday, February 21, 2022 3:20 PM
To: Tony Huang <[email protected]>
Cc: Rob Herring <[email protected]>; DTML <[email protected]>; Linux Kernel Mailing List <[email protected]>; Derek Kiernan <[email protected]>; Dragan Cvetic <[email protected]>; Arnd Bergmann <[email protected]>; gregkh <[email protected]>; Wells Lu 呂芳騰 <[email protected]>; Tony Huang 黃懷厚 <[email protected]>
Subject: Re: [PATCH v9 2/2] misc: Add iop driver for Sunplus SP7021

Quoted 8 lines · Tony Huang

IOP(8051) embedded inside SP7021 which is used as Processor for I/O control, monitor RTC interrupt and cooperation with CPU & PMC in power management purpose.
The IOP core is DQ8051, so also named IOP8051, it supports dedicated JTAG debug pins which share with SP7021.
In standby mode operation, the power spec reach 400uA.

Quoted 8 lines
Quoted 4 lines

---
Changes in v9:
- Remove custom attributes sysfs.

You are now back to a driver that does nothing at all, please make it use at least one kernel subsystem that it can hook up to before you send it again.

monitor RTC interrupt:
SP7021 system has its own RTC device driver (rtc-sunplus.c).
The user can set the RTC wake-up time through rtc-sunplus.c.
The IOP code does not need to increase the RTC subsystem function, set the RTC register. When the linux kernel system. Only the 8051 CPU has power and can monitor the RTC wake-up interrupt.

Quoted 5 lines

Also, when listing the functionality above, describe which subsystems you want to use for those in the long run, this would make it clearer to see which direction you want to take this driver when you add back the features.

Arnd