Skip to content

Commit

Permalink
boards: s32z2xxdc2: add support PWM eMIOS
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Dat-NguyenDuy committed Oct 7, 2024
1 parent 227cc32 commit 72d347f
Show file tree
Hide file tree
Showing 9 changed files with 186 additions and 0 deletions.
2 changes: 2 additions & 0 deletions boards/nxp/s32z2xxdc2/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
1 change: 1 addition & 0 deletions boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ supported:
- counter
- adc
- i2c
- pwm
vendor: nxp
1 change: 1 addition & 0 deletions boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu0_D.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ supported:
- counter
- adc
- i2c
- pwm
vendor: nxp
1 change: 1 addition & 0 deletions boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ supported:
- counter
- adc
- i2c
- pwm
vendor: nxp
1 change: 1 addition & 0 deletions boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1_D.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ supported:
- counter
- adc
- i2c
- pwm
vendor: nxp
39 changes: 39 additions & 0 deletions tests/drivers/pwm/pwm_api/boards/s32z2xxdc2_s32z270_rtu0.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <nxp/s32/S32Z27-BGA594-pinctrl.h>

/ {
aliases {
pwm-0 = &emios0_pwm;
};
};

&pinctrl {
emios0_default: emios0_default {
group0 {
pinmux = <PK0_EMIOS_0_CH24_O>;
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";
};
};
};
39 changes: 39 additions & 0 deletions tests/drivers/pwm/pwm_api/boards/s32z2xxdc2_s32z270_rtu1.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <nxp/s32/S32Z27-BGA594-pinctrl.h>

/ {
aliases {
pwm-0 = &emios0_pwm;
};
};

&pinctrl {
emios0_default: emios0_default {
group0 {
pinmux = <PK0_EMIOS_0_CH24_O>;
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";
};
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/dt-bindings/pwm/pwm.h>

/ {
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 = <PK0_EMIOS_0_CH24_O>;
output-enable;
};
group1 {
pinmux = <PJ15_EMIOS_0_CH25_I>;
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>;
};
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/dt-bindings/pwm/pwm.h>

/ {
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 = <PK0_EMIOS_0_CH24_O>;
output-enable;
};
group1 {
pinmux = <PJ15_EMIOS_0_CH25_I>;
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>;
};
};
};

0 comments on commit 72d347f

Please sign in to comment.