Overview
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.
...
SP7350 has 106 GPIO pins. ID is from 0 to 105. Name is in form of GPIO(id), like GPIO0, GPIO1, GPIO2, GPIO99, GPIO105, and etc. There are two kinds of GPIO pins. One is 1.8V GPIO pins, and the other is 1.8V/3.0V Dual Voltage IO (DVIO) pins. Beside configure 1.8V or 3.0V power to power supply of a DVIO group in your circuit boards (hardware), you need to setup MS control in device-tree source. Refer to groups of GPIO and DVIO in appendix GPIO Table below in details.
...
We define a bunch of groups as listed in appendix Function-group Table below.
pinmux
Panel | ||||||
---|---|---|---|---|---|---|
| ||||||
Here we only list the generic pinmux methods supported by SP7350. |
Set a single pin to function "GPIO"
...
Voltage Mode Select
For 1.8V/3.0V Dual Voltage IO (DVIO) pins,we offer several properties to select their voltage in pinctrl node in DTS file.
property | 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. |
pinmux
Panel | ||||||
---|---|---|---|---|---|---|
| ||||||
Here we only list the generic pinmux methods supported by SP7350. |
Set a single pin to function "GPIO"
set "GPIO0" to function"GPIO"
Code Block | ||
---|---|---|
| ||
pinmux_example {
function = "GPIO";
pins = "GPIO0";
}; |
Set several pins to function "GPIO"
set "GPIO0" and "GPIO1" to function"GPIO"
Code Block | ||
---|---|---|
| ||
pinmux_example { function = "GPIO"; pins = "GPIOGPIO0", "GPIO1"; }; |
Set a group of pins to a particular function
set group "UART0_X1" to function "UART0"
Code Block | ||
---|---|---|
| ||
pinmux_example { function = "UART0"; pinsgroup = "GPIO0UART0_X1"; }; |
Set several pins to function "GPIO"
...
pinconf
Info |
---|
Here we only list the generic pin configuration parameters supported by SP7350. |
bias-disable
description
Disable any pin bias on the pin.
argument
The argument is ignored.
usage
Code Block | ||
---|---|---|
| ||
pinmuxpinconf_example { : function : = "GPIO" bias-disable; pins = "GPIO0", "GPIO1"; }; |
Set a group of pins to a particular function
set group "UART0_X1" to function "UART0"
:
:
}; |
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
Code Block | ||
---|---|---|
| ||
pinmuxpinconf_example { : : function = "UART0"; bias-high-impedance; : group = "UART0_X1"; : }; |
pinconf
Info |
---|
Here we only list the generic pin configuration parameters supported by SP7350. |
bias-pull-
...
up
description
Disable any pin bias on the pinThe pin will be pulled up.
argument
The argument is ignored.
...
Code Block | ||
---|---|---|
| ||
pinconf_example { : : bias-pull-disableup; : : }; |
bias-
...
pull-
...
down
description
The pin will be set to a high impedance mode, also know as "third-state" (tri-state) or "high-Z" or "floating"pulled down.
argument
The argument is ignored.
...
Code Block | ||
---|---|---|
| ||
pinconf_example { : : bias-highpull-impedancedown; : : }; |
...
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.
...
Code Block | ||
---|---|---|
| ||
pinconf_example { : : biasdrive-pullopen-updrain; : : }; |
...
drive-
...
strength-
...
microamp
description
The pin will be pulled downsink or source at most the current passed as argument.
argument
The argument is ignoredin uA.
See linux/kernel/include/dt-bindings/pinctrl/sppctl-config-sp7350.h for selectable argument.
usage
Code Block | ||
---|---|---|
| ||
pinconf_example { : : bias-pull-down; :/* source current 1100uA for GPIO*/ : };drive- |
...
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
strength-microamp = <SPPCTRL_GPIO_DRV_IOH_1100_IOL_1100UA>;
:
:
}; |
Code Block | ||
---|---|---|
| ||
pinconf_example { : : /* source current 5100uA for DVIO*/ drive-open-drainstrength-microamp = <SPPCTRL_DVIO_DRV_IOH_5100_IOL_6200UA>; : : }; |
...
input-
...
enable
description
The pin will sink or source at most the current passed as argumentEnable the pin's input.
argument
The argument is in uA.See linux/kernel/include/dt-bindings/pinctrl/sppctl-config-sp7350.h for selectable argumentargument is ignored.
usage
Code Block | ||
---|---|---|
| ||
pinconf_example { : : /* source current 1100uA for GPIO*/ drive-strength-microamp = <SPPCTRL_GPIO_DRV_IOH_1100_IOL_1100UA>input-enable; : : }; |
input-disable
description
Disable the pin's input.
argument
The argument is ignored.
usage
Code Block | ||
---|---|---|
| ||
pinconf_example { : : /* source current 5100uA for DVIO*/ drive-strength-microamp = <SPPCTRL_DVIO_DRV_IOH_5100_IOL_6200UA>input-disable; : : }; |
input-schmitt-enable
description
...
This will configure an input pin to run in Schmitt-trigger mode.
argument
The argument is ignored.
...
Code Block | ||
---|---|---|
| ||
pinconf_example {
:
:
input-schmitt-enable;
:
:
}; |
input-schmitt-disable
description
Disable This will disable the pin's inputSchmitt-trigger mode.
argument
The argument is ignored.
...
Code Block | ||
---|---|---|
| ||
pinconf_example {
:
:
input-schmitt-disable;
:
:
}; |
...
output-enable
description
This will configure an input pin to run in Schmitt-trigger modeenable the pin's output mode without driving a value there.
argument
The argument is ignored.
...
Code Block | ||
---|---|---|
| ||
pinconf_example { : : inputoutput-schmitt-enable; : : }; |
...
output-disable
description
This will disable the pin's Schmitt-trigger output mode.
argument
The argument is ignored.
...
Code Block | ||
---|---|---|
| ||
pinconf_example { : : input-schmittoutput-disable; : : }; |
output-
...
high
description
This will enable configure the pin 's output mode without driving a value thereas output and drive high level on the line.
argument
The argument is ignored.
...
Code Block | ||
---|---|---|
| ||
pinconf_example { : : output-enablehigh; : : }; |
output-
...
low
description
This will disable configure the pin 's output modeas output and drive low level on the line.
argument
The argument is ignored.
...
Code Block | ||
---|---|---|
| ||
pinconf_example { : : output-disablelow; : : }; |
...
sunplus,input-invert-enable
description
This will configure invert the pin as output and drive high level on the line's input value. High level as 0, Low level as 1.
argument
The argument is ignored.
...
Code Block | ||
---|---|---|
| ||
pinconf_example { : : output-highsunplus,input-invert-enable; : : }; |
sunplus,output-invert-
...
enable
description
This will configure invert the pin as output and drive low level on the line's output value. 1 as low level, 0 as high level.
argument
The argument is ignored.
...
Code Block | ||
---|---|---|
| ||
pinconf_example { : : sunplus,output-lowinvert-enable; : : }; |
sunplus,input-invert-
...
disable
description
This will invert normalize the pin's input value. High level as 01, Low level as 10.
argument
The argument is ignored.
...
Code Block | ||
---|---|---|
| ||
pinconf_example { : : sunplus,input-invert-enabledisable; : : }; |
sunplus,output-invert-
...
disable
description
This will invert normalize the pin's output value. 1 as low high level, 0 as high low level.
argument
The argument is ignored.
...
Code Block | ||
---|---|---|
| ||
pinconf_example { : : sunplus,output-invert-enabledisable; : : }; |
sunplus,
...
bias-strong-
...
pull-
...
up
description
This will normalize the pin's input value. High level as 1, Low level as 0The pin will be pulled up strongly.
Note |
---|
For GPIO only, excluding DVIO. |
argument
The argument is ignored.
...
Code Block | ||
---|---|---|
| ||
pinconf_example { : : sunplus,inputbias-strong-invertpull-disableup; : : }; |
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
...
language | c |
---|
...
DTS
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 EVB | sp7350-ev.dts |
Example
Voltage Mode
For 1.8V/3.0V Dual Voltage IO (DVIO) pins,we need to select their voltage in pinctrl top node in DTS file. As below:
Code Block | ||
---|---|---|
| ||
pctl: pinctrl@f8800080 { compatible = "sunplus,sp7350-pctl"; : : sunplus,outputms-dvio-invert-disablegroup-0 = "1V8"; : sunplus,ms-dvio-group-1 = "1V8"; : };sunplus, |
...
ms- |
...
dvio- |
...
description
The pin will be pulled up strongly.
Note |
---|
For GPIO only, excluding DVIO. |
argument
The argument is ignored.
usage
Code Block | ||
---|---|---|
| ||
pinconf_example { : :ao-group-0 = "1V8"; sunplus,ms-dvio-ao-group-1 = "3V0"; sunplus,biasms-dvio-strongao-pull-upgroup-2 = "3V0"; : : }; |
DTS
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 EVB | sp7350-ev.dts |
...
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.
...