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