How to Setup Pins in Device-tree Source

How to Setup Pins in Device-tree Source

The aim of this document is to explain how to setup pins of SP7350 in device-tree source. SP7350 has 106 general purpose IO (GPIO) pins which are multiplexed with other special functions, like eMMC device, SPI-NOR flash, SPI-NAND flash, Ethernet PHY (RGMII or RMII interface), UART, I2C pins, and etc.

The following sections will explain how to setup GPIOs and special function pins in device-tree source file. Note that the same device-tree source file is used by U-Boot and Linux in SP7350. Both Pinctrl drivers support generic helper bindings.

Table of Contents

IO Pins

In the Linux, name of IO pin is in form of GPIO(id), like GPIO0, GPIO1, GPIO2, …, GPIO105, and etc. These IO pins of SP7350 are categorized, based on their operating voltage, into two groups:

  • Single-supply IO pins: The IO pins operate on a single power supply, specifically at 1.8V.

  • Dual-supply IO pins: The IO pins offer a dual power supply option, supporting both 1.8V and 3.0V. These pins are referred to as DVIO pins in the subsequent sections.

Refer to table below for a breakdown of power domain, supplying voltage, pin name (hardware pin name), supplying power pins of all IO pins of SP7350:

GPIO #

Power domain

Type

Pin name

Power-supply

0 - 19

Main

1.8V GPIO

G_MX0 - G_MX19

VDDPST18_GPIO

20

1.8V/3.0V DVIO

G_MX20

VDDPST3018_DVIO_2

21 - 27

G_MX21 - G_MX27

VDDPST3018_DVIO_1

28 - 37

G_MX28 - G_MX37

VDDPST3018_DVIO_2

38 - 43

G_MX38 - G_MX43

AVDDIO_3018_SD

44 - 49

G_MX44 - G_MX49

AVDDIO_3018_SDIO

50 - 59

CM4 (AO)

AO_MX0 - AO_MX9

VDDPST3018_DVIO_AO_1

60 - 69

AO_MX10 - AO_MX19

VDDPST3018_DVIO_AO_2

70 - 79

AO_MX20 - AO_MX29

VDDPST3018_DVIO_AO_3

80 - 98

1.8V GPIO

AO_MX30 - AO_MX48

VDDPST18_GPIO_AO

99 - 105

IV_MX0 - IV_MX6

Voltage Mode Select

Beyond configuring the 1.8V or 3.0V power to supply pins of a DVIO group in circuit boards (hardware), setting up the voltage mode select (ms control) control-bits is crucial for the normal operation of IO pins. The following properties configure voltage mode select control-bits in the Device Tree Source (DTS) file:

Properties

Pins

Value

Properties

Pins

Value

sunplus,ms-dvio-group-0

G_MX21~G_MX27

“3V0“ for 3.0V; “1V8“ for 1.8V.

sunplus,ms-dvio-group-1

G_MX20, G_MX28~G_MX37

“3V0“ for 3.0V; “1V8“ for 1.8V.

sunplus,ms-dvio-ao-group-0

AO_MX0~AO_MX9

“3V0“ for 3.0V; “1V8“ for 1.8V.

sunplus,ms-dvio-ao-group-1

AO_MX10~AO_MX19

“3V0“ for 3.0V; “1V8“ for 1.8V.

sunplus,ms-dvio-ao-group-2

AO_MX20~AO_MX29

“3V0“ for 3.0V; “1V8“ for 1.8V.

These properties should be set in the pinctrl node in the DTS file. For example:

pctl: pinctrl@f8800080 { : : sunplus,ms-dvio-group-0 = “1V8“; sunplus,ms-dvio-group-1 = “3V0“; sunplus,ms-dvio-ao-group-2 = “1V8“; : };

Default voltage is “3V0”.

Pin Multiplexing Nodes

  • function - the multiplex function to select.

  • groups - the list of groups to select with this function. Either this or "pins" must be specified.

  • pins - the list of pins to select with this function. Either this or "groups" must be specified.

Refer to examples below:

Set a Single Pin to GPIO function

pinmux_example { function = "GPIO"; pins = "GPIO0"; };

Set pin GPIO0 to GPIO function.

Set Several Pins to GPIO function

pinmux_example { function = "GPIO"; pins = "GPIO0", "GPIO1", "GPIO10"; };

Set pins GPIO0, GPIO1, GPIO10 to GPIO function.

Set a Group of Pins to a Specified Function

pinmux_example { function = "UART0"; groups = "UART0_X1"; };

Set a group of pins, whose group-name is UART0_X1, to UART0 function. Actually, the group includes pins GPIO50 and GPIO51.

