Commit 07f08d9c authored by Heiko Stuebner's avatar Heiko Stuebner
Browse files

ARM: dts: rockchip: bulk convert gpios to their constant counterparts



Rockchip SoCs use 2 different numbering schemes. Where the gpio-
controllers just count 0-31 for their 32 gpios, the underlying
iomux controller splits these into 4 separate entities A-D.

Device-schematics always use these iomux-values to identify pins,
so to make mapping schematics to devicetree easier Andy Yan introduced
named constants for the pins but so far we only used them on new
additions.

Using a sed-script created by Emil Renner Berthing bulk-convert
the remaining raw gpio numbers into their descriptive counterparts
and also gets rid of the unhelpful RK_FUNC_x -> x and RK_GPIOx -> x
mappings:

/rockchip,pins *=/bcheck
b # to end of script
:append-next-line
N
:check
/^[^;]*$/bappend-next-line
s/<RK_GPIO\([0-9]\) /<\1 /g
s/<\([^ ][^ ]*  *\)0 /<\1RK_PA0 /g
s/<\([^ ][^ ]*  *\)1 /<\1RK_PA1 /g
s/<\([^ ][^ ]*  *\)2 /<\1RK_PA2 /g
s/<\([^ ][^ ]*  *\)3 /<\1RK_PA3 /g
s/<\([^ ][^ ]*  *\)4 /<\1RK_PA4 /g
s/<\([^ ][^ ]*  *\)5 /<\1RK_PA5 /g
s/<\([^ ][^ ]*  *\)6 /<\1RK_PA6 /g
s/<\([^ ][^ ]*  *\)7 /<\1RK_PA7 /g
s/<\([^ ][^ ]*  *\)8 /<\1RK_PB0 /g
s/<\([^ ][^ ]*  *\)9 /<\1RK_PB1 /g
s/<\([^ ][^ ]*  *\)10 /<\1RK_PB2 /g
s/<\([^ ][^ ]*  *\)11 /<\1RK_PB3 /g
s/<\([^ ][^ ]*  *\)12 /<\1RK_PB4 /g
s/<\([^ ][^ ]*  *\)13 /<\1RK_PB5 /g
s/<\([^ ][^ ]*  *\)14 /<\1RK_PB6 /g
s/<\([^ ][^ ]*  *\)15 /<\1RK_PB7 /g
s/<\([^ ][^ ]*  *\)16 /<\1RK_PC0 /g
s/<\([^ ][^ ]*  *\)17 /<\1RK_PC1 /g
s/<\([^ ][^ ]*  *\)18 /<\1RK_PC2 /g
s/<\([^ ][^ ]*  *\)19 /<\1RK_PC3 /g
s/<\([^ ][^ ]*  *\)20 /<\1RK_PC4 /g
s/<\([^ ][^ ]*  *\)21 /<\1RK_PC5 /g
s/<\([^ ][^ ]*  *\)22 /<\1RK_PC6 /g
s/<\([^ ][^ ]*  *\)23 /<\1RK_PC7 /g
s/<\([^ ][^ ]*  *\)24 /<\1RK_PD0 /g
s/<\([^ ][^ ]*  *\)25 /<\1RK_PD1 /g
s/<\([^ ][^ ]*  *\)26 /<\1RK_PD2 /g
s/<\([^ ][^ ]*  *\)27 /<\1RK_PD3 /g
s/<\([^ ][^ ]*  *\)28 /<\1RK_PD4 /g
s/<\([^ ][^ ]*  *\)29 /<\1RK_PD5 /g
s/<\([^ ][^ ]*  *\)30 /<\1RK_PD6 /g
s/<\([^ ][^ ]*  *\)31 /<\1RK_PD7 /g
s/<\([^ ][^ ]*  *[^ ][^ ]*  *\)0 /<\1RK_FUNC_GPIO /g
s/<\([^ ][^ ]*  *[^ ][^ ]*  *\)RK_FUNC_\([1-9]\) /<\1\2 /g

