Skip to contentSkip to conversation

Add Nuvoton NPCM845 i3c master driver

PATCH In review Stanley Chu 2 participants 5 messages Jul 30, 2024 – Aug 2, 2024

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

cover Add Nuvoton NPCM845 i3c master driver

This patchset adds i3c master support for the Nuvoton Arbel NPCM8XX Board Management controller (BMC) SoC family.

The Nuvoton npcm845 i3c controller implements I3C master functionality as defined in the MIPI Alliance Specification for I3C, Version 1.0.

The npcm845 i3c master driver is based on svc i3c master driver and add platform specific support for the npcm845 hardware.

This patchset was tested on the Arbel NPCM8XX evaluation board.

We will contribute this patchset to torvalds upstream soon.

James Chiang (2):
dt-bindings: i3c: Add NPCM845 i3c controller
i3c: master: Add Nuvoton npcm845 i3c master driver

 .../bindings/i3c/nuvoton,i3c-master.yaml      |  113 +
 MAINTAINERS                                   |    7 +
 drivers/i3c/master/Kconfig                    |   14 +
 drivers/i3c/master/Makefile                   |    1 +
 drivers/i3c/master/npcm845-i3c-master.c       | 2372 +++++++++++++++++
 5 files changed, 2507 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i3c/nuvoton,i3c-master.yaml
 create mode 100644 drivers/i3c/master/npcm845-i3c-master.c
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 dt-bindings: i3c: Add NPCM845 i3c controller

Add a devicetree binding for the npcm845 i3c controller hardware.

---
 .../bindings/i3c/nuvoton,i3c-master.yaml      | 126 ++++++++++++++++++
 1 file changed, 126 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i3c/nuvoton,i3c-master.yaml
Documentation/devicetree/bindings/i3c/nuvoton,i3c-master.yaml new file +126 -0
new file mode 100644
index 000000000000..6bf5f9752006
@@ -0,0 +1,126 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/i3c/nuvoton,i3c-master.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Nuvoton NPCM845 I3C master
+
+maintainers:
+  - Stanley Chu <[email protected]>
+  - James Chiang <[email protected]>
+
+allOf:
+  - $ref: i3c.yaml#
+
+properties:
+  compatible:
+    const: nuvoton,npcm845-i3c
+
+  reg:
+    items:
+      - description: I3C registers
+      - description: GDMA registers
+      - description: GDMA request control register
+
+  reg-names:
+    items:
+      - const: i3c
+      - const: dma
+      - const: dma_ctl
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: system clock
+      - description: bus clock
+
+  clock-names:
+    items:
+      - const: pclk
+      - const: fast_clk
+
+  resets:
+    maxItems: 1
+
+  i3c-pp-scl-hi-period-ns:
+    minimum: 40
+    maximum: 160
+    description: |
+      If need to configure SCL with required duty cycle, specify the clock high/low period directly.
+      i3c-pp-scl-hi-perios-ns specifies the high period ns of the SCL clock cycle in push pull mode
+      When i3c-pp-scl-hi-period-ns and i3c-pp-scl-lo-period-ns are specified, the i3c pp frequency is
+      decided by these two properties.
+
+  i3c-pp-scl-lo-period-ns:
+    minimum: 40
+    maximum: 310
+    description: |
+      The low period ns of the SCL clock cycle in push pull mode. i3c-pp-scl-lo-period-ns should not
+      be less than i3c-pp-scl-hi-period-ns and the maximal value is i3c-pp-scl-hi-period-ns + 150.
+
+  i3c-pp-sda-rd-skew:
+    minimum: 1
+    maximum: 7
+    description: |
+      The number of MCLK clock periods to delay the SDA transition from the SCL clock edge at push
+      pull operation when transfers i3c private read.
+
+  i3c-pp-sda-wr-skew:
+    minimum: 1
+    maximum: 7
+    description: |
+      The number of MCLK clock periods to delay the SDA transition from the SCL clock edge at push
+      pull operation when transfers i3c private write.
+
+  i3c-od-scl-hi-period-ns:
+    description: |
+      The i3c open drain frequency is 1MHz by default.
+      If need to use different frequency, specify the clock high/low period directly.
+      i3c-od-scl-hi-perios-ns specifies the high period ns of the SCL clock cycle in open drain mode.
+      When i3c-od-scl-hi-period-ns and i3c-od-scl-lo-period-ns are specified, the i3c od frequency is
+      decided by these two properties.
+      i3c-od-scl-hi-period-ns should be equal to i3c-pp-scl-hi-period-ns or i3c-od-scl-lo-period-ns.
+
+  i3c-od-scl-lo-period-ns:
+    minimum: 200
+    description: |
+      The low period ns of the SCL clock cycle in open drain mode. i3c-od-scl-lo-period-ns should be
+      multiple of i3c-pp-scl-hi-period-ns.
+
+  enable-hj:
+    type: boolean
+    description: |
+      Enable SLVSTART interrupt for receiving hot-join request.
+
+  use-dma:
+    type: boolean
+    description: |
+      Enable the i3c private transfers using DMA.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clock-names
+  - clocks
+
+additionalProperties: true
+
+examples:
+  - |
+    i3c-master@fff10000 {
+        compatible = "nuvoton,npcm845-i3c";
+        clocks = <&clk 4>, <&clk 26>;
+        clock-names = "pclk", "fast_clk";
+        interrupts = <0 224 4>;
+        reg = <0xfff10000 0x1000>,
+              <0xf0850000 0x1000>,
+              <0xf0800300 0x4>;
+        reg-names = "i3c", "dma", "dma_ctl";
+        resets = <&rstc 0x74 8>;
+        #address-cells = <3>;
+        #size-cells = <0>;
+    };
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/2 i3c: master: Add Nuvoton npcm845 i3c master driver

