1edad3b2aSLinus Walleij /* 2*1ab599e7SPaul Gortmaker * Freescale i.MX23 pinctrl driver 3*1ab599e7SPaul Gortmaker * 4*1ab599e7SPaul Gortmaker * Author: Shawn Guo <shawn.guo@linaro.org> 5edad3b2aSLinus Walleij * Copyright 2012 Freescale Semiconductor, Inc. 6edad3b2aSLinus Walleij * 7edad3b2aSLinus Walleij * The code contained herein is licensed under the GNU General Public 8edad3b2aSLinus Walleij * License. You may obtain a copy of the GNU General Public License 9edad3b2aSLinus Walleij * Version 2 or later at the following locations: 10edad3b2aSLinus Walleij * 11edad3b2aSLinus Walleij * http://www.opensource.org/licenses/gpl-license.html 12edad3b2aSLinus Walleij * http://www.gnu.org/copyleft/gpl.html 13edad3b2aSLinus Walleij */ 14edad3b2aSLinus Walleij 15edad3b2aSLinus Walleij #include <linux/init.h> 16edad3b2aSLinus Walleij #include <linux/of_device.h> 17edad3b2aSLinus Walleij #include <linux/pinctrl/pinctrl.h> 18edad3b2aSLinus Walleij #include "pinctrl-mxs.h" 19edad3b2aSLinus Walleij 20edad3b2aSLinus Walleij enum imx23_pin_enum { 21edad3b2aSLinus Walleij GPMI_D00 = PINID(0, 0), 22edad3b2aSLinus Walleij GPMI_D01 = PINID(0, 1), 23edad3b2aSLinus Walleij GPMI_D02 = PINID(0, 2), 24edad3b2aSLinus Walleij GPMI_D03 = PINID(0, 3), 25edad3b2aSLinus Walleij GPMI_D04 = PINID(0, 4), 26edad3b2aSLinus Walleij GPMI_D05 = PINID(0, 5), 27edad3b2aSLinus Walleij GPMI_D06 = PINID(0, 6), 28edad3b2aSLinus Walleij GPMI_D07 = PINID(0, 7), 29edad3b2aSLinus Walleij GPMI_D08 = PINID(0, 8), 30edad3b2aSLinus Walleij GPMI_D09 = PINID(0, 9), 31edad3b2aSLinus Walleij GPMI_D10 = PINID(0, 10), 32edad3b2aSLinus Walleij GPMI_D11 = PINID(0, 11), 33edad3b2aSLinus Walleij GPMI_D12 = PINID(0, 12), 34edad3b2aSLinus Walleij GPMI_D13 = PINID(0, 13), 35edad3b2aSLinus Walleij GPMI_D14 = PINID(0, 14), 36edad3b2aSLinus Walleij GPMI_D15 = PINID(0, 15), 37edad3b2aSLinus Walleij GPMI_CLE = PINID(0, 16), 38edad3b2aSLinus Walleij GPMI_ALE = PINID(0, 17), 39edad3b2aSLinus Walleij GPMI_CE2N = PINID(0, 18), 40edad3b2aSLinus Walleij GPMI_RDY0 = PINID(0, 19), 41edad3b2aSLinus Walleij GPMI_RDY1 = PINID(0, 20), 42edad3b2aSLinus Walleij GPMI_RDY2 = PINID(0, 21), 43edad3b2aSLinus Walleij GPMI_RDY3 = PINID(0, 22), 44edad3b2aSLinus Walleij GPMI_WPN = PINID(0, 23), 45edad3b2aSLinus Walleij GPMI_WRN = PINID(0, 24), 46edad3b2aSLinus Walleij GPMI_RDN = PINID(0, 25), 47edad3b2aSLinus Walleij AUART1_CTS = PINID(0, 26), 48edad3b2aSLinus Walleij AUART1_RTS = PINID(0, 27), 49edad3b2aSLinus Walleij AUART1_RX = PINID(0, 28), 50edad3b2aSLinus Walleij AUART1_TX = PINID(0, 29), 51edad3b2aSLinus Walleij I2C_SCL = PINID(0, 30), 52edad3b2aSLinus Walleij I2C_SDA = PINID(0, 31), 53edad3b2aSLinus Walleij LCD_D00 = PINID(1, 0), 54edad3b2aSLinus Walleij LCD_D01 = PINID(1, 1), 55edad3b2aSLinus Walleij LCD_D02 = PINID(1, 2), 56edad3b2aSLinus Walleij LCD_D03 = PINID(1, 3), 57edad3b2aSLinus Walleij LCD_D04 = PINID(1, 4), 58edad3b2aSLinus Walleij LCD_D05 = PINID(1, 5), 59edad3b2aSLinus Walleij LCD_D06 = PINID(1, 6), 60edad3b2aSLinus Walleij LCD_D07 = PINID(1, 7), 61edad3b2aSLinus Walleij LCD_D08 = PINID(1, 8), 62edad3b2aSLinus Walleij LCD_D09 = PINID(1, 9), 63edad3b2aSLinus Walleij LCD_D10 = PINID(1, 10), 64edad3b2aSLinus Walleij LCD_D11 = PINID(1, 11), 65edad3b2aSLinus Walleij LCD_D12 = PINID(1, 12), 66edad3b2aSLinus Walleij LCD_D13 = PINID(1, 13), 67edad3b2aSLinus Walleij LCD_D14 = PINID(1, 14), 68edad3b2aSLinus Walleij LCD_D15 = PINID(1, 15), 69edad3b2aSLinus Walleij LCD_D16 = PINID(1, 16), 70edad3b2aSLinus Walleij LCD_D17 = PINID(1, 17), 71edad3b2aSLinus Walleij LCD_RESET = PINID(1, 18), 72edad3b2aSLinus Walleij LCD_RS = PINID(1, 19), 73edad3b2aSLinus Walleij LCD_WR = PINID(1, 20), 74edad3b2aSLinus Walleij LCD_CS = PINID(1, 21), 75edad3b2aSLinus Walleij LCD_DOTCK = PINID(1, 22), 76edad3b2aSLinus Walleij LCD_ENABLE = PINID(1, 23), 77edad3b2aSLinus Walleij LCD_HSYNC = PINID(1, 24), 78edad3b2aSLinus Walleij LCD_VSYNC = PINID(1, 25), 79edad3b2aSLinus Walleij PWM0 = PINID(1, 26), 80edad3b2aSLinus Walleij PWM1 = PINID(1, 27), 81edad3b2aSLinus Walleij PWM2 = PINID(1, 28), 82edad3b2aSLinus Walleij PWM3 = PINID(1, 29), 83edad3b2aSLinus Walleij PWM4 = PINID(1, 30), 84edad3b2aSLinus Walleij SSP1_CMD = PINID(2, 0), 85edad3b2aSLinus Walleij SSP1_DETECT = PINID(2, 1), 86edad3b2aSLinus Walleij SSP1_DATA0 = PINID(2, 2), 87edad3b2aSLinus Walleij SSP1_DATA1 = PINID(2, 3), 88edad3b2aSLinus Walleij SSP1_DATA2 = PINID(2, 4), 89edad3b2aSLinus Walleij SSP1_DATA3 = PINID(2, 5), 90edad3b2aSLinus Walleij SSP1_SCK = PINID(2, 6), 91edad3b2aSLinus Walleij ROTARYA = PINID(2, 7), 92edad3b2aSLinus Walleij ROTARYB = PINID(2, 8), 93edad3b2aSLinus Walleij EMI_A00 = PINID(2, 9), 94edad3b2aSLinus Walleij EMI_A01 = PINID(2, 10), 95edad3b2aSLinus Walleij EMI_A02 = PINID(2, 11), 96edad3b2aSLinus Walleij EMI_A03 = PINID(2, 12), 97edad3b2aSLinus Walleij EMI_A04 = PINID(2, 13), 98edad3b2aSLinus Walleij EMI_A05 = PINID(2, 14), 99edad3b2aSLinus Walleij EMI_A06 = PINID(2, 15), 100edad3b2aSLinus Walleij EMI_A07 = PINID(2, 16), 101edad3b2aSLinus Walleij EMI_A08 = PINID(2, 17), 102edad3b2aSLinus Walleij EMI_A09 = PINID(2, 18), 103edad3b2aSLinus Walleij EMI_A10 = PINID(2, 19), 104edad3b2aSLinus Walleij EMI_A11 = PINID(2, 20), 105edad3b2aSLinus Walleij EMI_A12 = PINID(2, 21), 106edad3b2aSLinus Walleij EMI_BA0 = PINID(2, 22), 107edad3b2aSLinus Walleij EMI_BA1 = PINID(2, 23), 108edad3b2aSLinus Walleij EMI_CASN = PINID(2, 24), 109edad3b2aSLinus Walleij EMI_CE0N = PINID(2, 25), 110edad3b2aSLinus Walleij EMI_CE1N = PINID(2, 26), 111edad3b2aSLinus Walleij GPMI_CE1N = PINID(2, 27), 112edad3b2aSLinus Walleij GPMI_CE0N = PINID(2, 28), 113edad3b2aSLinus Walleij EMI_CKE = PINID(2, 29), 114edad3b2aSLinus Walleij EMI_RASN = PINID(2, 30), 115edad3b2aSLinus Walleij EMI_WEN = PINID(2, 31), 116edad3b2aSLinus Walleij EMI_D00 = PINID(3, 0), 117edad3b2aSLinus Walleij EMI_D01 = PINID(3, 1), 118edad3b2aSLinus Walleij EMI_D02 = PINID(3, 2), 119edad3b2aSLinus Walleij EMI_D03 = PINID(3, 3), 120edad3b2aSLinus Walleij EMI_D04 = PINID(3, 4), 121edad3b2aSLinus Walleij EMI_D05 = PINID(3, 5), 122edad3b2aSLinus Walleij EMI_D06 = PINID(3, 6), 123edad3b2aSLinus Walleij EMI_D07 = PINID(3, 7), 124edad3b2aSLinus Walleij EMI_D08 = PINID(3, 8), 125edad3b2aSLinus Walleij EMI_D09 = PINID(3, 9), 126edad3b2aSLinus Walleij EMI_D10 = PINID(3, 10), 127edad3b2aSLinus Walleij EMI_D11 = PINID(3, 11), 128edad3b2aSLinus Walleij EMI_D12 = PINID(3, 12), 129edad3b2aSLinus Walleij EMI_D13 = PINID(3, 13), 130edad3b2aSLinus Walleij EMI_D14 = PINID(3, 14), 131edad3b2aSLinus Walleij EMI_D15 = PINID(3, 15), 132edad3b2aSLinus Walleij EMI_DQM0 = PINID(3, 16), 133edad3b2aSLinus Walleij EMI_DQM1 = PINID(3, 17), 134edad3b2aSLinus Walleij EMI_DQS0 = PINID(3, 18), 135edad3b2aSLinus Walleij EMI_DQS1 = PINID(3, 19), 136edad3b2aSLinus Walleij EMI_CLK = PINID(3, 20), 137edad3b2aSLinus Walleij EMI_CLKN = PINID(3, 21), 138edad3b2aSLinus Walleij }; 139edad3b2aSLinus Walleij 140edad3b2aSLinus Walleij static const struct pinctrl_pin_desc imx23_pins[] = { 141edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_D00), 142edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_D01), 143edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_D02), 144edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_D03), 145edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_D04), 146edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_D05), 147edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_D06), 148edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_D07), 149edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_D08), 150edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_D09), 151edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_D10), 152edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_D11), 153edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_D12), 154edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_D13), 155edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_D14), 156edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_D15), 157edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_CLE), 158edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_ALE), 159edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_CE2N), 160edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_RDY0), 161edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_RDY1), 162edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_RDY2), 163edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_RDY3), 164edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_WPN), 165edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_WRN), 166edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_RDN), 167edad3b2aSLinus Walleij MXS_PINCTRL_PIN(AUART1_CTS), 168edad3b2aSLinus Walleij MXS_PINCTRL_PIN(AUART1_RTS), 169edad3b2aSLinus Walleij MXS_PINCTRL_PIN(AUART1_RX), 170edad3b2aSLinus Walleij MXS_PINCTRL_PIN(AUART1_TX), 171edad3b2aSLinus Walleij MXS_PINCTRL_PIN(I2C_SCL), 172edad3b2aSLinus Walleij MXS_PINCTRL_PIN(I2C_SDA), 173edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_D00), 174edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_D01), 175edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_D02), 176edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_D03), 177edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_D04), 178edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_D05), 179edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_D06), 180edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_D07), 181edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_D08), 182edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_D09), 183edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_D10), 184edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_D11), 185edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_D12), 186edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_D13), 187edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_D14), 188edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_D15), 189edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_D16), 190edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_D17), 191edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_RESET), 192edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_RS), 193edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_WR), 194edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_CS), 195edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_DOTCK), 196edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_ENABLE), 197edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_HSYNC), 198edad3b2aSLinus Walleij MXS_PINCTRL_PIN(LCD_VSYNC), 199edad3b2aSLinus Walleij MXS_PINCTRL_PIN(PWM0), 200edad3b2aSLinus Walleij MXS_PINCTRL_PIN(PWM1), 201edad3b2aSLinus Walleij MXS_PINCTRL_PIN(PWM2), 202edad3b2aSLinus Walleij MXS_PINCTRL_PIN(PWM3), 203edad3b2aSLinus Walleij MXS_PINCTRL_PIN(PWM4), 204edad3b2aSLinus Walleij MXS_PINCTRL_PIN(SSP1_CMD), 205edad3b2aSLinus Walleij MXS_PINCTRL_PIN(SSP1_DETECT), 206edad3b2aSLinus Walleij MXS_PINCTRL_PIN(SSP1_DATA0), 207edad3b2aSLinus Walleij MXS_PINCTRL_PIN(SSP1_DATA1), 208edad3b2aSLinus Walleij MXS_PINCTRL_PIN(SSP1_DATA2), 209edad3b2aSLinus Walleij MXS_PINCTRL_PIN(SSP1_DATA3), 210edad3b2aSLinus Walleij MXS_PINCTRL_PIN(SSP1_SCK), 211edad3b2aSLinus Walleij MXS_PINCTRL_PIN(ROTARYA), 212edad3b2aSLinus Walleij MXS_PINCTRL_PIN(ROTARYB), 213edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_A00), 214edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_A01), 215edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_A02), 216edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_A03), 217edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_A04), 218edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_A05), 219edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_A06), 220edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_A07), 221edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_A08), 222edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_A09), 223edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_A10), 224edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_A11), 225edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_A12), 226edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_BA0), 227edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_BA1), 228edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_CASN), 229edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_CE0N), 230edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_CE1N), 231edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_CE1N), 232edad3b2aSLinus Walleij MXS_PINCTRL_PIN(GPMI_CE0N), 233edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_CKE), 234edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_RASN), 235edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_WEN), 236edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_D00), 237edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_D01), 238edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_D02), 239edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_D03), 240edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_D04), 241edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_D05), 242edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_D06), 243edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_D07), 244edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_D08), 245edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_D09), 246edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_D10), 247edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_D11), 248edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_D12), 249edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_D13), 250edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_D14), 251edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_D15), 252edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_DQM0), 253edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_DQM1), 254edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_DQS0), 255edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_DQS1), 256edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_CLK), 257edad3b2aSLinus Walleij MXS_PINCTRL_PIN(EMI_CLKN), 258edad3b2aSLinus Walleij }; 259edad3b2aSLinus Walleij 260edad3b2aSLinus Walleij static struct mxs_regs imx23_regs = { 261edad3b2aSLinus Walleij .muxsel = 0x100, 262edad3b2aSLinus Walleij .drive = 0x200, 263edad3b2aSLinus Walleij .pull = 0x400, 264edad3b2aSLinus Walleij }; 265edad3b2aSLinus Walleij 266edad3b2aSLinus Walleij static struct mxs_pinctrl_soc_data imx23_pinctrl_data = { 267edad3b2aSLinus Walleij .regs = &imx23_regs, 268edad3b2aSLinus Walleij .pins = imx23_pins, 269edad3b2aSLinus Walleij .npins = ARRAY_SIZE(imx23_pins), 270edad3b2aSLinus Walleij }; 271edad3b2aSLinus Walleij 272edad3b2aSLinus Walleij static int imx23_pinctrl_probe(struct platform_device *pdev) 273edad3b2aSLinus Walleij { 274edad3b2aSLinus Walleij return mxs_pinctrl_probe(pdev, &imx23_pinctrl_data); 275edad3b2aSLinus Walleij } 276edad3b2aSLinus Walleij 277edad3b2aSLinus Walleij static const struct of_device_id imx23_pinctrl_of_match[] = { 278edad3b2aSLinus Walleij { .compatible = "fsl,imx23-pinctrl", }, 279edad3b2aSLinus Walleij { /* sentinel */ } 280edad3b2aSLinus Walleij }; 281edad3b2aSLinus Walleij 282edad3b2aSLinus Walleij static struct platform_driver imx23_pinctrl_driver = { 283edad3b2aSLinus Walleij .driver = { 284edad3b2aSLinus Walleij .name = "imx23-pinctrl", 285*1ab599e7SPaul Gortmaker .suppress_bind_attrs = true, 286edad3b2aSLinus Walleij .of_match_table = imx23_pinctrl_of_match, 287edad3b2aSLinus Walleij }, 288edad3b2aSLinus Walleij .probe = imx23_pinctrl_probe, 289edad3b2aSLinus Walleij }; 290edad3b2aSLinus Walleij 291edad3b2aSLinus Walleij static int __init imx23_pinctrl_init(void) 292edad3b2aSLinus Walleij { 293edad3b2aSLinus Walleij return platform_driver_register(&imx23_pinctrl_driver); 294edad3b2aSLinus Walleij } 295edad3b2aSLinus Walleij postcore_initcall(imx23_pinctrl_init); 296