The STM32MP15 System-On-Chip has a lot of functionality but a limited number of pins (or pads). Even though a single pin can only perform one function at a time, they can be configured internally to perform different functions. This is called pin multiplexing.

The ConnectCore MP15 Hardware Reference Manual contains a Module pinout section that identifies all module pads with their corresponding signal name used in the reference boards schematics, and maps them to the corresponding STM32MP15 pad name.

Pad multiplexing

The STMicroelectronics STM32MP15 datasheet uses a pad name such as PH7 (for GPIOH 7) to refer to the System-On-Chip pads. Each pad can multiplex up to 16 alternate functions (labelled from AF0 to AF15) besides the regular GPIO functionality.

Refer to the ConnectCore MP15 Hardware Reference Manual for the SOM pads mapping to STM32MP15 pads and their available alternate functions.

Electrical parameters of a pad

The following electrical parameters can be configured for the pads:

  • Push-pull or open-drain (outputs)

  • Pull-up or pull-down enabled/disabled

  • Slew rate (low, medium, fast, high)

Use the device tree to configure pin IOMUX and pad control

Digi Embedded Yocto uses the Linux kernel device tree to configure the pad multiplexing and electrical characteristics of the pads.

The following example shows pad selection and IOMUX setting for a particular device: sdmmc2. On the Linux kernel source, you can find the sdmmc2 device tree node in arch/arm/boot/dts/ccmp157-dvk.dts

ConnectCore MP15 Development Kit device tree
/* Micro SD */
&sdmmc2 {
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc2_b4_pins_a>;
	pinctrl-1 = <&sdmmc2_b4_od_pins_a>;
	pinctrl-2 = <&sdmmc2_b4_sleep_pins_a>;
	broken-cd;
	disable-wp;
	st,neg-edge;
	bus-width = <4>;
	vmmc-supply = <&v3v3>;
	status = "okay";
};

The device tree establishes three different pin configurations (default, opendrain and sleep) at pinctrl-0, pinctrl-1, and pinctrl-2 properties. Such pinctrl configurations may be defined on the same board device tree file or in a common include file. For example:

stm32mp15-pinctrl.dtsi
sdmmc2_b4_pins_a: sdmmc2-b4-0 {
	pins1 {
		pinmux = <STM32_PINMUX('B', 14, AF9)>, /* SDMMC2_D0 */
			 <STM32_PINMUX('B', 15, AF9)>, /* SDMMC2_D1 */
			 <STM32_PINMUX('B', 3, AF9)>, /* SDMMC2_D2 */
			 <STM32_PINMUX('B', 4, AF9)>, /* SDMMC2_D3 */
			 <STM32_PINMUX('G', 6, AF10)>; /* SDMMC2_CMD */
		slew-rate = <1>;
		drive-push-pull;
		bias-pull-up;
	};
	pins2 {
		pinmux = <STM32_PINMUX('E', 3, AF9)>; /* SDMMC2_CK */
		slew-rate = <2>;
		drive-push-pull;
		bias-pull-up;
	};
};

This example shows:

  • The STM32_PINMUX() macro selects a pad (for instance, GPIOB 14) and it assigns it a given alternate function (for instance, AF9).

  • The optional property slew-rate selects a given slew rate for a group of pads (0=low, 1=medium, 2=fast, 3=high).

  • The optional property drive-push-pull tells the pad to use a push-pull configuration (as opposed to drive-open-drain).

  • The optional property bias-disable configures no internal pull-up or pull-down resistor (which you can enable with bias-pull-up or bias-pull-down).

The device tree pinctrl documentation binding explains the STM32MP15 pin mux and config controller.

Configure independent pin IOMUX and pad control

Unconfigured pads default to work as regular GPIOS. The GPIO chip may contain GPIO hog definitions. GPIO hogging is a mechanism providing automatic GPIO request and configuration as part of the gpio-controller’s driver probe function.

Check Documentation/devicetree/bindings/gpio/gpio.txt for more information on GPIO hog definitions.

Do not configure the same pad twice in the device tree. IOMUX configurations are set by the drivers in the order the kernel probes the configured device. If the same pad is configured differently by two drivers, the settings associated with the last-probed driver will fail to apply and the driver will not be brought up.