Refer to Function-group Table in appendix.

Pin Configuration Nodes

Here we only list the generic pin configuration parameters supported by SP7350.

  1. bias-disable

  • description

Disable any pin bias on the pin.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : bias-disable; : : };

 

  1. bias-high-impedance

  • description

The pin will be set to a high impedance mode, also know as "third-state" (tri-state) or "high-Z" or "floating".

  • argument

The argument is ignored.

  • usage

pinconf_example { : : bias-high-impedance; : : };

 

  1. bias-pull-up

  • description

The pin will be pulled up.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : bias-pull-up; : : };

 

  1. bias-pull-down

  • description

The pin will be pulled down.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : bias-pull-down; : : };

 

  1. drive-open-drain

  • description

The pin will be driven with open drain (open collector) which means it is usually wired with other output ports which are then pulled up with an external resistor. Setting this config will enable open drain mode.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : drive-open-drain; : : };

 

  1. drive-strength-microamp

  • description

The pin will sink or source at most the current passed as argument.

  • argument

The argument is in uA.

See linux/kernel/include/dt-bindings/pinctrl/pinctrl-config-sp7350.h for selectable argument.

  • usage

pinconf_example { : : /* source current 1100uA for GPIO*/ drive-strength-microamp = <SPPCTRL_GPIO_DRV_IOH_1100_IOL_1100UA>; : : };
pinconf_example { : : /* source current 5100uA for DVIO*/ drive-strength-microamp = <SPPCTRL_DVIO_DRV_IOH_5100_IOL_6200UA>; : : };

 

  1. input-enable

  • description

Enable the pin's input.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : input-enable; : : };

 

  1. input-disable

  • description

Disable the pin's input.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : input-disable; : : };

 

  1. input-schmitt-enable

  • description

This will configure an input pin to run in Schmitt-trigger mode.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : input-schmitt-enable; : : };

 

  1. input-schmitt-disable

  • description

This will disable the pin's Schmitt-trigger mode.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : input-schmitt-disable; : : };

 

  1. output-enable

  • description

This will enable the pin's output mode without driving a value there.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : output-enable; : : };

 

  1. output-disable

  • description

This will disable the pin's output mode.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : output-disable; : : };

 

  1. output-high

  • description

This will configure the pin as output and drive high level on the line.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : output-high; : : };

 

  1. output-low

  • description

This will configure the pin as output and drive low level on the line.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : output-low; : : };

 

  1. sunplus,input-invert-enable

  • description

This will invert the pin's input value. High level as 0, Low level as 1.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : sunplus,input-invert-enable; : : };

 

  1. sunplus,output-invert-enable

  • description

This will invert the pin's output value. 1 as low level, 0 as high level.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : sunplus,output-invert-enable; : : };

 

  1. sunplus,input-invert-disable

  • description

This will normalize the pin's input value. High level as 1, Low level as 0.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : sunplus,input-invert-disable; : : };

 

  1. sunplus,output-invert-disable

  • description

This will normalize the pin's output value. 1 as high level, 0 as low level.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : sunplus,output-invert-disable; : : };

 

  1. sunplus,bias-strong-pull-up

  • description

The pin will be pulled up strongly.

For GPIO only, excluding DVIO.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : sunplus,bias-strong-pull-up; : : };

 

  1. sunplus,ao-int-enable

  • description

Enable interrrupt for pins in group of GPIO_AO_INT.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : sunplus,ao-int-enable; : : };

 

  1. sunplus,ao-int-disable

  • description

Disable interrrupt for pins in group of GPIO_AO_INT.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : sunplus,ao-int-disable; : : };

 

  1. sunplus,ao-int-debounce-enable

  • description

Enable debounce for pins in group of GPIO_AO_INT.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : sunplus,ao-int-debounce-enable; : : };

 

  1. sunplus,ao-int-debounce-disable

  • description

Disable debounce for pins in group of GPIO_AO_INT.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : sunplus,ao-int-debounce-disable; : : };

 

  1. sunplus,ao-int-trigger-mode

  • description

Set interrupt trigger mode for pins in group of GPIO_AO_INT.

  • argument

0:Edge Trigger

1:Level Trigger

  • usage

pinconf_example { : : sunplus,ao-int-trigger-mode=<0>; : : };

 

  1. sunplus,ao-int-trigger-polarity

  • description

Set interrupt trigger polarity for pins in group of GPIO_AO_INT.

  • argument

0:Rising Edge or Level High

1:Falling Edge or Level Low

  • usage

