Skip to content
Permalink
Browse files

pinmux: Add stm32mp157c_dk2 board support

Implementation of pinmux for the stm32mp157c_dk2 board.
Some UART pin mux definition has been added (mainly for
UART console and UART/SPI Arduino shield support).
This can be completed with pin mux for other stm32mp157c
UART.

Signed-off-by: Yaël Boutreux <yael.boutreux@st.com>
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
  • Loading branch information...
yboutreux authored and nashif committed Apr 12, 2019
1 parent 287f067 commit eba3f4924021f387a206c99832fefb1274821d34
@@ -2,4 +2,5 @@
#
# SPDX-License-Identifier: Apache-2.0

zephyr_library_sources(pinmux.c)
zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers)
@@ -173,6 +173,8 @@ features:
| UART | on-chip | serial port-polling; |
| | | serial port-interrupt |
+-----------+------------+-------------------------------------+
| PINMUX | on-chip | pinmux |
+-----------+------------+-------------------------------------+

The default configuration can be found in the defconfig file:
``boards/arm/stm32mp157c_dk2/stm32mp157c_dk2_defconfig``
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2019 STMicroelectronics
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <kernel.h>
#include <device.h>
#include <init.h>
#include <pinmux.h>
#include <sys_io.h>

#include <pinmux/stm32/pinmux_stm32.h>

/* pin assignments for STM32MP157c_dk2 board */
static const struct pin_config pinconf[] = {
#ifdef CONFIG_UART_3
{ STM32_PIN_PB10, STM32MP1X_PINMUX_FUNC_PB10_USART3_TX },
{ STM32_PIN_PB12, STM32MP1X_PINMUX_FUNC_PB12_USART3_RX },
#endif /* CONFIG_UART_3 */
#ifdef CONFIG_UART_7
{ STM32_PIN_PE7, STM32MP1X_PINMUX_FUNC_PE7_UART7_RX },
{ STM32_PIN_PE8, STM32MP1X_PINMUX_FUNC_PE8_UART7_TX },
#endif /* CONFIG_UART_7 */

};

static int pinmux_stm32_init(struct device *port)
{
ARG_UNUSED(port);

stm32_setup_pins(pinconf, ARRAY_SIZE(pinconf));

return 0;
}

SYS_INIT(pinmux_stm32_init, PRE_KERNEL_1,
CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY);
@@ -13,6 +13,9 @@ CONFIG_GPIO=y
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y

# pin mux configuration
CONFIG_PINMUX=y

# clock configuration
CONFIG_CLOCK_CONTROL=y

@@ -23,7 +23,12 @@

#include "pinmux.h"

#ifdef CONFIG_SOC_SERIES_STM32MP1X
#define GPIO_REG_SIZE 0x1000
/* 0x1000 between each port, 0x400 gpio registry 0xC00 reserved */
#else
#define GPIO_REG_SIZE 0x400
#endif /* CONFIG_SOC_SERIES_STM32MP1X */
/* base address for where GPIO registers start */
#define GPIO_PORTS_BASE (GPIOA_BASE)

@@ -117,6 +117,8 @@ void stm32_setup_pins(const struct pin_config *pinconf,
#include "pinmux_stm32l1x.h"
#elif CONFIG_SOC_SERIES_STM32L4X
#include "pinmux_stm32l4x.h"
#elif CONFIG_SOC_SERIES_STM32MP1X
#include "pinmux_stm32mp1x.h"
#elif CONFIG_SOC_SERIES_STM32WBX
#include "pinmux_stm32wbx.h"
#endif
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2019 STMicroelectronics
*
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef ZEPHYR_DRIVERS_PINMUX_STM32_PINMUX_STM32MP1X_H_
#define ZEPHYR_DRIVERS_PINMUX_STM32_PINMUX_STM32MP1X_H_

/**
* @file Header for STM32MP1X pin multiplexing helper
*/

/* Port B */
#define STM32MP1X_PINMUX_FUNC_PB10_USART3_TX \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_PULLUP)
#define STM32MP1X_PINMUX_FUNC_PB12_USART3_RX \
(STM32_PINMUX_ALT_FUNC_8 | STM32_PUPDR_PULL_DOWN)

/* Port E */
#define STM32MP1X_PINMUX_FUNC_PE7_UART7_RX \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUPDR_PULL_DOWN)
#define STM32MP1X_PINMUX_FUNC_PE8_UART7_TX \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_PULLUP)

#endif /* ZEPHYR_DRIVERS_PINMUX_STM32_PINMUX_STM32MP1X_H_ */
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2019 STMicroelectronics
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <dt-bindings/pinctrl/stm32-pinctrl.h>

/ {
soc {
pinctrl: pin-controller@50002000 {
usart3_pins_a: usart3_a {
rx_tx {
rx = <STM32_PIN_PB12
(STM32_PINMUX_ALT_FUNC_8 |
STM32_PUPDR_PULL_DOWN)>;
tx = <STM32_PIN_PB10
(STM32_PINMUX_ALT_FUNC_7 |
STM32_PUSHPULL_PULLUP)>;
};
};
uart7_pins_a: uart7_a {
rx_tx {
rx = <STM32_PIN_PE7
(STM32_PINMUX_ALT_FUNC_7 |
STM32_PUPDR_PULL_DOWN)>;
tx = <STM32_PIN_PE8
(STM32_PINMUX_ALT_FUNC_7 |
STM32_PUSHPULL_PULLUP)>;
};
};
};
};
};
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include <st/mp1/stm32mp1-pinctrl.dtsi>
#include <mem.h>
#include <arm/armv7-m.dtsi>
#include <dt-bindings/gpio/gpio.h>

0 comments on commit eba3f49

Please sign in to comment.
You can’t perform that action at this time.