i2c: ma35d1: Add support for MA35D1 I2C controller
Subsystems (4)
v2 cover i2c: ma35d1: Add support for MA35D1 I2C controller
This series adds support for the I2C controller found in the Nuvoton MA35D1 SoC. The driver supports controller and optional target mode and runtime power management.
The implementation has been tested on the Nuvoton MA35D1 SOM board.
Changes in v2:
- Overall:
- Rebase on linux-i2c/i2c-next
- Switched terminology from "master/slave" to "controller/target".
- Patch 1 (dt-bindings):
- Simplified description and fixed 'reg' size in example.
- Patch 2 (driver):
- Modernized using devm_*, generic device properties, and FIELD_PREP/GENMASK.
- Optimized power management by moving clock control to runtime PM.
- Simplified code by removing redundant .remove(), .owner, and inlines.
- Added dev_err_probe() and default bus frequency handling.
- Patch 3 (dts):
- Moved i2c aliases to board dts and reordered nodes alphabetically.
-Link to v1: https://lore.kernel.org/r/[email protected]
Zi-Yu Chen (3):
dt-bindings: i2c: nuvoton,ma35d1-i2c: Add MA35D1 I2C controller
i2c: ma35d1: Add Nuvoton MA35D1 I2C driver support
arm64: dts: nuvoton: Add I2C nodes for MA35D1 SoC
.../bindings/i2c/nuvoton,ma35d1-i2c.yaml | 63 ++ .../boot/dts/nuvoton/ma35d1-som-256m.dts | 18 +- arch/arm64/boot/dts/nuvoton/ma35d1.dtsi | 60 ++ drivers/i2c/busses/Kconfig | 13 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-ma35d1.c | 792 ++++++++++++++++++ 6 files changed, 946 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/i2c/nuvoton,ma35d1-i2c.yaml create mode 100644 drivers/i2c/busses/i2c-ma35d1.c
Signature · 1 line
2.34.1
PATCH v2 1/3 dt-bindings: i2c: nuvoton,ma35d1-i2c: Add MA35D1 I2C controller
Add device tree binding documentation for the I2C controller found in the Nuvoton MA35D1 SoC.
--- .../bindings/i2c/nuvoton,ma35d1-i2c.yaml | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/nuvoton,ma35d1-i2c.yaml
Documentation/devicetree/bindings/i2c/nuvoton,ma35d1-i2c.yaml new file +63 -0
@@ -0,0 +1,63 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/i2c/nuvoton,ma35d1-i2c.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Nuvoton MA35D1 I2C Controller + +maintainers: + - Zi-Yu Chen <[email protected]> + +description: + The Nuvoton MA35D1 I2C controller supports controller and optional target mode. + +allOf: + - $ref: /schemas/i2c/i2c-controller.yaml# + +properties: + compatible: + const: nuvoton,ma35d1-i2c + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-frequency: + description: + Desired I2C bus clock frequency in Hz. The absence of this property + indicates the default frequency 100 kHz. + + resets: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + - clocks + - resets + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/clock/nuvoton,ma35d1-clk.h> + #include <dt-bindings/reset/nuvoton,ma35d1-reset.h> + + i2c0: i2c@40800000 { + compatible = "nuvoton,ma35d1-i2c"; + reg = <0x40800000 0x1000>; + interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk I2C0_GATE>; + clock-frequency = <100000>; + resets = <&sys MA35D1_RESET_I2C0>; + #address-cells = <1>; + #size-cells = <0>; + };
Signature · 1 line
2.34.1
PATCH v2 2/3 i2c: ma35d1: Add Nuvoton MA35D1 I2C driver support
In reply to Zi-Yu ChenAdd I2C support for Nuvoton MA35D1 SoC.
The controller supports standard, fast and fast-plus modes, and provides controller/target functionality.
--- drivers/i2c/busses/Kconfig | 13 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-ma35d1.c | 792 ++++++++++++++++++++++++++++++++ 3 files changed, 806 insertions(+) create mode 100644 drivers/i2c/busses/i2c-ma35d1.c
drivers/i2c/busses/Kconfig +13 -0
@@ -1589,4 +1589,17 @@ config I2C_VIRTIO This driver can also be built as a module. If so, the module will be called i2c-virtio. +config I2C_MA35D1 + tristate "Nuvoton MA35D1 I2C driver" + depends on ARCH_MA35 || COMPILE_TEST + select I2C_SLAVE + help + If you say yes to this option, support will be included for the + I2C controller in the Nuvoton MA35D1 SoC. This driver + supports the standard I2C bus protocols, including master and + slave modes. + + This driver can also be built as a module. If so, the module + will be called i2c-ma35d1. + endmenu
drivers/i2c/busses/Makefile +1 -0
@@ -130,6 +130,7 @@ obj-$(CONFIG_I2C_XILINX) += i2c-xiic.o obj-$(CONFIG_I2C_XLP9XX) += i2c-xlp9xx.o obj-$(CONFIG_I2C_RCAR) += i2c-rcar.o obj-$(CONFIG_I2C_GXP) += i2c-gxp.o +obj-$(CONFIG_I2C_MA35D1) += i2c-ma35d1.o # External I2C/SMBus adapter drivers obj-$(CONFIG_I2C_DIOLAN_U2C) += i2c-diolan-u2c.o
drivers/i2c/busses/i2c-ma35d1.c new file +792 -0
792 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v2 3/3 arm64: dts: nuvoton: Add I2C nodes for MA35D1 SoC
In reply to Zi-Yu ChenAdd I2C controller nodes to the MA35D1 SoC dtsi. Also enable the I2C interfaces on the MA35D1 SOM board to allow communication with onboard peripherals.
--- .../boot/dts/nuvoton/ma35d1-som-256m.dts | 18 +++++- arch/arm64/boot/dts/nuvoton/ma35d1.dtsi | 60 +++++++++++++++++++ 2 files changed, 77 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/nuvoton/ma35d1-som-256m.dts +17 -1
@@ -13,6 +13,7 @@ / { compatible = "nuvoton,ma35d1-som", "nuvoton,ma35d1"; aliases { + i2c0 = &i2c2; serial0 = &uart0; serial11 = &uart11; serial12 = &uart12;
@@ -55,6 +56,12 @@ &clk { "integer"; }; +&i2c1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c1>; + status = "okay"; +}; + &pinctrl { uart-grp { pinctrl_uart0: uart0-pins {
@@ -98,6 +105,15 @@ pinctrl_uart16: uart16-pins { power-source = <1>; }; }; + + i2c-grp { + pinctrl_i2c1: i2c1-pins { + nuvoton,pins = <1 10 12>, + <1 11 12>; + bias-disable; + }; + + }; }; &uart0 {
@@ -128,4 +144,4 @@ &uart16 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart16>; status = "okay"; -}; +};
arch/arm64/boot/dts/nuvoton/ma35d1.dtsi +60 -0
66 lines not on this page · raw message
Signature · 1 line
2.34.1
Hi Andi and Krzysztof,
I'm following up on this series. As detailed in the change log, v2 addresses the feedback from v1 regarding the modernization of legacy code.
I am preparing v3 to address minor formatting issues in Patch 3 (DTS). Before sending it out, I would highly appreciate any technical feedback on the driver logic in Patch 2 to ensure it aligns with your expectations.
Best regards,
Zi-Yu
Zi-Yu Chen 於 2026/3/16 下午 02:37 寫道:
Quoted 40 lines
This series adds support for the I2C controller found in the Nuvoton MA35D1 SoC. The driver supports controller and optional target mode and runtime power management.
The implementation has been tested on the Nuvoton MA35D1 SOM board.
Changes in v2:
- Overall:
- Rebase on linux-i2c/i2c-next
- Switched terminology from "master/slave" to "controller/target".- Patch 1 (dt-bindings):
- Simplified description and fixed 'reg' size in example.- Patch 2 (driver):
- Modernized using devm_*, generic device properties, and FIELD_PREP/GENMASK.
- Optimized power management by moving clock control to runtime PM.
- Simplified code by removing redundant .remove(), .owner, and inlines.
- Addeddev_err_probe()and default bus frequency handling.- Patch 3 (dts):
- Moved i2c aliases to board dts and reordered nodes alphabetically.-Link to v1: https://lore.kernel.org/r/[email protected]
Zi-Yu Chen (3):
dt-bindings: i2c: nuvoton,ma35d1-i2c: Add MA35D1 I2C controller
i2c: ma35d1: Add Nuvoton MA35D1 I2C driver support
arm64: dts: nuvoton: Add I2C nodes for MA35D1 SoC.../bindings/i2c/nuvoton,ma35d1-i2c.yaml | 63 ++ .../boot/dts/nuvoton/ma35d1-som-256m.dts | 18 +- arch/arm64/boot/dts/nuvoton/ma35d1.dtsi | 60 ++ drivers/i2c/busses/Kconfig | 13 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-ma35d1.c | 792 ++++++++++++++++++ 6 files changed, 946 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/i2c/nuvoton,ma35d1-i2c.yaml create mode 100644 drivers/i2c/busses/i2c-ma35d1.c