pinconf_example { : : sunplus,ao-int-trigger-polarity=<0>; : : };

 

  1. sunplus,ao-int-mask

  • description

Mask interrupt for pins in group of GPIO_AO_INT.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : sunplus,ao-int-mask; : : };

 

  1. sunplus,ao-int-unmask

  • description

Unmask interrupt for pins in group of GPIO_AO_INT.

  • argument

The argument is ignored.

  • usage

pinconf_example { : : sunplus,ao-int-unmask; : : };

DTS Files

Device-tree source files of SP7350 are located in linux/kernel/arch/arm64/boot/dts/sunplus/.

Here lists all files for SP7350 boards:

Boards

Device-tree source files

C3V-W Evaluation Board

sp7350-ev.dts

C3V-W Demo Board

sp7350-dm.dts

Example

Voltage Mode Select

For 1.8V/3.0V Dual Voltage IO (DVIO) pins, we need to select their voltage in pinctrl top node in DTS file. For example,

pctl: pinctrl@f8800080 { compatible = "sunplus,sp7350-pctl"; : : sunplus,ms-dvio-group-0 = "1V8"; sunplus,ms-dvio-group-1 = "1V8"; sunplus,ms-dvio-ao-group-0 = "1V8"; sunplus,ms-dvio-ao-group-1 = "3V0"; sunplus,ms-dvio-ao-group-2 = "3V0"; : : };

In this example, DVIO groups 0 and 1 are configured to operate at 1.8V, while DVIO AO group 0 is designated with a voltage setting of 1.8V. Conversely, DVIO AO groups 1 and 2 are specifically set to operate at 3.0V. It is crucial to note that in the absence of a specified selection, the default voltage for these groups is set to 3.0V.

GPIO

SP7350 has 106 general purpose IO (GPIO) pins. Most of them are multiplexed with other special function pins. This section explains how to modify device-tree source file to set up GPIO pins as digital input or output pins.

Define GPIO in device-tree source file

Every single device has a node in device-tree source (dts) file in Linux. Property pinctrl-0 (or pinctrl-1, pinctrl-2,… if a device has more states) is used to point at pin configuration node within pin controller (node pinctrl@f8800080 in SP7350). Pin configuration nodes (sub-nodes in node pinctrl@f8800080 ) define the actual pins assignment.

Users need to add properties pinctrl-names and pinctrl-0 to a node (device) in device-tree source file to set up GPIOs as digital input or output pins for a device . For example:

u3phy0: uphy@f80bd000 { : : pinctrl-names = "default"; pinctrl-0 = <&typec_pins>; typec-gpios = <&pctl 98 GPIO_ACTIVE_HIGH>; : : };

where property pinctrl-0 sets up pins of uphy@f80bd000 device for "default" state. It is a handle (an address) to sub-node of pin-controller node.

Property typec-gpios defines one GPIO pin to GPIO98 of pin controller. Linux driver can get GPIO descriptors using the property. pctl is a handle (an address) to pin controller.

The following device-tree source of SP7350 shows definitions of sub-node pinmux_typec-pins of node pinctrl@f8800080.

typec_pins: pinmux_typec-pins { function = "GPIO"; pins = "GPIO98"; };

Setting GPIO Characteristics

GPIO pins' characteristics, such as setting them to high, low, or configuring additional features, can also be directly specified within the pin node. For instance, we extend the previous example to add GPIO0 and GPIO1 and configure them as input and output, respectively. We introduce the extra_gpio_pins node label after typec_pins:

u3phy0: uphy@f80bd000 { : : pinctrl-names = "default"; pinctrl-0 = <&typec_pins &extra_gpio_pins>; typec-gpios = <&pctl 98 GPIO_ACTIVE_HIGH>; : : };

Add extra_gpio-pins node and label as shown below:

typec_pins: pinmux_typec-pins { function = "GPIO"; pins = "GPIO98"; }; extra_gpio_pins: extra_gpio-pins { gpio0_pinconf { function = "GPIO"; pins = "GPIO0"; input-enable; input-schmitt-enable; }; gpio1_pinconf { function = "GPIO"; pins = "GPIO1"; output-enable; output-low; drive-strength-microamp = <SPPCTRL_GPIO_DRV_IOH_1100_IOL_1100UA>; }; };

In the extra_gpio-pins node, GPIO0 is configured as an input with Schmitt trigger. Meanwhile, GPIO1 is configured as an output set to low, with a specified drive strength.

Special Function Pins

Some devices pins of SP7350 are multiplexed to specified pin-group of SP7350. This section explains how to modify device-tree source file to enable pins of those devices.

