Bjorn Andersson | 55aaf834 | 2013-12-05 18:10:04 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013, Sony Mobile Communications AB. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 and |
| 6 | * only version 2 as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | */ |
| 13 | |
| 14 | #include <linux/module.h> |
| 15 | #include <linux/of.h> |
| 16 | #include <linux/platform_device.h> |
| 17 | #include <linux/pinctrl/pinctrl.h> |
Bjorn Andersson | 55aaf834 | 2013-12-05 18:10:04 -0800 | [diff] [blame] | 18 | |
| 19 | #include "pinctrl-msm.h" |
| 20 | |
| 21 | static const struct pinctrl_pin_desc msm8x74_pins[] = { |
| 22 | PINCTRL_PIN(0, "GPIO_0"), |
| 23 | PINCTRL_PIN(1, "GPIO_1"), |
| 24 | PINCTRL_PIN(2, "GPIO_2"), |
| 25 | PINCTRL_PIN(3, "GPIO_3"), |
| 26 | PINCTRL_PIN(4, "GPIO_4"), |
| 27 | PINCTRL_PIN(5, "GPIO_5"), |
| 28 | PINCTRL_PIN(6, "GPIO_6"), |
| 29 | PINCTRL_PIN(7, "GPIO_7"), |
| 30 | PINCTRL_PIN(8, "GPIO_8"), |
| 31 | PINCTRL_PIN(9, "GPIO_9"), |
| 32 | PINCTRL_PIN(10, "GPIO_10"), |
| 33 | PINCTRL_PIN(11, "GPIO_11"), |
| 34 | PINCTRL_PIN(12, "GPIO_12"), |
| 35 | PINCTRL_PIN(13, "GPIO_13"), |
| 36 | PINCTRL_PIN(14, "GPIO_14"), |
| 37 | PINCTRL_PIN(15, "GPIO_15"), |
| 38 | PINCTRL_PIN(16, "GPIO_16"), |
| 39 | PINCTRL_PIN(17, "GPIO_17"), |
| 40 | PINCTRL_PIN(18, "GPIO_18"), |
| 41 | PINCTRL_PIN(19, "GPIO_19"), |
| 42 | PINCTRL_PIN(20, "GPIO_20"), |
| 43 | PINCTRL_PIN(21, "GPIO_21"), |
| 44 | PINCTRL_PIN(22, "GPIO_22"), |
| 45 | PINCTRL_PIN(23, "GPIO_23"), |
| 46 | PINCTRL_PIN(24, "GPIO_24"), |
| 47 | PINCTRL_PIN(25, "GPIO_25"), |
| 48 | PINCTRL_PIN(26, "GPIO_26"), |
| 49 | PINCTRL_PIN(27, "GPIO_27"), |
| 50 | PINCTRL_PIN(28, "GPIO_28"), |
| 51 | PINCTRL_PIN(29, "GPIO_29"), |
| 52 | PINCTRL_PIN(30, "GPIO_30"), |
| 53 | PINCTRL_PIN(31, "GPIO_31"), |
| 54 | PINCTRL_PIN(32, "GPIO_32"), |
| 55 | PINCTRL_PIN(33, "GPIO_33"), |
| 56 | PINCTRL_PIN(34, "GPIO_34"), |
| 57 | PINCTRL_PIN(35, "GPIO_35"), |
| 58 | PINCTRL_PIN(36, "GPIO_36"), |
| 59 | PINCTRL_PIN(37, "GPIO_37"), |
| 60 | PINCTRL_PIN(38, "GPIO_38"), |
| 61 | PINCTRL_PIN(39, "GPIO_39"), |
| 62 | PINCTRL_PIN(40, "GPIO_40"), |
| 63 | PINCTRL_PIN(41, "GPIO_41"), |
| 64 | PINCTRL_PIN(42, "GPIO_42"), |
| 65 | PINCTRL_PIN(43, "GPIO_43"), |
| 66 | PINCTRL_PIN(44, "GPIO_44"), |
| 67 | PINCTRL_PIN(45, "GPIO_45"), |
| 68 | PINCTRL_PIN(46, "GPIO_46"), |
| 69 | PINCTRL_PIN(47, "GPIO_47"), |
| 70 | PINCTRL_PIN(48, "GPIO_48"), |
| 71 | PINCTRL_PIN(49, "GPIO_49"), |
| 72 | PINCTRL_PIN(50, "GPIO_50"), |
| 73 | PINCTRL_PIN(51, "GPIO_51"), |
| 74 | PINCTRL_PIN(52, "GPIO_52"), |
| 75 | PINCTRL_PIN(53, "GPIO_53"), |
| 76 | PINCTRL_PIN(54, "GPIO_54"), |
| 77 | PINCTRL_PIN(55, "GPIO_55"), |
| 78 | PINCTRL_PIN(56, "GPIO_56"), |
| 79 | PINCTRL_PIN(57, "GPIO_57"), |
| 80 | PINCTRL_PIN(58, "GPIO_58"), |
| 81 | PINCTRL_PIN(59, "GPIO_59"), |
| 82 | PINCTRL_PIN(60, "GPIO_60"), |
| 83 | PINCTRL_PIN(61, "GPIO_61"), |
| 84 | PINCTRL_PIN(62, "GPIO_62"), |
| 85 | PINCTRL_PIN(63, "GPIO_63"), |
| 86 | PINCTRL_PIN(64, "GPIO_64"), |
| 87 | PINCTRL_PIN(65, "GPIO_65"), |
| 88 | PINCTRL_PIN(66, "GPIO_66"), |
| 89 | PINCTRL_PIN(67, "GPIO_67"), |
| 90 | PINCTRL_PIN(68, "GPIO_68"), |
| 91 | PINCTRL_PIN(69, "GPIO_69"), |
| 92 | PINCTRL_PIN(70, "GPIO_70"), |
| 93 | PINCTRL_PIN(71, "GPIO_71"), |
| 94 | PINCTRL_PIN(72, "GPIO_72"), |
| 95 | PINCTRL_PIN(73, "GPIO_73"), |
| 96 | PINCTRL_PIN(74, "GPIO_74"), |
| 97 | PINCTRL_PIN(75, "GPIO_75"), |
| 98 | PINCTRL_PIN(76, "GPIO_76"), |
| 99 | PINCTRL_PIN(77, "GPIO_77"), |
| 100 | PINCTRL_PIN(78, "GPIO_78"), |
| 101 | PINCTRL_PIN(79, "GPIO_79"), |
| 102 | PINCTRL_PIN(80, "GPIO_80"), |
| 103 | PINCTRL_PIN(81, "GPIO_81"), |
| 104 | PINCTRL_PIN(82, "GPIO_82"), |
| 105 | PINCTRL_PIN(83, "GPIO_83"), |
| 106 | PINCTRL_PIN(84, "GPIO_84"), |
| 107 | PINCTRL_PIN(85, "GPIO_85"), |
| 108 | PINCTRL_PIN(86, "GPIO_86"), |
| 109 | PINCTRL_PIN(87, "GPIO_87"), |
| 110 | PINCTRL_PIN(88, "GPIO_88"), |
| 111 | PINCTRL_PIN(89, "GPIO_89"), |
| 112 | PINCTRL_PIN(90, "GPIO_90"), |
| 113 | PINCTRL_PIN(91, "GPIO_91"), |
| 114 | PINCTRL_PIN(92, "GPIO_92"), |
| 115 | PINCTRL_PIN(93, "GPIO_93"), |
| 116 | PINCTRL_PIN(94, "GPIO_94"), |
| 117 | PINCTRL_PIN(95, "GPIO_95"), |
| 118 | PINCTRL_PIN(96, "GPIO_96"), |
| 119 | PINCTRL_PIN(97, "GPIO_97"), |
| 120 | PINCTRL_PIN(98, "GPIO_98"), |
| 121 | PINCTRL_PIN(99, "GPIO_99"), |
| 122 | PINCTRL_PIN(100, "GPIO_100"), |
| 123 | PINCTRL_PIN(101, "GPIO_101"), |
| 124 | PINCTRL_PIN(102, "GPIO_102"), |
| 125 | PINCTRL_PIN(103, "GPIO_103"), |
| 126 | PINCTRL_PIN(104, "GPIO_104"), |
| 127 | PINCTRL_PIN(105, "GPIO_105"), |
| 128 | PINCTRL_PIN(106, "GPIO_106"), |
| 129 | PINCTRL_PIN(107, "GPIO_107"), |
| 130 | PINCTRL_PIN(108, "GPIO_108"), |
| 131 | PINCTRL_PIN(109, "GPIO_109"), |
| 132 | PINCTRL_PIN(110, "GPIO_110"), |
| 133 | PINCTRL_PIN(111, "GPIO_111"), |
| 134 | PINCTRL_PIN(112, "GPIO_112"), |
| 135 | PINCTRL_PIN(113, "GPIO_113"), |
| 136 | PINCTRL_PIN(114, "GPIO_114"), |
| 137 | PINCTRL_PIN(115, "GPIO_115"), |
| 138 | PINCTRL_PIN(116, "GPIO_116"), |
| 139 | PINCTRL_PIN(117, "GPIO_117"), |
| 140 | PINCTRL_PIN(118, "GPIO_118"), |
| 141 | PINCTRL_PIN(119, "GPIO_119"), |
| 142 | PINCTRL_PIN(120, "GPIO_120"), |
| 143 | PINCTRL_PIN(121, "GPIO_121"), |
| 144 | PINCTRL_PIN(122, "GPIO_122"), |
| 145 | PINCTRL_PIN(123, "GPIO_123"), |
| 146 | PINCTRL_PIN(124, "GPIO_124"), |
| 147 | PINCTRL_PIN(125, "GPIO_125"), |
| 148 | PINCTRL_PIN(126, "GPIO_126"), |
| 149 | PINCTRL_PIN(127, "GPIO_127"), |
| 150 | PINCTRL_PIN(128, "GPIO_128"), |
| 151 | PINCTRL_PIN(129, "GPIO_129"), |
| 152 | PINCTRL_PIN(130, "GPIO_130"), |
| 153 | PINCTRL_PIN(131, "GPIO_131"), |
| 154 | PINCTRL_PIN(132, "GPIO_132"), |
| 155 | PINCTRL_PIN(133, "GPIO_133"), |
| 156 | PINCTRL_PIN(134, "GPIO_134"), |
| 157 | PINCTRL_PIN(135, "GPIO_135"), |
| 158 | PINCTRL_PIN(136, "GPIO_136"), |
| 159 | PINCTRL_PIN(137, "GPIO_137"), |
| 160 | PINCTRL_PIN(138, "GPIO_138"), |
| 161 | PINCTRL_PIN(139, "GPIO_139"), |
| 162 | PINCTRL_PIN(140, "GPIO_140"), |
| 163 | PINCTRL_PIN(141, "GPIO_141"), |
| 164 | PINCTRL_PIN(142, "GPIO_142"), |
| 165 | PINCTRL_PIN(143, "GPIO_143"), |
| 166 | PINCTRL_PIN(144, "GPIO_144"), |
| 167 | PINCTRL_PIN(145, "GPIO_145"), |
| 168 | |
| 169 | PINCTRL_PIN(146, "SDC1_CLK"), |
| 170 | PINCTRL_PIN(147, "SDC1_CMD"), |
| 171 | PINCTRL_PIN(148, "SDC1_DATA"), |
| 172 | PINCTRL_PIN(149, "SDC2_CLK"), |
| 173 | PINCTRL_PIN(150, "SDC2_CMD"), |
| 174 | PINCTRL_PIN(151, "SDC2_DATA"), |
| 175 | }; |
| 176 | |
| 177 | #define DECLARE_MSM_GPIO_PINS(pin) static const unsigned int gpio##pin##_pins[] = { pin } |
| 178 | DECLARE_MSM_GPIO_PINS(0); |
| 179 | DECLARE_MSM_GPIO_PINS(1); |
| 180 | DECLARE_MSM_GPIO_PINS(2); |
| 181 | DECLARE_MSM_GPIO_PINS(3); |
| 182 | DECLARE_MSM_GPIO_PINS(4); |
| 183 | DECLARE_MSM_GPIO_PINS(5); |
| 184 | DECLARE_MSM_GPIO_PINS(6); |
| 185 | DECLARE_MSM_GPIO_PINS(7); |
| 186 | DECLARE_MSM_GPIO_PINS(8); |
| 187 | DECLARE_MSM_GPIO_PINS(9); |
| 188 | DECLARE_MSM_GPIO_PINS(10); |
| 189 | DECLARE_MSM_GPIO_PINS(11); |
| 190 | DECLARE_MSM_GPIO_PINS(12); |
| 191 | DECLARE_MSM_GPIO_PINS(13); |
| 192 | DECLARE_MSM_GPIO_PINS(14); |
| 193 | DECLARE_MSM_GPIO_PINS(15); |
| 194 | DECLARE_MSM_GPIO_PINS(16); |
| 195 | DECLARE_MSM_GPIO_PINS(17); |
| 196 | DECLARE_MSM_GPIO_PINS(18); |
| 197 | DECLARE_MSM_GPIO_PINS(19); |
| 198 | DECLARE_MSM_GPIO_PINS(20); |
| 199 | DECLARE_MSM_GPIO_PINS(21); |
| 200 | DECLARE_MSM_GPIO_PINS(22); |
| 201 | DECLARE_MSM_GPIO_PINS(23); |
| 202 | DECLARE_MSM_GPIO_PINS(24); |
| 203 | DECLARE_MSM_GPIO_PINS(25); |
| 204 | DECLARE_MSM_GPIO_PINS(26); |
| 205 | DECLARE_MSM_GPIO_PINS(27); |
| 206 | DECLARE_MSM_GPIO_PINS(28); |
| 207 | DECLARE_MSM_GPIO_PINS(29); |
| 208 | DECLARE_MSM_GPIO_PINS(30); |
| 209 | DECLARE_MSM_GPIO_PINS(31); |
| 210 | DECLARE_MSM_GPIO_PINS(32); |
| 211 | DECLARE_MSM_GPIO_PINS(33); |
| 212 | DECLARE_MSM_GPIO_PINS(34); |
| 213 | DECLARE_MSM_GPIO_PINS(35); |
| 214 | DECLARE_MSM_GPIO_PINS(36); |
| 215 | DECLARE_MSM_GPIO_PINS(37); |
| 216 | DECLARE_MSM_GPIO_PINS(38); |
| 217 | DECLARE_MSM_GPIO_PINS(39); |
| 218 | DECLARE_MSM_GPIO_PINS(40); |
| 219 | DECLARE_MSM_GPIO_PINS(41); |
| 220 | DECLARE_MSM_GPIO_PINS(42); |
| 221 | DECLARE_MSM_GPIO_PINS(43); |
| 222 | DECLARE_MSM_GPIO_PINS(44); |
| 223 | DECLARE_MSM_GPIO_PINS(45); |
| 224 | DECLARE_MSM_GPIO_PINS(46); |
| 225 | DECLARE_MSM_GPIO_PINS(47); |
| 226 | DECLARE_MSM_GPIO_PINS(48); |
| 227 | DECLARE_MSM_GPIO_PINS(49); |
| 228 | DECLARE_MSM_GPIO_PINS(50); |
| 229 | DECLARE_MSM_GPIO_PINS(51); |
| 230 | DECLARE_MSM_GPIO_PINS(52); |
| 231 | DECLARE_MSM_GPIO_PINS(53); |
| 232 | DECLARE_MSM_GPIO_PINS(54); |
| 233 | DECLARE_MSM_GPIO_PINS(55); |
| 234 | DECLARE_MSM_GPIO_PINS(56); |
| 235 | DECLARE_MSM_GPIO_PINS(57); |
| 236 | DECLARE_MSM_GPIO_PINS(58); |
| 237 | DECLARE_MSM_GPIO_PINS(59); |
| 238 | DECLARE_MSM_GPIO_PINS(60); |
| 239 | DECLARE_MSM_GPIO_PINS(61); |
| 240 | DECLARE_MSM_GPIO_PINS(62); |
| 241 | DECLARE_MSM_GPIO_PINS(63); |
| 242 | DECLARE_MSM_GPIO_PINS(64); |
| 243 | DECLARE_MSM_GPIO_PINS(65); |
| 244 | DECLARE_MSM_GPIO_PINS(66); |
| 245 | DECLARE_MSM_GPIO_PINS(67); |
| 246 | DECLARE_MSM_GPIO_PINS(68); |
| 247 | DECLARE_MSM_GPIO_PINS(69); |
| 248 | DECLARE_MSM_GPIO_PINS(70); |
| 249 | DECLARE_MSM_GPIO_PINS(71); |
| 250 | DECLARE_MSM_GPIO_PINS(72); |
| 251 | DECLARE_MSM_GPIO_PINS(73); |
| 252 | DECLARE_MSM_GPIO_PINS(74); |
| 253 | DECLARE_MSM_GPIO_PINS(75); |
| 254 | DECLARE_MSM_GPIO_PINS(76); |
| 255 | DECLARE_MSM_GPIO_PINS(77); |
| 256 | DECLARE_MSM_GPIO_PINS(78); |
| 257 | DECLARE_MSM_GPIO_PINS(79); |
| 258 | DECLARE_MSM_GPIO_PINS(80); |
| 259 | DECLARE_MSM_GPIO_PINS(81); |
| 260 | DECLARE_MSM_GPIO_PINS(82); |
| 261 | DECLARE_MSM_GPIO_PINS(83); |
| 262 | DECLARE_MSM_GPIO_PINS(84); |
| 263 | DECLARE_MSM_GPIO_PINS(85); |
| 264 | DECLARE_MSM_GPIO_PINS(86); |
| 265 | DECLARE_MSM_GPIO_PINS(87); |
| 266 | DECLARE_MSM_GPIO_PINS(88); |
| 267 | DECLARE_MSM_GPIO_PINS(89); |
| 268 | DECLARE_MSM_GPIO_PINS(90); |
| 269 | DECLARE_MSM_GPIO_PINS(91); |
| 270 | DECLARE_MSM_GPIO_PINS(92); |
| 271 | DECLARE_MSM_GPIO_PINS(93); |
| 272 | DECLARE_MSM_GPIO_PINS(94); |
| 273 | DECLARE_MSM_GPIO_PINS(95); |
| 274 | DECLARE_MSM_GPIO_PINS(96); |
| 275 | DECLARE_MSM_GPIO_PINS(97); |
| 276 | DECLARE_MSM_GPIO_PINS(98); |
| 277 | DECLARE_MSM_GPIO_PINS(99); |
| 278 | DECLARE_MSM_GPIO_PINS(100); |
| 279 | DECLARE_MSM_GPIO_PINS(101); |
| 280 | DECLARE_MSM_GPIO_PINS(102); |
| 281 | DECLARE_MSM_GPIO_PINS(103); |
| 282 | DECLARE_MSM_GPIO_PINS(104); |
| 283 | DECLARE_MSM_GPIO_PINS(105); |
| 284 | DECLARE_MSM_GPIO_PINS(106); |
| 285 | DECLARE_MSM_GPIO_PINS(107); |
| 286 | DECLARE_MSM_GPIO_PINS(108); |
| 287 | DECLARE_MSM_GPIO_PINS(109); |
| 288 | DECLARE_MSM_GPIO_PINS(110); |
| 289 | DECLARE_MSM_GPIO_PINS(111); |
| 290 | DECLARE_MSM_GPIO_PINS(112); |
| 291 | DECLARE_MSM_GPIO_PINS(113); |
| 292 | DECLARE_MSM_GPIO_PINS(114); |
| 293 | DECLARE_MSM_GPIO_PINS(115); |
| 294 | DECLARE_MSM_GPIO_PINS(116); |
| 295 | DECLARE_MSM_GPIO_PINS(117); |
| 296 | DECLARE_MSM_GPIO_PINS(118); |
| 297 | DECLARE_MSM_GPIO_PINS(119); |
| 298 | DECLARE_MSM_GPIO_PINS(120); |
| 299 | DECLARE_MSM_GPIO_PINS(121); |
| 300 | DECLARE_MSM_GPIO_PINS(122); |
| 301 | DECLARE_MSM_GPIO_PINS(123); |
| 302 | DECLARE_MSM_GPIO_PINS(124); |
| 303 | DECLARE_MSM_GPIO_PINS(125); |
| 304 | DECLARE_MSM_GPIO_PINS(126); |
| 305 | DECLARE_MSM_GPIO_PINS(127); |
| 306 | DECLARE_MSM_GPIO_PINS(128); |
| 307 | DECLARE_MSM_GPIO_PINS(129); |
| 308 | DECLARE_MSM_GPIO_PINS(130); |
| 309 | DECLARE_MSM_GPIO_PINS(131); |
| 310 | DECLARE_MSM_GPIO_PINS(132); |
| 311 | DECLARE_MSM_GPIO_PINS(133); |
| 312 | DECLARE_MSM_GPIO_PINS(134); |
| 313 | DECLARE_MSM_GPIO_PINS(135); |
| 314 | DECLARE_MSM_GPIO_PINS(136); |
| 315 | DECLARE_MSM_GPIO_PINS(137); |
| 316 | DECLARE_MSM_GPIO_PINS(138); |
| 317 | DECLARE_MSM_GPIO_PINS(139); |
| 318 | DECLARE_MSM_GPIO_PINS(140); |
| 319 | DECLARE_MSM_GPIO_PINS(141); |
| 320 | DECLARE_MSM_GPIO_PINS(142); |
| 321 | DECLARE_MSM_GPIO_PINS(143); |
| 322 | DECLARE_MSM_GPIO_PINS(144); |
| 323 | DECLARE_MSM_GPIO_PINS(145); |
| 324 | |
| 325 | static const unsigned int sdc1_clk_pins[] = { 146 }; |
| 326 | static const unsigned int sdc1_cmd_pins[] = { 147 }; |
| 327 | static const unsigned int sdc1_data_pins[] = { 148 }; |
| 328 | static const unsigned int sdc2_clk_pins[] = { 149 }; |
| 329 | static const unsigned int sdc2_cmd_pins[] = { 150 }; |
| 330 | static const unsigned int sdc2_data_pins[] = { 151 }; |
| 331 | |
| 332 | #define FUNCTION(fname) \ |
| 333 | [MSM_MUX_##fname] = { \ |
| 334 | .name = #fname, \ |
| 335 | .groups = fname##_groups, \ |
| 336 | .ngroups = ARRAY_SIZE(fname##_groups), \ |
| 337 | } |
| 338 | |
| 339 | #define PINGROUP(id, f1, f2, f3, f4, f5, f6, f7) \ |
| 340 | { \ |
| 341 | .name = "gpio" #id, \ |
| 342 | .pins = gpio##id##_pins, \ |
| 343 | .npins = ARRAY_SIZE(gpio##id##_pins), \ |
| 344 | .funcs = { \ |
| 345 | MSM_MUX_NA, /* gpio mode */ \ |
| 346 | MSM_MUX_##f1, \ |
| 347 | MSM_MUX_##f2, \ |
| 348 | MSM_MUX_##f3, \ |
| 349 | MSM_MUX_##f4, \ |
| 350 | MSM_MUX_##f5, \ |
| 351 | MSM_MUX_##f6, \ |
| 352 | MSM_MUX_##f7 \ |
| 353 | }, \ |
Bjorn Andersson | 1f2b239 | 2013-12-14 23:01:51 -0800 | [diff] [blame] | 354 | .ctl_reg = 0x1000 + 0x10 * id, \ |
Bjorn Andersson | 55aaf834 | 2013-12-05 18:10:04 -0800 | [diff] [blame] | 355 | .io_reg = 0x1004 + 0x10 * id, \ |
| 356 | .intr_cfg_reg = 0x1008 + 0x10 * id, \ |
| 357 | .intr_status_reg = 0x100c + 0x10 * id, \ |
| 358 | .intr_target_reg = 0x1008 + 0x10 * id, \ |
| 359 | .mux_bit = 2, \ |
| 360 | .pull_bit = 0, \ |
| 361 | .drv_bit = 6, \ |
| 362 | .oe_bit = 9, \ |
| 363 | .in_bit = 0, \ |
| 364 | .out_bit = 1, \ |
| 365 | .intr_enable_bit = 0, \ |
| 366 | .intr_status_bit = 0, \ |
| 367 | .intr_target_bit = 5, \ |
| 368 | .intr_raw_status_bit = 4, \ |
| 369 | .intr_polarity_bit = 1, \ |
| 370 | .intr_detection_bit = 2, \ |
| 371 | .intr_detection_width = 2, \ |
| 372 | } |
| 373 | |
| 374 | #define SDC_PINGROUP(pg_name, ctl, pull, drv) \ |
| 375 | { \ |
| 376 | .name = #pg_name, \ |
| 377 | .pins = pg_name##_pins, \ |
| 378 | .npins = ARRAY_SIZE(pg_name##_pins), \ |
| 379 | .ctl_reg = ctl, \ |
| 380 | .io_reg = 0, \ |
| 381 | .intr_cfg_reg = 0, \ |
| 382 | .intr_status_reg = 0, \ |
| 383 | .intr_target_reg = 0, \ |
| 384 | .mux_bit = -1, \ |
| 385 | .pull_bit = pull, \ |
| 386 | .drv_bit = drv, \ |
| 387 | .oe_bit = -1, \ |
| 388 | .in_bit = -1, \ |
| 389 | .out_bit = -1, \ |
| 390 | .intr_enable_bit = -1, \ |
| 391 | .intr_status_bit = -1, \ |
| 392 | .intr_target_bit = -1, \ |
| 393 | .intr_raw_status_bit = -1, \ |
| 394 | .intr_polarity_bit = -1, \ |
| 395 | .intr_detection_bit = -1, \ |
| 396 | .intr_detection_width = -1, \ |
| 397 | } |
| 398 | |
| 399 | /* |
| 400 | * TODO: Add the rest of the possible functions and fill out |
| 401 | * the pingroup table below. |
| 402 | */ |
| 403 | enum msm8x74_functions { |
| 404 | MSM_MUX_blsp_i2c2, |
| 405 | MSM_MUX_blsp_i2c6, |
| 406 | MSM_MUX_blsp_i2c11, |
| 407 | MSM_MUX_blsp_spi1, |
Ivan T. Ivanov | dc17911 | 2014-02-06 17:28:48 +0200 | [diff] [blame] | 408 | MSM_MUX_blsp_spi8, |
Bjorn Andersson | 55aaf834 | 2013-12-05 18:10:04 -0800 | [diff] [blame] | 409 | MSM_MUX_blsp_uart2, |
| 410 | MSM_MUX_blsp_uart8, |
| 411 | MSM_MUX_slimbus, |
| 412 | MSM_MUX_NA, |
| 413 | }; |
| 414 | |
| 415 | static const char * const blsp_i2c2_groups[] = { "gpio6", "gpio7" }; |
| 416 | static const char * const blsp_i2c6_groups[] = { "gpio29", "gpio30" }; |
| 417 | static const char * const blsp_i2c11_groups[] = { "gpio83", "gpio84" }; |
| 418 | static const char * const blsp_spi1_groups[] = { "gpio0", "gpio1", "gpio2", "gpio3" }; |
Ivan T. Ivanov | dc17911 | 2014-02-06 17:28:48 +0200 | [diff] [blame] | 419 | static const char * const blsp_spi8_groups[] = { |
| 420 | "gpio45", "gpio46", "gpio47", "gpio48" |
| 421 | }; |
Bjorn Andersson | 55aaf834 | 2013-12-05 18:10:04 -0800 | [diff] [blame] | 422 | static const char * const blsp_uart2_groups[] = { "gpio4", "gpio5" }; |
| 423 | static const char * const blsp_uart8_groups[] = { "gpio45", "gpio46" }; |
| 424 | static const char * const slimbus_groups[] = { "gpio70", "gpio71" }; |
| 425 | |
| 426 | static const struct msm_function msm8x74_functions[] = { |
| 427 | FUNCTION(blsp_i2c2), |
| 428 | FUNCTION(blsp_i2c6), |
| 429 | FUNCTION(blsp_i2c11), |
| 430 | FUNCTION(blsp_spi1), |
Ivan T. Ivanov | dc17911 | 2014-02-06 17:28:48 +0200 | [diff] [blame] | 431 | FUNCTION(blsp_spi8), |
Bjorn Andersson | 55aaf834 | 2013-12-05 18:10:04 -0800 | [diff] [blame] | 432 | FUNCTION(blsp_uart2), |
| 433 | FUNCTION(blsp_uart8), |
| 434 | FUNCTION(slimbus), |
| 435 | }; |
| 436 | |
| 437 | static const struct msm_pingroup msm8x74_groups[] = { |
| 438 | PINGROUP(0, blsp_spi1, NA, NA, NA, NA, NA, NA), |
| 439 | PINGROUP(1, blsp_spi1, NA, NA, NA, NA, NA, NA), |
| 440 | PINGROUP(2, blsp_spi1, NA, NA, NA, NA, NA, NA), |
| 441 | PINGROUP(3, blsp_spi1, NA, NA, NA, NA, NA, NA), |
| 442 | PINGROUP(4, NA, blsp_uart2, NA, NA, NA, NA, NA), |
| 443 | PINGROUP(5, NA, blsp_uart2, NA, NA, NA, NA, NA), |
| 444 | PINGROUP(6, NA, NA, blsp_i2c2, NA, NA, NA, NA), |
| 445 | PINGROUP(7, NA, NA, blsp_i2c2, NA, NA, NA, NA), |
| 446 | PINGROUP(8, NA, NA, NA, NA, NA, NA, NA), |
| 447 | PINGROUP(9, NA, NA, NA, NA, NA, NA, NA), |
| 448 | PINGROUP(10, NA, NA, NA, NA, NA, NA, NA), |
| 449 | PINGROUP(11, NA, NA, NA, NA, NA, NA, NA), |
| 450 | PINGROUP(12, NA, NA, NA, NA, NA, NA, NA), |
| 451 | PINGROUP(13, NA, NA, NA, NA, NA, NA, NA), |
| 452 | PINGROUP(14, NA, NA, NA, NA, NA, NA, NA), |
| 453 | PINGROUP(15, NA, NA, NA, NA, NA, NA, NA), |
| 454 | PINGROUP(16, NA, NA, NA, NA, NA, NA, NA), |
| 455 | PINGROUP(17, NA, NA, NA, NA, NA, NA, NA), |
| 456 | PINGROUP(18, NA, NA, NA, NA, NA, NA, NA), |
| 457 | PINGROUP(19, NA, NA, NA, NA, NA, NA, NA), |
| 458 | PINGROUP(20, NA, NA, NA, NA, NA, NA, NA), |
| 459 | PINGROUP(21, NA, NA, NA, NA, NA, NA, NA), |
| 460 | PINGROUP(22, NA, NA, NA, NA, NA, NA, NA), |
| 461 | PINGROUP(23, NA, NA, NA, NA, NA, NA, NA), |
| 462 | PINGROUP(24, NA, NA, NA, NA, NA, NA, NA), |
| 463 | PINGROUP(25, NA, NA, NA, NA, NA, NA, NA), |
| 464 | PINGROUP(26, NA, NA, NA, NA, NA, NA, NA), |
| 465 | PINGROUP(27, NA, NA, NA, NA, NA, NA, NA), |
| 466 | PINGROUP(28, NA, NA, NA, NA, NA, NA, NA), |
| 467 | PINGROUP(29, NA, NA, blsp_i2c6, NA, NA, NA, NA), |
| 468 | PINGROUP(30, NA, NA, blsp_i2c6, NA, NA, NA, NA), |
| 469 | PINGROUP(31, NA, NA, NA, NA, NA, NA, NA), |
| 470 | PINGROUP(32, NA, NA, NA, NA, NA, NA, NA), |
| 471 | PINGROUP(33, NA, NA, NA, NA, NA, NA, NA), |
| 472 | PINGROUP(34, NA, NA, NA, NA, NA, NA, NA), |
| 473 | PINGROUP(35, NA, NA, NA, NA, NA, NA, NA), |
| 474 | PINGROUP(36, NA, NA, NA, NA, NA, NA, NA), |
| 475 | PINGROUP(37, NA, NA, NA, NA, NA, NA, NA), |
| 476 | PINGROUP(38, NA, NA, NA, NA, NA, NA, NA), |
| 477 | PINGROUP(39, NA, NA, NA, NA, NA, NA, NA), |
| 478 | PINGROUP(40, NA, NA, NA, NA, NA, NA, NA), |
| 479 | PINGROUP(41, NA, NA, NA, NA, NA, NA, NA), |
| 480 | PINGROUP(42, NA, NA, NA, NA, NA, NA, NA), |
| 481 | PINGROUP(43, NA, NA, NA, NA, NA, NA, NA), |
| 482 | PINGROUP(44, NA, NA, NA, NA, NA, NA, NA), |
Ivan T. Ivanov | dc17911 | 2014-02-06 17:28:48 +0200 | [diff] [blame] | 483 | PINGROUP(45, blsp_spi8, blsp_uart8, NA, NA, NA, NA, NA), |
| 484 | PINGROUP(46, blsp_spi8, blsp_uart8, NA, NA, NA, NA, NA), |
| 485 | PINGROUP(47, blsp_spi8, NA, NA, NA, NA, NA, NA), |
| 486 | PINGROUP(48, blsp_spi8, NA, NA, NA, NA, NA, NA), |
Bjorn Andersson | 55aaf834 | 2013-12-05 18:10:04 -0800 | [diff] [blame] | 487 | PINGROUP(49, NA, NA, NA, NA, NA, NA, NA), |
| 488 | PINGROUP(50, NA, NA, NA, NA, NA, NA, NA), |
| 489 | PINGROUP(51, NA, NA, NA, NA, NA, NA, NA), |
| 490 | PINGROUP(52, NA, NA, NA, NA, NA, NA, NA), |
| 491 | PINGROUP(53, NA, NA, NA, NA, NA, NA, NA), |
| 492 | PINGROUP(54, NA, NA, NA, NA, NA, NA, NA), |
| 493 | PINGROUP(55, NA, NA, NA, NA, NA, NA, NA), |
| 494 | PINGROUP(56, NA, NA, NA, NA, NA, NA, NA), |
| 495 | PINGROUP(57, NA, NA, NA, NA, NA, NA, NA), |
| 496 | PINGROUP(58, NA, NA, NA, NA, NA, NA, NA), |
| 497 | PINGROUP(59, NA, NA, NA, NA, NA, NA, NA), |
| 498 | PINGROUP(60, NA, NA, NA, NA, NA, NA, NA), |
| 499 | PINGROUP(61, NA, NA, NA, NA, NA, NA, NA), |
| 500 | PINGROUP(62, NA, NA, NA, NA, NA, NA, NA), |
| 501 | PINGROUP(63, NA, NA, NA, NA, NA, NA, NA), |
| 502 | PINGROUP(64, NA, NA, NA, NA, NA, NA, NA), |
| 503 | PINGROUP(65, NA, NA, NA, NA, NA, NA, NA), |
| 504 | PINGROUP(66, NA, NA, NA, NA, NA, NA, NA), |
| 505 | PINGROUP(67, NA, NA, NA, NA, NA, NA, NA), |
| 506 | PINGROUP(68, NA, NA, NA, NA, NA, NA, NA), |
| 507 | PINGROUP(69, NA, NA, NA, NA, NA, NA, NA), |
| 508 | PINGROUP(70, slimbus, NA, NA, NA, NA, NA, NA), |
| 509 | PINGROUP(71, slimbus, NA, NA, NA, NA, NA, NA), |
| 510 | PINGROUP(72, NA, NA, NA, NA, NA, NA, NA), |
| 511 | PINGROUP(73, NA, NA, NA, NA, NA, NA, NA), |
| 512 | PINGROUP(74, NA, NA, NA, NA, NA, NA, NA), |
| 513 | PINGROUP(75, NA, NA, NA, NA, NA, NA, NA), |
| 514 | PINGROUP(76, NA, NA, NA, NA, NA, NA, NA), |
| 515 | PINGROUP(77, NA, NA, NA, NA, NA, NA, NA), |
| 516 | PINGROUP(78, NA, NA, NA, NA, NA, NA, NA), |
| 517 | PINGROUP(79, NA, NA, NA, NA, NA, NA, NA), |
| 518 | PINGROUP(80, NA, NA, NA, NA, NA, NA, NA), |
| 519 | PINGROUP(81, NA, NA, NA, NA, NA, NA, NA), |
| 520 | PINGROUP(82, NA, NA, NA, NA, NA, NA, NA), |
| 521 | PINGROUP(83, NA, NA, blsp_i2c11, NA, NA, NA, NA), |
| 522 | PINGROUP(84, NA, NA, blsp_i2c11, NA, NA, NA, NA), |
| 523 | PINGROUP(85, NA, NA, NA, NA, NA, NA, NA), |
| 524 | PINGROUP(86, NA, NA, NA, NA, NA, NA, NA), |
| 525 | PINGROUP(87, NA, NA, NA, NA, NA, NA, NA), |
| 526 | PINGROUP(88, NA, NA, NA, NA, NA, NA, NA), |
| 527 | PINGROUP(89, NA, NA, NA, NA, NA, NA, NA), |
| 528 | PINGROUP(90, NA, NA, NA, NA, NA, NA, NA), |
| 529 | PINGROUP(91, NA, NA, NA, NA, NA, NA, NA), |
| 530 | PINGROUP(92, NA, NA, NA, NA, NA, NA, NA), |
| 531 | PINGROUP(93, NA, NA, NA, NA, NA, NA, NA), |
| 532 | PINGROUP(94, NA, NA, NA, NA, NA, NA, NA), |
| 533 | PINGROUP(95, NA, NA, NA, NA, NA, NA, NA), |
| 534 | PINGROUP(96, NA, NA, NA, NA, NA, NA, NA), |
| 535 | PINGROUP(97, NA, NA, NA, NA, NA, NA, NA), |
| 536 | PINGROUP(98, NA, NA, NA, NA, NA, NA, NA), |
| 537 | PINGROUP(99, NA, NA, NA, NA, NA, NA, NA), |
| 538 | PINGROUP(100, NA, NA, NA, NA, NA, NA, NA), |
| 539 | PINGROUP(101, NA, NA, NA, NA, NA, NA, NA), |
| 540 | PINGROUP(102, NA, NA, NA, NA, NA, NA, NA), |
| 541 | PINGROUP(103, NA, NA, NA, NA, NA, NA, NA), |
| 542 | PINGROUP(104, NA, NA, NA, NA, NA, NA, NA), |
| 543 | PINGROUP(105, NA, NA, NA, NA, NA, NA, NA), |
| 544 | PINGROUP(106, NA, NA, NA, NA, NA, NA, NA), |
| 545 | PINGROUP(107, NA, NA, NA, NA, NA, NA, NA), |
| 546 | PINGROUP(108, NA, NA, NA, NA, NA, NA, NA), |
| 547 | PINGROUP(109, NA, NA, NA, NA, NA, NA, NA), |
| 548 | PINGROUP(110, NA, NA, NA, NA, NA, NA, NA), |
| 549 | PINGROUP(111, NA, NA, NA, NA, NA, NA, NA), |
| 550 | PINGROUP(112, NA, NA, NA, NA, NA, NA, NA), |
| 551 | PINGROUP(113, NA, NA, NA, NA, NA, NA, NA), |
| 552 | PINGROUP(114, NA, NA, NA, NA, NA, NA, NA), |
| 553 | PINGROUP(115, NA, NA, NA, NA, NA, NA, NA), |
| 554 | PINGROUP(116, NA, NA, NA, NA, NA, NA, NA), |
| 555 | PINGROUP(117, NA, NA, NA, NA, NA, NA, NA), |
| 556 | PINGROUP(118, NA, NA, NA, NA, NA, NA, NA), |
| 557 | PINGROUP(119, NA, NA, NA, NA, NA, NA, NA), |
| 558 | PINGROUP(120, NA, NA, NA, NA, NA, NA, NA), |
| 559 | PINGROUP(121, NA, NA, NA, NA, NA, NA, NA), |
| 560 | PINGROUP(122, NA, NA, NA, NA, NA, NA, NA), |
| 561 | PINGROUP(123, NA, NA, NA, NA, NA, NA, NA), |
| 562 | PINGROUP(124, NA, NA, NA, NA, NA, NA, NA), |
| 563 | PINGROUP(125, NA, NA, NA, NA, NA, NA, NA), |
| 564 | PINGROUP(126, NA, NA, NA, NA, NA, NA, NA), |
| 565 | PINGROUP(127, NA, NA, NA, NA, NA, NA, NA), |
| 566 | PINGROUP(128, NA, NA, NA, NA, NA, NA, NA), |
| 567 | PINGROUP(129, NA, NA, NA, NA, NA, NA, NA), |
| 568 | PINGROUP(130, NA, NA, NA, NA, NA, NA, NA), |
| 569 | PINGROUP(131, NA, NA, NA, NA, NA, NA, NA), |
| 570 | PINGROUP(132, NA, NA, NA, NA, NA, NA, NA), |
| 571 | PINGROUP(133, NA, NA, NA, NA, NA, NA, NA), |
| 572 | PINGROUP(134, NA, NA, NA, NA, NA, NA, NA), |
| 573 | PINGROUP(135, NA, NA, NA, NA, NA, NA, NA), |
| 574 | PINGROUP(136, NA, NA, NA, NA, NA, NA, NA), |
| 575 | PINGROUP(137, NA, NA, NA, NA, NA, NA, NA), |
| 576 | PINGROUP(138, NA, NA, NA, NA, NA, NA, NA), |
| 577 | PINGROUP(139, NA, NA, NA, NA, NA, NA, NA), |
| 578 | PINGROUP(140, NA, NA, NA, NA, NA, NA, NA), |
| 579 | PINGROUP(141, NA, NA, NA, NA, NA, NA, NA), |
| 580 | PINGROUP(143, NA, NA, NA, NA, NA, NA, NA), |
| 581 | PINGROUP(143, NA, NA, NA, NA, NA, NA, NA), |
| 582 | PINGROUP(144, NA, NA, NA, NA, NA, NA, NA), |
| 583 | PINGROUP(145, NA, NA, NA, NA, NA, NA, NA), |
| 584 | SDC_PINGROUP(sdc1_clk, 0x2044, 13, 6), |
| 585 | SDC_PINGROUP(sdc1_cmd, 0x2044, 11, 3), |
| 586 | SDC_PINGROUP(sdc1_data, 0x2044, 9, 0), |
| 587 | SDC_PINGROUP(sdc2_clk, 0x2048, 14, 6), |
| 588 | SDC_PINGROUP(sdc2_cmd, 0x2048, 11, 3), |
| 589 | SDC_PINGROUP(sdc2_data, 0x2048, 9, 0), |
| 590 | }; |
| 591 | |
| 592 | #define NUM_GPIO_PINGROUPS 146 |
| 593 | |
| 594 | static const struct msm_pinctrl_soc_data msm8x74_pinctrl = { |
| 595 | .pins = msm8x74_pins, |
| 596 | .npins = ARRAY_SIZE(msm8x74_pins), |
| 597 | .functions = msm8x74_functions, |
| 598 | .nfunctions = ARRAY_SIZE(msm8x74_functions), |
| 599 | .groups = msm8x74_groups, |
| 600 | .ngroups = ARRAY_SIZE(msm8x74_groups), |
| 601 | .ngpios = NUM_GPIO_PINGROUPS, |
| 602 | }; |
| 603 | |
| 604 | static int msm8x74_pinctrl_probe(struct platform_device *pdev) |
| 605 | { |
| 606 | return msm_pinctrl_probe(pdev, &msm8x74_pinctrl); |
| 607 | } |
| 608 | |
Bjorn Andersson | 1f2b239 | 2013-12-14 23:01:51 -0800 | [diff] [blame] | 609 | static const struct of_device_id msm8x74_pinctrl_of_match[] = { |
Bjorn Andersson | b31d100 | 2013-12-14 23:01:54 -0800 | [diff] [blame] | 610 | { .compatible = "qcom,msm8974-pinctrl", }, |
Bjorn Andersson | 55aaf834 | 2013-12-05 18:10:04 -0800 | [diff] [blame] | 611 | { }, |
| 612 | }; |
| 613 | |
| 614 | static struct platform_driver msm8x74_pinctrl_driver = { |
| 615 | .driver = { |
| 616 | .name = "msm8x74-pinctrl", |
| 617 | .owner = THIS_MODULE, |
| 618 | .of_match_table = msm8x74_pinctrl_of_match, |
| 619 | }, |
| 620 | .probe = msm8x74_pinctrl_probe, |
| 621 | .remove = msm_pinctrl_remove, |
| 622 | }; |
| 623 | |
| 624 | static int __init msm8x74_pinctrl_init(void) |
| 625 | { |
| 626 | return platform_driver_register(&msm8x74_pinctrl_driver); |
| 627 | } |
| 628 | arch_initcall(msm8x74_pinctrl_init); |
| 629 | |
| 630 | static void __exit msm8x74_pinctrl_exit(void) |
| 631 | { |
| 632 | platform_driver_unregister(&msm8x74_pinctrl_driver); |
| 633 | } |
| 634 | module_exit(msm8x74_pinctrl_exit); |
| 635 | |
| 636 | MODULE_AUTHOR("Bjorn Andersson <bjorn.andersson@sonymobile.com>"); |
| 637 | MODULE_DESCRIPTION("Qualcomm MSM8x74 pinctrl driver"); |
| 638 | MODULE_LICENSE("GPL v2"); |
| 639 | MODULE_DEVICE_TABLE(of, msm8x74_pinctrl_of_match); |
| 640 | |