18c2ecf20Sopenharmony_ci* Mediatek MT65XX Pin Controller
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciThe Mediatek's Pin controller is used to control SoC pins.
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ciRequired properties:
68c2ecf20Sopenharmony_ci- compatible: value should be one of the following.
78c2ecf20Sopenharmony_ci	"mediatek,mt2701-pinctrl", compatible with mt2701 pinctrl.
88c2ecf20Sopenharmony_ci	"mediatek,mt2712-pinctrl", compatible with mt2712 pinctrl.
98c2ecf20Sopenharmony_ci	"mediatek,mt6397-pinctrl", compatible with mt6397 pinctrl.
108c2ecf20Sopenharmony_ci	"mediatek,mt7623-pinctrl", compatible with mt7623 pinctrl.
118c2ecf20Sopenharmony_ci	"mediatek,mt8127-pinctrl", compatible with mt8127 pinctrl.
128c2ecf20Sopenharmony_ci	"mediatek,mt8135-pinctrl", compatible with mt8135 pinctrl.
138c2ecf20Sopenharmony_ci	"mediatek,mt8167-pinctrl", compatible with mt8167 pinctrl.
148c2ecf20Sopenharmony_ci	"mediatek,mt8173-pinctrl", compatible with mt8173 pinctrl.
158c2ecf20Sopenharmony_ci	"mediatek,mt8516-pinctrl", compatible with mt8516 pinctrl.
168c2ecf20Sopenharmony_ci- pins-are-numbered: Specify the subnodes are using numbered pinmux to
178c2ecf20Sopenharmony_ci  specify pins.
188c2ecf20Sopenharmony_ci- gpio-controller : Marks the device node as a gpio controller.
198c2ecf20Sopenharmony_ci- #gpio-cells: number of cells in GPIO specifier. Since the generic GPIO
208c2ecf20Sopenharmony_ci  binding is used, the amount of cells must be specified as 2. See the below
218c2ecf20Sopenharmony_ci  mentioned gpio binding representation for description of particular cells.
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci	Eg: <&pio 6 0>
248c2ecf20Sopenharmony_ci	<[phandle of the gpio controller node]
258c2ecf20Sopenharmony_ci	[line number within the gpio controller]
268c2ecf20Sopenharmony_ci	[flags]>
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci	Values for gpio specifier:
298c2ecf20Sopenharmony_ci	- Line number: is a value between 0 to 202.
308c2ecf20Sopenharmony_ci	- Flags:  bit field of flags, as defined in <dt-bindings/gpio/gpio.h>.
318c2ecf20Sopenharmony_ci            Only the following flags are supported:
328c2ecf20Sopenharmony_ci            0 - GPIO_ACTIVE_HIGH
338c2ecf20Sopenharmony_ci            1 - GPIO_ACTIVE_LOW
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ciOptional properties:
368c2ecf20Sopenharmony_ci- mediatek,pctl-regmap: Should be a phandle of the syscfg node.
378c2ecf20Sopenharmony_ci- reg: physicall address base for EINT registers
388c2ecf20Sopenharmony_ci- interrupt-controller: Marks the device node as an interrupt controller
398c2ecf20Sopenharmony_ci- #interrupt-cells: Should be two.
408c2ecf20Sopenharmony_ci- interrupts : The interrupt outputs from the controller.
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ciPlease refer to pinctrl-bindings.txt in this directory for details of the
438c2ecf20Sopenharmony_cicommon pinctrl bindings used by client devices.
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ciSubnode format
468c2ecf20Sopenharmony_ciA pinctrl node should contain at least one subnodes representing the
478c2ecf20Sopenharmony_cipinctrl groups available on the machine. Each subnode will list the
488c2ecf20Sopenharmony_cipins it needs, and how they should be configured, with regard to muxer
498c2ecf20Sopenharmony_ciconfiguration, pullups, drive strength, input enable/disable and input schmitt.
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci    node {
528c2ecf20Sopenharmony_ci	pinmux = <PIN_NUMBER_PINMUX>;
538c2ecf20Sopenharmony_ci	GENERIC_PINCONFIG;
548c2ecf20Sopenharmony_ci    };
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ciRequired properties:
578c2ecf20Sopenharmony_ci- pinmux: integer array, represents gpio pin number and mux setting.
588c2ecf20Sopenharmony_ci    Supported pin number and mux varies for different SoCs, and are defined
598c2ecf20Sopenharmony_ci    as macros in boot/dts/<soc>-pinfunc.h directly.
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ciOptional properties:
628c2ecf20Sopenharmony_ci- GENERIC_PINCONFIG: is the generic pinconfig options to use, bias-disable,
638c2ecf20Sopenharmony_ci    bias-pull-down, bias-pull-up, input-enable, input-disable, output-low, output-high,
648c2ecf20Sopenharmony_ci    input-schmitt-enable, input-schmitt-disable and drive-strength are valid.
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci    Some special pins have extra pull up strength, there are R0 and R1 pull-up
678c2ecf20Sopenharmony_ci    resistors available, but for user, it's only need to set R1R0 as 00, 01, 10 or 11.
688c2ecf20Sopenharmony_ci    So when config bias-pull-up, it support arguments for those special pins.
698c2ecf20Sopenharmony_ci    Some macros have been defined for this usage, such as MTK_PUPD_SET_R1R0_00.
708c2ecf20Sopenharmony_ci    See dt-bindings/pinctrl/mt65xx.h.
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci    When config drive-strength, it can support some arguments, such as
738c2ecf20Sopenharmony_ci    MTK_DRIVE_4mA, MTK_DRIVE_6mA, etc. See dt-bindings/pinctrl/mt65xx.h.
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ciExamples:
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci#include "mt8135-pinfunc.h"
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci...
808c2ecf20Sopenharmony_ci{
818c2ecf20Sopenharmony_ci	syscfg_pctl_a: syscfg-pctl-a@10005000 {
828c2ecf20Sopenharmony_ci		compatible = "mediatek,mt8135-pctl-a-syscfg", "syscon";
838c2ecf20Sopenharmony_ci		reg = <0 0x10005000 0 0x1000>;
848c2ecf20Sopenharmony_ci	};
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci	syscfg_pctl_b: syscfg-pctl-b@1020c020 {
878c2ecf20Sopenharmony_ci		compatible = "mediatek,mt8135-pctl-b-syscfg", "syscon";
888c2ecf20Sopenharmony_ci		reg = <0 0x1020C020 0 0x1000>;
898c2ecf20Sopenharmony_ci	};
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci	pinctrl@1c20800 {
928c2ecf20Sopenharmony_ci		compatible = "mediatek,mt8135-pinctrl";
938c2ecf20Sopenharmony_ci		reg = <0 0x1000B000 0 0x1000>;
948c2ecf20Sopenharmony_ci		mediatek,pctl-regmap = <&syscfg_pctl_a &syscfg_pctl_b>;
958c2ecf20Sopenharmony_ci		pins-are-numbered;
968c2ecf20Sopenharmony_ci		gpio-controller;
978c2ecf20Sopenharmony_ci		#gpio-cells = <2>;
988c2ecf20Sopenharmony_ci		interrupt-controller;
998c2ecf20Sopenharmony_ci		#interrupt-cells = <2>;
1008c2ecf20Sopenharmony_ci		interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>,
1018c2ecf20Sopenharmony_ci				<GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>,
1028c2ecf20Sopenharmony_ci				<GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>;
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci		i2c0_pins_a: i2c0@0 {
1058c2ecf20Sopenharmony_ci			pins1 {
1068c2ecf20Sopenharmony_ci				pinmux = <MT8135_PIN_100_SDA0__FUNC_SDA0>,
1078c2ecf20Sopenharmony_ci					 <MT8135_PIN_101_SCL0__FUNC_SCL0>;
1088c2ecf20Sopenharmony_ci				bias-disable;
1098c2ecf20Sopenharmony_ci			};
1108c2ecf20Sopenharmony_ci		};
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci		i2c1_pins_a: i2c1@0 {
1138c2ecf20Sopenharmony_ci			pins {
1148c2ecf20Sopenharmony_ci				pinmux = <MT8135_PIN_195_SDA1__FUNC_SDA1>,
1158c2ecf20Sopenharmony_ci					 <MT8135_PIN_196_SCL1__FUNC_SCL1>;
1168c2ecf20Sopenharmony_ci				bias-pull-up = <55>;
1178c2ecf20Sopenharmony_ci			};
1188c2ecf20Sopenharmony_ci		};
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci		i2c2_pins_a: i2c2@0 {
1218c2ecf20Sopenharmony_ci			pins1 {
1228c2ecf20Sopenharmony_ci				pinmux = <MT8135_PIN_193_SDA2__FUNC_SDA2>;
1238c2ecf20Sopenharmony_ci				bias-pull-down;
1248c2ecf20Sopenharmony_ci			};
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci			pins2 {
1278c2ecf20Sopenharmony_ci				pinmux = <MT8135_PIN_49_WATCHDOG__FUNC_GPIO49>;
1288c2ecf20Sopenharmony_ci				bias-pull-up;
1298c2ecf20Sopenharmony_ci			};
1308c2ecf20Sopenharmony_ci		};
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_ci		i2c3_pins_a: i2c3@0 {
1338c2ecf20Sopenharmony_ci			pins1 {
1348c2ecf20Sopenharmony_ci				pinmux = <MT8135_PIN_40_DAC_CLK__FUNC_GPIO40>,
1358c2ecf20Sopenharmony_ci					 <MT8135_PIN_41_DAC_WS__FUNC_GPIO41>;
1368c2ecf20Sopenharmony_ci				bias-pull-up = <55>;
1378c2ecf20Sopenharmony_ci			};
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci			pins2 {
1408c2ecf20Sopenharmony_ci				pinmux = <MT8135_PIN_35_SCL3__FUNC_SCL3>,
1418c2ecf20Sopenharmony_ci					 <MT8135_PIN_36_SDA3__FUNC_SDA3>;
1428c2ecf20Sopenharmony_ci				output-low;
1438c2ecf20Sopenharmony_ci				bias-pull-up = <55>;
1448c2ecf20Sopenharmony_ci			};
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci			pins3 {
1478c2ecf20Sopenharmony_ci				pinmux = <MT8135_PIN_57_JTCK__FUNC_GPIO57>,
1488c2ecf20Sopenharmony_ci					 <MT8135_PIN_60_JTDI__FUNC_JTDI>;
1498c2ecf20Sopenharmony_ci				drive-strength = <32>;
1508c2ecf20Sopenharmony_ci			};
1518c2ecf20Sopenharmony_ci		};
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci		...
1548c2ecf20Sopenharmony_ci	}
1558c2ecf20Sopenharmony_ci};
156