Every device should have a node in device-tree source (dts) file in Linux. Property pinctrl-0 (or pinctrl-1, pinctrl-2,… if a device has more states) is used to point at pin configuration node within pin controller (node pinctrl@f8800080 in SP7021). Pin configuration nodes (sub-nodes in node pinctrl@f8800080 ) define the actual pins assignment. For examples:

pinmux

  1. eMMC device:

Pins of eMMC of SP7350, [D5, D3, D4, D0, D1, CLK, D2, D7, D6, CMD, DS], can be multiplexed to pin-group GPIO [20, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37].

To set up eMMC pins, users need to add properties pinctrl-names and pinctrl-0 to eMMC node mmc@f8003b00 in device-tree source file. For example:

mmc0: mmc@f8003b00 { : : pinctrl-names = "default"; pinctrl-0 = <&emmc_pins>; : : };

The following device-tree source of SP7350 shows definition of sub-nodes pinmux_emmc-pins of node pinctrl@f8800080.

emmc_pins: pinmux_emmc-pins { function = "EMMC"; groups = "EMMC"; };

StringEMMC is defined for the only pin-group of eMMC which is mapped to GPIO [20, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37]. Refer to "Function-group Table" in Appendix.

 

  1. GMAC

Pins of GMAC of SP7350, [RXC, RXDV, RXD0, RXD1, RXD2, RXD3, TXC, TXEN, TXD0, TXD1, TXD2, TXD3, MDC, MDIO], can be multiplexed to pin-group GPIO [3, 4, 5, 6, 13, 14, 10, 11, 7, 8, 15, 16, 9, 12].

To set up GMAC pins, users need to add properties pinctrl-names and pinctrl-0 to GMAC node stmmac@f8103000 in device-tree source file. For example:

ethernet: stmmac@f8103000 { : : pinctrl-names = "default"; pinctrl-0 = <&gmac_pins>; : : };

The following device-tree source of SP7350 shows definition of sub-nodes pinmux_gmac-pins of node pinctrl@f8800080.

gmac_pins: pinmux_gmac-pins { function = "GMAC"; groups = "GMAC_RGMII"; };

StringGMAC_RGMII is defined for the pin-group of GMAC which is mapped to GPIO [3, 4, 5, 6, 13, 14, 10, 11, 7, 8, 15, 16, 9, 12]. Refer to "Function-group Table" in Appendix.

 

  1. SD Card

Pins of SD card of SP7350, [D1, D0, CLK, CMD, D3, D2], can be multiplexed to pin-group GPIO [38, 39, 40, 41, 42, 43].

To set up SD card pins, users need to add properties pinctrl-names and pinctrl-0 to SD card node mmc@f8003e80 in device-tree source file. For example:

mmc1: mmc@f8003e80 { : : pinctrl-names = "default"; pinctrl-0 = <&sdcard_pins>; : : };

The following device-tree source of SP7350 shows definition of sub-nodes pinmux_sdcard-pins of node pinctrl@f8800080.

sdcard_pins: pinmux_sdcard-pins { function = "SD_CARD"; groups = "SD_CARD"; };

StringSD_CARD is defined for the pin-group of SD card which is mapped to GPIO [38, 39, 40, 41, 42, 43]. Refer to "Function-group Table" in Appendix.

 

  1. SDIO

Pins of SDIO of SP7350, [D1, D0, CLK, CMD, D3, D2], can be multiplexed to pin-group GPIO [44, 45, 46, 47, 48, 49].

To set up SDIO pins, users need to add properties pinctrl-names and pinctrl-0 to SDIO node sdio@f8008400 in device-tree source file. For example:

sdio: sdio@f8008400 { : : pinctrl-names = "default"; pinctrl-0 = <&sdio_pins>; : : };

The following device-tree source of SP7350 shows definition of sub-nodes pinmux_sdio-pins of node pinctrl@f8800080.

sdio_pins: pinmux_sdio-pins { function = "SDIO"; groups = "SDIO"; };

StringSDIO is defined for the pin-group of SDIO which is mapped to GPIO [44, 45, 46, 47, 48, 49]. Refer to "Function-group Table" in Appendix.

 

  1. SPI-NOR Flash

Pins of SPI-NOR flash of SP7350, [D2, CLK, D1, D3, CSB, D0], can be multiplexed to pin-group GPIO [21, 22, 23, 24, 25, 26].

To set up pins of SPI-NOR flash, users need to add properties pinctrl-names and pinctrl-0 to SPI-NOR flash node spinor@f8000b00 in device-tree source file. For example:

sp_spinor0: spinor@f8000b00 { : : pinctrl-names = "default"; pinctrl-0 = <&spi_nor_pins>; : : };

