Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Driver for the ST Microelectronics SPEAr1310 pinmux
0003  *
0004  * Copyright (C) 2012 ST Microelectronics
0005  * Viresh Kumar <vireshk@kernel.org>
0006  *
0007  * This file is licensed under the terms of the GNU General Public
0008  * License version 2. This program is licensed "as is" without any
0009  * warranty of any kind, whether express or implied.
0010  */
0011 
0012 #include <linux/err.h>
0013 #include <linux/init.h>
0014 #include <linux/of_device.h>
0015 #include <linux/platform_device.h>
0016 #include "pinctrl-spear.h"
0017 
0018 #define DRIVER_NAME "spear1310-pinmux"
0019 
0020 /* pins */
0021 static const struct pinctrl_pin_desc spear1310_pins[] = {
0022     SPEAR_PIN_0_TO_101,
0023     SPEAR_PIN_102_TO_245,
0024 };
0025 
0026 /* registers */
0027 #define PERIP_CFG                   0x3B0
0028     #define MCIF_SEL_SHIFT              5
0029     #define MCIF_SEL_SD             (0x1 << MCIF_SEL_SHIFT)
0030     #define MCIF_SEL_CF             (0x2 << MCIF_SEL_SHIFT)
0031     #define MCIF_SEL_XD             (0x3 << MCIF_SEL_SHIFT)
0032     #define MCIF_SEL_MASK               (0x3 << MCIF_SEL_SHIFT)
0033 
0034 #define PCIE_SATA_CFG                   0x3A4
0035     #define PCIE_SATA2_SEL_PCIE         (0 << 31)
0036     #define PCIE_SATA1_SEL_PCIE         (0 << 30)
0037     #define PCIE_SATA0_SEL_PCIE         (0 << 29)
0038     #define PCIE_SATA2_SEL_SATA         (1 << 31)
0039     #define PCIE_SATA1_SEL_SATA         (1 << 30)
0040     #define PCIE_SATA0_SEL_SATA         (1 << 29)
0041     #define SATA2_CFG_TX_CLK_EN         (1 << 27)
0042     #define SATA2_CFG_RX_CLK_EN         (1 << 26)
0043     #define SATA2_CFG_POWERUP_RESET         (1 << 25)
0044     #define SATA2_CFG_PM_CLK_EN         (1 << 24)
0045     #define SATA1_CFG_TX_CLK_EN         (1 << 23)
0046     #define SATA1_CFG_RX_CLK_EN         (1 << 22)
0047     #define SATA1_CFG_POWERUP_RESET         (1 << 21)
0048     #define SATA1_CFG_PM_CLK_EN         (1 << 20)
0049     #define SATA0_CFG_TX_CLK_EN         (1 << 19)
0050     #define SATA0_CFG_RX_CLK_EN         (1 << 18)
0051     #define SATA0_CFG_POWERUP_RESET         (1 << 17)
0052     #define SATA0_CFG_PM_CLK_EN         (1 << 16)
0053     #define PCIE2_CFG_DEVICE_PRESENT        (1 << 11)
0054     #define PCIE2_CFG_POWERUP_RESET         (1 << 10)
0055     #define PCIE2_CFG_CORE_CLK_EN           (1 << 9)
0056     #define PCIE2_CFG_AUX_CLK_EN            (1 << 8)
0057     #define PCIE1_CFG_DEVICE_PRESENT        (1 << 7)
0058     #define PCIE1_CFG_POWERUP_RESET         (1 << 6)
0059     #define PCIE1_CFG_CORE_CLK_EN           (1 << 5)
0060     #define PCIE1_CFG_AUX_CLK_EN            (1 << 4)
0061     #define PCIE0_CFG_DEVICE_PRESENT        (1 << 3)
0062     #define PCIE0_CFG_POWERUP_RESET         (1 << 2)
0063     #define PCIE0_CFG_CORE_CLK_EN           (1 << 1)
0064     #define PCIE0_CFG_AUX_CLK_EN            (1 << 0)
0065 
0066 #define PAD_FUNCTION_EN_0               0x650
0067     #define PMX_UART0_MASK              (1 << 1)
0068     #define PMX_I2C0_MASK               (1 << 2)
0069     #define PMX_I2S0_MASK               (1 << 3)
0070     #define PMX_SSP0_MASK               (1 << 4)
0071     #define PMX_CLCD1_MASK              (1 << 5)
0072     #define PMX_EGPIO00_MASK            (1 << 6)
0073     #define PMX_EGPIO01_MASK            (1 << 7)
0074     #define PMX_EGPIO02_MASK            (1 << 8)
0075     #define PMX_EGPIO03_MASK            (1 << 9)
0076     #define PMX_EGPIO04_MASK            (1 << 10)
0077     #define PMX_EGPIO05_MASK            (1 << 11)
0078     #define PMX_EGPIO06_MASK            (1 << 12)
0079     #define PMX_EGPIO07_MASK            (1 << 13)
0080     #define PMX_EGPIO08_MASK            (1 << 14)
0081     #define PMX_EGPIO09_MASK            (1 << 15)
0082     #define PMX_SMI_MASK                (1 << 16)
0083     #define PMX_NAND8_MASK              (1 << 17)
0084     #define PMX_GMIICLK_MASK            (1 << 18)
0085     #define PMX_GMIICOL_CRS_XFERER_MIITXCLK_MASK    (1 << 19)
0086     #define PMX_RXCLK_RDV_TXEN_D03_MASK     (1 << 20)
0087     #define PMX_GMIID47_MASK            (1 << 21)
0088     #define PMX_MDC_MDIO_MASK           (1 << 22)
0089     #define PMX_MCI_DATA8_15_MASK           (1 << 23)
0090     #define PMX_NFAD23_MASK             (1 << 24)
0091     #define PMX_NFAD24_MASK             (1 << 25)
0092     #define PMX_NFAD25_MASK             (1 << 26)
0093     #define PMX_NFCE3_MASK              (1 << 27)
0094     #define PMX_NFWPRT3_MASK            (1 << 28)
0095     #define PMX_NFRSTPWDWN0_MASK            (1 << 29)
0096     #define PMX_NFRSTPWDWN1_MASK            (1 << 30)
0097     #define PMX_NFRSTPWDWN2_MASK            (1 << 31)
0098 
0099 #define PAD_FUNCTION_EN_1               0x654
0100     #define PMX_NFRSTPWDWN3_MASK            (1 << 0)
0101     #define PMX_SMINCS2_MASK            (1 << 1)
0102     #define PMX_SMINCS3_MASK            (1 << 2)
0103     #define PMX_CLCD2_MASK              (1 << 3)
0104     #define PMX_KBD_ROWCOL68_MASK           (1 << 4)
0105     #define PMX_EGPIO10_MASK            (1 << 5)
0106     #define PMX_EGPIO11_MASK            (1 << 6)
0107     #define PMX_EGPIO12_MASK            (1 << 7)
0108     #define PMX_EGPIO13_MASK            (1 << 8)
0109     #define PMX_EGPIO14_MASK            (1 << 9)
0110     #define PMX_EGPIO15_MASK            (1 << 10)
0111     #define PMX_UART0_MODEM_MASK            (1 << 11)
0112     #define PMX_GPT0_TMR0_MASK          (1 << 12)
0113     #define PMX_GPT0_TMR1_MASK          (1 << 13)
0114     #define PMX_GPT1_TMR0_MASK          (1 << 14)
0115     #define PMX_GPT1_TMR1_MASK          (1 << 15)
0116     #define PMX_I2S1_MASK               (1 << 16)
0117     #define PMX_KBD_ROWCOL25_MASK           (1 << 17)
0118     #define PMX_NFIO8_15_MASK           (1 << 18)
0119     #define PMX_KBD_COL1_MASK           (1 << 19)
0120     #define PMX_NFCE1_MASK              (1 << 20)
0121     #define PMX_KBD_COL0_MASK           (1 << 21)
0122     #define PMX_NFCE2_MASK              (1 << 22)
0123     #define PMX_KBD_ROW1_MASK           (1 << 23)
0124     #define PMX_NFWPRT1_MASK            (1 << 24)
0125     #define PMX_KBD_ROW0_MASK           (1 << 25)
0126     #define PMX_NFWPRT2_MASK            (1 << 26)
0127     #define PMX_MCIDATA0_MASK           (1 << 27)
0128     #define PMX_MCIDATA1_MASK           (1 << 28)
0129     #define PMX_MCIDATA2_MASK           (1 << 29)
0130     #define PMX_MCIDATA3_MASK           (1 << 30)
0131     #define PMX_MCIDATA4_MASK           (1 << 31)
0132 
0133 #define PAD_FUNCTION_EN_2               0x658
0134     #define PMX_MCIDATA5_MASK           (1 << 0)
0135     #define PMX_MCIDATA6_MASK           (1 << 1)
0136     #define PMX_MCIDATA7_MASK           (1 << 2)
0137     #define PMX_MCIDATA1SD_MASK         (1 << 3)
0138     #define PMX_MCIDATA2SD_MASK         (1 << 4)
0139     #define PMX_MCIDATA3SD_MASK         (1 << 5)
0140     #define PMX_MCIADDR0ALE_MASK            (1 << 6)
0141     #define PMX_MCIADDR1CLECLK_MASK         (1 << 7)
0142     #define PMX_MCIADDR2_MASK           (1 << 8)
0143     #define PMX_MCICECF_MASK            (1 << 9)
0144     #define PMX_MCICEXD_MASK            (1 << 10)
0145     #define PMX_MCICESDMMC_MASK         (1 << 11)
0146     #define PMX_MCICDCF1_MASK           (1 << 12)
0147     #define PMX_MCICDCF2_MASK           (1 << 13)
0148     #define PMX_MCICDXD_MASK            (1 << 14)
0149     #define PMX_MCICDSDMMC_MASK         (1 << 15)
0150     #define PMX_MCIDATADIR_MASK         (1 << 16)
0151     #define PMX_MCIDMARQWP_MASK         (1 << 17)
0152     #define PMX_MCIIORDRE_MASK          (1 << 18)
0153     #define PMX_MCIIOWRWE_MASK          (1 << 19)
0154     #define PMX_MCIRESETCF_MASK         (1 << 20)
0155     #define PMX_MCICS0CE_MASK           (1 << 21)
0156     #define PMX_MCICFINTR_MASK          (1 << 22)
0157     #define PMX_MCIIORDY_MASK           (1 << 23)
0158     #define PMX_MCICS1_MASK             (1 << 24)
0159     #define PMX_MCIDMAACK_MASK          (1 << 25)
0160     #define PMX_MCISDCMD_MASK           (1 << 26)
0161     #define PMX_MCILEDS_MASK            (1 << 27)
0162     #define PMX_TOUCH_XY_MASK           (1 << 28)
0163     #define PMX_SSP0_CS0_MASK           (1 << 29)
0164     #define PMX_SSP0_CS1_2_MASK         (1 << 30)
0165 
0166 #define PAD_DIRECTION_SEL_0             0x65C
0167 #define PAD_DIRECTION_SEL_1             0x660
0168 #define PAD_DIRECTION_SEL_2             0x664
0169 
0170 /* combined macros */
0171 #define PMX_GMII_MASK       (PMX_GMIICLK_MASK |         \
0172                 PMX_GMIICOL_CRS_XFERER_MIITXCLK_MASK |  \
0173                 PMX_RXCLK_RDV_TXEN_D03_MASK |       \
0174                 PMX_GMIID47_MASK | PMX_MDC_MDIO_MASK)
0175 
0176 #define PMX_EGPIO_0_GRP_MASK    (PMX_EGPIO00_MASK | PMX_EGPIO01_MASK |  \
0177                 PMX_EGPIO02_MASK |          \
0178                 PMX_EGPIO03_MASK | PMX_EGPIO04_MASK |   \
0179                 PMX_EGPIO05_MASK | PMX_EGPIO06_MASK |   \
0180                 PMX_EGPIO07_MASK | PMX_EGPIO08_MASK |   \
0181                 PMX_EGPIO09_MASK)
0182 #define PMX_EGPIO_1_GRP_MASK    (PMX_EGPIO10_MASK | PMX_EGPIO11_MASK |  \
0183                 PMX_EGPIO12_MASK | PMX_EGPIO13_MASK |   \
0184                 PMX_EGPIO14_MASK | PMX_EGPIO15_MASK)
0185 
0186 #define PMX_KEYBOARD_6X6_MASK   (PMX_KBD_ROW0_MASK | PMX_KBD_ROW1_MASK | \
0187                 PMX_KBD_ROWCOL25_MASK | PMX_KBD_COL0_MASK | \
0188                 PMX_KBD_COL1_MASK)
0189 
0190 #define PMX_NAND8BIT_0_MASK (PMX_NAND8_MASK | PMX_NFAD23_MASK | \
0191                 PMX_NFAD24_MASK | PMX_NFAD25_MASK | \
0192                 PMX_NFWPRT3_MASK | PMX_NFRSTPWDWN0_MASK | \
0193                 PMX_NFRSTPWDWN1_MASK | PMX_NFRSTPWDWN2_MASK | \
0194                 PMX_NFCE3_MASK)
0195 #define PMX_NAND8BIT_1_MASK PMX_NFRSTPWDWN3_MASK
0196 
0197 #define PMX_NAND16BIT_1_MASK    (PMX_KBD_ROWCOL25_MASK | PMX_NFIO8_15_MASK)
0198 #define PMX_NAND_4CHIPS_MASK    (PMX_NFCE1_MASK | PMX_NFCE2_MASK |  \
0199                 PMX_NFWPRT1_MASK | PMX_NFWPRT2_MASK |   \
0200                 PMX_KBD_ROW0_MASK | PMX_KBD_ROW1_MASK | \
0201                 PMX_KBD_COL0_MASK | PMX_KBD_COL1_MASK)
0202 
0203 #define PMX_MCIFALL_1_MASK  0xF8000000
0204 #define PMX_MCIFALL_2_MASK  0x0FFFFFFF
0205 
0206 #define PMX_PCI_REG1_MASK   (PMX_SMINCS2_MASK | PMX_SMINCS3_MASK |  \
0207                 PMX_CLCD2_MASK | PMX_KBD_ROWCOL68_MASK | \
0208                 PMX_EGPIO_1_GRP_MASK | PMX_GPT0_TMR0_MASK | \
0209                 PMX_GPT0_TMR1_MASK | PMX_GPT1_TMR0_MASK | \
0210                 PMX_GPT1_TMR1_MASK | PMX_I2S1_MASK |    \
0211                 PMX_NFCE2_MASK)
0212 #define PMX_PCI_REG2_MASK   (PMX_TOUCH_XY_MASK | PMX_SSP0_CS0_MASK | \
0213                 PMX_SSP0_CS1_2_MASK)
0214 
0215 #define PMX_SMII_0_1_2_MASK (PMX_CLCD2_MASK | PMX_KBD_ROWCOL68_MASK)
0216 #define PMX_RGMII_REG0_MASK (PMX_MCI_DATA8_15_MASK |        \
0217                 PMX_GMIICOL_CRS_XFERER_MIITXCLK_MASK |  \
0218                 PMX_GMIID47_MASK)
0219 #define PMX_RGMII_REG1_MASK (PMX_KBD_ROWCOL68_MASK | PMX_EGPIO_1_GRP_MASK |\
0220                 PMX_KBD_ROW1_MASK | PMX_NFWPRT1_MASK |  \
0221                 PMX_KBD_ROW0_MASK | PMX_NFWPRT2_MASK)
0222 #define PMX_RGMII_REG2_MASK (PMX_TOUCH_XY_MASK | PMX_SSP0_CS0_MASK | \
0223                 PMX_SSP0_CS1_2_MASK)
0224 
0225 #define PCIE_CFG_VAL(x)     (PCIE_SATA##x##_SEL_PCIE |  \
0226                 PCIE##x##_CFG_AUX_CLK_EN |  \
0227                 PCIE##x##_CFG_CORE_CLK_EN | \
0228                 PCIE##x##_CFG_POWERUP_RESET |   \
0229                 PCIE##x##_CFG_DEVICE_PRESENT)
0230 #define SATA_CFG_VAL(x)     (PCIE_SATA##x##_SEL_SATA |  \
0231                 SATA##x##_CFG_PM_CLK_EN |   \
0232                 SATA##x##_CFG_POWERUP_RESET |   \
0233                 SATA##x##_CFG_RX_CLK_EN |   \
0234                 SATA##x##_CFG_TX_CLK_EN)
0235 
0236 /* Pad multiplexing for i2c0 device */
0237 static const unsigned i2c0_pins[] = { 102, 103 };
0238 static struct spear_muxreg i2c0_muxreg[] = {
0239     {
0240         .reg = PAD_FUNCTION_EN_0,
0241         .mask = PMX_I2C0_MASK,
0242         .val = PMX_I2C0_MASK,
0243     }, {
0244         .reg = PAD_DIRECTION_SEL_0,
0245         .mask = PMX_I2C0_MASK,
0246         .val = PMX_I2C0_MASK,
0247     },
0248 };
0249 
0250 static struct spear_modemux i2c0_modemux[] = {
0251     {
0252         .muxregs = i2c0_muxreg,
0253         .nmuxregs = ARRAY_SIZE(i2c0_muxreg),
0254     },
0255 };
0256 
0257 static struct spear_pingroup i2c0_pingroup = {
0258     .name = "i2c0_grp",
0259     .pins = i2c0_pins,
0260     .npins = ARRAY_SIZE(i2c0_pins),
0261     .modemuxs = i2c0_modemux,
0262     .nmodemuxs = ARRAY_SIZE(i2c0_modemux),
0263 };
0264 
0265 static const char *const i2c0_grps[] = { "i2c0_grp" };
0266 static struct spear_function i2c0_function = {
0267     .name = "i2c0",
0268     .groups = i2c0_grps,
0269     .ngroups = ARRAY_SIZE(i2c0_grps),
0270 };
0271 
0272 /* Pad multiplexing for ssp0 device */
0273 static const unsigned ssp0_pins[] = { 109, 110, 111, 112 };
0274 static struct spear_muxreg ssp0_muxreg[] = {
0275     {
0276         .reg = PAD_FUNCTION_EN_0,
0277         .mask = PMX_SSP0_MASK,
0278         .val = PMX_SSP0_MASK,
0279     }, {
0280         .reg = PAD_DIRECTION_SEL_0,
0281         .mask = PMX_SSP0_MASK,
0282         .val = PMX_SSP0_MASK,
0283     },
0284 };
0285 
0286 static struct spear_modemux ssp0_modemux[] = {
0287     {
0288         .muxregs = ssp0_muxreg,
0289         .nmuxregs = ARRAY_SIZE(ssp0_muxreg),
0290     },
0291 };
0292 
0293 static struct spear_pingroup ssp0_pingroup = {
0294     .name = "ssp0_grp",
0295     .pins = ssp0_pins,
0296     .npins = ARRAY_SIZE(ssp0_pins),
0297     .modemuxs = ssp0_modemux,
0298     .nmodemuxs = ARRAY_SIZE(ssp0_modemux),
0299 };
0300 
0301 /* Pad multiplexing for ssp0_cs0 device */
0302 static const unsigned ssp0_cs0_pins[] = { 96 };
0303 static struct spear_muxreg ssp0_cs0_muxreg[] = {
0304     {
0305         .reg = PAD_FUNCTION_EN_2,
0306         .mask = PMX_SSP0_CS0_MASK,
0307         .val = PMX_SSP0_CS0_MASK,
0308     }, {
0309         .reg = PAD_DIRECTION_SEL_2,
0310         .mask = PMX_SSP0_CS0_MASK,
0311         .val = PMX_SSP0_CS0_MASK,
0312     },
0313 };
0314 
0315 static struct spear_modemux ssp0_cs0_modemux[] = {
0316     {
0317         .muxregs = ssp0_cs0_muxreg,
0318         .nmuxregs = ARRAY_SIZE(ssp0_cs0_muxreg),
0319     },
0320 };
0321 
0322 static struct spear_pingroup ssp0_cs0_pingroup = {
0323     .name = "ssp0_cs0_grp",
0324     .pins = ssp0_cs0_pins,
0325     .npins = ARRAY_SIZE(ssp0_cs0_pins),
0326     .modemuxs = ssp0_cs0_modemux,
0327     .nmodemuxs = ARRAY_SIZE(ssp0_cs0_modemux),
0328 };
0329 
0330 /* ssp0_cs1_2 device */
0331 static const unsigned ssp0_cs1_2_pins[] = { 94, 95 };
0332 static struct spear_muxreg ssp0_cs1_2_muxreg[] = {
0333     {
0334         .reg = PAD_FUNCTION_EN_2,
0335         .mask = PMX_SSP0_CS1_2_MASK,
0336         .val = PMX_SSP0_CS1_2_MASK,
0337     }, {
0338         .reg = PAD_DIRECTION_SEL_2,
0339         .mask = PMX_SSP0_CS1_2_MASK,
0340         .val = PMX_SSP0_CS1_2_MASK,
0341     },
0342 };
0343 
0344 static struct spear_modemux ssp0_cs1_2_modemux[] = {
0345     {
0346         .muxregs = ssp0_cs1_2_muxreg,
0347         .nmuxregs = ARRAY_SIZE(ssp0_cs1_2_muxreg),
0348     },
0349 };
0350 
0351 static struct spear_pingroup ssp0_cs1_2_pingroup = {
0352     .name = "ssp0_cs1_2_grp",
0353     .pins = ssp0_cs1_2_pins,
0354     .npins = ARRAY_SIZE(ssp0_cs1_2_pins),
0355     .modemuxs = ssp0_cs1_2_modemux,
0356     .nmodemuxs = ARRAY_SIZE(ssp0_cs1_2_modemux),
0357 };
0358 
0359 static const char *const ssp0_grps[] = { "ssp0_grp", "ssp0_cs0_grp",
0360     "ssp0_cs1_2_grp" };
0361 static struct spear_function ssp0_function = {
0362     .name = "ssp0",
0363     .groups = ssp0_grps,
0364     .ngroups = ARRAY_SIZE(ssp0_grps),
0365 };
0366 
0367 /* Pad multiplexing for i2s0 device */
0368 static const unsigned i2s0_pins[] = { 104, 105, 106, 107, 108 };
0369 static struct spear_muxreg i2s0_muxreg[] = {
0370     {
0371         .reg = PAD_FUNCTION_EN_0,
0372         .mask = PMX_I2S0_MASK,
0373         .val = PMX_I2S0_MASK,
0374     }, {
0375         .reg = PAD_DIRECTION_SEL_0,
0376         .mask = PMX_I2S0_MASK,
0377         .val = PMX_I2S0_MASK,
0378     },
0379 };
0380 
0381 static struct spear_modemux i2s0_modemux[] = {
0382     {
0383         .muxregs = i2s0_muxreg,
0384         .nmuxregs = ARRAY_SIZE(i2s0_muxreg),
0385     },
0386 };
0387 
0388 static struct spear_pingroup i2s0_pingroup = {
0389     .name = "i2s0_grp",
0390     .pins = i2s0_pins,
0391     .npins = ARRAY_SIZE(i2s0_pins),
0392     .modemuxs = i2s0_modemux,
0393     .nmodemuxs = ARRAY_SIZE(i2s0_modemux),
0394 };
0395 
0396 static const char *const i2s0_grps[] = { "i2s0_grp" };
0397 static struct spear_function i2s0_function = {
0398     .name = "i2s0",
0399     .groups = i2s0_grps,
0400     .ngroups = ARRAY_SIZE(i2s0_grps),
0401 };
0402 
0403 /* Pad multiplexing for i2s1 device */
0404 static const unsigned i2s1_pins[] = { 0, 1, 2, 3 };
0405 static struct spear_muxreg i2s1_muxreg[] = {
0406     {
0407         .reg = PAD_FUNCTION_EN_1,
0408         .mask = PMX_I2S1_MASK,
0409         .val = PMX_I2S1_MASK,
0410     }, {
0411         .reg = PAD_DIRECTION_SEL_1,
0412         .mask = PMX_I2S1_MASK,
0413         .val = PMX_I2S1_MASK,
0414     },
0415 };
0416 
0417 static struct spear_modemux i2s1_modemux[] = {
0418     {
0419         .muxregs = i2s1_muxreg,
0420         .nmuxregs = ARRAY_SIZE(i2s1_muxreg),
0421     },
0422 };
0423 
0424 static struct spear_pingroup i2s1_pingroup = {
0425     .name = "i2s1_grp",
0426     .pins = i2s1_pins,
0427     .npins = ARRAY_SIZE(i2s1_pins),
0428     .modemuxs = i2s1_modemux,
0429     .nmodemuxs = ARRAY_SIZE(i2s1_modemux),
0430 };
0431 
0432 static const char *const i2s1_grps[] = { "i2s1_grp" };
0433 static struct spear_function i2s1_function = {
0434     .name = "i2s1",
0435     .groups = i2s1_grps,
0436     .ngroups = ARRAY_SIZE(i2s1_grps),
0437 };
0438 
0439 /* Pad multiplexing for clcd device */
0440 static const unsigned clcd_pins[] = { 113, 114, 115, 116, 117, 118, 119, 120,
0441     121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
0442     135, 136, 137, 138, 139, 140, 141, 142 };
0443 static struct spear_muxreg clcd_muxreg[] = {
0444     {
0445         .reg = PAD_FUNCTION_EN_0,
0446         .mask = PMX_CLCD1_MASK,
0447         .val = PMX_CLCD1_MASK,
0448     }, {
0449         .reg = PAD_DIRECTION_SEL_0,
0450         .mask = PMX_CLCD1_MASK,
0451         .val = PMX_CLCD1_MASK,
0452     },
0453 };
0454 
0455 static struct spear_modemux clcd_modemux[] = {
0456     {
0457         .muxregs = clcd_muxreg,
0458         .nmuxregs = ARRAY_SIZE(clcd_muxreg),
0459     },
0460 };
0461 
0462 static struct spear_pingroup clcd_pingroup = {
0463     .name = "clcd_grp",
0464     .pins = clcd_pins,
0465     .npins = ARRAY_SIZE(clcd_pins),
0466     .modemuxs = clcd_modemux,
0467     .nmodemuxs = ARRAY_SIZE(clcd_modemux),
0468 };
0469 
0470 static const unsigned clcd_high_res_pins[] = { 30, 31, 32, 33, 34, 35, 36, 37,
0471     38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 };
0472 static struct spear_muxreg clcd_high_res_muxreg[] = {
0473     {
0474         .reg = PAD_FUNCTION_EN_1,
0475         .mask = PMX_CLCD2_MASK,
0476         .val = PMX_CLCD2_MASK,
0477     }, {
0478         .reg = PAD_DIRECTION_SEL_1,
0479         .mask = PMX_CLCD2_MASK,
0480         .val = PMX_CLCD2_MASK,
0481     },
0482 };
0483 
0484 static struct spear_modemux clcd_high_res_modemux[] = {
0485     {
0486         .muxregs = clcd_high_res_muxreg,
0487         .nmuxregs = ARRAY_SIZE(clcd_high_res_muxreg),
0488     },
0489 };
0490 
0491 static struct spear_pingroup clcd_high_res_pingroup = {
0492     .name = "clcd_high_res_grp",
0493     .pins = clcd_high_res_pins,
0494     .npins = ARRAY_SIZE(clcd_high_res_pins),
0495     .modemuxs = clcd_high_res_modemux,
0496     .nmodemuxs = ARRAY_SIZE(clcd_high_res_modemux),
0497 };
0498 
0499 static const char *const clcd_grps[] = { "clcd_grp", "clcd_high_res_grp" };
0500 static struct spear_function clcd_function = {
0501     .name = "clcd",
0502     .groups = clcd_grps,
0503     .ngroups = ARRAY_SIZE(clcd_grps),
0504 };
0505 
0506 static const unsigned arm_gpio_pins[] = { 18, 19, 20, 21, 22, 23, 143, 144, 145,
0507     146, 147, 148, 149, 150, 151, 152 };
0508 static struct spear_muxreg arm_gpio_muxreg[] = {
0509     {
0510         .reg = PAD_FUNCTION_EN_0,
0511         .mask = PMX_EGPIO_0_GRP_MASK,
0512         .val = PMX_EGPIO_0_GRP_MASK,
0513     }, {
0514         .reg = PAD_FUNCTION_EN_1,
0515         .mask = PMX_EGPIO_1_GRP_MASK,
0516         .val = PMX_EGPIO_1_GRP_MASK,
0517     }, {
0518         .reg = PAD_DIRECTION_SEL_0,
0519         .mask = PMX_EGPIO_0_GRP_MASK,
0520         .val = PMX_EGPIO_0_GRP_MASK,
0521     }, {
0522         .reg = PAD_DIRECTION_SEL_1,
0523         .mask = PMX_EGPIO_1_GRP_MASK,
0524         .val = PMX_EGPIO_1_GRP_MASK,
0525     },
0526 };
0527 
0528 static struct spear_modemux arm_gpio_modemux[] = {
0529     {
0530         .muxregs = arm_gpio_muxreg,
0531         .nmuxregs = ARRAY_SIZE(arm_gpio_muxreg),
0532     },
0533 };
0534 
0535 static struct spear_pingroup arm_gpio_pingroup = {
0536     .name = "arm_gpio_grp",
0537     .pins = arm_gpio_pins,
0538     .npins = ARRAY_SIZE(arm_gpio_pins),
0539     .modemuxs = arm_gpio_modemux,
0540     .nmodemuxs = ARRAY_SIZE(arm_gpio_modemux),
0541 };
0542 
0543 static const char *const arm_gpio_grps[] = { "arm_gpio_grp" };
0544 static struct spear_function arm_gpio_function = {
0545     .name = "arm_gpio",
0546     .groups = arm_gpio_grps,
0547     .ngroups = ARRAY_SIZE(arm_gpio_grps),
0548 };
0549 
0550 /* Pad multiplexing for smi 2 chips device */
0551 static const unsigned smi_2_chips_pins[] = { 153, 154, 155, 156, 157 };
0552 static struct spear_muxreg smi_2_chips_muxreg[] = {
0553     {
0554         .reg = PAD_FUNCTION_EN_0,
0555         .mask = PMX_SMI_MASK,
0556         .val = PMX_SMI_MASK,
0557     }, {
0558         .reg = PAD_DIRECTION_SEL_0,
0559         .mask = PMX_SMI_MASK,
0560         .val = PMX_SMI_MASK,
0561     },
0562 };
0563 
0564 static struct spear_modemux smi_2_chips_modemux[] = {
0565     {
0566         .muxregs = smi_2_chips_muxreg,
0567         .nmuxregs = ARRAY_SIZE(smi_2_chips_muxreg),
0568     },
0569 };
0570 
0571 static struct spear_pingroup smi_2_chips_pingroup = {
0572     .name = "smi_2_chips_grp",
0573     .pins = smi_2_chips_pins,
0574     .npins = ARRAY_SIZE(smi_2_chips_pins),
0575     .modemuxs = smi_2_chips_modemux,
0576     .nmodemuxs = ARRAY_SIZE(smi_2_chips_modemux),
0577 };
0578 
0579 static const unsigned smi_4_chips_pins[] = { 54, 55 };
0580 static struct spear_muxreg smi_4_chips_muxreg[] = {
0581     {
0582         .reg = PAD_FUNCTION_EN_0,
0583         .mask = PMX_SMI_MASK,
0584         .val = PMX_SMI_MASK,
0585     }, {
0586         .reg = PAD_FUNCTION_EN_1,
0587         .mask = PMX_SMINCS2_MASK | PMX_SMINCS3_MASK,
0588         .val = PMX_SMINCS2_MASK | PMX_SMINCS3_MASK,
0589     }, {
0590         .reg = PAD_DIRECTION_SEL_0,
0591         .mask = PMX_SMI_MASK,
0592         .val = PMX_SMI_MASK,
0593     }, {
0594         .reg = PAD_DIRECTION_SEL_1,
0595         .mask = PMX_SMINCS2_MASK | PMX_SMINCS3_MASK,
0596         .val = PMX_SMINCS2_MASK | PMX_SMINCS3_MASK,
0597     },
0598 };
0599 
0600 static struct spear_modemux smi_4_chips_modemux[] = {
0601     {
0602         .muxregs = smi_4_chips_muxreg,
0603         .nmuxregs = ARRAY_SIZE(smi_4_chips_muxreg),
0604     },
0605 };
0606 
0607 static struct spear_pingroup smi_4_chips_pingroup = {
0608     .name = "smi_4_chips_grp",
0609     .pins = smi_4_chips_pins,
0610     .npins = ARRAY_SIZE(smi_4_chips_pins),
0611     .modemuxs = smi_4_chips_modemux,
0612     .nmodemuxs = ARRAY_SIZE(smi_4_chips_modemux),
0613 };
0614 
0615 static const char *const smi_grps[] = { "smi_2_chips_grp", "smi_4_chips_grp" };
0616 static struct spear_function smi_function = {
0617     .name = "smi",
0618     .groups = smi_grps,
0619     .ngroups = ARRAY_SIZE(smi_grps),
0620 };
0621 
0622 /* Pad multiplexing for gmii device */
0623 static const unsigned gmii_pins[] = { 173, 174, 175, 176, 177, 178, 179, 180,
0624     181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
0625     195, 196, 197, 198, 199, 200 };
0626 static struct spear_muxreg gmii_muxreg[] = {
0627     {
0628         .reg = PAD_FUNCTION_EN_0,
0629         .mask = PMX_GMII_MASK,
0630         .val = PMX_GMII_MASK,
0631     }, {
0632         .reg = PAD_DIRECTION_SEL_0,
0633         .mask = PMX_GMII_MASK,
0634         .val = PMX_GMII_MASK,
0635     },
0636 };
0637 
0638 static struct spear_modemux gmii_modemux[] = {
0639     {
0640         .muxregs = gmii_muxreg,
0641         .nmuxregs = ARRAY_SIZE(gmii_muxreg),
0642     },
0643 };
0644 
0645 static struct spear_pingroup gmii_pingroup = {
0646     .name = "gmii_grp",
0647     .pins = gmii_pins,
0648     .npins = ARRAY_SIZE(gmii_pins),
0649     .modemuxs = gmii_modemux,
0650     .nmodemuxs = ARRAY_SIZE(gmii_modemux),
0651 };
0652 
0653 static const char *const gmii_grps[] = { "gmii_grp" };
0654 static struct spear_function gmii_function = {
0655     .name = "gmii",
0656     .groups = gmii_grps,
0657     .ngroups = ARRAY_SIZE(gmii_grps),
0658 };
0659 
0660 /* Pad multiplexing for rgmii device */
0661 static const unsigned rgmii_pins[] = { 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
0662     28, 29, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 175,
0663     180, 181, 182, 183, 185, 188, 193, 194, 195, 196, 197, 198, 211, 212 };
0664 static struct spear_muxreg rgmii_muxreg[] = {
0665     {
0666         .reg = PAD_FUNCTION_EN_0,
0667         .mask = PMX_RGMII_REG0_MASK,
0668         .val = 0,
0669     }, {
0670         .reg = PAD_FUNCTION_EN_1,
0671         .mask = PMX_RGMII_REG1_MASK,
0672         .val = 0,
0673     }, {
0674         .reg = PAD_FUNCTION_EN_2,
0675         .mask = PMX_RGMII_REG2_MASK,
0676         .val = 0,
0677     }, {
0678         .reg = PAD_DIRECTION_SEL_0,
0679         .mask = PMX_RGMII_REG0_MASK,
0680         .val = PMX_RGMII_REG0_MASK,
0681     }, {
0682         .reg = PAD_DIRECTION_SEL_1,
0683         .mask = PMX_RGMII_REG1_MASK,
0684         .val = PMX_RGMII_REG1_MASK,
0685     }, {
0686         .reg = PAD_DIRECTION_SEL_2,
0687         .mask = PMX_RGMII_REG2_MASK,
0688         .val = PMX_RGMII_REG2_MASK,
0689     },
0690 };
0691 
0692 static struct spear_modemux rgmii_modemux[] = {
0693     {
0694         .muxregs = rgmii_muxreg,
0695         .nmuxregs = ARRAY_SIZE(rgmii_muxreg),
0696     },
0697 };
0698 
0699 static struct spear_pingroup rgmii_pingroup = {
0700     .name = "rgmii_grp",
0701     .pins = rgmii_pins,
0702     .npins = ARRAY_SIZE(rgmii_pins),
0703     .modemuxs = rgmii_modemux,
0704     .nmodemuxs = ARRAY_SIZE(rgmii_modemux),
0705 };
0706 
0707 static const char *const rgmii_grps[] = { "rgmii_grp" };
0708 static struct spear_function rgmii_function = {
0709     .name = "rgmii",
0710     .groups = rgmii_grps,
0711     .ngroups = ARRAY_SIZE(rgmii_grps),
0712 };
0713 
0714 /* Pad multiplexing for smii_0_1_2 device */
0715 static const unsigned smii_0_1_2_pins[] = { 24, 25, 26, 27, 28, 29, 30, 31, 32,
0716     33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
0717     51, 52, 53, 54, 55 };
0718 static struct spear_muxreg smii_0_1_2_muxreg[] = {
0719     {
0720         .reg = PAD_FUNCTION_EN_1,
0721         .mask = PMX_SMII_0_1_2_MASK,
0722         .val = 0,
0723     }, {
0724         .reg = PAD_DIRECTION_SEL_1,
0725         .mask = PMX_SMII_0_1_2_MASK,
0726         .val = PMX_SMII_0_1_2_MASK,
0727     },
0728 };
0729 
0730 static struct spear_modemux smii_0_1_2_modemux[] = {
0731     {
0732         .muxregs = smii_0_1_2_muxreg,
0733         .nmuxregs = ARRAY_SIZE(smii_0_1_2_muxreg),
0734     },
0735 };
0736 
0737 static struct spear_pingroup smii_0_1_2_pingroup = {
0738     .name = "smii_0_1_2_grp",
0739     .pins = smii_0_1_2_pins,
0740     .npins = ARRAY_SIZE(smii_0_1_2_pins),
0741     .modemuxs = smii_0_1_2_modemux,
0742     .nmodemuxs = ARRAY_SIZE(smii_0_1_2_modemux),
0743 };
0744 
0745 static const char *const smii_0_1_2_grps[] = { "smii_0_1_2_grp" };
0746 static struct spear_function smii_0_1_2_function = {
0747     .name = "smii_0_1_2",
0748     .groups = smii_0_1_2_grps,
0749     .ngroups = ARRAY_SIZE(smii_0_1_2_grps),
0750 };
0751 
0752 /* Pad multiplexing for ras_mii_txclk device */
0753 static const unsigned ras_mii_txclk_pins[] = { 98, 99 };
0754 static struct spear_muxreg ras_mii_txclk_muxreg[] = {
0755     {
0756         .reg = PAD_FUNCTION_EN_1,
0757         .mask = PMX_NFCE2_MASK,
0758         .val = 0,
0759     }, {
0760         .reg = PAD_DIRECTION_SEL_1,
0761         .mask = PMX_NFCE2_MASK,
0762         .val = PMX_NFCE2_MASK,
0763     },
0764 };
0765 
0766 static struct spear_modemux ras_mii_txclk_modemux[] = {
0767     {
0768         .muxregs = ras_mii_txclk_muxreg,
0769         .nmuxregs = ARRAY_SIZE(ras_mii_txclk_muxreg),
0770     },
0771 };
0772 
0773 static struct spear_pingroup ras_mii_txclk_pingroup = {
0774     .name = "ras_mii_txclk_grp",
0775     .pins = ras_mii_txclk_pins,
0776     .npins = ARRAY_SIZE(ras_mii_txclk_pins),
0777     .modemuxs = ras_mii_txclk_modemux,
0778     .nmodemuxs = ARRAY_SIZE(ras_mii_txclk_modemux),
0779 };
0780 
0781 static const char *const ras_mii_txclk_grps[] = { "ras_mii_txclk_grp" };
0782 static struct spear_function ras_mii_txclk_function = {
0783     .name = "ras_mii_txclk",
0784     .groups = ras_mii_txclk_grps,
0785     .ngroups = ARRAY_SIZE(ras_mii_txclk_grps),
0786 };
0787 
0788 /* Pad multiplexing for nand 8bit device (cs0 only) */
0789 static const unsigned nand_8bit_pins[] = { 56, 57, 58, 59, 60, 61, 62, 63, 64,
0790     65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
0791     83, 84, 85, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
0792     170, 171, 172, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
0793     212 };
0794 static struct spear_muxreg nand_8bit_muxreg[] = {
0795     {
0796         .reg = PAD_FUNCTION_EN_0,
0797         .mask = PMX_NAND8BIT_0_MASK,
0798         .val = PMX_NAND8BIT_0_MASK,
0799     }, {
0800         .reg = PAD_FUNCTION_EN_1,
0801         .mask = PMX_NAND8BIT_1_MASK,
0802         .val = PMX_NAND8BIT_1_MASK,
0803     }, {
0804         .reg = PAD_DIRECTION_SEL_0,
0805         .mask = PMX_NAND8BIT_0_MASK,
0806         .val = PMX_NAND8BIT_0_MASK,
0807     }, {
0808         .reg = PAD_DIRECTION_SEL_1,
0809         .mask = PMX_NAND8BIT_1_MASK,
0810         .val = PMX_NAND8BIT_1_MASK,
0811     },
0812 };
0813 
0814 static struct spear_modemux nand_8bit_modemux[] = {
0815     {
0816         .muxregs = nand_8bit_muxreg,
0817         .nmuxregs = ARRAY_SIZE(nand_8bit_muxreg),
0818     },
0819 };
0820 
0821 static struct spear_pingroup nand_8bit_pingroup = {
0822     .name = "nand_8bit_grp",
0823     .pins = nand_8bit_pins,
0824     .npins = ARRAY_SIZE(nand_8bit_pins),
0825     .modemuxs = nand_8bit_modemux,
0826     .nmodemuxs = ARRAY_SIZE(nand_8bit_modemux),
0827 };
0828 
0829 /* Pad multiplexing for nand 16bit device */
0830 static const unsigned nand_16bit_pins[] = { 201, 202, 203, 204, 207, 208, 209,
0831     210 };
0832 static struct spear_muxreg nand_16bit_muxreg[] = {
0833     {
0834         .reg = PAD_FUNCTION_EN_1,
0835         .mask = PMX_NAND16BIT_1_MASK,
0836         .val = PMX_NAND16BIT_1_MASK,
0837     }, {
0838         .reg = PAD_DIRECTION_SEL_1,
0839         .mask = PMX_NAND16BIT_1_MASK,
0840         .val = PMX_NAND16BIT_1_MASK,
0841     },
0842 };
0843 
0844 static struct spear_modemux nand_16bit_modemux[] = {
0845     {
0846         .muxregs = nand_16bit_muxreg,
0847         .nmuxregs = ARRAY_SIZE(nand_16bit_muxreg),
0848     },
0849 };
0850 
0851 static struct spear_pingroup nand_16bit_pingroup = {
0852     .name = "nand_16bit_grp",
0853     .pins = nand_16bit_pins,
0854     .npins = ARRAY_SIZE(nand_16bit_pins),
0855     .modemuxs = nand_16bit_modemux,
0856     .nmodemuxs = ARRAY_SIZE(nand_16bit_modemux),
0857 };
0858 
0859 /* Pad multiplexing for nand 4 chips */
0860 static const unsigned nand_4_chips_pins[] = { 205, 206, 211, 212 };
0861 static struct spear_muxreg nand_4_chips_muxreg[] = {
0862     {
0863         .reg = PAD_FUNCTION_EN_1,
0864         .mask = PMX_NAND_4CHIPS_MASK,
0865         .val = PMX_NAND_4CHIPS_MASK,
0866     }, {
0867         .reg = PAD_DIRECTION_SEL_1,
0868         .mask = PMX_NAND_4CHIPS_MASK,
0869         .val = PMX_NAND_4CHIPS_MASK,
0870     },
0871 };
0872 
0873 static struct spear_modemux nand_4_chips_modemux[] = {
0874     {
0875         .muxregs = nand_4_chips_muxreg,
0876         .nmuxregs = ARRAY_SIZE(nand_4_chips_muxreg),
0877     },
0878 };
0879 
0880 static struct spear_pingroup nand_4_chips_pingroup = {
0881     .name = "nand_4_chips_grp",
0882     .pins = nand_4_chips_pins,
0883     .npins = ARRAY_SIZE(nand_4_chips_pins),
0884     .modemuxs = nand_4_chips_modemux,
0885     .nmodemuxs = ARRAY_SIZE(nand_4_chips_modemux),
0886 };
0887 
0888 static const char *const nand_grps[] = { "nand_8bit_grp", "nand_16bit_grp",
0889     "nand_4_chips_grp" };
0890 static struct spear_function nand_function = {
0891     .name = "nand",
0892     .groups = nand_grps,
0893     .ngroups = ARRAY_SIZE(nand_grps),
0894 };
0895 
0896 /* Pad multiplexing for keyboard_6x6 device */
0897 static const unsigned keyboard_6x6_pins[] = { 201, 202, 203, 204, 205, 206, 207,
0898     208, 209, 210, 211, 212 };
0899 static struct spear_muxreg keyboard_6x6_muxreg[] = {
0900     {
0901         .reg = PAD_FUNCTION_EN_1,
0902         .mask = PMX_KEYBOARD_6X6_MASK | PMX_NFIO8_15_MASK |
0903             PMX_NFCE1_MASK | PMX_NFCE2_MASK | PMX_NFWPRT1_MASK |
0904             PMX_NFWPRT2_MASK,
0905         .val = PMX_KEYBOARD_6X6_MASK,
0906     },
0907 };
0908 
0909 static struct spear_modemux keyboard_6x6_modemux[] = {
0910     {
0911         .muxregs = keyboard_6x6_muxreg,
0912         .nmuxregs = ARRAY_SIZE(keyboard_6x6_muxreg),
0913     },
0914 };
0915 
0916 static struct spear_pingroup keyboard_6x6_pingroup = {
0917     .name = "keyboard_6x6_grp",
0918     .pins = keyboard_6x6_pins,
0919     .npins = ARRAY_SIZE(keyboard_6x6_pins),
0920     .modemuxs = keyboard_6x6_modemux,
0921     .nmodemuxs = ARRAY_SIZE(keyboard_6x6_modemux),
0922 };
0923 
0924 /* Pad multiplexing for keyboard_rowcol6_8 device */
0925 static const unsigned keyboard_rowcol6_8_pins[] = { 24, 25, 26, 27, 28, 29 };
0926 static struct spear_muxreg keyboard_rowcol6_8_muxreg[] = {
0927     {
0928         .reg = PAD_FUNCTION_EN_1,
0929         .mask = PMX_KBD_ROWCOL68_MASK,
0930         .val = PMX_KBD_ROWCOL68_MASK,
0931     }, {
0932         .reg = PAD_DIRECTION_SEL_1,
0933         .mask = PMX_KBD_ROWCOL68_MASK,
0934         .val = PMX_KBD_ROWCOL68_MASK,
0935     },
0936 };
0937 
0938 static struct spear_modemux keyboard_rowcol6_8_modemux[] = {
0939     {
0940         .muxregs = keyboard_rowcol6_8_muxreg,
0941         .nmuxregs = ARRAY_SIZE(keyboard_rowcol6_8_muxreg),
0942     },
0943 };
0944 
0945 static struct spear_pingroup keyboard_rowcol6_8_pingroup = {
0946     .name = "keyboard_rowcol6_8_grp",
0947     .pins = keyboard_rowcol6_8_pins,
0948     .npins = ARRAY_SIZE(keyboard_rowcol6_8_pins),
0949     .modemuxs = keyboard_rowcol6_8_modemux,
0950     .nmodemuxs = ARRAY_SIZE(keyboard_rowcol6_8_modemux),
0951 };
0952 
0953 static const char *const keyboard_grps[] = { "keyboard_6x6_grp",
0954     "keyboard_rowcol6_8_grp" };
0955 static struct spear_function keyboard_function = {
0956     .name = "keyboard",
0957     .groups = keyboard_grps,
0958     .ngroups = ARRAY_SIZE(keyboard_grps),
0959 };
0960 
0961 /* Pad multiplexing for uart0 device */
0962 static const unsigned uart0_pins[] = { 100, 101 };
0963 static struct spear_muxreg uart0_muxreg[] = {
0964     {
0965         .reg = PAD_FUNCTION_EN_0,
0966         .mask = PMX_UART0_MASK,
0967         .val = PMX_UART0_MASK,
0968     }, {
0969         .reg = PAD_DIRECTION_SEL_0,
0970         .mask = PMX_UART0_MASK,
0971         .val = PMX_UART0_MASK,
0972     },
0973 };
0974 
0975 static struct spear_modemux uart0_modemux[] = {
0976     {
0977         .muxregs = uart0_muxreg,
0978         .nmuxregs = ARRAY_SIZE(uart0_muxreg),
0979     },
0980 };
0981 
0982 static struct spear_pingroup uart0_pingroup = {
0983     .name = "uart0_grp",
0984     .pins = uart0_pins,
0985     .npins = ARRAY_SIZE(uart0_pins),
0986     .modemuxs = uart0_modemux,
0987     .nmodemuxs = ARRAY_SIZE(uart0_modemux),
0988 };
0989 
0990 /* Pad multiplexing for uart0_modem device */
0991 static const unsigned uart0_modem_pins[] = { 12, 13, 14, 15, 16, 17 };
0992 static struct spear_muxreg uart0_modem_muxreg[] = {
0993     {
0994         .reg = PAD_FUNCTION_EN_1,
0995         .mask = PMX_UART0_MODEM_MASK,
0996         .val = PMX_UART0_MODEM_MASK,
0997     }, {
0998         .reg = PAD_DIRECTION_SEL_1,
0999         .mask = PMX_UART0_MODEM_MASK,
1000         .val = PMX_UART0_MODEM_MASK,
1001     },
1002 };
1003 
1004 static struct spear_modemux uart0_modem_modemux[] = {
1005     {
1006         .muxregs = uart0_modem_muxreg,
1007         .nmuxregs = ARRAY_SIZE(uart0_modem_muxreg),
1008     },
1009 };
1010 
1011 static struct spear_pingroup uart0_modem_pingroup = {
1012     .name = "uart0_modem_grp",
1013     .pins = uart0_modem_pins,
1014     .npins = ARRAY_SIZE(uart0_modem_pins),
1015     .modemuxs = uart0_modem_modemux,
1016     .nmodemuxs = ARRAY_SIZE(uart0_modem_modemux),
1017 };
1018 
1019 static const char *const uart0_grps[] = { "uart0_grp", "uart0_modem_grp" };
1020 static struct spear_function uart0_function = {
1021     .name = "uart0",
1022     .groups = uart0_grps,
1023     .ngroups = ARRAY_SIZE(uart0_grps),
1024 };
1025 
1026 /* Pad multiplexing for gpt0_tmr0 device */
1027 static const unsigned gpt0_tmr0_pins[] = { 10, 11 };
1028 static struct spear_muxreg gpt0_tmr0_muxreg[] = {
1029     {
1030         .reg = PAD_FUNCTION_EN_1,
1031         .mask = PMX_GPT0_TMR0_MASK,
1032         .val = PMX_GPT0_TMR0_MASK,
1033     }, {
1034         .reg = PAD_DIRECTION_SEL_1,
1035         .mask = PMX_GPT0_TMR0_MASK,
1036         .val = PMX_GPT0_TMR0_MASK,
1037     },
1038 };
1039 
1040 static struct spear_modemux gpt0_tmr0_modemux[] = {
1041     {
1042         .muxregs = gpt0_tmr0_muxreg,
1043         .nmuxregs = ARRAY_SIZE(gpt0_tmr0_muxreg),
1044     },
1045 };
1046 
1047 static struct spear_pingroup gpt0_tmr0_pingroup = {
1048     .name = "gpt0_tmr0_grp",
1049     .pins = gpt0_tmr0_pins,
1050     .npins = ARRAY_SIZE(gpt0_tmr0_pins),
1051     .modemuxs = gpt0_tmr0_modemux,
1052     .nmodemuxs = ARRAY_SIZE(gpt0_tmr0_modemux),
1053 };
1054 
1055 /* Pad multiplexing for gpt0_tmr1 device */
1056 static const unsigned gpt0_tmr1_pins[] = { 8, 9 };
1057 static struct spear_muxreg gpt0_tmr1_muxreg[] = {
1058     {
1059         .reg = PAD_FUNCTION_EN_1,
1060         .mask = PMX_GPT0_TMR1_MASK,
1061         .val = PMX_GPT0_TMR1_MASK,
1062     }, {
1063         .reg = PAD_DIRECTION_SEL_1,
1064         .mask = PMX_GPT0_TMR1_MASK,
1065         .val = PMX_GPT0_TMR1_MASK,
1066     },
1067 };
1068 
1069 static struct spear_modemux gpt0_tmr1_modemux[] = {
1070     {
1071         .muxregs = gpt0_tmr1_muxreg,
1072         .nmuxregs = ARRAY_SIZE(gpt0_tmr1_muxreg),
1073     },
1074 };
1075 
1076 static struct spear_pingroup gpt0_tmr1_pingroup = {
1077     .name = "gpt0_tmr1_grp",
1078     .pins = gpt0_tmr1_pins,
1079     .npins = ARRAY_SIZE(gpt0_tmr1_pins),
1080     .modemuxs = gpt0_tmr1_modemux,
1081     .nmodemuxs = ARRAY_SIZE(gpt0_tmr1_modemux),
1082 };
1083 
1084 static const char *const gpt0_grps[] = { "gpt0_tmr0_grp", "gpt0_tmr1_grp" };
1085 static struct spear_function gpt0_function = {
1086     .name = "gpt0",
1087     .groups = gpt0_grps,
1088     .ngroups = ARRAY_SIZE(gpt0_grps),
1089 };
1090 
1091 /* Pad multiplexing for gpt1_tmr0 device */
1092 static const unsigned gpt1_tmr0_pins[] = { 6, 7 };
1093 static struct spear_muxreg gpt1_tmr0_muxreg[] = {
1094     {
1095         .reg = PAD_FUNCTION_EN_1,
1096         .mask = PMX_GPT1_TMR0_MASK,
1097         .val = PMX_GPT1_TMR0_MASK,
1098     }, {
1099         .reg = PAD_DIRECTION_SEL_1,
1100         .mask = PMX_GPT1_TMR0_MASK,
1101         .val = PMX_GPT1_TMR0_MASK,
1102     },
1103 };
1104 
1105 static struct spear_modemux gpt1_tmr0_modemux[] = {
1106     {
1107         .muxregs = gpt1_tmr0_muxreg,
1108         .nmuxregs = ARRAY_SIZE(gpt1_tmr0_muxreg),
1109     },
1110 };
1111 
1112 static struct spear_pingroup gpt1_tmr0_pingroup = {
1113     .name = "gpt1_tmr0_grp",
1114     .pins = gpt1_tmr0_pins,
1115     .npins = ARRAY_SIZE(gpt1_tmr0_pins),
1116     .modemuxs = gpt1_tmr0_modemux,
1117     .nmodemuxs = ARRAY_SIZE(gpt1_tmr0_modemux),
1118 };
1119 
1120 /* Pad multiplexing for gpt1_tmr1 device */
1121 static const unsigned gpt1_tmr1_pins[] = { 4, 5 };
1122 static struct spear_muxreg gpt1_tmr1_muxreg[] = {
1123     {
1124         .reg = PAD_FUNCTION_EN_1,
1125         .mask = PMX_GPT1_TMR1_MASK,
1126         .val = PMX_GPT1_TMR1_MASK,
1127     }, {
1128         .reg = PAD_DIRECTION_SEL_1,
1129         .mask = PMX_GPT1_TMR1_MASK,
1130         .val = PMX_GPT1_TMR1_MASK,
1131     },
1132 };
1133 
1134 static struct spear_modemux gpt1_tmr1_modemux[] = {
1135     {
1136         .muxregs = gpt1_tmr1_muxreg,
1137         .nmuxregs = ARRAY_SIZE(gpt1_tmr1_muxreg),
1138     },
1139 };
1140 
1141 static struct spear_pingroup gpt1_tmr1_pingroup = {
1142     .name = "gpt1_tmr1_grp",
1143     .pins = gpt1_tmr1_pins,
1144     .npins = ARRAY_SIZE(gpt1_tmr1_pins),
1145     .modemuxs = gpt1_tmr1_modemux,
1146     .nmodemuxs = ARRAY_SIZE(gpt1_tmr1_modemux),
1147 };
1148 
1149 static const char *const gpt1_grps[] = { "gpt1_tmr1_grp", "gpt1_tmr0_grp" };
1150 static struct spear_function gpt1_function = {
1151     .name = "gpt1",
1152     .groups = gpt1_grps,
1153     .ngroups = ARRAY_SIZE(gpt1_grps),
1154 };
1155 
1156 /* Pad multiplexing for mcif device */
1157 static const unsigned mcif_pins[] = { 86, 87, 88, 89, 90, 91, 92, 93, 213, 214,
1158     215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228,
1159     229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242,
1160     243, 244, 245 };
1161 #define MCIF_MUXREG                     \
1162     {                           \
1163         .reg = PAD_FUNCTION_EN_0,           \
1164         .mask = PMX_MCI_DATA8_15_MASK,          \
1165         .val = PMX_MCI_DATA8_15_MASK,           \
1166     }, {                            \
1167         .reg = PAD_FUNCTION_EN_1,           \
1168         .mask = PMX_MCIFALL_1_MASK | PMX_NFWPRT1_MASK | \
1169             PMX_NFWPRT2_MASK,           \
1170         .val = PMX_MCIFALL_1_MASK,          \
1171     }, {                            \
1172         .reg = PAD_FUNCTION_EN_2,           \
1173         .mask = PMX_MCIFALL_2_MASK,         \
1174         .val = PMX_MCIFALL_2_MASK,          \
1175     }, {                            \
1176         .reg = PAD_DIRECTION_SEL_0,         \
1177         .mask = PMX_MCI_DATA8_15_MASK,          \
1178         .val = PMX_MCI_DATA8_15_MASK,           \
1179     }, {                            \
1180         .reg = PAD_DIRECTION_SEL_1,         \
1181         .mask = PMX_MCIFALL_1_MASK | PMX_NFWPRT1_MASK | \
1182             PMX_NFWPRT2_MASK,           \
1183         .val = PMX_MCIFALL_1_MASK | PMX_NFWPRT1_MASK |  \
1184             PMX_NFWPRT2_MASK,           \
1185     }, {                            \
1186         .reg = PAD_DIRECTION_SEL_2,         \
1187         .mask = PMX_MCIFALL_2_MASK,         \
1188         .val = PMX_MCIFALL_2_MASK,          \
1189     }
1190 
1191 /* sdhci device */
1192 static struct spear_muxreg sdhci_muxreg[] = {
1193     MCIF_MUXREG,
1194     {
1195         .reg = PERIP_CFG,
1196         .mask = MCIF_SEL_MASK,
1197         .val = MCIF_SEL_SD,
1198     },
1199 };
1200 
1201 static struct spear_modemux sdhci_modemux[] = {
1202     {
1203         .muxregs = sdhci_muxreg,
1204         .nmuxregs = ARRAY_SIZE(sdhci_muxreg),
1205     },
1206 };
1207 
1208 static struct spear_pingroup sdhci_pingroup = {
1209     .name = "sdhci_grp",
1210     .pins = mcif_pins,
1211     .npins = ARRAY_SIZE(mcif_pins),
1212     .modemuxs = sdhci_modemux,
1213     .nmodemuxs = ARRAY_SIZE(sdhci_modemux),
1214 };
1215 
1216 static const char *const sdhci_grps[] = { "sdhci_grp" };
1217 static struct spear_function sdhci_function = {
1218     .name = "sdhci",
1219     .groups = sdhci_grps,
1220     .ngroups = ARRAY_SIZE(sdhci_grps),
1221 };
1222 
1223 /* cf device */
1224 static struct spear_muxreg cf_muxreg[] = {
1225     MCIF_MUXREG,
1226     {
1227         .reg = PERIP_CFG,
1228         .mask = MCIF_SEL_MASK,
1229         .val = MCIF_SEL_CF,
1230     },
1231 };
1232 
1233 static struct spear_modemux cf_modemux[] = {
1234     {
1235         .muxregs = cf_muxreg,
1236         .nmuxregs = ARRAY_SIZE(cf_muxreg),
1237     },
1238 };
1239 
1240 static struct spear_pingroup cf_pingroup = {
1241     .name = "cf_grp",
1242     .pins = mcif_pins,
1243     .npins = ARRAY_SIZE(mcif_pins),
1244     .modemuxs = cf_modemux,
1245     .nmodemuxs = ARRAY_SIZE(cf_modemux),
1246 };
1247 
1248 static const char *const cf_grps[] = { "cf_grp" };
1249 static struct spear_function cf_function = {
1250     .name = "cf",
1251     .groups = cf_grps,
1252     .ngroups = ARRAY_SIZE(cf_grps),
1253 };
1254 
1255 /* xd device */
1256 static struct spear_muxreg xd_muxreg[] = {
1257     MCIF_MUXREG,
1258     {
1259         .reg = PERIP_CFG,
1260         .mask = MCIF_SEL_MASK,
1261         .val = MCIF_SEL_XD,
1262     },
1263 };
1264 
1265 static struct spear_modemux xd_modemux[] = {
1266     {
1267         .muxregs = xd_muxreg,
1268         .nmuxregs = ARRAY_SIZE(xd_muxreg),
1269     },
1270 };
1271 
1272 static struct spear_pingroup xd_pingroup = {
1273     .name = "xd_grp",
1274     .pins = mcif_pins,
1275     .npins = ARRAY_SIZE(mcif_pins),
1276     .modemuxs = xd_modemux,
1277     .nmodemuxs = ARRAY_SIZE(xd_modemux),
1278 };
1279 
1280 static const char *const xd_grps[] = { "xd_grp" };
1281 static struct spear_function xd_function = {
1282     .name = "xd",
1283     .groups = xd_grps,
1284     .ngroups = ARRAY_SIZE(xd_grps),
1285 };
1286 
1287 /* Pad multiplexing for touch_xy device */
1288 static const unsigned touch_xy_pins[] = { 97 };
1289 static struct spear_muxreg touch_xy_muxreg[] = {
1290     {
1291         .reg = PAD_FUNCTION_EN_2,
1292         .mask = PMX_TOUCH_XY_MASK,
1293         .val = PMX_TOUCH_XY_MASK,
1294     }, {
1295         .reg = PAD_DIRECTION_SEL_2,
1296         .mask = PMX_TOUCH_XY_MASK,
1297         .val = PMX_TOUCH_XY_MASK,
1298     },
1299 };
1300 
1301 static struct spear_modemux touch_xy_modemux[] = {
1302     {
1303         .muxregs = touch_xy_muxreg,
1304         .nmuxregs = ARRAY_SIZE(touch_xy_muxreg),
1305     },
1306 };
1307 
1308 static struct spear_pingroup touch_xy_pingroup = {
1309     .name = "touch_xy_grp",
1310     .pins = touch_xy_pins,
1311     .npins = ARRAY_SIZE(touch_xy_pins),
1312     .modemuxs = touch_xy_modemux,
1313     .nmodemuxs = ARRAY_SIZE(touch_xy_modemux),
1314 };
1315 
1316 static const char *const touch_xy_grps[] = { "touch_xy_grp" };
1317 static struct spear_function touch_xy_function = {
1318     .name = "touchscreen",
1319     .groups = touch_xy_grps,
1320     .ngroups = ARRAY_SIZE(touch_xy_grps),
1321 };
1322 
1323 /* Pad multiplexing for uart1 device */
1324 /* Muxed with I2C */
1325 static const unsigned uart1_dis_i2c_pins[] = { 102, 103 };
1326 static struct spear_muxreg uart1_dis_i2c_muxreg[] = {
1327     {
1328         .reg = PAD_FUNCTION_EN_0,
1329         .mask = PMX_I2C0_MASK,
1330         .val = 0,
1331     }, {
1332         .reg = PAD_DIRECTION_SEL_0,
1333         .mask = PMX_I2C0_MASK,
1334         .val = PMX_I2C0_MASK,
1335     },
1336 };
1337 
1338 static struct spear_modemux uart1_dis_i2c_modemux[] = {
1339     {
1340         .muxregs = uart1_dis_i2c_muxreg,
1341         .nmuxregs = ARRAY_SIZE(uart1_dis_i2c_muxreg),
1342     },
1343 };
1344 
1345 static struct spear_pingroup uart_1_dis_i2c_pingroup = {
1346     .name = "uart1_disable_i2c_grp",
1347     .pins = uart1_dis_i2c_pins,
1348     .npins = ARRAY_SIZE(uart1_dis_i2c_pins),
1349     .modemuxs = uart1_dis_i2c_modemux,
1350     .nmodemuxs = ARRAY_SIZE(uart1_dis_i2c_modemux),
1351 };
1352 
1353 /* Muxed with SD/MMC */
1354 static const unsigned uart1_dis_sd_pins[] = { 214, 215 };
1355 static struct spear_muxreg uart1_dis_sd_muxreg[] = {
1356     {
1357         .reg = PAD_FUNCTION_EN_1,
1358         .mask = PMX_MCIDATA1_MASK |
1359             PMX_MCIDATA2_MASK,
1360         .val = 0,
1361     }, {
1362         .reg = PAD_DIRECTION_SEL_1,
1363         .mask = PMX_MCIDATA1_MASK |
1364             PMX_MCIDATA2_MASK,
1365         .val = PMX_MCIDATA1_MASK |
1366             PMX_MCIDATA2_MASK,
1367     },
1368 };
1369 
1370 static struct spear_modemux uart1_dis_sd_modemux[] = {
1371     {
1372         .muxregs = uart1_dis_sd_muxreg,
1373         .nmuxregs = ARRAY_SIZE(uart1_dis_sd_muxreg),
1374     },
1375 };
1376 
1377 static struct spear_pingroup uart_1_dis_sd_pingroup = {
1378     .name = "uart1_disable_sd_grp",
1379     .pins = uart1_dis_sd_pins,
1380     .npins = ARRAY_SIZE(uart1_dis_sd_pins),
1381     .modemuxs = uart1_dis_sd_modemux,
1382     .nmodemuxs = ARRAY_SIZE(uart1_dis_sd_modemux),
1383 };
1384 
1385 static const char *const uart1_grps[] = { "uart1_disable_i2c_grp",
1386     "uart1_disable_sd_grp" };
1387 static struct spear_function uart1_function = {
1388     .name = "uart1",
1389     .groups = uart1_grps,
1390     .ngroups = ARRAY_SIZE(uart1_grps),
1391 };
1392 
1393 /* Pad multiplexing for uart2_3 device */
1394 static const unsigned uart2_3_pins[] = { 104, 105, 106, 107 };
1395 static struct spear_muxreg uart2_3_muxreg[] = {
1396     {
1397         .reg = PAD_FUNCTION_EN_0,
1398         .mask = PMX_I2S0_MASK,
1399         .val = 0,
1400     }, {
1401         .reg = PAD_DIRECTION_SEL_0,
1402         .mask = PMX_I2S0_MASK,
1403         .val = PMX_I2S0_MASK,
1404     },
1405 };
1406 
1407 static struct spear_modemux uart2_3_modemux[] = {
1408     {
1409         .muxregs = uart2_3_muxreg,
1410         .nmuxregs = ARRAY_SIZE(uart2_3_muxreg),
1411     },
1412 };
1413 
1414 static struct spear_pingroup uart_2_3_pingroup = {
1415     .name = "uart2_3_grp",
1416     .pins = uart2_3_pins,
1417     .npins = ARRAY_SIZE(uart2_3_pins),
1418     .modemuxs = uart2_3_modemux,
1419     .nmodemuxs = ARRAY_SIZE(uart2_3_modemux),
1420 };
1421 
1422 static const char *const uart2_3_grps[] = { "uart2_3_grp" };
1423 static struct spear_function uart2_3_function = {
1424     .name = "uart2_3",
1425     .groups = uart2_3_grps,
1426     .ngroups = ARRAY_SIZE(uart2_3_grps),
1427 };
1428 
1429 /* Pad multiplexing for uart4 device */
1430 static const unsigned uart4_pins[] = { 108, 113 };
1431 static struct spear_muxreg uart4_muxreg[] = {
1432     {
1433         .reg = PAD_FUNCTION_EN_0,
1434         .mask = PMX_I2S0_MASK | PMX_CLCD1_MASK,
1435         .val = 0,
1436     }, {
1437         .reg = PAD_DIRECTION_SEL_0,
1438         .mask = PMX_I2S0_MASK | PMX_CLCD1_MASK,
1439         .val = PMX_I2S0_MASK | PMX_CLCD1_MASK,
1440     },
1441 };
1442 
1443 static struct spear_modemux uart4_modemux[] = {
1444     {
1445         .muxregs = uart4_muxreg,
1446         .nmuxregs = ARRAY_SIZE(uart4_muxreg),
1447     },
1448 };
1449 
1450 static struct spear_pingroup uart_4_pingroup = {
1451     .name = "uart4_grp",
1452     .pins = uart4_pins,
1453     .npins = ARRAY_SIZE(uart4_pins),
1454     .modemuxs = uart4_modemux,
1455     .nmodemuxs = ARRAY_SIZE(uart4_modemux),
1456 };
1457 
1458 static const char *const uart4_grps[] = { "uart4_grp" };
1459 static struct spear_function uart4_function = {
1460     .name = "uart4",
1461     .groups = uart4_grps,
1462     .ngroups = ARRAY_SIZE(uart4_grps),
1463 };
1464 
1465 /* Pad multiplexing for uart5 device */
1466 static const unsigned uart5_pins[] = { 114, 115 };
1467 static struct spear_muxreg uart5_muxreg[] = {
1468     {
1469         .reg = PAD_FUNCTION_EN_0,
1470         .mask = PMX_CLCD1_MASK,
1471         .val = 0,
1472     }, {
1473         .reg = PAD_DIRECTION_SEL_0,
1474         .mask = PMX_CLCD1_MASK,
1475         .val = PMX_CLCD1_MASK,
1476     },
1477 };
1478 
1479 static struct spear_modemux uart5_modemux[] = {
1480     {
1481         .muxregs = uart5_muxreg,
1482         .nmuxregs = ARRAY_SIZE(uart5_muxreg),
1483     },
1484 };
1485 
1486 static struct spear_pingroup uart_5_pingroup = {
1487     .name = "uart5_grp",
1488     .pins = uart5_pins,
1489     .npins = ARRAY_SIZE(uart5_pins),
1490     .modemuxs = uart5_modemux,
1491     .nmodemuxs = ARRAY_SIZE(uart5_modemux),
1492 };
1493 
1494 static const char *const uart5_grps[] = { "uart5_grp" };
1495 static struct spear_function uart5_function = {
1496     .name = "uart5",
1497     .groups = uart5_grps,
1498     .ngroups = ARRAY_SIZE(uart5_grps),
1499 };
1500 
1501 /* Pad multiplexing for rs485_0_1_tdm_0_1 device */
1502 static const unsigned rs485_0_1_tdm_0_1_pins[] = { 116, 117, 118, 119, 120, 121,
1503     122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
1504     136, 137 };
1505 static struct spear_muxreg rs485_0_1_tdm_0_1_muxreg[] = {
1506     {
1507         .reg = PAD_FUNCTION_EN_0,
1508         .mask = PMX_CLCD1_MASK,
1509         .val = 0,
1510     }, {
1511         .reg = PAD_DIRECTION_SEL_0,
1512         .mask = PMX_CLCD1_MASK,
1513         .val = PMX_CLCD1_MASK,
1514     },
1515 };
1516 
1517 static struct spear_modemux rs485_0_1_tdm_0_1_modemux[] = {
1518     {
1519         .muxregs = rs485_0_1_tdm_0_1_muxreg,
1520         .nmuxregs = ARRAY_SIZE(rs485_0_1_tdm_0_1_muxreg),
1521     },
1522 };
1523 
1524 static struct spear_pingroup rs485_0_1_tdm_0_1_pingroup = {
1525     .name = "rs485_0_1_tdm_0_1_grp",
1526     .pins = rs485_0_1_tdm_0_1_pins,
1527     .npins = ARRAY_SIZE(rs485_0_1_tdm_0_1_pins),
1528     .modemuxs = rs485_0_1_tdm_0_1_modemux,
1529     .nmodemuxs = ARRAY_SIZE(rs485_0_1_tdm_0_1_modemux),
1530 };
1531 
1532 static const char *const rs485_0_1_tdm_0_1_grps[] = { "rs485_0_1_tdm_0_1_grp" };
1533 static struct spear_function rs485_0_1_tdm_0_1_function = {
1534     .name = "rs485_0_1_tdm_0_1",
1535     .groups = rs485_0_1_tdm_0_1_grps,
1536     .ngroups = ARRAY_SIZE(rs485_0_1_tdm_0_1_grps),
1537 };
1538 
1539 /* Pad multiplexing for i2c_1_2 device */
1540 static const unsigned i2c_1_2_pins[] = { 138, 139, 140, 141 };
1541 static struct spear_muxreg i2c_1_2_muxreg[] = {
1542     {
1543         .reg = PAD_FUNCTION_EN_0,
1544         .mask = PMX_CLCD1_MASK,
1545         .val = 0,
1546     }, {
1547         .reg = PAD_DIRECTION_SEL_0,
1548         .mask = PMX_CLCD1_MASK,
1549         .val = PMX_CLCD1_MASK,
1550     },
1551 };
1552 
1553 static struct spear_modemux i2c_1_2_modemux[] = {
1554     {
1555         .muxregs = i2c_1_2_muxreg,
1556         .nmuxregs = ARRAY_SIZE(i2c_1_2_muxreg),
1557     },
1558 };
1559 
1560 static struct spear_pingroup i2c_1_2_pingroup = {
1561     .name = "i2c_1_2_grp",
1562     .pins = i2c_1_2_pins,
1563     .npins = ARRAY_SIZE(i2c_1_2_pins),
1564     .modemuxs = i2c_1_2_modemux,
1565     .nmodemuxs = ARRAY_SIZE(i2c_1_2_modemux),
1566 };
1567 
1568 static const char *const i2c_1_2_grps[] = { "i2c_1_2_grp" };
1569 static struct spear_function i2c_1_2_function = {
1570     .name = "i2c_1_2",
1571     .groups = i2c_1_2_grps,
1572     .ngroups = ARRAY_SIZE(i2c_1_2_grps),
1573 };
1574 
1575 /* Pad multiplexing for i2c3_dis_smi_clcd device */
1576 /* Muxed with SMI & CLCD */
1577 static const unsigned i2c3_dis_smi_clcd_pins[] = { 142, 153 };
1578 static struct spear_muxreg i2c3_dis_smi_clcd_muxreg[] = {
1579     {
1580         .reg = PAD_FUNCTION_EN_0,
1581         .mask = PMX_CLCD1_MASK | PMX_SMI_MASK,
1582         .val = 0,
1583     }, {
1584         .reg = PAD_DIRECTION_SEL_0,
1585         .mask = PMX_CLCD1_MASK | PMX_SMI_MASK,
1586         .val = PMX_CLCD1_MASK | PMX_SMI_MASK,
1587     },
1588 };
1589 
1590 static struct spear_modemux i2c3_dis_smi_clcd_modemux[] = {
1591     {
1592         .muxregs = i2c3_dis_smi_clcd_muxreg,
1593         .nmuxregs = ARRAY_SIZE(i2c3_dis_smi_clcd_muxreg),
1594     },
1595 };
1596 
1597 static struct spear_pingroup i2c3_dis_smi_clcd_pingroup = {
1598     .name = "i2c3_dis_smi_clcd_grp",
1599     .pins = i2c3_dis_smi_clcd_pins,
1600     .npins = ARRAY_SIZE(i2c3_dis_smi_clcd_pins),
1601     .modemuxs = i2c3_dis_smi_clcd_modemux,
1602     .nmodemuxs = ARRAY_SIZE(i2c3_dis_smi_clcd_modemux),
1603 };
1604 
1605 /* Pad multiplexing for i2c3_dis_sd_i2s0 device */
1606 /* Muxed with SD/MMC & I2S1 */
1607 static const unsigned i2c3_dis_sd_i2s0_pins[] = { 0, 216 };
1608 static struct spear_muxreg i2c3_dis_sd_i2s0_muxreg[] = {
1609     {
1610         .reg = PAD_FUNCTION_EN_1,
1611         .mask = PMX_I2S1_MASK | PMX_MCIDATA3_MASK,
1612         .val = 0,
1613     }, {
1614         .reg = PAD_DIRECTION_SEL_1,
1615         .mask = PMX_I2S1_MASK | PMX_MCIDATA3_MASK,
1616         .val = PMX_I2S1_MASK | PMX_MCIDATA3_MASK,
1617     },
1618 };
1619 
1620 static struct spear_modemux i2c3_dis_sd_i2s0_modemux[] = {
1621     {
1622         .muxregs = i2c3_dis_sd_i2s0_muxreg,
1623         .nmuxregs = ARRAY_SIZE(i2c3_dis_sd_i2s0_muxreg),
1624     },
1625 };
1626 
1627 static struct spear_pingroup i2c3_dis_sd_i2s0_pingroup = {
1628     .name = "i2c3_dis_sd_i2s0_grp",
1629     .pins = i2c3_dis_sd_i2s0_pins,
1630     .npins = ARRAY_SIZE(i2c3_dis_sd_i2s0_pins),
1631     .modemuxs = i2c3_dis_sd_i2s0_modemux,
1632     .nmodemuxs = ARRAY_SIZE(i2c3_dis_sd_i2s0_modemux),
1633 };
1634 
1635 static const char *const i2c3_grps[] = { "i2c3_dis_smi_clcd_grp",
1636     "i2c3_dis_sd_i2s0_grp" };
1637 static struct spear_function i2c3_unction = {
1638     .name = "i2c3_i2s1",
1639     .groups = i2c3_grps,
1640     .ngroups = ARRAY_SIZE(i2c3_grps),
1641 };
1642 
1643 /* Pad multiplexing for i2c_4_5_dis_smi device */
1644 /* Muxed with SMI */
1645 static const unsigned i2c_4_5_dis_smi_pins[] = { 154, 155, 156, 157 };
1646 static struct spear_muxreg i2c_4_5_dis_smi_muxreg[] = {
1647     {
1648         .reg = PAD_FUNCTION_EN_0,
1649         .mask = PMX_SMI_MASK,
1650         .val = 0,
1651     }, {
1652         .reg = PAD_DIRECTION_SEL_0,
1653         .mask = PMX_SMI_MASK,
1654         .val = PMX_SMI_MASK,
1655     },
1656 };
1657 
1658 static struct spear_modemux i2c_4_5_dis_smi_modemux[] = {
1659     {
1660         .muxregs = i2c_4_5_dis_smi_muxreg,
1661         .nmuxregs = ARRAY_SIZE(i2c_4_5_dis_smi_muxreg),
1662     },
1663 };
1664 
1665 static struct spear_pingroup i2c_4_5_dis_smi_pingroup = {
1666     .name = "i2c_4_5_dis_smi_grp",
1667     .pins = i2c_4_5_dis_smi_pins,
1668     .npins = ARRAY_SIZE(i2c_4_5_dis_smi_pins),
1669     .modemuxs = i2c_4_5_dis_smi_modemux,
1670     .nmodemuxs = ARRAY_SIZE(i2c_4_5_dis_smi_modemux),
1671 };
1672 
1673 /* Pad multiplexing for i2c4_dis_sd device */
1674 /* Muxed with SD/MMC */
1675 static const unsigned i2c4_dis_sd_pins[] = { 217, 218 };
1676 static struct spear_muxreg i2c4_dis_sd_muxreg[] = {
1677     {
1678         .reg = PAD_FUNCTION_EN_1,
1679         .mask = PMX_MCIDATA4_MASK,
1680         .val = 0,
1681     }, {
1682         .reg = PAD_FUNCTION_EN_2,
1683         .mask = PMX_MCIDATA5_MASK,
1684         .val = 0,
1685     }, {
1686         .reg = PAD_DIRECTION_SEL_1,
1687         .mask = PMX_MCIDATA4_MASK,
1688         .val = PMX_MCIDATA4_MASK,
1689     }, {
1690         .reg = PAD_DIRECTION_SEL_2,
1691         .mask = PMX_MCIDATA5_MASK,
1692         .val = PMX_MCIDATA5_MASK,
1693     },
1694 };
1695 
1696 static struct spear_modemux i2c4_dis_sd_modemux[] = {
1697     {
1698         .muxregs = i2c4_dis_sd_muxreg,
1699         .nmuxregs = ARRAY_SIZE(i2c4_dis_sd_muxreg),
1700     },
1701 };
1702 
1703 static struct spear_pingroup i2c4_dis_sd_pingroup = {
1704     .name = "i2c4_dis_sd_grp",
1705     .pins = i2c4_dis_sd_pins,
1706     .npins = ARRAY_SIZE(i2c4_dis_sd_pins),
1707     .modemuxs = i2c4_dis_sd_modemux,
1708     .nmodemuxs = ARRAY_SIZE(i2c4_dis_sd_modemux),
1709 };
1710 
1711 /* Pad multiplexing for i2c5_dis_sd device */
1712 /* Muxed with SD/MMC */
1713 static const unsigned i2c5_dis_sd_pins[] = { 219, 220 };
1714 static struct spear_muxreg i2c5_dis_sd_muxreg[] = {
1715     {
1716         .reg = PAD_FUNCTION_EN_2,
1717         .mask = PMX_MCIDATA6_MASK |
1718             PMX_MCIDATA7_MASK,
1719         .val = 0,
1720     }, {
1721         .reg = PAD_DIRECTION_SEL_2,
1722         .mask = PMX_MCIDATA6_MASK |
1723             PMX_MCIDATA7_MASK,
1724         .val = PMX_MCIDATA6_MASK |
1725             PMX_MCIDATA7_MASK,
1726     },
1727 };
1728 
1729 static struct spear_modemux i2c5_dis_sd_modemux[] = {
1730     {
1731         .muxregs = i2c5_dis_sd_muxreg,
1732         .nmuxregs = ARRAY_SIZE(i2c5_dis_sd_muxreg),
1733     },
1734 };
1735 
1736 static struct spear_pingroup i2c5_dis_sd_pingroup = {
1737     .name = "i2c5_dis_sd_grp",
1738     .pins = i2c5_dis_sd_pins,
1739     .npins = ARRAY_SIZE(i2c5_dis_sd_pins),
1740     .modemuxs = i2c5_dis_sd_modemux,
1741     .nmodemuxs = ARRAY_SIZE(i2c5_dis_sd_modemux),
1742 };
1743 
1744 static const char *const i2c_4_5_grps[] = { "i2c5_dis_sd_grp",
1745     "i2c4_dis_sd_grp", "i2c_4_5_dis_smi_grp" };
1746 static struct spear_function i2c_4_5_function = {
1747     .name = "i2c_4_5",
1748     .groups = i2c_4_5_grps,
1749     .ngroups = ARRAY_SIZE(i2c_4_5_grps),
1750 };
1751 
1752 /* Pad multiplexing for i2c_6_7_dis_kbd device */
1753 /* Muxed with KBD */
1754 static const unsigned i2c_6_7_dis_kbd_pins[] = { 207, 208, 209, 210 };
1755 static struct spear_muxreg i2c_6_7_dis_kbd_muxreg[] = {
1756     {
1757         .reg = PAD_FUNCTION_EN_1,
1758         .mask = PMX_KBD_ROWCOL25_MASK,
1759         .val = 0,
1760     }, {
1761         .reg = PAD_DIRECTION_SEL_1,
1762         .mask = PMX_KBD_ROWCOL25_MASK,
1763         .val = PMX_KBD_ROWCOL25_MASK,
1764     },
1765 };
1766 
1767 static struct spear_modemux i2c_6_7_dis_kbd_modemux[] = {
1768     {
1769         .muxregs = i2c_6_7_dis_kbd_muxreg,
1770         .nmuxregs = ARRAY_SIZE(i2c_6_7_dis_kbd_muxreg),
1771     },
1772 };
1773 
1774 static struct spear_pingroup i2c_6_7_dis_kbd_pingroup = {
1775     .name = "i2c_6_7_dis_kbd_grp",
1776     .pins = i2c_6_7_dis_kbd_pins,
1777     .npins = ARRAY_SIZE(i2c_6_7_dis_kbd_pins),
1778     .modemuxs = i2c_6_7_dis_kbd_modemux,
1779     .nmodemuxs = ARRAY_SIZE(i2c_6_7_dis_kbd_modemux),
1780 };
1781 
1782 /* Pad multiplexing for i2c6_dis_sd device */
1783 /* Muxed with SD/MMC */
1784 static const unsigned i2c6_dis_sd_pins[] = { 236, 237 };
1785 static struct spear_muxreg i2c6_dis_sd_muxreg[] = {
1786     {
1787         .reg = PAD_FUNCTION_EN_2,
1788         .mask = PMX_MCIIORDRE_MASK |
1789             PMX_MCIIOWRWE_MASK,
1790         .val = 0,
1791     }, {
1792         .reg = PAD_DIRECTION_SEL_2,
1793         .mask = PMX_MCIIORDRE_MASK |
1794             PMX_MCIIOWRWE_MASK,
1795         .val = PMX_MCIIORDRE_MASK |
1796             PMX_MCIIOWRWE_MASK,
1797     },
1798 };
1799 
1800 static struct spear_modemux i2c6_dis_sd_modemux[] = {
1801     {
1802         .muxregs = i2c6_dis_sd_muxreg,
1803         .nmuxregs = ARRAY_SIZE(i2c6_dis_sd_muxreg),
1804     },
1805 };
1806 
1807 static struct spear_pingroup i2c6_dis_sd_pingroup = {
1808     .name = "i2c6_dis_sd_grp",
1809     .pins = i2c6_dis_sd_pins,
1810     .npins = ARRAY_SIZE(i2c6_dis_sd_pins),
1811     .modemuxs = i2c6_dis_sd_modemux,
1812     .nmodemuxs = ARRAY_SIZE(i2c6_dis_sd_modemux),
1813 };
1814 
1815 /* Pad multiplexing for i2c7_dis_sd device */
1816 static const unsigned i2c7_dis_sd_pins[] = { 238, 239 };
1817 static struct spear_muxreg i2c7_dis_sd_muxreg[] = {
1818     {
1819         .reg = PAD_FUNCTION_EN_2,
1820         .mask = PMX_MCIRESETCF_MASK |
1821             PMX_MCICS0CE_MASK,
1822         .val = 0,
1823     }, {
1824         .reg = PAD_DIRECTION_SEL_2,
1825         .mask = PMX_MCIRESETCF_MASK |
1826             PMX_MCICS0CE_MASK,
1827         .val = PMX_MCIRESETCF_MASK |
1828             PMX_MCICS0CE_MASK,
1829     },
1830 };
1831 
1832 static struct spear_modemux i2c7_dis_sd_modemux[] = {
1833     {
1834         .muxregs = i2c7_dis_sd_muxreg,
1835         .nmuxregs = ARRAY_SIZE(i2c7_dis_sd_muxreg),
1836     },
1837 };
1838 
1839 static struct spear_pingroup i2c7_dis_sd_pingroup = {
1840     .name = "i2c7_dis_sd_grp",
1841     .pins = i2c7_dis_sd_pins,
1842     .npins = ARRAY_SIZE(i2c7_dis_sd_pins),
1843     .modemuxs = i2c7_dis_sd_modemux,
1844     .nmodemuxs = ARRAY_SIZE(i2c7_dis_sd_modemux),
1845 };
1846 
1847 static const char *const i2c_6_7_grps[] = { "i2c6_dis_sd_grp",
1848     "i2c7_dis_sd_grp", "i2c_6_7_dis_kbd_grp" };
1849 static struct spear_function i2c_6_7_function = {
1850     .name = "i2c_6_7",
1851     .groups = i2c_6_7_grps,
1852     .ngroups = ARRAY_SIZE(i2c_6_7_grps),
1853 };
1854 
1855 /* Pad multiplexing for can0_dis_nor device */
1856 /* Muxed with NOR */
1857 static const unsigned can0_dis_nor_pins[] = { 56, 57 };
1858 static struct spear_muxreg can0_dis_nor_muxreg[] = {
1859     {
1860         .reg = PAD_FUNCTION_EN_0,
1861         .mask = PMX_NFRSTPWDWN2_MASK,
1862         .val = 0,
1863     }, {
1864         .reg = PAD_FUNCTION_EN_1,
1865         .mask = PMX_NFRSTPWDWN3_MASK,
1866         .val = 0,
1867     }, {
1868         .reg = PAD_DIRECTION_SEL_0,
1869         .mask = PMX_NFRSTPWDWN2_MASK,
1870         .val = PMX_NFRSTPWDWN2_MASK,
1871     }, {
1872         .reg = PAD_DIRECTION_SEL_1,
1873         .mask = PMX_NFRSTPWDWN3_MASK,
1874         .val = PMX_NFRSTPWDWN3_MASK,
1875     },
1876 };
1877 
1878 static struct spear_modemux can0_dis_nor_modemux[] = {
1879     {
1880         .muxregs = can0_dis_nor_muxreg,
1881         .nmuxregs = ARRAY_SIZE(can0_dis_nor_muxreg),
1882     },
1883 };
1884 
1885 static struct spear_pingroup can0_dis_nor_pingroup = {
1886     .name = "can0_dis_nor_grp",
1887     .pins = can0_dis_nor_pins,
1888     .npins = ARRAY_SIZE(can0_dis_nor_pins),
1889     .modemuxs = can0_dis_nor_modemux,
1890     .nmodemuxs = ARRAY_SIZE(can0_dis_nor_modemux),
1891 };
1892 
1893 /* Pad multiplexing for can0_dis_sd device */
1894 /* Muxed with SD/MMC */
1895 static const unsigned can0_dis_sd_pins[] = { 240, 241 };
1896 static struct spear_muxreg can0_dis_sd_muxreg[] = {
1897     {
1898         .reg = PAD_FUNCTION_EN_2,
1899         .mask = PMX_MCICFINTR_MASK | PMX_MCIIORDY_MASK,
1900         .val = 0,
1901     }, {
1902         .reg = PAD_DIRECTION_SEL_2,
1903         .mask = PMX_MCICFINTR_MASK | PMX_MCIIORDY_MASK,
1904         .val = PMX_MCICFINTR_MASK | PMX_MCIIORDY_MASK,
1905     },
1906 };
1907 
1908 static struct spear_modemux can0_dis_sd_modemux[] = {
1909     {
1910         .muxregs = can0_dis_sd_muxreg,
1911         .nmuxregs = ARRAY_SIZE(can0_dis_sd_muxreg),
1912     },
1913 };
1914 
1915 static struct spear_pingroup can0_dis_sd_pingroup = {
1916     .name = "can0_dis_sd_grp",
1917     .pins = can0_dis_sd_pins,
1918     .npins = ARRAY_SIZE(can0_dis_sd_pins),
1919     .modemuxs = can0_dis_sd_modemux,
1920     .nmodemuxs = ARRAY_SIZE(can0_dis_sd_modemux),
1921 };
1922 
1923 static const char *const can0_grps[] = { "can0_dis_nor_grp", "can0_dis_sd_grp"
1924 };
1925 static struct spear_function can0_function = {
1926     .name = "can0",
1927     .groups = can0_grps,
1928     .ngroups = ARRAY_SIZE(can0_grps),
1929 };
1930 
1931 /* Pad multiplexing for can1_dis_sd device */
1932 /* Muxed with SD/MMC */
1933 static const unsigned can1_dis_sd_pins[] = { 242, 243 };
1934 static struct spear_muxreg can1_dis_sd_muxreg[] = {
1935     {
1936         .reg = PAD_FUNCTION_EN_2,
1937         .mask = PMX_MCICS1_MASK | PMX_MCIDMAACK_MASK,
1938         .val = 0,
1939     }, {
1940         .reg = PAD_DIRECTION_SEL_2,
1941         .mask = PMX_MCICS1_MASK | PMX_MCIDMAACK_MASK,
1942         .val = PMX_MCICS1_MASK | PMX_MCIDMAACK_MASK,
1943     },
1944 };
1945 
1946 static struct spear_modemux can1_dis_sd_modemux[] = {
1947     {
1948         .muxregs = can1_dis_sd_muxreg,
1949         .nmuxregs = ARRAY_SIZE(can1_dis_sd_muxreg),
1950     },
1951 };
1952 
1953 static struct spear_pingroup can1_dis_sd_pingroup = {
1954     .name = "can1_dis_sd_grp",
1955     .pins = can1_dis_sd_pins,
1956     .npins = ARRAY_SIZE(can1_dis_sd_pins),
1957     .modemuxs = can1_dis_sd_modemux,
1958     .nmodemuxs = ARRAY_SIZE(can1_dis_sd_modemux),
1959 };
1960 
1961 /* Pad multiplexing for can1_dis_kbd device */
1962 /* Muxed with KBD */
1963 static const unsigned can1_dis_kbd_pins[] = { 201, 202 };
1964 static struct spear_muxreg can1_dis_kbd_muxreg[] = {
1965     {
1966         .reg = PAD_FUNCTION_EN_1,
1967         .mask = PMX_KBD_ROWCOL25_MASK,
1968         .val = 0,
1969     }, {
1970         .reg = PAD_DIRECTION_SEL_1,
1971         .mask = PMX_KBD_ROWCOL25_MASK,
1972         .val = PMX_KBD_ROWCOL25_MASK,
1973     },
1974 };
1975 
1976 static struct spear_modemux can1_dis_kbd_modemux[] = {
1977     {
1978         .muxregs = can1_dis_kbd_muxreg,
1979         .nmuxregs = ARRAY_SIZE(can1_dis_kbd_muxreg),
1980     },
1981 };
1982 
1983 static struct spear_pingroup can1_dis_kbd_pingroup = {
1984     .name = "can1_dis_kbd_grp",
1985     .pins = can1_dis_kbd_pins,
1986     .npins = ARRAY_SIZE(can1_dis_kbd_pins),
1987     .modemuxs = can1_dis_kbd_modemux,
1988     .nmodemuxs = ARRAY_SIZE(can1_dis_kbd_modemux),
1989 };
1990 
1991 static const char *const can1_grps[] = { "can1_dis_sd_grp", "can1_dis_kbd_grp"
1992 };
1993 static struct spear_function can1_function = {
1994     .name = "can1",
1995     .groups = can1_grps,
1996     .ngroups = ARRAY_SIZE(can1_grps),
1997 };
1998 
1999 /* Pad multiplexing for (ras-ip) pci device */
2000 static const unsigned pci_pins[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 18,
2001     19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
2002     37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
2003     55, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 };
2004 
2005 static struct spear_muxreg pci_muxreg[] = {
2006     {
2007         .reg = PAD_FUNCTION_EN_0,
2008         .mask = PMX_MCI_DATA8_15_MASK,
2009         .val = 0,
2010     }, {
2011         .reg = PAD_FUNCTION_EN_1,
2012         .mask = PMX_PCI_REG1_MASK,
2013         .val = 0,
2014     }, {
2015         .reg = PAD_FUNCTION_EN_2,
2016         .mask = PMX_PCI_REG2_MASK,
2017         .val = 0,
2018     }, {
2019         .reg = PAD_DIRECTION_SEL_0,
2020         .mask = PMX_MCI_DATA8_15_MASK,
2021         .val = PMX_MCI_DATA8_15_MASK,
2022     }, {
2023         .reg = PAD_DIRECTION_SEL_1,
2024         .mask = PMX_PCI_REG1_MASK,
2025         .val = PMX_PCI_REG1_MASK,
2026     }, {
2027         .reg = PAD_DIRECTION_SEL_2,
2028         .mask = PMX_PCI_REG2_MASK,
2029         .val = PMX_PCI_REG2_MASK,
2030     },
2031 };
2032 
2033 static struct spear_modemux pci_modemux[] = {
2034     {
2035         .muxregs = pci_muxreg,
2036         .nmuxregs = ARRAY_SIZE(pci_muxreg),
2037     },
2038 };
2039 
2040 static struct spear_pingroup pci_pingroup = {
2041     .name = "pci_grp",
2042     .pins = pci_pins,
2043     .npins = ARRAY_SIZE(pci_pins),
2044     .modemuxs = pci_modemux,
2045     .nmodemuxs = ARRAY_SIZE(pci_modemux),
2046 };
2047 
2048 static const char *const pci_grps[] = { "pci_grp" };
2049 static struct spear_function pci_function = {
2050     .name = "pci",
2051     .groups = pci_grps,
2052     .ngroups = ARRAY_SIZE(pci_grps),
2053 };
2054 
2055 /* pad multiplexing for (fix-part) pcie0 device */
2056 static struct spear_muxreg pcie0_muxreg[] = {
2057     {
2058         .reg = PCIE_SATA_CFG,
2059         .mask = PCIE_CFG_VAL(0),
2060         .val = PCIE_CFG_VAL(0),
2061     },
2062 };
2063 
2064 static struct spear_modemux pcie0_modemux[] = {
2065     {
2066         .muxregs = pcie0_muxreg,
2067         .nmuxregs = ARRAY_SIZE(pcie0_muxreg),
2068     },
2069 };
2070 
2071 static struct spear_pingroup pcie0_pingroup = {
2072     .name = "pcie0_grp",
2073     .modemuxs = pcie0_modemux,
2074     .nmodemuxs = ARRAY_SIZE(pcie0_modemux),
2075 };
2076 
2077 /* pad multiplexing for (fix-part) pcie1 device */
2078 static struct spear_muxreg pcie1_muxreg[] = {
2079     {
2080         .reg = PCIE_SATA_CFG,
2081         .mask = PCIE_CFG_VAL(1),
2082         .val = PCIE_CFG_VAL(1),
2083     },
2084 };
2085 
2086 static struct spear_modemux pcie1_modemux[] = {
2087     {
2088         .muxregs = pcie1_muxreg,
2089         .nmuxregs = ARRAY_SIZE(pcie1_muxreg),
2090     },
2091 };
2092 
2093 static struct spear_pingroup pcie1_pingroup = {
2094     .name = "pcie1_grp",
2095     .modemuxs = pcie1_modemux,
2096     .nmodemuxs = ARRAY_SIZE(pcie1_modemux),
2097 };
2098 
2099 /* pad multiplexing for (fix-part) pcie2 device */
2100 static struct spear_muxreg pcie2_muxreg[] = {
2101     {
2102         .reg = PCIE_SATA_CFG,
2103         .mask = PCIE_CFG_VAL(2),
2104         .val = PCIE_CFG_VAL(2),
2105     },
2106 };
2107 
2108 static struct spear_modemux pcie2_modemux[] = {
2109     {
2110         .muxregs = pcie2_muxreg,
2111         .nmuxregs = ARRAY_SIZE(pcie2_muxreg),
2112     },
2113 };
2114 
2115 static struct spear_pingroup pcie2_pingroup = {
2116     .name = "pcie2_grp",
2117     .modemuxs = pcie2_modemux,
2118     .nmodemuxs = ARRAY_SIZE(pcie2_modemux),
2119 };
2120 
2121 static const char *const pcie_grps[] = { "pcie0_grp", "pcie1_grp", "pcie2_grp"
2122 };
2123 static struct spear_function pcie_function = {
2124     .name = "pci_express",
2125     .groups = pcie_grps,
2126     .ngroups = ARRAY_SIZE(pcie_grps),
2127 };
2128 
2129 /* pad multiplexing for sata0 device */
2130 static struct spear_muxreg sata0_muxreg[] = {
2131     {
2132         .reg = PCIE_SATA_CFG,
2133         .mask = SATA_CFG_VAL(0),
2134         .val = SATA_CFG_VAL(0),
2135     },
2136 };
2137 
2138 static struct spear_modemux sata0_modemux[] = {
2139     {
2140         .muxregs = sata0_muxreg,
2141         .nmuxregs = ARRAY_SIZE(sata0_muxreg),
2142     },
2143 };
2144 
2145 static struct spear_pingroup sata0_pingroup = {
2146     .name = "sata0_grp",
2147     .modemuxs = sata0_modemux,
2148     .nmodemuxs = ARRAY_SIZE(sata0_modemux),
2149 };
2150 
2151 /* pad multiplexing for sata1 device */
2152 static struct spear_muxreg sata1_muxreg[] = {
2153     {
2154         .reg = PCIE_SATA_CFG,
2155         .mask = SATA_CFG_VAL(1),
2156         .val = SATA_CFG_VAL(1),
2157     },
2158 };
2159 
2160 static struct spear_modemux sata1_modemux[] = {
2161     {
2162         .muxregs = sata1_muxreg,
2163         .nmuxregs = ARRAY_SIZE(sata1_muxreg),
2164     },
2165 };
2166 
2167 static struct spear_pingroup sata1_pingroup = {
2168     .name = "sata1_grp",
2169     .modemuxs = sata1_modemux,
2170     .nmodemuxs = ARRAY_SIZE(sata1_modemux),
2171 };
2172 
2173 /* pad multiplexing for sata2 device */
2174 static struct spear_muxreg sata2_muxreg[] = {
2175     {
2176         .reg = PCIE_SATA_CFG,
2177         .mask = SATA_CFG_VAL(2),
2178         .val = SATA_CFG_VAL(2),
2179     },
2180 };
2181 
2182 static struct spear_modemux sata2_modemux[] = {
2183     {
2184         .muxregs = sata2_muxreg,
2185         .nmuxregs = ARRAY_SIZE(sata2_muxreg),
2186     },
2187 };
2188 
2189 static struct spear_pingroup sata2_pingroup = {
2190     .name = "sata2_grp",
2191     .modemuxs = sata2_modemux,
2192     .nmodemuxs = ARRAY_SIZE(sata2_modemux),
2193 };
2194 
2195 static const char *const sata_grps[] = { "sata0_grp", "sata1_grp", "sata2_grp"
2196 };
2197 static struct spear_function sata_function = {
2198     .name = "sata",
2199     .groups = sata_grps,
2200     .ngroups = ARRAY_SIZE(sata_grps),
2201 };
2202 
2203 /* Pad multiplexing for ssp1_dis_kbd device */
2204 static const unsigned ssp1_dis_kbd_pins[] = { 203, 204, 205, 206 };
2205 static struct spear_muxreg ssp1_dis_kbd_muxreg[] = {
2206     {
2207         .reg = PAD_FUNCTION_EN_1,
2208         .mask = PMX_KBD_ROWCOL25_MASK | PMX_KBD_COL1_MASK |
2209             PMX_KBD_COL0_MASK | PMX_NFIO8_15_MASK | PMX_NFCE1_MASK |
2210             PMX_NFCE2_MASK,
2211         .val = 0,
2212     }, {
2213         .reg = PAD_DIRECTION_SEL_1,
2214         .mask = PMX_KBD_ROWCOL25_MASK | PMX_KBD_COL1_MASK |
2215             PMX_KBD_COL0_MASK | PMX_NFIO8_15_MASK | PMX_NFCE1_MASK |
2216             PMX_NFCE2_MASK,
2217         .val = PMX_KBD_ROWCOL25_MASK | PMX_KBD_COL1_MASK |
2218             PMX_KBD_COL0_MASK | PMX_NFIO8_15_MASK | PMX_NFCE1_MASK |
2219             PMX_NFCE2_MASK,
2220     },
2221 };
2222 
2223 static struct spear_modemux ssp1_dis_kbd_modemux[] = {
2224     {
2225         .muxregs = ssp1_dis_kbd_muxreg,
2226         .nmuxregs = ARRAY_SIZE(ssp1_dis_kbd_muxreg),
2227     },
2228 };
2229 
2230 static struct spear_pingroup ssp1_dis_kbd_pingroup = {
2231     .name = "ssp1_dis_kbd_grp",
2232     .pins = ssp1_dis_kbd_pins,
2233     .npins = ARRAY_SIZE(ssp1_dis_kbd_pins),
2234     .modemuxs = ssp1_dis_kbd_modemux,
2235     .nmodemuxs = ARRAY_SIZE(ssp1_dis_kbd_modemux),
2236 };
2237 
2238 /* Pad multiplexing for ssp1_dis_sd device */
2239 static const unsigned ssp1_dis_sd_pins[] = { 224, 226, 227, 228 };
2240 static struct spear_muxreg ssp1_dis_sd_muxreg[] = {
2241     {
2242         .reg = PAD_FUNCTION_EN_2,
2243         .mask = PMX_MCIADDR0ALE_MASK | PMX_MCIADDR2_MASK |
2244             PMX_MCICECF_MASK | PMX_MCICEXD_MASK,
2245         .val = 0,
2246     }, {
2247         .reg = PAD_DIRECTION_SEL_2,
2248         .mask = PMX_MCIADDR0ALE_MASK | PMX_MCIADDR2_MASK |
2249             PMX_MCICECF_MASK | PMX_MCICEXD_MASK,
2250         .val = PMX_MCIADDR0ALE_MASK | PMX_MCIADDR2_MASK |
2251             PMX_MCICECF_MASK | PMX_MCICEXD_MASK,
2252     },
2253 };
2254 
2255 static struct spear_modemux ssp1_dis_sd_modemux[] = {
2256     {
2257         .muxregs = ssp1_dis_sd_muxreg,
2258         .nmuxregs = ARRAY_SIZE(ssp1_dis_sd_muxreg),
2259     },
2260 };
2261 
2262 static struct spear_pingroup ssp1_dis_sd_pingroup = {
2263     .name = "ssp1_dis_sd_grp",
2264     .pins = ssp1_dis_sd_pins,
2265     .npins = ARRAY_SIZE(ssp1_dis_sd_pins),
2266     .modemuxs = ssp1_dis_sd_modemux,
2267     .nmodemuxs = ARRAY_SIZE(ssp1_dis_sd_modemux),
2268 };
2269 
2270 static const char *const ssp1_grps[] = { "ssp1_dis_kbd_grp",
2271     "ssp1_dis_sd_grp" };
2272 static struct spear_function ssp1_function = {
2273     .name = "ssp1",
2274     .groups = ssp1_grps,
2275     .ngroups = ARRAY_SIZE(ssp1_grps),
2276 };
2277 
2278 /* Pad multiplexing for gpt64 device */
2279 static const unsigned gpt64_pins[] = { 230, 231, 232, 245 };
2280 static struct spear_muxreg gpt64_muxreg[] = {
2281     {
2282         .reg = PAD_FUNCTION_EN_2,
2283         .mask = PMX_MCICDCF1_MASK | PMX_MCICDCF2_MASK | PMX_MCICDXD_MASK
2284             | PMX_MCILEDS_MASK,
2285         .val = 0,
2286     }, {
2287         .reg = PAD_DIRECTION_SEL_2,
2288         .mask = PMX_MCICDCF1_MASK | PMX_MCICDCF2_MASK | PMX_MCICDXD_MASK
2289             | PMX_MCILEDS_MASK,
2290         .val = PMX_MCICDCF1_MASK | PMX_MCICDCF2_MASK | PMX_MCICDXD_MASK
2291             | PMX_MCILEDS_MASK,
2292     },
2293 };
2294 
2295 static struct spear_modemux gpt64_modemux[] = {
2296     {
2297         .muxregs = gpt64_muxreg,
2298         .nmuxregs = ARRAY_SIZE(gpt64_muxreg),
2299     },
2300 };
2301 
2302 static struct spear_pingroup gpt64_pingroup = {
2303     .name = "gpt64_grp",
2304     .pins = gpt64_pins,
2305     .npins = ARRAY_SIZE(gpt64_pins),
2306     .modemuxs = gpt64_modemux,
2307     .nmodemuxs = ARRAY_SIZE(gpt64_modemux),
2308 };
2309 
2310 static const char *const gpt64_grps[] = { "gpt64_grp" };
2311 static struct spear_function gpt64_function = {
2312     .name = "gpt64",
2313     .groups = gpt64_grps,
2314     .ngroups = ARRAY_SIZE(gpt64_grps),
2315 };
2316 
2317 /* pingroups */
2318 static struct spear_pingroup *spear1310_pingroups[] = {
2319     &i2c0_pingroup,
2320     &ssp0_pingroup,
2321     &i2s0_pingroup,
2322     &i2s1_pingroup,
2323     &clcd_pingroup,
2324     &clcd_high_res_pingroup,
2325     &arm_gpio_pingroup,
2326     &smi_2_chips_pingroup,
2327     &smi_4_chips_pingroup,
2328     &gmii_pingroup,
2329     &rgmii_pingroup,
2330     &smii_0_1_2_pingroup,
2331     &ras_mii_txclk_pingroup,
2332     &nand_8bit_pingroup,
2333     &nand_16bit_pingroup,
2334     &nand_4_chips_pingroup,
2335     &keyboard_6x6_pingroup,
2336     &keyboard_rowcol6_8_pingroup,
2337     &uart0_pingroup,
2338     &uart0_modem_pingroup,
2339     &gpt0_tmr0_pingroup,
2340     &gpt0_tmr1_pingroup,
2341     &gpt1_tmr0_pingroup,
2342     &gpt1_tmr1_pingroup,
2343     &sdhci_pingroup,
2344     &cf_pingroup,
2345     &xd_pingroup,
2346     &touch_xy_pingroup,
2347     &ssp0_cs0_pingroup,
2348     &ssp0_cs1_2_pingroup,
2349     &uart_1_dis_i2c_pingroup,
2350     &uart_1_dis_sd_pingroup,
2351     &uart_2_3_pingroup,
2352     &uart_4_pingroup,
2353     &uart_5_pingroup,
2354     &rs485_0_1_tdm_0_1_pingroup,
2355     &i2c_1_2_pingroup,
2356     &i2c3_dis_smi_clcd_pingroup,
2357     &i2c3_dis_sd_i2s0_pingroup,
2358     &i2c_4_5_dis_smi_pingroup,
2359     &i2c4_dis_sd_pingroup,
2360     &i2c5_dis_sd_pingroup,
2361     &i2c_6_7_dis_kbd_pingroup,
2362     &i2c6_dis_sd_pingroup,
2363     &i2c7_dis_sd_pingroup,
2364     &can0_dis_nor_pingroup,
2365     &can0_dis_sd_pingroup,
2366     &can1_dis_sd_pingroup,
2367     &can1_dis_kbd_pingroup,
2368     &pci_pingroup,
2369     &pcie0_pingroup,
2370     &pcie1_pingroup,
2371     &pcie2_pingroup,
2372     &sata0_pingroup,
2373     &sata1_pingroup,
2374     &sata2_pingroup,
2375     &ssp1_dis_kbd_pingroup,
2376     &ssp1_dis_sd_pingroup,
2377     &gpt64_pingroup,
2378 };
2379 
2380 /* functions */
2381 static struct spear_function *spear1310_functions[] = {
2382     &i2c0_function,
2383     &ssp0_function,
2384     &i2s0_function,
2385     &i2s1_function,
2386     &clcd_function,
2387     &arm_gpio_function,
2388     &smi_function,
2389     &gmii_function,
2390     &rgmii_function,
2391     &smii_0_1_2_function,
2392     &ras_mii_txclk_function,
2393     &nand_function,
2394     &keyboard_function,
2395     &uart0_function,
2396     &gpt0_function,
2397     &gpt1_function,
2398     &sdhci_function,
2399     &cf_function,
2400     &xd_function,
2401     &touch_xy_function,
2402     &uart1_function,
2403     &uart2_3_function,
2404     &uart4_function,
2405     &uart5_function,
2406     &rs485_0_1_tdm_0_1_function,
2407     &i2c_1_2_function,
2408     &i2c3_unction,
2409     &i2c_4_5_function,
2410     &i2c_6_7_function,
2411     &can0_function,
2412     &can1_function,
2413     &pci_function,
2414     &pcie_function,
2415     &sata_function,
2416     &ssp1_function,
2417     &gpt64_function,
2418 };
2419 
2420 static const unsigned pin18[] = { 18, };
2421 static const unsigned pin19[] = { 19, };
2422 static const unsigned pin20[] = { 20, };
2423 static const unsigned pin21[] = { 21, };
2424 static const unsigned pin22[] = { 22, };
2425 static const unsigned pin23[] = { 23, };
2426 static const unsigned pin54[] = { 54, };
2427 static const unsigned pin55[] = { 55, };
2428 static const unsigned pin56[] = { 56, };
2429 static const unsigned pin57[] = { 57, };
2430 static const unsigned pin58[] = { 58, };
2431 static const unsigned pin59[] = { 59, };
2432 static const unsigned pin60[] = { 60, };
2433 static const unsigned pin61[] = { 61, };
2434 static const unsigned pin62[] = { 62, };
2435 static const unsigned pin63[] = { 63, };
2436 static const unsigned pin143[] = { 143, };
2437 static const unsigned pin144[] = { 144, };
2438 static const unsigned pin145[] = { 145, };
2439 static const unsigned pin146[] = { 146, };
2440 static const unsigned pin147[] = { 147, };
2441 static const unsigned pin148[] = { 148, };
2442 static const unsigned pin149[] = { 149, };
2443 static const unsigned pin150[] = { 150, };
2444 static const unsigned pin151[] = { 151, };
2445 static const unsigned pin152[] = { 152, };
2446 static const unsigned pin205[] = { 205, };
2447 static const unsigned pin206[] = { 206, };
2448 static const unsigned pin211[] = { 211, };
2449 static const unsigned pin212[] = { 212, };
2450 static const unsigned pin213[] = { 213, };
2451 static const unsigned pin214[] = { 214, };
2452 static const unsigned pin215[] = { 215, };
2453 static const unsigned pin216[] = { 216, };
2454 static const unsigned pin217[] = { 217, };
2455 static const unsigned pin218[] = { 218, };
2456 static const unsigned pin219[] = { 219, };
2457 static const unsigned pin220[] = { 220, };
2458 static const unsigned pin221[] = { 221, };
2459 static const unsigned pin222[] = { 222, };
2460 static const unsigned pin223[] = { 223, };
2461 static const unsigned pin224[] = { 224, };
2462 static const unsigned pin225[] = { 225, };
2463 static const unsigned pin226[] = { 226, };
2464 static const unsigned pin227[] = { 227, };
2465 static const unsigned pin228[] = { 228, };
2466 static const unsigned pin229[] = { 229, };
2467 static const unsigned pin230[] = { 230, };
2468 static const unsigned pin231[] = { 231, };
2469 static const unsigned pin232[] = { 232, };
2470 static const unsigned pin233[] = { 233, };
2471 static const unsigned pin234[] = { 234, };
2472 static const unsigned pin235[] = { 235, };
2473 static const unsigned pin236[] = { 236, };
2474 static const unsigned pin237[] = { 237, };
2475 static const unsigned pin238[] = { 238, };
2476 static const unsigned pin239[] = { 239, };
2477 static const unsigned pin240[] = { 240, };
2478 static const unsigned pin241[] = { 241, };
2479 static const unsigned pin242[] = { 242, };
2480 static const unsigned pin243[] = { 243, };
2481 static const unsigned pin244[] = { 244, };
2482 static const unsigned pin245[] = { 245, };
2483 
2484 static const unsigned pin_grp0[] = { 173, 174, };
2485 static const unsigned pin_grp1[] = { 175, 185, 188, 197, 198, };
2486 static const unsigned pin_grp2[] = { 176, 177, 178, 179, 184, 186, 187, 189,
2487     190, 191, 192, };
2488 static const unsigned pin_grp3[] = { 180, 181, 182, 183, 193, 194, 195, 196, };
2489 static const unsigned pin_grp4[] = { 199, 200, };
2490 static const unsigned pin_grp5[] = { 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
2491     75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, };
2492 static const unsigned pin_grp6[] = { 86, 87, 88, 89, 90, 91, 92, 93, };
2493 static const unsigned pin_grp7[] = { 98, 99, };
2494 static const unsigned pin_grp8[] = { 158, 159, 160, 161, 162, 163, 164, 165,
2495     166, 167, 168, 169, 170, 171, 172, };
2496 
2497 /* Define muxreg arrays */
2498 DEFINE_2_MUXREG(i2c0_pins, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_I2C0_MASK, 0, 1);
2499 DEFINE_2_MUXREG(ssp0_pins, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_SSP0_MASK, 0, 1);
2500 DEFINE_2_MUXREG(ssp0_cs0_pins, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_SSP0_CS0_MASK, 0, 1);
2501 DEFINE_2_MUXREG(ssp0_cs1_2_pins, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_SSP0_CS1_2_MASK, 0, 1);
2502 DEFINE_2_MUXREG(i2s0_pins, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_I2S0_MASK, 0, 1);
2503 DEFINE_2_MUXREG(i2s1_pins, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_I2S1_MASK, 0, 1);
2504 DEFINE_2_MUXREG(clcd_pins, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_CLCD1_MASK, 0, 1);
2505 DEFINE_2_MUXREG(clcd_high_res_pins, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_CLCD2_MASK, 0, 1);
2506 DEFINE_2_MUXREG(pin18, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO15_MASK, 0, 1);
2507 DEFINE_2_MUXREG(pin19, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO14_MASK, 0, 1);
2508 DEFINE_2_MUXREG(pin20, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO13_MASK, 0, 1);
2509 DEFINE_2_MUXREG(pin21, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO12_MASK, 0, 1);
2510 DEFINE_2_MUXREG(pin22, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO11_MASK, 0, 1);
2511 DEFINE_2_MUXREG(pin23, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO10_MASK, 0, 1);
2512 DEFINE_2_MUXREG(pin143, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO00_MASK, 0, 1);
2513 DEFINE_2_MUXREG(pin144, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO01_MASK, 0, 1);
2514 DEFINE_2_MUXREG(pin145, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO02_MASK, 0, 1);
2515 DEFINE_2_MUXREG(pin146, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO03_MASK, 0, 1);
2516 DEFINE_2_MUXREG(pin147, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO04_MASK, 0, 1);
2517 DEFINE_2_MUXREG(pin148, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO05_MASK, 0, 1);
2518 DEFINE_2_MUXREG(pin149, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO06_MASK, 0, 1);
2519 DEFINE_2_MUXREG(pin150, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO07_MASK, 0, 1);
2520 DEFINE_2_MUXREG(pin151, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO08_MASK, 0, 1);
2521 DEFINE_2_MUXREG(pin152, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO09_MASK, 0, 1);
2522 DEFINE_2_MUXREG(smi_2_chips_pins, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_SMI_MASK, 0, 1);
2523 DEFINE_2_MUXREG(pin54, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_SMINCS3_MASK, 0, 1);
2524 DEFINE_2_MUXREG(pin55, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_SMINCS2_MASK, 0, 1);
2525 DEFINE_2_MUXREG(pin56, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_NFRSTPWDWN3_MASK, 0, 1);
2526 DEFINE_2_MUXREG(pin57, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_NFRSTPWDWN2_MASK, 0, 1);
2527 DEFINE_2_MUXREG(pin58, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_NFRSTPWDWN1_MASK, 0, 1);
2528 DEFINE_2_MUXREG(pin59, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_NFRSTPWDWN0_MASK, 0, 1);
2529 DEFINE_2_MUXREG(pin60, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_NFWPRT3_MASK, 0, 1);
2530 DEFINE_2_MUXREG(pin61, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_NFCE3_MASK, 0, 1);
2531 DEFINE_2_MUXREG(pin62, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_NFAD25_MASK, 0, 1);
2532 DEFINE_2_MUXREG(pin63, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_NFAD24_MASK, 0, 1);
2533 DEFINE_2_MUXREG(pin_grp0, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_GMIICLK_MASK, 0, 1);
2534 DEFINE_2_MUXREG(pin_grp1, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_GMIICOL_CRS_XFERER_MIITXCLK_MASK, 0, 1);
2535 DEFINE_2_MUXREG(pin_grp2, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_RXCLK_RDV_TXEN_D03_MASK, 0, 1);
2536 DEFINE_2_MUXREG(pin_grp3, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_GMIID47_MASK, 0, 1);
2537 DEFINE_2_MUXREG(pin_grp4, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_MDC_MDIO_MASK, 0, 1);
2538 DEFINE_2_MUXREG(pin_grp5, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_NFAD23_MASK, 0, 1);
2539 DEFINE_2_MUXREG(pin_grp6, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_MCI_DATA8_15_MASK, 0, 1);
2540 DEFINE_2_MUXREG(pin_grp7, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_NFCE2_MASK, 0, 1);
2541 DEFINE_2_MUXREG(pin_grp8, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_NAND8_MASK, 0, 1);
2542 DEFINE_2_MUXREG(nand_16bit_pins, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_NAND16BIT_1_MASK, 0, 1);
2543 DEFINE_2_MUXREG(pin205, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_KBD_COL1_MASK | PMX_NFCE1_MASK, 0, 1);
2544 DEFINE_2_MUXREG(pin206, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_KBD_COL0_MASK | PMX_NFCE2_MASK, 0, 1);
2545 DEFINE_2_MUXREG(pin211, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_KBD_ROW1_MASK | PMX_NFWPRT1_MASK, 0, 1);
2546 DEFINE_2_MUXREG(pin212, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_KBD_ROW0_MASK | PMX_NFWPRT2_MASK, 0, 1);
2547 DEFINE_2_MUXREG(pin213, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_MCIDATA0_MASK, 0, 1);
2548 DEFINE_2_MUXREG(pin214, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_MCIDATA1_MASK, 0, 1);
2549 DEFINE_2_MUXREG(pin215, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_MCIDATA2_MASK, 0, 1);
2550 DEFINE_2_MUXREG(pin216, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_MCIDATA3_MASK, 0, 1);
2551 DEFINE_2_MUXREG(pin217, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_MCIDATA4_MASK, 0, 1);
2552 DEFINE_2_MUXREG(pin218, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIDATA5_MASK, 0, 1);
2553 DEFINE_2_MUXREG(pin219, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIDATA6_MASK, 0, 1);
2554 DEFINE_2_MUXREG(pin220, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIDATA7_MASK, 0, 1);
2555 DEFINE_2_MUXREG(pin221, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIDATA1SD_MASK, 0, 1);
2556 DEFINE_2_MUXREG(pin222, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIDATA2SD_MASK, 0, 1);
2557 DEFINE_2_MUXREG(pin223, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIDATA3SD_MASK, 0, 1);
2558 DEFINE_2_MUXREG(pin224, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIADDR0ALE_MASK, 0, 1);
2559 DEFINE_2_MUXREG(pin225, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIADDR1CLECLK_MASK, 0, 1);
2560 DEFINE_2_MUXREG(pin226, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIADDR2_MASK, 0, 1);
2561 DEFINE_2_MUXREG(pin227, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCICECF_MASK, 0, 1);
2562 DEFINE_2_MUXREG(pin228, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCICEXD_MASK, 0, 1);
2563 DEFINE_2_MUXREG(pin229, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCICESDMMC_MASK, 0, 1);
2564 DEFINE_2_MUXREG(pin230, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCICDCF1_MASK, 0, 1);
2565 DEFINE_2_MUXREG(pin231, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCICDCF2_MASK, 0, 1);
2566 DEFINE_2_MUXREG(pin232, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCICDXD_MASK, 0, 1);
2567 DEFINE_2_MUXREG(pin233, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCICDSDMMC_MASK, 0, 1);
2568 DEFINE_2_MUXREG(pin234, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIDATADIR_MASK, 0, 1);
2569 DEFINE_2_MUXREG(pin235, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIDMARQWP_MASK, 0, 1);
2570 DEFINE_2_MUXREG(pin236, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIIORDRE_MASK, 0, 1);
2571 DEFINE_2_MUXREG(pin237, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIIOWRWE_MASK, 0, 1);
2572 DEFINE_2_MUXREG(pin238, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIRESETCF_MASK, 0, 1);
2573 DEFINE_2_MUXREG(pin239, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCICS0CE_MASK, 0, 1);
2574 DEFINE_2_MUXREG(pin240, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCICFINTR_MASK, 0, 1);
2575 DEFINE_2_MUXREG(pin241, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIIORDY_MASK, 0, 1);
2576 DEFINE_2_MUXREG(pin242, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCICS1_MASK, 0, 1);
2577 DEFINE_2_MUXREG(pin243, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIDMAACK_MASK, 0, 1);
2578 DEFINE_2_MUXREG(pin244, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCISDCMD_MASK, 0, 1);
2579 DEFINE_2_MUXREG(pin245, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCILEDS_MASK, 0, 1);
2580 DEFINE_2_MUXREG(keyboard_rowcol6_8_pins, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_KBD_ROWCOL68_MASK, 0, 1);
2581 DEFINE_2_MUXREG(uart0_pins, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_UART0_MASK, 0, 1);
2582 DEFINE_2_MUXREG(uart0_modem_pins, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_UART0_MODEM_MASK, 0, 1);
2583 DEFINE_2_MUXREG(gpt0_tmr0_pins, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_GPT0_TMR0_MASK, 0, 1);
2584 DEFINE_2_MUXREG(gpt0_tmr1_pins, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_GPT0_TMR1_MASK, 0, 1);
2585 DEFINE_2_MUXREG(gpt1_tmr0_pins, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_GPT1_TMR0_MASK, 0, 1);
2586 DEFINE_2_MUXREG(gpt1_tmr1_pins, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_GPT1_TMR1_MASK, 0, 1);
2587 DEFINE_2_MUXREG(touch_xy_pins, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_TOUCH_XY_MASK, 0, 1);
2588 
2589 static struct spear_gpio_pingroup spear1310_gpio_pingroup[] = {
2590     GPIO_PINGROUP(i2c0_pins),
2591     GPIO_PINGROUP(ssp0_pins),
2592     GPIO_PINGROUP(ssp0_cs0_pins),
2593     GPIO_PINGROUP(ssp0_cs1_2_pins),
2594     GPIO_PINGROUP(i2s0_pins),
2595     GPIO_PINGROUP(i2s1_pins),
2596     GPIO_PINGROUP(clcd_pins),
2597     GPIO_PINGROUP(clcd_high_res_pins),
2598     GPIO_PINGROUP(pin18),
2599     GPIO_PINGROUP(pin19),
2600     GPIO_PINGROUP(pin20),
2601     GPIO_PINGROUP(pin21),
2602     GPIO_PINGROUP(pin22),
2603     GPIO_PINGROUP(pin23),
2604     GPIO_PINGROUP(pin143),
2605     GPIO_PINGROUP(pin144),
2606     GPIO_PINGROUP(pin145),
2607     GPIO_PINGROUP(pin146),
2608     GPIO_PINGROUP(pin147),
2609     GPIO_PINGROUP(pin148),
2610     GPIO_PINGROUP(pin149),
2611     GPIO_PINGROUP(pin150),
2612     GPIO_PINGROUP(pin151),
2613     GPIO_PINGROUP(pin152),
2614     GPIO_PINGROUP(smi_2_chips_pins),
2615     GPIO_PINGROUP(pin54),
2616     GPIO_PINGROUP(pin55),
2617     GPIO_PINGROUP(pin56),
2618     GPIO_PINGROUP(pin57),
2619     GPIO_PINGROUP(pin58),
2620     GPIO_PINGROUP(pin59),
2621     GPIO_PINGROUP(pin60),
2622     GPIO_PINGROUP(pin61),
2623     GPIO_PINGROUP(pin62),
2624     GPIO_PINGROUP(pin63),
2625     GPIO_PINGROUP(pin_grp0),
2626     GPIO_PINGROUP(pin_grp1),
2627     GPIO_PINGROUP(pin_grp2),
2628     GPIO_PINGROUP(pin_grp3),
2629     GPIO_PINGROUP(pin_grp4),
2630     GPIO_PINGROUP(pin_grp5),
2631     GPIO_PINGROUP(pin_grp6),
2632     GPIO_PINGROUP(pin_grp7),
2633     GPIO_PINGROUP(pin_grp8),
2634     GPIO_PINGROUP(nand_16bit_pins),
2635     GPIO_PINGROUP(pin205),
2636     GPIO_PINGROUP(pin206),
2637     GPIO_PINGROUP(pin211),
2638     GPIO_PINGROUP(pin212),
2639     GPIO_PINGROUP(pin213),
2640     GPIO_PINGROUP(pin214),
2641     GPIO_PINGROUP(pin215),
2642     GPIO_PINGROUP(pin216),
2643     GPIO_PINGROUP(pin217),
2644     GPIO_PINGROUP(pin218),
2645     GPIO_PINGROUP(pin219),
2646     GPIO_PINGROUP(pin220),
2647     GPIO_PINGROUP(pin221),
2648     GPIO_PINGROUP(pin222),
2649     GPIO_PINGROUP(pin223),
2650     GPIO_PINGROUP(pin224),
2651     GPIO_PINGROUP(pin225),
2652     GPIO_PINGROUP(pin226),
2653     GPIO_PINGROUP(pin227),
2654     GPIO_PINGROUP(pin228),
2655     GPIO_PINGROUP(pin229),
2656     GPIO_PINGROUP(pin230),
2657     GPIO_PINGROUP(pin231),
2658     GPIO_PINGROUP(pin232),
2659     GPIO_PINGROUP(pin233),
2660     GPIO_PINGROUP(pin234),
2661     GPIO_PINGROUP(pin235),
2662     GPIO_PINGROUP(pin236),
2663     GPIO_PINGROUP(pin237),
2664     GPIO_PINGROUP(pin238),
2665     GPIO_PINGROUP(pin239),
2666     GPIO_PINGROUP(pin240),
2667     GPIO_PINGROUP(pin241),
2668     GPIO_PINGROUP(pin242),
2669     GPIO_PINGROUP(pin243),
2670     GPIO_PINGROUP(pin244),
2671     GPIO_PINGROUP(pin245),
2672     GPIO_PINGROUP(keyboard_rowcol6_8_pins),
2673     GPIO_PINGROUP(uart0_pins),
2674     GPIO_PINGROUP(uart0_modem_pins),
2675     GPIO_PINGROUP(gpt0_tmr0_pins),
2676     GPIO_PINGROUP(gpt0_tmr1_pins),
2677     GPIO_PINGROUP(gpt1_tmr0_pins),
2678     GPIO_PINGROUP(gpt1_tmr1_pins),
2679     GPIO_PINGROUP(touch_xy_pins),
2680 };
2681 
2682 static struct spear_pinctrl_machdata spear1310_machdata = {
2683     .pins = spear1310_pins,
2684     .npins = ARRAY_SIZE(spear1310_pins),
2685     .groups = spear1310_pingroups,
2686     .ngroups = ARRAY_SIZE(spear1310_pingroups),
2687     .functions = spear1310_functions,
2688     .nfunctions = ARRAY_SIZE(spear1310_functions),
2689     .gpio_pingroups = spear1310_gpio_pingroup,
2690     .ngpio_pingroups = ARRAY_SIZE(spear1310_gpio_pingroup),
2691     .modes_supported = false,
2692 };
2693 
2694 static const struct of_device_id spear1310_pinctrl_of_match[] = {
2695     {
2696         .compatible = "st,spear1310-pinmux",
2697     },
2698     {},
2699 };
2700 
2701 static int spear1310_pinctrl_probe(struct platform_device *pdev)
2702 {
2703     return spear_pinctrl_probe(pdev, &spear1310_machdata);
2704 }
2705 
2706 static struct platform_driver spear1310_pinctrl_driver = {
2707     .driver = {
2708         .name = DRIVER_NAME,
2709         .of_match_table = spear1310_pinctrl_of_match,
2710     },
2711     .probe = spear1310_pinctrl_probe,
2712 };
2713 
2714 static int __init spear1310_pinctrl_init(void)
2715 {
2716     return platform_driver_register(&spear1310_pinctrl_driver);
2717 }
2718 arch_initcall(spear1310_pinctrl_init);