boards: arm: stm32: use DT for ADC pinmux

Use the new DT facilities to configure ADC pinmux on all boards with
STM32 MCUs currently supporting the ADC.

Signed-off-by: Martin Jäger <martin@libre.solar>
This commit is contained in:
Martin Jäger 2020-10-12 08:10:50 +02:00 committed by Kumar Gala
parent 72947484f1
commit cd908d9085
46 changed files with 29 additions and 78 deletions

View file

@ -120,6 +120,8 @@
};
&adc1 {
pinctrl-0 = <&adc1_in10_pc0 &adc1_in11_pc1
&adc1_in12_pc2 &adc1_in13_pc3>;
status = "okay";
};

View file

@ -54,12 +54,6 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PB10, STM32F4_PINMUX_FUNC_PB10_I2C2_SCL},
{STM32_PIN_PB11, STM32F4_PINMUX_FUNC_PB11_I2C2_SDA},
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{STM32_PIN_PC0, STM32F4_PINMUX_FUNC_PC0_ADC123_IN10},
{STM32_PIN_PC1, STM32F4_PINMUX_FUNC_PC1_ADC123_IN11},
{STM32_PIN_PC2, STM32F4_PINMUX_FUNC_PC2_ADC123_IN12},
{STM32_PIN_PC3, STM32F4_PINMUX_FUNC_PC3_ADC123_IN13},
#endif
#ifdef CONFIG_USB_DC_STM32
{STM32_PIN_PA11, STM32F4_PINMUX_FUNC_PA11_OTG_FS_DM},
{STM32_PIN_PA12, STM32F4_PINMUX_FUNC_PA12_OTG_FS_DP},

View file

@ -111,5 +111,6 @@
};
&adc1 {
pinctrl-0 = <&adc1_in1_pa1>;
status = "okay";
};

View file

@ -31,9 +31,6 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA11, STM32F4_PINMUX_FUNC_PA11_OTG_FS_DM},
{STM32_PIN_PA12, STM32F4_PINMUX_FUNC_PA12_OTG_FS_DP},
#endif /* CONFIG_USB_DC_STM32 */
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{STM32_PIN_PA1, STM32F4_PINMUX_FUNC_PA1_ADC123_IN1},
#endif
};
static int pinmux_stm32_init(const struct device *port)

View file

@ -216,5 +216,8 @@
};
&adc1 {
pinctrl-0 = <&adc1_in5_pa0 &adc1_in3_pc2
&adc1_in4_pc3 &adc1_in13_pc4
&adc1_in14_pc5>;
status = "okay";
};

View file

@ -44,13 +44,6 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA11, STM32L4X_PINMUX_FUNC_PA11_OTG_FS_DM},
{STM32_PIN_PA12, STM32L4X_PINMUX_FUNC_PA12_OTG_FS_DP},
#endif /* CONFIG_USB_DC_STM32 */
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{STM32_PIN_PA0, STM32L4X_PINMUX_FUNC_PA0_ADC12_IN5},
{STM32_PIN_PC2, STM32L4X_PINMUX_FUNC_PC2_ADC123_IN3},
{STM32_PIN_PC3, STM32L4X_PINMUX_FUNC_PC3_ADC123_IN4},
{STM32_PIN_PC4, STM32L4X_PINMUX_FUNC_PC4_ADC12_IN13},
{STM32_PIN_PC5, STM32L4X_PINMUX_FUNC_PC5_ADC12_IN14},
#endif
};
static int pinmux_stm32_init(const struct device *port)

View file

@ -98,6 +98,7 @@
};
&adc1 {
pinctrl-0 = <&adc_in0_pa0>;
status = "okay";
};

View file

@ -32,9 +32,6 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PB14, STM32F0_PINMUX_FUNC_PB14_SPI2_MISO},
{STM32_PIN_PB15, STM32F0_PINMUX_FUNC_PB15_SPI2_MOSI},
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{STM32_PIN_PA0, STM32F0_PINMUX_FUNC_PA0_ADC_IN0},
#endif
};
static int pinmux_stm32_init(const struct device *port)