The following device-tree source of SP7350 shows definition of sub-nodes pinmux_spi_nor-pins of node pinctrl@f8800080.

spi_nor_pins: pinmux_spi_nor-pins { function = "SPI_FLASH"; groups = "SPI_FLASH"; };

StringSPI_FLASH is defined for the pin-group of SPI-NOR FLASH which is mapped to GPIO [21, 22, 23, 24, 25, 26]. Refer to "Function-group Table" in Appendix.

 

  1. SPI-NAND Flash

Pins of SPI-NAND flash of SP7350, [D0, D2, CLK, D1, D3, CSB], can be multiplexed to either pin-group GPIO [30, 31, 32, 33, 34, 35] or pin-group GPIO [21, 22, 23, 24, 25, 26].

To set up pins of SPI-NAND flash, users need to add properties pinctrl-names and pinctrl-0 to SPI-NAND flash node spinand@f8002b80 in device-tree source file. For example:

spinand0: spinand@f8002b80 { : : pinctrl-names = "default"; pinctrl-0 = <&spi_nand_pins>; : : };

The following device-tree source of SP7350 shows definition of sub-nodes pinmux_spi_nand-pins of node pinctrl@f8800080.

spi_nand_pins: pinmux_spi_nand-pins { function = "SPI_NAND"; groups = "SPI_NAND_X1"; };

String SPI_NAND_X1 is defined for the pin-group 1 of SPI-NAND flash which is mapped to GPIO [30, 31, 32, 33, 34, 35]. Users can also use string SPI_NAND_X2 for the pin-group 2 which is mapped to GPIO [21, 22, 23, 24, 25, 26]. Refer to "Function-group Table" in Appendix.

 

  1. 8-bit NAND Flash

Pins of 8-bit NAND flash of SP7350, [RDY0, WP_B, CE_B, RE_B, CLE, ALE, WE_B, D0, D1, D2, D3, D4, D5, D6, D7], can be multiplexed to pin-group GPIO [20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36].

To set up 8-bit NAND FLASH pins, users need to add properties pinctrl-names and pinctrl-0 to 8-bit NAND flash node paranand@f8120000 in device-tree source file. For example:

paranand0: paranand@f8120000 { : : pinctrl-names = "default"; pinctrl-0 = <&para_nand_pins>; : : };

The following device-tree source of SP7350 shows definition of sub-nodes pinmux_para_nand-pins of node pinctrl@f8800080.

para_nand_pins: pinmux_para_nand-pins { function = "PARA_NAND"; groups = "PARA_NAND"; };

StringPARA_NAND is defined for the pin-group of 8-bit NAND flash which is mapped to GPIO [20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36]. Refer to "Function-group Table" in Appendix.

 

  1. UART0

Pins of UART0 of SP7350, [TXD, RXD], can be multiplexed to either pin-group GPIO [50, 51] or pin-group GPIO [68, 69].

To set up UART0 pins, users need to add properties pinctrl-names and pinctrl-0 to UART0 node serial@f8801900 in device-tree source file. For example:

uart0: serial@f8801900 { : : pinctrl-names = "default"; pinctrl-0 = <&uart0_pins>; : : };

The following device-tree source of SP7350 shows definition of sub-nodes pinmux_uart0-pins of node pinctrl@f8800080.

uart0_pins: pinmux_uart0-pins { function = "UART0"; groups = "UART0_X1"; };

StringUART0_X1 is defined for the pin-group 1 of UART0 which is mapped to GPIO [50, 51]. Users can also use string UART0_X2 is defined for the pin-group 2 which is mapped to GPIO [68, 69]. Refer to "Function-group Table" in Appendix.

 

  1. UART1

Pins of UART1 of SP7350, [TXD, RXD], can be multiplexed to either pin-group GPIO [52, 53] or pin-group GPIO [64, 65]. Flow-control pins of UART1 of SP7350, [RTS, CTS], can be multiplexed to either pin-group GPIO [54, 55] or pin-group GPIO [66, 67].

To set up UART1 pins, users need to add properties pinctrl-names and pinctrl-0 to UART1 node serial@f8801980 in device-tree source file. For example:

uart1: serial@f8801980 { : : pinctrl-names = "default"; pinctrl-0 = <&uart1_pins>; : : };

If flow-control is needed, for example:

uart1: serial@f8801980 { : : pinctrl-names = "default"; pinctrl-0 = <&uart1_pins &uart1_fc_pins>; : : };

