boards: nxp: frdm_ke17z and frdm_ke17z512: add ftm and pwt pwm support

Add ftm pinctrl configuration, and enable ftm2 to support pwm-led.

Signed-off-by: Anke Xiao <anke.xiao@nxp.com>
This commit is contained in:
Anke Xiao 2024-07-15 11:33:09 +08:00 committed by Fabio Baltieri
commit a2890affd4
8 changed files with 88 additions and 0 deletions

View file

@ -65,6 +65,8 @@ features:
+-----------+------------+-------------------------------------+
| DMA | on-chip | dma |
+-----------+------------+-------------------------------------+
| FTM | on-chip | pwm |
+-----------+------------+-------------------------------------+
| I2C | on-chip | i2c |
+-----------+------------+-------------------------------------+
| ACMP | on-chip | sensor |

View file

@ -25,6 +25,16 @@
};
};
ftm2_default: ftm2_default {
group0 {
pinmux = <FTM2_CH0_PTD10>,
<FTM2_CH1_PTD11>,
<FTM2_CH2_PTD12>;
drive-strength = "low";
slew-rate = "slow";
};
};
lpi2c0_default: lpi2c0_default {
group0 {
pinmux = <LPI2C0_SDA_PTA16>,

View file

@ -9,6 +9,7 @@
#include <nxp/nxp_ke17z.dtsi>
#include "frdm_ke17z-pinctrl.dtsi"
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include <zephyr/dt-bindings/pwm/pwm.h>
/ {
model = "NXP Freedom KE17Z board";
@ -20,6 +21,9 @@
led2 = &blue_led;
sw0 = &user_button_0;
sw1 = &user_button_1;
pwm-led0 = &red_pwm_led;
pwm-led1 = &green_pwm_led;
pwm-led2 = &blue_pwm_led;
};
chosen {
@ -45,6 +49,22 @@
};
};
pwmleds {
compatible = "pwm-leds";
red_pwm_led: led_pwm_0 {
pwms = <&ftm2 0 PWM_HZ(20) PWM_POLARITY_INVERTED>;
label = "RED RGB PWM LED";
};
green_pwm_led: led_pwm_1 {
pwms = <&ftm2 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
label = "GREEN RGB PWM LED";
};
blue_pwm_led: led_pwm_2 {
pwms = <&ftm2 2 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
label = "BLUE RGB PWM LED";
};
};
gpio_keys {
compatible = "gpio-keys";
user_button_0: button_0 {
@ -90,6 +110,17 @@
status = "okay";
};
&ftm2 {
status = "okay";
compatible = "nxp,kinetis-ftm-pwm";
#pwm-cells = <3>;
clocks = <&scg KINETIS_SCG_SIRC_CLK>;
prescaler = <128>;
pinctrl-0 = <&ftm2_default>;
pinctrl-names = "default";
clock-source = "system";
};
&flash0 {
partitions {
compatible = "fixed-partitions";

View file

@ -12,6 +12,7 @@ supported:
- gpio
- adc
- uart
- pwm
- i2c
- spi
- dma

View file

@ -61,6 +61,8 @@ features:
| UART | on-chip | uart polling; |
| | | uart interrupt |
+-----------+------------+-------------------------------------+
| FTM | on-chip | pwm |
+-----------+------------+-------------------------------------+
| I2C | on-chip | I2C |
+-----------+------------+-------------------------------------+
| ACMP | on-chip | sensor |

View file

@ -26,6 +26,16 @@
};
};
ftm2_default: ftm2_default {
group0 {
pinmux = <FTM2_CH0_PTD10>,
<FTM2_CH2_PTD12>,
<FTM2_CH3_PTD5>;
drive-strength = "low";
slew-rate = "slow";
};
};
lpi2c0_default: lpi2c0_default {
group0 {
pinmux = <LPI2C0_SDA_PTA2>,

View file

@ -9,6 +9,7 @@
#include <nxp/nxp_ke17z512.dtsi>
#include "frdm_ke17z512-pinctrl.dtsi"
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include <zephyr/dt-bindings/pwm/pwm.h>
/ {
model = "NXP Freedom KE17Z512 board";
@ -27,6 +28,9 @@
led2 = &blue_led;
sw0 = &user_button_2;
sw1 = &user_button_3;
pwm-led0 = &red_pwm_led;
pwm-led1 = &green_pwm_led;
pwm-led2 = &blue_pwm_led;
};
leds {
@ -45,6 +49,22 @@
};
};
pwmleds {
compatible = "pwm-leds";
red_pwm_led: led_pwm_0 {
pwms = <&ftm2 0 PWM_HZ(20) PWM_POLARITY_INVERTED>;
label = "RED RGB PWM LED";
};
green_pwm_led: led_pwm_1 {
pwms = <&ftm2 3 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
label = "GREEN RGB PWM LED";
};
blue_pwm_led: led_pwm_2 {
pwms = <&ftm2 2 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
label = "BLUE RGB PWM LED";
};
};
gpio_keys {
compatible = "gpio-keys";
user_button_2: button_0 {
@ -96,6 +116,17 @@
pinctrl-names = "default";
};
&ftm2 {
status = "okay";
compatible = "nxp,kinetis-ftm-pwm";
#pwm-cells = <3>;
clocks = <&scg KINETIS_SCG_SIRC_CLK>;
prescaler = <128>;
pinctrl-0 = <&ftm2_default>;
pinctrl-names = "default";
clock-source = "system";
};
&flash0 {
partitions {

View file

@ -18,6 +18,7 @@ supported:
- gpio
- adc
- uart
- pwm
- i2c
- spi
- dma