View file

@ -80,5 +80,6 @@
};
&adc1 {
pinctrl-0 = <&adc1_in0_pa0>;
status = "okay";
};

View file

@ -30,9 +30,6 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PB14, STM32F1_PINMUX_FUNC_PB14_SPI2_MASTER_MISO},
{STM32_PIN_PB15, STM32F1_PINMUX_FUNC_PB15_SPI2_MASTER_MOSI},
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{STM32_PIN_PA0, STM32F1_PINMUX_FUNC_PA0_ADC123_IN0},
#endif
};
static int pinmux_stm32_init(const struct device *port)

View file

@ -77,6 +77,7 @@
};
&adc1 {
pinctrl-0 = <&adc1_in0_pa0>;
status = "okay";
};

View file

@ -31,9 +31,6 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA11, STM32F2_PINMUX_FUNC_PA11_OTG_FS_DM},
{STM32_PIN_PA12, STM32F2_PINMUX_FUNC_PA12_OTG_FS_DP},
#endif /* CONFIG_USB_DC_STM32 */
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{STM32_PIN_PA0, STM32F2_PINMUX_FUNC_PA0_ADC123_IN0},
#endif
};
static int pinmux_stm32_init(const struct device *port)

View file

@ -81,5 +81,6 @@
};
&adc1 {
pinctrl-0 = <&adc1_in1_pa0>;
status = "okay";
};

View file

@ -26,9 +26,6 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PB14, STM32F3_PINMUX_FUNC_PB14_SPI2_MISO},
{STM32_PIN_PB15, STM32F3_PINMUX_FUNC_PB15_SPI2_MOSI},
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{STM32_PIN_PA0, STM32F3_PINMUX_FUNC_PA0_ADC1_IN1},
#endif
};
static int pinmux_stm32_init(const struct device *port)

View file

@ -127,6 +127,7 @@
};
&adc1 {
pinctrl-0 = <&adc1_in0_pa0>;
status = "okay";
};

View file

@ -34,9 +34,6 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PB14, STM32F4_PINMUX_FUNC_PB14_SPI2_MISO},
{STM32_PIN_PB15, STM32F4_PINMUX_FUNC_PB15_SPI2_MOSI},
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{STM32_PIN_PA0, STM32F4_PINMUX_FUNC_PA0_ADC123_IN0},
#endif
};
static int pinmux_stm32_init(const struct device *port)

View file

@ -55,6 +55,7 @@
};
&adc1 {
pinctrl-0 = <&adc1_in0_pa0>;
status = "okay";
};

View file

@ -43,9 +43,6 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA11, STM32F4_PINMUX_FUNC_PA11_OTG_FS_DM},
{STM32_PIN_PA12, STM32F4_PINMUX_FUNC_PA12_OTG_FS_DP},
#endif /* CONFIG_USB_DC_STM32 */
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{STM32_PIN_PA0, STM32F4_PINMUX_FUNC_PA0_ADC123_IN0},
#endif
};
static int pinmux_stm32_init(const struct device *port)

View file

@ -117,6 +117,7 @@
};
&adc1 {
pinctrl-0 = <&adc1_in0_pa0>;
status = "okay";
};

View file

@ -47,9 +47,6 @@ static const struct pin_config pinconf[] = {
{ STM32_PIN_PA6, STM32F7_PINMUX_FUNC_PA6_SPI1_MISO },
{ STM32_PIN_PA7, STM32F7_PINMUX_FUNC_PA7_SPI1_MOSI },
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{ STM32_PIN_PA0, STM32F7_PINMUX_FUNC_PA0_ADC123_IN0 },
#endif
};
static int pinmux_stm32_init(const struct device *port)

View file

@ -120,6 +120,7 @@
};
&adc1 {
pinctrl-0 = <&adc1_in0_pa0>;
status = "okay";
};

View file