The following device-tree source of SP7350 shows definition of sub-nodes pinmux_uart1-pins and pinmux_uart1_fc-pins of node pinctrl@f8800080.

uart1_pins: pinmux_uart1-pins { function = "UART1"; groups = "UART1_X1"; }; uart1_fc_pins: pinmux_uart1_fc-pins { function = "UART1_FC"; groups = "UART1_FC_X1"; };

StringUART1_X1 is defined for the pin-group 1 of UART1 which is mapped to GPIO [52, 53]. Users can also use stringUART1_X2 for the pin-group 2 which is mapped to GPIO [64, 65].

String "UART1_FC_X1" are defined for the pin-groups 1 of flow-control of UART1 which is mapped to GPIO [54, 55]. Users can also use string "UART1_FC_X2" for the pin-groups 2 which is mapped to GPIO [54, 55]. Refer to "Function-group Table" in Appendix.

 

  1. I2C0

Pins of I2C0 of SP7350, [CLK, DATA], can be multiplexed to either pin-group GPIO [68, 69] or pin-group GPIO [54, 55].

To set up I2C0 pins, users need to add properties pinctrl-names and pinctrl-0 to I2C0 node i2c@f8828000 in device-tree source file. For example:

i2c0: i2c@f8828000 { : : pinctrl-names = "default"; pinctrl-0 = <&i2c_combo0_pins>; : : };

The following device-tree source of SP7350 shows definition of sub-nodes

pinmux_i2c_combo0-pins of node pinctrl@f8800080.

i2c_combo0_pins: pinmux_i2c_combo0-pins { function = "I2C_COMBO0"; groups = "I2C_COMBO0_X1"; };

StringI2C_COMBO0_X1 is defined for the pin-group 1 of I2C0 which is mapped to GPIO [68, 69]. Users can also use stringI2C_COMBO0_X1 for the pin-group 2 of I2C0 which is mapped to GPIO [54, 55]. Refer to "Function-group Table" in Appendix.

 

  1. PWM

PWM0 of SP7350 can be multiplexed to either pin-group GPIO [78] or pin-group GPIO [58]. PWM1 can be multiplexed to either pin GPIO [79] or GPIO [59]. PWM2 can be multiplexed to either pin-group GPIO [60] or pin-group GPIO [92]. PWM3 can be multiplexed to either pin-group GPIO [61] or pin-group GPIO [93].

To set up PWM pins, users need to add properties pinctrl-names and pinctrl-0 to PWM node pwm@f8800d80 in device-tree source file. For example, set up PWM0:

pwm: pwm@f8800d80 { : : pinctrl-names = "default"; pinctrl-0 = <&pwm0_pins>; : : };

Or, for example, set up PWM0, PWM1, PWM2, PWM3:

pwm: pwm@f8800d80 { : : pinctrl-names = "default"; pinctrl-0 = <&pwm0_pins &pwm1_pins &pwm2_pins &pwm3_pins>; : : };

The following device-tree source of SP7350 shows definitions of sub-nodes

pinmux_pwm0-pins, pinmux_pwm1-pins, pinmux_pwm2-pins, pinmux_pwm3-pins

of node pinctrl@f8800080.

pwm0_pins: pinmux_pwm0-pins { function = "PWM0"; groups = "PWM0_X1"; }; pwm1_pins: pinmux_pwm1-pins { function = "PWM1"; groups = "PWM1_X1"; }; pwm2_pins: pinmux_pwm2-pins { function = "PWM2"; groups = "PWM2_X1"; }; pwm3_pins: pinmux_pwm3-pins { function = "PWM3"; groups = "PWM3_X1"; };

StringPWM0_X1 is defined for the pin-group 1 of PWM0 which is mapped to GPIO [78]. Users can also use stringPWM0_X2 for pin group 2 which is mapped to GPIO [58].

StringPWM1_X1 is defined for the pin-group 1 of PWM1 which is mapped to GPIO [79]. Users can also use stringPWM1_X2 for pin group 2 which is mapped to GPIO [59].

StringPWM2_X1 is defined for the pin-group 1 of PWM2 which is mapped to GPIO [60]. Users can also use stringPWM2_X2 for pin group 2 which is mapped to GPIO [92].

StringPWM3_X1 is defined for the pin-group 1 of PWM3 which is mapped to GPIO [61]. Users can also use stringPWM3_X2 for pin group 2 which is mapped to GPIO [93].

Refer to "Function-group Table" in Appendix.

pinconf

  1. One Configuration to All Pins.

Pin configuration will be applied to all pins included by property "pins" or "groups". For example:

