diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2012-11-29 07:24:07 -0500 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2013-03-15 08:33:38 -0400 |
commit | a373ed0aa229f06e7d699797669b664ef39d97c1 (patch) | |
tree | 0fe20a0492d3bd6953fc706eaa97bc28d7e14ff9 | |
parent | 24d6b36e91b0503cd1c88b34fa793c0c65fa767d (diff) |
sh-pfc: Split pins and functions definition tables
Split the GPIOs table into a pins table for real GPIOs and a functions
table for function GPIOs.
Only register pins with the pinctrl core. The function GPIOs remain
accessible as GPIOs.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/pinctrl/sh-pfc/core.c | 21 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/gpio.c | 5 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/pfc-r8a7740.c | 15 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/pfc-r8a7779.c | 14 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/pfc-sh7203.c | 13 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/pfc-sh7264.c | 13 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/pfc-sh7269.c | 13 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/pfc-sh7372.c | 15 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/pfc-sh73a0.c | 13 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/pfc-sh7720.c | 13 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/pfc-sh7722.c | 13 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/pfc-sh7723.c | 13 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/pfc-sh7724.c | 13 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/pfc-sh7734.c | 13 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/pfc-sh7757.c | 13 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/pfc-sh7785.c | 13 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/pfc-sh7786.c | 13 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/pfc-shx3.c | 13 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/pinctrl.c | 41 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/sh_pfc.h | 19 |
20 files changed, 193 insertions, 106 deletions
diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c index bed2d23e2464..9dee3b911283 100644 --- a/drivers/pinctrl/sh-pfc/core.c +++ b/drivers/pinctrl/sh-pfc/core.c | |||
@@ -92,13 +92,14 @@ static int sh_pfc_enum_in_range(pinmux_enum_t enum_id, struct pinmux_range *r) | |||
92 | static bool sh_pfc_gpio_is_pin(struct sh_pfc *pfc, unsigned int gpio) | 92 | static bool sh_pfc_gpio_is_pin(struct sh_pfc *pfc, unsigned int gpio) |
93 | { | 93 | { |
94 | return (gpio < pfc->info->nr_pins) && | 94 | return (gpio < pfc->info->nr_pins) && |
95 | (pfc->info->gpios[gpio].enum_id != 0); | 95 | (pfc->info->pins[gpio].enum_id != 0); |
96 | } | 96 | } |
97 | 97 | ||
98 | bool sh_pfc_gpio_is_function(struct sh_pfc *pfc, unsigned int gpio) | 98 | bool sh_pfc_gpio_is_function(struct sh_pfc *pfc, unsigned int gpio) |
99 | { | 99 | { |
100 | return (gpio >= pfc->info->nr_pins) && (gpio < pfc->info->nr_gpios) && | 100 | return (gpio >= pfc->info->nr_pins) && |
101 | (pfc->info->gpios[gpio].enum_id != 0); | 101 | (gpio < pfc->info->nr_pins + pfc->info->nr_func_gpios) && |
102 | (pfc->info->func_gpios[gpio - pfc->info->nr_pins].enum_id != 0); | ||
102 | } | 103 | } |
103 | 104 | ||
104 | static unsigned long sh_pfc_read_raw_reg(void __iomem *mapped_reg, | 105 | static unsigned long sh_pfc_read_raw_reg(void __iomem *mapped_reg, |
@@ -234,7 +235,7 @@ static void sh_pfc_write_config_reg(struct sh_pfc *pfc, | |||
234 | 235 | ||
235 | static int sh_pfc_setup_data_reg(struct sh_pfc *pfc, unsigned gpio) | 236 | static int sh_pfc_setup_data_reg(struct sh_pfc *pfc, unsigned gpio) |
236 | { | 237 | { |
237 | struct pinmux_gpio *gpiop = &pfc->info->gpios[gpio]; | 238 | struct pinmux_pin *gpiop = &pfc->info->pins[gpio]; |
238 | struct pinmux_data_reg *data_reg; | 239 | struct pinmux_data_reg *data_reg; |
239 | int k, n; | 240 | int k, n; |
240 | 241 | ||
@@ -291,7 +292,7 @@ static void sh_pfc_setup_data_regs(struct sh_pfc *pfc) | |||
291 | int sh_pfc_get_data_reg(struct sh_pfc *pfc, unsigned gpio, | 292 | int sh_pfc_get_data_reg(struct sh_pfc *pfc, unsigned gpio, |
292 | struct pinmux_data_reg **drp, int *bitp) | 293 | struct pinmux_data_reg **drp, int *bitp) |
293 | { | 294 | { |
294 | struct pinmux_gpio *gpiop = &pfc->info->gpios[gpio]; | 295 | struct pinmux_pin *gpiop = &pfc->info->pins[gpio]; |
295 | int k, n; | 296 | int k, n; |
296 | 297 | ||
297 | if (!sh_pfc_gpio_is_pin(pfc, gpio)) | 298 | if (!sh_pfc_gpio_is_pin(pfc, gpio)) |
@@ -352,12 +353,16 @@ static int sh_pfc_get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id, | |||
352 | int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos, | 353 | int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos, |
353 | pinmux_enum_t *enum_idp) | 354 | pinmux_enum_t *enum_idp) |
354 | { | 355 | { |
355 | pinmux_enum_t enum_id = pfc->info->gpios[gpio].enum_id; | ||
356 | pinmux_enum_t *data = pfc->info->gpio_data; | 356 | pinmux_enum_t *data = pfc->info->gpio_data; |
357 | pinmux_enum_t enum_id; | ||
357 | int k; | 358 | int k; |
358 | 359 | ||
359 | if (!sh_pfc_gpio_is_pin(pfc, gpio) && | 360 | if (sh_pfc_gpio_is_pin(pfc, gpio)) { |
360 | !sh_pfc_gpio_is_function(pfc, gpio)) { | 361 | enum_id = pfc->info->pins[gpio].enum_id; |
362 | } else if (sh_pfc_gpio_is_function(pfc, gpio)) { | ||
363 | unsigned int offset = gpio - pfc->info->nr_pins; | ||
364 | enum_id = pfc->info->func_gpios[offset].enum_id; | ||
365 | } else { | ||
361 | pr_err("non data/mark enum_id for gpio %d\n", gpio); | 366 | pr_err("non data/mark enum_id for gpio %d\n", gpio); |
362 | return -1; | 367 | return -1; |
363 | } | 368 | } |
diff --git a/drivers/pinctrl/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c index 8f01113d0ecb..2a99bef281ad 100644 --- a/drivers/pinctrl/sh-pfc/gpio.c +++ b/drivers/pinctrl/sh-pfc/gpio.c | |||
@@ -183,7 +183,7 @@ static void sh_pfc_gpio_setup(struct sh_pfc_chip *chip) | |||
183 | gc->label = pfc->info->name; | 183 | gc->label = pfc->info->name; |
184 | gc->owner = THIS_MODULE; | 184 | gc->owner = THIS_MODULE; |
185 | gc->base = 0; | 185 | gc->base = 0; |
186 | gc->ngpio = pfc->info->nr_gpios; | 186 | gc->ngpio = pfc->info->nr_pins + pfc->info->nr_func_gpios; |
187 | } | 187 | } |
188 | 188 | ||
189 | int sh_pfc_register_gpiochip(struct sh_pfc *pfc) | 189 | int sh_pfc_register_gpiochip(struct sh_pfc *pfc) |
@@ -206,7 +206,8 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc) | |||
206 | pfc->gpio = chip; | 206 | pfc->gpio = chip; |
207 | 207 | ||
208 | pr_info("%s handling gpio 0 -> %u\n", | 208 | pr_info("%s handling gpio 0 -> %u\n", |
209 | pfc->info->name, pfc->info->nr_gpios - 1); | 209 | pfc->info->name, |
210 | pfc->info->nr_pins + pfc->info->nr_func_gpios - 1); | ||
210 | 211 | ||
211 | return 0; | 212 | return 0; |
212 | } | 213 | } |
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c index 957502ebcc5b..a22763e3a32e 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c | |||
@@ -1654,11 +1654,13 @@ static pinmux_enum_t pinmux_data[] = { | |||
1654 | PINMUX_DATA(TRACEAUD_FROM_MEMC_MARK, MSEL5CR_30_1, MSEL5CR_29_0), | 1654 | PINMUX_DATA(TRACEAUD_FROM_MEMC_MARK, MSEL5CR_30_1, MSEL5CR_29_0), |
1655 | }; | 1655 | }; |
1656 | 1656 | ||
1657 | static struct pinmux_gpio pinmux_gpios[] = { | 1657 | static struct pinmux_pin pinmux_pins[] = { |
1658 | |||
1659 | /* PORT */ | ||
1660 | GPIO_PORT_ALL(), | 1658 | GPIO_PORT_ALL(), |
1659 | }; | ||
1660 | |||
1661 | #define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins) | ||
1661 | 1662 | ||
1663 | static struct pinmux_func pinmux_func_gpios[] = { | ||
1662 | /* IRQ */ | 1664 | /* IRQ */ |
1663 | GPIO_FN(IRQ0_PORT2), GPIO_FN(IRQ0_PORT13), | 1665 | GPIO_FN(IRQ0_PORT2), GPIO_FN(IRQ0_PORT13), |
1664 | GPIO_FN(IRQ1), | 1666 | GPIO_FN(IRQ1), |
@@ -2592,9 +2594,10 @@ struct sh_pfc_soc_info r8a7740_pinmux_info = { | |||
2592 | .function = { PINMUX_FUNCTION_BEGIN, | 2594 | .function = { PINMUX_FUNCTION_BEGIN, |
2593 | PINMUX_FUNCTION_END }, | 2595 | PINMUX_FUNCTION_END }, |
2594 | 2596 | ||
2595 | .gpios = pinmux_gpios, | 2597 | .pins = pinmux_pins, |
2596 | .nr_pins = GPIO_PORT211 + 1, | 2598 | .nr_pins = ARRAY_SIZE(pinmux_pins), |
2597 | .nr_gpios = ARRAY_SIZE(pinmux_gpios), | 2599 | .func_gpios = pinmux_func_gpios, |
2600 | .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios), | ||
2598 | 2601 | ||
2599 | .cfg_regs = pinmux_config_regs, | 2602 | .cfg_regs = pinmux_config_regs, |
2600 | .data_regs = pinmux_data_regs, | 2603 | .data_regs = pinmux_data_regs, |
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7779.c b/drivers/pinctrl/sh-pfc/pfc-r8a7779.c index bd5a70d5247f..f771239f93e4 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7779.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7779.c | |||
@@ -1450,8 +1450,13 @@ static pinmux_enum_t pinmux_data[] = { | |||
1450 | PINMUX_IPSR_MODSEL_DATA(IP12_17_15, SCK4_B, SEL_SCIF4_1), | 1450 | PINMUX_IPSR_MODSEL_DATA(IP12_17_15, SCK4_B, SEL_SCIF4_1), |
1451 | }; | 1451 | }; |
1452 | 1452 | ||
1453 | static struct pinmux_gpio pinmux_gpios[] = { | 1453 | static struct pinmux_pin pinmux_pins[] = { |
1454 | PINMUX_GPIO_GP_ALL(), | 1454 | PINMUX_GPIO_GP_ALL(), |
1455 | }; | ||
1456 | |||
1457 | #define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins) | ||
1458 | |||
1459 | static struct pinmux_func pinmux_func_gpios[] = { | ||
1455 | GPIO_FN(AVS1), GPIO_FN(AVS2), GPIO_FN(A17), GPIO_FN(A18), | 1460 | GPIO_FN(AVS1), GPIO_FN(AVS2), GPIO_FN(A17), GPIO_FN(A18), |
1456 | GPIO_FN(A19), | 1461 | GPIO_FN(A19), |
1457 | 1462 | ||
@@ -2609,9 +2614,10 @@ struct sh_pfc_soc_info r8a7779_pinmux_info = { | |||
2609 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, | 2614 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, |
2610 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, | 2615 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, |
2611 | 2616 | ||
2612 | .gpios = pinmux_gpios, | 2617 | .pins = pinmux_pins, |
2613 | .nr_pins = GPIO_GP_6_8 + 1, | 2618 | .nr_pins = ARRAY_SIZE(pinmux_pins), |
2614 | .nr_gpios = ARRAY_SIZE(pinmux_gpios), | 2619 | .func_gpios = pinmux_func_gpios, |
2620 | .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios), | ||
2615 | 2621 | ||
2616 | .cfg_regs = pinmux_config_regs, | 2622 | .cfg_regs = pinmux_config_regs, |
2617 | .data_regs = pinmux_data_regs, | 2623 | .data_regs = pinmux_data_regs, |
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7203.c b/drivers/pinctrl/sh-pfc/pfc-sh7203.c index ee972f0bc696..17e2d06cf7a0 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh7203.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh7203.c | |||
@@ -703,7 +703,7 @@ static pinmux_enum_t pinmux_data[] = { | |||
703 | PINMUX_DATA(SSCK0_PF_MARK, PF0MD_11), | 703 | PINMUX_DATA(SSCK0_PF_MARK, PF0MD_11), |
704 | }; | 704 | }; |
705 | 705 | ||
706 | static struct pinmux_gpio pinmux_gpios[] = { | 706 | static struct pinmux_pin pinmux_pins[] = { |
707 | 707 | ||
708 | /* PA */ | 708 | /* PA */ |
709 | PINMUX_GPIO(GPIO_PA7, PA7_DATA), | 709 | PINMUX_GPIO(GPIO_PA7, PA7_DATA), |
@@ -815,7 +815,11 @@ static struct pinmux_gpio pinmux_gpios[] = { | |||
815 | PINMUX_GPIO(GPIO_PF2, PF2_DATA), | 815 | PINMUX_GPIO(GPIO_PF2, PF2_DATA), |
816 | PINMUX_GPIO(GPIO_PF1, PF1_DATA), | 816 | PINMUX_GPIO(GPIO_PF1, PF1_DATA), |
817 | PINMUX_GPIO(GPIO_PF0, PF0_DATA), | 817 | PINMUX_GPIO(GPIO_PF0, PF0_DATA), |
818 | }; | ||
819 | |||
820 | #define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins) | ||
818 | 821 | ||
822 | static struct pinmux_func pinmux_func_gpios[] = { | ||
819 | /* INTC */ | 823 | /* INTC */ |
820 | GPIO_FN(PINT7_PB), | 824 | GPIO_FN(PINT7_PB), |
821 | GPIO_FN(PINT6_PB), | 825 | GPIO_FN(PINT6_PB), |
@@ -1577,9 +1581,10 @@ struct sh_pfc_soc_info sh7203_pinmux_info = { | |||
1577 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END, FORCE_OUT }, | 1581 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END, FORCE_OUT }, |
1578 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, | 1582 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, |
1579 | 1583 | ||
1580 | .gpios = pinmux_gpios, | 1584 | .pins = pinmux_pins, |
1581 | .nr_pins = GPIO_PF0 + 1, | 1585 | .nr_pins = ARRAY_SIZE(pinmux_pins), |
1582 | .nr_gpios = ARRAY_SIZE(pinmux_gpios), | 1586 | .func_gpios = pinmux_func_gpios, |
1587 | .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios), | ||
1583 | 1588 | ||
1584 | .cfg_regs = pinmux_config_regs, | 1589 | .cfg_regs = pinmux_config_regs, |
1585 | .data_regs = pinmux_data_regs, | 1590 | .data_regs = pinmux_data_regs, |
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7264.c b/drivers/pinctrl/sh-pfc/pfc-sh7264.c index 44066dec1c3f..b927440564b7 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh7264.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh7264.c | |||
@@ -1072,7 +1072,7 @@ static pinmux_enum_t pinmux_data[] = { | |||
1072 | PINMUX_DATA(SD_D2_MARK, PK0MD_10), | 1072 | PINMUX_DATA(SD_D2_MARK, PK0MD_10), |
1073 | }; | 1073 | }; |
1074 | 1074 | ||
1075 | static struct pinmux_gpio pinmux_gpios[] = { | 1075 | static struct pinmux_pin pinmux_pins[] = { |
1076 | 1076 | ||
1077 | /* Port A */ | 1077 | /* Port A */ |
1078 | PINMUX_GPIO(GPIO_PA3, PA3_DATA), | 1078 | PINMUX_GPIO(GPIO_PA3, PA3_DATA), |
@@ -1216,7 +1216,11 @@ static struct pinmux_gpio pinmux_gpios[] = { | |||
1216 | PINMUX_GPIO(GPIO_PK2, PK2_DATA), | 1216 | PINMUX_GPIO(GPIO_PK2, PK2_DATA), |
1217 | PINMUX_GPIO(GPIO_PK1, PK1_DATA), | 1217 | PINMUX_GPIO(GPIO_PK1, PK1_DATA), |
1218 | PINMUX_GPIO(GPIO_PK0, PK0_DATA), | 1218 | PINMUX_GPIO(GPIO_PK0, PK0_DATA), |
1219 | }; | ||
1220 | |||
1221 | #define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins) | ||
1219 | 1222 | ||
1223 | static struct pinmux_func pinmux_func_gpios[] = { | ||
1220 | /* INTC */ | 1224 | /* INTC */ |
1221 | GPIO_FN(PINT7_PG), | 1225 | GPIO_FN(PINT7_PG), |
1222 | GPIO_FN(PINT6_PG), | 1226 | GPIO_FN(PINT6_PG), |
@@ -2116,9 +2120,10 @@ struct sh_pfc_soc_info sh7264_pinmux_info = { | |||
2116 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END, FORCE_OUT }, | 2120 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END, FORCE_OUT }, |
2117 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, | 2121 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, |
2118 | 2122 | ||
2119 | .gpios = pinmux_gpios, | 2123 | .pins = pinmux_pins, |
2120 | .nr_pins = GPIO_PK0 + 1, | 2124 | .nr_pins = ARRAY_SIZE(pinmux_pins), |
2121 | .nr_gpios = ARRAY_SIZE(pinmux_gpios), | 2125 | .func_gpios = pinmux_func_gpios, |
2126 | .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios), | ||
2122 | 2127 | ||
2123 | .cfg_regs = pinmux_config_regs, | 2128 | .cfg_regs = pinmux_config_regs, |
2124 | .data_regs = pinmux_data_regs, | 2129 | .data_regs = pinmux_data_regs, |
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7269.c b/drivers/pinctrl/sh-pfc/pfc-sh7269.c index 072c7d5da512..8f9b975670c2 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh7269.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh7269.c | |||
@@ -1452,7 +1452,7 @@ static pinmux_enum_t pinmux_data[] = { | |||
1452 | PINMUX_DATA(PWM1A_MARK, PJ0MD_100), | 1452 | PINMUX_DATA(PWM1A_MARK, PJ0MD_100), |
1453 | }; | 1453 | }; |
1454 | 1454 | ||
1455 | static struct pinmux_gpio pinmux_gpios[] = { | 1455 | static struct pinmux_pin pinmux_pins[] = { |
1456 | /* Port A */ | 1456 | /* Port A */ |
1457 | PINMUX_GPIO(GPIO_PA1, PA1_DATA), | 1457 | PINMUX_GPIO(GPIO_PA1, PA1_DATA), |
1458 | PINMUX_GPIO(GPIO_PA0, PA0_DATA), | 1458 | PINMUX_GPIO(GPIO_PA0, PA0_DATA), |
@@ -1613,7 +1613,11 @@ static struct pinmux_gpio pinmux_gpios[] = { | |||
1613 | PINMUX_GPIO(GPIO_PJ2, PJ2_DATA), | 1613 | PINMUX_GPIO(GPIO_PJ2, PJ2_DATA), |
1614 | PINMUX_GPIO(GPIO_PJ1, PJ1_DATA), | 1614 | PINMUX_GPIO(GPIO_PJ1, PJ1_DATA), |
1615 | PINMUX_GPIO(GPIO_PJ0, PJ0_DATA), | 1615 | PINMUX_GPIO(GPIO_PJ0, PJ0_DATA), |
1616 | }; | ||
1617 | |||
1618 | #define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins) | ||
1616 | 1619 | ||
1620 | static struct pinmux_func pinmux_func_gpios[] = { | ||
1617 | /* INTC */ | 1621 | /* INTC */ |
1618 | GPIO_FN(IRQ7_PG), | 1622 | GPIO_FN(IRQ7_PG), |
1619 | GPIO_FN(IRQ6_PG), | 1623 | GPIO_FN(IRQ6_PG), |
@@ -2819,9 +2823,10 @@ struct sh_pfc_soc_info sh7269_pinmux_info = { | |||
2819 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END, FORCE_OUT }, | 2823 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END, FORCE_OUT }, |
2820 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, | 2824 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, |
2821 | 2825 | ||
2822 | .gpios = pinmux_gpios, | 2826 | .pins = pinmux_pins, |
2823 | .nr_pins = GPIO_PJ0 + 1, | 2827 | .nr_pins = ARRAY_SIZE(pinmux_pins), |
2824 | .nr_gpios = ARRAY_SIZE(pinmux_gpios), | 2828 | .func_gpios = pinmux_func_gpios, |
2829 | .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios), | ||
2825 | 2830 | ||
2826 | .cfg_regs = pinmux_config_regs, | 2831 | .cfg_regs = pinmux_config_regs, |
2827 | .data_regs = pinmux_data_regs, | 2832 | .data_regs = pinmux_data_regs, |
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7372.c b/drivers/pinctrl/sh-pfc/pfc-sh7372.c index c11207442415..3a1961b3d902 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh7372.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh7372.c | |||
@@ -929,11 +929,13 @@ static pinmux_enum_t pinmux_data[] = { | |||
929 | PINMUX_DATA(MFIv4_MARK, MSEL4CR_6_1), | 929 | PINMUX_DATA(MFIv4_MARK, MSEL4CR_6_1), |
930 | }; | 930 | }; |
931 | 931 | ||
932 | static struct pinmux_gpio pinmux_gpios[] = { | 932 | static struct pinmux_pin pinmux_pins[] = { |
933 | |||
934 | /* PORT */ | ||
935 | GPIO_PORT_ALL(), | 933 | GPIO_PORT_ALL(), |
934 | }; | ||
935 | |||
936 | #define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins) | ||
936 | 937 | ||
938 | static struct pinmux_func pinmux_func_gpios[] = { | ||
937 | /* IRQ */ | 939 | /* IRQ */ |
938 | GPIO_FN(IRQ0_6), GPIO_FN(IRQ0_162), GPIO_FN(IRQ1), | 940 | GPIO_FN(IRQ0_6), GPIO_FN(IRQ0_162), GPIO_FN(IRQ1), |
939 | GPIO_FN(IRQ2_4), GPIO_FN(IRQ2_5), GPIO_FN(IRQ3_8), | 941 | GPIO_FN(IRQ2_4), GPIO_FN(IRQ2_5), GPIO_FN(IRQ3_8), |
@@ -1640,9 +1642,10 @@ struct sh_pfc_soc_info sh7372_pinmux_info = { | |||
1640 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, | 1642 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, |
1641 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, | 1643 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, |
1642 | 1644 | ||
1643 | .gpios = pinmux_gpios, | 1645 | .pins = pinmux_pins, |
1644 | .nr_pins = GPIO_PORT190 + 1, | 1646 | .nr_pins = ARRAY_SIZE(pinmux_pins), |
1645 | .nr_gpios = ARRAY_SIZE(pinmux_gpios), | 1647 | .func_gpios = pinmux_func_gpios, |
1648 | .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios), | ||
1646 | 1649 | ||
1647 | .cfg_regs = pinmux_config_regs, | 1650 | .cfg_regs = pinmux_config_regs, |
1648 | .data_regs = pinmux_data_regs, | 1651 | .data_regs = pinmux_data_regs, |
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c index e41aa21edac0..02cb1dc6d12e 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c | |||
@@ -1539,9 +1539,13 @@ static pinmux_enum_t pinmux_data[] = { | |||
1539 | PINMUX_DATA(FSIAISLD_PU_MARK, PORT55_FN1, PORT55_IN_PU), | 1539 | PINMUX_DATA(FSIAISLD_PU_MARK, PORT55_FN1, PORT55_IN_PU), |
1540 | }; | 1540 | }; |
1541 | 1541 | ||
1542 | static struct pinmux_gpio pinmux_gpios[] = { | 1542 | static struct pinmux_pin pinmux_pins[] = { |
1543 | GPIO_PORT_ALL(), | 1543 | GPIO_PORT_ALL(), |
1544 | }; | ||
1545 | |||
1546 | #define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins) | ||
1544 | 1547 | ||
1548 | static struct pinmux_func pinmux_func_gpios[] = { | ||
1545 | /* Table 25-1 (Functions 0-7) */ | 1549 | /* Table 25-1 (Functions 0-7) */ |
1546 | GPIO_FN(VBUS_0), | 1550 | GPIO_FN(VBUS_0), |
1547 | GPIO_FN(GPI0), | 1551 | GPIO_FN(GPI0), |
@@ -2776,9 +2780,10 @@ struct sh_pfc_soc_info sh73a0_pinmux_info = { | |||
2776 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, | 2780 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, |
2777 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, | 2781 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, |
2778 | 2782 | ||
2779 | .gpios = pinmux_gpios, | 2783 | .pins = pinmux_pins, |
2780 | .nr_pins = GPIO_PORT309 + 1, | 2784 | .nr_pins = ARRAY_SIZE(pinmux_pins), |
2781 | .nr_gpios = ARRAY_SIZE(pinmux_gpios), | 2785 | .func_gpios = pinmux_func_gpios, |
2786 | .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios), | ||
2782 | 2787 | ||
2783 | .cfg_regs = pinmux_config_regs, | 2788 | .cfg_regs = pinmux_config_regs, |
2784 | .data_regs = pinmux_data_regs, | 2789 | .data_regs = pinmux_data_regs, |
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7720.c b/drivers/pinctrl/sh-pfc/pfc-sh7720.c index 294b75858c9e..9952a7c2d287 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh7720.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh7720.c | |||
@@ -606,7 +606,7 @@ static pinmux_enum_t pinmux_data[] = { | |||
606 | PINMUX_DATA(SIM_CLK_MARK, PSELD_1_0_10, PTV0_FN), | 606 | PINMUX_DATA(SIM_CLK_MARK, PSELD_1_0_10, PTV0_FN), |
607 | }; | 607 | }; |
608 | 608 | ||
609 | static struct pinmux_gpio pinmux_gpios[] = { | 609 | static struct pinmux_pin pinmux_pins[] = { |
610 | /* PTA */ | 610 | /* PTA */ |
611 | PINMUX_GPIO(GPIO_PTA7, PTA7_DATA), | 611 | PINMUX_GPIO(GPIO_PTA7, PTA7_DATA), |
612 | PINMUX_GPIO(GPIO_PTA6, PTA6_DATA), | 612 | PINMUX_GPIO(GPIO_PTA6, PTA6_DATA), |
@@ -759,7 +759,11 @@ static struct pinmux_gpio pinmux_gpios[] = { | |||
759 | PINMUX_GPIO(GPIO_PTV2, PTV2_DATA), | 759 | PINMUX_GPIO(GPIO_PTV2, PTV2_DATA), |
760 | PINMUX_GPIO(GPIO_PTV1, PTV1_DATA), | 760 | PINMUX_GPIO(GPIO_PTV1, PTV1_DATA), |
761 | PINMUX_GPIO(GPIO_PTV0, PTV0_DATA), | 761 | PINMUX_GPIO(GPIO_PTV0, PTV0_DATA), |
762 | }; | ||
763 | |||
764 | #define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins) | ||
762 | 765 | ||
766 | static struct pinmux_func pinmux_func_gpios[] = { | ||
763 | /* BSC */ | 767 | /* BSC */ |
764 | GPIO_FN(D31), | 768 | GPIO_FN(D31), |
765 | GPIO_FN(D30), | 769 | GPIO_FN(D30), |
@@ -1220,9 +1224,10 @@ struct sh_pfc_soc_info sh7720_pinmux_info = { | |||
1220 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, | 1224 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, |
1221 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, | 1225 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, |
1222 | 1226 | ||
1223 | .gpios = pinmux_gpios, | 1227 | .pins = pinmux_pins, |
1224 | .nr_pins = GPIO_PTV0 + 1, | 1228 | .nr_pins = ARRAY_SIZE(pinmux_pins), |
1225 | .nr_gpios = ARRAY_SIZE(pinmux_gpios), | 1229 | .func_gpios = pinmux_func_gpios, |
1230 | .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios), | ||
1226 | 1231 | ||
1227 | .cfg_regs = pinmux_config_regs, | 1232 | .cfg_regs = pinmux_config_regs, |
1228 | .data_regs = pinmux_data_regs, | 1233 | .data_regs = pinmux_data_regs, |
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7722.c b/drivers/pinctrl/sh-pfc/pfc-sh7722.c index e7eadaf8e444..d561737a385b 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh7722.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh7722.c | |||
@@ -787,7 +787,7 @@ static pinmux_enum_t pinmux_data[] = { | |||
787 | PINMUX_DATA(KEYOUT5_IN5_MARK, HIZA14_KEYSC, KEYOUT5_IN5), | 787 | PINMUX_DATA(KEYOUT5_IN5_MARK, HIZA14_KEYSC, KEYOUT5_IN5), |
788 | }; | 788 | }; |
789 | 789 | ||
790 | static struct pinmux_gpio pinmux_gpios[] = { | 790 | static struct pinmux_pin pinmux_pins[] = { |
791 | /* PTA */ | 791 | /* PTA */ |
792 | PINMUX_GPIO(GPIO_PTA7, PTA7_DATA), | 792 | PINMUX_GPIO(GPIO_PTA7, PTA7_DATA), |
793 | PINMUX_GPIO(GPIO_PTA6, PTA6_DATA), | 793 | PINMUX_GPIO(GPIO_PTA6, PTA6_DATA), |
@@ -982,7 +982,11 @@ static struct pinmux_gpio pinmux_gpios[] = { | |||
982 | PINMUX_GPIO(GPIO_PTZ3, PTZ3_DATA), | 982 | PINMUX_GPIO(GPIO_PTZ3, PTZ3_DATA), |
983 | PINMUX_GPIO(GPIO_PTZ2, PTZ2_DATA), | 983 | PINMUX_GPIO(GPIO_PTZ2, PTZ2_DATA), |
984 | PINMUX_GPIO(GPIO_PTZ1, PTZ1_DATA), | 984 | PINMUX_GPIO(GPIO_PTZ1, PTZ1_DATA), |
985 | }; | ||
986 | |||
987 | #define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins) | ||
985 | 988 | ||
989 | static struct pinmux_func pinmux_func_gpios[] = { | ||
986 | /* SCIF0 */ | 990 | /* SCIF0 */ |
987 | GPIO_FN(SCIF0_TXD), | 991 | GPIO_FN(SCIF0_TXD), |
988 | GPIO_FN(SCIF0_RXD), | 992 | GPIO_FN(SCIF0_RXD), |
@@ -1764,9 +1768,10 @@ struct sh_pfc_soc_info sh7722_pinmux_info = { | |||
1764 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, | 1768 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, |
1765 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, | 1769 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, |
1766 | 1770 | ||
1767 | .gpios = pinmux_gpios, | 1771 | .pins = pinmux_pins, |
1768 | .nr_pins = GPIO_PTZ1 + 1, | 1772 | .nr_pins = ARRAY_SIZE(pinmux_pins), |
1769 | .nr_gpios = ARRAY_SIZE(pinmux_gpios), | 1773 | .func_gpios = pinmux_func_gpios, |
1774 | .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios), | ||
1770 | 1775 | ||
1771 | .cfg_regs = pinmux_config_regs, | 1776 | .cfg_regs = pinmux_config_regs, |
1772 | .data_regs = pinmux_data_regs, | 1777 | .data_regs = pinmux_data_regs, |
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7723.c b/drivers/pinctrl/sh-pfc/pfc-sh7723.c index 06b1d736001d..60831bfa177a 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh7723.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh7723.c | |||
@@ -923,7 +923,7 @@ static pinmux_enum_t pinmux_data[] = { | |||
923 | PINMUX_DATA(SIUBISLD_MARK, PSD1_PSD0_FN2, PTZ0_FN), | 923 | PINMUX_DATA(SIUBISLD_MARK, PSD1_PSD0_FN2, PTZ0_FN), |
924 | }; | 924 | }; |
925 | 925 | ||
926 | static struct pinmux_gpio pinmux_gpios[] = { | 926 | static struct pinmux_pin pinmux_pins[] = { |
927 | /* PTA */ | 927 | /* PTA */ |
928 | PINMUX_GPIO(GPIO_PTA7, PTA7_DATA), | 928 | PINMUX_GPIO(GPIO_PTA7, PTA7_DATA), |
929 | PINMUX_GPIO(GPIO_PTA6, PTA6_DATA), | 929 | PINMUX_GPIO(GPIO_PTA6, PTA6_DATA), |
@@ -1139,7 +1139,11 @@ static struct pinmux_gpio pinmux_gpios[] = { | |||
1139 | PINMUX_GPIO(GPIO_PTZ2, PTZ2_DATA), | 1139 | PINMUX_GPIO(GPIO_PTZ2, PTZ2_DATA), |
1140 | PINMUX_GPIO(GPIO_PTZ1, PTZ1_DATA), | 1140 | PINMUX_GPIO(GPIO_PTZ1, PTZ1_DATA), |
1141 | PINMUX_GPIO(GPIO_PTZ0, PTZ0_DATA), | 1141 | PINMUX_GPIO(GPIO_PTZ0, PTZ0_DATA), |
1142 | }; | ||
1143 | |||
1144 | #define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins) | ||
1142 | 1145 | ||
1146 | static struct pinmux_func pinmux_func_gpios[] = { | ||
1143 | /* SCIF0 */ | 1147 | /* SCIF0 */ |
1144 | GPIO_FN(SCIF0_PTT_TXD), | 1148 | GPIO_FN(SCIF0_PTT_TXD), |
1145 | GPIO_FN(SCIF0_PTT_RXD), | 1149 | GPIO_FN(SCIF0_PTT_RXD), |
@@ -1888,9 +1892,10 @@ struct sh_pfc_soc_info sh7723_pinmux_info = { | |||
1888 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, | 1892 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, |
1889 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, | 1893 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, |
1890 | 1894 | ||
1891 | .gpios = pinmux_gpios, | 1895 | .pins = pinmux_pins, |
1892 | .nr_pins = GPIO_PTZ0 + 1, | 1896 | .nr_pins = ARRAY_SIZE(pinmux_pins), |
1893 | .nr_gpios = ARRAY_SIZE(pinmux_gpios), | 1897 | .func_gpios = pinmux_func_gpios, |
1898 | .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios), | ||
1894 | 1899 | ||
1895 | .cfg_regs = pinmux_config_regs, | 1900 | .cfg_regs = pinmux_config_regs, |
1896 | .data_regs = pinmux_data_regs, | 1901 | .data_regs = pinmux_data_regs, |
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7724.c b/drivers/pinctrl/sh-pfc/pfc-sh7724.c index 41160a3efb40..0b9d16ed3524 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh7724.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh7724.c | |||
@@ -1192,7 +1192,7 @@ static pinmux_enum_t pinmux_data[] = { | |||
1192 | PINMUX_DATA(SCIF3_I_TXD_MARK, PSB14_1, PTZ3_FN), | 1192 | PINMUX_DATA(SCIF3_I_TXD_MARK, PSB14_1, PTZ3_FN), |
1193 | }; | 1193 | }; |
1194 | 1194 | ||
1195 | static struct pinmux_gpio pinmux_gpios[] = { | 1195 | static struct pinmux_pin pinmux_pins[] = { |
1196 | /* PTA */ | 1196 | /* PTA */ |
1197 | PINMUX_GPIO(GPIO_PTA7, PTA7_DATA), | 1197 | PINMUX_GPIO(GPIO_PTA7, PTA7_DATA), |
1198 | PINMUX_GPIO(GPIO_PTA6, PTA6_DATA), | 1198 | PINMUX_GPIO(GPIO_PTA6, PTA6_DATA), |
@@ -1418,7 +1418,11 @@ static struct pinmux_gpio pinmux_gpios[] = { | |||
1418 | PINMUX_GPIO(GPIO_PTZ2, PTZ2_DATA), | 1418 | PINMUX_GPIO(GPIO_PTZ2, PTZ2_DATA), |
1419 | PINMUX_GPIO(GPIO_PTZ1, PTZ1_DATA), | 1419 | PINMUX_GPIO(GPIO_PTZ1, PTZ1_DATA), |
1420 | PINMUX_GPIO(GPIO_PTZ0, PTZ0_DATA), | 1420 | PINMUX_GPIO(GPIO_PTZ0, PTZ0_DATA), |
1421 | }; | ||
1422 | |||
1423 | #define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins) | ||
1421 | 1424 | ||
1425 | static struct pinmux_func pinmux_func_gpios[] = { | ||
1422 | /* BSC */ | 1426 | /* BSC */ |
1423 | GPIO_FN(D31), | 1427 | GPIO_FN(D31), |
1424 | GPIO_FN(D30), | 1428 | GPIO_FN(D30), |
@@ -2210,9 +2214,10 @@ struct sh_pfc_soc_info sh7724_pinmux_info = { | |||
2210 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, | 2214 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, |
2211 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, | 2215 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, |
2212 | 2216 | ||
2213 | .gpios = pinmux_gpios, | 2217 | .pins = pinmux_pins, |
2214 | .nr_pins = GPIO_PTZ0 + 1, | 2218 | .nr_pins = ARRAY_SIZE(pinmux_pins), |
2215 | .nr_gpios = ARRAY_SIZE(pinmux_gpios), | 2219 | .func_gpios = pinmux_func_gpios, |
2220 | .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios), | ||
2216 | 2221 | ||
2217 | .cfg_regs = pinmux_config_regs, | 2222 | .cfg_regs = pinmux_config_regs, |
2218 | .data_regs = pinmux_data_regs, | 2223 | .data_regs = pinmux_data_regs, |
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7734.c b/drivers/pinctrl/sh-pfc/pfc-sh7734.c index df32e71625b1..e3bfeffba392 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh7734.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh7734.c | |||
@@ -1384,9 +1384,13 @@ static pinmux_enum_t pinmux_data[] = { | |||
1384 | PINMUX_IPSR_DATA(IP11_28, ST_CLKOUT), | 1384 | PINMUX_IPSR_DATA(IP11_28, ST_CLKOUT), |
1385 | }; | 1385 | }; |
1386 | 1386 | ||
1387 | static struct pinmux_gpio pinmux_gpios[] = { | 1387 | static struct pinmux_pin pinmux_pins[] = { |
1388 | PINMUX_GPIO_GP_ALL(), | 1388 | PINMUX_GPIO_GP_ALL(), |
1389 | }; | ||
1390 | |||
1391 | #define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins) | ||
1389 | 1392 | ||
1393 | static struct pinmux_func pinmux_func_gpios[] = { | ||
1390 | GPIO_FN(CLKOUT), GPIO_FN(BS), GPIO_FN(CS0), GPIO_FN(EX_CS0), | 1394 | GPIO_FN(CLKOUT), GPIO_FN(BS), GPIO_FN(CS0), GPIO_FN(EX_CS0), |
1391 | GPIO_FN(RD), GPIO_FN(WE0), GPIO_FN(WE1), | 1395 | GPIO_FN(RD), GPIO_FN(WE0), GPIO_FN(WE1), |
1392 | GPIO_FN(SCL0), GPIO_FN(PENC0), GPIO_FN(USB_OVC0), | 1396 | GPIO_FN(SCL0), GPIO_FN(PENC0), GPIO_FN(USB_OVC0), |
@@ -2460,9 +2464,10 @@ struct sh_pfc_soc_info sh7734_pinmux_info = { | |||
2460 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, | 2464 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, |
2461 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, | 2465 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, |
2462 | 2466 | ||
2463 | .gpios = pinmux_gpios, | 2467 | .pins = pinmux_pins, |
2464 | .nr_pins = GPIO_GP_5_11 + 1, | 2468 | .nr_pins = ARRAY_SIZE(pinmux_pins), |
2465 | .nr_gpios = ARRAY_SIZE(pinmux_gpios), | 2469 | .func_gpios = pinmux_func_gpios, |
2470 | .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios), | ||
2466 | 2471 | ||
2467 | .cfg_regs = pinmux_config_regs, | 2472 | .cfg_regs = pinmux_config_regs, |
2468 | .data_regs = pinmux_data_regs, | 2473 | .data_regs = pinmux_data_regs, |
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7757.c b/drivers/pinctrl/sh-pfc/pfc-sh7757.c index dd32f347ce5a..6e78358bbdef 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh7757.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh7757.c | |||
@@ -1114,7 +1114,7 @@ static pinmux_enum_t pinmux_data[] = { | |||
1114 | PINMUX_DATA(ON_DQ0_MARK, PS8_8_FN2, PTZ0_FN), | 1114 | PINMUX_DATA(ON_DQ0_MARK, PS8_8_FN2, PTZ0_FN), |
1115 | }; | 1115 | }; |
1116 | 1116 | ||
1117 | static struct pinmux_gpio pinmux_gpios[] = { | 1117 | static struct pinmux_pin pinmux_pins[] = { |
1118 | /* PTA */ | 1118 | /* PTA */ |
1119 | PINMUX_GPIO(GPIO_PTA7, PTA7_DATA), | 1119 | PINMUX_GPIO(GPIO_PTA7, PTA7_DATA), |
1120 | PINMUX_GPIO(GPIO_PTA6, PTA6_DATA), | 1120 | PINMUX_GPIO(GPIO_PTA6, PTA6_DATA), |
@@ -1370,7 +1370,11 @@ static struct pinmux_gpio pinmux_gpios[] = { | |||
1370 | PINMUX_GPIO(GPIO_PTZ2, PTZ2_DATA), | 1370 | PINMUX_GPIO(GPIO_PTZ2, PTZ2_DATA), |
1371 | PINMUX_GPIO(GPIO_PTZ1, PTZ1_DATA), | 1371 | PINMUX_GPIO(GPIO_PTZ1, PTZ1_DATA), |
1372 | PINMUX_GPIO(GPIO_PTZ0, PTZ0_DATA), | 1372 | PINMUX_GPIO(GPIO_PTZ0, PTZ0_DATA), |
1373 | }; | ||
1374 | |||
1375 | #define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins) | ||
1373 | 1376 | ||
1377 | static struct pinmux_func pinmux_func_gpios[] = { | ||
1374 | /* PTA (mobule: LBSC, RGMII) */ | 1378 | /* PTA (mobule: LBSC, RGMII) */ |
1375 | GPIO_FN(BS), | 1379 | GPIO_FN(BS), |
1376 | GPIO_FN(RDWR), | 1380 | GPIO_FN(RDWR), |
@@ -2267,9 +2271,10 @@ struct sh_pfc_soc_info sh7757_pinmux_info = { | |||
2267 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, | 2271 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, |
2268 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, | 2272 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, |
2269 | 2273 | ||
2270 | .gpios = pinmux_gpios, | 2274 | .pins = pinmux_pins, |
2271 | .nr_pins = GPIO_PTZ7 + 1, | 2275 | .nr_pins = ARRAY_SIZE(pinmux_pins), |
2272 | .nr_gpios = ARRAY_SIZE(pinmux_gpios), | 2276 | .func_gpios = pinmux_func_gpios, |
2277 | .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios), | ||
2273 | 2278 | ||
2274 | .cfg_regs = pinmux_config_regs, | 2279 | .cfg_regs = pinmux_config_regs, |
2275 | .data_regs = pinmux_data_regs, | 2280 | .data_regs = pinmux_data_regs, |
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7785.c b/drivers/pinctrl/sh-pfc/pfc-sh7785.c index 447bd921b0ea..cce232d47276 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh7785.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh7785.c | |||
@@ -702,7 +702,7 @@ static pinmux_enum_t pinmux_data[] = { | |||
702 | PINMUX_DATA(IRQOUT_MARK, P2MSEL2_1), | 702 | PINMUX_DATA(IRQOUT_MARK, P2MSEL2_1), |
703 | }; | 703 | }; |
704 | 704 | ||
705 | static struct pinmux_gpio pinmux_gpios[] = { | 705 | static struct pinmux_pin pinmux_pins[] = { |
706 | /* PA */ | 706 | /* PA */ |
707 | PINMUX_GPIO(GPIO_PA7, PA7_DATA), | 707 | PINMUX_GPIO(GPIO_PA7, PA7_DATA), |
708 | PINMUX_GPIO(GPIO_PA6, PA6_DATA), | 708 | PINMUX_GPIO(GPIO_PA6, PA6_DATA), |
@@ -845,7 +845,11 @@ static struct pinmux_gpio pinmux_gpios[] = { | |||
845 | PINMUX_GPIO(GPIO_PR2, PR2_DATA), | 845 | PINMUX_GPIO(GPIO_PR2, PR2_DATA), |
846 | PINMUX_GPIO(GPIO_PR1, PR1_DATA), | 846 | PINMUX_GPIO(GPIO_PR1, PR1_DATA), |
847 | PINMUX_GPIO(GPIO_PR0, PR0_DATA), | 847 | PINMUX_GPIO(GPIO_PR0, PR0_DATA), |
848 | }; | ||
849 | |||
850 | #define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins) | ||
848 | 851 | ||
852 | static struct pinmux_func pinmux_func_gpios[] = { | ||
849 | /* FN */ | 853 | /* FN */ |
850 | GPIO_FN(D63_AD31), | 854 | GPIO_FN(D63_AD31), |
851 | GPIO_FN(D62_AD30), | 855 | GPIO_FN(D62_AD30), |
@@ -1289,9 +1293,10 @@ struct sh_pfc_soc_info sh7785_pinmux_info = { | |||
1289 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, | 1293 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, |
1290 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, | 1294 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, |
1291 | 1295 | ||
1292 | .gpios = pinmux_gpios, | 1296 | .pins = pinmux_pins, |
1293 | .nr_pins = GPIO_PR0 + 1, | 1297 | .nr_pins = ARRAY_SIZE(pinmux_pins), |
1294 | .nr_gpios = ARRAY_SIZE(pinmux_gpios), | 1298 | .func_gpios = pinmux_func_gpios, |
1299 | .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios), | ||
1295 | 1300 | ||
1296 | .cfg_regs = pinmux_config_regs, | 1301 | .cfg_regs = pinmux_config_regs, |
1297 | .data_regs = pinmux_data_regs, | 1302 | .data_regs = pinmux_data_regs, |
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7786.c b/drivers/pinctrl/sh-pfc/pfc-sh7786.c index dee3cfbe3bbe..74a0e1128f22 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh7786.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh7786.c | |||
@@ -427,7 +427,7 @@ static pinmux_enum_t pinmux_data[] = { | |||
427 | PINMUX_DATA(SSI3_SCK_MARK, P2MSEL6_1, P2MSEL5_1, PJ1_FN), | 427 | PINMUX_DATA(SSI3_SCK_MARK, P2MSEL6_1, P2MSEL5_1, PJ1_FN), |
428 | }; | 428 | }; |
429 | 429 | ||
430 | static struct pinmux_gpio pinmux_gpios[] = { | 430 | static struct pinmux_pin pinmux_pins[] = { |
431 | /* PA */ | 431 | /* PA */ |
432 | PINMUX_GPIO(GPIO_PA7, PA7_DATA), | 432 | PINMUX_GPIO(GPIO_PA7, PA7_DATA), |
433 | PINMUX_GPIO(GPIO_PA6, PA6_DATA), | 433 | PINMUX_GPIO(GPIO_PA6, PA6_DATA), |
@@ -505,7 +505,11 @@ static struct pinmux_gpio pinmux_gpios[] = { | |||
505 | PINMUX_GPIO(GPIO_PJ3, PJ3_DATA), | 505 | PINMUX_GPIO(GPIO_PJ3, PJ3_DATA), |
506 | PINMUX_GPIO(GPIO_PJ2, PJ2_DATA), | 506 | PINMUX_GPIO(GPIO_PJ2, PJ2_DATA), |
507 | PINMUX_GPIO(GPIO_PJ1, PJ1_DATA), | 507 | PINMUX_GPIO(GPIO_PJ1, PJ1_DATA), |
508 | }; | ||
509 | |||
510 | #define PINMUX_FN_BASE ARRAY_SIZE(pinmux_pins) | ||
508 | 511 | ||
512 | static struct pinmux_func pinmux_func_gpios[] = { | ||
509 | /* FN */ | 513 | /* FN */ |
510 | GPIO_FN(CDE), | 514 | GPIO_FN(CDE), |
511 | GPIO_FN(ETH_MAGIC), | 515 | GPIO_FN(ETH_MAGIC), |
@@ -822,9 +826,10 @@ struct sh_pfc_soc_info sh7786_pinmux_info = { | |||
822 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, | 826 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, |
823 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, | 827 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, |
824 | 828 | ||
825 | .gpios = pinmux_gpios, | 829 | .pins = pinmux_pins, |
826 | .nr_pins = GPIO_PJ0 + 1, | 830 | .nr_pins = ARRAY_SIZE(pinmux_pins), |
827 | .nr_gpios = ARRAY_SIZE(pinmux_gpios), | 831 | .func_gpios = pinmux_func_gpios, |
832 | .nr_func_gpios = ARRAY_SIZE(pinmux_func_gpios), | ||
828 | 833 | ||
829 | .cfg_regs = pinmux_config_regs, | 834 | .cfg_regs = pinmux_config_regs, |
830 | .data_regs = pinmux_data_regs, | 835 | .data_regs = pinmux_data_regs, |
diff --git a/drivers/pinctrl/sh-pfc/pfc-shx3.c b/drivers/pinctrl/sh-pfc/pfc-shx3.c index e59da7999348..eeecffc562c1 100644 --- a/drivers/pinctrl/sh-pfc/pfc-shx3.c +++ b/drivers/pinctrl/sh-pfc/pfc-shx3.c | |||
@@ -306,7 +306,7 @@ static pinmux_enum_t shx3_pinmux_data[] = { | |||
306 | PINMUX_DATA(IRQOUT_MARK, PH0_FN), | 306 | PINMUX_DATA(IRQOUT_MARK, PH0_FN), |
307 | }; | 307 | }; |
308 | 308 | ||
309 | static struct pinmux_gpio shx3_pinmux_gpios[] = { | 309 | static struct pinmux_pin shx3_pinmux_pins[] = { |
310 | /* PA */ | 310 | /* PA */ |
311 | PINMUX_GPIO(GPIO_PA7, PA7_DATA), | 311 | PINMUX_GPIO(GPIO_PA7, PA7_DATA), |
312 | PINMUX_GPIO(GPIO_PA6, PA6_DATA), | 312 | PINMUX_GPIO(GPIO_PA6, PA6_DATA), |
@@ -384,7 +384,11 @@ static struct pinmux_gpio shx3_pinmux_gpios[] = { | |||
384 | PINMUX_GPIO(GPIO_PH2, PH2_DATA), | 384 | PINMUX_GPIO(GPIO_PH2, PH2_DATA), |
385 | PINMUX_GPIO(GPIO_PH1, PH1_DATA), | 385 | PINMUX_GPIO(GPIO_PH1, PH1_DATA), |
386 | PINMUX_GPIO(GPIO_PH0, PH0_DATA), | 386 | PINMUX_GPIO(GPIO_PH0, PH0_DATA), |
387 | }; | ||
388 | |||
389 | #define PINMUX_FN_BASE ARRAY_SIZE(shx3_pinmux_pins) | ||
387 | 390 | ||
391 | static struct pinmux_func shx3_pinmux_func_gpios[] = { | ||
388 | /* FN */ | 392 | /* FN */ |
389 | GPIO_FN(D31), | 393 | GPIO_FN(D31), |
390 | GPIO_FN(D30), | 394 | GPIO_FN(D30), |
@@ -569,9 +573,10 @@ struct sh_pfc_soc_info shx3_pinmux_info = { | |||
569 | PINMUX_INPUT_PULLUP_END }, | 573 | PINMUX_INPUT_PULLUP_END }, |
570 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, | 574 | .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, |
571 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, | 575 | .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, |
572 | .gpios = shx3_pinmux_gpios, | 576 | .pins = shx3_pinmux_pins, |
573 | .nr_pins = GPIO_PH0 + 1, | 577 | .nr_pins = ARRAY_SIZE(shx3_pinmux_pins), |
574 | .nr_gpios = ARRAY_SIZE(shx3_pinmux_gpios), | 578 | .func_gpios = shx3_pinmux_func_gpios, |
579 | .nr_func_gpios = ARRAY_SIZE(shx3_pinmux_func_gpios), | ||
575 | .gpio_data = shx3_pinmux_data, | 580 | .gpio_data = shx3_pinmux_data, |
576 | .gpio_data_size = ARRAY_SIZE(shx3_pinmux_data), | 581 | .gpio_data_size = ARRAY_SIZE(shx3_pinmux_data), |
577 | .cfg_regs = shx3_pinmux_config_regs, | 582 | .cfg_regs = shx3_pinmux_config_regs, |
diff --git a/drivers/pinctrl/sh-pfc/pinctrl.c b/drivers/pinctrl/sh-pfc/pinctrl.c index 747ee6487fd7..77592900b601 100644 --- a/drivers/pinctrl/sh-pfc/pinctrl.c +++ b/drivers/pinctrl/sh-pfc/pinctrl.c | |||
@@ -32,7 +32,7 @@ struct sh_pfc_pinctrl { | |||
32 | 32 | ||
33 | struct sh_pfc *pfc; | 33 | struct sh_pfc *pfc; |
34 | 34 | ||
35 | struct pinmux_gpio **functions; | 35 | struct pinmux_func **functions; |
36 | unsigned int nr_functions; | 36 | unsigned int nr_functions; |
37 | 37 | ||
38 | struct pinctrl_pin_desc *pads; | 38 | struct pinctrl_pin_desc *pads; |
@@ -125,7 +125,7 @@ static int sh_pfc_reconfig_pin(struct sh_pfc *pfc, unsigned offset, | |||
125 | 125 | ||
126 | spin_lock_irqsave(&pfc->lock, flags); | 126 | spin_lock_irqsave(&pfc->lock, flags); |
127 | 127 | ||
128 | pinmux_type = pfc->info->gpios[offset].flags & PINMUX_FLAG_TYPE; | 128 | pinmux_type = pfc->info->pins[offset].flags & PINMUX_FLAG_TYPE; |
129 | 129 | ||
130 | /* | 130 | /* |
131 | * See if the present config needs to first be de-configured. | 131 | * See if the present config needs to first be de-configured. |
@@ -157,8 +157,8 @@ static int sh_pfc_reconfig_pin(struct sh_pfc *pfc, unsigned offset, | |||
157 | GPIO_CFG_REQ) != 0) | 157 | GPIO_CFG_REQ) != 0) |
158 | goto err; | 158 | goto err; |
159 | 159 | ||
160 | pfc->info->gpios[offset].flags &= ~PINMUX_FLAG_TYPE; | 160 | pfc->info->pins[offset].flags &= ~PINMUX_FLAG_TYPE; |
161 | pfc->info->gpios[offset].flags |= new_type; | 161 | pfc->info->pins[offset].flags |= new_type; |
162 | 162 | ||
163 | ret = 0; | 163 | ret = 0; |
164 | 164 | ||
@@ -168,7 +168,6 @@ err: | |||
168 | return ret; | 168 | return ret; |
169 | } | 169 | } |
170 | 170 | ||
171 | |||
172 | static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev, | 171 | static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev, |
173 | struct pinctrl_gpio_range *range, | 172 | struct pinctrl_gpio_range *range, |
174 | unsigned offset) | 173 | unsigned offset) |
@@ -180,7 +179,7 @@ static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev, | |||
180 | 179 | ||
181 | spin_lock_irqsave(&pfc->lock, flags); | 180 | spin_lock_irqsave(&pfc->lock, flags); |
182 | 181 | ||
183 | pinmux_type = pfc->info->gpios[offset].flags & PINMUX_FLAG_TYPE; | 182 | pinmux_type = pfc->info->pins[offset].flags & PINMUX_FLAG_TYPE; |
184 | 183 | ||
185 | switch (pinmux_type) { | 184 | switch (pinmux_type) { |
186 | case PINMUX_TYPE_GPIO: | 185 | case PINMUX_TYPE_GPIO: |
@@ -213,7 +212,7 @@ static void sh_pfc_gpio_disable_free(struct pinctrl_dev *pctldev, | |||
213 | 212 | ||
214 | spin_lock_irqsave(&pfc->lock, flags); | 213 | spin_lock_irqsave(&pfc->lock, flags); |
215 | 214 | ||
216 | pinmux_type = pfc->info->gpios[offset].flags & PINMUX_FLAG_TYPE; | 215 | pinmux_type = pfc->info->pins[offset].flags & PINMUX_FLAG_TYPE; |
217 | 216 | ||
218 | sh_pfc_config_gpio(pfc, offset, pinmux_type, GPIO_CFG_FREE); | 217 | sh_pfc_config_gpio(pfc, offset, pinmux_type, GPIO_CFG_FREE); |
219 | 218 | ||
@@ -247,7 +246,7 @@ static int sh_pfc_pinconf_get(struct pinctrl_dev *pctldev, unsigned pin, | |||
247 | struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); | 246 | struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); |
248 | struct sh_pfc *pfc = pmx->pfc; | 247 | struct sh_pfc *pfc = pmx->pfc; |
249 | 248 | ||
250 | *config = pfc->info->gpios[pin].flags & PINMUX_FLAG_TYPE; | 249 | *config = pfc->info->pins[pin].flags & PINMUX_FLAG_TYPE; |
251 | 250 | ||
252 | return 0; | 251 | return 0; |
253 | } | 252 | } |
@@ -297,7 +296,7 @@ static int sh_pfc_map_gpios(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx) | |||
297 | { | 296 | { |
298 | int i; | 297 | int i; |
299 | 298 | ||
300 | pmx->nr_pads = pfc->info->nr_gpios; | 299 | pmx->nr_pads = pfc->info->nr_pins; |
301 | 300 | ||
302 | pmx->pads = devm_kzalloc(pfc->dev, sizeof(*pmx->pads) * pmx->nr_pads, | 301 | pmx->pads = devm_kzalloc(pfc->dev, sizeof(*pmx->pads) * pmx->nr_pads, |
303 | GFP_KERNEL); | 302 | GFP_KERNEL); |
@@ -308,17 +307,10 @@ static int sh_pfc_map_gpios(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx) | |||
308 | 307 | ||
309 | for (i = 0; i < pmx->nr_pads; i++) { | 308 | for (i = 0; i < pmx->nr_pads; i++) { |
310 | struct pinctrl_pin_desc *pin = pmx->pads + i; | 309 | struct pinctrl_pin_desc *pin = pmx->pads + i; |
311 | struct pinmux_gpio *gpio = pfc->info->gpios + i; | 310 | struct pinmux_pin *gpio = pfc->info->pins + i; |
312 | 311 | ||
313 | pin->number = i; | 312 | pin->number = i; |
314 | pin->name = gpio->name; | 313 | pin->name = gpio->name; |
315 | |||
316 | /* XXX */ | ||
317 | if (unlikely(!gpio->enum_id)) | ||
318 | continue; | ||
319 | |||
320 | if ((gpio->flags & PINMUX_FLAG_TYPE) == PINMUX_TYPE_FUNCTION) | ||
321 | pmx->nr_functions++; | ||
322 | } | 314 | } |
323 | 315 | ||
324 | return 0; | 316 | return 0; |
@@ -328,16 +320,23 @@ static int sh_pfc_map_functions(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx) | |||
328 | { | 320 | { |
329 | int i, fn; | 321 | int i, fn; |
330 | 322 | ||
323 | for (i = 0; i < pfc->info->nr_func_gpios; i++) { | ||
324 | struct pinmux_func *func = pfc->info->func_gpios + i; | ||
325 | |||
326 | if (func->enum_id) | ||
327 | pmx->nr_functions++; | ||
328 | } | ||
329 | |||
331 | pmx->functions = devm_kzalloc(pfc->dev, pmx->nr_functions * | 330 | pmx->functions = devm_kzalloc(pfc->dev, pmx->nr_functions * |
332 | sizeof(*pmx->functions), GFP_KERNEL); | 331 | sizeof(*pmx->functions), GFP_KERNEL); |
333 | if (unlikely(!pmx->functions)) | 332 | if (unlikely(!pmx->functions)) |
334 | return -ENOMEM; | 333 | return -ENOMEM; |
335 | 334 | ||
336 | for (i = fn = 0; i < pmx->nr_pads; i++) { | 335 | for (i = fn = 0; i < pfc->info->nr_func_gpios; i++) { |
337 | struct pinmux_gpio *gpio = pfc->info->gpios + i; | 336 | struct pinmux_func *func = pfc->info->func_gpios + i; |
338 | 337 | ||
339 | if ((gpio->flags & PINMUX_FLAG_TYPE) == PINMUX_TYPE_FUNCTION) | 338 | if (func->enum_id) |
340 | pmx->functions[fn++] = gpio; | 339 | pmx->functions[fn++] = func; |
341 | } | 340 | } |
342 | 341 | ||
343 | return 0; | 342 | return 0; |
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h index 6ed7ab9d56d4..940170a4c64f 100644 --- a/drivers/pinctrl/sh-pfc/sh_pfc.h +++ b/drivers/pinctrl/sh-pfc/sh_pfc.h | |||
@@ -35,23 +35,27 @@ enum { | |||
35 | #define PINMUX_FLAG_DREG_SHIFT 10 | 35 | #define PINMUX_FLAG_DREG_SHIFT 10 |
36 | #define PINMUX_FLAG_DREG (0x3f << PINMUX_FLAG_DREG_SHIFT) | 36 | #define PINMUX_FLAG_DREG (0x3f << PINMUX_FLAG_DREG_SHIFT) |
37 | 37 | ||
38 | struct pinmux_gpio { | 38 | struct pinmux_pin { |
39 | const pinmux_enum_t enum_id; | 39 | const pinmux_enum_t enum_id; |
40 | pinmux_flag_t flags; | 40 | pinmux_flag_t flags; |
41 | const char *name; | 41 | const char *name; |
42 | }; | 42 | }; |
43 | 43 | ||
44 | struct pinmux_func { | ||
45 | const pinmux_enum_t enum_id; | ||
46 | const char *name; | ||
47 | }; | ||
48 | |||
44 | #define PINMUX_GPIO(gpio, data_or_mark) \ | 49 | #define PINMUX_GPIO(gpio, data_or_mark) \ |
45 | [gpio] = { \ | 50 | [gpio] = { \ |
46 | .name = __stringify(gpio), \ | 51 | .name = __stringify(gpio), \ |
47 | .enum_id = data_or_mark, \ | 52 | .enum_id = data_or_mark, \ |
48 | .flags = PINMUX_TYPE_GPIO \ | 53 | .flags = PINMUX_TYPE_GPIO \ |
49 | } | 54 | } |
50 | #define PINMUX_GPIO_FN(gpio, data_or_mark) \ | 55 | #define PINMUX_GPIO_FN(gpio, base, data_or_mark) \ |
51 | [gpio] = { \ | 56 | [gpio - (base)] = { \ |
52 | .name = __stringify(gpio), \ | 57 | .name = __stringify(gpio), \ |
53 | .enum_id = data_or_mark, \ | 58 | .enum_id = data_or_mark, \ |
54 | .flags = PINMUX_TYPE_FUNCTION \ | ||
55 | } | 59 | } |
56 | 60 | ||
57 | #define PINMUX_DATA(data_or_mark, ids...) data_or_mark, ids, 0 | 61 | #define PINMUX_DATA(data_or_mark, ids...) data_or_mark, ids, 0 |
@@ -106,9 +110,10 @@ struct sh_pfc_soc_info { | |||
106 | struct pinmux_range output; | 110 | struct pinmux_range output; |
107 | struct pinmux_range function; | 111 | struct pinmux_range function; |
108 | 112 | ||
109 | struct pinmux_gpio *gpios; | 113 | struct pinmux_pin *pins; |
110 | unsigned int nr_pins; | 114 | unsigned int nr_pins; |
111 | unsigned int nr_gpios; | 115 | struct pinmux_func *func_gpios; |
116 | unsigned int nr_func_gpios; | ||
112 | 117 | ||
113 | struct pinmux_cfg_reg *cfg_regs; | 118 | struct pinmux_cfg_reg *cfg_regs; |
114 | struct pinmux_data_reg *data_regs; | 119 | struct pinmux_data_reg *data_regs; |
@@ -145,7 +150,7 @@ enum { GPIO_CFG_DRYRUN, GPIO_CFG_REQ, GPIO_CFG_FREE }; | |||
145 | #define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA) | 150 | #define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA) |
146 | #define PORT_ALL(str) CPU_ALL_PORT(_PORT_ALL, PORT, str) | 151 | #define PORT_ALL(str) CPU_ALL_PORT(_PORT_ALL, PORT, str) |
147 | #define GPIO_PORT_ALL() CPU_ALL_PORT(_GPIO_PORT, , unused) | 152 | #define GPIO_PORT_ALL() CPU_ALL_PORT(_GPIO_PORT, , unused) |
148 | #define GPIO_FN(str) PINMUX_GPIO_FN(GPIO_FN_##str, str##_MARK) | 153 | #define GPIO_FN(str) PINMUX_GPIO_FN(GPIO_FN_##str, PINMUX_FN_BASE, str##_MARK) |
149 | 154 | ||
150 | /* helper macro for pinmux_enum_t */ | 155 | /* helper macro for pinmux_enum_t */ |
151 | #define PORT_DATA_I(nr) \ | 156 | #define PORT_DATA_I(nr) \ |