Jingchang Lu | 78bafc6 | 2013-05-28 17:32:08 +0800 | [diff] [blame] | 1 | /* |
| 2 | * VF610 pinctrl driver based on imx pinmux and pinconf core |
| 3 | * |
| 4 | * Copyright 2013 Freescale Semiconductor, Inc. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/err.h> |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/io.h> |
| 15 | #include <linux/module.h> |
| 16 | #include <linux/of.h> |
| 17 | #include <linux/of_device.h> |
| 18 | #include <linux/pinctrl/pinctrl.h> |
| 19 | |
| 20 | #include "pinctrl-imx.h" |
| 21 | |
| 22 | enum vf610_pads { |
| 23 | VF610_PAD_PTA6 = 0, |
| 24 | VF610_PAD_PTA8 = 1, |
| 25 | VF610_PAD_PTA9 = 2, |
| 26 | VF610_PAD_PTA10 = 3, |
| 27 | VF610_PAD_PTA11 = 4, |
| 28 | VF610_PAD_PTA12 = 5, |
| 29 | VF610_PAD_PTA16 = 6, |
| 30 | VF610_PAD_PTA17 = 7, |
| 31 | VF610_PAD_PTA18 = 8, |
| 32 | VF610_PAD_PTA19 = 9, |
| 33 | VF610_PAD_PTA20 = 10, |
| 34 | VF610_PAD_PTA21 = 11, |
| 35 | VF610_PAD_PTA22 = 12, |
| 36 | VF610_PAD_PTA23 = 13, |
| 37 | VF610_PAD_PTA24 = 14, |
| 38 | VF610_PAD_PTA25 = 15, |
| 39 | VF610_PAD_PTA26 = 16, |
| 40 | VF610_PAD_PTA27 = 17, |
| 41 | VF610_PAD_PTA28 = 18, |
| 42 | VF610_PAD_PTA29 = 19, |
| 43 | VF610_PAD_PTA30 = 20, |
| 44 | VF610_PAD_PTA31 = 21, |
| 45 | VF610_PAD_PTB0 = 22, |
| 46 | VF610_PAD_PTB1 = 23, |
| 47 | VF610_PAD_PTB2 = 24, |
| 48 | VF610_PAD_PTB3 = 25, |
| 49 | VF610_PAD_PTB4 = 26, |
| 50 | VF610_PAD_PTB5 = 27, |
| 51 | VF610_PAD_PTB6 = 28, |
| 52 | VF610_PAD_PTB7 = 29, |
| 53 | VF610_PAD_PTB8 = 30, |
| 54 | VF610_PAD_PTB9 = 31, |
| 55 | VF610_PAD_PTB10 = 32, |
| 56 | VF610_PAD_PTB11 = 33, |
| 57 | VF610_PAD_PTB12 = 34, |
| 58 | VF610_PAD_PTB13 = 35, |
| 59 | VF610_PAD_PTB14 = 36, |
| 60 | VF610_PAD_PTB15 = 37, |
| 61 | VF610_PAD_PTB16 = 38, |
| 62 | VF610_PAD_PTB17 = 39, |
| 63 | VF610_PAD_PTB18 = 40, |
| 64 | VF610_PAD_PTB19 = 41, |
| 65 | VF610_PAD_PTB20 = 42, |
| 66 | VF610_PAD_PTB21 = 43, |
| 67 | VF610_PAD_PTB22 = 44, |
| 68 | VF610_PAD_PTC0 = 45, |
| 69 | VF610_PAD_PTC1 = 46, |
| 70 | VF610_PAD_PTC2 = 47, |
| 71 | VF610_PAD_PTC3 = 48, |
| 72 | VF610_PAD_PTC4 = 49, |
| 73 | VF610_PAD_PTC5 = 50, |
| 74 | VF610_PAD_PTC6 = 51, |
| 75 | VF610_PAD_PTC7 = 52, |
| 76 | VF610_PAD_PTC8 = 53, |
| 77 | VF610_PAD_PTC9 = 54, |
| 78 | VF610_PAD_PTC10 = 55, |
| 79 | VF610_PAD_PTC11 = 56, |
| 80 | VF610_PAD_PTC12 = 57, |
| 81 | VF610_PAD_PTC13 = 58, |
| 82 | VF610_PAD_PTC14 = 59, |
| 83 | VF610_PAD_PTC15 = 60, |
| 84 | VF610_PAD_PTC16 = 61, |
| 85 | VF610_PAD_PTC17 = 62, |
| 86 | VF610_PAD_PTD31 = 63, |
| 87 | VF610_PAD_PTD30 = 64, |
| 88 | VF610_PAD_PTD29 = 65, |
| 89 | VF610_PAD_PTD28 = 66, |
| 90 | VF610_PAD_PTD27 = 67, |
| 91 | VF610_PAD_PTD26 = 68, |
| 92 | VF610_PAD_PTD25 = 69, |
| 93 | VF610_PAD_PTD24 = 70, |
| 94 | VF610_PAD_PTD23 = 71, |
| 95 | VF610_PAD_PTD22 = 72, |
| 96 | VF610_PAD_PTD21 = 73, |
| 97 | VF610_PAD_PTD20 = 74, |
| 98 | VF610_PAD_PTD19 = 75, |
| 99 | VF610_PAD_PTD18 = 76, |
| 100 | VF610_PAD_PTD17 = 77, |
| 101 | VF610_PAD_PTD16 = 78, |
| 102 | VF610_PAD_PTD0 = 79, |
| 103 | VF610_PAD_PTD1 = 80, |
| 104 | VF610_PAD_PTD2 = 81, |
| 105 | VF610_PAD_PTD3 = 82, |
| 106 | VF610_PAD_PTD4 = 83, |
| 107 | VF610_PAD_PTD5 = 84, |
| 108 | VF610_PAD_PTD6 = 85, |
| 109 | VF610_PAD_PTD7 = 86, |
| 110 | VF610_PAD_PTD8 = 87, |
| 111 | VF610_PAD_PTD9 = 88, |
| 112 | VF610_PAD_PTD10 = 89, |
| 113 | VF610_PAD_PTD11 = 90, |
| 114 | VF610_PAD_PTD12 = 91, |
| 115 | VF610_PAD_PTD13 = 92, |
| 116 | VF610_PAD_PTB23 = 93, |
| 117 | VF610_PAD_PTB24 = 94, |
| 118 | VF610_PAD_PTB25 = 95, |
| 119 | VF610_PAD_PTB26 = 96, |
| 120 | VF610_PAD_PTB27 = 97, |
| 121 | VF610_PAD_PTB28 = 98, |
| 122 | VF610_PAD_PTC26 = 99, |
| 123 | VF610_PAD_PTC27 = 100, |
| 124 | VF610_PAD_PTC28 = 101, |
| 125 | VF610_PAD_PTC29 = 102, |
| 126 | VF610_PAD_PTC30 = 103, |
| 127 | VF610_PAD_PTC31 = 104, |
| 128 | VF610_PAD_PTE0 = 105, |
| 129 | VF610_PAD_PTE1 = 106, |
| 130 | VF610_PAD_PTE2 = 107, |
| 131 | VF610_PAD_PTE3 = 108, |
| 132 | VF610_PAD_PTE4 = 109, |
| 133 | VF610_PAD_PTE5 = 110, |
| 134 | VF610_PAD_PTE6 = 111, |
| 135 | VF610_PAD_PTE7 = 112, |
| 136 | VF610_PAD_PTE8 = 113, |
| 137 | VF610_PAD_PTE9 = 114, |
| 138 | VF610_PAD_PTE10 = 115, |
| 139 | VF610_PAD_PTE11 = 116, |
| 140 | VF610_PAD_PTE12 = 117, |
| 141 | VF610_PAD_PTE13 = 118, |
| 142 | VF610_PAD_PTE14 = 119, |
| 143 | VF610_PAD_PTE15 = 120, |
| 144 | VF610_PAD_PTE16 = 121, |
| 145 | VF610_PAD_PTE17 = 122, |
| 146 | VF610_PAD_PTE18 = 123, |
| 147 | VF610_PAD_PTE19 = 124, |
| 148 | VF610_PAD_PTE20 = 125, |
| 149 | VF610_PAD_PTE21 = 126, |
| 150 | VF610_PAD_PTE22 = 127, |
| 151 | VF610_PAD_PTE23 = 128, |
| 152 | VF610_PAD_PTE24 = 129, |
| 153 | VF610_PAD_PTE25 = 130, |
| 154 | VF610_PAD_PTE26 = 131, |
| 155 | VF610_PAD_PTE27 = 132, |
| 156 | VF610_PAD_PTE28 = 133, |
| 157 | VF610_PAD_PTA7 = 134, |
| 158 | }; |
| 159 | |
| 160 | /* Pad names for the pinmux subsystem */ |
| 161 | static const struct pinctrl_pin_desc vf610_pinctrl_pads[] = { |
| 162 | IMX_PINCTRL_PIN(VF610_PAD_PTA6), |
| 163 | IMX_PINCTRL_PIN(VF610_PAD_PTA8), |
| 164 | IMX_PINCTRL_PIN(VF610_PAD_PTA9), |
| 165 | IMX_PINCTRL_PIN(VF610_PAD_PTA10), |
| 166 | IMX_PINCTRL_PIN(VF610_PAD_PTA11), |
| 167 | IMX_PINCTRL_PIN(VF610_PAD_PTA12), |
| 168 | IMX_PINCTRL_PIN(VF610_PAD_PTA16), |
| 169 | IMX_PINCTRL_PIN(VF610_PAD_PTA17), |
| 170 | IMX_PINCTRL_PIN(VF610_PAD_PTA18), |
| 171 | IMX_PINCTRL_PIN(VF610_PAD_PTA19), |
| 172 | IMX_PINCTRL_PIN(VF610_PAD_PTA20), |
| 173 | IMX_PINCTRL_PIN(VF610_PAD_PTA21), |
| 174 | IMX_PINCTRL_PIN(VF610_PAD_PTA22), |
| 175 | IMX_PINCTRL_PIN(VF610_PAD_PTA23), |
| 176 | IMX_PINCTRL_PIN(VF610_PAD_PTA24), |
| 177 | IMX_PINCTRL_PIN(VF610_PAD_PTA25), |
| 178 | IMX_PINCTRL_PIN(VF610_PAD_PTA26), |
| 179 | IMX_PINCTRL_PIN(VF610_PAD_PTA27), |
| 180 | IMX_PINCTRL_PIN(VF610_PAD_PTA28), |
| 181 | IMX_PINCTRL_PIN(VF610_PAD_PTA29), |
| 182 | IMX_PINCTRL_PIN(VF610_PAD_PTA30), |
| 183 | IMX_PINCTRL_PIN(VF610_PAD_PTA31), |
| 184 | IMX_PINCTRL_PIN(VF610_PAD_PTB0), |
| 185 | IMX_PINCTRL_PIN(VF610_PAD_PTB1), |
| 186 | IMX_PINCTRL_PIN(VF610_PAD_PTB2), |
| 187 | IMX_PINCTRL_PIN(VF610_PAD_PTB3), |
| 188 | IMX_PINCTRL_PIN(VF610_PAD_PTB4), |
| 189 | IMX_PINCTRL_PIN(VF610_PAD_PTB5), |
| 190 | IMX_PINCTRL_PIN(VF610_PAD_PTB6), |
| 191 | IMX_PINCTRL_PIN(VF610_PAD_PTB7), |
| 192 | IMX_PINCTRL_PIN(VF610_PAD_PTB8), |
| 193 | IMX_PINCTRL_PIN(VF610_PAD_PTB9), |
| 194 | IMX_PINCTRL_PIN(VF610_PAD_PTB10), |
| 195 | IMX_PINCTRL_PIN(VF610_PAD_PTB11), |
| 196 | IMX_PINCTRL_PIN(VF610_PAD_PTB12), |
| 197 | IMX_PINCTRL_PIN(VF610_PAD_PTB13), |
| 198 | IMX_PINCTRL_PIN(VF610_PAD_PTB14), |
| 199 | IMX_PINCTRL_PIN(VF610_PAD_PTB15), |
| 200 | IMX_PINCTRL_PIN(VF610_PAD_PTB16), |
| 201 | IMX_PINCTRL_PIN(VF610_PAD_PTB17), |
| 202 | IMX_PINCTRL_PIN(VF610_PAD_PTB18), |
| 203 | IMX_PINCTRL_PIN(VF610_PAD_PTB19), |
| 204 | IMX_PINCTRL_PIN(VF610_PAD_PTB20), |
| 205 | IMX_PINCTRL_PIN(VF610_PAD_PTB21), |
| 206 | IMX_PINCTRL_PIN(VF610_PAD_PTB22), |
| 207 | IMX_PINCTRL_PIN(VF610_PAD_PTC0), |
| 208 | IMX_PINCTRL_PIN(VF610_PAD_PTC1), |
| 209 | IMX_PINCTRL_PIN(VF610_PAD_PTC2), |
| 210 | IMX_PINCTRL_PIN(VF610_PAD_PTC3), |
| 211 | IMX_PINCTRL_PIN(VF610_PAD_PTC4), |
| 212 | IMX_PINCTRL_PIN(VF610_PAD_PTC5), |
| 213 | IMX_PINCTRL_PIN(VF610_PAD_PTC6), |
| 214 | IMX_PINCTRL_PIN(VF610_PAD_PTC7), |
| 215 | IMX_PINCTRL_PIN(VF610_PAD_PTC8), |
| 216 | IMX_PINCTRL_PIN(VF610_PAD_PTC9), |
| 217 | IMX_PINCTRL_PIN(VF610_PAD_PTC10), |
| 218 | IMX_PINCTRL_PIN(VF610_PAD_PTC11), |
| 219 | IMX_PINCTRL_PIN(VF610_PAD_PTC12), |
| 220 | IMX_PINCTRL_PIN(VF610_PAD_PTC13), |
| 221 | IMX_PINCTRL_PIN(VF610_PAD_PTC14), |
| 222 | IMX_PINCTRL_PIN(VF610_PAD_PTC15), |
| 223 | IMX_PINCTRL_PIN(VF610_PAD_PTC16), |
| 224 | IMX_PINCTRL_PIN(VF610_PAD_PTC17), |
| 225 | IMX_PINCTRL_PIN(VF610_PAD_PTD31), |
| 226 | IMX_PINCTRL_PIN(VF610_PAD_PTD30), |
| 227 | IMX_PINCTRL_PIN(VF610_PAD_PTD29), |
| 228 | IMX_PINCTRL_PIN(VF610_PAD_PTD28), |
| 229 | IMX_PINCTRL_PIN(VF610_PAD_PTD27), |
| 230 | IMX_PINCTRL_PIN(VF610_PAD_PTD26), |
| 231 | IMX_PINCTRL_PIN(VF610_PAD_PTD25), |
| 232 | IMX_PINCTRL_PIN(VF610_PAD_PTD24), |
| 233 | IMX_PINCTRL_PIN(VF610_PAD_PTD23), |
| 234 | IMX_PINCTRL_PIN(VF610_PAD_PTD22), |
| 235 | IMX_PINCTRL_PIN(VF610_PAD_PTD21), |
| 236 | IMX_PINCTRL_PIN(VF610_PAD_PTD20), |
| 237 | IMX_PINCTRL_PIN(VF610_PAD_PTD19), |
| 238 | IMX_PINCTRL_PIN(VF610_PAD_PTD18), |
| 239 | IMX_PINCTRL_PIN(VF610_PAD_PTD17), |
| 240 | IMX_PINCTRL_PIN(VF610_PAD_PTD16), |
| 241 | IMX_PINCTRL_PIN(VF610_PAD_PTD0), |
| 242 | IMX_PINCTRL_PIN(VF610_PAD_PTD1), |
| 243 | IMX_PINCTRL_PIN(VF610_PAD_PTD2), |
| 244 | IMX_PINCTRL_PIN(VF610_PAD_PTD3), |
| 245 | IMX_PINCTRL_PIN(VF610_PAD_PTD4), |
| 246 | IMX_PINCTRL_PIN(VF610_PAD_PTD5), |
| 247 | IMX_PINCTRL_PIN(VF610_PAD_PTD6), |
| 248 | IMX_PINCTRL_PIN(VF610_PAD_PTD7), |
| 249 | IMX_PINCTRL_PIN(VF610_PAD_PTD8), |
| 250 | IMX_PINCTRL_PIN(VF610_PAD_PTD9), |
| 251 | IMX_PINCTRL_PIN(VF610_PAD_PTD10), |
| 252 | IMX_PINCTRL_PIN(VF610_PAD_PTD11), |
| 253 | IMX_PINCTRL_PIN(VF610_PAD_PTD12), |
| 254 | IMX_PINCTRL_PIN(VF610_PAD_PTD13), |
| 255 | IMX_PINCTRL_PIN(VF610_PAD_PTB23), |
| 256 | IMX_PINCTRL_PIN(VF610_PAD_PTB24), |
| 257 | IMX_PINCTRL_PIN(VF610_PAD_PTB25), |
| 258 | IMX_PINCTRL_PIN(VF610_PAD_PTB26), |
| 259 | IMX_PINCTRL_PIN(VF610_PAD_PTB27), |
| 260 | IMX_PINCTRL_PIN(VF610_PAD_PTB28), |
| 261 | IMX_PINCTRL_PIN(VF610_PAD_PTC26), |
| 262 | IMX_PINCTRL_PIN(VF610_PAD_PTC27), |
| 263 | IMX_PINCTRL_PIN(VF610_PAD_PTC28), |
| 264 | IMX_PINCTRL_PIN(VF610_PAD_PTC29), |
| 265 | IMX_PINCTRL_PIN(VF610_PAD_PTC30), |
| 266 | IMX_PINCTRL_PIN(VF610_PAD_PTC31), |
| 267 | IMX_PINCTRL_PIN(VF610_PAD_PTE0), |
| 268 | IMX_PINCTRL_PIN(VF610_PAD_PTE1), |
| 269 | IMX_PINCTRL_PIN(VF610_PAD_PTE2), |
| 270 | IMX_PINCTRL_PIN(VF610_PAD_PTE3), |
| 271 | IMX_PINCTRL_PIN(VF610_PAD_PTE4), |
| 272 | IMX_PINCTRL_PIN(VF610_PAD_PTE5), |
| 273 | IMX_PINCTRL_PIN(VF610_PAD_PTE6), |
| 274 | IMX_PINCTRL_PIN(VF610_PAD_PTE7), |
| 275 | IMX_PINCTRL_PIN(VF610_PAD_PTE8), |
| 276 | IMX_PINCTRL_PIN(VF610_PAD_PTE9), |
| 277 | IMX_PINCTRL_PIN(VF610_PAD_PTE10), |
| 278 | IMX_PINCTRL_PIN(VF610_PAD_PTE11), |
| 279 | IMX_PINCTRL_PIN(VF610_PAD_PTE12), |
| 280 | IMX_PINCTRL_PIN(VF610_PAD_PTE13), |
| 281 | IMX_PINCTRL_PIN(VF610_PAD_PTE14), |
| 282 | IMX_PINCTRL_PIN(VF610_PAD_PTE15), |
| 283 | IMX_PINCTRL_PIN(VF610_PAD_PTE16), |
| 284 | IMX_PINCTRL_PIN(VF610_PAD_PTE17), |
| 285 | IMX_PINCTRL_PIN(VF610_PAD_PTE18), |
| 286 | IMX_PINCTRL_PIN(VF610_PAD_PTE19), |
| 287 | IMX_PINCTRL_PIN(VF610_PAD_PTE20), |
| 288 | IMX_PINCTRL_PIN(VF610_PAD_PTE21), |
| 289 | IMX_PINCTRL_PIN(VF610_PAD_PTE22), |
| 290 | IMX_PINCTRL_PIN(VF610_PAD_PTE23), |
| 291 | IMX_PINCTRL_PIN(VF610_PAD_PTE24), |
| 292 | IMX_PINCTRL_PIN(VF610_PAD_PTE25), |
| 293 | IMX_PINCTRL_PIN(VF610_PAD_PTE26), |
| 294 | IMX_PINCTRL_PIN(VF610_PAD_PTE27), |
| 295 | IMX_PINCTRL_PIN(VF610_PAD_PTE28), |
| 296 | IMX_PINCTRL_PIN(VF610_PAD_PTA7), |
| 297 | }; |
| 298 | |
| 299 | static struct imx_pinctrl_soc_info vf610_pinctrl_info = { |
| 300 | .pins = vf610_pinctrl_pads, |
| 301 | .npins = ARRAY_SIZE(vf610_pinctrl_pads), |
| 302 | .flags = ZERO_OFFSET_VALID | SHARE_MUX_CONF_REG, |
| 303 | }; |
| 304 | |
| 305 | static struct of_device_id vf610_pinctrl_of_match[] = { |
| 306 | { .compatible = "fsl,vf610-iomuxc", }, |
| 307 | { /* sentinel */ } |
| 308 | }; |
| 309 | |
| 310 | static int vf610_pinctrl_probe(struct platform_device *pdev) |
| 311 | { |
| 312 | return imx_pinctrl_probe(pdev, &vf610_pinctrl_info); |
| 313 | } |
| 314 | |
| 315 | static struct platform_driver vf610_pinctrl_driver = { |
| 316 | .driver = { |
| 317 | .name = "vf610-pinctrl", |
| 318 | .owner = THIS_MODULE, |
Sachin Kamat | 606fca9 | 2013-09-28 17:38:48 +0530 | [diff] [blame] | 319 | .of_match_table = vf610_pinctrl_of_match, |
Jingchang Lu | 78bafc6 | 2013-05-28 17:32:08 +0800 | [diff] [blame] | 320 | }, |
| 321 | .probe = vf610_pinctrl_probe, |
| 322 | .remove = imx_pinctrl_remove, |
| 323 | }; |
| 324 | |
| 325 | static int __init vf610_pinctrl_init(void) |
| 326 | { |
| 327 | return platform_driver_register(&vf610_pinctrl_driver); |
| 328 | } |
| 329 | arch_initcall(vf610_pinctrl_init); |
| 330 | |
| 331 | static void __exit vf610_pinctrl_exit(void) |
| 332 | { |
| 333 | platform_driver_unregister(&vf610_pinctrl_driver); |
| 334 | } |
| 335 | module_exit(vf610_pinctrl_exit); |
| 336 | |
| 337 | MODULE_DESCRIPTION("Freescale VF610 pinctrl driver"); |
| 338 | MODULE_LICENSE("GPL v2"); |