uart0_pins: pinmux_uart0-pins { function = "UART0"; groups = "UART0_X1"; drive-strength-microamp = <SPPCTRL_DVIO_DRV_IOH_15200_IOL_18700UA>; };

"drive-strength-microamp = <SPPCTRL_DVIO_DRV_IOH_15200_IOL_18700UA>;" indicates that setting drive strength to 15.2mA on GPIO50 and GPIO51 included by group "UART0_X1".

 

  1. Different Configurations to Different Pins.

If users want to set different drive strength on GPIO50 and GPIO51 respectively,do as below:

uart0_pins: pinmux_uart0-pins { pinmux{ function = "UART0"; groups = "UART0_X1"; }; pinconf_tx { pins = "GPIO50"; drive-strength-microamp = <SPPCTRL_DVIO_DRV_IOH_15200_IOL_18700UA>; }; pinconf_rx { pins = "GPIO51"; drive-strength-microamp = <SPPCTRL_DVIO_DRV_IOH_17700_IOL_21800UA>; }; };

Other supported pin configurations are supposed to be configured in the same way.

 

Here lists some examples of pin configuration on sp7350-ev.dts:

  1. SD card with typical drive source current 17.7mA (Min: 6.5mA, Max: 34.6mA) for DVIO.

sdcard_pins: pinmux_sdcard-pins { function = "SD_CARD"; groups = "SD_CARD"; drive-strength-microamp = <SPPCTRL_DVIO_DRV_IOH_17700_IOL_21800UA>; };

 

  1. SDIO with typical drive source current 17.7mA (Min: 6.5mA, Max: 34.6mA) for DVIO.

sdio_pins: pinmux_sdio-pins { function = "SDIO"; groups = "SDIO"; drive-strength-microamp = <SPPCTRL_DVIO_DRV_IOH_17700_IOL_21800UA>; };

 

  1. GMAC

  • TXD0(GPIO7), TXD1(GPIO8), TXC(GPIO10), TXEN(GPIO11), TXD2(GPIO15), TXD3(GPIO16) with typical drive source current 16.4mA (Min: 11.3mA, Max: 21.6mA) for GPIO.

  • RXC(GPIO3), RXDV(GPIO4), RXD0(GPIO5), RXD1(GPIO6), RXD2(GPIO13), RXD3(GPIO14) with typical drive source current 8.2mA (Min: 5.7mA, Max: 10.8mA) for GPIO.

  • MDC(GPIO9), MDIO(GPIO12) with typical drive source current 8.2mA (Min: 5.7mA, Max: 10.8mA) for GPIO.

gmac_pins: pinmux_gmac-pins { pinmux{ function = "GMAC"; groups = "GMAC_RGMII"; }; pinconf0 { pins = "GPIO7","GPIO8","GPIO10","GPIO11","GPIO15","GPIO16"; drive-strength-microamp = <SPPCTRL_GPIO_DRV_IOH_16400_IOL_16500UA>; }; pinconf1 { pins = "GPIO3","GPIO4","GPIO5","GPIO6","GPIO13","GPIO14"; drive-strength-microamp = <SPPCTRL_GPIO_DRV_IOH_8200_IOL_8300UA>; }; pinconf3 { pins = "GPIO9","GPIO12"; drive-strength-microamp = <SPPCTRL_GPIO_DRV_IOH_8200_IOL_8300UA>; }; };

 

  1. eMMC with typical drive source current 17.7mA (Min: 6.5mA, Max: 34.6mA) for DVIO.

emmc_pins: pinmux_emmc-pins { function = "EMMC"; groups = "EMMC"; drive-strength-microamp = <SPPCTRL_DVIO_DRV_IOH_17700_IOL_21800UA>; };

 

  1. I2C0 with typical drive source current 15.2mA (Min: 5.6mA, Max: 29.7mA) for DVIO.

i2c_combo0_pins: pinmux_i2c_combo0-pins { function = "I2C_COMBO0"; groups = "I2C_COMBO0_X1"; drive-strength-microamp = <SPPCTRL_DVIO_DRV_IOH_15200_IOL_18700UA>; };

 

  1. I2C1 with typical drive source current 15.2mA (Min: 5.6mA, Max: 29.7mA) for DVIO.

i2c_combo1_pins: pinmux_i2c_combo1-pins { function = "I2C_COMBO1"; groups = "I2C_COMBO1"; drive-strength-microamp = <SPPCTRL_DVIO_DRV_IOH_15200_IOL_18700UA>; };

 

  1. I2C2 with typical drive source current 15.2mA (Min: 5.6mA, Max: 29.7mA) for DVIO.

