Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: eth_nxp_s32_netc: si: use instance-based DT macros #65389

Merged
merged 1 commit into from
Dec 11, 2023
Merged

drivers: eth_nxp_s32_netc: si: use instance-based DT macros #65389

merged 1 commit into from
Dec 11, 2023

Conversation

congnguyenhuu
Copy link
Contributor

@congnguyenhuu congnguyenhuu commented Nov 17, 2023

At present, many of the NXP S32 shim drivers do not make use of devicetree instance-based macros because the NXP S32 HAL relies on an index-based approach, requiring knowledge of the peripheral instance index during both compilation and runtime, and this index might not align with the devicetree instance index.

The proposed solution in this patch eliminates this limitation by determining the peripheral instance index during compilation through macrobatics.

west build -p -b s32z270dc2_rtu0_r52 samples\boards\nxp_s32\netc

[00:00:00.051,000] <inf> phy_mii: PHY (7) ID 1CC916

[00:00:00.052,000] <inf> nxp_s32_eth_psi: SI0 MAC: 00:00:00:01:02:00
*** Booting Zephyr OS build zephyr-v3.5.0-2534-g8ccae9fff76a ***
[00:00:00.052,000] <inf> shell_telnet: Telnet shell backend initialized
[00:00:00.052,000] <inf> nxp_s32_netc_sample: Starting sample
[00:00:00.052,000] <inf> nxp_s32_netc_sample: Waiting for iface 1 to come up
[00:00:07.595,000] <inf> phy_mii: PHY (7) Link speed 1000 Mb, full duplex

[00:00:07.595,000] <inf> nxp_s32_netc_sample: Configuring iface 1 (0x3180b718)
[00:00:07.595,000] <inf> nxp_s32_netc_sample: IPv6 address: 2001:db8::1
[00:00:07.595,000] <inf> nxp_s32_netc_sample: IPv4 address: 192.0.2.1
uart:~$ net ping 2001:db8::3
PING 2001:db8::3
8 bytes from 2001:db8::3 to 2001:db8::1: icmp_seq=1 ttl=64 time=0.31 ms
8 bytes from 2001:db8::3 to 2001:db8::1: icmp_seq=2 ttl=64 time=0.30 ms
8 bytes from 2001:db8::3 to 2001:db8::1: icmp_seq=3 ttl=64 time=0.30 ms
uart:~$ net ping 192.0.2.3
PING 192.0.2.3
28 bytes from 192.0.2.3 to 192.0.2.1: icmp_seq=1 ttl=64 time=0.32 ms
28 bytes from 192.0.2.3 to 192.0.2.1: icmp_seq=2 ttl=64 time=0.32 ms
28 bytes from 192.0.2.3 to 192.0.2.1: icmp_seq=3 ttl=64 time=0.33 ms
uart:~$
west build -p -b s32z270dc2_rtu0_r52 samples\boards\nxp_s32\netc -T sample.boards.nxp_s32.netc.vsi_and_psi

[00:00:00.052,000] <inf> phy_mii: PHY (7) ID 1CC916

[00:00:00.053,000] <inf> nxp_s32_eth_psi: SI0 MAC: 00:00:00:01:02:00
[00:00:00.053,000] <inf> nxp_s32_eth_vsi: SI1 MAC: 00:00:00:01:02:11
*** Booting Zephyr OS build zephyr-v3.5.0-2534-g8ccae9fff76a ***
[00:00:00.053,000] <inf> shell_telnet: Telnet shell backend initialized
[00:00:00.053,000] <inf> nxp_s32_netc_sample: Starting sample
[00:00:00.053,000] <inf> nxp_s32_netc_sample: Waiting for iface 1 to come up
[00:00:07.596,000] <inf> phy_mii: PHY (7) Link speed 1000 Mb, full duplex

[00:00:07.596,000] <inf> nxp_s32_netc_sample: Configuring iface 1 (0x3183a9d4)
[00:00:07.596,000] <inf> nxp_s32_netc_sample: IPv6 address: 2001:db8::1
[00:00:07.596,000] <inf> nxp_s32_netc_sample: IPv4 address: 192.0.2.1
[00:00:07.596,000] <inf> nxp_s32_netc_sample: Configuring iface 2 (0x3183aa14)
[00:00:07.596,000] <inf> nxp_s32_netc_sample: IPv6 address: 2001:db8::2
[00:00:07.596,000] <inf> nxp_s32_netc_sample: IPv4 address: 192.0.2.2
uart:~$ net ping 192.0.2.3
PING 192.0.2.3
28 bytes from 192.0.2.3 to 192.0.2.1: icmp_seq=1 ttl=64 time=0.32 ms
28 bytes from 192.0.2.3 to 192.0.2.1: icmp_seq=2 ttl=64 time=0.32 ms
28 bytes from 192.0.2.3 to 192.0.2.1: icmp_seq=3 ttl=64 time=0.32 ms
uart:~$ net ping 2001:db8::3
PING 2001:db8::3
8 bytes from 2001:db8::3 to 2001:db8::2: icmp_seq=1 ttl=64 time=0.31 ms
8 bytes from 2001:db8::3 to 2001:db8::2: icmp_seq=2 ttl=64 time=0.30 ms
8 bytes from 2001:db8::3 to 2001:db8::2: icmp_seq=3 ttl=64 time=0.30 ms
uart:~$

@zephyrbot
Copy link
Collaborator

zephyrbot commented Nov 17, 2023

The following west manifest projects have been modified in this Pull Request:

Name Old Revision New Revision Diff
hal_nxp zephyrproject-rtos/hal_nxp@1b2f360 zephyrproject-rtos/hal_nxp@cbf2cd1 (master) zephyrproject-rtos/[email protected]

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@zephyrbot zephyrbot added manifest manifest-hal_nxp DNM This PR should not be merged (Do Not Merge) labels Nov 17, 2023
@manuargue
Copy link
Member

please include some test evidence running with PSI/VSI configurations https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/boards/nxp_s32/netc

west.yml Outdated Show resolved Hide resolved
@dleach02 dleach02 assigned manuargue and unassigned dleach02 Nov 30, 2023
drivers/ethernet/eth_nxp_s32_netc_psi.c Outdated Show resolved Hide resolved
drivers/ethernet/eth_nxp_s32_netc_psi.c Show resolved Hide resolved
west.yml Outdated Show resolved Hide resolved
@zephyrbot zephyrbot removed the DNM This PR should not be merged (Do Not Merge) label Dec 8, 2023
At present, many of the NXP S32 shim drivers do not make use of
devicetree instance-based macros because the NXP S32 HAL relies on an
index-based approach, requiring knowledge of the peripheral instance
index during both compilation and runtime, and this index might not
align with the devicetree instance index.

The proposed solution in this patch eliminates this limitation by
determining the peripheral instance index during compilation
through macrobatics and defining the handler of SI Rx event within
the shim driver itself.

Signed-off-by: Cong Nguyen Huu <[email protected]>
@carlescufi carlescufi merged commit 3533178 into zephyrproject-rtos:main Dec 11, 2023
21 checks passed
@manuargue manuargue deleted the nxp-s32-dt-inst-netc branch December 11, 2023 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants