13c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/*
23c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * Copyright (C) ST-Ericsson SA 2012
33c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *
43c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * Author: Patrice Chotard <patrice.chotard@stericsson.com> for ST-Ericsson.
53c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *
63c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * This program is free software; you can redistribute it and/or modify
73c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * it under the terms of the GNU General Public License version 2 as
83c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * published by the Free Software Foundation.
93c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard */
103c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
113c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#include <linux/kernel.h>
123c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#include <linux/gpio.h>
133c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#include <linux/pinctrl/pinctrl.h>
143c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#include <linux/mfd/abx500/ab8500.h>
153c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#include "pinctrl-abx500.h"
163c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
173c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/* All the pins that can be used for GPIO and some other functions */
183c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define ABX500_GPIO(offset)		(offset)
193c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
203c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_T10		ABX500_GPIO(1)
213c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_T9		ABX500_GPIO(2)
223c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_U9		ABX500_GPIO(3)
233c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_W2		ABX500_GPIO(4)
243c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/* hole */
253c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_Y18		ABX500_GPIO(6)
263c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_AA20		ABX500_GPIO(7)
273c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_W18		ABX500_GPIO(8)
283c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_AA19		ABX500_GPIO(9)
293c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_U17		ABX500_GPIO(10)
303c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_AA18		ABX500_GPIO(11)
313c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_U16		ABX500_GPIO(12)
323c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_W17		ABX500_GPIO(13)
333c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_F14		ABX500_GPIO(14)
343c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_B17		ABX500_GPIO(15)
353c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_F15		ABX500_GPIO(16)
363c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_P5		ABX500_GPIO(17)
373c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_R5		ABX500_GPIO(18)
383c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_U5		ABX500_GPIO(19)
393c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_T5		ABX500_GPIO(20)
403c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_H19		ABX500_GPIO(21)
413c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_G20		ABX500_GPIO(22)
423c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_G19		ABX500_GPIO(23)
433c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_T14		ABX500_GPIO(24)
443c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_R16		ABX500_GPIO(25)
453c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_M16		ABX500_GPIO(26)
463c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_J6		ABX500_GPIO(27)
473c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_K6		ABX500_GPIO(28)
483c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_G6		ABX500_GPIO(29)
493c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_H6		ABX500_GPIO(30)
503c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_F5		ABX500_GPIO(31)
513c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_G5		ABX500_GPIO(32)
523c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/* hole */
533c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_R17		ABX500_GPIO(34)
543c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_W15		ABX500_GPIO(35)
553c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_A17		ABX500_GPIO(36)
563c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_E15		ABX500_GPIO(37)
573c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_C17		ABX500_GPIO(38)
583c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_E16		ABX500_GPIO(39)
593c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_T19		ABX500_GPIO(40)
603c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_U19		ABX500_GPIO(41)
613c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_U2		ABX500_GPIO(42)
623c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
633c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/* indicates the highest GPIO number */
643c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_GPIO_MAX_NUMBER	42
653c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
663c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/*
673c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * The names of the pins are denoted by GPIO number and ball name, even
683c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * though they can be used for other things than GPIO, this is the first
693c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * column in the table of the data sheet and often used on schematics and
703c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * such.
713c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard */
723c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const struct pinctrl_pin_desc ab8500_pins[] = {
733c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_T10, "GPIO1_T10"),
743c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_T9, "GPIO2_T9"),
753c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_U9, "GPIO3_U9"),
763c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_W2, "GPIO4_W2"),
773c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	/* hole */
783c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_Y18, "GPIO6_Y18"),
793c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_AA20, "GPIO7_AA20"),
803c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_W18, "GPIO8_W18"),
813c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_AA19, "GPIO9_AA19"),
823c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_U17, "GPIO10_U17"),
833c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_AA18, "GPIO11_AA18"),
843c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_U16, "GPIO12_U16"),
853c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_W17, "GPIO13_W17"),
863c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_F14, "GPIO14_F14"),
873c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_B17, "GPIO15_B17"),
883c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_F15, "GPIO16_F15"),
893c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_P5, "GPIO17_P5"),
903c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_R5, "GPIO18_R5"),
913c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_U5, "GPIO19_U5"),
923c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_T5, "GPIO20_T5"),
933c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_H19, "GPIO21_H19"),
943c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_G20, "GPIO22_G20"),
953c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_G19, "GPIO23_G19"),
963c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_T14, "GPIO24_T14"),
973c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_R16, "GPIO25_R16"),
983c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_M16, "GPIO26_M16"),
993c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_J6, "GPIO27_J6"),
1003c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_K6, "GPIO28_K6"),
1013c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_G6, "GPIO29_G6"),
1023c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_H6, "GPIO30_H6"),
1033c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_F5, "GPIO31_F5"),
1043c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_G5, "GPIO32_G5"),
1053c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	/* hole */
1063c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_R17, "GPIO34_R17"),
1073c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_W15, "GPIO35_W15"),
1083c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_A17, "GPIO36_A17"),
1093c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_E15, "GPIO37_E15"),
1103c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_C17, "GPIO38_C17"),
1113c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_E16, "GPIO39_E16"),
1123c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_T19, "GPIO40_T19"),
1133c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_U19, "GPIO41_U19"),
1143c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	PINCTRL_PIN(AB8500_PIN_U2, "GPIO42_U2"),
1153c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard};
1163c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
1173c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/*
1183c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * Maps local GPIO offsets to local pin numbers
1193c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard */
1203c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const struct abx500_pinrange ab8500_pinranges[] = {
1213c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ABX500_PINRANGE(1, 4, ABX500_ALT_A),
1223c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ABX500_PINRANGE(6, 4, ABX500_ALT_A),
1233c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ABX500_PINRANGE(10, 4, ABX500_DEFAULT),
1243c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ABX500_PINRANGE(14, 12, ABX500_ALT_A),
1253c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ABX500_PINRANGE(26, 1, ABX500_DEFAULT),
1263c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ABX500_PINRANGE(27, 6, ABX500_ALT_A),
1273c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ABX500_PINRANGE(34, 1, ABX500_ALT_A),
1283c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ABX500_PINRANGE(35, 1, ABX500_DEFAULT),
1293c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ABX500_PINRANGE(36, 7, ABX500_ALT_A),
1303c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard};
1313c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
1323c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/*
1333c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * Read the pin group names like this:
1343c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * sysclkreq2_d_1 = first groups of pins for sysclkreq2 on default function
1353c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *
1363c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * The groups are arranged as sets per altfunction column, so we can
1373c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * mux in one group at a time by selecting the same altfunction for them
1383c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * all. When functions require pins on different altfunctions, you need
1393c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * to combine several groups.
1403c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard */
1413c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
1423c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/* default column */
1433c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned sysclkreq2_d_1_pins[] = { AB8500_PIN_T10 };
1443c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned sysclkreq3_d_1_pins[] = { AB8500_PIN_T9 };
1453c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned sysclkreq4_d_1_pins[] = { AB8500_PIN_U9 };
1463c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned sysclkreq6_d_1_pins[] = { AB8500_PIN_W2 };
1473c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned ycbcr0123_d_1_pins[] = { AB8500_PIN_Y18, AB8500_PIN_AA20,
1483c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard					AB8500_PIN_W18, AB8500_PIN_AA19};
1493c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio10_d_1_pins[] = { AB8500_PIN_U17 };
1503c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio11_d_1_pins[] = { AB8500_PIN_AA18 };
1513c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio12_d_1_pins[] = { AB8500_PIN_U16 };
1523c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio13_d_1_pins[] = { AB8500_PIN_W17 };
1533c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned pwmout1_d_1_pins[] = { AB8500_PIN_F14 };
1543c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned pwmout2_d_1_pins[] = { AB8500_PIN_B17 };
1553c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned pwmout3_d_1_pins[] = { AB8500_PIN_F15 };
1563c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
1573c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/* audio data interface 1*/
1583c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned adi1_d_1_pins[] = { AB8500_PIN_P5, AB8500_PIN_R5,
1593c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard					AB8500_PIN_U5, AB8500_PIN_T5 };
1603c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/* USBUICC */
1613c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned usbuicc_d_1_pins[] = { AB8500_PIN_H19, AB8500_PIN_G20,
1623c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard					AB8500_PIN_G19 };
1633c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned sysclkreq7_d_1_pins[] = { AB8500_PIN_T14 };
1643c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned sysclkreq8_d_1_pins[] = { AB8500_PIN_R16 };
1653c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio26_d_1_pins[] = { AB8500_PIN_M16 };
1663c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/* Digital microphone 1 and 2 */
1673c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned dmic12_d_1_pins[] = { AB8500_PIN_J6, AB8500_PIN_K6 };
1683c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/* Digital microphone 3 and 4 */
1693c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned dmic34_d_1_pins[] = { AB8500_PIN_G6, AB8500_PIN_H6 };
1703c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/* Digital microphone 5 and 6 */
1713c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned dmic56_d_1_pins[] = { AB8500_PIN_F5, AB8500_PIN_G5 };
1723c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned extcpena_d_1_pins[] = { AB8500_PIN_R17 };
1733c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio35_d_1_pins[] = { AB8500_PIN_W15 };
1743c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/* APE SPI */
1753c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned apespi_d_1_pins[] = { AB8500_PIN_A17, AB8500_PIN_E15,
1763c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard					AB8500_PIN_C17, AB8500_PIN_E16};
1773c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/* modem SDA/SCL */
1783c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned modsclsda_d_1_pins[] = { AB8500_PIN_T19, AB8500_PIN_U19 };
1793c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned sysclkreq5_d_1_pins[] = { AB8500_PIN_U2 };
1803c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
1813c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/* Altfunction A column */
1823c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio1_a_1_pins[] = { AB8500_PIN_T10 };
1833c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio2_a_1_pins[] = { AB8500_PIN_T9 };
1843c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio3_a_1_pins[] = { AB8500_PIN_U9 };
1853c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio4_a_1_pins[] = { AB8500_PIN_W2 };
1863c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio6_a_1_pins[] = { AB8500_PIN_Y18 };
1873c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio7_a_1_pins[] = { AB8500_PIN_AA20 };
1883c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio8_a_1_pins[] = { AB8500_PIN_W18 };
1893c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio9_a_1_pins[] = { AB8500_PIN_AA19 };
1903c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/* YCbCr4 YCbCr5 YCbCr6 YCbCr7*/
1913c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned ycbcr4567_a_1_pins[] = { AB8500_PIN_U17, AB8500_PIN_AA18,
1923c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard					AB8500_PIN_U16, AB8500_PIN_W17};
1933c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio14_a_1_pins[] = { AB8500_PIN_F14 };
1943c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio15_a_1_pins[] = { AB8500_PIN_B17 };
1953c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio16_a_1_pins[] = { AB8500_PIN_F15 };
1963c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio17_a_1_pins[] = { AB8500_PIN_P5 };
1973c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio18_a_1_pins[] = { AB8500_PIN_R5 };
1983c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio19_a_1_pins[] = { AB8500_PIN_U5 };
1993c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio20_a_1_pins[] = { AB8500_PIN_T5 };
2003c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio21_a_1_pins[] = { AB8500_PIN_H19 };
2013c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio22_a_1_pins[] = { AB8500_PIN_G20 };
2023c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio23_a_1_pins[] = { AB8500_PIN_G19 };
2033c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio24_a_1_pins[] = { AB8500_PIN_T14 };
2043c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio25_a_1_pins[] = { AB8500_PIN_R16 };
2053c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio27_a_1_pins[] = { AB8500_PIN_J6 };
2063c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio28_a_1_pins[] = { AB8500_PIN_K6 };
2073c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio29_a_1_pins[] = { AB8500_PIN_G6 };
2083c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio30_a_1_pins[] = { AB8500_PIN_H6 };
2093c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio31_a_1_pins[] = { AB8500_PIN_F5 };
2103c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio32_a_1_pins[] = { AB8500_PIN_G5 };
2113c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio34_a_1_pins[] = { AB8500_PIN_R17 };
2123c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio36_a_1_pins[] = { AB8500_PIN_A17 };
2133c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio37_a_1_pins[] = { AB8500_PIN_E15 };
2143c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio38_a_1_pins[] = { AB8500_PIN_C17 };
2153c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio39_a_1_pins[] = { AB8500_PIN_E16 };
2163c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio40_a_1_pins[] = { AB8500_PIN_T19 };
2173c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio41_a_1_pins[] = { AB8500_PIN_U19 };
2183c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned gpio42_a_1_pins[] = { AB8500_PIN_U2 };
2193c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
2203c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/* Altfunction B colum */
2213c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned hiqclkena_b_1_pins[] = { AB8500_PIN_U17 };
2223c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned usbuiccpd_b_1_pins[] = { AB8500_PIN_AA18 };
2233c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned i2ctrig1_b_1_pins[] = { AB8500_PIN_U16 };
2243c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned i2ctrig2_b_1_pins[] = { AB8500_PIN_W17 };
2253c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
2263c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/* Altfunction C column */
2273c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const unsigned usbvdat_c_1_pins[] = { AB8500_PIN_W17 };
2283c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
2293c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
2303c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_PIN_GROUP(a, b) { .name = #a, .pins = a##_pins,		\
2313c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard			.npins = ARRAY_SIZE(a##_pins), .altsetting = b }
2323c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
2333c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const struct abx500_pingroup ab8500_groups[] = {
2343c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	/* default column */
2353c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(sysclkreq2_d_1, ABX500_DEFAULT),
2363c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(sysclkreq3_d_1, ABX500_DEFAULT),
2373c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(sysclkreq4_d_1, ABX500_DEFAULT),
2383c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(sysclkreq6_d_1, ABX500_DEFAULT),
2393c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(ycbcr0123_d_1, ABX500_DEFAULT),
2403c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio10_d_1, ABX500_DEFAULT),
2413c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio11_d_1, ABX500_DEFAULT),
2423c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio12_d_1, ABX500_DEFAULT),
2433c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio13_d_1, ABX500_DEFAULT),
2443c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(pwmout1_d_1, ABX500_DEFAULT),
2453c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(pwmout2_d_1, ABX500_DEFAULT),
2463c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(pwmout3_d_1, ABX500_DEFAULT),
2473c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(adi1_d_1, ABX500_DEFAULT),
2483c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(usbuicc_d_1, ABX500_DEFAULT),
2493c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(sysclkreq7_d_1, ABX500_DEFAULT),
2503c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(sysclkreq8_d_1, ABX500_DEFAULT),
2513c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio26_d_1, ABX500_DEFAULT),
2523c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(dmic12_d_1, ABX500_DEFAULT),
2533c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(dmic34_d_1, ABX500_DEFAULT),
2543c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(dmic56_d_1, ABX500_DEFAULT),
2553c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(extcpena_d_1, ABX500_DEFAULT),
2563c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio35_d_1, ABX500_DEFAULT),
2573c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(apespi_d_1, ABX500_DEFAULT),
2583c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(modsclsda_d_1, ABX500_DEFAULT),
2593c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(sysclkreq5_d_1, ABX500_DEFAULT),
2603c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	/* Altfunction A column */
2613c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio1_a_1, ABX500_ALT_A),
2623c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio2_a_1, ABX500_ALT_A),
2633c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio3_a_1, ABX500_ALT_A),
2643c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio4_a_1, ABX500_ALT_A),
2653c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio6_a_1, ABX500_ALT_A),
2663c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio7_a_1, ABX500_ALT_A),
2673c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio8_a_1, ABX500_ALT_A),
2683c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio9_a_1, ABX500_ALT_A),
2693c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(ycbcr4567_a_1, ABX500_ALT_A),
2703c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio14_a_1, ABX500_ALT_A),
2713c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio15_a_1, ABX500_ALT_A),
2723c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio16_a_1, ABX500_ALT_A),
2733c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio17_a_1, ABX500_ALT_A),
2743c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio18_a_1, ABX500_ALT_A),
2753c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio19_a_1, ABX500_ALT_A),
2763c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio20_a_1, ABX500_ALT_A),
2773c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio21_a_1, ABX500_ALT_A),
2783c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio22_a_1, ABX500_ALT_A),
2793c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio23_a_1, ABX500_ALT_A),
2803c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio24_a_1, ABX500_ALT_A),
2813c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio25_a_1, ABX500_ALT_A),
2823c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio27_a_1, ABX500_ALT_A),
2833c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio28_a_1, ABX500_ALT_A),
2843c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio29_a_1, ABX500_ALT_A),
2853c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio30_a_1, ABX500_ALT_A),
2863c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio31_a_1, ABX500_ALT_A),
2873c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio32_a_1, ABX500_ALT_A),
2883c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio34_a_1, ABX500_ALT_A),
2893c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio36_a_1, ABX500_ALT_A),
2903c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio37_a_1, ABX500_ALT_A),
2913c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio38_a_1, ABX500_ALT_A),
2923c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio39_a_1, ABX500_ALT_A),
2933c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio40_a_1, ABX500_ALT_A),
2943c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio41_a_1, ABX500_ALT_A),
2953c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(gpio42_a_1, ABX500_ALT_A),
2963c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	/* Altfunction B column */
2973c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(hiqclkena_b_1, ABX500_ALT_B),
2983c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(usbuiccpd_b_1, ABX500_ALT_B),
2993c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(i2ctrig1_b_1, ABX500_ALT_B),
3003c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(i2ctrig2_b_1, ABX500_ALT_B),
3013c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	/* Altfunction C column */
3023c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	AB8500_PIN_GROUP(usbvdat_c_1, ABX500_ALT_C),
3033c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard};
3043c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
3053c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/* We use this macro to define the groups applicable to a function */
3063c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define AB8500_FUNC_GROUPS(a, b...)	   \
3073c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const char * const a##_groups[] = { b };
3083c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
3093c93799378ce0cb13179ba5a28366573028e03cfPatrice ChotardAB8500_FUNC_GROUPS(sysclkreq, "sysclkreq2_d_1", "sysclkreq3_d_1",
3103c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard		"sysclkreq4_d_1", "sysclkreq5_d_1", "sysclkreq6_d_1",
3113c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard		"sysclkreq7_d_1", "sysclkreq8_d_1");
3123c93799378ce0cb13179ba5a28366573028e03cfPatrice ChotardAB8500_FUNC_GROUPS(ycbcr, "ycbcr0123_d_1", "ycbcr4567_a_1");
3133c93799378ce0cb13179ba5a28366573028e03cfPatrice ChotardAB8500_FUNC_GROUPS(gpio, "gpio1_a_1", "gpio2_a_1", "gpio3_a_1", "gpio4_a_1",
3143c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard		"gpio6_a_1", "gpio7_a_1", "gpio8_a_1", "gpio9_a_1",
3153c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard		"gpio10_d_1", "gpio11_d_1", "gpio12_d_1", "gpio13_d_1",
3163c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard		"gpio14_a_1", "gpio15_a_1", "gpio16_a_1", "gpio17_a_1",
3173c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard		"gpio18_a_1", "gpio19_a_1", "gpio20_a_1", "gpio21_a_1",
3183c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard		"gpio22_a_1", "gpio23_a_1", "gpio24_a_1", "gpio25_a_1",
3193c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard		"gpio26_d_1", "gpio27_a_1", "gpio28_a_1", "gpio29_a_1",
3203c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard		"gpio30_a_1", "gpio31_a_1", "gpio32_a_1", "gpio34_a_1",
3213c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard		"gpio35_d_1", "gpio36_a_1", "gpio37_a_1", "gpio38_a_1",
3223c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard		"gpio39_a_1", "gpio40_a_1", "gpio41_a_1", "gpio42_a_1");
3233c93799378ce0cb13179ba5a28366573028e03cfPatrice ChotardAB8500_FUNC_GROUPS(pwmout, "pwmout1_d_1", "pwmout2_d_1", "pwmout3_d_1");
3243c93799378ce0cb13179ba5a28366573028e03cfPatrice ChotardAB8500_FUNC_GROUPS(adi1, "adi1_d_1");
3253c93799378ce0cb13179ba5a28366573028e03cfPatrice ChotardAB8500_FUNC_GROUPS(usbuicc, "usbuicc_d_1", "usbuiccpd_b_1");
3263c93799378ce0cb13179ba5a28366573028e03cfPatrice ChotardAB8500_FUNC_GROUPS(dmic, "dmic12_d_1", "dmic34_d_1", "dmic56_d_1");
3273c93799378ce0cb13179ba5a28366573028e03cfPatrice ChotardAB8500_FUNC_GROUPS(extcpena, "extcpena_d_1");
3283c93799378ce0cb13179ba5a28366573028e03cfPatrice ChotardAB8500_FUNC_GROUPS(apespi, "apespi_d_1");
3293c93799378ce0cb13179ba5a28366573028e03cfPatrice ChotardAB8500_FUNC_GROUPS(modsclsda, "modsclsda_d_1");
3303c93799378ce0cb13179ba5a28366573028e03cfPatrice ChotardAB8500_FUNC_GROUPS(hiqclkena, "hiqclkena_b_1");
3313c93799378ce0cb13179ba5a28366573028e03cfPatrice ChotardAB8500_FUNC_GROUPS(i2ctrig, "i2ctrig1_b_1", "i2ctrig2_b_1");
3323c93799378ce0cb13179ba5a28366573028e03cfPatrice ChotardAB8500_FUNC_GROUPS(usbvdat, "usbvdat_c_1");
3333c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
3343c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard#define FUNCTION(fname)					\
3353c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	{						\
3363c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard		.name = #fname,				\
3373c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard		.groups = fname##_groups,		\
3383c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard		.ngroups = ARRAY_SIZE(fname##_groups),	\
3393c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	}
3403c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
3413c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic const struct abx500_function ab8500_functions[] = {
3423c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	FUNCTION(sysclkreq),
3433c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	FUNCTION(ycbcr),
3443c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	FUNCTION(gpio),
3453c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	FUNCTION(pwmout),
3463c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	FUNCTION(adi1),
3473c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	FUNCTION(usbuicc),
3483c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	FUNCTION(dmic),
3493c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	FUNCTION(extcpena),
3503c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	FUNCTION(apespi),
3513c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	FUNCTION(modsclsda),
3523c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	FUNCTION(hiqclkena),
3533c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	FUNCTION(i2ctrig),
3543c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	FUNCTION(usbvdat),
3553c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard};
3563c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
3573c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/*
3583c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * this table translates what's is in the AB8500 specification regarding the
3593c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * balls alternate functions (as for DB, default, ALT_A, ALT_B and ALT_C).
3603c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * ALTERNATE_FUNCTIONS(GPIO_NUMBER, GPIOSEL bit, ALTERNATFUNC bit1,
3613c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * ALTERNATEFUNC bit2, ALTA val, ALTB val, ALTC val),
3623c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *
3633c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * example :
3643c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *
3653c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	ALTERNATE_FUNCTIONS(13,     4,      3,      4, 0, 1 ,2),
3663c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	means that pin AB8500_PIN_W17 (pin 13) supports 4 mux (default/ALT_A,
3673c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	ALT_B and ALT_C), so GPIOSEL and ALTERNATFUNC registers are used to
3683c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	select the mux.  ALTA, ALTB and ALTC val indicates values to write in
3693c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	ALTERNATFUNC register. We need to specifies these values as SOC
3703c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	designers didn't apply the same logic on how to select mux in the
3713c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	ABx500 family.
3723c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *
3733c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	As this pins supports at least ALT_B mux, default mux is
3743c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	selected by writing 1 in GPIOSEL bit :
3753c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *
3763c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *		| GPIOSEL bit=4 | alternatfunc bit2=4 | alternatfunc bit1=3
3773c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	default	|       1       |          0          |          0
3783c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	alt_A	|       0       |          0          |          0
3793c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	alt_B	|       0       |          0          |          1
3803c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	alt_C	|       0       |          1          |          0
3813c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *
3823c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	ALTERNATE_FUNCTIONS(8,      7, UNUSED, UNUSED),
3833c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	means that pin AB8500_PIN_W18 (pin 8) supports 2 mux, so only GPIOSEL
3843c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	register is used to select the mux. As this pins doesn't support at
3853c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	least ALT_B mux, default mux is by writing 0 in GPIOSEL bit :
3863c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *
3873c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *		| GPIOSEL bit=7 | alternatfunc bit2=  | alternatfunc bit1=
3883c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	default	|       0       |          0          |          0
3893c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	alt_A	|       1       |          0          |          0
3903c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard */
3913c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
392a0ce9f3ee34ec4e96ed6e40e6765d8c836d26935Sachin Kamatstatic struct
393a0ce9f3ee34ec4e96ed6e40e6765d8c836d26935Sachin Kamatalternate_functions ab8500_alternate_functions[AB8500_GPIO_MAX_NUMBER + 1] = {
3943c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(0, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO0 */
3953c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(1,	    0, UNUSED, UNUSED, 0, 0, 0), /* GPIO1, altA controlled by bit 0 */
3963c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(2,      1, UNUSED, UNUSED, 0, 0, 0), /* GPIO2, altA controlled by bit 1 */
3973c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(3,      2, UNUSED, UNUSED, 0, 0, 0), /* GPIO3, altA controlled by bit 2*/
3983c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(4,      3, UNUSED, UNUSED, 0, 0, 0), /* GPIO4, altA controlled by bit 3*/
3993c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	/* bit 4 reserved */
4003c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(5, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO5 */
4013c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(6,      5, UNUSED, UNUSED, 0, 0, 0), /* GPIO6, altA controlled by bit 5*/
4023c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(7,      6, UNUSED, UNUSED, 0, 0, 0), /* GPIO7, altA controlled by bit 6*/
4033c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(8,      7, UNUSED, UNUSED, 0, 0, 0), /* GPIO8, altA controlled by bit 7*/
4043c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
4053c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(9,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO9, altA controlled by bit 0*/
4063c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(10,     1,      0, UNUSED, 0, 1, 0), /* GPIO10, altA and altB controlled by bit 0 */
4073c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(11,     2,      1, UNUSED, 0, 1, 0), /* GPIO11, altA and altB controlled by bit 1 */
4083c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(12,     3,      2, UNUSED, 0, 1, 0), /* GPIO12, altA and altB controlled by bit 2 */
4093c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(13,     4,      3,      4, 0, 1, 2), /* GPIO13, altA altB and altC controlled by bit 3 and 4 */
4103c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(14,     5, UNUSED, UNUSED, 0, 0, 0), /* GPIO14, altA controlled by bit 5 */
4113c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(15,     6, UNUSED, UNUSED, 0, 0, 0), /* GPIO15, altA controlled by bit 6 */
4123c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(16,     7, UNUSED, UNUSED, 0, 0, 0), /* GPIO16, altA controlled by bit 7 */
4133c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	/*
4143c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	 * pins 17 to 20 are special case, only bit 0 is used to select
4153c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	 * alternate function for these 4 pins.
4163c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	 * bits 1 to 3 are reserved
4173c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	 */
4183c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(17,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO17, altA controlled by bit 0 */
4193c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(18,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO18, altA controlled by bit 0 */
4203c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(19,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO19, altA controlled by bit 0 */
4213c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(20,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO20, altA controlled by bit 0 */
4223c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(21,      4, UNUSED, UNUSED, 0, 0, 0), /* GPIO21, altA controlled by bit 4 */
4233c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(22,      5, UNUSED, UNUSED, 0, 0, 0), /* GPIO22, altA controlled by bit 5 */
4243c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(23,      6, UNUSED, UNUSED, 0, 0, 0), /* GPIO23, altA controlled by bit 6 */
4253c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(24,      7, UNUSED, UNUSED, 0, 0, 0), /* GPIO24, altA controlled by bit 7 */
4263c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
4273c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(25,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO25, altA controlled by bit 0 */
4283c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	/* pin 26 special case, no alternate function, bit 1 reserved */
4293c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(26, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* GPIO26 */
4303c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(27,      2, UNUSED, UNUSED, 0, 0, 0), /* GPIO27, altA controlled by bit 2 */
4313c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(28,      3, UNUSED, UNUSED, 0, 0, 0), /* GPIO28, altA controlled by bit 3 */
4323c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(29,      4, UNUSED, UNUSED, 0, 0, 0), /* GPIO29, altA controlled by bit 4 */
4333c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(30,      5, UNUSED, UNUSED, 0, 0, 0), /* GPIO30, altA controlled by bit 5 */
4343c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(31,      6, UNUSED, UNUSED, 0, 0, 0), /* GPIO31, altA controlled by bit 6 */
4353c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(32,      7, UNUSED, UNUSED, 0, 0, 0), /* GPIO32, altA controlled by bit 7 */
4363c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
4373c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(33, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO33 */
4383c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(34,      1, UNUSED, UNUSED, 0, 0, 0), /* GPIO34, altA controlled by bit 1 */
4393c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	/* pin 35 special case, no alternate function, bit 2 reserved */
4403c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(35, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* GPIO35 */
4413c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(36,      3, UNUSED, UNUSED, 0, 0, 0), /* GPIO36, altA controlled by bit 3 */
4423c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(37,      4, UNUSED, UNUSED, 0, 0, 0), /* GPIO37, altA controlled by bit 4 */
4433c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(38,      5, UNUSED, UNUSED, 0, 0, 0), /* GPIO38, altA controlled by bit 5 */
4443c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(39,      6, UNUSED, UNUSED, 0, 0, 0), /* GPIO39, altA controlled by bit 6 */
4453c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(40,      7, UNUSED, UNUSED, 0, 0, 0), /* GPIO40, altA controlled by bit 7 */
4463c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
4473c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(41,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO41, altA controlled by bit 0 */
4483c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	ALTERNATE_FUNCTIONS(42,      1, UNUSED, UNUSED, 0, 0, 0), /* GPIO42, altA controlled by bit 1 */
4493c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard};
4503c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
4513c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard/*
4523c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * Only some GPIOs are interrupt capable, and they are
4533c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard * organized in discontiguous clusters:
4543c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *
4553c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	GPIO6 to GPIO13
4563c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	GPIO24 and GPIO25
4573c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard *	GPIO36 to GPIO41
4583c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard */
459a0ce9f3ee34ec4e96ed6e40e6765d8c836d26935Sachin Kamatstatic struct abx500_gpio_irq_cluster ab8500_gpio_irq_cluster[] = {
46043a255dba132c1783f4ca16b528d55e55b4b4d83Linus Walleij	GPIO_IRQ_CLUSTER(6,  13, AB8500_INT_GPIO6R),
46143a255dba132c1783f4ca16b528d55e55b4b4d83Linus Walleij	GPIO_IRQ_CLUSTER(24, 25, AB8500_INT_GPIO24R),
46243a255dba132c1783f4ca16b528d55e55b4b4d83Linus Walleij	GPIO_IRQ_CLUSTER(36, 41, AB8500_INT_GPIO36R),
4633c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard};
4643c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
4653c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardstatic struct abx500_pinctrl_soc_data ab8500_soc = {
4663c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	.gpio_ranges = ab8500_pinranges,
4673c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	.gpio_num_ranges = ARRAY_SIZE(ab8500_pinranges),
4683c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	.pins = ab8500_pins,
4693c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	.npins = ARRAY_SIZE(ab8500_pins),
4703c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	.functions = ab8500_functions,
4713c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	.nfunctions = ARRAY_SIZE(ab8500_functions),
4723c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	.groups = ab8500_groups,
4733c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	.ngroups = ARRAY_SIZE(ab8500_groups),
4743c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	.alternate_functions = ab8500_alternate_functions,
4753c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	.gpio_irq_cluster = ab8500_gpio_irq_cluster,
4763c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	.ngpio_irq_cluster = ARRAY_SIZE(ab8500_gpio_irq_cluster),
4773c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	.irq_gpio_rising_offset = AB8500_INT_GPIO6R,
4783c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	.irq_gpio_falling_offset = AB8500_INT_GPIO6F,
4793c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	.irq_gpio_factor = 1,
4803c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard};
4813c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard
4823c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotardvoid abx500_pinctrl_ab8500_init(struct abx500_pinctrl_soc_data **soc)
4833c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard{
4843c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard	*soc = &ab8500_soc;
4853c93799378ce0cb13179ba5a28366573028e03cfPatrice Chotard}
486