
For debug purpose, it's useful to know the pins muxing to check if a pin is configured as a GPIO or as an alternate function and to get information about this alternate function configuration. For this purpose a new command pinmux is implemented.
This series adds: - Add get_pin_muxing ops to UCLASS pinctrl - Add pinmux command - Add get_function() support to stm32 gpio driver - Add get_pins_count() support to stm32 pinctrl driver - Add get_pin_name() support to stm32 pinctrl driver - Add get_pin_muxing() support to stm32 pinctrl driver - Add pinmux command test
Changes in v4: - Update get_pin_muxing() prototype by adding buffer and buffer's size parameters. - Replace respectively uclass_first_device() and uclass_next_device() by uclass_first_device_err() and uclass_next_device_err() - Update test return value of pinctrl_get_pin_muxing() due to ops get_pin_muxing() prototype update - Move defines PINNAME_SIZE and PINMUX_SIZE into include/dm/pinctrl.h in order to be used by pinctrl driver - Hardened test on argc value to avoid core dump during sandbox testing - Fix check of uclass_get_device_by_name() return value, in any error case, continue with the next child. - Use define PINNAME_SIZE from include/dm/pinctrl.h instead of driver's local one - Update get_pin_muxing() prototype by adding buffer and buffer's size as parameters - Update sandbox_get_pin_muxing() due to get_pin_muxing() prototype changes
Changes in v3: - Replace const char **buf parameter by char *buf, int size parameters for pinctrl_get_pin_muxing() - Replace const char **buf parameter by char *buf, int size parameters for pinctrl_get_pin_name() - Update calls to pinctrl_get_pin_name() and pinctrl_get_pin_muxing due to prototype update. - Fix typo
Changes in v2: - Replace pinmux_show ops which displayed the complete pin-controller muxing by get_pin_muxing ops which displays the muxing of one pin - In order to make pin muxing display less SoC specific, use pinctrl_pins_count(), pinctrl_get_pin_name() and pinctrl_get_pin_muxing() methods instead of previous pinctrl_pinmux_show() method.
Patrice Chotard (11): dm: pinctrl: Add get_pin_muxing() ops dm: pinctrl: Add pinctrl_get_pin_name and pinctrl_get_pins_count dm: uclass: Add uclass_next_device_err() to return a valid device dm: uclass: Add uclass_foreach_dev_probe cmd: pinmux: Add pinmux command pinctrl: stm32: Add get_pins_count() ops pinctrl: stm32: Add get_pin_name() ops pinctrl: stm32: Add get_pin_muxing() ops gpio: stm32f7: Add ops get_function pinctrl: sandbox: Add get_pin_muxing ops support test/py: test pinmux command
arch/sandbox/dts/test.dts | 4 + cmd/Kconfig | 8 ++ cmd/Makefile | 1 + cmd/pinmux.c | 146 +++++++++++++++++++++++++++ drivers/core/uclass.c | 13 +++ drivers/gpio/stm32f7_gpio.c | 20 ++++ drivers/pinctrl/pinctrl-sandbox.c | 18 ++++ drivers/pinctrl/pinctrl-uclass.c | 34 +++++++ drivers/pinctrl/pinctrl_stm32.c | 207 +++++++++++++++++++++++++++++++++++++- include/dm/pinctrl.h | 59 +++++++++++ include/dm/uclass.h | 28 ++++++ test/py/tests/test_pinmux.py | 62 ++++++++++++ 12 files changed, 595 insertions(+), 5 deletions(-) create mode 100644 cmd/pinmux.c create mode 100644 test/py/tests/test_pinmux.py