From 101aa44db31da69fc7eda68b86666b41229ff313 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 9cb0972bf8fc7ea..f353b68194f51fe 100644 --- a/boards/nxp/s32z2xxdc2/doc/index.rst +++ b/boards/nxp/s32z2xxdc2/doc/index.rst @@ -60,6 +60,8 @@ The boards support the following hardware features: +-----------+------------+-------------------------------------+ | DSPI | on-chip | spi | +-----------+------------+-------------------------------------+ +| 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 070c33e6bfd323c..60b258ad5a16628 100644 --- a/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu0.yaml +++ b/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu0.yaml @@ -19,4 +19,5 @@ supported: - adc - i2c - dma + - pwm vendor: nxp diff --git a/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu0_D.yaml b/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu0_D.yaml index 9d692144a76c21f..c35cc47699bd0e9 100644 --- a/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu0_D.yaml +++ b/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu0_D.yaml @@ -19,4 +19,5 @@ supported: - adc - i2c - dma + - pwm vendor: nxp diff --git a/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1.yaml b/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1.yaml index 3de95effa800355..3d4f2062cc98423 100644 --- a/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1.yaml +++ b/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1.yaml @@ -19,4 +19,5 @@ supported: - adc - i2c - dma + - pwm vendor: nxp diff --git a/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1_D.yaml b/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1_D.yaml index ef45138807edaee..334d75319ca0561 100644 --- a/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1_D.yaml +++ b/boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1_D.yaml @@ -19,4 +19,5 @@ supported: - adc - i2c - dma + - 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>; + }; + }; +};