@ -47,9 +47,6 @@ static const struct pin_config pinconf[] = {
{ STM32_PIN_PA6, STM32F7_PINMUX_FUNC_PA6_SPI1_MISO },
{ STM32_PIN_PA7, STM32F7_PINMUX_FUNC_PA7_SPI1_MOSI },
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{ STM32_PIN_PA0, STM32F7_PINMUX_FUNC_PA0_ADC123_IN0 },
#endif
};
static int pinmux_stm32_init(const struct device *port)

View file

@ -162,7 +162,7 @@ Default Zephyr Peripheral Mapping:
- LD2 : PA5
- USB DM : PA11
- USB DP : PA12
- ADC1 : PA0
- ADC1_IN1 : PA0
System Clock
------------

View file

@ -115,5 +115,6 @@
};
&adc1 {
pinctrl-0 = <&adc1_in1_pa0>;
status = "okay";
};

View file

@ -50,9 +50,6 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA11, STM32G4X_PINMUX_FUNC_PA11_USB_DM},
{STM32_PIN_PA12, STM32G4X_PINMUX_FUNC_PA12_USB_DP},
#endif /* CONFIG_USB_DC_STM32 */
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{STM32_PIN_PA0, STM32G4X_PINMUX_FUNC_PA0_ADC12_IN1},
#endif
};
static int pinmux_stm32_init(const struct device *port)

View file

@ -135,7 +135,7 @@ and a ST morpho connector. Board is configured as follows:
- LD2 : PB7
- LD3 : PB14
- I2C : PB8, PB9
- ADC12_INP15 : PA3
- ADC1_INP15 : PA3
System Clock
------------

View file

@ -81,7 +81,8 @@
};
};
&adc1_2 {
&adc1 {
pinctrl-0 = <&adc1_inp15_pa3>;
status = "okay";
};

View file

@ -18,9 +18,6 @@ static const struct pin_config pinconf[] = {
{ STM32_PIN_PB8, STM32H7_PINMUX_FUNC_PB8_I2C1_SCL },
{ STM32_PIN_PB9, STM32H7_PINMUX_FUNC_PB9_I2C1_SDA },
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1_2), okay) && CONFIG_ADC
{ STM32_PIN_PA3, STM32H7_PINMUX_FUNC_PA3_ADC12_INP15 },
#endif
};
static int pinmux_stm32_init(const struct device *port)

View file

@ -67,6 +67,7 @@
};
&adc1 {
pinctrl-0 = <&adc_in0_pa0>;
status = "okay";
};

View file

@ -23,9 +23,6 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA6, STM32L0_PINMUX_FUNC_PA6_SPI1_MISO},
{STM32_PIN_PA7, STM32L0_PINMUX_FUNC_PA7_SPI1_MOSI},
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{STM32_PIN_PA0, STM32L0_PINMUX_FUNC_PA0_ADC_IN0},
#endif
};
static int pinmux_stm32_init(const struct device *port)

View file

@ -66,6 +66,7 @@
};
&adc1 {
pinctrl-0 = <&adc_in0_pa0>;
status = "okay";
};

View file

@ -17,9 +17,6 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PB8, STM32L1X_PINMUX_FUNC_PB8_I2C1_SCL},
{STM32_PIN_PB9, STM32L1X_PINMUX_FUNC_PB9_I2C1_SDA},
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{STM32_PIN_PA0, STM32L1X_PINMUX_FUNC_PA0_ADC1_IN0},
#endif
};
static int pinmux_stm32_init(const struct device *port)

View file

@ -87,5 +87,6 @@
};
&adc1 {
pinctrl-0 = <&adc1_in1_pc0>;
status = "okay";
};

View file

@ -51,9 +51,6 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PC11, STM32L4X_PINMUX_FUNC_PC11_SPI3_MISO},
{STM32_PIN_PC12, STM32L4X_PINMUX_FUNC_PC12_SPI3_MOSI},
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{STM32_PIN_PC0, STM32L4X_PINMUX_FUNC_PC0_ADC123_IN1},
#endif
};
static int pinmux_stm32_init(const struct device *port)

View file