In reply to Stanley Chu

Add support for the Nuvoton npcm845 i3c controller which implements I3C master functionality as defined in the MIPI Alliance Specification for I3C, Version 1.0.

The master role is supported in SDR mode only. IBI and Hot-join requsts are supported.

---
 MAINTAINERS                             |    7 +
 drivers/i3c/master/Kconfig              |   14 +
 drivers/i3c/master/Makefile             |    1 +
 drivers/i3c/master/npcm845-i3c-master.c | 2372 +++++++++++++++++++++++
 4 files changed, 2394 insertions(+)
 create mode 100644 drivers/i3c/master/npcm845-i3c-master.c
MAINTAINERS +7 -0
index e46d0f6ab29c..7c020ea88ffc 100644
@@ -2510,6 +2510,13 @@ F:	Documentation/userspace-api/media/drivers/npcm-video.rst
 F:	drivers/media/platform/nuvoton/
 F:	include/uapi/linux/npcm-video.h
 
+ARM/NUVOTON NPCM845 I3C MASTER DRIVER
+M:	Stanley Chu <[email protected]>
+M:	James Chiang <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/i3c/nuvoton,i3c-master.yaml
+F:	drivers/i3c/master/npcm845-i3c-master.c
+
 ARM/NUVOTON WPCM450 ARCHITECTURE
 M:	Jonathan Neuschäfer <[email protected]>
 L:	[email protected] (moderated for non-subscribers)
drivers/i3c/master/Kconfig +14 -0
index 90dee3ec5520..a71d504d4744 100644
@@ -44,6 +44,20 @@ config SVC_I3C_MASTER
 	help
 	  Support for Silvaco I3C Dual-Role Master Controller.
 
+config NPCM845_I3C_MASTER
+	tristate "Nuvoton NPCM845 I3C master driver"
+	depends on I3C
+	depends on HAS_IOMEM
+	depends on ARCH_NPCM || COMPILE_TEST
+	help
+	  Support for Nuvoton NPCM845 I3C Master Controller.
+
+	  This hardware is an instance of the SVC I3C controller; this
+	  driver adds platform specific support for NPCM845 hardware.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called npcm845-i3c-master.
+
 config MIPI_I3C_HCI
 	tristate "MIPI I3C Host Controller Interface driver (EXPERIMENTAL)"
 	depends on I3C
drivers/i3c/master/Makefile +1 -0
index 3e97960160bc..3ed55113190a 100644
@@ -3,4 +3,5 @@ obj-$(CONFIG_CDNS_I3C_MASTER)		+= i3c-master-cdns.o
 obj-$(CONFIG_DW_I3C_MASTER)		+= dw-i3c-master.o
 obj-$(CONFIG_AST2600_I3C_MASTER)	+= ast2600-i3c-master.o
 obj-$(CONFIG_SVC_I3C_MASTER)		+= svc-i3c-master.o
+obj-$(CONFIG_NPCM845_I3C_MASTER)	+= npcm845-i3c-master.o
 obj-$(CONFIG_MIPI_I3C_HCI)		+= mipi-i3c-hci/
drivers/i3c/master/npcm845-i3c-master.c new file +2372 -0

2,372 lines not on this page · raw message

Signature · 1 line
2.34.1
maintainer
#3 lore raw
In reply to Stanley Chu
Quoted 6 lines · Stanley Chu

This patchset adds i3c master support for the Nuvoton Arbel NPCM8XX Board Management controller (BMC) SoC family.

The Nuvoton npcm845 i3c controller implements I3C master functionality as defined in the MIPI Alliance Specification for I3C, Version 1.0.

Quoted 6 lines

The npcm845 i3c master driver is based on svc i3c master driver and add platform specific support for the npcm845 hardware.

This patchset was tested on the Arbel NPCM8XX evaluation board.

We will contribute this patchset to torvalds upstream soon.

Please reply here with the appropriate lore[1] link once you've sent the equivalent patches upstream. When you've done so, I'll look to apply these patches to the OpenBMC tree based on the feedback, along with the OpenBMC-Staging-Count tag.

Thanks,

Andrew

[1]: https://lore.kernel.org/

maintainer
#4 lore raw
Quoted 10 lines · Andrew Jeffery
Quoted 9 lines · Stanley Chu

This patchset adds i3c master support for the Nuvoton Arbel NPCM8XX Board Management controller (BMC) SoC family.

The Nuvoton npcm845 i3c controller implements I3C master functionality as defined in the MIPI Alliance Specification for I3C, Version 1.0.

The npcm845 i3c master driver is based on svc i3c master driver and add platform specific support for the npcm845 hardware.

Quoted 8 lines
Quoted 3 lines

This patchset was tested on the Arbel NPCM8XX evaluation board.

We will contribute this patchset to torvalds upstream soon.

Please reply here with the appropriate lore[1] link once you've sent the equivalent patches upstream. When you've done so, I'll look to apply these patches to the OpenBMC tree based on the feedback, along with the OpenBMC-Staging-Count tag.

Based on the feedback from the thread at [1], I'd prefer to wait until you've got an Acked-by or Reviewed-by on from the DT maintainers on the binding.

The driver is less concerning so I think it will be okay to apply that and do some fixups later, but the binding issues need to be sorted first.

Andrew

[1]: https://lore.kernel.org/lkml/[email protected]/