zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.52k stars 6.45k forks source link

dts: sam0: question: Is it possible to clean up samd.dtsi devicetree warning? #23672

Closed sslupsky closed 4 years ago

sslupsky commented 4 years ago

When building a project using the samd dts, an warning is generated because of a duplicate unit address in dts/arm/atmel/samd.dtsi. The samd PORT peripheral controls both the GPIO and PINMUX functions of the soc. The samd.dtsi uses the address of the PORT peripheral for both nodes which results in the duplicate address warning. Thus, the warning can be safely ignored.

I am wondering if the warning can be cleaned up somehow?

Here is the warning:

arduino_mkr_1310.dts.pre.tmp:87.29-91.5: Warning (unique_unit_address_if_enabled): /soc/pinmux@41004400: duplicate unit-address (also used in node /soc/gpio@41004400)
arduino_mkr_1310.dts.pre.tmp:92.29-96.5: Warning (unique_unit_address_if_enabled): /soc/pinmux@41004480: duplicate unit-address (also used in node /soc/gpio@41004480)
carlescufi commented 4 years ago

@galak could you take a stab at answering the question please?

stephanosio commented 4 years ago

Atmel SAM0 GPIO, in general, requires a major overhaul, and this problem should probably be fixed as part of that (at this time, pinmux-ing is not properly done in the DT, but in a hack file pinmux.c, and this is undesirable).

nzmichaelh commented 4 years ago

@stephanosio out of interest, what does a proper DT based pinmux setup look like?

sslupsky commented 4 years ago

I attempted to suppress the warning by adding the following line to pre_dt_board.cmake:

list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address")

but this generates a compiler error:

gen_defines.py: error: unrecognized arguments: -Wno-unique_unit_address'

Similarly,

list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled")

generates error:

gen_defines.py: error: unrecognized arguments: -Wno-unique_unit_address_if_enabled'
stephanosio commented 4 years ago

@stephanosio out of interest, what does a proper DT based pinmux setup look like?

@nzmichaelh Something like: https://github.com/zephyrproject-rtos/zephyr/blob/98bcc51b0925a92db28f127d08b842b1d609bce8/dts/arm/atmel/same70.dtsi#L241-L301

https://github.com/zephyrproject-rtos/zephyr/blob/98bcc51b0925a92db28f127d08b842b1d609bce8/dts/arm/atmel/same70.dtsi#L216

nzmichaelh commented 4 years ago

@stephanosio thanks. I'm not sure if I'll finish it, but I started a branch at https://github.com/zephyrproject-rtos/zephyr/compare/master...nzmichaelh:pinctrl