From 8507a95fcc96546e8f45aae5f3df04f6a4cf0ed6 Mon Sep 17 00:00:00 2001 From: Tu Nguyen Van Date: Mon, 9 Sep 2024 14:26:25 +0700 Subject: [PATCH 1/3] soc: dts: pinctrl: support the configurations which apply for LVDS pads support the configurations which apply for LVDS pads + termination resistor + current reference control + rx current boost Signed-off-by: Tu Nguyen Van --- dts/bindings/pinctrl/nxp,s32ze-pinctrl.yaml | 37 +++++++++++++++++---- soc/nxp/s32/s32ze/pinctrl_soc.h | 5 ++- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/dts/bindings/pinctrl/nxp,s32ze-pinctrl.yaml b/dts/bindings/pinctrl/nxp,s32ze-pinctrl.yaml index 251cb46a89f72..0826fce73acd8 100644 --- a/dts/bindings/pinctrl/nxp,s32ze-pinctrl.yaml +++ b/dts/bindings/pinctrl/nxp,s32ze-pinctrl.yaml @@ -1,4 +1,4 @@ -# Copyright 2022 NXP +# Copyright 2022, 2024 NXP # SPDX-License-Identifier: Apache-2.0 description: | @@ -57,13 +57,13 @@ description: | - internal pull not enabled - open drain disabled - slew rate 4 (see description in property below). + - termination resistor disabled (affect LVDS pads only). + - current reference control disabled (affect LVDS pads only). + - Rx current boost disabled (affect LVDS pads only). - Additionally, Safe Mode is always disabled (reset value) and configuration that - only applies to LVDS pads, which are not supported, default to reset values: - - termination resistor disabled - - receiver single ended - - current reference control disabled - - Rx current boost disabled. + Additionally: + - Safe Mode is always kept as reset value (disabled). + - Receiver Select is always kept as reset value (enables the differential vref based receiver). compatible: "nxp,s32ze-pinctrl" @@ -116,3 +116,26 @@ child-binding: 5: FMAX_33 = 50 MHz 6: FMAX_33 = 50 MHz 7: FMAX_33 = 1 MHz + + nxp,current-reference-control: + type: boolean + description: | + This configuration applies the current reference control to + the associated pin. It is only applicable to LVDS pads and + has no effect on other types of pads + + nxp,termination-resistor: + type: boolean + description: | + This configuration applies the termination resistor to + the associated pin. It is only applicable to LVDS pads and + has no effect on other types of pads + + nxp,rx-current-boost: + type: boolean + description: | + RX LVDS Current Boost + Boosts RX IO current. It is only applicable to LVDS pads and + has no effect on other types of pads + 0: Current reference is 200 μA; supports data rate up to 320 Mbaud + 1: Current reference is 1 mA; supports data rate up to 420 Mbaud diff --git a/soc/nxp/s32/s32ze/pinctrl_soc.h b/soc/nxp/s32/s32ze/pinctrl_soc.h index d167bcd7e2c19..a7a4807efec62 100644 --- a/soc/nxp/s32/s32ze/pinctrl_soc.h +++ b/soc/nxp/s32/s32ze/pinctrl_soc.h @@ -53,7 +53,10 @@ SIUL2_MSCR_PUS(DT_PROP(group, bias_pull_up)) | \ SIUL2_MSCR_SRE(DT_PROP(group, slew_rate)) | \ SIUL2_MSCR_ODE(DT_PROP(group, drive_open_drain) && \ - DT_PROP(group, output_enable)) \ + DT_PROP(group, output_enable)) | \ + SIUL2_MSCR_TRC(DT_PROP(group, nxp_termination_resistor)) | \ + SIUL2_MSCR_CREF(DT_PROP(group, nxp_current_reference_control)) | \ + SIUL2_MSCR_RXCB(DT_PROP(group, nxp_rx_current_boost)) \ }, \ .imcr = { \ .inst = NXP_S32_PINMUX_GET_IMCR_SIUL2_IDX(value), \ From 5d7dfc3fbf700fec34bc2e6d4ad6ef9e1fe20074 Mon Sep 17 00:00:00 2001 From: Tu Nguyen Van Date: Thu, 29 Aug 2024 19:00:23 +0700 Subject: [PATCH 2/3] dts: arm: nxp: add dspi support for S32Z27x add dspi support for S32Z27x devices Signed-off-by: Tu Nguyen Van --- boards/nxp/s32z2xxdc2/doc/index.rst | 2 ++ dts/arm/nxp/nxp_s32z27x_r52.dtsi | 10 ++++++++++ west.yml | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/boards/nxp/s32z2xxdc2/doc/index.rst b/boards/nxp/s32z2xxdc2/doc/index.rst index 9129a9ffba0ff..9200246fc5612 100644 --- a/boards/nxp/s32z2xxdc2/doc/index.rst +++ b/boards/nxp/s32z2xxdc2/doc/index.rst @@ -61,6 +61,8 @@ The boards support the following hardware features: +-----------+------------+-------------------------------------+ | EDMA | on-chip | dma | +-----------+------------+-------------------------------------+ +| DSPI | on-chip | spi | ++-----------+------------+-------------------------------------+ Other hardware features are not currently supported by the port. diff --git a/dts/arm/nxp/nxp_s32z27x_r52.dtsi b/dts/arm/nxp/nxp_s32z27x_r52.dtsi index 1927e855db992..a04d5a01022d1 100644 --- a/dts/arm/nxp/nxp_s32z27x_r52.dtsi +++ b/dts/arm/nxp/nxp_s32z27x_r52.dtsi @@ -560,6 +560,16 @@ status = "disabled"; }; + dspi0: spi@40340000 { + compatible = "nxp,kinetis-dspi"; + reg = <0x40340000 0x10000>; + interrupts = ; + clocks = <&clock NXP_S32_MSCDSPI_CLK>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + mru0: mbox@76070000 { compatible = "nxp,s32-mru"; reg = <0x76070000 0x10000>; diff --git a/west.yml b/west.yml index a20edb3c48779..5a9279af57fa5 100644 --- a/west.yml +++ b/west.yml @@ -198,7 +198,7 @@ manifest: groups: - hal - name: hal_nxp - revision: 4597b16cfedf5553cb155151e65eb994d5d0ef25 + revision: 683c007c3b834012358b4adf96a532d18ce05646 path: modules/hal/nxp groups: - hal From 5e43c9d055c7209d770672e2990e1bf00772e7d3 Mon Sep 17 00:00:00 2001 From: Tu Nguyen Van Date: Thu, 29 Aug 2024 19:02:07 +0700 Subject: [PATCH 3/3] tests: drivers: spi: enable test spi_loopback enable test spi_loopback for dspi feature on s32z27x devices Signed-off-by: Tu Nguyen Van --- .../boards/s32z2xxdc2_s32z270_dspi.overlay | 40 +++++++++++++++++++ tests/drivers/spi/spi_loopback/testcase.yaml | 6 +++ 2 files changed, 46 insertions(+) create mode 100644 tests/drivers/spi/spi_loopback/boards/s32z2xxdc2_s32z270_dspi.overlay diff --git a/tests/drivers/spi/spi_loopback/boards/s32z2xxdc2_s32z270_dspi.overlay b/tests/drivers/spi/spi_loopback/boards/s32z2xxdc2_s32z270_dspi.overlay new file mode 100644 index 0000000000000..c6111cbd703fd --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/s32z2xxdc2_s32z270_dspi.overlay @@ -0,0 +1,40 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + dspi0_default: dspi0_default { + group1 { + pinmux = , ; + output-enable; + nxp,current-reference-control; + nxp,termination-resistor; + }; + group2 { + pinmux = ; + input-enable; + nxp,current-reference-control; + nxp,termination-resistor; + }; + }; +}; + +&dspi0 { + pinctrl-0 = <&dspi0_default>; + pinctrl-names = "default"; + status = "okay"; + + slow@0 { + compatible = "test-spi-loopback-slow"; + reg = <0>; + spi-max-frequency = <500000>; + }; + + fast@0 { + compatible = "test-spi-loopback-fast"; + reg = <0>; + spi-max-frequency = <16000000>; + }; +}; diff --git a/tests/drivers/spi/spi_loopback/testcase.yaml b/tests/drivers/spi/spi_loopback/testcase.yaml index 47d2ec28178ea..3087e65c640d2 100644 --- a/tests/drivers/spi/spi_loopback/testcase.yaml +++ b/tests/drivers/spi/spi_loopback/testcase.yaml @@ -204,3 +204,9 @@ tests: drivers.spi.max32_dma.loopback: extra_args: EXTRA_CONF_FILE="overlay-max32-spi-dma.conf" filter: CONFIG_SOC_FAMILY_MAX32 + drivers.spi.s32z_dspi.loopback: + extra_args: + - DTC_OVERLAY_FILE=boards/s32z2xxdc2_s32z270_dspi.overlay + platform_allow: + - s32z2xxdc2/s32z270/rtu0 + - s32z2xxdc2/s32z270/rtu1