boards: efr32mg_sltb004a: Add minimal pwm support

Add minimal pwm support to the efr32mg12p soc and the Thunderboard Sense
2 board.

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
This commit is contained in:
Christian Taedcke 2021-08-09 12:36:02 +02:00 committed by Christopher Friedt
commit 5c8f7bf874
3 changed files with 38 additions and 0 deletions

View file

@ -15,6 +15,7 @@
aliases { aliases {
led0 = &led0; led0 = &led0;
led1 = &led1; led1 = &led1;
pwm-led0 = &pwm_led0;
sw0 = &button0; sw0 = &button0;
sw1 = &button1; sw1 = &button1;
watchdog0 = &wdog0; watchdog0 = &wdog0;
@ -53,6 +54,14 @@
label = "User Push Button 1"; label = "User Push Button 1";
}; };
}; };
pwmleds {
compatible = "pwm-leds";
status = "okay";
pwm_led0: pwm_led0 {
pwms = <&pwm0 0 PWM_POLARITY_NORMAL>;
};
};
}; };
&cpu0 { &cpu0 {
@ -141,6 +150,16 @@
status = "okay"; status = "okay";
}; };
&timer0 {
status = "okay";
pwm0: pwm {
status = "okay";
pin-location = <GECKO_LOCATION(17) GECKO_PORT_D GECKO_PIN(9)>;
prescaler = <1024>;
};
};
&gpio { &gpio {
location-swo = <0>; location-swo = <0>;
status = "okay"; status = "okay";

View file

@ -4,6 +4,7 @@
#include <dt-bindings/gpio/gpio.h> #include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/i2c/i2c.h> #include <dt-bindings/i2c/i2c.h>
#include "gpio_gecko.h" #include "gpio_gecko.h"
#include <dt-bindings/pwm/pwm.h>
/ { / {
chosen { chosen {
@ -234,6 +235,20 @@
status = "disabled"; status = "disabled";
}; };
timer0: timer@40018000 {
compatible = "silabs,gecko-timers";
reg = <0x40018000 0x400>;
status = "disabled";
label = "TIMER_0";
pwm {
compatible = "silabs,gecko-pwm";
status = "disabled";
label = "PWM_0";
#pwm-cells = <2>;
};
};
trng0: trng@4001d000 { trng0: trng@4001d000 {
compatible = "silabs,gecko-trng"; compatible = "silabs,gecko-trng";
reg = <0x4001d000 0x400>; reg = <0x4001d000 0x400>;

View file

@ -28,3 +28,7 @@ config SOC_FLASH_GECKO
config SPI_GECKO config SPI_GECKO
default y default y
depends on SPI depends on SPI
config PWM_GECKO
default y
depends on PWM