diff options
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/Kconfig | 1 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-nomadik-db8500.c | 130 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-nomadik.c | 204 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-nomadik.h | 20 |
4 files changed, 353 insertions, 2 deletions
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index 5e718201b88f..bbf14dc67ad2 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig | |||
@@ -39,6 +39,7 @@ config PINCTRL_MMP2 | |||
39 | config PINCTRL_NOMADIK | 39 | config PINCTRL_NOMADIK |
40 | bool "Nomadik pin controller driver" | 40 | bool "Nomadik pin controller driver" |
41 | depends on ARCH_U8500 | 41 | depends on ARCH_U8500 |
42 | select PINMUX | ||
42 | 43 | ||
43 | config PINCTRL_DB8500 | 44 | config PINCTRL_DB8500 |
44 | bool "DB8500 pin controller driver" | 45 | bool "DB8500 pin controller driver" |
diff --git a/drivers/pinctrl/pinctrl-nomadik-db8500.c b/drivers/pinctrl/pinctrl-nomadik-db8500.c index b6871c9ba53b..8b2022276f71 100644 --- a/drivers/pinctrl/pinctrl-nomadik-db8500.c +++ b/drivers/pinctrl/pinctrl-nomadik-db8500.c | |||
@@ -711,11 +711,141 @@ static const struct nmk_pingroup nmk_db8500_groups[] = { | |||
711 | DB8500_PIN_GROUP(spi2_oc1_1, NMK_GPIO_ALT_C), | 711 | DB8500_PIN_GROUP(spi2_oc1_1, NMK_GPIO_ALT_C), |
712 | }; | 712 | }; |
713 | 713 | ||
714 | /* We use this macro to define the groups applicable to a function */ | ||
715 | #define DB8500_FUNC_GROUPS(a, b...) \ | ||
716 | static const char * const a##_groups[] = { b }; | ||
717 | |||
718 | DB8500_FUNC_GROUPS(u0, "u0_a_1", "u0_c_1"); | ||
719 | DB8500_FUNC_GROUPS(u1, "u1rxtx_a_1", "u1ctsrts_a_1"); | ||
720 | /* | ||
721 | * UART2 can be muxed out with just RX/TX in four places, CTS+RTS is however | ||
722 | * only available on two pins in alternative function C | ||
723 | */ | ||
724 | DB8500_FUNC_GROUPS(u2, "u2rxtx_b_1", "u2rxtx_c_1", "u2ctsrts_c_1", | ||
725 | "u2rxtx_c_2", "u2rxtx_c_3"); | ||
726 | DB8500_FUNC_GROUPS(ipi2c, "ipi2c_a_1", "ipi2c_a_2"); | ||
727 | /* | ||
728 | * MSP0 can only be on a certain set of pins, but the TX/RX pins can be | ||
729 | * switched around by selecting the altfunction A or B. The SCK pin is | ||
730 | * only available on the altfunction B. | ||
731 | */ | ||
732 | DB8500_FUNC_GROUPS(msp0, "msp0txrx_a_1", "msp0tfstck_a_1", "msp0rfstck_a_1", | ||
733 | "msp0txrx_b_1", "msp0sck_b_1"); | ||
734 | DB8500_FUNC_GROUPS(mc0, "mc0_a_1"); | ||
735 | /* MSP0 can swap RX/TX like MSP0 but has no SCK pin available */ | ||
736 | DB8500_FUNC_GROUPS(msp1, "msp1txrx_a_1", "msp1_a_1", "msp1txrx_b_1"); | ||
737 | DB8500_FUNC_GROUPS(lcdb, "lcdb_a_1"); | ||
738 | DB8500_FUNC_GROUPS(lcd, "lcdvsi0_a_1", "lcdvsi1_a_1", "lcd_d0_d7_a_1", | ||
739 | "lcd_d8_d11_a_1", "lcd_d12_d23_a_1", "lcd_b_1"); | ||
740 | DB8500_FUNC_GROUPS(kp, "kp_a_1", "kp_b_1", "kp_c_1", "kp_oc1_1"); | ||
741 | DB8500_FUNC_GROUPS(mc2, "mc2_a_1", "mc2rstn_c_1"); | ||
742 | DB8500_FUNC_GROUPS(ssp1, "ssp1_a_1"); | ||
743 | DB8500_FUNC_GROUPS(ssp0, "ssp0_a_1"); | ||
744 | DB8500_FUNC_GROUPS(i2c0, "i2c0_a_1"); | ||
745 | /* The image processor has 8 GPIO pins that can be muxed out */ | ||
746 | DB8500_FUNC_GROUPS(ipgpio, "ipgpio0_a_1", "ipgpio1_a_1", "ipgpio7_b_1", | ||
747 | "ipgpio2_b_1", "ipgpio3_b_1", "ipgpio6_c_1", "ipgpio0_c_1", | ||
748 | "ipgpio1_c_1", "ipgpio3_c_1", "ipgpio2_c_1", "ipgpio4_c_1", | ||
749 | "ipgpio5_c_1", "ipgpio6_c_2", "ipgpio7_c_1", "ipgpio2_c_2", | ||
750 | "ipgpio3_c_2", "ipgpio4_c_2", "ipgpio5_c_2"); | ||
751 | /* MSP2 can not invert the RX/TX pins but has the optional SCK pin */ | ||
752 | DB8500_FUNC_GROUPS(msp2, "msp2sck_a_1", "msp2_a_1"); | ||
753 | DB8500_FUNC_GROUPS(mc4, "mc4_a_1", "mc4rstn_c_1"); | ||
754 | DB8500_FUNC_GROUPS(mc1, "mc1_a_1", "mc1dir_a_1"); | ||
755 | DB8500_FUNC_GROUPS(hsi, "hsir1_a_1", "hsit1_a_1"); | ||
756 | DB8500_FUNC_GROUPS(clkout, "clkout_a_1", "clkout_a_2", "clkout_c_1"); | ||
757 | DB8500_FUNC_GROUPS(usb, "usb_a_1"); | ||
758 | DB8500_FUNC_GROUPS(trig, "trig_b_1"); | ||
759 | DB8500_FUNC_GROUPS(i2c4, "i2c4_b_1"); | ||
760 | DB8500_FUNC_GROUPS(i2c1, "i2c1_b_1", "i2c1_b_2"); | ||
761 | DB8500_FUNC_GROUPS(i2c2, "i2c2_b_1", "i2c2_b_2"); | ||
762 | /* | ||
763 | * The modem UART can output its RX and TX pins in some different places, | ||
764 | * so select one of each. | ||
765 | */ | ||
766 | DB8500_FUNC_GROUPS(uartmod, "uartmodtx_b_1", "uartmodrx_b_1", "uartmodrx_b_2", | ||
767 | "uartmodrx_c_1", "uartmod_tx_c_1"); | ||
768 | DB8500_FUNC_GROUPS(stmmod, "stmmod_b_1", "stmmod_c_1"); | ||
769 | DB8500_FUNC_GROUPS(spi3, "spi3_b_1"); | ||
770 | /* Select between CS0 on alt B or PS1 on alt C */ | ||
771 | DB8500_FUNC_GROUPS(sm, "sm_b_1", "smcs0_b_1", "smcleale_c_1", "smps1_c_1"); | ||
772 | DB8500_FUNC_GROUPS(lcda, "lcdaclk_b_1", "lcda_b_1"); | ||
773 | DB8500_FUNC_GROUPS(ddrtrig, "ddrtrig_b_1"); | ||
774 | DB8500_FUNC_GROUPS(pwl, "pwl_b_1", "pwl_b_2", "pwl_b_3", "pwl_b_4"); | ||
775 | DB8500_FUNC_GROUPS(spi1, "spi1_b_1"); | ||
776 | DB8500_FUNC_GROUPS(mc3, "mc3_b_1"); | ||
777 | DB8500_FUNC_GROUPS(ipjtag, "ipjtag_c_1"); | ||
778 | DB8500_FUNC_GROUPS(slim0, "slim0_c_1"); | ||
779 | DB8500_FUNC_GROUPS(ms, "ms_c_1"); | ||
780 | DB8500_FUNC_GROUPS(iptrigout, "iptrigout_c_1"); | ||
781 | DB8500_FUNC_GROUPS(stmape, "stmape_c_1", "stmape_c_2"); | ||
782 | DB8500_FUNC_GROUPS(mc5, "mc5_c_1"); | ||
783 | DB8500_FUNC_GROUPS(usbsim, "usbsim_c_1", "usbsim_c_2"); | ||
784 | DB8500_FUNC_GROUPS(i2c3, "i2c3_c_1", "i2c3_c_2"); | ||
785 | DB8500_FUNC_GROUPS(spi0, "spi0_c_1"); | ||
786 | DB8500_FUNC_GROUPS(spi2, "spi2_oc1_1"); | ||
787 | |||
788 | #define FUNCTION(fname) \ | ||
789 | { \ | ||
790 | .name = #fname, \ | ||
791 | .groups = fname##_groups, \ | ||
792 | .ngroups = ARRAY_SIZE(fname##_groups), \ | ||
793 | } | ||
794 | |||
795 | static const struct nmk_function nmk_db8500_functions[] = { | ||
796 | FUNCTION(u0), | ||
797 | FUNCTION(u1), | ||
798 | FUNCTION(u2), | ||
799 | FUNCTION(ipi2c), | ||
800 | FUNCTION(msp0), | ||
801 | FUNCTION(mc0), | ||
802 | FUNCTION(msp1), | ||
803 | FUNCTION(lcdb), | ||
804 | FUNCTION(lcd), | ||
805 | FUNCTION(kp), | ||
806 | FUNCTION(mc2), | ||
807 | FUNCTION(ssp1), | ||
808 | FUNCTION(ssp0), | ||
809 | FUNCTION(i2c0), | ||
810 | FUNCTION(ipgpio), | ||
811 | FUNCTION(msp2), | ||
812 | FUNCTION(mc4), | ||
813 | FUNCTION(mc1), | ||
814 | FUNCTION(hsi), | ||
815 | FUNCTION(clkout), | ||
816 | FUNCTION(usb), | ||
817 | FUNCTION(trig), | ||
818 | FUNCTION(i2c4), | ||
819 | FUNCTION(i2c1), | ||
820 | FUNCTION(i2c2), | ||
821 | FUNCTION(uartmod), | ||
822 | FUNCTION(stmmod), | ||
823 | FUNCTION(spi3), | ||
824 | FUNCTION(sm), | ||
825 | FUNCTION(lcda), | ||
826 | FUNCTION(ddrtrig), | ||
827 | FUNCTION(pwl), | ||
828 | FUNCTION(spi1), | ||
829 | FUNCTION(mc3), | ||
830 | FUNCTION(ipjtag), | ||
831 | FUNCTION(slim0), | ||
832 | FUNCTION(ms), | ||
833 | FUNCTION(iptrigout), | ||
834 | FUNCTION(stmape), | ||
835 | FUNCTION(mc5), | ||
836 | FUNCTION(usbsim), | ||
837 | FUNCTION(i2c3), | ||
838 | FUNCTION(spi0), | ||
839 | FUNCTION(spi2), | ||
840 | }; | ||
841 | |||
714 | static const struct nmk_pinctrl_soc_data nmk_db8500_soc = { | 842 | static const struct nmk_pinctrl_soc_data nmk_db8500_soc = { |
715 | .gpio_ranges = nmk_db8500_ranges, | 843 | .gpio_ranges = nmk_db8500_ranges, |
716 | .gpio_num_ranges = ARRAY_SIZE(nmk_db8500_ranges), | 844 | .gpio_num_ranges = ARRAY_SIZE(nmk_db8500_ranges), |
717 | .pins = nmk_db8500_pins, | 845 | .pins = nmk_db8500_pins, |
718 | .npins = ARRAY_SIZE(nmk_db8500_pins), | 846 | .npins = ARRAY_SIZE(nmk_db8500_pins), |
847 | .functions = nmk_db8500_functions, | ||
848 | .nfunctions = ARRAY_SIZE(nmk_db8500_functions), | ||
719 | .groups = nmk_db8500_groups, | 849 | .groups = nmk_db8500_groups, |
720 | .ngroups = ARRAY_SIZE(nmk_db8500_groups), | 850 | .ngroups = ARRAY_SIZE(nmk_db8500_groups), |
721 | }; | 851 | }; |
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index 7543eb243c12..8c632e931c22 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c | |||
@@ -25,6 +25,9 @@ | |||
25 | #include <linux/irqdomain.h> | 25 | #include <linux/irqdomain.h> |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/pinctrl/pinctrl.h> | 27 | #include <linux/pinctrl/pinctrl.h> |
28 | #include <linux/pinctrl/pinmux.h> | ||
29 | /* Since we request GPIOs from ourself */ | ||
30 | #include <linux/pinctrl/consumer.h> | ||
28 | 31 | ||
29 | #include <asm/mach/irq.h> | 32 | #include <asm/mach/irq.h> |
30 | 33 | ||
@@ -873,6 +876,25 @@ static int nmk_gpio_init_irq(struct nmk_gpio_chip *nmk_chip) | |||
873 | } | 876 | } |
874 | 877 | ||
875 | /* I/O Functions */ | 878 | /* I/O Functions */ |
879 | |||
880 | static int nmk_gpio_request(struct gpio_chip *chip, unsigned offset) | ||
881 | { | ||
882 | /* | ||
883 | * Map back to global GPIO space and request muxing, the direction | ||
884 | * parameter does not matter for this controller. | ||
885 | */ | ||
886 | int gpio = chip->base + offset; | ||
887 | |||
888 | return pinctrl_request_gpio(gpio); | ||
889 | } | ||
890 | |||
891 | static void nmk_gpio_free(struct gpio_chip *chip, unsigned offset) | ||
892 | { | ||
893 | int gpio = chip->base + offset; | ||
894 | |||
895 | pinctrl_free_gpio(gpio); | ||
896 | } | ||
897 | |||
876 | static int nmk_gpio_make_input(struct gpio_chip *chip, unsigned offset) | 898 | static int nmk_gpio_make_input(struct gpio_chip *chip, unsigned offset) |
877 | { | 899 | { |
878 | struct nmk_gpio_chip *nmk_chip = | 900 | struct nmk_gpio_chip *nmk_chip = |
@@ -1023,6 +1045,8 @@ static inline void nmk_gpio_dbg_show_one(struct seq_file *s, | |||
1023 | 1045 | ||
1024 | /* This structure is replicated for each GPIO block allocated at probe time */ | 1046 | /* This structure is replicated for each GPIO block allocated at probe time */ |
1025 | static struct gpio_chip nmk_gpio_template = { | 1047 | static struct gpio_chip nmk_gpio_template = { |
1048 | .request = nmk_gpio_request, | ||
1049 | .free = nmk_gpio_free, | ||
1026 | .direction_input = nmk_gpio_make_input, | 1050 | .direction_input = nmk_gpio_make_input, |
1027 | .get = nmk_gpio_get_input, | 1051 | .get = nmk_gpio_get_input, |
1028 | .direction_output = nmk_gpio_make_output, | 1052 | .direction_output = nmk_gpio_make_output, |
@@ -1365,9 +1389,189 @@ static struct pinctrl_ops nmk_pinctrl_ops = { | |||
1365 | .pin_dbg_show = nmk_pin_dbg_show, | 1389 | .pin_dbg_show = nmk_pin_dbg_show, |
1366 | }; | 1390 | }; |
1367 | 1391 | ||
1392 | static int nmk_pmx_get_funcs_cnt(struct pinctrl_dev *pctldev) | ||
1393 | { | ||
1394 | struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); | ||
1395 | |||
1396 | return npct->soc->nfunctions; | ||
1397 | } | ||
1398 | |||
1399 | static const char *nmk_pmx_get_func_name(struct pinctrl_dev *pctldev, | ||
1400 | unsigned function) | ||
1401 | { | ||
1402 | struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); | ||
1403 | |||
1404 | return npct->soc->functions[function].name; | ||
1405 | } | ||
1406 | |||
1407 | static int nmk_pmx_get_func_groups(struct pinctrl_dev *pctldev, | ||
1408 | unsigned function, | ||
1409 | const char * const **groups, | ||
1410 | unsigned * const num_groups) | ||
1411 | { | ||
1412 | struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); | ||
1413 | |||
1414 | *groups = npct->soc->functions[function].groups; | ||
1415 | *num_groups = npct->soc->functions[function].ngroups; | ||
1416 | |||
1417 | return 0; | ||
1418 | } | ||
1419 | |||
1420 | static int nmk_pmx_enable(struct pinctrl_dev *pctldev, unsigned function, | ||
1421 | unsigned group) | ||
1422 | { | ||
1423 | struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); | ||
1424 | const struct nmk_pingroup *g; | ||
1425 | static unsigned int slpm[NUM_BANKS]; | ||
1426 | unsigned long flags; | ||
1427 | bool glitch; | ||
1428 | int ret = -EINVAL; | ||
1429 | int i; | ||
1430 | |||
1431 | g = &npct->soc->groups[group]; | ||
1432 | |||
1433 | if (g->altsetting < 0) | ||
1434 | return -EINVAL; | ||
1435 | |||
1436 | dev_dbg(npct->dev, "enable group %s, %u pins\n", g->name, g->npins); | ||
1437 | |||
1438 | /* Handle this special glitch on altfunction C */ | ||
1439 | glitch = (g->altsetting == NMK_GPIO_ALT_C); | ||
1440 | |||
1441 | if (glitch) { | ||
1442 | spin_lock_irqsave(&nmk_gpio_slpm_lock, flags); | ||
1443 | |||
1444 | /* Initially don't put any pins to sleep when switching */ | ||
1445 | memset(slpm, 0xff, sizeof(slpm)); | ||
1446 | |||
1447 | /* | ||
1448 | * Then mask the pins that need to be sleeping now when we're | ||
1449 | * switching to the ALT C function. | ||
1450 | */ | ||
1451 | for (i = 0; i < g->npins; i++) | ||
1452 | slpm[g->pins[i] / NMK_GPIO_PER_CHIP] &= ~BIT(g->pins[i]); | ||
1453 | nmk_gpio_glitch_slpm_init(slpm); | ||
1454 | } | ||
1455 | |||
1456 | for (i = 0; i < g->npins; i++) { | ||
1457 | struct pinctrl_gpio_range *range; | ||
1458 | struct nmk_gpio_chip *nmk_chip; | ||
1459 | struct gpio_chip *chip; | ||
1460 | unsigned bit; | ||
1461 | |||
1462 | range = nmk_match_gpio_range(pctldev, g->pins[i]); | ||
1463 | if (!range) { | ||
1464 | dev_err(npct->dev, | ||
1465 | "invalid pin offset %d in group %s at index %d\n", | ||
1466 | g->pins[i], g->name, i); | ||
1467 | goto out_glitch; | ||
1468 | } | ||
1469 | if (!range->gc) { | ||
1470 | dev_err(npct->dev, "GPIO chip missing in range for pin offset %d in group %s at index %d\n", | ||
1471 | g->pins[i], g->name, i); | ||
1472 | goto out_glitch; | ||
1473 | } | ||
1474 | chip = range->gc; | ||
1475 | nmk_chip = container_of(chip, struct nmk_gpio_chip, chip); | ||
1476 | dev_dbg(npct->dev, "setting pin %d to altsetting %d\n", g->pins[i], g->altsetting); | ||
1477 | |||
1478 | clk_enable(nmk_chip->clk); | ||
1479 | bit = g->pins[i] % NMK_GPIO_PER_CHIP; | ||
1480 | /* | ||
1481 | * If the pin is switching to altfunc, and there was an | ||
1482 | * interrupt installed on it which has been lazy disabled, | ||
1483 | * actually mask the interrupt to prevent spurious interrupts | ||
1484 | * that would occur while the pin is under control of the | ||
1485 | * peripheral. Only SKE does this. | ||
1486 | */ | ||
1487 | nmk_gpio_disable_lazy_irq(nmk_chip, bit); | ||
1488 | |||
1489 | __nmk_gpio_set_mode_safe(nmk_chip, bit, g->altsetting, glitch); | ||
1490 | clk_disable(nmk_chip->clk); | ||
1491 | } | ||
1492 | |||
1493 | /* When all pins are successfully reconfigured we get here */ | ||
1494 | ret = 0; | ||
1495 | |||
1496 | out_glitch: | ||
1497 | if (glitch) { | ||
1498 | nmk_gpio_glitch_slpm_restore(slpm); | ||
1499 | spin_unlock_irqrestore(&nmk_gpio_slpm_lock, flags); | ||
1500 | } | ||
1501 | |||
1502 | return ret; | ||
1503 | } | ||
1504 | |||
1505 | static void nmk_pmx_disable(struct pinctrl_dev *pctldev, | ||
1506 | unsigned function, unsigned group) | ||
1507 | { | ||
1508 | struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); | ||
1509 | const struct nmk_pingroup *g; | ||
1510 | |||
1511 | g = &npct->soc->groups[group]; | ||
1512 | |||
1513 | if (g->altsetting < 0) | ||
1514 | return; | ||
1515 | |||
1516 | /* Poke out the mux, set the pin to some default state? */ | ||
1517 | dev_dbg(npct->dev, "disable group %s, %u pins\n", g->name, g->npins); | ||
1518 | } | ||
1519 | |||
1520 | int nmk_gpio_request_enable(struct pinctrl_dev *pctldev, | ||
1521 | struct pinctrl_gpio_range *range, | ||
1522 | unsigned offset) | ||
1523 | { | ||
1524 | struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); | ||
1525 | struct nmk_gpio_chip *nmk_chip; | ||
1526 | struct gpio_chip *chip; | ||
1527 | unsigned bit; | ||
1528 | |||
1529 | if (!range) { | ||
1530 | dev_err(npct->dev, "invalid range\n"); | ||
1531 | return -EINVAL; | ||
1532 | } | ||
1533 | if (!range->gc) { | ||
1534 | dev_err(npct->dev, "missing GPIO chip in range\n"); | ||
1535 | return -EINVAL; | ||
1536 | } | ||
1537 | chip = range->gc; | ||
1538 | nmk_chip = container_of(chip, struct nmk_gpio_chip, chip); | ||
1539 | |||
1540 | dev_dbg(npct->dev, "enable pin %u as GPIO\n", offset); | ||
1541 | |||
1542 | clk_enable(nmk_chip->clk); | ||
1543 | bit = offset % NMK_GPIO_PER_CHIP; | ||
1544 | /* There is no glitch when converting any pin to GPIO */ | ||
1545 | __nmk_gpio_set_mode(nmk_chip, bit, NMK_GPIO_ALT_GPIO); | ||
1546 | clk_disable(nmk_chip->clk); | ||
1547 | |||
1548 | return 0; | ||
1549 | } | ||
1550 | |||
1551 | void nmk_gpio_disable_free(struct pinctrl_dev *pctldev, | ||
1552 | struct pinctrl_gpio_range *range, | ||
1553 | unsigned offset) | ||
1554 | { | ||
1555 | struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); | ||
1556 | |||
1557 | dev_dbg(npct->dev, "disable pin %u as GPIO\n", offset); | ||
1558 | /* Set the pin to some default state, GPIO is usually default */ | ||
1559 | } | ||
1560 | |||
1561 | static struct pinmux_ops nmk_pinmux_ops = { | ||
1562 | .get_functions_count = nmk_pmx_get_funcs_cnt, | ||
1563 | .get_function_name = nmk_pmx_get_func_name, | ||
1564 | .get_function_groups = nmk_pmx_get_func_groups, | ||
1565 | .enable = nmk_pmx_enable, | ||
1566 | .disable = nmk_pmx_disable, | ||
1567 | .gpio_request_enable = nmk_gpio_request_enable, | ||
1568 | .gpio_disable_free = nmk_gpio_disable_free, | ||
1569 | }; | ||
1570 | |||
1368 | static struct pinctrl_desc nmk_pinctrl_desc = { | 1571 | static struct pinctrl_desc nmk_pinctrl_desc = { |
1369 | .name = "pinctrl-nomadik", | 1572 | .name = "pinctrl-nomadik", |
1370 | .pctlops = &nmk_pinctrl_ops, | 1573 | .pctlops = &nmk_pinctrl_ops, |
1574 | .pmxops = &nmk_pinmux_ops, | ||
1371 | .owner = THIS_MODULE, | 1575 | .owner = THIS_MODULE, |
1372 | }; | 1576 | }; |
1373 | 1577 | ||
diff --git a/drivers/pinctrl/pinctrl-nomadik.h b/drivers/pinctrl/pinctrl-nomadik.h index e690accb5051..bc91aed7185d 100644 --- a/drivers/pinctrl/pinctrl-nomadik.h +++ b/drivers/pinctrl/pinctrl-nomadik.h | |||
@@ -8,6 +8,18 @@ | |||
8 | #define PINCTRL_NMK_DB8500 1 | 8 | #define PINCTRL_NMK_DB8500 1 |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * struct nmk_function - Nomadik pinctrl mux function | ||
12 | * @name: The name of the function, exported to pinctrl core. | ||
13 | * @groups: An array of pin groups that may select this function. | ||
14 | * @ngroups: The number of entries in @groups. | ||
15 | */ | ||
16 | struct nmk_function { | ||
17 | const char *name; | ||
18 | const char * const *groups; | ||
19 | unsigned ngroups; | ||
20 | }; | ||
21 | |||
22 | /** | ||
11 | * struct nmk_pingroup - describes a Nomadik pin group | 23 | * struct nmk_pingroup - describes a Nomadik pin group |
12 | * @name: the name of this specific pin group | 24 | * @name: the name of this specific pin group |
13 | * @pins: an array of discrete physical pins used in this group, taken | 25 | * @pins: an array of discrete physical pins used in this group, taken |
@@ -21,7 +33,7 @@ struct nmk_pingroup { | |||
21 | const char *name; | 33 | const char *name; |
22 | const unsigned int *pins; | 34 | const unsigned int *pins; |
23 | const unsigned npins; | 35 | const unsigned npins; |
24 | u32 altsetting; | 36 | int altsetting; |
25 | }; | 37 | }; |
26 | 38 | ||
27 | /** | 39 | /** |
@@ -32,7 +44,9 @@ struct nmk_pingroup { | |||
32 | * All pins which are also GPIOs must be listed first within the | 44 | * All pins which are also GPIOs must be listed first within the |
33 | * array, and be numbered identically to the GPIO controller's | 45 | * array, and be numbered identically to the GPIO controller's |
34 | * numbering. | 46 | * numbering. |
35 | * @npins: The numbmer of entries in @pins. | 47 | * @npins: The number of entries in @pins. |
48 | * @functions: The functions supported on this SoC. | ||
49 | * @nfunction: The number of entries in @functions. | ||
36 | * @groups: An array describing all pin groups the pin SoC supports. | 50 | * @groups: An array describing all pin groups the pin SoC supports. |
37 | * @ngroups: The number of entries in @groups. | 51 | * @ngroups: The number of entries in @groups. |
38 | */ | 52 | */ |
@@ -41,6 +55,8 @@ struct nmk_pinctrl_soc_data { | |||
41 | unsigned gpio_num_ranges; | 55 | unsigned gpio_num_ranges; |
42 | const struct pinctrl_pin_desc *pins; | 56 | const struct pinctrl_pin_desc *pins; |
43 | unsigned npins; | 57 | unsigned npins; |
58 | const struct nmk_function *functions; | ||
59 | unsigned nfunctions; | ||
44 | const struct nmk_pingroup *groups; | 60 | const struct nmk_pingroup *groups; |
45 | unsigned ngroups; | 61 | unsigned ngroups; |
46 | }; | 62 | }; |