From 72d347f01845f6ebcc75bd8125581c65f4a5ee70 Mon Sep 17 00:00:00 2001 From: Dat Nguyen Duy Date: Sat, 14 Sep 2024 16:00:15 +0700 Subject: [PATCH] boards: s32z2xxdc2: add support PWM eMIOS Add support PWM eMIOS for s32z2xxdc2 board. There is no LED on-board dedicated for PWM, so no sample is supported. Only enabling some pwm tests Signed-off-by: Dat Nguyen Duy --- boards/nxp/s32z2xxdc2/doc/index.rst | 2 + .../s32z2xxdc2/s32z2xxdc2_s32z270_rtu0.yaml | 1 + .../s32z2xxdc2/s32z2xxdc2_s32z270_rtu0_D.yaml | 1 + .../s32z2xxdc2/s32z2xxdc2_s32z270_rtu1.yaml | 1 + .../s32z2xxdc2/s32z2xxdc2_s32z270_rtu1_D.yaml | 1 + .../boards/s32z2xxdc2_s32z270_rtu0.overlay | 39 ++++++++++++++ .../boards/s32z2xxdc2_s32z270_rtu1.overlay | 39 ++++++++++++++ .../boards/s32z2xxdc2_s32z270_rtu0.overlay | 51 +++++++++++++++++++ .../boards/s32z2xxdc2_s32z270_rtu1.overlay | 51 +++++++++++++++++++ 9 files changed, 186 insertions(+) create mode 100644 tests/drivers/pwm/pwm_api/boards/s32z2xxdc2_s32z270_rtu0.overlay create mode 100644 tests/drivers/pwm/pwm_api/boards/s32z2xxdc2_s32z270_rtu1.overlay create mode 100644 tests/drivers/pwm/pwm_loopback/boards/s32z2xxdc2_s32z270_rtu0.overlay create mode 100644 tests/drivers/pwm/pwm_loopback/boards/s32z2xxdc2_s32z270_rtu1.overlay diff --git a/boards/nxp/s32z2xxdc2/doc/index.rst b/boards/nxp/s32z2xxdc2/doc/index.rst index d864059de00bbfc..2fa9c96e03d4975 100644 --- a/boards/nxp/s32z2xxdc2/doc/index.rst +++ b/boards/nxp/s32z2xxdc2/doc/index.rst @@ -59,6 +59,8 @@ The boards support the following hardware features: +-----------+------------+-------------------------------------+ | LPI2C | on-chip | i2c | +-----------+------------+-------------------------------------+ +| eMIOS | on-chip | pwm | ++-----------+------------+-------------------------------------+ Other hardware features are not currently supported by the port. diff --git a/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu0.yaml b/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu0.yaml index 1ec2dc27de4f34e..ae5c99fc0fa0b25 100644 --- a/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu0.yaml +++ b/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu0.yaml @@ -18,4 +18,5 @@ supported: - counter - adc - i2c + - pwm vendor: nxp diff --git a/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu0_D.yaml b/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu0_D.yaml index 329e11384c73939..ea4269d3fac8319 100644 --- a/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu0_D.yaml +++ b/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu0_D.yaml @@ -18,4 +18,5 @@ supported: - counter - adc - i2c + - pwm vendor: nxp diff --git a/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1.yaml b/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1.yaml index ff384e953beac0b..85be43286854c6e 100644 --- a/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1.yaml +++ b/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1.yaml @@ -18,4 +18,5 @@ supported: - counter - adc - i2c + - pwm vendor: nxp diff --git a/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1_D.yaml b/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1_D.yaml index 1165ca8019468f1..e400165649e004c 100644 --- a/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1_D.yaml +++ b/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1_D.yaml @@ -18,4 +18,5 @@ supported: - counter - adc - i2c + - pwm vendor: nxp diff --git a/tests/drivers/pwm/pwm_api/boards/s32z2xxdc2_s32z270_rtu0.overlay b/tests/drivers/pwm/pwm_api/boards/s32z2xxdc2_s32z270_rtu0.overlay new file mode 100644 index 000000000000000..eae92bfc7e4cd9a --- /dev/null +++ b/tests/drivers/pwm/pwm_api/boards/s32z2xxdc2_s32z270_rtu0.overlay @@ -0,0 +1,39 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/ { + aliases { + pwm-0 = &emios0_pwm; + }; +}; + +&pinctrl { + emios0_default: emios0_default { + group0 { + pinmux = ; + output-enable; + }; + }; +}; + +&emios0 { + clock-divider = <133>; + status = "okay"; + + emios0_pwm: pwm { + pinctrl-0 = <&emios0_default>; + pinctrl-names = "default"; + status = "okay"; + + pwm_24 { + channel = <24>; + prescaler = <16>; + pwm-mode = "OPWFMB"; + }; + }; +}; diff --git a/tests/drivers/pwm/pwm_api/boards/s32z2xxdc2_s32z270_rtu1.overlay b/tests/drivers/pwm/pwm_api/boards/s32z2xxdc2_s32z270_rtu1.overlay new file mode 100644 index 000000000000000..eae92bfc7e4cd9a --- /dev/null +++ b/tests/drivers/pwm/pwm_api/boards/s32z2xxdc2_s32z270_rtu1.overlay @@ -0,0 +1,39 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/ { + aliases { + pwm-0 = &emios0_pwm; + }; +}; + +&pinctrl { + emios0_default: emios0_default { + group0 { + pinmux = ; + output-enable; + }; + }; +}; + +&emios0 { + clock-divider = <133>; + status = "okay"; + + emios0_pwm: pwm { + pinctrl-0 = <&emios0_default>; + pinctrl-names = "default"; + status = "okay"; + + pwm_24 { + channel = <24>; + prescaler = <16>; + pwm-mode = "OPWFMB"; + }; + }; +}; diff --git a/tests/drivers/pwm/pwm_loopback/boards/s32z2xxdc2_s32z270_rtu0.overlay b/tests/drivers/pwm/pwm_loopback/boards/s32z2xxdc2_s32z270_rtu0.overlay new file mode 100644 index 000000000000000..2b7fa95384e85c9 --- /dev/null +++ b/tests/drivers/pwm/pwm_loopback/boards/s32z2xxdc2_s32z270_rtu0.overlay @@ -0,0 +1,51 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/ { + pwm_loopback_0 { + compatible = "test-pwm-loopback"; + pwms = <&emios0_pwm 24 0 PWM_POLARITY_NORMAL>, + <&emios0_pwm 25 0 PWM_POLARITY_NORMAL>; + }; +}; + +&pinctrl { + emios0_default: emios0_default { + group0 { + pinmux = ; + output-enable; + }; + group1 { + pinmux = ; + input-enable; + }; + }; +}; + +&emios0 { + clock-divider = <200>; + status = "okay"; + + emios0_pwm: pwm { + pinctrl-0 = <&emios0_default>; + pinctrl-names = "default"; + status = "okay"; + + pwm_24 { + channel = <24>; + prescaler = <16>; + pwm-mode = "OPWFMB"; + }; + + pwm_25 { + channel = <25>; + pwm-mode = "SAIC"; + prescaler = <16>; + }; + }; +}; diff --git a/tests/drivers/pwm/pwm_loopback/boards/s32z2xxdc2_s32z270_rtu1.overlay b/tests/drivers/pwm/pwm_loopback/boards/s32z2xxdc2_s32z270_rtu1.overlay new file mode 100644 index 000000000000000..2b7fa95384e85c9 --- /dev/null +++ b/tests/drivers/pwm/pwm_loopback/boards/s32z2xxdc2_s32z270_rtu1.overlay @@ -0,0 +1,51 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/ { + pwm_loopback_0 { + compatible = "test-pwm-loopback"; + pwms = <&emios0_pwm 24 0 PWM_POLARITY_NORMAL>, + <&emios0_pwm 25 0 PWM_POLARITY_NORMAL>; + }; +}; + +&pinctrl { + emios0_default: emios0_default { + group0 { + pinmux = ; + output-enable; + }; + group1 { + pinmux = ; + input-enable; + }; + }; +}; + +&emios0 { + clock-divider = <200>; + status = "okay"; + + emios0_pwm: pwm { + pinctrl-0 = <&emios0_default>; + pinctrl-names = "default"; + status = "okay"; + + pwm_24 { + channel = <24>; + prescaler = <16>; + pwm-mode = "OPWFMB"; + }; + + pwm_25 { + channel = <25>; + pwm-mode = "SAIC"; + prescaler = <16>; + }; + }; +};