boards: stm32: Replace CAN Kconfig symbols by dt instances
Replace use of CAN_X Kconfig symbols by access to dt instances
Control of enabled instances is now done using dts nodes status
field ('okay'/'disabled'). For boards supporting only can2,
can1 instance is disabled.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
parent
826e24ca58
commit
fe244040d1
@ -12,10 +12,6 @@ config PWM_STM32_2
|
||||
default y
|
||||
depends on PWM
|
||||
|
||||
config CAN_2
|
||||
default y
|
||||
depends on CAN
|
||||
|
||||
config SPI_STM32_INTERRUPT
|
||||
default y
|
||||
depends on SPI
|
||||
|
||||
@ -83,7 +83,7 @@
|
||||
|
||||
&can1 {
|
||||
bus-speed = <125000>;
|
||||
status = "okay";
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&can2 {
|
||||
|
||||
@ -29,11 +29,11 @@ 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 */
|
||||
#ifdef CONFIG_CAN_1
|
||||
#if DT_HAS_NODE(DT_NODELABEL(can1))
|
||||
{STM32_PIN_PD0, STM32F4_PINMUX_FUNC_PD0_CAN1_RX},
|
||||
{STM32_PIN_PD1, STM32F4_PINMUX_FUNC_PD1_CAN1_TX},
|
||||
#endif /* CONFIG_CAN_1 */
|
||||
#ifdef CONFIG_CAN_2
|
||||
#endif
|
||||
#if DT_HAS_NODE(DT_NODELABEL(can2))
|
||||
{STM32_PIN_PB12, STM32F4_PINMUX_FUNC_PB12_CAN2_RX},
|
||||
{STM32_PIN_PB13, STM32F4_PINMUX_FUNC_PB13_CAN2_TX},
|
||||
#endif /* CONFIG_CAN_2 */
|
||||
|
||||
@ -23,10 +23,6 @@ config PWM_STM32_1
|
||||
default y
|
||||
depends on PWM
|
||||
|
||||
config CAN_1
|
||||
default y
|
||||
depends on CAN
|
||||
|
||||
config ADC_1
|
||||
default y
|
||||
depends on ADC
|
||||
|
||||
@ -64,10 +64,10 @@ 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
|
||||
#ifdef CONFIG_CAN_1
|
||||
#if DT_HAS_NODE(DT_NODELABEL(can1))
|
||||
{STM32_PIN_PD0, STM32F7_PINMUX_FUNC_PD0_CAN_RX},
|
||||
{STM32_PIN_PD1, STM32F7_PINMUX_FUNC_PD1_CAN_TX},
|
||||
#endif /* CONFIG_CAN_1 */
|
||||
#endif
|
||||
#ifdef CONFIG_ADC_1
|
||||
{ STM32_PIN_PA0, STM32F7_PINMUX_FUNC_PA0_ADC123_IN0 },
|
||||
#endif /* CONFIG_ADC_1 */
|
||||
|
||||
@ -23,10 +23,6 @@ config PWM_STM32_1
|
||||
default y
|
||||
depends on PWM
|
||||
|
||||
config CAN_1
|
||||
default y
|
||||
depends on CAN
|
||||
|
||||
config ADC_1
|
||||
default y
|
||||
depends on ADC
|
||||
|
||||
@ -64,10 +64,10 @@ 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
|
||||
#ifdef CONFIG_CAN_1
|
||||
#if DT_HAS_NODE(DT_NODELABEL(can1))
|
||||
{STM32_PIN_PD0, STM32F7_PINMUX_FUNC_PD0_CAN_RX},
|
||||
{STM32_PIN_PD1, STM32F7_PINMUX_FUNC_PD1_CAN_TX},
|
||||
#endif /* CONFIG_CAN_1 */
|
||||
#endif
|
||||
#ifdef CONFIG_ADC_1
|
||||
{ STM32_PIN_PA0, STM32F7_PINMUX_FUNC_PA0_ADC123_IN0 },
|
||||
#endif /* CONFIG_ADC_1 */
|
||||
|
||||
@ -17,8 +17,4 @@ config SPI_STM32_INTERRUPT
|
||||
default y
|
||||
depends on SPI
|
||||
|
||||
config CAN_1
|
||||
default y
|
||||
depends on CAN
|
||||
|
||||
endif # BOARD_NUCLEO_L432KC
|
||||
|
||||
@ -38,10 +38,10 @@ static const struct pin_config pinconf[] = {
|
||||
{STM32_PIN_PA6, STM32L4X_PINMUX_FUNC_PA6_SPI1_MISO},
|
||||
{STM32_PIN_PA7, STM32L4X_PINMUX_FUNC_PA7_SPI1_MOSI},
|
||||
#endif
|
||||
#ifdef CONFIG_CAN_1
|
||||
#if DT_HAS_NODE(DT_NODELABEL(can1))
|
||||
{STM32_PIN_PA11, STM32L4X_PINMUX_FUNC_PA11_CAN_RX},
|
||||
{STM32_PIN_PA12, STM32L4X_PINMUX_FUNC_PA12_CAN_TX},
|
||||
#endif /* CONFIG_CAN_1 */
|
||||
#endif
|
||||
};
|
||||
|
||||
static int pinmux_stm32_init(struct device *port)
|
||||
|
||||
@ -17,8 +17,4 @@ config SPI_STM32_INTERRUPT
|
||||
default y
|
||||
depends on SPI
|
||||
|
||||
config CAN_1
|
||||
default y
|
||||
depends on CAN
|
||||
|
||||
endif # BOARD_NUCLEO_L452RE
|
||||
|
||||
@ -37,10 +37,10 @@ static const struct pin_config pinconf[] = {
|
||||
{STM32_PIN_PA6, STM32L4X_PINMUX_FUNC_PA6_SPI1_MISO},
|
||||
{STM32_PIN_PA7, STM32L4X_PINMUX_FUNC_PA7_SPI1_MOSI},
|
||||
#endif
|
||||
#ifdef CONFIG_CAN_1
|
||||
#if DT_HAS_NODE(DT_NODELABEL(can1))
|
||||
{STM32_PIN_PA11, STM32L4X_PINMUX_FUNC_PA11_CAN_RX},
|
||||
{STM32_PIN_PA12, STM32L4X_PINMUX_FUNC_PA12_CAN_TX},
|
||||
#endif /* CONFIG_CAN_1 */
|
||||
#endif
|
||||
};
|
||||
|
||||
static int pinmux_stm32_init(struct device *port)
|
||||
|
||||
@ -8,8 +8,4 @@ if BOARD_OLIMEX_STM32_P405
|
||||
config BOARD
|
||||
default "olimex_stm32_p405"
|
||||
|
||||
config CAN_1
|
||||
default y
|
||||
depends on CAN
|
||||
|
||||
endif # BOARD_OLIMEX_STM32_P405
|
||||
|
||||
@ -18,10 +18,10 @@ static const struct pin_config pinconf[] = {
|
||||
{STM32_PIN_PA2, STM32F4_PINMUX_FUNC_PA2_USART2_TX},
|
||||
{STM32_PIN_PA3, STM32F4_PINMUX_FUNC_PA3_USART2_RX},
|
||||
#endif
|
||||
#ifdef CONFIG_CAN_1
|
||||
#if DT_HAS_NODE(DT_NODELABEL(can1))
|
||||
{STM32_PIN_PB8, STM32F4_PINMUX_FUNC_PB8_CAN1_RX},
|
||||
{STM32_PIN_PB9, STM32F4_PINMUX_FUNC_PB9_CAN1_TX},
|
||||
#endif /* CONFIG_CAN_1 */
|
||||
#endif
|
||||
};
|
||||
|
||||
static int pinmux_stm32_init(struct device *port)
|
||||
|
||||
@ -16,8 +16,4 @@ config PWM_STM32_1
|
||||
default y
|
||||
depends on PWM
|
||||
|
||||
config CAN_1
|
||||
default y
|
||||
depends on CAN
|
||||
|
||||
endif # BOARD_OLIMEXINO_STM32
|
||||
|
||||
@ -58,10 +58,10 @@ 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 */
|
||||
#ifdef CONFIG_CAN_1
|
||||
#if DT_HAS_NODE(DT_NODELABEL(can1))
|
||||
{STM32_PIN_PB8, STM32F1_PINMUX_FUNC_PB8_CAN_RX},
|
||||
{STM32_PIN_PB9, STM32F1_PINMUX_FUNC_PB9_CAN_TX},
|
||||
#endif /* CONFIG_CAN_1 */
|
||||
#endif
|
||||
};
|
||||
|
||||
static int pinmux_stm32_init(struct device *port)
|
||||
@ -69,10 +69,10 @@ static int pinmux_stm32_init(struct device *port)
|
||||
ARG_UNUSED(port);
|
||||
|
||||
stm32_setup_pins(pinconf, ARRAY_SIZE(pinconf));
|
||||
#ifdef CONFIG_CAN_1
|
||||
#if DT_HAS_NODE(DT_NODELABEL(can1))
|
||||
/* Set pin-mux so that CAN1 is on PB8 and PB9 */
|
||||
AFIO->MAPR |= AFIO_MAPR_CAN_REMAP_REMAP2;
|
||||
#endif /* CONFIG_CAN_1 */
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -12,8 +12,4 @@ config SPI_STM32_INTERRUPT
|
||||
default y
|
||||
depends on SPI
|
||||
|
||||
config CAN_1
|
||||
default y
|
||||
depends on CAN
|
||||
|
||||
endif # BOARD_STM32F072B_DISCO
|
||||
|
||||
@ -32,10 +32,10 @@ static const struct pin_config pinconf[] = {
|
||||
{STM32_PIN_PB4, STM32F0_PINMUX_FUNC_PB4_SPI1_MISO},
|
||||
{STM32_PIN_PB5, STM32F0_PINMUX_FUNC_PB5_SPI1_MOSI},
|
||||
#endif
|
||||
#ifdef CONFIG_CAN_1
|
||||
#if DT_HAS_NODE(DT_NODELABEL(can1))
|
||||
{STM32_PIN_PB8, STM32F0_PINMUX_FUNC_PB8_CAN_RX},
|
||||
{STM32_PIN_PB9, STM32F0_PINMUX_FUNC_PB9_CAN_TX},
|
||||
#endif /* CONFIG_CAN_1 */
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -8,8 +8,4 @@ if BOARD_STM32F3_DISCO
|
||||
config BOARD
|
||||
default "stm32f3_disco"
|
||||
|
||||
config CAN_1
|
||||
default y
|
||||
depends on CAN
|
||||
|
||||
endif # BOARD_STM32F3_DISCO
|
||||
|
||||
@ -50,10 +50,10 @@ 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 */
|
||||
#ifdef CONFIG_CAN_1
|
||||
#if DT_HAS_NODE(DT_NODELABEL(can1))
|
||||
{STM32_PIN_PD0, STM32F3_PINMUX_FUNC_PD0_CAN1_RX},
|
||||
{STM32_PIN_PD1, STM32F3_PINMUX_FUNC_PD1_CAN1_TX},
|
||||
#endif /* CONFIG_CAN_1 */
|
||||
#endif
|
||||
};
|
||||
|
||||
static int pinmux_stm32_init(struct device *port)
|
||||
|
||||
@ -12,8 +12,4 @@ config PWM_STM32_2
|
||||
default y
|
||||
depends on PWM
|
||||
|
||||
config CAN_2
|
||||
default y
|
||||
depends on CAN
|
||||
|
||||
endif # BOARD_STM32F4_DISCO
|
||||
|
||||
@ -29,14 +29,14 @@ 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 */
|
||||
#ifdef CONFIG_CAN_1
|
||||
#if DT_HAS_NODE(DT_NODELABEL(can1))
|
||||
{STM32_PIN_PB8, STM32F4_PINMUX_FUNC_PB8_CAN1_RX},
|
||||
{STM32_PIN_PB9, STM32F4_PINMUX_FUNC_PB9_CAN1_TX},
|
||||
#endif /* CONFIG_CAN_1 */
|
||||
#ifdef CONFIG_CAN_2
|
||||
#endif
|
||||
#if DT_HAS_NODE(DT_NODELABEL(can2))
|
||||
{STM32_PIN_PB5, STM32F4_PINMUX_FUNC_PB5_CAN2_RX},
|
||||
{STM32_PIN_PB13, STM32F4_PINMUX_FUNC_PB13_CAN2_TX},
|
||||
#endif /* CONFIG_CAN_2 */
|
||||
#endif
|
||||
};
|
||||
|
||||
static int pinmux_stm32_init(struct device *port)
|
||||
|
||||
@ -85,7 +85,7 @@
|
||||
|
||||
&can1 {
|
||||
bus-speed = <125000>;
|
||||
status = "okay";
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&can2 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user