Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 #include <linux/kernel.h>
0003 #include <linux/pinctrl/pinctrl.h>
0004 #include "pinctrl-nomadik.h"
0005 
0006 /* All the pins that can be used for GPIO and some other functions */
0007 #define _GPIO(offset)       (offset)
0008 
0009 #define STN8815_PIN_B4      _GPIO(0)
0010 #define STN8815_PIN_D5      _GPIO(1)
0011 #define STN8815_PIN_C5      _GPIO(2)
0012 #define STN8815_PIN_A4      _GPIO(3)
0013 #define STN8815_PIN_B5      _GPIO(4)
0014 #define STN8815_PIN_D6      _GPIO(5)
0015 #define STN8815_PIN_C6      _GPIO(6)
0016 #define STN8815_PIN_B6      _GPIO(7)
0017 #define STN8815_PIN_B10     _GPIO(8)
0018 #define STN8815_PIN_A10     _GPIO(9)
0019 #define STN8815_PIN_C11     _GPIO(10)
0020 #define STN8815_PIN_B11     _GPIO(11)
0021 #define STN8815_PIN_A11     _GPIO(12)
0022 #define STN8815_PIN_C12     _GPIO(13)
0023 #define STN8815_PIN_B12     _GPIO(14)
0024 #define STN8815_PIN_A12     _GPIO(15)
0025 #define STN8815_PIN_C13     _GPIO(16)
0026 #define STN8815_PIN_B13     _GPIO(17)
0027 #define STN8815_PIN_A13     _GPIO(18)
0028 #define STN8815_PIN_D13     _GPIO(19)
0029 #define STN8815_PIN_C14     _GPIO(20)
0030 #define STN8815_PIN_B14     _GPIO(21)
0031 #define STN8815_PIN_A14     _GPIO(22)
0032 #define STN8815_PIN_D15     _GPIO(23)
0033 #define STN8815_PIN_C15     _GPIO(24)
0034 #define STN8815_PIN_B15     _GPIO(25)
0035 #define STN8815_PIN_A15     _GPIO(26)
0036 #define STN8815_PIN_C16     _GPIO(27)
0037 #define STN8815_PIN_B16     _GPIO(28)
0038 #define STN8815_PIN_A16     _GPIO(29)
0039 #define STN8815_PIN_D17     _GPIO(30)
0040 #define STN8815_PIN_C17     _GPIO(31)
0041 #define STN8815_PIN_AB6     _GPIO(32)
0042 #define STN8815_PIN_AA6     _GPIO(33)
0043 #define STN8815_PIN_Y6      _GPIO(34)
0044 #define STN8815_PIN_Y5      _GPIO(35)
0045 #define STN8815_PIN_AA5     _GPIO(36)
0046 #define STN8815_PIN_AB5     _GPIO(37)
0047 #define STN8815_PIN_AB4     _GPIO(38)
0048 #define STN8815_PIN_Y4      _GPIO(39)
0049 #define STN8815_PIN_R1      _GPIO(40)
0050 #define STN8815_PIN_R2      _GPIO(41)
0051 #define STN8815_PIN_R3      _GPIO(42)
0052 #define STN8815_PIN_P1      _GPIO(43)
0053 #define STN8815_PIN_P2      _GPIO(44)
0054 #define STN8815_PIN_P3      _GPIO(45)
0055 #define STN8815_PIN_N1      _GPIO(46)
0056 #define STN8815_PIN_N2      _GPIO(47)
0057 #define STN8815_PIN_N3      _GPIO(48)
0058 #define STN8815_PIN_M1      _GPIO(49)
0059 #define STN8815_PIN_M3      _GPIO(50)
0060 #define STN8815_PIN_M2      _GPIO(51)
0061 #define STN8815_PIN_L1      _GPIO(52)
0062 #define STN8815_PIN_L4      _GPIO(53)
0063 #define STN8815_PIN_L3      _GPIO(54)
0064 #define STN8815_PIN_L2      _GPIO(55)
0065 #define STN8815_PIN_F3      _GPIO(56)
0066 #define STN8815_PIN_F2      _GPIO(57)
0067 #define STN8815_PIN_E1      _GPIO(58)
0068 #define STN8815_PIN_E3      _GPIO(59)
0069 #define STN8815_PIN_E2      _GPIO(60)
0070 #define STN8815_PIN_E4      _GPIO(61)
0071 #define STN8815_PIN_D3      _GPIO(62)
0072 #define STN8815_PIN_D2      _GPIO(63)
0073 #define STN8815_PIN_F21     _GPIO(64)
0074 #define STN8815_PIN_F20     _GPIO(65)
0075 #define STN8815_PIN_E22     _GPIO(66)
0076 #define STN8815_PIN_D22     _GPIO(67)
0077 #define STN8815_PIN_E21     _GPIO(68)
0078 #define STN8815_PIN_E20     _GPIO(69)
0079 #define STN8815_PIN_C22     _GPIO(70)
0080 #define STN8815_PIN_D21     _GPIO(71)
0081 #define STN8815_PIN_D20     _GPIO(72)
0082 #define STN8815_PIN_C21     _GPIO(73)
0083 #define STN8815_PIN_C20     _GPIO(74)
0084 #define STN8815_PIN_C19     _GPIO(75)
0085 #define STN8815_PIN_B20     _GPIO(76)
0086 #define STN8815_PIN_B8      _GPIO(77)
0087 #define STN8815_PIN_A8      _GPIO(78)
0088 #define STN8815_PIN_C9      _GPIO(79)
0089 #define STN8815_PIN_B9      _GPIO(80)
0090 #define STN8815_PIN_A9      _GPIO(81)
0091 #define STN8815_PIN_C10     _GPIO(82)
0092 #define STN8815_PIN_K1      _GPIO(83)
0093 #define STN8815_PIN_K3      _GPIO(84)
0094 #define STN8815_PIN_K2      _GPIO(85)
0095 #define STN8815_PIN_J1      _GPIO(86)
0096 #define STN8815_PIN_J3      _GPIO(87)
0097 #define STN8815_PIN_J2      _GPIO(88)
0098 #define STN8815_PIN_H1      _GPIO(89)
0099 #define STN8815_PIN_H3      _GPIO(90)
0100 #define STN8815_PIN_H2      _GPIO(91)
0101 #define STN8815_PIN_G1      _GPIO(92)
0102 #define STN8815_PIN_G3      _GPIO(93)
0103 #define STN8815_PIN_G2      _GPIO(94)
0104 #define STN8815_PIN_F1      _GPIO(95)
0105 #define STN8815_PIN_T20     _GPIO(96)
0106 #define STN8815_PIN_R21     _GPIO(97)
0107 #define STN8815_PIN_R20     _GPIO(98)
0108 #define STN8815_PIN_U22     _GPIO(99)
0109 #define STN8815_PIN_N21     _GPIO(100)
0110 #define STN8815_PIN_N20     _GPIO(101)
0111 #define STN8815_PIN_P22     _GPIO(102)
0112 #define STN8815_PIN_N22     _GPIO(103)
0113 #define STN8815_PIN_V22     _GPIO(104)
0114 #define STN8815_PIN_V21     _GPIO(105)
0115 #define STN8815_PIN_K22     _GPIO(106)
0116 #define STN8815_PIN_K21     _GPIO(107)
0117 #define STN8815_PIN_H20     _GPIO(108)
0118 #define STN8815_PIN_G20     _GPIO(109)
0119 #define STN8815_PIN_L21     _GPIO(110)
0120 #define STN8815_PIN_H21     _GPIO(111)
0121 #define STN8815_PIN_J21     _GPIO(112)
0122 #define STN8815_PIN_H22     _GPIO(113)
0123 #define STN8815_PIN_K20     _GPIO(114)
0124 #define STN8815_PIN_L22     _GPIO(115)
0125 #define STN8815_PIN_G21     _GPIO(116)
0126 #define STN8815_PIN_J20     _GPIO(117)
0127 #define STN8815_PIN_G22     _GPIO(118)
0128 #define STN8815_PIN_U19     _GPIO(119)
0129 #define STN8815_PIN_G19     _GPIO(120)
0130 #define STN8815_PIN_M22     _GPIO(121)
0131 #define STN8815_PIN_M19     _GPIO(122)
0132 #define STN8815_PIN_J22     _GPIO(123)
0133 /* GPIOs 124-127 not routed to pins */
0134 
0135 /*
0136  * The names of the pins are denoted by GPIO number and ball name, even
0137  * though they can be used for other things than GPIO, this is the first
0138  * column in the table of the data sheet and often used on schematics and
0139  * such.
0140  */
0141 static const struct pinctrl_pin_desc nmk_stn8815_pins[] = {
0142     PINCTRL_PIN(STN8815_PIN_B4, "GPIO0_B4"),
0143     PINCTRL_PIN(STN8815_PIN_D5, "GPIO1_D5"),
0144     PINCTRL_PIN(STN8815_PIN_C5, "GPIO2_C5"),
0145     PINCTRL_PIN(STN8815_PIN_A4, "GPIO3_A4"),
0146     PINCTRL_PIN(STN8815_PIN_B5, "GPIO4_B5"),
0147     PINCTRL_PIN(STN8815_PIN_D6, "GPIO5_D6"),
0148     PINCTRL_PIN(STN8815_PIN_C6, "GPIO6_C6"),
0149     PINCTRL_PIN(STN8815_PIN_B6, "GPIO7_B6"),
0150     PINCTRL_PIN(STN8815_PIN_B10, "GPIO8_B10"),
0151     PINCTRL_PIN(STN8815_PIN_A10, "GPIO9_A10"),
0152     PINCTRL_PIN(STN8815_PIN_C11, "GPIO10_C11"),
0153     PINCTRL_PIN(STN8815_PIN_B11, "GPIO11_B11"),
0154     PINCTRL_PIN(STN8815_PIN_A11, "GPIO12_A11"),
0155     PINCTRL_PIN(STN8815_PIN_C12, "GPIO13_C12"),
0156     PINCTRL_PIN(STN8815_PIN_B12, "GPIO14_B12"),
0157     PINCTRL_PIN(STN8815_PIN_A12, "GPIO15_A12"),
0158     PINCTRL_PIN(STN8815_PIN_C13, "GPIO16_C13"),
0159     PINCTRL_PIN(STN8815_PIN_B13, "GPIO17_B13"),
0160     PINCTRL_PIN(STN8815_PIN_A13, "GPIO18_A13"),
0161     PINCTRL_PIN(STN8815_PIN_D13, "GPIO19_D13"),
0162     PINCTRL_PIN(STN8815_PIN_C14, "GPIO20_C14"),
0163     PINCTRL_PIN(STN8815_PIN_B14, "GPIO21_B14"),
0164     PINCTRL_PIN(STN8815_PIN_A14, "GPIO22_A14"),
0165     PINCTRL_PIN(STN8815_PIN_D15, "GPIO23_D15"),
0166     PINCTRL_PIN(STN8815_PIN_C15, "GPIO24_C15"),
0167     PINCTRL_PIN(STN8815_PIN_B15, "GPIO25_B15"),
0168     PINCTRL_PIN(STN8815_PIN_A15, "GPIO26_A15"),
0169     PINCTRL_PIN(STN8815_PIN_C16, "GPIO27_C16"),
0170     PINCTRL_PIN(STN8815_PIN_B16, "GPIO28_B16"),
0171     PINCTRL_PIN(STN8815_PIN_A16, "GPIO29_A16"),
0172     PINCTRL_PIN(STN8815_PIN_D17, "GPIO30_D17"),
0173     PINCTRL_PIN(STN8815_PIN_C17, "GPIO31_C17"),
0174     PINCTRL_PIN(STN8815_PIN_AB6, "GPIO32_AB6"),
0175     PINCTRL_PIN(STN8815_PIN_AA6, "GPIO33_AA6"),
0176     PINCTRL_PIN(STN8815_PIN_Y6, "GPIO34_Y6"),
0177     PINCTRL_PIN(STN8815_PIN_Y5, "GPIO35_Y5"),
0178     PINCTRL_PIN(STN8815_PIN_AA5, "GPIO36_AA5"),
0179     PINCTRL_PIN(STN8815_PIN_AB5, "GPIO37_AB5"),
0180     PINCTRL_PIN(STN8815_PIN_AB4, "GPIO38_AB4"),
0181     PINCTRL_PIN(STN8815_PIN_Y4, "GPIO39_Y4"),
0182     PINCTRL_PIN(STN8815_PIN_R1, "GPIO40_R1"),
0183     PINCTRL_PIN(STN8815_PIN_R2, "GPIO41_R2"),
0184     PINCTRL_PIN(STN8815_PIN_R3, "GPIO42_R3"),
0185     PINCTRL_PIN(STN8815_PIN_P1, "GPIO43_P1"),
0186     PINCTRL_PIN(STN8815_PIN_P2, "GPIO44_P2"),
0187     PINCTRL_PIN(STN8815_PIN_P3, "GPIO45_P3"),
0188     PINCTRL_PIN(STN8815_PIN_N1, "GPIO46_N1"),
0189     PINCTRL_PIN(STN8815_PIN_N2, "GPIO47_N2"),
0190     PINCTRL_PIN(STN8815_PIN_N3, "GPIO48_N3"),
0191     PINCTRL_PIN(STN8815_PIN_M1, "GPIO49_M1"),
0192     PINCTRL_PIN(STN8815_PIN_M3, "GPIO50_M3"),
0193     PINCTRL_PIN(STN8815_PIN_M2, "GPIO51_M2"),
0194     PINCTRL_PIN(STN8815_PIN_L1, "GPIO52_L1"),
0195     PINCTRL_PIN(STN8815_PIN_L4, "GPIO53_L4"),
0196     PINCTRL_PIN(STN8815_PIN_L3, "GPIO54_L3"),
0197     PINCTRL_PIN(STN8815_PIN_L2, "GPIO55_L2"),
0198     PINCTRL_PIN(STN8815_PIN_F3, "GPIO56_F3"),
0199     PINCTRL_PIN(STN8815_PIN_F2, "GPIO57_F2"),
0200     PINCTRL_PIN(STN8815_PIN_E1, "GPIO58_E1"),
0201     PINCTRL_PIN(STN8815_PIN_E3, "GPIO59_E3"),
0202     PINCTRL_PIN(STN8815_PIN_E2, "GPIO60_E2"),
0203     PINCTRL_PIN(STN8815_PIN_E4, "GPIO61_E4"),
0204     PINCTRL_PIN(STN8815_PIN_D3, "GPIO62_D3"),
0205     PINCTRL_PIN(STN8815_PIN_D2, "GPIO63_D2"),
0206     PINCTRL_PIN(STN8815_PIN_F21, "GPIO64_F21"),
0207     PINCTRL_PIN(STN8815_PIN_F20, "GPIO65_F20"),
0208     PINCTRL_PIN(STN8815_PIN_E22, "GPIO66_E22"),
0209     PINCTRL_PIN(STN8815_PIN_D22, "GPIO67_D22"),
0210     PINCTRL_PIN(STN8815_PIN_E21, "GPIO68_E21"),
0211     PINCTRL_PIN(STN8815_PIN_E20, "GPIO69_E20"),
0212     PINCTRL_PIN(STN8815_PIN_C22, "GPIO70_C22"),
0213     PINCTRL_PIN(STN8815_PIN_D21, "GPIO71_D21"),
0214     PINCTRL_PIN(STN8815_PIN_D20, "GPIO72_D20"),
0215     PINCTRL_PIN(STN8815_PIN_C21, "GPIO73_C21"),
0216     PINCTRL_PIN(STN8815_PIN_C20, "GPIO74_C20"),
0217     PINCTRL_PIN(STN8815_PIN_C19, "GPIO75_C19"),
0218     PINCTRL_PIN(STN8815_PIN_B20, "GPIO76_B20"),
0219     PINCTRL_PIN(STN8815_PIN_B8, "GPIO77_B8"),
0220     PINCTRL_PIN(STN8815_PIN_A8, "GPIO78_A8"),
0221     PINCTRL_PIN(STN8815_PIN_C9, "GPIO79_C9"),
0222     PINCTRL_PIN(STN8815_PIN_B9, "GPIO80_B9"),
0223     PINCTRL_PIN(STN8815_PIN_A9, "GPIO81_A9"),
0224     PINCTRL_PIN(STN8815_PIN_C10, "GPIO82_C10"),
0225     PINCTRL_PIN(STN8815_PIN_K1, "GPIO83_K1"),
0226     PINCTRL_PIN(STN8815_PIN_K3, "GPIO84_K3"),
0227     PINCTRL_PIN(STN8815_PIN_K2, "GPIO85_K2"),
0228     PINCTRL_PIN(STN8815_PIN_J1, "GPIO86_J1"),
0229     PINCTRL_PIN(STN8815_PIN_J3, "GPIO87_J3"),
0230     PINCTRL_PIN(STN8815_PIN_J2, "GPIO88_J2"),
0231     PINCTRL_PIN(STN8815_PIN_H1, "GPIO89_H1"),
0232     PINCTRL_PIN(STN8815_PIN_H3, "GPIO90_H3"),
0233     PINCTRL_PIN(STN8815_PIN_H2, "GPIO91_H2"),
0234     PINCTRL_PIN(STN8815_PIN_G1, "GPIO92_G1"),
0235     PINCTRL_PIN(STN8815_PIN_G3, "GPIO93_G3"),
0236     PINCTRL_PIN(STN8815_PIN_G2, "GPIO94_G2"),
0237     PINCTRL_PIN(STN8815_PIN_F1, "GPIO95_F1"),
0238     PINCTRL_PIN(STN8815_PIN_T20, "GPIO96_T20"),
0239     PINCTRL_PIN(STN8815_PIN_R21, "GPIO97_R21"),
0240     PINCTRL_PIN(STN8815_PIN_R20, "GPIO98_R20"),
0241     PINCTRL_PIN(STN8815_PIN_U22, "GPIO99_U22"),
0242     PINCTRL_PIN(STN8815_PIN_N21, "GPIO100_N21"),
0243     PINCTRL_PIN(STN8815_PIN_N20, "GPIO101_N20"),
0244     PINCTRL_PIN(STN8815_PIN_P22, "GPIO102_P22"),
0245     PINCTRL_PIN(STN8815_PIN_N22, "GPIO103_N22"),
0246     PINCTRL_PIN(STN8815_PIN_V22, "GPIO104_V22"),
0247     PINCTRL_PIN(STN8815_PIN_V21, "GPIO105_V21"),
0248     PINCTRL_PIN(STN8815_PIN_K22, "GPIO106_K22"),
0249     PINCTRL_PIN(STN8815_PIN_K21, "GPIO107_K21"),
0250     PINCTRL_PIN(STN8815_PIN_H20, "GPIO108_H20"),
0251     PINCTRL_PIN(STN8815_PIN_G20, "GPIO109_G20"),
0252     PINCTRL_PIN(STN8815_PIN_L21, "GPIO110_L21"),
0253     PINCTRL_PIN(STN8815_PIN_H21, "GPIO111_H21"),
0254     PINCTRL_PIN(STN8815_PIN_J21, "GPIO112_J21"),
0255     PINCTRL_PIN(STN8815_PIN_H22, "GPIO113_H22"),
0256     PINCTRL_PIN(STN8815_PIN_K20, "GPIO114_K20"),
0257     PINCTRL_PIN(STN8815_PIN_L22, "GPIO115_L22"),
0258     PINCTRL_PIN(STN8815_PIN_G21, "GPIO116_G21"),
0259     PINCTRL_PIN(STN8815_PIN_J20, "GPIO117_J20"),
0260     PINCTRL_PIN(STN8815_PIN_G22, "GPIO118_G22"),
0261     PINCTRL_PIN(STN8815_PIN_U19, "GPIO119_U19"),
0262     PINCTRL_PIN(STN8815_PIN_G19, "GPIO120_G19"),
0263     PINCTRL_PIN(STN8815_PIN_M22, "GPIO121_M22"),
0264     PINCTRL_PIN(STN8815_PIN_M19, "GPIO122_M19"),
0265     PINCTRL_PIN(STN8815_PIN_J22, "GPIO123_J22"),
0266 };
0267 
0268 /*
0269  * Read the pin group names like this:
0270  * u0_a_1    = first groups of pins for uart0 on alt function a
0271  * i2c2_b_2  = second group of pins for i2c2 on alt function b
0272  */
0273 
0274 /* Altfunction A */
0275 static const unsigned u0txrx_a_1_pins[] = { STN8815_PIN_B4, STN8815_PIN_D5 };
0276 static const unsigned u0ctsrts_a_1_pins[] = { STN8815_PIN_C5, STN8815_PIN_B6 };
0277 /* Modem pins: DCD, DSR, RI, DTR */
0278 static const unsigned u0modem_a_1_pins[] = { STN8815_PIN_A4, STN8815_PIN_B5,
0279     STN8815_PIN_D6, STN8815_PIN_C6 };
0280 static const unsigned mmcsd_a_1_pins[] = { STN8815_PIN_B10, STN8815_PIN_A10,
0281     STN8815_PIN_C11, STN8815_PIN_B11, STN8815_PIN_A11, STN8815_PIN_C12,
0282     STN8815_PIN_B12, STN8815_PIN_A12, STN8815_PIN_C13, STN8815_PIN_C15 };
0283 static const unsigned mmcsd_b_1_pins[] = { STN8815_PIN_D15 };
0284 static const unsigned u1_a_1_pins[] = { STN8815_PIN_M2, STN8815_PIN_L1,
0285                     STN8815_PIN_F3, STN8815_PIN_F2 };
0286 static const unsigned i2c1_a_1_pins[] = { STN8815_PIN_L4, STN8815_PIN_L3 };
0287 static const unsigned i2c0_a_1_pins[] = { STN8815_PIN_D3, STN8815_PIN_D2 };
0288 /* Altfunction B */
0289 static const unsigned u1_b_1_pins[] = { STN8815_PIN_B16, STN8815_PIN_A16 };
0290 static const unsigned i2cusb_b_1_pins[] = { STN8815_PIN_C21, STN8815_PIN_C20 };
0291 static const unsigned clcd_16_23_b_1_pins[] = { STN8815_PIN_AB6,
0292     STN8815_PIN_AA6, STN8815_PIN_Y6, STN8815_PIN_Y5, STN8815_PIN_AA5,
0293     STN8815_PIN_AB5, STN8815_PIN_AB4, STN8815_PIN_Y4 };
0294 /* Full-speed and high-speed USB pins */
0295 static const unsigned usbfs_b_1_pins[] = { STN8815_PIN_E21, STN8815_PIN_E20,
0296                        STN8815_PIN_C22, STN8815_PIN_D21,
0297                        STN8815_PIN_D20, STN8815_PIN_C21,
0298                        STN8815_PIN_C20 };
0299 static const unsigned usbhs_c_1_pins[] = { STN8815_PIN_E21, STN8815_PIN_E20,
0300                        STN8815_PIN_C20, STN8815_PIN_C19,
0301                        STN8815_PIN_C22, STN8815_PIN_D21,
0302                        STN8815_PIN_D20, STN8815_PIN_C21,
0303                        STN8815_PIN_C16, STN8815_PIN_A15,
0304                        STN8815_PIN_D17, STN8815_PIN_C17 };
0305 
0306 #define STN8815_PIN_GROUP(a, b) { .name = #a, .pins = a##_pins,     \
0307             .npins = ARRAY_SIZE(a##_pins), .altsetting = b }
0308 
0309 static const struct nmk_pingroup nmk_stn8815_groups[] = {
0310     STN8815_PIN_GROUP(u0txrx_a_1, NMK_GPIO_ALT_A),
0311     STN8815_PIN_GROUP(u0ctsrts_a_1, NMK_GPIO_ALT_A),
0312     STN8815_PIN_GROUP(u0modem_a_1, NMK_GPIO_ALT_A),
0313     STN8815_PIN_GROUP(mmcsd_a_1, NMK_GPIO_ALT_A),
0314     STN8815_PIN_GROUP(mmcsd_b_1, NMK_GPIO_ALT_B),
0315     STN8815_PIN_GROUP(u1_a_1, NMK_GPIO_ALT_A),
0316     STN8815_PIN_GROUP(i2c1_a_1, NMK_GPIO_ALT_A),
0317     STN8815_PIN_GROUP(i2c0_a_1, NMK_GPIO_ALT_A),
0318     STN8815_PIN_GROUP(u1_b_1, NMK_GPIO_ALT_B),
0319     STN8815_PIN_GROUP(i2cusb_b_1, NMK_GPIO_ALT_B),
0320     STN8815_PIN_GROUP(clcd_16_23_b_1, NMK_GPIO_ALT_B),
0321     STN8815_PIN_GROUP(usbfs_b_1, NMK_GPIO_ALT_B),
0322     STN8815_PIN_GROUP(usbhs_c_1, NMK_GPIO_ALT_C),
0323 };
0324 
0325 /* We use this macro to define the groups applicable to a function */
0326 #define STN8815_FUNC_GROUPS(a, b...)       \
0327 static const char * const a##_groups[] = { b };
0328 
0329 STN8815_FUNC_GROUPS(u0, "u0txrx_a_1", "u0ctsrts_a_1", "u0modem_a_1");
0330 STN8815_FUNC_GROUPS(mmcsd, "mmcsd_a_1", "mmcsd_b_1");
0331 STN8815_FUNC_GROUPS(u1, "u1_a_1", "u1_b_1");
0332 STN8815_FUNC_GROUPS(i2c1, "i2c1_a_1");
0333 STN8815_FUNC_GROUPS(i2c0, "i2c0_a_1");
0334 STN8815_FUNC_GROUPS(i2cusb, "i2cusb_b_1");
0335 STN8815_FUNC_GROUPS(clcd, "clcd_16_23_b_1");
0336 STN8815_FUNC_GROUPS(usb, "usbfs_b_1", "usbhs_c_1");
0337 
0338 #define FUNCTION(fname)                 \
0339     {                       \
0340         .name = #fname,             \
0341         .groups = fname##_groups,       \
0342         .ngroups = ARRAY_SIZE(fname##_groups),  \
0343     }
0344 
0345 static const struct nmk_function nmk_stn8815_functions[] = {
0346     FUNCTION(u0),
0347     FUNCTION(mmcsd),
0348     FUNCTION(u1),
0349     FUNCTION(i2c1),
0350     FUNCTION(i2c0),
0351     FUNCTION(i2cusb),
0352     FUNCTION(clcd),
0353     FUNCTION(usb),
0354 };
0355 
0356 static const struct nmk_pinctrl_soc_data nmk_stn8815_soc = {
0357     .pins = nmk_stn8815_pins,
0358     .npins = ARRAY_SIZE(nmk_stn8815_pins),
0359     .functions = nmk_stn8815_functions,
0360     .nfunctions = ARRAY_SIZE(nmk_stn8815_functions),
0361     .groups = nmk_stn8815_groups,
0362     .ngroups = ARRAY_SIZE(nmk_stn8815_groups),
0363 };
0364 
0365 void nmk_pinctrl_stn8815_init(const struct nmk_pinctrl_soc_data **soc)
0366 {
0367     *soc = &nmk_stn8815_soc;
0368 }