Skip to content

Commit 48af32d

Browse files
cameledMaureenHelm
authored andcommitted
dts: i2c: introduce gd32 i2c interface
Add gd32 i2c interface support. Signed-off-by: HaiLong Yang <[email protected]>
1 parent 76968d9 commit 48af32d

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

dts/arm/gigadevice/gd32f4xx/gd32f4xx.dtsi

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <arm/armv7-m.dtsi>
88
#include <dt-bindings/gpio/gpio.h>
9+
#include <dt-bindings/i2c/i2c.h>
910

1011
#include <dt-bindings/pwm/pwm.h>
1112

@@ -131,6 +132,45 @@
131132
#io-channel-cells = <1>;
132133
};
133134

135+
i2c0: i2c@40005400 {
136+
compatible = "gd,gd32-i2c";
137+
reg = <0x40005400 0x400>;
138+
#address-cells = <1>;
139+
#size-cells = <0>;
140+
clock-frequency = <I2C_BITRATE_STANDARD>;
141+
interrupts = <31 0>, <32 0>;
142+
interrupt-names = "event", "error";
143+
rcu-periph-clock = <0x1015>;
144+
status = "disabled";
145+
label = "I2C_0";
146+
};
147+
148+
i2c1: i2c@40005800 {
149+
compatible = "gd,gd32-i2c";
150+
reg = <0x40005800 0x400>;
151+
#address-cells = <1>;
152+
#size-cells = <0>;
153+
clock-frequency = <I2C_BITRATE_STANDARD>;
154+
interrupts = <33 0>, <34 0>;
155+
interrupt-names = "event", "error";
156+
rcu-periph-clock = <0x1016>;
157+
status = "disabled";
158+
label = "I2C_1";
159+
};
160+
161+
i2c2: i2c@40005c00 {
162+
compatible = "gd,gd32-i2c";
163+
reg = <0x40005c00 0x400>;
164+
#address-cells = <1>;
165+
#size-cells = <0>;
166+
clock-frequency = <I2C_BITRATE_STANDARD>;
167+
interrupts = <72 0>, <73 0>;
168+
interrupt-names = "event", "error";
169+
rcu-periph-clock = <0x1017>;
170+
status = "disabled";
171+
label = "I2C_2";
172+
};
173+
134174
syscfg: syscfg@40013800 {
135175
compatible = "gd,gd32-syscfg";
136176
reg = <0x40013800 0x400>;

dts/bindings/i2c/gd,gd32-i2c.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright (c) 2021 BrainCo Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
description: GigiDevice GD32 I2C
5+
6+
compatible: "gd,gd32-i2c"
7+
8+
include: [i2c-controller.yaml, pinctrl-device.yaml]
9+
10+
properties:
11+
reg:
12+
required: true
13+
14+
interrupts:
15+
required: true
16+
17+
rcu-periph-clock:
18+
type: int
19+
description: Reset Control Unit Peripheral Clock ID
20+
required: true
21+
22+
pinctrl-0:
23+
required: true
24+
25+
pinctrl-names:
26+
required: true

dts/riscv/gigadevice/gd32vf103.dtsi

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <dt-bindings/gpio/gpio.h>
88
#include <dt-bindings/timer/riscv-machine-timer.h>
9+
#include <dt-bindings/i2c/i2c.h>
910

1011
#include <dt-bindings/pwm/pwm.h>
1112

@@ -108,6 +109,20 @@
108109
#io-channel-cells = <1>;
109110
};
110111

112+
i2c0: i2c@40005400 {
113+
compatible = "gd,gd32-i2c";
114+
reg = <0x40005400 0x400>;
115+
#address-cells = <1>;
116+
#size-cells = <0>;
117+
clock-frequency = <I2C_BITRATE_STANDARD>;
118+
interrupts = <50 0>, <51 0>;
119+
interrupt-names = "event", "error";
120+
interrupt-parent = <&eclic>;
121+
rcu-periph-clock = <0x715>;
122+
status = "disabled";
123+
label = "I2C_0";
124+
};
125+
111126
afio: afio@40010000 {
112127
compatible = "gd,gd32-afio";
113128
reg = <0x40010000 0x400>;

0 commit comments

Comments
 (0)