Suggested-by: default avatarEmil Renner Berthing <esmil@mailme.dk>
Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
parent 280fa349
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -368,31 +368,31 @@
&pinctrl {
	leds {
		led_ctl: led-ctl {
			rockchip,pins = <2 30 RK_FUNC_GPIO &pcfg_pull_none>;
			rockchip,pins = <2 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	pmic {
		pmic_int: pmic-int {
			rockchip,pins = <2 2 RK_FUNC_GPIO &pcfg_pull_default>;
			rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_default>;
		};
	};

	sdio {
		bt_wake_h: bt-wake-h {
			rockchip,pins = <2 8 RK_FUNC_GPIO &pcfg_pull_default>;
			rockchip,pins = <2 RK_PB0 RK_FUNC_GPIO &pcfg_pull_default>;
		};
	};

	sdmmc {
		sdmmc_pwr: sdmmc-pwr {
			rockchip,pins = <2 28 RK_FUNC_GPIO &pcfg_pull_none>;
			rockchip,pins = <2 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	sleep {
		global_pwroff: global-pwroff {
			rockchip,pins = <2 7 RK_FUNC_1 &pcfg_pull_none>;
			rockchip,pins = <2 RK_PA7 1 &pcfg_pull_none>;
		};
	};
};
+68 −68
Original line number Diff line number Diff line
@@ -551,71 +551,71 @@

		pwm0 {
			pwm0_pin: pwm0-pin {
				rockchip,pins = <0 0 RK_FUNC_2 &pcfg_pull_none>;
				rockchip,pins = <0 RK_PA0 2 &pcfg_pull_none>;
			};
		};

		pwm1 {
			pwm1_pin: pwm1-pin {
				rockchip,pins = <0 1 RK_FUNC_2 &pcfg_pull_none>;
				rockchip,pins = <0 RK_PA1 2 &pcfg_pull_none>;
			};
		};

		pwm2 {
			pwm2_pin: pwm2-pin {
				rockchip,pins = <0 1 2 &pcfg_pull_none>;
				rockchip,pins = <0 RK_PA1 2 &pcfg_pull_none>;
			};
		};

		pwm3 {
			pwm3_pin: pwm3-pin {
				rockchip,pins = <0 27 1 &pcfg_pull_none>;
				rockchip,pins = <0 RK_PD3 1 &pcfg_pull_none>;
			};
		};

		sdmmc {
			sdmmc_clk: sdmmc-clk {
				rockchip,pins = <1 16 RK_FUNC_1 &pcfg_pull_none>;
				rockchip,pins = <1 RK_PC0 1 &pcfg_pull_none>;
			};

			sdmmc_cmd: sdmmc-cmd {
				rockchip,pins = <1 15 RK_FUNC_1 &pcfg_pull_default>;
				rockchip,pins = <1 RK_PB7 1 &pcfg_pull_default>;
			};

			sdmmc_cd: sdmmc-cd {
				rockchip,pins = <1 17 RK_FUNC_1 &pcfg_pull_default>;
				rockchip,pins = <1 RK_PC1 1 &pcfg_pull_default>;
			};

			sdmmc_bus1: sdmmc-bus1 {
				rockchip,pins = <1 18 RK_FUNC_1 &pcfg_pull_default>;
				rockchip,pins = <1 RK_PC2 1 &pcfg_pull_default>;
			};

			sdmmc_bus4: sdmmc-bus4 {
				rockchip,pins = <1 18 RK_FUNC_1 &pcfg_pull_default>,
						<1 19 RK_FUNC_1 &pcfg_pull_default>,
						<1 20 RK_FUNC_1 &pcfg_pull_default>,
						<1 21 RK_FUNC_1 &pcfg_pull_default>;
				rockchip,pins = <1 RK_PC2 1 &pcfg_pull_default>,
						<1 RK_PC3 1 &pcfg_pull_default>,
						<1 RK_PC4 1 &pcfg_pull_default>,
						<1 RK_PC5 1 &pcfg_pull_default>;
			};
		};

		sdio {
			sdio_bus1: sdio-bus1 {
				rockchip,pins = <0 11 RK_FUNC_1 &pcfg_pull_default>;
				rockchip,pins = <0 RK_PB3 1 &pcfg_pull_default>;
			};

			sdio_bus4: sdio-bus4 {
				rockchip,pins = <0 11 RK_FUNC_1 &pcfg_pull_default>,
						<0 12 RK_FUNC_1 &pcfg_pull_default>,
						<0 13 RK_FUNC_1 &pcfg_pull_default>,
						<0 14 RK_FUNC_1 &pcfg_pull_default>;
				rockchip,pins = <0 RK_PB3 1 &pcfg_pull_default>,
						<0 RK_PB4 1 &pcfg_pull_default>,
						<0 RK_PB5 1 &pcfg_pull_default>,
						<0 RK_PB6 1 &pcfg_pull_default>;
			};

			sdio_cmd: sdio-cmd {
				rockchip,pins = <0 8 RK_FUNC_1 &pcfg_pull_default>;
				rockchip,pins = <0 RK_PB0 1 &pcfg_pull_default>;
			};

			sdio_clk: sdio-clk {
				rockchip,pins = <0 9 RK_FUNC_1 &pcfg_pull_none>;
				rockchip,pins = <0 RK_PB1 1 &pcfg_pull_none>;
			};
		};

@@ -625,135 +625,135 @@
			 * We also have external pulls, so disable the internal ones.
			 */
			emmc_clk: emmc-clk {
				rockchip,pins = <2 4 RK_FUNC_2 &pcfg_pull_none>;
				rockchip,pins = <2 RK_PA4 2 &pcfg_pull_none>;
			};

			emmc_cmd: emmc-cmd {
				rockchip,pins = <2 1 RK_FUNC_2 &pcfg_pull_default>;
				rockchip,pins = <2 RK_PA1 2 &pcfg_pull_default>;
			};

			emmc_bus8: emmc-bus8 {
				rockchip,pins = <1 24 RK_FUNC_2 &pcfg_pull_default>,
						<1 25 RK_FUNC_2 &pcfg_pull_default>,
						<1 26 RK_FUNC_2 &pcfg_pull_default>,
						<1 27 RK_FUNC_2 &pcfg_pull_default>,
						<1 28 RK_FUNC_2 &pcfg_pull_default>,
						<1 29 RK_FUNC_2 &pcfg_pull_default>,
						<1 30 RK_FUNC_2 &pcfg_pull_default>,
						<1 31 RK_FUNC_2 &pcfg_pull_default>;
				rockchip,pins = <1 RK_PD0 2 &pcfg_pull_default>,
						<1 RK_PD1 2 &pcfg_pull_default>,
						<1 RK_PD2 2 &pcfg_pull_default>,
						<1 RK_PD3 2 &pcfg_pull_default>,
						<1 RK_PD4 2 &pcfg_pull_default>,
						<1 RK_PD5 2 &pcfg_pull_default>,
						<1 RK_PD6 2 &pcfg_pull_default>,
						<1 RK_PD7 2 &pcfg_pull_default>;
			};
		};

		emac {
			emac_xfer: emac-xfer {
				rockchip,pins = <2 10 RK_FUNC_1 &pcfg_pull_default>, /* crs_dvalid */
						<2 13 RK_FUNC_1 &pcfg_pull_default>, /* tx_en */
						<2 14 RK_FUNC_1 &pcfg_pull_default>, /* mac_clk */
						<2 15 RK_FUNC_1 &pcfg_pull_default>, /* rx_err */
						<2 16 RK_FUNC_1 &pcfg_pull_default>, /* rxd1 */
						<2 17 RK_FUNC_1 &pcfg_pull_default>, /* rxd0 */
						<2 18 RK_FUNC_1 &pcfg_pull_default>, /* txd1 */
						<2 19 RK_FUNC_1 &pcfg_pull_default>; /* txd0 */
				rockchip,pins = <2 RK_PB2 1 &pcfg_pull_default>, /* crs_dvalid */
						<2 RK_PB5 1 &pcfg_pull_default>, /* tx_en */
						<2 RK_PB6 1 &pcfg_pull_default>, /* mac_clk */
						<2 RK_PB7 1 &pcfg_pull_default>, /* rx_err */
						<2 RK_PC0 1 &pcfg_pull_default>, /* rxd1 */
						<2 RK_PC1 1 &pcfg_pull_default>, /* rxd0 */
						<2 RK_PC2 1 &pcfg_pull_default>, /* txd1 */
						<2 RK_PC3 1 &pcfg_pull_default>; /* txd0 */
			};

			emac_mdio: emac-mdio {
				rockchip,pins = <2 12 RK_FUNC_1 &pcfg_pull_default>, /* mac_md */
						<2 25 RK_FUNC_1 &pcfg_pull_default>; /* mac_mdclk */
				rockchip,pins = <2 RK_PB4 1 &pcfg_pull_default>, /* mac_md */
						<2 RK_PD1 1 &pcfg_pull_default>; /* mac_mdclk */
			};
		};

		i2c0 {
			i2c0_xfer: i2c0-xfer {
				rockchip,pins = <0 0 RK_FUNC_1 &pcfg_pull_none>,
						<0 1 RK_FUNC_1 &pcfg_pull_none>;
				rockchip,pins = <0 RK_PA0 1 &pcfg_pull_none>,
						<0 RK_PA1 1 &pcfg_pull_none>;
			};
		};

		i2c1 {
			i2c1_xfer: i2c1-xfer {
				rockchip,pins = <0 2 RK_FUNC_1 &pcfg_pull_none>,
						<0 3 RK_FUNC_1 &pcfg_pull_none>;
				rockchip,pins = <0 RK_PA2 1 &pcfg_pull_none>,
						<0 RK_PA3 1 &pcfg_pull_none>;
			};
		};

		i2c2 {
			i2c2_xfer: i2c2-xfer {
				rockchip,pins = <2 20 RK_FUNC_1 &pcfg_pull_none>,
						<2 21 RK_FUNC_1 &pcfg_pull_none>;
				rockchip,pins = <2 RK_PC4 1 &pcfg_pull_none>,
						<2 RK_PC5 1 &pcfg_pull_none>;
			};
		};

		i2s {
			i2s_bus: i2s-bus {
				rockchip,pins = <1 0 RK_FUNC_1 &pcfg_pull_default>,
						<1 1 RK_FUNC_1 &pcfg_pull_default>,
						<1 2 RK_FUNC_1 &pcfg_pull_default>,
						<1 3 RK_FUNC_1 &pcfg_pull_default>,
						<1 4 RK_FUNC_1 &pcfg_pull_default>,
						<1 5 RK_FUNC_1 &pcfg_pull_default>;
				rockchip,pins = <1 RK_PA0 1 &pcfg_pull_default>,
						<1 RK_PA1 1 &pcfg_pull_default>,
						<1 RK_PA2 1 &pcfg_pull_default>,
						<1 RK_PA3 1 &pcfg_pull_default>,
						<1 RK_PA4 1 &pcfg_pull_default>,
						<1 RK_PA5 1 &pcfg_pull_default>;
			};
		};

		hdmi {
			hdmi_ctl: hdmi-ctl {
				rockchip,pins = <1 8  RK_FUNC_1 &pcfg_pull_none>,
						<1 9  RK_FUNC_1 &pcfg_pull_none>,
						<1 10 RK_FUNC_1 &pcfg_pull_none>,
						<1 11 RK_FUNC_1 &pcfg_pull_none>;
				rockchip,pins = <1 RK_PB0  1 &pcfg_pull_none>,
						<1 RK_PB1  1 &pcfg_pull_none>,
						<1 RK_PB2 1 &pcfg_pull_none>,
						<1 RK_PB3 1 &pcfg_pull_none>;
			};
		};

		uart0 {
			uart0_xfer: uart0-xfer {
				rockchip,pins = <0 16 RK_FUNC_1 &pcfg_pull_default>,
						<0 17 RK_FUNC_1 &pcfg_pull_none>;
				rockchip,pins = <0 RK_PC0 1 &pcfg_pull_default>,
						<0 RK_PC1 1 &pcfg_pull_none>;
			};

			uart0_cts: uart0-cts {
				rockchip,pins = <0 18 RK_FUNC_1 &pcfg_pull_default>;
				rockchip,pins = <0 RK_PC2 1 &pcfg_pull_default>;
			};

			uart0_rts: uart0-rts {
				rockchip,pins = <0 19 RK_FUNC_1 &pcfg_pull_none>;
				rockchip,pins = <0 RK_PC3 1 &pcfg_pull_none>;
			};
		};

		uart1 {
			uart1_xfer: uart1-xfer {
				rockchip,pins = <2 22 RK_FUNC_1 &pcfg_pull_default>,
						<2 23 RK_FUNC_1 &pcfg_pull_none>;
				rockchip,pins = <2 RK_PC6 1 &pcfg_pull_default>,
						<2 RK_PC7 1 &pcfg_pull_none>;
			};
			/* no rts / cts for uart1 */
		};

		uart2 {
			uart2_xfer: uart2-xfer {
				rockchip,pins = <1 18 RK_FUNC_2 &pcfg_pull_default>,
						<1 19 RK_FUNC_2 &pcfg_pull_none>;
				rockchip,pins = <1 RK_PC2 2 &pcfg_pull_default>,
						<1 RK_PC3 2 &pcfg_pull_none>;
			};
			/* no rts / cts for uart2 */
		};

		spi-pins {
			spi_txd:spi-txd {
				rockchip,pins = <1 29 RK_FUNC_3 &pcfg_pull_default>;
				rockchip,pins = <1 RK_PD5 3 &pcfg_pull_default>;
			};

			spi_rxd:spi-rxd {
				rockchip,pins = <1 28 RK_FUNC_3 &pcfg_pull_default>;
				rockchip,pins = <1 RK_PD4 3 &pcfg_pull_default>;
			};

			spi_clk:spi-clk {
				rockchip,pins = <2 0 RK_FUNC_2 &pcfg_pull_default>;
				rockchip,pins = <2 RK_PA0 2 &pcfg_pull_default>;
			};

			spi_cs0:spi-cs0 {
				rockchip,pins = <1 30 RK_FUNC_3 &pcfg_pull_default>;
				rockchip,pins = <1 RK_PD6 3 &pcfg_pull_default>;

			};

			spi_cs1:spi-cs1 {
				rockchip,pins = <1 31 RK_FUNC_3 &pcfg_pull_default>;
				rockchip,pins = <1 RK_PD7 3 &pcfg_pull_default>;

			};
		};
+1 −1
Original line number Diff line number Diff line
@@ -168,7 +168,7 @@
&pinctrl {
	lan8720a {
		phy_int: phy-int {
			rockchip,pins = <RK_GPIO1 26 RK_FUNC_GPIO &pcfg_pull_none>;
			rockchip,pins = <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};
};
+4 −4
Original line number Diff line number Diff line
@@ -136,25 +136,25 @@
&pinctrl {
	usb-host {
		host_drv: host-drv {
			rockchip,pins = <RK_GPIO0 6 RK_FUNC_GPIO &pcfg_pull_default>;
			rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_default>;
		};
	};

	usb-otg {
		otg_drv: otg-drv {
			rockchip,pins = <RK_GPIO0 5 RK_FUNC_GPIO &pcfg_pull_default>;
			rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_default>;
		};
	};

	sdmmc {
		sdmmc_pwr: sdmmc-pwr {
			rockchip,pins = <RK_GPIO3 7 RK_FUNC_GPIO &pcfg_pull_default>;
			rockchip,pins = <3 RK_PA7 RK_FUNC_GPIO &pcfg_pull_default>;
		};
	};

	sdio {
		wifi_pwr: wifi-pwr {
			rockchip,pins = <RK_GPIO3 24 RK_FUNC_GPIO &pcfg_pull_none>;
			rockchip,pins = <3 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};
};
+13 −13
Original line number Diff line number Diff line
@@ -322,71 +322,71 @@

	ak8963 {
		comp_int: comp-int {
			rockchip,pins = <4 17 RK_FUNC_GPIO &pcfg_pull_default>;
			rockchip,pins = <4 RK_PC1 RK_FUNC_GPIO &pcfg_pull_default>;
		};
	};

	emac {
		rmii_rst: rmii-rst {
			rockchip,pins = <1 30 RK_FUNC_GPIO &pcfg_output_high>;
			rockchip,pins = <1 RK_PD6 RK_FUNC_GPIO &pcfg_output_high>;
		};
	};

	ir {
		ir_int: ir-int {
			rockchip,pins = <6 1 RK_FUNC_GPIO &pcfg_pull_default>;
			rockchip,pins = <6 RK_PA1 RK_FUNC_GPIO &pcfg_pull_default>;
		};
	};

	keys {
		pwr_key: pwr-key {
			rockchip,pins = <6 2 RK_FUNC_GPIO &pcfg_pull_default>;
			rockchip,pins = <6 RK_PA2 RK_FUNC_GPIO &pcfg_pull_default>;
		};
	};

	mma8452 {
		gsensor_int: gsensor-int {
			rockchip,pins = <4 16 RK_FUNC_GPIO &pcfg_pull_default>;
			rockchip,pins = <4 RK_PC0 RK_FUNC_GPIO &pcfg_pull_default>;
		};
	};

	mmc {
		sdmmc_pwr: sdmmc-pwr {
			rockchip,pins = <3 7 RK_FUNC_GPIO &pcfg_pull_default>;
			rockchip,pins = <3 RK_PA7 RK_FUNC_GPIO &pcfg_pull_default>;
		};
	};

	usb_host {
		host_drv: host-drv {
			rockchip,pins = <0 6 RK_FUNC_GPIO &pcfg_pull_default>;
			rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_default>;
		};

		hub_rst: hub-rst {
			rockchip,pins = <1 31 RK_FUNC_GPIO &pcfg_output_high>;
			rockchip,pins = <1 RK_PD7 RK_FUNC_GPIO &pcfg_output_high>;
		};

		sata_pwr: sata-pwr {
			rockchip,pins = <4 22 RK_FUNC_GPIO &pcfg_pull_default>;
			rockchip,pins = <4 RK_PC6 RK_FUNC_GPIO &pcfg_pull_default>;
		};

		sata_reset: sata-reset {
			rockchip,pins = <0 13 RK_FUNC_GPIO &pcfg_output_high>;
			rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_output_high>;
		};
	};

	usb_otg {
		otg_drv: otg-drv {
			rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_default>;
			rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_default>;
		};
	};

	tps {
		pmic_int: pmic-int {
			rockchip,pins = <6 4 RK_FUNC_GPIO &pcfg_pull_default>;
			rockchip,pins = <6 RK_PA4 RK_FUNC_GPIO &pcfg_pull_default>;
		};

		pwr_hold: pwr-hold {
			rockchip,pins = <6 8 RK_FUNC_GPIO &pcfg_output_high>;
			rockchip,pins = <6 RK_PB0 RK_FUNC_GPIO &pcfg_output_high>;
		};
	};
};
Loading