i2c_combo2_pins: pinmux_i2c_combo2-pins { function = "I2C_COMBO2"; groups = "I2C_COMBO2_X1"; drive-strength-microamp = <SPPCTRL_DVIO_DRV_IOH_15200_IOL_18700UA>; };

 

  1. I2C3 with typical drive source current 9.9mA (Min: 6.8mA, Max: 13.0mA) for GPIO.

i2c_combo3_pins: pinmux_i2c_combo3-pins { function = "I2C_COMBO3"; groups = "I2C_COMBO3"; drive-strength-microamp = <SPPCTRL_GPIO_DRV_IOH_9900_IOL_9900UA>; };

 

  1. I2C6 with typical drive source current 16.4mA (Min: 11.3mA, Max: 21.6mA) for GPIO.

i2c_combo6_pins: pinmux_i2c_combo6-pins { function = "I2C_COMBO6"; groups = "I2C_COMBO6_X1"; drive-strength-microamp = <SPPCTRL_GPIO_DRV_IOH_16400_IOL_16500UA>; };

 

  1. I2C7 with typical drive source current 9.9mA (Min: 6.8mA, Max: 13.0mA) for GPIO.

i2c_combo7_pins: pinmux_i2c_combo7-pins { function = "I2C_COMBO7"; groups = "I2C_COMBO7_X1"; drive-strength-microamp = <SPPCTRL_GPIO_DRV_IOH_9900_IOL_9900UA>; };

 

  1. UART0 with typical drive source current 15.2mA (Min: 5.6mA, Max: 29.7mA) for DVIO.

uart0_pins: pinmux_uart0-pins { function = "UART0"; groups = "UART0_X1"; drive-strength-microamp = <SPPCTRL_DVIO_DRV_IOH_15200_IOL_18700UA>; };

 

  1. UART1 with typical drive source current 15.2mA (Min: 5.6mA, Max: 29.7mA) for DVIO.

uart1_pins: pinmux_uart1-pins { function = "UART1"; groups = "UART1_X1"; drive-strength-microamp = <SPPCTRL_DVIO_DRV_IOH_15200_IOL_18700UA>; };

 

  1. UART2 with typical drive source current 15.2mA (Min: 5.6mA, Max: 29.7mA) for DVIO.

uart2_pins: pinmux_uart2-pins { function = "UART2"; groups = "UART2_X1"; drive-strength-microamp = <SPPCTRL_DVIO_DRV_IOH_15200_IOL_18700UA>; };

 

  1. UART3 with typical drive source current 15.2mA (Min: 5.6mA, Max: 29.7mA) for DVIO.

uart3_pins: pinmux_uart3-pins { function = "UART3"; groups = "UART3_X1"; drive-strength-microamp = <SPPCTRL_DVIO_DRV_IOH_15200_IOL_18700UA>; };

 

  1. UADBG with typical drive source current 6.6mA (Min: 4.5mA, Max: 8.6mA) for GPIO.

uadbg_pins: pinmux_uadbg-pins { function = "UADBG"; groups = "UADBG"; drive-strength-microamp = <SPPCTRL_GPIO_DRV_IOH_6600_IOL_6600UA>; };

 

  1. UART6 with typical drive source current 6.6mA (Min: 4.5mA, Max: 8.6mA) for GPIO.

uart6_pins: pinmux_uart6-pins { function = "UART6"; groups = "UART6_X1"; drive-strength-microamp = <SPPCTRL_GPIO_DRV_IOH_6600_IOL_6600UA>; };

 

  1. UART7 with typical drive source current 6.6mA (Min: 4.5mA, Max: 8.6mA) for GPIO.

uart7_pins: pinmux_uart7-pins { function = "UART7"; groups = "UART7"; drive-strength-microamp = <SPPCTRL_GPIO_DRV_IOH_6600_IOL_6600UA>; };

 

Refer to Driving-strength Table of GPIO and Driving-strength Table of DVIO in Appendix.

Appendix

List of Support Properties

Properties

Values

Descriptions

bias-disable

NA

Disable pull-up, pull-down and strong pull-up

bias-high-impedance

NA

 

bias-pull-up

NA

 

bias-pull-down

NA

 

drive-open-drain

NA

For GPIO or DVIO

drive-strength-microamp

Refer to Driving-strength Table of GPIO and DVIO.

function

Refer to Function-group Table

groups

Refer to Function-group Table

input-disable

NA

For GPIO or DVIO

input-enable

NA

For GPIO or DVIO

input-schmitt-disable

NA

 

input-schmitt-enable

NA

 

output-disable

NA

For GPIO or DVIO

output-enable

NA

For GPIO or DVIO