]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
pinctrl: sh-pfc: r8a7790: Use new macros for non-GPIO pins
authorGeert Uytterhoeven <geert+renesas@glider.be>
Wed, 16 Jan 2019 10:03:00 +0000 (11:03 +0100)
committerGeert Uytterhoeven <geert+renesas@glider.be>
Tue, 4 Jun 2019 09:19:08 +0000 (11:19 +0200)
Update the R-Car H2 pin control driver to use the new macros for
describing pins without GPIO functionality.  This replaces the use of
physical pin numbers on the R-Car H2 SoC (in 31x31 FCBGA package) by
symbolic enum values, referring to signal names.

Note that the user-visible names of these pins are still based on pin
numbers instead of signal names, to preserve DT backwards compatibility.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
drivers/pinctrl/sh-pfc/pfc-r8a7790.c

index 80d33c7398df43881b3a2b6557a0ffe47d0ad73d..3366ed561cceefdb87a4d5cbf30648ed62ffbb5f 100644 (file)
        PORT_GP_32(4, fn, sfx),                                         \
        PORT_GP_32(5, fn, sfx)
 
+#define CPU_ALL_NOGP(fn)               \
+       PIN_NOGP(IIC0_SDA, "AF15", fn), \
+       PIN_NOGP(IIC0_SCL, "AG15", fn), \
+       PIN_NOGP(IIC3_SDA, "AH15", fn), \
+       PIN_NOGP(IIC3_SCL, "AJ15", fn)
+
 enum {
        PINMUX_RESERVED = 0,
 
@@ -1727,19 +1733,17 @@ static const u16 pinmux_data[] = {
        PINMUX_DATA(I2C3_SDA_MARK, FN_SEL_IICDVFS_1),
 };
 
-/* R8A7790 has 6 banks with 32 GPIOs in each = 192 GPIOs */
-#define ROW_GROUP_A(r) ('Z' - 'A' + 1 + (r))
-#define PIN_NUMBER(r, c) (((r) - 'A') * 31 + (c) + 200)
-#define PIN_A_NUMBER(r, c) PIN_NUMBER(ROW_GROUP_A(r), c)
+/*
+ * Pins not associated with a GPIO port.
+ */
+enum {
+       GP_ASSIGN_LAST(),
+       NOGP_ALL(),
+};
 
 static const struct sh_pfc_pin pinmux_pins[] = {
        PINMUX_GPIO_GP_ALL(),
-
-       /* Pins not associated with a GPIO port */
-       SH_PFC_PIN_NAMED(ROW_GROUP_A('F'), 15, AF15),
-       SH_PFC_PIN_NAMED(ROW_GROUP_A('G'), 15, AG15),
-       SH_PFC_PIN_NAMED(ROW_GROUP_A('H'), 15, AH15),
-       SH_PFC_PIN_NAMED(ROW_GROUP_A('J'), 15, AJ15),
+       PINMUX_NOGP_ALL(),
 };
 
 /* - AUDIO CLOCK ------------------------------------------------------------ */
@@ -2135,7 +2139,7 @@ static const unsigned int hscif1_ctrl_b_mux[] = {
 /* - I2C0 ------------------------------------------------------------------- */
 static const unsigned int i2c0_pins[] = {
        /* SCL, SDA */
-       PIN_A_NUMBER('G', 15), PIN_A_NUMBER('F', 15),
+       PIN_IIC0_SCL, PIN_IIC0_SDA,
 };
 static const unsigned int i2c0_mux[] = {
        I2C0_SCL_MARK, I2C0_SDA_MARK,
@@ -2201,7 +2205,7 @@ static const unsigned int i2c2_e_mux[] = {
 /* - I2C3 ------------------------------------------------------------------- */
 static const unsigned int i2c3_pins[] = {
        /* SCL, SDA */
-       PIN_A_NUMBER('J', 15), PIN_A_NUMBER('H', 15),
+       PIN_IIC3_SCL, PIN_IIC3_SDA,
 };
 static const unsigned int i2c3_mux[] = {
        I2C3_SCL_MARK, I2C3_SDA_MARK,
@@ -2209,7 +2213,7 @@ static const unsigned int i2c3_mux[] = {
 /* - IIC0 (I2C4) ------------------------------------------------------------ */
 static const unsigned int iic0_pins[] = {
        /* SCL, SDA */
-       PIN_A_NUMBER('G', 15), PIN_A_NUMBER('F', 15),
+       PIN_IIC0_SCL, PIN_IIC0_SDA,
 };
 static const unsigned int iic0_mux[] = {
        IIC0_SCL_MARK, IIC0_SDA_MARK,
@@ -2274,8 +2278,8 @@ static const unsigned int iic2_e_mux[] = {
 };
 /* - IIC3 (I2C7) ------------------------------------------------------------ */
 static const unsigned int iic3_pins[] = {
-/* SCL, SDA */
-       PIN_A_NUMBER('J', 15), PIN_A_NUMBER('H', 15),
+       /* SCL, SDA */
+       PIN_IIC3_SCL, PIN_IIC3_SDA,
 };
 static const unsigned int iic3_mux[] = {
        IIC3_SCL_MARK, IIC3_SDA_MARK,