Skip to content

Commit

Permalink
soc: silabs: siwx917: Enable I2C
Browse files Browse the repository at this point in the history
- Add snps,designware-i2c compatibility for I2C peripherals.
- Enable I2C clocks in soc.c for now, pending proper implementation of
  clock control.
- Add pinctrl configuration for Si7021 sensor on rb4338a board.

Signed-off-by: Aksel Skauge Mellbye <[email protected]>
  • Loading branch information
asmellby committed Sep 13, 2024
1 parent d3d7179 commit 515c19d
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
19 changes: 19 additions & 0 deletions boards/silabs/radio_boards/siwx917_rb4338a/siwx917_rb4338a.dts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input-event-codes.h>
#include <dt-bindings/pinctrl/silabs/siwx917-pinctrl.h>
#include <common/freq.h>

/ {
model = "Silicon Labs BRD4338A (SiWG917 Radio Board)";
Expand Down Expand Up @@ -58,6 +59,19 @@
pinctrl-names = "default";
};

&ulpi2c {
status = "disabled";
pinctrl-0 = <&ulpi2c_default>;
pinctrl-names = "default";
clock-frequency = <DT_FREQ_K(100)>;

si7021: si7021@40 {
compatible = "silabs,si7006";
reg = <0x40>;
status = "disabled";
};
};

&pinctrl0 {
ulpuart0_default: ulpuart0_default {
out {
Expand All @@ -67,4 +81,9 @@
pinmux = <ULPUART_RX_ULP9>;
};
};
ulpi2c_default: ulpi2c_default {
group {
pinmux = <ULPI2C_SDA_ULP6>, <ULPI2C_SCL_ULP7>;
};
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ toolchain:
- xtools
supported:
- gpio
- i2c
vendor: silabs
30 changes: 30 additions & 0 deletions dts/arm/silabs/siwg917.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,36 @@
ngpios = <5>;
status = "okay";
};

i2c0: i2c@44010000 {
compatible = "snps,designware-i2c";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x44010000 0x100>;
interrupts = <42 0>;
interrupt-names = "i2c0";
status = "disabled";
};

i2c1: i2c@47040000 {
compatible = "snps,designware-i2c";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x47040000 0x100>;
interrupts = <61 0>;
interrupt-names = "i2c1";
status = "disabled";
};

ulpi2c: i2c@24040000 {
compatible = "snps,designware-i2c";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x24040000 0x100>;
interrupts = <13 0>;
interrupt-names = "i2c2";
status = "disabled";
};
};
};

Expand Down
12 changes: 12 additions & 0 deletions soc/silabs/silabs_siwx917/siwg917/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ int silabs_siwx917_init(void)
#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay)
RSI_CLK_UsartClkConfig(M4CLK, ENABLE_STATIC_CLK, 0, USART2, 0, 1);
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c0), okay)
RSI_PS_M4ssPeriPowerUp(M4SS_PWRGATE_ULP_EFUSE_PERI);
RSI_CLK_I2CClkConfig(M4CLK, true, 0);
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c1), okay)
RSI_PS_M4ssPeriPowerUp(M4SS_PWRGATE_ULP_EFUSE_PERI);
RSI_CLK_I2CClkConfig(M4CLK, true, 1);
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(ulpi2c), okay)
RSI_PS_UlpssPeriPowerUp(ULPSS_PWRGATE_ULP_I2C);
RSI_ULPSS_PeripheralEnable(ULPCLK, ULP_I2C_CLK, ENABLE_STATIC_CLK);
#endif

return 0;
}
Expand Down

0 comments on commit 515c19d

Please sign in to comment.