18c2ecf20Sopenharmony_ci* Freescale MXS Pin Controller
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciThe pins controlled by mxs pin controller are organized in banks, each bank
48c2ecf20Sopenharmony_cihas 32 pins.  Each pin has 4 multiplexing functions, and generally, the 4th
58c2ecf20Sopenharmony_cifunction is GPIO.  The configuration on the pins includes drive strength,
68c2ecf20Sopenharmony_civoltage and pull-up.
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ciRequired properties:
98c2ecf20Sopenharmony_ci- compatible: "fsl,imx23-pinctrl" or "fsl,imx28-pinctrl"
108c2ecf20Sopenharmony_ci- reg: Should contain the register physical address and length for the
118c2ecf20Sopenharmony_ci  pin controller.
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciPlease refer to pinctrl-bindings.txt in this directory for details of the
148c2ecf20Sopenharmony_cicommon pinctrl bindings used by client devices.
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ciThe node of mxs pin controller acts as a container for an arbitrary number of
178c2ecf20Sopenharmony_cisubnodes.  Each of these subnodes represents some desired configuration for
188c2ecf20Sopenharmony_cia group of pins, and only affects those parameters that are explicitly listed.
198c2ecf20Sopenharmony_ciIn other words, a subnode that describes a drive strength parameter implies no
208c2ecf20Sopenharmony_ciinformation about pull-up. For this reason, even seemingly boolean values are
218c2ecf20Sopenharmony_ciactually tristates in this binding: unspecified, off, or on. Unspecified is
228c2ecf20Sopenharmony_cirepresented as an absent property, and off/on are represented as integer
238c2ecf20Sopenharmony_civalues 0 and 1.
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ciThose subnodes under mxs pin controller node will fall into two categories.
268c2ecf20Sopenharmony_ciOne is to set up a group of pins for a function, both mux selection and pin
278c2ecf20Sopenharmony_ciconfigurations, and it's called group node in the binding document.   The other
288c2ecf20Sopenharmony_cione is to adjust the pin configuration for some particular pins that need a
298c2ecf20Sopenharmony_cidifferent configuration than what is defined in group node.  The binding
308c2ecf20Sopenharmony_cidocument calls this type of node config node.
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ciOn mxs, there is no hardware pin group. The pin group in this binding only
338c2ecf20Sopenharmony_cimeans a group of pins put together for particular peripheral to work in
348c2ecf20Sopenharmony_ciparticular function, like SSP0 functioning as mmc0-8bit.  That said, the
358c2ecf20Sopenharmony_cigroup node should include all the pins needed for one function rather than
368c2ecf20Sopenharmony_cihaving these pins defined in several group nodes.  It also means each of
378c2ecf20Sopenharmony_ci"pinctrl-*" phandle in client device node should only have one group node
388c2ecf20Sopenharmony_cipointed in there, while the phandle can have multiple config node referenced
398c2ecf20Sopenharmony_cithere to adjust configurations for some pins in the group.
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciRequired subnode-properties:
428c2ecf20Sopenharmony_ci- fsl,pinmux-ids: An integer array.  Each integer in the array specify a pin
438c2ecf20Sopenharmony_ci  with given mux function, with bank, pin and mux packed as below.
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci    [15..12] : bank number
468c2ecf20Sopenharmony_ci    [11..4]  : pin number
478c2ecf20Sopenharmony_ci    [3..0]   : mux selection
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci  This integer with mux selection packed is used as an entity by both group
508c2ecf20Sopenharmony_ci  and config nodes to identify a pin.  The mux selection in the integer takes
518c2ecf20Sopenharmony_ci  effects only on group node, and will get ignored by driver with config node,
528c2ecf20Sopenharmony_ci  since config node is only meant to set up pin configurations.
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci  Valid values for these integers are listed below.
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci- reg: Should be the index of the group nodes for same function.  This property
578c2ecf20Sopenharmony_ci  is required only for group nodes, and should not be present in any config
588c2ecf20Sopenharmony_ci  nodes.
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ciOptional subnode-properties:
618c2ecf20Sopenharmony_ci- fsl,drive-strength: Integer.
628c2ecf20Sopenharmony_ci    0: MXS_DRIVE_4mA
638c2ecf20Sopenharmony_ci    1: MXS_DRIVE_8mA
648c2ecf20Sopenharmony_ci    2: MXS_DRIVE_12mA
658c2ecf20Sopenharmony_ci    3: MXS_DRIVE_16mA
668c2ecf20Sopenharmony_ci- fsl,voltage: Integer.
678c2ecf20Sopenharmony_ci    0: MXS_VOLTAGE_LOW  - 1.8 V
688c2ecf20Sopenharmony_ci    1: MXS_VOLTAGE_HIGH - 3.3 V
698c2ecf20Sopenharmony_ci- fsl,pull-up: Integer.
708c2ecf20Sopenharmony_ci    0: MXS_PULL_DISABLE - Disable the internal pull-up
718c2ecf20Sopenharmony_ci    1: MXS_PULL_ENABLE  - Enable the internal pull-up
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ciNote that when enabling the pull-up, the internal pad keeper gets disabled.
748c2ecf20Sopenharmony_ciAlso, some pins doesn't have a pull up, in that case, setting the fsl,pull-up
758c2ecf20Sopenharmony_ciwill only disable the internal pad keeper.
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ciExamples:
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_cipinctrl@80018000 {
808c2ecf20Sopenharmony_ci	#address-cells = <1>;
818c2ecf20Sopenharmony_ci	#size-cells = <0>;
828c2ecf20Sopenharmony_ci	compatible = "fsl,imx28-pinctrl";
838c2ecf20Sopenharmony_ci	reg = <0x80018000 2000>;
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci	mmc0_8bit_pins_a: mmc0-8bit@0 {
868c2ecf20Sopenharmony_ci		reg = <0>;
878c2ecf20Sopenharmony_ci		fsl,pinmux-ids = <
888c2ecf20Sopenharmony_ci			MX28_PAD_SSP0_DATA0__SSP0_D0
898c2ecf20Sopenharmony_ci			MX28_PAD_SSP0_DATA1__SSP0_D1
908c2ecf20Sopenharmony_ci			MX28_PAD_SSP0_DATA2__SSP0_D2
918c2ecf20Sopenharmony_ci			MX28_PAD_SSP0_DATA3__SSP0_D3
928c2ecf20Sopenharmony_ci			MX28_PAD_SSP0_DATA4__SSP0_D4
938c2ecf20Sopenharmony_ci			MX28_PAD_SSP0_DATA5__SSP0_D5
948c2ecf20Sopenharmony_ci			MX28_PAD_SSP0_DATA6__SSP0_D6
958c2ecf20Sopenharmony_ci			MX28_PAD_SSP0_DATA7__SSP0_D7
968c2ecf20Sopenharmony_ci			MX28_PAD_SSP0_CMD__SSP0_CMD
978c2ecf20Sopenharmony_ci			MX28_PAD_SSP0_DETECT__SSP0_CARD_DETECT
988c2ecf20Sopenharmony_ci			MX28_PAD_SSP0_SCK__SSP0_SCK
998c2ecf20Sopenharmony_ci		>;
1008c2ecf20Sopenharmony_ci		fsl,drive-strength = <MXS_DRIVE_4mA>;
1018c2ecf20Sopenharmony_ci		fsl,voltage = <MXS_VOLTAGE_HIGH>;
1028c2ecf20Sopenharmony_ci		fsl,pull-up = <MXS_PULL_ENABLE>;
1038c2ecf20Sopenharmony_ci	};
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci	mmc_cd_cfg: mmc-cd-cfg {
1068c2ecf20Sopenharmony_ci		fsl,pinmux-ids = <MX28_PAD_SSP0_DETECT__SSP0_CARD_DETECT>;
1078c2ecf20Sopenharmony_ci		fsl,pull-up = <MXS_PULL_DISABLE>;
1088c2ecf20Sopenharmony_ci	};
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci	mmc_sck_cfg: mmc-sck-cfg {
1118c2ecf20Sopenharmony_ci		fsl,pinmux-ids = <MX28_PAD_SSP0_SCK__SSP0_SCK>;
1128c2ecf20Sopenharmony_ci		fsl,drive-strength = <MXS_DRIVE_12mA>;
1138c2ecf20Sopenharmony_ci		fsl,pull-up = <MXS_PULL_DISABLE>;
1148c2ecf20Sopenharmony_ci	};
1158c2ecf20Sopenharmony_ci};
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ciIn this example, group node mmc0-8bit defines a group of pins for mxs SSP0
1188c2ecf20Sopenharmony_cito function as a 8-bit mmc device, with 8mA, 3.3V and pull-up configurations
1198c2ecf20Sopenharmony_ciapplied on all these pins.  And config nodes mmc-cd-cfg and mmc-sck-cfg are
1208c2ecf20Sopenharmony_ciadjusting the configuration for pins card-detection and clock from what group
1218c2ecf20Sopenharmony_cinode mmc0-8bit defines.  Only the configuration properties to be adjusted need
1228c2ecf20Sopenharmony_cito be listed in the config nodes.
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ciValid values for i.MX28/i.MX23 pinmux-id are defined in
1258c2ecf20Sopenharmony_ciarch/arm/boot/dts/imx28-pinfunc.h and arch/arm/boot/dts/imx23-pinfunc.h.
1268c2ecf20Sopenharmony_ciThe definitions for the padconfig properties can be found in
1278c2ecf20Sopenharmony_ciarch/arm/boot/dts/mxs-pinfunc.h.
128