@ -122,5 +122,6 @@
};
&adc1 {
pinctrl-0 = <&adc1_in1_pc0>;
status = "okay";
};

View file

@ -50,9 +50,6 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA11, STM32L4X_PINMUX_FUNC_PA11_OTG_FS_DM},
{STM32_PIN_PA12, STM32L4X_PINMUX_FUNC_PA12_OTG_FS_DP},
#endif /* CONFIG_USB_DC_STM32 */
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{STM32_PIN_PC0, STM32L4X_PINMUX_FUNC_PC0_ADC123_IN1},
#endif
};
static int pinmux_stm32_init(const struct device *port)

View file

@ -101,6 +101,7 @@
};
&adc1 {
pinctrl-0 = <&adc1_in3_pc2>;
status = "okay";
};

View file

@ -30,9 +30,6 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA6, STM32WBX_PINMUX_FUNC_PA6_SPI1_MISO},
{STM32_PIN_PA7, STM32WBX_PINMUX_FUNC_PA7_SPI1_MOSI},
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{STM32_PIN_PC2, STM32WBX_PINMUX_FUNC_PC2_ADC1_IN3},
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb), okay)
{STM32_PIN_PA11, STM32WBX_PINMUX_FUNC_PA11_USB_DM},
{STM32_PIN_PA12, STM32WBX_PINMUX_FUNC_PA12_USB_DP},

View file

@ -89,6 +89,8 @@
};
&adc1 {
/* adc1_in14_pc4 is used to sense the USB voltage */
pinctrl-0 = <&adc1_in1_pa1 &adc1_in14_pc4>;
status = "okay";
};

View file

@ -42,11 +42,6 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA11, STM32F1_PINMUX_FUNC_PA11_USB_DM},
{STM32_PIN_PA12, STM32F1_PINMUX_FUNC_PA12_USB_DP},
#endif /* CONFIG_USB_DC_STM32 */
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{STM32_PIN_PA1, STM32F1_PINMUX_FUNC_PA1_ADC123_IN1},
#endif
/* This input is to sense the USB voltage */
{STM32_PIN_PC4, STM32F1_PINMUX_FUNC_PC4_ADC12_IN14},
};
static int pinmux_stm32_init(const struct device *port)

View file

@ -42,9 +42,6 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA11, STM32F1_PINMUX_FUNC_PA11_USB_DM},
{STM32_PIN_PA12, STM32F1_PINMUX_FUNC_PA12_USB_DP},
#endif /* CONFIG_USB_DC_STM32 */
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{STM32_PIN_PA0, STM32F1_PINMUX_FUNC_PA0_ADC123_IN0},
#endif
};
static int pinmux_stm32_init(const struct device *port)

View file

@ -83,5 +83,6 @@
};
&adc1 {
pinctrl-0 = <&adc1_in0_pa0>;
status = "okay";
};

View file

@ -42,9 +42,6 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA11, STM32F3_PINMUX_FUNC_PA11_USB_DM},
{STM32_PIN_PA12, STM32F3_PINMUX_FUNC_PA12_USB_DP},
#endif /* CONFIG_USB_DC_STM32 */
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{STM32_PIN_PA0, STM32F3_PINMUX_FUNC_PA0_ADC1_IN1},
#endif
};
static int pinmux_stm32_init(const struct device *port)

View file

@ -159,5 +159,6 @@
};
&adc1 {
pinctrl-0 = <&adc1_in1_pa0>;
status = "okay";
};

View file

@ -42,9 +42,6 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA11, STM32F1_PINMUX_FUNC_PA11_USB_DM},
{STM32_PIN_PA12, STM32F1_PINMUX_FUNC_PA12_USB_DP},
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
{STM32_PIN_PA0, STM32F1_PINMUX_FUNC_PA0_ADC123_IN0},
#endif
};
static int pinmux_stm32_init(const struct device *port)

View file

@ -146,5 +146,6 @@
};
&adc1 {
pinctrl-0 = <&adc1_in0_pa0>;
status = "okay";
};