Skip to content

Commit 5933312

Browse files
committed
riscv: dts: spacemit: add gpio support for K1 SoC
Populate the GPIO node in the device tree for SpacemiT K1 SoC. Each of 32 pins will act as one bank and map pins to pinctrl controller. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Yixun Lan <[email protected]>
1 parent 3b2802c commit 5933312

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
#define K1_PADCONF(pin, func) (((pin) << 16) | (func))
99

10+
/* Map GPIO pin to each bank's <index, offset> */
11+
#define K1_GPIO(x) (x / 32) (x % 32)
12+
1013
&pinctrl {
1114
uart0_2_cfg: uart0-2-cfg {
1215
uart0-2-pins {

arch/riscv/boot/dts/spacemit/k1.dtsi

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,24 @@
465465
status = "disabled";
466466
};
467467

468+
gpio: gpio@d4019000 {
469+
compatible = "spacemit,k1-gpio";
470+
reg = <0x0 0xd4019000 0x0 0x100>;
471+
clocks = <&syscon_apbc CLK_GPIO>,
472+
<&syscon_apbc CLK_GPIO_BUS>;
473+
clock-names = "core", "bus";
474+
gpio-controller;
475+
#gpio-cells = <3>;
476+
interrupts = <58>;
477+
interrupt-parent = <&plic>;
478+
interrupt-controller;
479+
#interrupt-cells = <3>;
480+
gpio-ranges = <&pinctrl 0 0 0 32>,
481+
<&pinctrl 1 0 32 32>,
482+
<&pinctrl 2 0 64 32>,
483+
<&pinctrl 3 0 96 32>;
484+
};
485+
468486
pinctrl: pinctrl@d401e000 {
469487
compatible = "spacemit,k1-pinctrl";
470488
reg = <0x0 0xd401e000 0x0 0x400>;

0 commit comments

Comments
 (0)