Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux-2.6-block.git] / drivers / pinctrl / sirf / pinctrl-atlas7.c
1 /*
2  * pinctrl pads, groups, functions for CSR SiRFatlasVII
3  *
4  * Copyright (c) 2011 - 2014 Cambridge Silicon Radio Limited, a CSR plc group
5  * company.
6  *
7  * Licensed under GPLv2 or later.
8  */
9
10 #include <linux/module.h>
11 #include <linux/platform_device.h>
12 #include <linux/io.h>
13 #include <linux/bitops.h>
14 #include <linux/irq.h>
15 #include <linux/slab.h>
16 #include <linux/clk.h>
17 #include <linux/of.h>
18 #include <linux/of_address.h>
19 #include <linux/of_device.h>
20 #include <linux/of_platform.h>
21 #include <linux/of_irq.h>
22 #include <linux/of_gpio.h>
23 #include <linux/pinctrl/machine.h>
24 #include <linux/pinctrl/pinconf.h>
25 #include <linux/pinctrl/pinctrl.h>
26 #include <linux/pinctrl/pinmux.h>
27 #include <linux/pinctrl/consumer.h>
28 #include <linux/pinctrl/pinconf-generic.h>
29 #include <linux/gpio.h>
30
31 /* Definition of Pad&Mux Properties */
32 #define N 0
33
34 /* The Bank contains input-disable regisgers */
35 #define BANK_DS 0
36
37 /* Clear Register offset */
38 #define CLR_REG(r)      ((r) + 0x04)
39
40 /* Definition of multiple function select register */
41 #define FUNC_CLEAR_MASK         0x7
42 #define FUNC_GPIO               0
43 #define FUNC_ANALOGUE           0x8
44 #define ANA_CLEAR_MASK          0x1
45
46 /* The Atlas7's Pad Type List */
47 enum altas7_pad_type {
48         PAD_T_4WE_PD = 0,       /* ZIO_PAD3V_4WE_PD */
49         PAD_T_4WE_PU,           /* ZIO_PAD3V_4WE_PD */
50         PAD_T_16ST,             /* ZIO_PAD3V_SDCLK_PD */
51         PAD_T_M31_0204_PD,      /* PRDW0204SDGZ_M311311_PD */
52         PAD_T_M31_0204_PU,      /* PRDW0204SDGZ_M311311_PU */
53         PAD_T_M31_0610_PD,      /* PRUW0610SDGZ_M311311_PD */
54         PAD_T_M31_0610_PU,      /* PRUW0610SDGZ_M311311_PU */
55         PAD_T_AD,               /* PRDWUWHW08SCDG_HZ */
56 };
57
58 /* Raw value of Driver-Strength Bits */
59 #define DS3     BIT(3)
60 #define DS2     BIT(2)
61 #define DS1     BIT(1)
62 #define DS0     BIT(0)
63 #define DSZ     0
64
65 /* Drive-Strength Intermediate Values */
66 #define DS_NULL         -1
67 #define DS_1BIT_IM_VAL  DS0
68 #define DS_1BIT_MASK    0x1
69 #define DS_2BIT_IM_VAL  (DS1 | DS0)
70 #define DS_2BIT_MASK    0x3
71 #define DS_4BIT_IM_VAL  (DS3 | DS2 | DS1 | DS0)
72 #define DS_4BIT_MASK    0xf
73
74 /* The Drive-Strength of 4WE Pad                 DS1  0  CO */
75 #define DS_4WE_3   (DS1 | DS0)                  /* 1  1  3  */
76 #define DS_4WE_2   (DS1)                        /* 1  0  2  */
77 #define DS_4WE_1   (DS0)                        /* 0  1  1  */
78 #define DS_4WE_0   (DSZ)                        /* 0  0  0  */
79
80 /* The Drive-Strength of 16st Pad                DS3  2  1  0  CO */
81 #define DS_16ST_15  (DS3 | DS2 | DS1 | DS0)     /* 1  1  1  1  15 */
82 #define DS_16ST_14  (DS3 | DS2 | DS0)           /* 1  1  0  1  13 */
83 #define DS_16ST_13  (DS3 | DS2 | DS1)           /* 1  1  1  0  14 */
84 #define DS_16ST_12  (DS2 | DS1 | DS0)           /* 0  1  1  1  7  */
85 #define DS_16ST_11  (DS2 | DS0)                 /* 0  1  0  1  5  */
86 #define DS_16ST_10  (DS3 | DS1 | DS0)           /* 1  0  1  1  11 */
87 #define DS_16ST_9   (DS3 | DS0)                 /* 1  0  0  1  9  */
88 #define DS_16ST_8   (DS1 | DS0)                 /* 0  0  1  1  3  */
89 #define DS_16ST_7   (DS2 | DS1)                 /* 0  1  1  0  6  */
90 #define DS_16ST_6   (DS3 | DS2)                 /* 1  1  0  0  12 */
91 #define DS_16ST_5   (DS2)                       /* 0  1  0  0  4  */
92 #define DS_16ST_4   (DS3 | DS1)                 /* 1  0  1  0  10 */
93 #define DS_16ST_3   (DS1)                       /* 0  0  1  0  2  */
94 #define DS_16ST_2   (DS0)                       /* 0  0  0  1  1  */
95 #define DS_16ST_1   (DSZ)                       /* 0  0  0  0  0  */
96 #define DS_16ST_0   (DS3)                       /* 1  0  0  0  8  */
97
98 /* The Drive-Strength of M31 Pad                 DS0  CO */
99 #define DS_M31_0   (DSZ)                        /* 0  0  */
100 #define DS_M31_1   (DS0)                        /* 1  1  */
101
102 /* Raw values of Pull Option Bits */
103 #define PUN     BIT(1)
104 #define PD      BIT(0)
105 #define PE      BIT(0)
106 #define PZ      0
107
108 /* Definition of Pull Types */
109 #define PULL_UP         0
110 #define HIGH_HYSTERESIS 1
111 #define HIGH_Z          2
112 #define PULL_DOWN       3
113 #define PULL_DISABLE    4
114 #define PULL_ENABLE     5
115 #define PULL_UNKNOWN    -1
116
117 /* Pull Options for 4WE Pad                       PUN  PD  CO */
118 #define P4WE_PULL_MASK          0x3
119 #define P4WE_PULL_DOWN          (PUN | PD)      /* 1   1   3  */
120 #define P4WE_HIGH_Z             (PUN)           /* 1   0   2  */
121 #define P4WE_HIGH_HYSTERESIS    (PD)            /* 0   1   1  */
122 #define P4WE_PULL_UP            (PZ)            /* 0   0   0  */
123
124 /* Pull Options for 16ST Pad                      PUN  PD  CO */
125 #define P16ST_PULL_MASK         0x3
126 #define P16ST_PULL_DOWN         (PUN | PD)      /* 1   1   3  */
127 #define P16ST_HIGH_Z            (PUN)           /* 1   0   2  */
128 #define P16ST_PULL_UP           (PZ)            /* 0   0   0  */
129
130 /* Pull Options for M31 Pad                       PE */
131 #define PM31_PULL_MASK          0x1
132 #define PM31_PULL_ENABLED       (PE)            /* 1 */
133 #define PM31_PULL_DISABLED      (PZ)            /* 0 */
134
135 /* Pull Options for A/D Pad                       PUN  PD  CO */
136 #define PANGD_PULL_MASK         0x3
137 #define PANGD_PULL_DOWN         (PUN | PD)      /* 1   1   3  */
138 #define PANGD_HIGH_Z            (PUN)           /* 1   0   2  */
139 #define PANGD_PULL_UP           (PZ)            /* 0   0   0  */
140
141 /* Definition of Input Disable */
142 #define DI_MASK         0x1
143 #define DI_DISABLE      0x1
144 #define DI_ENABLE       0x0
145
146 /* Definition of Input Disable Value */
147 #define DIV_MASK        0x1
148 #define DIV_DISABLE     0x1
149 #define DIV_ENABLE      0x0
150
151 /* Number of Function input disable registers */
152 #define NUM_OF_IN_DISABLE_REG   0x2
153
154 /* Offset of Function input disable registers */
155 #define IN_DISABLE_0_REG_SET            0x0A00
156 #define IN_DISABLE_0_REG_CLR            0x0A04
157 #define IN_DISABLE_1_REG_SET            0x0A08
158 #define IN_DISABLE_1_REG_CLR            0x0A0C
159 #define IN_DISABLE_VAL_0_REG_SET        0x0A80
160 #define IN_DISABLE_VAL_0_REG_CLR        0x0A84
161 #define IN_DISABLE_VAL_1_REG_SET        0x0A88
162 #define IN_DISABLE_VAL_1_REG_CLR        0x0A8C
163
164 /* Offset of the SDIO9SEL*/
165 #define SYS2PCI_SDIO9SEL 0x14
166
167 struct dt_params {
168         const char *property;
169         int value;
170 };
171
172 /**
173  * struct atlas7_pad_conf - Atlas7 Pad Configuration
174  * @id                  The ID of this Pad.
175  * @type:               The type of this Pad.
176  * @mux_reg:            The mux register offset.
177  *                      This register contains the mux.
178  * @pupd_reg:           The pull-up/down register offset.
179  * @drvstr_reg:         The drive-strength register offset.
180  * @ad_ctrl_reg:        The Analogue/Digital Control register.
181  *
182  * @mux_bit:            The start bit of mux register.
183  * @pupd_bit:           The start bit of pull-up/down register.
184  * @drvstr_bit:         The start bit of drive-strength register.
185  * @ad_ctrl_bit:        The start bit of analogue/digital register.
186  */
187 struct atlas7_pad_config {
188         const u32 id;
189         u32 type;
190         u32 mux_reg;
191         u32 pupd_reg;
192         u32 drvstr_reg;
193         u32 ad_ctrl_reg;
194         /* bits in register */
195         u8 mux_bit;
196         u8 pupd_bit;
197         u8 drvstr_bit;
198         u8 ad_ctrl_bit;
199 };
200
201 #define PADCONF(pad, t, mr, pr, dsr, adr, mb, pb, dsb, adb)     \
202         {                                                       \
203                 .id = pad,                                      \
204                 .type = t,                                      \
205                 .mux_reg = mr,                                  \
206                 .pupd_reg = pr,                                 \
207                 .drvstr_reg = dsr,                              \
208                 .ad_ctrl_reg = adr,                             \
209                 .mux_bit = mb,                                  \
210                 .pupd_bit = pb,                                 \
211                 .drvstr_bit = dsb,                              \
212                 .ad_ctrl_bit = adb,                             \
213         }
214
215 /**
216  * struct atlas7_pad_status - Atlas7 Pad status
217  */
218 struct atlas7_pad_status {
219         u8 func;
220         u8 pull;
221         u8 dstr;
222         u8 reserved;
223 };
224
225 /**
226  * struct atlas7_pad_mux - Atlas7 mux
227  * @bank:               The bank of this pad's registers on.
228  * @pin :               The ID of this Pad.
229  * @func:               The mux func on this Pad.
230  * @dinput_reg:         The Input-Disable register offset.
231  * @dinput_bit:         The start bit of Input-Disable register.
232  * @dinput_val_reg:     The Input-Disable-value register offset.
233  *                      This register is used to set the value of this pad
234  *                      if this pad was disabled.
235  * @dinput_val_bit:     The start bit of Input-Disable Value register.
236  */
237 struct atlas7_pad_mux {
238         u32 bank;
239         u32 pin;
240         u32 func;
241         u32 dinput_reg;
242         u32 dinput_bit;
243         u32 dinput_val_reg;
244         u32 dinput_val_bit;
245 };
246
247 #define MUX(b, pad, f, dr, db, dvr, dvb)        \
248         {                                       \
249                 .bank = b,                      \
250                 .pin = pad,                     \
251                 .func = f,                      \
252                 .dinput_reg = dr,               \
253                 .dinput_bit = db,               \
254                 .dinput_val_reg = dvr,          \
255                 .dinput_val_bit = dvb,          \
256         }
257
258 struct atlas7_grp_mux {
259         unsigned int group;
260         unsigned int pad_mux_count;
261         const struct atlas7_pad_mux *pad_mux_list;
262 };
263
264  /**
265  * struct sirfsoc_pin_group - describes a SiRFprimaII pin group
266  * @name: the name of this specific pin group
267  * @pins: an array of discrete physical pins used in this group, taken
268  *      from the driver-local pin enumeration space
269  * @num_pins: the number of pins in this group array, i.e. the number of
270  *      elements in .pins so we can iterate over that array
271  */
272 struct atlas7_pin_group {
273         const char *name;
274         const unsigned int *pins;
275         const unsigned num_pins;
276 };
277
278 #define GROUP(n, p)  \
279         {                       \
280                 .name = n,      \
281                 .pins = p,      \
282                 .num_pins = ARRAY_SIZE(p),      \
283         }
284
285 struct atlas7_pmx_func {
286         const char *name;
287         const char * const *groups;
288         const unsigned num_groups;
289         const struct atlas7_grp_mux *grpmux;
290 };
291
292 #define FUNCTION(n, g, m)               \
293         {                                       \
294                 .name = n,                      \
295                 .groups = g,                    \
296                 .num_groups = ARRAY_SIZE(g),    \
297                 .grpmux = m,                    \
298         }
299
300 struct atlas7_pinctrl_data {
301         struct pinctrl_pin_desc *pads;
302         int pads_cnt;
303         struct atlas7_pin_group *grps;
304         int grps_cnt;
305         struct atlas7_pmx_func *funcs;
306         int funcs_cnt;
307         struct atlas7_pad_config *confs;
308         int confs_cnt;
309 };
310
311 /* Platform info of atlas7 pinctrl */
312 #define ATLAS7_PINCTRL_REG_BANKS        2
313 #define ATLAS7_PINCTRL_BANK_0_PINS      18
314 #define ATLAS7_PINCTRL_BANK_1_PINS      141
315 #define ATLAS7_PINCTRL_TOTAL_PINS       \
316         (ATLAS7_PINCTRL_BANK_0_PINS + ATLAS7_PINCTRL_BANK_1_PINS)
317
318 /**
319  * Atlas7 GPIO Chip
320  */
321
322 #define NGPIO_OF_BANK           32
323 #define GPIO_TO_BANK(gpio)      ((gpio) / NGPIO_OF_BANK)
324
325 /* Registers of GPIO Controllers */
326 #define ATLAS7_GPIO_BASE(g, b)          ((g)->reg + 0x100 * (b))
327 #define ATLAS7_GPIO_CTRL(b, i)          ((b)->base + 4 * (i))
328 #define ATLAS7_GPIO_INT_STATUS(b)       ((b)->base + 0x8C)
329
330 /* Definition bits of GPIO Control Registers */
331 #define ATLAS7_GPIO_CTL_INTR_LOW_MASK           BIT(0)
332 #define ATLAS7_GPIO_CTL_INTR_HIGH_MASK          BIT(1)
333 #define ATLAS7_GPIO_CTL_INTR_TYPE_MASK          BIT(2)
334 #define ATLAS7_GPIO_CTL_INTR_EN_MASK            BIT(3)
335 #define ATLAS7_GPIO_CTL_INTR_STATUS_MASK        BIT(4)
336 #define ATLAS7_GPIO_CTL_OUT_EN_MASK             BIT(5)
337 #define ATLAS7_GPIO_CTL_DATAOUT_MASK            BIT(6)
338 #define ATLAS7_GPIO_CTL_DATAIN_MASK             BIT(7)
339
340 struct atlas7_gpio_bank {
341         struct pinctrl_dev *pctldev;
342         int id;
343         int irq;
344         void __iomem *base;
345         unsigned int gpio_offset;
346         unsigned int ngpio;
347         const unsigned int *gpio_pins;
348         u32 sleep_data[NGPIO_OF_BANK];
349 };
350
351 struct atlas7_gpio_chip {
352         const char *name;
353         void __iomem *reg;
354         struct clk *clk;
355         int nbank;
356         spinlock_t lock;
357         struct gpio_chip chip;
358         struct atlas7_gpio_bank banks[0];
359 };
360
361 static inline struct atlas7_gpio_chip *to_atlas7_gpio(struct gpio_chip *gc)
362 {
363         return container_of(gc, struct atlas7_gpio_chip, chip);
364 }
365
366 /**
367  * @dev: a pointer back to containing device
368  * @virtbase: the offset to the controller in virtual memory
369  */
370 struct atlas7_pmx {
371         struct device *dev;
372         struct pinctrl_dev *pctl;
373         struct pinctrl_desc pctl_desc;
374         struct atlas7_pinctrl_data *pctl_data;
375         void __iomem *regs[ATLAS7_PINCTRL_REG_BANKS];
376         void __iomem *sys2pci_base;
377         u32 status_ds[NUM_OF_IN_DISABLE_REG];
378         u32 status_dsv[NUM_OF_IN_DISABLE_REG];
379         struct atlas7_pad_status sleep_data[ATLAS7_PINCTRL_TOTAL_PINS];
380 };
381
382 /*
383  * Pad list for the pinmux subsystem
384  * refer to A7DA IO Summary - CS-314158-DD-4E.xls
385  */
386
387 /*Pads in IOC RTC & TOP */
388 static const struct pinctrl_pin_desc atlas7_ioc_pads[] = {
389         /* RTC PADs */
390         PINCTRL_PIN(0, "rtc_gpio_0"),
391         PINCTRL_PIN(1, "rtc_gpio_1"),
392         PINCTRL_PIN(2, "rtc_gpio_2"),
393         PINCTRL_PIN(3, "rtc_gpio_3"),
394         PINCTRL_PIN(4, "low_bat_ind_b"),
395         PINCTRL_PIN(5, "on_key_b"),
396         PINCTRL_PIN(6, "ext_on"),
397         PINCTRL_PIN(7, "mem_on"),
398         PINCTRL_PIN(8, "core_on"),
399         PINCTRL_PIN(9, "io_on"),
400         PINCTRL_PIN(10, "can0_tx"),
401         PINCTRL_PIN(11, "can0_rx"),
402         PINCTRL_PIN(12, "spi0_clk"),
403         PINCTRL_PIN(13, "spi0_cs_b"),
404         PINCTRL_PIN(14, "spi0_io_0"),
405         PINCTRL_PIN(15, "spi0_io_1"),
406         PINCTRL_PIN(16, "spi0_io_2"),
407         PINCTRL_PIN(17, "spi0_io_3"),
408
409         /* TOP PADs */
410         PINCTRL_PIN(18, "spi1_en"),
411         PINCTRL_PIN(19, "spi1_clk"),
412         PINCTRL_PIN(20, "spi1_din"),
413         PINCTRL_PIN(21, "spi1_dout"),
414         PINCTRL_PIN(22, "trg_spi_clk"),
415         PINCTRL_PIN(23, "trg_spi_di"),
416         PINCTRL_PIN(24, "trg_spi_do"),
417         PINCTRL_PIN(25, "trg_spi_cs_b"),
418         PINCTRL_PIN(26, "trg_acq_d1"),
419         PINCTRL_PIN(27, "trg_irq_b"),
420         PINCTRL_PIN(28, "trg_acq_d0"),
421         PINCTRL_PIN(29, "trg_acq_clk"),
422         PINCTRL_PIN(30, "trg_shutdown_b_out"),
423         PINCTRL_PIN(31, "sdio2_clk"),
424         PINCTRL_PIN(32, "sdio2_cmd"),
425         PINCTRL_PIN(33, "sdio2_dat_0"),
426         PINCTRL_PIN(34, "sdio2_dat_1"),
427         PINCTRL_PIN(35, "sdio2_dat_2"),
428         PINCTRL_PIN(36, "sdio2_dat_3"),
429         PINCTRL_PIN(37, "df_ad_7"),
430         PINCTRL_PIN(38, "df_ad_6"),
431         PINCTRL_PIN(39, "df_ad_5"),
432         PINCTRL_PIN(40, "df_ad_4"),
433         PINCTRL_PIN(41, "df_ad_3"),
434         PINCTRL_PIN(42, "df_ad_2"),
435         PINCTRL_PIN(43, "df_ad_1"),
436         PINCTRL_PIN(44, "df_ad_0"),
437         PINCTRL_PIN(45, "df_dqs"),
438         PINCTRL_PIN(46, "df_cle"),
439         PINCTRL_PIN(47, "df_ale"),
440         PINCTRL_PIN(48, "df_we_b"),
441         PINCTRL_PIN(49, "df_re_b"),
442         PINCTRL_PIN(50, "df_ry_by"),
443         PINCTRL_PIN(51, "df_cs_b_1"),
444         PINCTRL_PIN(52, "df_cs_b_0"),
445         PINCTRL_PIN(53, "l_pclk"),
446         PINCTRL_PIN(54, "l_lck"),
447         PINCTRL_PIN(55, "l_fck"),
448         PINCTRL_PIN(56, "l_de"),
449         PINCTRL_PIN(57, "ldd_0"),
450         PINCTRL_PIN(58, "ldd_1"),
451         PINCTRL_PIN(59, "ldd_2"),
452         PINCTRL_PIN(60, "ldd_3"),
453         PINCTRL_PIN(61, "ldd_4"),
454         PINCTRL_PIN(62, "ldd_5"),
455         PINCTRL_PIN(63, "ldd_6"),
456         PINCTRL_PIN(64, "ldd_7"),
457         PINCTRL_PIN(65, "ldd_8"),
458         PINCTRL_PIN(66, "ldd_9"),
459         PINCTRL_PIN(67, "ldd_10"),
460         PINCTRL_PIN(68, "ldd_11"),
461         PINCTRL_PIN(69, "ldd_12"),
462         PINCTRL_PIN(70, "ldd_13"),
463         PINCTRL_PIN(71, "ldd_14"),
464         PINCTRL_PIN(72, "ldd_15"),
465         PINCTRL_PIN(73, "lcd_gpio_20"),
466         PINCTRL_PIN(74, "vip_0"),
467         PINCTRL_PIN(75, "vip_1"),
468         PINCTRL_PIN(76, "vip_2"),
469         PINCTRL_PIN(77, "vip_3"),
470         PINCTRL_PIN(78, "vip_4"),
471         PINCTRL_PIN(79, "vip_5"),
472         PINCTRL_PIN(80, "vip_6"),
473         PINCTRL_PIN(81, "vip_7"),
474         PINCTRL_PIN(82, "vip_pxclk"),
475         PINCTRL_PIN(83, "vip_hsync"),
476         PINCTRL_PIN(84, "vip_vsync"),
477         PINCTRL_PIN(85, "sdio3_clk"),
478         PINCTRL_PIN(86, "sdio3_cmd"),
479         PINCTRL_PIN(87, "sdio3_dat_0"),
480         PINCTRL_PIN(88, "sdio3_dat_1"),
481         PINCTRL_PIN(89, "sdio3_dat_2"),
482         PINCTRL_PIN(90, "sdio3_dat_3"),
483         PINCTRL_PIN(91, "sdio5_clk"),
484         PINCTRL_PIN(92, "sdio5_cmd"),
485         PINCTRL_PIN(93, "sdio5_dat_0"),
486         PINCTRL_PIN(94, "sdio5_dat_1"),
487         PINCTRL_PIN(95, "sdio5_dat_2"),
488         PINCTRL_PIN(96, "sdio5_dat_3"),
489         PINCTRL_PIN(97, "rgmii_txd_0"),
490         PINCTRL_PIN(98, "rgmii_txd_1"),
491         PINCTRL_PIN(99, "rgmii_txd_2"),
492         PINCTRL_PIN(100, "rgmii_txd_3"),
493         PINCTRL_PIN(101, "rgmii_txclk"),
494         PINCTRL_PIN(102, "rgmii_tx_ctl"),
495         PINCTRL_PIN(103, "rgmii_rxd_0"),
496         PINCTRL_PIN(104, "rgmii_rxd_1"),
497         PINCTRL_PIN(105, "rgmii_rxd_2"),
498         PINCTRL_PIN(106, "rgmii_rxd_3"),
499         PINCTRL_PIN(107, "rgmii_rx_clk"),
500         PINCTRL_PIN(108, "rgmii_rxc_ctl"),
501         PINCTRL_PIN(109, "rgmii_mdio"),
502         PINCTRL_PIN(110, "rgmii_mdc"),
503         PINCTRL_PIN(111, "rgmii_intr_n"),
504         PINCTRL_PIN(112, "i2s_mclk"),
505         PINCTRL_PIN(113, "i2s_bclk"),
506         PINCTRL_PIN(114, "i2s_ws"),
507         PINCTRL_PIN(115, "i2s_dout0"),
508         PINCTRL_PIN(116, "i2s_dout1"),
509         PINCTRL_PIN(117, "i2s_dout2"),
510         PINCTRL_PIN(118, "i2s_din"),
511         PINCTRL_PIN(119, "gpio_0"),
512         PINCTRL_PIN(120, "gpio_1"),
513         PINCTRL_PIN(121, "gpio_2"),
514         PINCTRL_PIN(122, "gpio_3"),
515         PINCTRL_PIN(123, "gpio_4"),
516         PINCTRL_PIN(124, "gpio_5"),
517         PINCTRL_PIN(125, "gpio_6"),
518         PINCTRL_PIN(126, "gpio_7"),
519         PINCTRL_PIN(127, "sda_0"),
520         PINCTRL_PIN(128, "scl_0"),
521         PINCTRL_PIN(129, "coex_pio_0"),
522         PINCTRL_PIN(130, "coex_pio_1"),
523         PINCTRL_PIN(131, "coex_pio_2"),
524         PINCTRL_PIN(132, "coex_pio_3"),
525         PINCTRL_PIN(133, "uart0_tx"),
526         PINCTRL_PIN(134, "uart0_rx"),
527         PINCTRL_PIN(135, "uart1_tx"),
528         PINCTRL_PIN(136, "uart1_rx"),
529         PINCTRL_PIN(137, "uart3_tx"),
530         PINCTRL_PIN(138, "uart3_rx"),
531         PINCTRL_PIN(139, "uart4_tx"),
532         PINCTRL_PIN(140, "uart4_rx"),
533         PINCTRL_PIN(141, "usp0_clk"),
534         PINCTRL_PIN(142, "usp0_tx"),
535         PINCTRL_PIN(143, "usp0_rx"),
536         PINCTRL_PIN(144, "usp0_fs"),
537         PINCTRL_PIN(145, "usp1_clk"),
538         PINCTRL_PIN(146, "usp1_tx"),
539         PINCTRL_PIN(147, "usp1_rx"),
540         PINCTRL_PIN(148, "usp1_fs"),
541         PINCTRL_PIN(149, "lvds_tx0d4p"),
542         PINCTRL_PIN(150, "lvds_tx0d4n"),
543         PINCTRL_PIN(151, "lvds_tx0d3p"),
544         PINCTRL_PIN(152, "lvds_tx0d3n"),
545         PINCTRL_PIN(153, "lvds_tx0d2p"),
546         PINCTRL_PIN(154, "lvds_tx0d2n"),
547         PINCTRL_PIN(155, "lvds_tx0d1p"),
548         PINCTRL_PIN(156, "lvds_tx0d1n"),
549         PINCTRL_PIN(157, "lvds_tx0d0p"),
550         PINCTRL_PIN(158, "lvds_tx0d0n"),
551         PINCTRL_PIN(159, "jtag_tdo"),
552         PINCTRL_PIN(160, "jtag_tms"),
553         PINCTRL_PIN(161, "jtag_tck"),
554         PINCTRL_PIN(162, "jtag_tdi"),
555         PINCTRL_PIN(163, "jtag_trstn"),
556 };
557
558 struct atlas7_pad_config atlas7_ioc_pad_confs[] = {
559         /* The Configuration of IOC_RTC Pads */
560         PADCONF(0, 3, 0x0, 0x100, 0x200, -1, 0, 0, 0, 0),
561         PADCONF(1, 3, 0x0, 0x100, 0x200, -1, 4, 2, 2, 0),
562         PADCONF(2, 3, 0x0, 0x100, 0x200, -1, 8, 4, 4, 0),
563         PADCONF(3, 5, 0x0, 0x100, 0x200, -1, 12, 6, 6, 0),
564         PADCONF(4, 4, 0x0, 0x100, 0x200, -1, 16, 8, 8, 0),
565         PADCONF(5, 4, 0x0, 0x100, 0x200, -1, 20, 10, 10, 0),
566         PADCONF(6, 3, 0x0, 0x100, 0x200, -1, 24, 12, 12, 0),
567         PADCONF(7, 3, 0x0, 0x100, 0x200, -1, 28, 14, 14, 0),
568         PADCONF(8, 3, 0x8, 0x100, 0x200, -1, 0, 16, 16, 0),
569         PADCONF(9, 3, 0x8, 0x100, 0x200, -1, 4, 18, 18, 0),
570         PADCONF(10, 4, 0x8, 0x100, 0x200, -1, 8, 20, 20, 0),
571         PADCONF(11, 4, 0x8, 0x100, 0x200, -1, 12, 22, 22, 0),
572         PADCONF(12, 5, 0x8, 0x100, 0x200, -1, 16, 24, 24, 0),
573         PADCONF(13, 6, 0x8, 0x100, 0x200, -1, 20, 26, 26, 0),
574         PADCONF(14, 5, 0x8, 0x100, 0x200, -1, 24, 28, 28, 0),
575         PADCONF(15, 5, 0x8, 0x100, 0x200, -1, 28, 30, 30, 0),
576         PADCONF(16, 5, 0x10, 0x108, 0x208, -1, 0, 0, 0, 0),
577         PADCONF(17, 5, 0x10, 0x108, 0x208, -1, 4, 2, 2, 0),
578         /* The Configuration of IOC_TOP Pads */
579         PADCONF(18, 5, 0x80, 0x180, 0x300, -1, 0, 0, 0, 0),
580         PADCONF(19, 5, 0x80, 0x180, 0x300, -1, 4, 2, 2, 0),
581         PADCONF(20, 5, 0x80, 0x180, 0x300, -1, 8, 4, 4, 0),
582         PADCONF(21, 5, 0x80, 0x180, 0x300, -1, 12, 6, 6, 0),
583         PADCONF(22, 5, 0x88, 0x188, 0x308, -1, 0, 0, 0, 0),
584         PADCONF(23, 5, 0x88, 0x188, 0x308, -1, 4, 2, 2, 0),
585         PADCONF(24, 5, 0x88, 0x188, 0x308, -1, 8, 4, 4, 0),
586         PADCONF(25, 6, 0x88, 0x188, 0x308, -1, 12, 6, 6, 0),
587         PADCONF(26, 5, 0x88, 0x188, 0x308, -1, 16, 8, 8, 0),
588         PADCONF(27, 6, 0x88, 0x188, 0x308, -1, 20, 10, 10, 0),
589         PADCONF(28, 5, 0x88, 0x188, 0x308, -1, 24, 12, 12, 0),
590         PADCONF(29, 5, 0x88, 0x188, 0x308, -1, 28, 14, 14, 0),
591         PADCONF(30, 5, 0x90, 0x188, 0x308, -1, 0, 16, 16, 0),
592         PADCONF(31, 2, 0x98, 0x190, 0x310, -1, 0, 0, 0, 0),
593         PADCONF(32, 1, 0x98, 0x190, 0x310, -1, 4, 2, 4, 0),
594         PADCONF(33, 1, 0x98, 0x190, 0x310, -1, 8, 4, 6, 0),
595         PADCONF(34, 1, 0x98, 0x190, 0x310, -1, 12, 6, 8, 0),
596         PADCONF(35, 1, 0x98, 0x190, 0x310, -1, 16, 8, 10, 0),
597         PADCONF(36, 1, 0x98, 0x190, 0x310, -1, 20, 10, 12, 0),
598         PADCONF(37, 1, 0xa0, 0x198, 0x318, -1, 0, 0, 0, 0),
599         PADCONF(38, 1, 0xa0, 0x198, 0x318, -1, 4, 2, 2, 0),
600         PADCONF(39, 1, 0xa0, 0x198, 0x318, -1, 8, 4, 4, 0),
601         PADCONF(40, 1, 0xa0, 0x198, 0x318, -1, 12, 6, 6, 0),
602         PADCONF(41, 1, 0xa0, 0x198, 0x318, -1, 16, 8, 8, 0),
603         PADCONF(42, 1, 0xa0, 0x198, 0x318, -1, 20, 10, 10, 0),
604         PADCONF(43, 1, 0xa0, 0x198, 0x318, -1, 24, 12, 12, 0),
605         PADCONF(44, 1, 0xa0, 0x198, 0x318, -1, 28, 14, 14, 0),
606         PADCONF(45, 0, 0xa8, 0x198, 0x318, -1, 0, 16, 16, 0),
607         PADCONF(46, 0, 0xa8, 0x198, 0x318, -1, 4, 18, 18, 0),
608         PADCONF(47, 1, 0xa8, 0x198, 0x318, -1, 8, 20, 20, 0),
609         PADCONF(48, 1, 0xa8, 0x198, 0x318, -1, 12, 22, 22, 0),
610         PADCONF(49, 1, 0xa8, 0x198, 0x318, -1, 16, 24, 24, 0),
611         PADCONF(50, 1, 0xa8, 0x198, 0x318, -1, 20, 26, 26, 0),
612         PADCONF(51, 1, 0xa8, 0x198, 0x318, -1, 24, 28, 28, 0),
613         PADCONF(52, 1, 0xa8, 0x198, 0x318, -1, 28, 30, 30, 0),
614         PADCONF(53, 0, 0xb0, 0x1a0, 0x320, -1, 0, 0, 0, 0),
615         PADCONF(54, 0, 0xb0, 0x1a0, 0x320, -1, 4, 2, 2, 0),
616         PADCONF(55, 0, 0xb0, 0x1a0, 0x320, -1, 8, 4, 4, 0),
617         PADCONF(56, 0, 0xb0, 0x1a0, 0x320, -1, 12, 6, 6, 0),
618         PADCONF(57, 0, 0xb0, 0x1a0, 0x320, -1, 16, 8, 8, 0),
619         PADCONF(58, 0, 0xb0, 0x1a0, 0x320, -1, 20, 10, 10, 0),
620         PADCONF(59, 0, 0xb0, 0x1a0, 0x320, -1, 24, 12, 12, 0),
621         PADCONF(60, 0, 0xb0, 0x1a0, 0x320, -1, 28, 14, 14, 0),
622         PADCONF(61, 0, 0xb8, 0x1a0, 0x320, -1, 0, 16, 16, 0),
623         PADCONF(62, 0, 0xb8, 0x1a0, 0x320, -1, 4, 18, 18, 0),
624         PADCONF(63, 0, 0xb8, 0x1a0, 0x320, -1, 8, 20, 20, 0),
625         PADCONF(64, 0, 0xb8, 0x1a0, 0x320, -1, 12, 22, 22, 0),
626         PADCONF(65, 0, 0xb8, 0x1a0, 0x320, -1, 16, 24, 24, 0),
627         PADCONF(66, 0, 0xb8, 0x1a0, 0x320, -1, 20, 26, 26, 0),
628         PADCONF(67, 0, 0xb8, 0x1a0, 0x320, -1, 24, 28, 28, 0),
629         PADCONF(68, 0, 0xb8, 0x1a0, 0x320, -1, 28, 30, 30, 0),
630         PADCONF(69, 0, 0xc0, 0x1a8, 0x328, -1, 0, 0, 0, 0),
631         PADCONF(70, 0, 0xc0, 0x1a8, 0x328, -1, 4, 2, 2, 0),
632         PADCONF(71, 0, 0xc0, 0x1a8, 0x328, -1, 8, 4, 4, 0),
633         PADCONF(72, 0, 0xc0, 0x1a8, 0x328, -1, 12, 6, 6, 0),
634         PADCONF(73, 0, 0xc0, 0x1a8, 0x328, -1, 16, 8, 8, 0),
635         PADCONF(74, 0, 0xc8, 0x1b0, 0x330, -1, 0, 0, 0, 0),
636         PADCONF(75, 0, 0xc8, 0x1b0, 0x330, -1, 4, 2, 2, 0),
637         PADCONF(76, 0, 0xc8, 0x1b0, 0x330, -1, 8, 4, 4, 0),
638         PADCONF(77, 0, 0xc8, 0x1b0, 0x330, -1, 12, 6, 6, 0),
639         PADCONF(78, 0, 0xc8, 0x1b0, 0x330, -1, 16, 8, 8, 0),
640         PADCONF(79, 0, 0xc8, 0x1b0, 0x330, -1, 20, 10, 10, 0),
641         PADCONF(80, 0, 0xc8, 0x1b0, 0x330, -1, 24, 12, 12, 0),
642         PADCONF(81, 0, 0xc8, 0x1b0, 0x330, -1, 28, 14, 14, 0),
643         PADCONF(82, 0, 0xd0, 0x1b0, 0x330, -1, 0, 16, 16, 0),
644         PADCONF(83, 0, 0xd0, 0x1b0, 0x330, -1, 4, 18, 18, 0),
645         PADCONF(84, 0, 0xd0, 0x1b0, 0x330, -1, 8, 20, 20, 0),
646         PADCONF(85, 2, 0xd8, 0x1b8, 0x338, -1, 0, 0, 0, 0),
647         PADCONF(86, 1, 0xd8, 0x1b8, 0x338, -1, 4, 4, 4, 0),
648         PADCONF(87, 1, 0xd8, 0x1b8, 0x338, -1, 8, 6, 6, 0),
649         PADCONF(88, 1, 0xd8, 0x1b8, 0x338, -1, 12, 8, 8, 0),
650         PADCONF(89, 1, 0xd8, 0x1b8, 0x338, -1, 16, 10, 10, 0),
651         PADCONF(90, 1, 0xd8, 0x1b8, 0x338, -1, 20, 12, 12, 0),
652         PADCONF(91, 2, 0xe0, 0x1c0, 0x340, -1, 0, 0, 0, 0),
653         PADCONF(92, 1, 0xe0, 0x1c0, 0x340, -1, 4, 4, 4, 0),
654         PADCONF(93, 1, 0xe0, 0x1c0, 0x340, -1, 8, 6, 6, 0),
655         PADCONF(94, 1, 0xe0, 0x1c0, 0x340, -1, 12, 8, 8, 0),
656         PADCONF(95, 1, 0xe0, 0x1c0, 0x340, -1, 16, 10, 10, 0),
657         PADCONF(96, 1, 0xe0, 0x1c0, 0x340, -1, 20, 12, 12, 0),
658         PADCONF(97, 0, 0xe8, 0x1c8, 0x348, -1, 0, 0, 0, 0),
659         PADCONF(98, 0, 0xe8, 0x1c8, 0x348, -1, 4, 2, 2, 0),
660         PADCONF(99, 0, 0xe8, 0x1c8, 0x348, -1, 8, 4, 4, 0),
661         PADCONF(100, 0, 0xe8, 0x1c8, 0x348, -1, 12, 6, 6, 0),
662         PADCONF(101, 2, 0xe8, 0x1c8, 0x348, -1, 16, 8, 8, 0),
663         PADCONF(102, 0, 0xe8, 0x1c8, 0x348, -1, 20, 12, 12, 0),
664         PADCONF(103, 0, 0xe8, 0x1c8, 0x348, -1, 24, 14, 14, 0),
665         PADCONF(104, 0, 0xe8, 0x1c8, 0x348, -1, 28, 16, 16, 0),
666         PADCONF(105, 0, 0xf0, 0x1c8, 0x348, -1, 0, 18, 18, 0),
667         PADCONF(106, 0, 0xf0, 0x1c8, 0x348, -1, 4, 20, 20, 0),
668         PADCONF(107, 0, 0xf0, 0x1c8, 0x348, -1, 8, 22, 22, 0),
669         PADCONF(108, 0, 0xf0, 0x1c8, 0x348, -1, 12, 24, 24, 0),
670         PADCONF(109, 1, 0xf0, 0x1c8, 0x348, -1, 16, 26, 26, 0),
671         PADCONF(110, 0, 0xf0, 0x1c8, 0x348, -1, 20, 28, 28, 0),
672         PADCONF(111, 1, 0xf0, 0x1c8, 0x348, -1, 24, 30, 30, 0),
673         PADCONF(112, 5, 0xf8, 0x200, 0x350, -1, 0, 0, 0, 0),
674         PADCONF(113, 5, 0xf8, 0x200, 0x350, -1, 4, 2, 2, 0),
675         PADCONF(114, 5, 0xf8, 0x200, 0x350, -1, 8, 4, 4, 0),
676         PADCONF(115, 5, 0xf8, 0x200, 0x350, -1, 12, 6, 6, 0),
677         PADCONF(116, 5, 0xf8, 0x200, 0x350, -1, 16, 8, 8, 0),
678         PADCONF(117, 5, 0xf8, 0x200, 0x350, -1, 20, 10, 10, 0),
679         PADCONF(118, 5, 0xf8, 0x200, 0x350, -1, 24, 12, 12, 0),
680         PADCONF(119, 5, 0x100, 0x250, 0x358, -1, 0, 0, 0, 0),
681         PADCONF(120, 5, 0x100, 0x250, 0x358, -1, 4, 2, 2, 0),
682         PADCONF(121, 5, 0x100, 0x250, 0x358, -1, 8, 4, 4, 0),
683         PADCONF(122, 5, 0x100, 0x250, 0x358, -1, 12, 6, 6, 0),
684         PADCONF(123, 6, 0x100, 0x250, 0x358, -1, 16, 8, 8, 0),
685         PADCONF(124, 6, 0x100, 0x250, 0x358, -1, 20, 10, 10, 0),
686         PADCONF(125, 6, 0x100, 0x250, 0x358, -1, 24, 12, 12, 0),
687         PADCONF(126, 6, 0x100, 0x250, 0x358, -1, 28, 14, 14, 0),
688         PADCONF(127, 6, 0x108, 0x250, 0x358, -1, 16, 24, 24, 0),
689         PADCONF(128, 6, 0x108, 0x250, 0x358, -1, 20, 26, 26, 0),
690         PADCONF(129, 0, 0x110, 0x258, 0x360, -1, 0, 0, 0, 0),
691         PADCONF(130, 0, 0x110, 0x258, 0x360, -1, 4, 2, 2, 0),
692         PADCONF(131, 0, 0x110, 0x258, 0x360, -1, 8, 4, 4, 0),
693         PADCONF(132, 0, 0x110, 0x258, 0x360, -1, 12, 6, 6, 0),
694         PADCONF(133, 6, 0x118, 0x260, 0x368, -1, 0, 0, 0, 0),
695         PADCONF(134, 6, 0x118, 0x260, 0x368, -1, 4, 2, 2, 0),
696         PADCONF(135, 6, 0x118, 0x260, 0x368, -1, 16, 8, 8, 0),
697         PADCONF(136, 6, 0x118, 0x260, 0x368, -1, 20, 10, 10, 0),
698         PADCONF(137, 6, 0x118, 0x260, 0x368, -1, 24, 12, 12, 0),
699         PADCONF(138, 6, 0x118, 0x260, 0x368, -1, 28, 14, 14, 0),
700         PADCONF(139, 6, 0x120, 0x260, 0x368, -1, 0, 16, 16, 0),
701         PADCONF(140, 6, 0x120, 0x260, 0x368, -1, 4, 18, 18, 0),
702         PADCONF(141, 5, 0x128, 0x268, 0x378, -1, 0, 0, 0, 0),
703         PADCONF(142, 5, 0x128, 0x268, 0x378, -1, 4, 2, 2, 0),
704         PADCONF(143, 5, 0x128, 0x268, 0x378, -1, 8, 4, 4, 0),
705         PADCONF(144, 5, 0x128, 0x268, 0x378, -1, 12, 6, 6, 0),
706         PADCONF(145, 5, 0x128, 0x268, 0x378, -1, 16, 8, 8, 0),
707         PADCONF(146, 5, 0x128, 0x268, 0x378, -1, 20, 10, 10, 0),
708         PADCONF(147, 5, 0x128, 0x268, 0x378, -1, 24, 12, 12, 0),
709         PADCONF(148, 5, 0x128, 0x268, 0x378, -1, 28, 14, 14, 0),
710         PADCONF(149, 7, 0x130, 0x270, -1, 0x480, 0, 0, 0, 0),
711         PADCONF(150, 7, 0x130, 0x270, -1, 0x480, 4, 2, 0, 1),
712         PADCONF(151, 7, 0x130, 0x270, -1, 0x480, 8, 4, 0, 2),
713         PADCONF(152, 7, 0x130, 0x270, -1, 0x480, 12, 6, 0, 3),
714         PADCONF(153, 7, 0x130, 0x270, -1, 0x480, 16, 8, 0, 4),
715         PADCONF(154, 7, 0x130, 0x270, -1, 0x480, 20, 10, 0, 5),
716         PADCONF(155, 7, 0x130, 0x270, -1, 0x480, 24, 12, 0, 6),
717         PADCONF(156, 7, 0x130, 0x270, -1, 0x480, 28, 14, 0, 7),
718         PADCONF(157, 7, 0x138, 0x278, -1, 0x480, 0, 0, 0, 8),
719         PADCONF(158, 7, 0x138, 0x278, -1, 0x480, 4, 2, 0, 9),
720         PADCONF(159, 5, 0x140, 0x280, 0x380, -1, 0, 0, 0, 0),
721         PADCONF(160, 6, 0x140, 0x280, 0x380, -1, 4, 2, 2, 0),
722         PADCONF(161, 5, 0x140, 0x280, 0x380, -1, 8, 4, 4, 0),
723         PADCONF(162, 6, 0x140, 0x280, 0x380, -1, 12, 6, 6, 0),
724         PADCONF(163, 6, 0x140, 0x280, 0x380, -1, 16, 8, 8, 0),
725 };
726
727 /* pin list of each pin group */
728 static const unsigned int gnss_gpio_pins[] = { 119, 120, 121, 122, 123, 124,
729                 125, 126, 127, 128, 22, 23, 24, 25, 26, 27, 28, 29, 30, };
730 static const unsigned int lcd_vip_gpio_pins[] = { 74, 75, 76, 77, 78, 79, 80,
731                 81, 82, 83, 84, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
732                 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, };
733 static const unsigned int sdio_i2s_gpio_pins[] = { 31, 32, 33, 34, 35, 36,
734                 85, 86, 87, 88, 89, 90, 129, 130, 131, 132, 91, 92, 93, 94,
735                 95, 96, 112, 113, 114, 115, 116, 117, 118, };
736 static const unsigned int sp_rgmii_gpio_pins[] = { 97, 98, 99, 100, 101, 102,
737                 103, 104, 105, 106, 107, 108, 109, 110, 111, 18, 19, 20, 21,
738                 141, 142, 143, 144, 145, 146, 147, 148, };
739 static const unsigned int lvds_gpio_pins[] = { 157, 158, 155, 156, 153, 154,
740                 151, 152, 149, 150, };
741 static const unsigned int jtag_uart_nand_gpio_pins[] = { 44, 43, 42, 41, 40,
742                 39, 38, 37, 46, 47, 48, 49, 50, 52, 51, 45, 133, 134, 135,
743                 136, 137, 138, 139, 140, 159, 160, 161, 162, 163, };
744 static const unsigned int rtc_gpio_pins[] = { 0, 1, 2, 3, 4, 10, 11, 12, 13,
745                 14, 15, 16, 17, 9, };
746 static const unsigned int audio_ac97_pins[] = { 113, 118, 115, 114, };
747 static const unsigned int audio_digmic_pins0[] = { 51, };
748 static const unsigned int audio_digmic_pins1[] = { 122, };
749 static const unsigned int audio_digmic_pins2[] = { 161, };
750 static const unsigned int audio_func_dbg_pins[] = { 141, 144, 44, 43, 42, 41,
751                 40, 39, 38, 37, 74, 75, 76, 77, 78, 79, 81, 113, 114, 118,
752                 115, 49, 50, 142, 143, 80, };
753 static const unsigned int audio_i2s_pins[] = { 118, 115, 116, 117, 112, 113,
754                 114, };
755 static const unsigned int audio_i2s_2ch_pins[] = { 118, 115, 112, 113, 114, };
756 static const unsigned int audio_i2s_extclk_pins[] = { 112, };
757 static const unsigned int audio_spdif_out_pins0[] = { 112, };
758 static const unsigned int audio_spdif_out_pins1[] = { 116, };
759 static const unsigned int audio_spdif_out_pins2[] = { 142, };
760 static const unsigned int audio_uart0_basic_pins[] = { 143, 142, 141, 144, };
761 static const unsigned int audio_uart0_urfs_pins0[] = { 117, };
762 static const unsigned int audio_uart0_urfs_pins1[] = { 139, };
763 static const unsigned int audio_uart0_urfs_pins2[] = { 163, };
764 static const unsigned int audio_uart0_urfs_pins3[] = { 162, };
765 static const unsigned int audio_uart1_basic_pins[] = { 147, 146, 145, 148, };
766 static const unsigned int audio_uart1_urfs_pins0[] = { 117, };
767 static const unsigned int audio_uart1_urfs_pins1[] = { 140, };
768 static const unsigned int audio_uart1_urfs_pins2[] = { 163, };
769 static const unsigned int audio_uart2_urfs_pins0[] = { 139, };
770 static const unsigned int audio_uart2_urfs_pins1[] = { 163, };
771 static const unsigned int audio_uart2_urfs_pins2[] = { 96, };
772 static const unsigned int audio_uart2_urxd_pins0[] = { 20, };
773 static const unsigned int audio_uart2_urxd_pins1[] = { 109, };
774 static const unsigned int audio_uart2_urxd_pins2[] = { 93, };
775 static const unsigned int audio_uart2_usclk_pins0[] = { 19, };
776 static const unsigned int audio_uart2_usclk_pins1[] = { 101, };
777 static const unsigned int audio_uart2_usclk_pins2[] = { 91, };
778 static const unsigned int audio_uart2_utfs_pins0[] = { 18, };
779 static const unsigned int audio_uart2_utfs_pins1[] = { 111, };
780 static const unsigned int audio_uart2_utfs_pins2[] = { 94, };
781 static const unsigned int audio_uart2_utxd_pins0[] = { 21, };
782 static const unsigned int audio_uart2_utxd_pins1[] = { 110, };
783 static const unsigned int audio_uart2_utxd_pins2[] = { 92, };
784 static const unsigned int c_can_trnsvr_en_pins0[] = { 2, };
785 static const unsigned int c_can_trnsvr_en_pins1[] = { 0, };
786 static const unsigned int c_can_trnsvr_intr_pins[] = { 1, };
787 static const unsigned int c_can_trnsvr_stb_n_pins[] = { 3, };
788 static const unsigned int c0_can_rxd_trnsv0_pins[] = { 11, };
789 static const unsigned int c0_can_rxd_trnsv1_pins[] = { 2, };
790 static const unsigned int c0_can_txd_trnsv0_pins[] = { 10, };
791 static const unsigned int c0_can_txd_trnsv1_pins[] = { 3, };
792 static const unsigned int c1_can_rxd_pins0[] = { 138, };
793 static const unsigned int c1_can_rxd_pins1[] = { 147, };
794 static const unsigned int c1_can_rxd_pins2[] = { 2, };
795 static const unsigned int c1_can_rxd_pins3[] = { 162, };
796 static const unsigned int c1_can_txd_pins0[] = { 137, };
797 static const unsigned int c1_can_txd_pins1[] = { 146, };
798 static const unsigned int c1_can_txd_pins2[] = { 3, };
799 static const unsigned int c1_can_txd_pins3[] = { 161, };
800 static const unsigned int ca_audio_lpc_pins[] = { 62, 63, 64, 65, 66, 67, 68,
801                 69, 70, 71, };
802 static const unsigned int ca_bt_lpc_pins[] = { 85, 86, 87, 88, 89, 90, };
803 static const unsigned int ca_coex_pins[] = { 129, 130, 131, 132, };
804 static const unsigned int ca_curator_lpc_pins[] = { 57, 58, 59, 60, };
805 static const unsigned int ca_pcm_debug_pins[] = { 91, 93, 94, 92, };
806 static const unsigned int ca_pio_pins[] = { 121, 122, 125, 126, 38, 37, 47,
807                 49, 50, 54, 55, 56, };
808 static const unsigned int ca_sdio_debug_pins[] = { 40, 39, 44, 43, 42, 41, };
809 static const unsigned int ca_spi_pins[] = { 82, 79, 80, 81, };
810 static const unsigned int ca_trb_pins[] = { 91, 93, 94, 95, 96, 78, 74, 75,
811                 76, 77, };
812 static const unsigned int ca_uart_debug_pins[] = { 136, 135, 134, 133, };
813 static const unsigned int clkc_pins0[] = { 30, 47, };
814 static const unsigned int clkc_pins1[] = { 78, 54, };
815 static const unsigned int gn_gnss_i2c_pins[] = { 128, 127, };
816 static const unsigned int gn_gnss_uart_nopause_pins[] = { 134, 133, };
817 static const unsigned int gn_gnss_uart_pins[] = { 134, 133, 136, 135, };
818 static const unsigned int gn_trg_spi_pins0[] = { 22, 25, 23, 24, };
819 static const unsigned int gn_trg_spi_pins1[] = { 82, 79, 80, 81, };
820 static const unsigned int cvbs_dbg_pins[] = { 54, 53, 82, 74, 75, 76, 77, 78,
821                 79, 80, 81, 83, 84, 73, 55, 56, };
822 static const unsigned int cvbs_dbg_test_pins0[] = { 57, };
823 static const unsigned int cvbs_dbg_test_pins1[] = { 58, };
824 static const unsigned int cvbs_dbg_test_pins2[] = { 59, };
825 static const unsigned int cvbs_dbg_test_pins3[] = { 60, };
826 static const unsigned int cvbs_dbg_test_pins4[] = { 61, };
827 static const unsigned int cvbs_dbg_test_pins5[] = { 62, };
828 static const unsigned int cvbs_dbg_test_pins6[] = { 63, };
829 static const unsigned int cvbs_dbg_test_pins7[] = { 64, };
830 static const unsigned int cvbs_dbg_test_pins8[] = { 65, };
831 static const unsigned int cvbs_dbg_test_pins9[] = { 66, };
832 static const unsigned int cvbs_dbg_test_pins10[] = { 67, };
833 static const unsigned int cvbs_dbg_test_pins11[] = { 68, };
834 static const unsigned int cvbs_dbg_test_pins12[] = { 69, };
835 static const unsigned int cvbs_dbg_test_pins13[] = { 70, };
836 static const unsigned int cvbs_dbg_test_pins14[] = { 71, };
837 static const unsigned int cvbs_dbg_test_pins15[] = { 72, };
838 static const unsigned int gn_gnss_power_pins[] = { 123, 124, 121, 122, 125,
839                 120, };
840 static const unsigned int gn_gnss_sw_status_pins[] = { 57, 58, 59, 60, 61,
841                 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 53, 55, 56, 54, };
842 static const unsigned int gn_gnss_eclk_pins[] = { 113, };
843 static const unsigned int gn_gnss_irq1_pins0[] = { 112, };
844 static const unsigned int gn_gnss_irq2_pins0[] = { 118, };
845 static const unsigned int gn_gnss_tm_pins[] = { 115, };
846 static const unsigned int gn_gnss_tsync_pins[] = { 114, };
847 static const unsigned int gn_io_gnsssys_sw_cfg_pins[] = { 44, 43, 42, 41, 40,
848                 39, 38, 37, 49, 50, 91, 92, 93, 94, 95, 96, };
849 static const unsigned int gn_trg_pins0[] = { 29, 28, 26, 27, };
850 static const unsigned int gn_trg_pins1[] = { 77, 76, 74, 75, };
851 static const unsigned int gn_trg_shutdown_pins0[] = { 30, };
852 static const unsigned int gn_trg_shutdown_pins1[] = { 83, };
853 static const unsigned int gn_trg_shutdown_pins2[] = { 117, };
854 static const unsigned int gn_trg_shutdown_pins3[] = { 123, };
855 static const unsigned int i2c0_pins[] = { 128, 127, };
856 static const unsigned int i2c1_pins[] = { 126, 125, };
857 static const unsigned int i2s0_pins[] = { 91, 93, 94, 92, };
858 static const unsigned int i2s1_basic_pins[] = { 95, 96, };
859 static const unsigned int i2s1_rxd0_pins0[] = { 61, };
860 static const unsigned int i2s1_rxd0_pins1[] = { 131, };
861 static const unsigned int i2s1_rxd0_pins2[] = { 129, };
862 static const unsigned int i2s1_rxd0_pins3[] = { 117, };
863 static const unsigned int i2s1_rxd0_pins4[] = { 83, };
864 static const unsigned int i2s1_rxd1_pins0[] = { 72, };
865 static const unsigned int i2s1_rxd1_pins1[] = { 132, };
866 static const unsigned int i2s1_rxd1_pins2[] = { 130, };
867 static const unsigned int i2s1_rxd1_pins3[] = { 118, };
868 static const unsigned int i2s1_rxd1_pins4[] = { 84, };
869 static const unsigned int jtag_jt_dbg_nsrst_pins[] = { 125, };
870 static const unsigned int jtag_ntrst_pins0[] = { 4, };
871 static const unsigned int jtag_ntrst_pins1[] = { 163, };
872 static const unsigned int jtag_swdiotms_pins0[] = { 2, };
873 static const unsigned int jtag_swdiotms_pins1[] = { 160, };
874 static const unsigned int jtag_tck_pins0[] = { 0, };
875 static const unsigned int jtag_tck_pins1[] = { 161, };
876 static const unsigned int jtag_tdi_pins0[] = { 1, };
877 static const unsigned int jtag_tdi_pins1[] = { 162, };
878 static const unsigned int jtag_tdo_pins0[] = { 3, };
879 static const unsigned int jtag_tdo_pins1[] = { 159, };
880 static const unsigned int ks_kas_spi_pins0[] = { 141, 144, 143, 142, };
881 static const unsigned int ld_ldd_pins[] = { 57, 58, 59, 60, 61, 62, 63, 64,
882                 65, 66, 67, 68, 69, 70, 71, 72, 74, 75, 76, 77, 78, 79, 80,
883                 81, 56, 53, };
884 static const unsigned int ld_ldd_16bit_pins[] = { 57, 58, 59, 60, 61, 62, 63,
885                 64, 65, 66, 67, 68, 69, 70, 71, 72, 56, 53, };
886 static const unsigned int ld_ldd_fck_pins[] = { 55, };
887 static const unsigned int ld_ldd_lck_pins[] = { 54, };
888 static const unsigned int lr_lcdrom_pins[] = { 73, 54, 57, 58, 59, 60, 61,
889                 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 56, 53, 55, };
890 static const unsigned int lvds_analog_pins[] = { 149, 150, 151, 152, 153, 154,
891                 155, 156, 157, 158, };
892 static const unsigned int nd_df_basic_pins[] = { 44, 43, 42, 41, 40, 39, 38,
893                 37, 47, 46, 52, 45, 49, 50, 48, };
894 static const unsigned int nd_df_wp_pins[] = { 124, };
895 static const unsigned int nd_df_cs_pins[] = { 51, };
896 static const unsigned int ps_pins[] = { 120, 119, 121, };
897 static const unsigned int ps_no_dir_pins[] = { 119, };
898 static const unsigned int pwc_core_on_pins[] = { 8, };
899 static const unsigned int pwc_ext_on_pins[] = { 6, };
900 static const unsigned int pwc_gpio3_clk_pins[] = { 3, };
901 static const unsigned int pwc_io_on_pins[] = { 9, };
902 static const unsigned int pwc_lowbatt_b_pins0[] = { 4, };
903 static const unsigned int pwc_mem_on_pins[] = { 7, };
904 static const unsigned int pwc_on_key_b_pins0[] = { 5, };
905 static const unsigned int pwc_wakeup_src0_pins[] = { 0, };
906 static const unsigned int pwc_wakeup_src1_pins[] = { 1, };
907 static const unsigned int pwc_wakeup_src2_pins[] = { 2, };
908 static const unsigned int pwc_wakeup_src3_pins[] = { 3, };
909 static const unsigned int pw_cko0_pins0[] = { 123, };
910 static const unsigned int pw_cko0_pins1[] = { 101, };
911 static const unsigned int pw_cko0_pins2[] = { 82, };
912 static const unsigned int pw_cko0_pins3[] = { 162, };
913 static const unsigned int pw_cko1_pins0[] = { 124, };
914 static const unsigned int pw_cko1_pins1[] = { 110, };
915 static const unsigned int pw_cko1_pins2[] = { 163, };
916 static const unsigned int pw_i2s01_clk_pins0[] = { 125, };
917 static const unsigned int pw_i2s01_clk_pins1[] = { 117, };
918 static const unsigned int pw_i2s01_clk_pins2[] = { 132, };
919 static const unsigned int pw_pwm0_pins0[] = { 119, };
920 static const unsigned int pw_pwm0_pins1[] = { 159, };
921 static const unsigned int pw_pwm1_pins0[] = { 120, };
922 static const unsigned int pw_pwm1_pins1[] = { 160, };
923 static const unsigned int pw_pwm1_pins2[] = { 131, };
924 static const unsigned int pw_pwm2_pins0[] = { 121, };
925 static const unsigned int pw_pwm2_pins1[] = { 98, };
926 static const unsigned int pw_pwm2_pins2[] = { 161, };
927 static const unsigned int pw_pwm3_pins0[] = { 122, };
928 static const unsigned int pw_pwm3_pins1[] = { 73, };
929 static const unsigned int pw_pwm_cpu_vol_pins0[] = { 121, };
930 static const unsigned int pw_pwm_cpu_vol_pins1[] = { 98, };
931 static const unsigned int pw_pwm_cpu_vol_pins2[] = { 161, };
932 static const unsigned int pw_backlight_pins0[] = { 122, };
933 static const unsigned int pw_backlight_pins1[] = { 73, };
934 static const unsigned int rg_eth_mac_pins[] = { 108, 103, 104, 105, 106, 107,
935                 102, 97, 98, 99, 100, 101, };
936 static const unsigned int rg_gmac_phy_intr_n_pins[] = { 111, };
937 static const unsigned int rg_rgmii_mac_pins[] = { 109, 110, };
938 static const unsigned int rg_rgmii_phy_ref_clk_pins0[] = { 111, };
939 static const unsigned int rg_rgmii_phy_ref_clk_pins1[] = { 53, };
940 static const unsigned int sd0_pins[] = { 46, 47, 44, 43, 42, 41, 40, 39, 38,
941                 37, };
942 static const unsigned int sd0_4bit_pins[] = { 46, 47, 44, 43, 42, 41, };
943 static const unsigned int sd1_pins[] = { 48, 49, 44, 43, 42, 41, 40, 39, 38,
944                 37, };
945 static const unsigned int sd1_4bit_pins0[] = { 48, 49, 44, 43, 42, 41, };
946 static const unsigned int sd1_4bit_pins1[] = { 48, 49, 40, 39, 38, 37, };
947 static const unsigned int sd2_basic_pins[] = { 31, 32, 33, 34, 35, 36, };
948 static const unsigned int sd2_cdb_pins0[] = { 124, };
949 static const unsigned int sd2_cdb_pins1[] = { 161, };
950 static const unsigned int sd2_wpb_pins0[] = { 123, };
951 static const unsigned int sd2_wpb_pins1[] = { 163, };
952 static const unsigned int sd3_9_pins[] = { 85, 86, 87, 88, 89, 90, };
953 static const unsigned int sd5_pins[] = { 91, 92, 93, 94, 95, 96, };
954 static const unsigned int sd6_pins0[] = { 79, 78, 74, 75, 76, 77, };
955 static const unsigned int sd6_pins1[] = { 101, 99, 100, 110, 109, 111, };
956 static const unsigned int sp0_ext_ldo_on_pins[] = { 4, };
957 static const unsigned int sp0_qspi_pins[] = { 12, 13, 14, 15, 16, 17, };
958 static const unsigned int sp1_spi_pins[] = { 19, 20, 21, 18, };
959 static const unsigned int tpiu_trace_pins[] = { 53, 56, 57, 58, 59, 60, 61,
960                 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, };
961 static const unsigned int uart0_pins[] = { 121, 120, 134, 133, };
962 static const unsigned int uart0_nopause_pins[] = { 134, 133, };
963 static const unsigned int uart1_pins[] = { 136, 135, };
964 static const unsigned int uart2_cts_pins0[] = { 132, };
965 static const unsigned int uart2_cts_pins1[] = { 162, };
966 static const unsigned int uart2_rts_pins0[] = { 131, };
967 static const unsigned int uart2_rts_pins1[] = { 161, };
968 static const unsigned int uart2_rxd_pins0[] = { 11, };
969 static const unsigned int uart2_rxd_pins1[] = { 160, };
970 static const unsigned int uart2_rxd_pins2[] = { 130, };
971 static const unsigned int uart2_txd_pins0[] = { 10, };
972 static const unsigned int uart2_txd_pins1[] = { 159, };
973 static const unsigned int uart2_txd_pins2[] = { 129, };
974 static const unsigned int uart3_cts_pins0[] = { 125, };
975 static const unsigned int uart3_cts_pins1[] = { 111, };
976 static const unsigned int uart3_cts_pins2[] = { 140, };
977 static const unsigned int uart3_rts_pins0[] = { 126, };
978 static const unsigned int uart3_rts_pins1[] = { 109, };
979 static const unsigned int uart3_rts_pins2[] = { 139, };
980 static const unsigned int uart3_rxd_pins0[] = { 138, };
981 static const unsigned int uart3_rxd_pins1[] = { 84, };
982 static const unsigned int uart3_rxd_pins2[] = { 162, };
983 static const unsigned int uart3_txd_pins0[] = { 137, };
984 static const unsigned int uart3_txd_pins1[] = { 83, };
985 static const unsigned int uart3_txd_pins2[] = { 161, };
986 static const unsigned int uart4_basic_pins[] = { 140, 139, };
987 static const unsigned int uart4_cts_pins0[] = { 122, };
988 static const unsigned int uart4_cts_pins1[] = { 100, };
989 static const unsigned int uart4_cts_pins2[] = { 117, };
990 static const unsigned int uart4_rts_pins0[] = { 123, };
991 static const unsigned int uart4_rts_pins1[] = { 99, };
992 static const unsigned int uart4_rts_pins2[] = { 116, };
993 static const unsigned int usb0_drvvbus_pins0[] = { 51, };
994 static const unsigned int usb0_drvvbus_pins1[] = { 162, };
995 static const unsigned int usb1_drvvbus_pins0[] = { 134, };
996 static const unsigned int usb1_drvvbus_pins1[] = { 163, };
997 static const unsigned int visbus_dout_pins[] = { 57, 58, 59, 60, 61, 62, 63,
998                 64, 65, 66, 67, 68, 69, 70, 71, 72, 53, 54, 55, 56, 85, 86,
999                 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, };
1000 static const unsigned int vi_vip1_pins[] = { 74, 75, 76, 77, 78, 79, 80, 81,
1001                 82, 83, 84, 103, 104, 105, 106, 107, 102, 97, 98, };
1002 static const unsigned int vi_vip1_ext_pins[] = { 74, 75, 76, 77, 78, 79, 80,
1003                 81, 82, 83, 84, 108, 103, 104, 105, 106, 107, 102, 97, 98,
1004                 99, 100, };
1005 static const unsigned int vi_vip1_low8bit_pins[] = { 74, 75, 76, 77, 78, 79,
1006                 80, 81, 82, 83, 84, };
1007 static const unsigned int vi_vip1_high8bit_pins[] = { 82, 83, 84, 103, 104,
1008                 105, 106, 107, 102, 97, 98, };
1009
1010 /* definition of pin group table */
1011 struct atlas7_pin_group altas7_pin_groups[] = {
1012         GROUP("gnss_gpio_grp", gnss_gpio_pins),
1013         GROUP("lcd_vip_gpio_grp", lcd_vip_gpio_pins),
1014         GROUP("sdio_i2s_gpio_grp", sdio_i2s_gpio_pins),
1015         GROUP("sp_rgmii_gpio_grp", sp_rgmii_gpio_pins),
1016         GROUP("lvds_gpio_grp", lvds_gpio_pins),
1017         GROUP("jtag_uart_nand_gpio_grp", jtag_uart_nand_gpio_pins),
1018         GROUP("rtc_gpio_grp", rtc_gpio_pins),
1019         GROUP("audio_ac97_grp", audio_ac97_pins),
1020         GROUP("audio_digmic_grp0", audio_digmic_pins0),
1021         GROUP("audio_digmic_grp1", audio_digmic_pins1),
1022         GROUP("audio_digmic_grp2", audio_digmic_pins2),
1023         GROUP("audio_func_dbg_grp", audio_func_dbg_pins),
1024         GROUP("audio_i2s_grp", audio_i2s_pins),
1025         GROUP("audio_i2s_2ch_grp", audio_i2s_2ch_pins),
1026         GROUP("audio_i2s_extclk_grp", audio_i2s_extclk_pins),
1027         GROUP("audio_spdif_out_grp0", audio_spdif_out_pins0),
1028         GROUP("audio_spdif_out_grp1", audio_spdif_out_pins1),
1029         GROUP("audio_spdif_out_grp2", audio_spdif_out_pins2),
1030         GROUP("audio_uart0_basic_grp", audio_uart0_basic_pins),
1031         GROUP("audio_uart0_urfs_grp0", audio_uart0_urfs_pins0),
1032         GROUP("audio_uart0_urfs_grp1", audio_uart0_urfs_pins1),
1033         GROUP("audio_uart0_urfs_grp2", audio_uart0_urfs_pins2),
1034         GROUP("audio_uart0_urfs_grp3", audio_uart0_urfs_pins3),
1035         GROUP("audio_uart1_basic_grp", audio_uart1_basic_pins),
1036         GROUP("audio_uart1_urfs_grp0", audio_uart1_urfs_pins0),
1037         GROUP("audio_uart1_urfs_grp1", audio_uart1_urfs_pins1),
1038         GROUP("audio_uart1_urfs_grp2", audio_uart1_urfs_pins2),
1039         GROUP("audio_uart2_urfs_grp0", audio_uart2_urfs_pins0),
1040         GROUP("audio_uart2_urfs_grp1", audio_uart2_urfs_pins1),
1041         GROUP("audio_uart2_urfs_grp2", audio_uart2_urfs_pins2),
1042         GROUP("audio_uart2_urxd_grp0", audio_uart2_urxd_pins0),
1043         GROUP("audio_uart2_urxd_grp1", audio_uart2_urxd_pins1),
1044         GROUP("audio_uart2_urxd_grp2", audio_uart2_urxd_pins2),
1045         GROUP("audio_uart2_usclk_grp0", audio_uart2_usclk_pins0),
1046         GROUP("audio_uart2_usclk_grp1", audio_uart2_usclk_pins1),
1047         GROUP("audio_uart2_usclk_grp2", audio_uart2_usclk_pins2),
1048         GROUP("audio_uart2_utfs_grp0", audio_uart2_utfs_pins0),
1049         GROUP("audio_uart2_utfs_grp1", audio_uart2_utfs_pins1),
1050         GROUP("audio_uart2_utfs_grp2", audio_uart2_utfs_pins2),
1051         GROUP("audio_uart2_utxd_grp0", audio_uart2_utxd_pins0),
1052         GROUP("audio_uart2_utxd_grp1", audio_uart2_utxd_pins1),
1053         GROUP("audio_uart2_utxd_grp2", audio_uart2_utxd_pins2),
1054         GROUP("c_can_trnsvr_en_grp0", c_can_trnsvr_en_pins0),
1055         GROUP("c_can_trnsvr_en_grp1", c_can_trnsvr_en_pins1),
1056         GROUP("c_can_trnsvr_intr_grp", c_can_trnsvr_intr_pins),
1057         GROUP("c_can_trnsvr_stb_n_grp", c_can_trnsvr_stb_n_pins),
1058         GROUP("c0_can_rxd_trnsv0_grp", c0_can_rxd_trnsv0_pins),
1059         GROUP("c0_can_rxd_trnsv1_grp", c0_can_rxd_trnsv1_pins),
1060         GROUP("c0_can_txd_trnsv0_grp", c0_can_txd_trnsv0_pins),
1061         GROUP("c0_can_txd_trnsv1_grp", c0_can_txd_trnsv1_pins),
1062         GROUP("c1_can_rxd_grp0", c1_can_rxd_pins0),
1063         GROUP("c1_can_rxd_grp1", c1_can_rxd_pins1),
1064         GROUP("c1_can_rxd_grp2", c1_can_rxd_pins2),
1065         GROUP("c1_can_rxd_grp3", c1_can_rxd_pins3),
1066         GROUP("c1_can_txd_grp0", c1_can_txd_pins0),
1067         GROUP("c1_can_txd_grp1", c1_can_txd_pins1),
1068         GROUP("c1_can_txd_grp2", c1_can_txd_pins2),
1069         GROUP("c1_can_txd_grp3", c1_can_txd_pins3),
1070         GROUP("ca_audio_lpc_grp", ca_audio_lpc_pins),
1071         GROUP("ca_bt_lpc_grp", ca_bt_lpc_pins),
1072         GROUP("ca_coex_grp", ca_coex_pins),
1073         GROUP("ca_curator_lpc_grp", ca_curator_lpc_pins),
1074         GROUP("ca_pcm_debug_grp", ca_pcm_debug_pins),
1075         GROUP("ca_pio_grp", ca_pio_pins),
1076         GROUP("ca_sdio_debug_grp", ca_sdio_debug_pins),
1077         GROUP("ca_spi_grp", ca_spi_pins),
1078         GROUP("ca_trb_grp", ca_trb_pins),
1079         GROUP("ca_uart_debug_grp", ca_uart_debug_pins),
1080         GROUP("clkc_grp0", clkc_pins0),
1081         GROUP("clkc_grp1", clkc_pins1),
1082         GROUP("gn_gnss_i2c_grp", gn_gnss_i2c_pins),
1083         GROUP("gn_gnss_uart_nopause_grp", gn_gnss_uart_nopause_pins),
1084         GROUP("gn_gnss_uart_grp", gn_gnss_uart_pins),
1085         GROUP("gn_trg_spi_grp0", gn_trg_spi_pins0),
1086         GROUP("gn_trg_spi_grp1", gn_trg_spi_pins1),
1087         GROUP("cvbs_dbg_grp", cvbs_dbg_pins),
1088         GROUP("cvbs_dbg_test_grp0", cvbs_dbg_test_pins0),
1089         GROUP("cvbs_dbg_test_grp1", cvbs_dbg_test_pins1),
1090         GROUP("cvbs_dbg_test_grp2", cvbs_dbg_test_pins2),
1091         GROUP("cvbs_dbg_test_grp3", cvbs_dbg_test_pins3),
1092         GROUP("cvbs_dbg_test_grp4", cvbs_dbg_test_pins4),
1093         GROUP("cvbs_dbg_test_grp5", cvbs_dbg_test_pins5),
1094         GROUP("cvbs_dbg_test_grp6", cvbs_dbg_test_pins6),
1095         GROUP("cvbs_dbg_test_grp7", cvbs_dbg_test_pins7),
1096         GROUP("cvbs_dbg_test_grp8", cvbs_dbg_test_pins8),
1097         GROUP("cvbs_dbg_test_grp9", cvbs_dbg_test_pins9),
1098         GROUP("cvbs_dbg_test_grp10", cvbs_dbg_test_pins10),
1099         GROUP("cvbs_dbg_test_grp11", cvbs_dbg_test_pins11),
1100         GROUP("cvbs_dbg_test_grp12", cvbs_dbg_test_pins12),
1101         GROUP("cvbs_dbg_test_grp13", cvbs_dbg_test_pins13),
1102         GROUP("cvbs_dbg_test_grp14", cvbs_dbg_test_pins14),
1103         GROUP("cvbs_dbg_test_grp15", cvbs_dbg_test_pins15),
1104         GROUP("gn_gnss_power_grp", gn_gnss_power_pins),
1105         GROUP("gn_gnss_sw_status_grp", gn_gnss_sw_status_pins),
1106         GROUP("gn_gnss_eclk_grp", gn_gnss_eclk_pins),
1107         GROUP("gn_gnss_irq1_grp0", gn_gnss_irq1_pins0),
1108         GROUP("gn_gnss_irq2_grp0", gn_gnss_irq2_pins0),
1109         GROUP("gn_gnss_tm_grp", gn_gnss_tm_pins),
1110         GROUP("gn_gnss_tsync_grp", gn_gnss_tsync_pins),
1111         GROUP("gn_io_gnsssys_sw_cfg_grp", gn_io_gnsssys_sw_cfg_pins),
1112         GROUP("gn_trg_grp0", gn_trg_pins0),
1113         GROUP("gn_trg_grp1", gn_trg_pins1),
1114         GROUP("gn_trg_shutdown_grp0", gn_trg_shutdown_pins0),
1115         GROUP("gn_trg_shutdown_grp1", gn_trg_shutdown_pins1),
1116         GROUP("gn_trg_shutdown_grp2", gn_trg_shutdown_pins2),
1117         GROUP("gn_trg_shutdown_grp3", gn_trg_shutdown_pins3),
1118         GROUP("i2c0_grp", i2c0_pins),
1119         GROUP("i2c1_grp", i2c1_pins),
1120         GROUP("i2s0_grp", i2s0_pins),
1121         GROUP("i2s1_basic_grp", i2s1_basic_pins),
1122         GROUP("i2s1_rxd0_grp0", i2s1_rxd0_pins0),
1123         GROUP("i2s1_rxd0_grp1", i2s1_rxd0_pins1),
1124         GROUP("i2s1_rxd0_grp2", i2s1_rxd0_pins2),
1125         GROUP("i2s1_rxd0_grp3", i2s1_rxd0_pins3),
1126         GROUP("i2s1_rxd0_grp4", i2s1_rxd0_pins4),
1127         GROUP("i2s1_rxd1_grp0", i2s1_rxd1_pins0),
1128         GROUP("i2s1_rxd1_grp1", i2s1_rxd1_pins1),
1129         GROUP("i2s1_rxd1_grp2", i2s1_rxd1_pins2),
1130         GROUP("i2s1_rxd1_grp3", i2s1_rxd1_pins3),
1131         GROUP("i2s1_rxd1_grp4", i2s1_rxd1_pins4),
1132         GROUP("jtag_jt_dbg_nsrst_grp", jtag_jt_dbg_nsrst_pins),
1133         GROUP("jtag_ntrst_grp0", jtag_ntrst_pins0),
1134         GROUP("jtag_ntrst_grp1", jtag_ntrst_pins1),
1135         GROUP("jtag_swdiotms_grp0", jtag_swdiotms_pins0),
1136         GROUP("jtag_swdiotms_grp1", jtag_swdiotms_pins1),
1137         GROUP("jtag_tck_grp0", jtag_tck_pins0),
1138         GROUP("jtag_tck_grp1", jtag_tck_pins1),
1139         GROUP("jtag_tdi_grp0", jtag_tdi_pins0),
1140         GROUP("jtag_tdi_grp1", jtag_tdi_pins1),
1141         GROUP("jtag_tdo_grp0", jtag_tdo_pins0),
1142         GROUP("jtag_tdo_grp1", jtag_tdo_pins1),
1143         GROUP("ks_kas_spi_grp0", ks_kas_spi_pins0),
1144         GROUP("ld_ldd_grp", ld_ldd_pins),
1145         GROUP("ld_ldd_16bit_grp", ld_ldd_16bit_pins),
1146         GROUP("ld_ldd_fck_grp", ld_ldd_fck_pins),
1147         GROUP("ld_ldd_lck_grp", ld_ldd_lck_pins),
1148         GROUP("lr_lcdrom_grp", lr_lcdrom_pins),
1149         GROUP("lvds_analog_grp", lvds_analog_pins),
1150         GROUP("nd_df_basic_grp", nd_df_basic_pins),
1151         GROUP("nd_df_wp_grp", nd_df_wp_pins),
1152         GROUP("nd_df_cs_grp", nd_df_cs_pins),
1153         GROUP("ps_grp", ps_pins),
1154         GROUP("ps_no_dir_grp", ps_no_dir_pins),
1155         GROUP("pwc_core_on_grp", pwc_core_on_pins),
1156         GROUP("pwc_ext_on_grp", pwc_ext_on_pins),
1157         GROUP("pwc_gpio3_clk_grp", pwc_gpio3_clk_pins),
1158         GROUP("pwc_io_on_grp", pwc_io_on_pins),
1159         GROUP("pwc_lowbatt_b_grp0", pwc_lowbatt_b_pins0),
1160         GROUP("pwc_mem_on_grp", pwc_mem_on_pins),
1161         GROUP("pwc_on_key_b_grp0", pwc_on_key_b_pins0),
1162         GROUP("pwc_wakeup_src0_grp", pwc_wakeup_src0_pins),
1163         GROUP("pwc_wakeup_src1_grp", pwc_wakeup_src1_pins),
1164         GROUP("pwc_wakeup_src2_grp", pwc_wakeup_src2_pins),
1165         GROUP("pwc_wakeup_src3_grp", pwc_wakeup_src3_pins),
1166         GROUP("pw_cko0_grp0", pw_cko0_pins0),
1167         GROUP("pw_cko0_grp1", pw_cko0_pins1),
1168         GROUP("pw_cko0_grp2", pw_cko0_pins2),
1169         GROUP("pw_cko0_grp3", pw_cko0_pins3),
1170         GROUP("pw_cko1_grp0", pw_cko1_pins0),
1171         GROUP("pw_cko1_grp1", pw_cko1_pins1),
1172         GROUP("pw_cko1_grp2", pw_cko1_pins2),
1173         GROUP("pw_i2s01_clk_grp0", pw_i2s01_clk_pins0),
1174         GROUP("pw_i2s01_clk_grp1", pw_i2s01_clk_pins1),
1175         GROUP("pw_i2s01_clk_grp2", pw_i2s01_clk_pins2),
1176         GROUP("pw_pwm0_grp0", pw_pwm0_pins0),
1177         GROUP("pw_pwm0_grp1", pw_pwm0_pins1),
1178         GROUP("pw_pwm1_grp0", pw_pwm1_pins0),
1179         GROUP("pw_pwm1_grp1", pw_pwm1_pins1),
1180         GROUP("pw_pwm1_grp2", pw_pwm1_pins2),
1181         GROUP("pw_pwm2_grp0", pw_pwm2_pins0),
1182         GROUP("pw_pwm2_grp1", pw_pwm2_pins1),
1183         GROUP("pw_pwm2_grp2", pw_pwm2_pins2),
1184         GROUP("pw_pwm3_grp0", pw_pwm3_pins0),
1185         GROUP("pw_pwm3_grp1", pw_pwm3_pins1),
1186         GROUP("pw_pwm_cpu_vol_grp0", pw_pwm_cpu_vol_pins0),
1187         GROUP("pw_pwm_cpu_vol_grp1", pw_pwm_cpu_vol_pins1),
1188         GROUP("pw_pwm_cpu_vol_grp2", pw_pwm_cpu_vol_pins2),
1189         GROUP("pw_backlight_grp0", pw_backlight_pins0),
1190         GROUP("pw_backlight_grp1", pw_backlight_pins1),
1191         GROUP("rg_eth_mac_grp", rg_eth_mac_pins),
1192         GROUP("rg_gmac_phy_intr_n_grp", rg_gmac_phy_intr_n_pins),
1193         GROUP("rg_rgmii_mac_grp", rg_rgmii_mac_pins),
1194         GROUP("rg_rgmii_phy_ref_clk_grp0", rg_rgmii_phy_ref_clk_pins0),
1195         GROUP("rg_rgmii_phy_ref_clk_grp1", rg_rgmii_phy_ref_clk_pins1),
1196         GROUP("sd0_grp", sd0_pins),
1197         GROUP("sd0_4bit_grp", sd0_4bit_pins),
1198         GROUP("sd1_grp", sd1_pins),
1199         GROUP("sd1_4bit_grp0", sd1_4bit_pins0),
1200         GROUP("sd1_4bit_grp1", sd1_4bit_pins1),
1201         GROUP("sd2_basic_grp", sd2_basic_pins),
1202         GROUP("sd2_cdb_grp0", sd2_cdb_pins0),
1203         GROUP("sd2_cdb_grp1", sd2_cdb_pins1),
1204         GROUP("sd2_wpb_grp0", sd2_wpb_pins0),
1205         GROUP("sd2_wpb_grp1", sd2_wpb_pins1),
1206         GROUP("sd3_9_grp", sd3_9_pins),
1207         GROUP("sd5_grp", sd5_pins),
1208         GROUP("sd6_grp0", sd6_pins0),
1209         GROUP("sd6_grp1", sd6_pins1),
1210         GROUP("sp0_ext_ldo_on_grp", sp0_ext_ldo_on_pins),
1211         GROUP("sp0_qspi_grp", sp0_qspi_pins),
1212         GROUP("sp1_spi_grp", sp1_spi_pins),
1213         GROUP("tpiu_trace_grp", tpiu_trace_pins),
1214         GROUP("uart0_grp", uart0_pins),
1215         GROUP("uart0_nopause_grp", uart0_nopause_pins),
1216         GROUP("uart1_grp", uart1_pins),
1217         GROUP("uart2_cts_grp0", uart2_cts_pins0),
1218         GROUP("uart2_cts_grp1", uart2_cts_pins1),
1219         GROUP("uart2_rts_grp0", uart2_rts_pins0),
1220         GROUP("uart2_rts_grp1", uart2_rts_pins1),
1221         GROUP("uart2_rxd_grp0", uart2_rxd_pins0),
1222         GROUP("uart2_rxd_grp1", uart2_rxd_pins1),
1223         GROUP("uart2_rxd_grp2", uart2_rxd_pins2),
1224         GROUP("uart2_txd_grp0", uart2_txd_pins0),
1225         GROUP("uart2_txd_grp1", uart2_txd_pins1),
1226         GROUP("uart2_txd_grp2", uart2_txd_pins2),
1227         GROUP("uart3_cts_grp0", uart3_cts_pins0),
1228         GROUP("uart3_cts_grp1", uart3_cts_pins1),
1229         GROUP("uart3_cts_grp2", uart3_cts_pins2),
1230         GROUP("uart3_rts_grp0", uart3_rts_pins0),
1231         GROUP("uart3_rts_grp1", uart3_rts_pins1),
1232         GROUP("uart3_rts_grp2", uart3_rts_pins2),
1233         GROUP("uart3_rxd_grp0", uart3_rxd_pins0),
1234         GROUP("uart3_rxd_grp1", uart3_rxd_pins1),
1235         GROUP("uart3_rxd_grp2", uart3_rxd_pins2),
1236         GROUP("uart3_txd_grp0", uart3_txd_pins0),
1237         GROUP("uart3_txd_grp1", uart3_txd_pins1),
1238         GROUP("uart3_txd_grp2", uart3_txd_pins2),
1239         GROUP("uart4_basic_grp", uart4_basic_pins),
1240         GROUP("uart4_cts_grp0", uart4_cts_pins0),
1241         GROUP("uart4_cts_grp1", uart4_cts_pins1),
1242         GROUP("uart4_cts_grp2", uart4_cts_pins2),
1243         GROUP("uart4_rts_grp0", uart4_rts_pins0),
1244         GROUP("uart4_rts_grp1", uart4_rts_pins1),
1245         GROUP("uart4_rts_grp2", uart4_rts_pins2),
1246         GROUP("usb0_drvvbus_grp0", usb0_drvvbus_pins0),
1247         GROUP("usb0_drvvbus_grp1", usb0_drvvbus_pins1),
1248         GROUP("usb1_drvvbus_grp0", usb1_drvvbus_pins0),
1249         GROUP("usb1_drvvbus_grp1", usb1_drvvbus_pins1),
1250         GROUP("visbus_dout_grp", visbus_dout_pins),
1251         GROUP("vi_vip1_grp", vi_vip1_pins),
1252         GROUP("vi_vip1_ext_grp", vi_vip1_ext_pins),
1253         GROUP("vi_vip1_low8bit_grp", vi_vip1_low8bit_pins),
1254         GROUP("vi_vip1_high8bit_grp", vi_vip1_high8bit_pins),
1255 };
1256
1257 /* How many groups that a function can use */
1258 static const char * const gnss_gpio_grp[] = { "gnss_gpio_grp", };
1259 static const char * const lcd_vip_gpio_grp[] = { "lcd_vip_gpio_grp", };
1260 static const char * const sdio_i2s_gpio_grp[] = { "sdio_i2s_gpio_grp", };
1261 static const char * const sp_rgmii_gpio_grp[] = { "sp_rgmii_gpio_grp", };
1262 static const char * const lvds_gpio_grp[] = { "lvds_gpio_grp", };
1263 static const char * const jtag_uart_nand_gpio_grp[] = {
1264                                 "jtag_uart_nand_gpio_grp", };
1265 static const char * const rtc_gpio_grp[] = { "rtc_gpio_grp", };
1266 static const char * const audio_ac97_grp[] = { "audio_ac97_grp", };
1267 static const char * const audio_digmic_grp0[] = { "audio_digmic_grp0", };
1268 static const char * const audio_digmic_grp1[] = { "audio_digmic_grp1", };
1269 static const char * const audio_digmic_grp2[] = { "audio_digmic_grp2", };
1270 static const char * const audio_func_dbg_grp[] = { "audio_func_dbg_grp", };
1271 static const char * const audio_i2s_grp[] = { "audio_i2s_grp", };
1272 static const char * const audio_i2s_2ch_grp[] = { "audio_i2s_2ch_grp", };
1273 static const char * const audio_i2s_extclk_grp[] = { "audio_i2s_extclk_grp", };
1274 static const char * const audio_spdif_out_grp0[] = { "audio_spdif_out_grp0", };
1275 static const char * const audio_spdif_out_grp1[] = { "audio_spdif_out_grp1", };
1276 static const char * const audio_spdif_out_grp2[] = { "audio_spdif_out_grp2", };
1277 static const char * const audio_uart0_basic_grp[] = {
1278                                 "audio_uart0_basic_grp", };
1279 static const char * const audio_uart0_urfs_grp0[] = {
1280                                 "audio_uart0_urfs_grp0", };
1281 static const char * const audio_uart0_urfs_grp1[] = {
1282                                 "audio_uart0_urfs_grp1", };
1283 static const char * const audio_uart0_urfs_grp2[] = {
1284                                 "audio_uart0_urfs_grp2", };
1285 static const char * const audio_uart0_urfs_grp3[] = {
1286                                 "audio_uart0_urfs_grp3", };
1287 static const char * const audio_uart1_basic_grp[] = {
1288                                 "audio_uart1_basic_grp", };
1289 static const char * const audio_uart1_urfs_grp0[] = {
1290                                 "audio_uart1_urfs_grp0", };
1291 static const char * const audio_uart1_urfs_grp1[] = {
1292                                 "audio_uart1_urfs_grp1", };
1293 static const char * const audio_uart1_urfs_grp2[] = {
1294                                 "audio_uart1_urfs_grp2", };
1295 static const char * const audio_uart2_urfs_grp0[] = {
1296                                 "audio_uart2_urfs_grp0", };
1297 static const char * const audio_uart2_urfs_grp1[] = {
1298                                 "audio_uart2_urfs_grp1", };
1299 static const char * const audio_uart2_urfs_grp2[] = {
1300                                 "audio_uart2_urfs_grp2", };
1301 static const char * const audio_uart2_urxd_grp0[] = {
1302                                 "audio_uart2_urxd_grp0", };
1303 static const char * const audio_uart2_urxd_grp1[] = {
1304                                 "audio_uart2_urxd_grp1", };
1305 static const char * const audio_uart2_urxd_grp2[] = {
1306                                 "audio_uart2_urxd_grp2", };
1307 static const char * const audio_uart2_usclk_grp0[] = {
1308                                 "audio_uart2_usclk_grp0", };
1309 static const char * const audio_uart2_usclk_grp1[] = {
1310                                 "audio_uart2_usclk_grp1", };
1311 static const char * const audio_uart2_usclk_grp2[] = {
1312                                 "audio_uart2_usclk_grp2", };
1313 static const char * const audio_uart2_utfs_grp0[] = {
1314                                 "audio_uart2_utfs_grp0", };
1315 static const char * const audio_uart2_utfs_grp1[] = {
1316                                 "audio_uart2_utfs_grp1", };
1317 static const char * const audio_uart2_utfs_grp2[] = {
1318                                 "audio_uart2_utfs_grp2", };
1319 static const char * const audio_uart2_utxd_grp0[] = {
1320                                 "audio_uart2_utxd_grp0", };
1321 static const char * const audio_uart2_utxd_grp1[] = {
1322                                 "audio_uart2_utxd_grp1", };
1323 static const char * const audio_uart2_utxd_grp2[] = {
1324                                 "audio_uart2_utxd_grp2", };
1325 static const char * const c_can_trnsvr_en_grp0[] = { "c_can_trnsvr_en_grp0", };
1326 static const char * const c_can_trnsvr_en_grp1[] = { "c_can_trnsvr_en_grp1", };
1327 static const char * const c_can_trnsvr_intr_grp[] = {
1328                                 "c_can_trnsvr_intr_grp", };
1329 static const char * const c_can_trnsvr_stb_n_grp[] = {
1330                                 "c_can_trnsvr_stb_n_grp", };
1331 static const char * const c0_can_rxd_trnsv0_grp[] = {
1332                                 "c0_can_rxd_trnsv0_grp", };
1333 static const char * const c0_can_rxd_trnsv1_grp[] = {
1334                                 "c0_can_rxd_trnsv1_grp", };
1335 static const char * const c0_can_txd_trnsv0_grp[] = {
1336                                 "c0_can_txd_trnsv0_grp", };
1337 static const char * const c0_can_txd_trnsv1_grp[] = {
1338                                 "c0_can_txd_trnsv1_grp", };
1339 static const char * const c1_can_rxd_grp0[] = { "c1_can_rxd_grp0", };
1340 static const char * const c1_can_rxd_grp1[] = { "c1_can_rxd_grp1", };
1341 static const char * const c1_can_rxd_grp2[] = { "c1_can_rxd_grp2", };
1342 static const char * const c1_can_rxd_grp3[] = { "c1_can_rxd_grp3", };
1343 static const char * const c1_can_txd_grp0[] = { "c1_can_txd_grp0", };
1344 static const char * const c1_can_txd_grp1[] = { "c1_can_txd_grp1", };
1345 static const char * const c1_can_txd_grp2[] = { "c1_can_txd_grp2", };
1346 static const char * const c1_can_txd_grp3[] = { "c1_can_txd_grp3", };
1347 static const char * const ca_audio_lpc_grp[] = { "ca_audio_lpc_grp", };
1348 static const char * const ca_bt_lpc_grp[] = { "ca_bt_lpc_grp", };
1349 static const char * const ca_coex_grp[] = { "ca_coex_grp", };
1350 static const char * const ca_curator_lpc_grp[] = { "ca_curator_lpc_grp", };
1351 static const char * const ca_pcm_debug_grp[] = { "ca_pcm_debug_grp", };
1352 static const char * const ca_pio_grp[] = { "ca_pio_grp", };
1353 static const char * const ca_sdio_debug_grp[] = { "ca_sdio_debug_grp", };
1354 static const char * const ca_spi_grp[] = { "ca_spi_grp", };
1355 static const char * const ca_trb_grp[] = { "ca_trb_grp", };
1356 static const char * const ca_uart_debug_grp[] = { "ca_uart_debug_grp", };
1357 static const char * const clkc_grp0[] = { "clkc_grp0", };
1358 static const char * const clkc_grp1[] = { "clkc_grp1", };
1359 static const char * const gn_gnss_i2c_grp[] = { "gn_gnss_i2c_grp", };
1360 static const char * const gn_gnss_uart_nopause_grp[] = {
1361                                 "gn_gnss_uart_nopause_grp", };
1362 static const char * const gn_gnss_uart_grp[] = { "gn_gnss_uart_grp", };
1363 static const char * const gn_trg_spi_grp0[] = { "gn_trg_spi_grp0", };
1364 static const char * const gn_trg_spi_grp1[] = { "gn_trg_spi_grp1", };
1365 static const char * const cvbs_dbg_grp[] = { "cvbs_dbg_grp", };
1366 static const char * const cvbs_dbg_test_grp0[] = { "cvbs_dbg_test_grp0", };
1367 static const char * const cvbs_dbg_test_grp1[] = { "cvbs_dbg_test_grp1", };
1368 static const char * const cvbs_dbg_test_grp2[] = { "cvbs_dbg_test_grp2", };
1369 static const char * const cvbs_dbg_test_grp3[] = { "cvbs_dbg_test_grp3", };
1370 static const char * const cvbs_dbg_test_grp4[] = { "cvbs_dbg_test_grp4", };
1371 static const char * const cvbs_dbg_test_grp5[] = { "cvbs_dbg_test_grp5", };
1372 static const char * const cvbs_dbg_test_grp6[] = { "cvbs_dbg_test_grp6", };
1373 static const char * const cvbs_dbg_test_grp7[] = { "cvbs_dbg_test_grp7", };
1374 static const char * const cvbs_dbg_test_grp8[] = { "cvbs_dbg_test_grp8", };
1375 static const char * const cvbs_dbg_test_grp9[] = { "cvbs_dbg_test_grp9", };
1376 static const char * const cvbs_dbg_test_grp10[] = { "cvbs_dbg_test_grp10", };
1377 static const char * const cvbs_dbg_test_grp11[] = { "cvbs_dbg_test_grp11", };
1378 static const char * const cvbs_dbg_test_grp12[] = { "cvbs_dbg_test_grp12", };
1379 static const char * const cvbs_dbg_test_grp13[] = { "cvbs_dbg_test_grp13", };
1380 static const char * const cvbs_dbg_test_grp14[] = { "cvbs_dbg_test_grp14", };
1381 static const char * const cvbs_dbg_test_grp15[] = { "cvbs_dbg_test_grp15", };
1382 static const char * const gn_gnss_power_grp[] = { "gn_gnss_power_grp", };
1383 static const char * const gn_gnss_sw_status_grp[] = {
1384                                 "gn_gnss_sw_status_grp", };
1385 static const char * const gn_gnss_eclk_grp[] = { "gn_gnss_eclk_grp", };
1386 static const char * const gn_gnss_irq1_grp0[] = { "gn_gnss_irq1_grp0", };
1387 static const char * const gn_gnss_irq2_grp0[] = { "gn_gnss_irq2_grp0", };
1388 static const char * const gn_gnss_tm_grp[] = { "gn_gnss_tm_grp", };
1389 static const char * const gn_gnss_tsync_grp[] = { "gn_gnss_tsync_grp", };
1390 static const char * const gn_io_gnsssys_sw_cfg_grp[] = {
1391                                 "gn_io_gnsssys_sw_cfg_grp", };
1392 static const char * const gn_trg_grp0[] = { "gn_trg_grp0", };
1393 static const char * const gn_trg_grp1[] = { "gn_trg_grp1", };
1394 static const char * const gn_trg_shutdown_grp0[] = { "gn_trg_shutdown_grp0", };
1395 static const char * const gn_trg_shutdown_grp1[] = { "gn_trg_shutdown_grp1", };
1396 static const char * const gn_trg_shutdown_grp2[] = { "gn_trg_shutdown_grp2", };
1397 static const char * const gn_trg_shutdown_grp3[] = { "gn_trg_shutdown_grp3", };
1398 static const char * const i2c0_grp[] = { "i2c0_grp", };
1399 static const char * const i2c1_grp[] = { "i2c1_grp", };
1400 static const char * const i2s0_grp[] = { "i2s0_grp", };
1401 static const char * const i2s1_basic_grp[] = { "i2s1_basic_grp", };
1402 static const char * const i2s1_rxd0_grp0[] = { "i2s1_rxd0_grp0", };
1403 static const char * const i2s1_rxd0_grp1[] = { "i2s1_rxd0_grp1", };
1404 static const char * const i2s1_rxd0_grp2[] = { "i2s1_rxd0_grp2", };
1405 static const char * const i2s1_rxd0_grp3[] = { "i2s1_rxd0_grp3", };
1406 static const char * const i2s1_rxd0_grp4[] = { "i2s1_rxd0_grp4", };
1407 static const char * const i2s1_rxd1_grp0[] = { "i2s1_rxd1_grp0", };
1408 static const char * const i2s1_rxd1_grp1[] = { "i2s1_rxd1_grp1", };
1409 static const char * const i2s1_rxd1_grp2[] = { "i2s1_rxd1_grp2", };
1410 static const char * const i2s1_rxd1_grp3[] = { "i2s1_rxd1_grp3", };
1411 static const char * const i2s1_rxd1_grp4[] = { "i2s1_rxd1_grp4", };
1412 static const char * const jtag_jt_dbg_nsrst_grp[] = {
1413                                 "jtag_jt_dbg_nsrst_grp", };
1414 static const char * const jtag_ntrst_grp0[] = { "jtag_ntrst_grp0", };
1415 static const char * const jtag_ntrst_grp1[] = { "jtag_ntrst_grp1", };
1416 static const char * const jtag_swdiotms_grp0[] = { "jtag_swdiotms_grp0", };
1417 static const char * const jtag_swdiotms_grp1[] = { "jtag_swdiotms_grp1", };
1418 static const char * const jtag_tck_grp0[] = { "jtag_tck_grp0", };
1419 static const char * const jtag_tck_grp1[] = { "jtag_tck_grp1", };
1420 static const char * const jtag_tdi_grp0[] = { "jtag_tdi_grp0", };
1421 static const char * const jtag_tdi_grp1[] = { "jtag_tdi_grp1", };
1422 static const char * const jtag_tdo_grp0[] = { "jtag_tdo_grp0", };
1423 static const char * const jtag_tdo_grp1[] = { "jtag_tdo_grp1", };
1424 static const char * const ks_kas_spi_grp0[] = { "ks_kas_spi_grp0", };
1425 static const char * const ld_ldd_grp[] = { "ld_ldd_grp", };
1426 static const char * const ld_ldd_16bit_grp[] = { "ld_ldd_16bit_grp", };
1427 static const char * const ld_ldd_fck_grp[] = { "ld_ldd_fck_grp", };
1428 static const char * const ld_ldd_lck_grp[] = { "ld_ldd_lck_grp", };
1429 static const char * const lr_lcdrom_grp[] = { "lr_lcdrom_grp", };
1430 static const char * const lvds_analog_grp[] = { "lvds_analog_grp", };
1431 static const char * const nd_df_basic_grp[] = { "nd_df_basic_grp", };
1432 static const char * const nd_df_wp_grp[] = { "nd_df_wp_grp", };
1433 static const char * const nd_df_cs_grp[] = { "nd_df_cs_grp", };
1434 static const char * const ps_grp[] = { "ps_grp", };
1435 static const char * const ps_no_dir_grp[] = { "ps_no_dir_grp", };
1436 static const char * const pwc_core_on_grp[] = { "pwc_core_on_grp", };
1437 static const char * const pwc_ext_on_grp[] = { "pwc_ext_on_grp", };
1438 static const char * const pwc_gpio3_clk_grp[] = { "pwc_gpio3_clk_grp", };
1439 static const char * const pwc_io_on_grp[] = { "pwc_io_on_grp", };
1440 static const char * const pwc_lowbatt_b_grp0[] = { "pwc_lowbatt_b_grp0", };
1441 static const char * const pwc_mem_on_grp[] = { "pwc_mem_on_grp", };
1442 static const char * const pwc_on_key_b_grp0[] = { "pwc_on_key_b_grp0", };
1443 static const char * const pwc_wakeup_src0_grp[] = { "pwc_wakeup_src0_grp", };
1444 static const char * const pwc_wakeup_src1_grp[] = { "pwc_wakeup_src1_grp", };
1445 static const char * const pwc_wakeup_src2_grp[] = { "pwc_wakeup_src2_grp", };
1446 static const char * const pwc_wakeup_src3_grp[] = { "pwc_wakeup_src3_grp", };
1447 static const char * const pw_cko0_grp0[] = { "pw_cko0_grp0", };
1448 static const char * const pw_cko0_grp1[] = { "pw_cko0_grp1", };
1449 static const char * const pw_cko0_grp2[] = { "pw_cko0_grp2", };
1450 static const char * const pw_cko0_grp3[] = { "pw_cko0_grp3", };
1451 static const char * const pw_cko1_grp0[] = { "pw_cko1_grp0", };
1452 static const char * const pw_cko1_grp1[] = { "pw_cko1_grp1", };
1453 static const char * const pw_cko1_grp2[] = { "pw_cko1_grp2", };
1454 static const char * const pw_i2s01_clk_grp0[] = { "pw_i2s01_clk_grp0", };
1455 static const char * const pw_i2s01_clk_grp1[] = { "pw_i2s01_clk_grp1", };
1456 static const char * const pw_i2s01_clk_grp2[] = { "pw_i2s01_clk_grp2", };
1457 static const char * const pw_pwm0_grp0[] = { "pw_pwm0_grp0", };
1458 static const char * const pw_pwm0_grp1[] = { "pw_pwm0_grp1", };
1459 static const char * const pw_pwm1_grp0[] = { "pw_pwm1_grp0", };
1460 static const char * const pw_pwm1_grp1[] = { "pw_pwm1_grp1", };
1461 static const char * const pw_pwm1_grp2[] = { "pw_pwm1_grp2", };
1462 static const char * const pw_pwm2_grp0[] = { "pw_pwm2_grp0", };
1463 static const char * const pw_pwm2_grp1[] = { "pw_pwm2_grp1", };
1464 static const char * const pw_pwm2_grp2[] = { "pw_pwm2_grp2", };
1465 static const char * const pw_pwm3_grp0[] = { "pw_pwm3_grp0", };
1466 static const char * const pw_pwm3_grp1[] = { "pw_pwm3_grp1", };
1467 static const char * const pw_pwm_cpu_vol_grp0[] = { "pw_pwm_cpu_vol_grp0", };
1468 static const char * const pw_pwm_cpu_vol_grp1[] = { "pw_pwm_cpu_vol_grp1", };
1469 static const char * const pw_pwm_cpu_vol_grp2[] = { "pw_pwm_cpu_vol_grp2", };
1470 static const char * const pw_backlight_grp0[] = { "pw_backlight_grp0", };
1471 static const char * const pw_backlight_grp1[] = { "pw_backlight_grp1", };
1472 static const char * const rg_eth_mac_grp[] = { "rg_eth_mac_grp", };
1473 static const char * const rg_gmac_phy_intr_n_grp[] = {
1474                                 "rg_gmac_phy_intr_n_grp", };
1475 static const char * const rg_rgmii_mac_grp[] = { "rg_rgmii_mac_grp", };
1476 static const char * const rg_rgmii_phy_ref_clk_grp0[] = {
1477                                 "rg_rgmii_phy_ref_clk_grp0", };
1478 static const char * const rg_rgmii_phy_ref_clk_grp1[] = {
1479                                 "rg_rgmii_phy_ref_clk_grp1", };
1480 static const char * const sd0_grp[] = { "sd0_grp", };
1481 static const char * const sd0_4bit_grp[] = { "sd0_4bit_grp", };
1482 static const char * const sd1_grp[] = { "sd1_grp", };
1483 static const char * const sd1_4bit_grp0[] = { "sd1_4bit_grp0", };
1484 static const char * const sd1_4bit_grp1[] = { "sd1_4bit_grp1", };
1485 static const char * const sd2_basic_grp[] = { "sd2_basic_grp", };
1486 static const char * const sd2_cdb_grp0[] = { "sd2_cdb_grp0", };
1487 static const char * const sd2_cdb_grp1[] = { "sd2_cdb_grp1", };
1488 static const char * const sd2_wpb_grp0[] = { "sd2_wpb_grp0", };
1489 static const char * const sd2_wpb_grp1[] = { "sd2_wpb_grp1", };
1490 static const char * const sd3_9_grp[] = { "sd3_9_grp", };
1491 static const char * const sd5_grp[] = { "sd5_grp", };
1492 static const char * const sd6_grp0[] = { "sd6_grp0", };
1493 static const char * const sd6_grp1[] = { "sd6_grp1", };
1494 static const char * const sp0_ext_ldo_on_grp[] = { "sp0_ext_ldo_on_grp", };
1495 static const char * const sp0_qspi_grp[] = { "sp0_qspi_grp", };
1496 static const char * const sp1_spi_grp[] = { "sp1_spi_grp", };
1497 static const char * const tpiu_trace_grp[] = { "tpiu_trace_grp", };
1498 static const char * const uart0_grp[] = { "uart0_grp", };
1499 static const char * const uart0_nopause_grp[] = { "uart0_nopause_grp", };
1500 static const char * const uart1_grp[] = { "uart1_grp", };
1501 static const char * const uart2_cts_grp0[] = { "uart2_cts_grp0", };
1502 static const char * const uart2_cts_grp1[] = { "uart2_cts_grp1", };
1503 static const char * const uart2_rts_grp0[] = { "uart2_rts_grp0", };
1504 static const char * const uart2_rts_grp1[] = { "uart2_rts_grp1", };
1505 static const char * const uart2_rxd_grp0[] = { "uart2_rxd_grp0", };
1506 static const char * const uart2_rxd_grp1[] = { "uart2_rxd_grp1", };
1507 static const char * const uart2_rxd_grp2[] = { "uart2_rxd_grp2", };
1508 static const char * const uart2_txd_grp0[] = { "uart2_txd_grp0", };
1509 static const char * const uart2_txd_grp1[] = { "uart2_txd_grp1", };
1510 static const char * const uart2_txd_grp2[] = { "uart2_txd_grp2", };
1511 static const char * const uart3_cts_grp0[] = { "uart3_cts_grp0", };
1512 static const char * const uart3_cts_grp1[] = { "uart3_cts_grp1", };
1513 static const char * const uart3_cts_grp2[] = { "uart3_cts_grp2", };
1514 static const char * const uart3_rts_grp0[] = { "uart3_rts_grp0", };
1515 static const char * const uart3_rts_grp1[] = { "uart3_rts_grp1", };
1516 static const char * const uart3_rts_grp2[] = { "uart3_rts_grp2", };
1517 static const char * const uart3_rxd_grp0[] = { "uart3_rxd_grp0", };
1518 static const char * const uart3_rxd_grp1[] = { "uart3_rxd_grp1", };
1519 static const char * const uart3_rxd_grp2[] = { "uart3_rxd_grp2", };
1520 static const char * const uart3_txd_grp0[] = { "uart3_txd_grp0", };
1521 static const char * const uart3_txd_grp1[] = { "uart3_txd_grp1", };
1522 static const char * const uart3_txd_grp2[] = { "uart3_txd_grp2", };
1523 static const char * const uart4_basic_grp[] = { "uart4_basic_grp", };
1524 static const char * const uart4_cts_grp0[] = { "uart4_cts_grp0", };
1525 static const char * const uart4_cts_grp1[] = { "uart4_cts_grp1", };
1526 static const char * const uart4_cts_grp2[] = { "uart4_cts_grp2", };
1527 static const char * const uart4_rts_grp0[] = { "uart4_rts_grp0", };
1528 static const char * const uart4_rts_grp1[] = { "uart4_rts_grp1", };
1529 static const char * const uart4_rts_grp2[] = { "uart4_rts_grp2", };
1530 static const char * const usb0_drvvbus_grp0[] = { "usb0_drvvbus_grp0", };
1531 static const char * const usb0_drvvbus_grp1[] = { "usb0_drvvbus_grp1", };
1532 static const char * const usb1_drvvbus_grp0[] = { "usb1_drvvbus_grp0", };
1533 static const char * const usb1_drvvbus_grp1[] = { "usb1_drvvbus_grp1", };
1534 static const char * const visbus_dout_grp[] = { "visbus_dout_grp", };
1535 static const char * const vi_vip1_grp[] = { "vi_vip1_grp", };
1536 static const char * const vi_vip1_ext_grp[] = { "vi_vip1_ext_grp", };
1537 static const char * const vi_vip1_low8bit_grp[] = { "vi_vip1_low8bit_grp", };
1538 static const char * const vi_vip1_high8bit_grp[] = { "vi_vip1_high8bit_grp", };
1539
1540 static struct atlas7_pad_mux gnss_gpio_grp_pad_mux[] = {
1541         MUX(1, 119, 0, N, N, N, N),
1542         MUX(1, 120, 0, N, N, N, N),
1543         MUX(1, 121, 0, N, N, N, N),
1544         MUX(1, 122, 0, N, N, N, N),
1545         MUX(1, 123, 0, N, N, N, N),
1546         MUX(1, 124, 0, N, N, N, N),
1547         MUX(1, 125, 0, N, N, N, N),
1548         MUX(1, 126, 0, N, N, N, N),
1549         MUX(1, 127, 0, N, N, N, N),
1550         MUX(1, 128, 0, N, N, N, N),
1551         MUX(1, 22, 0, N, N, N, N),
1552         MUX(1, 23, 0, N, N, N, N),
1553         MUX(1, 24, 0, N, N, N, N),
1554         MUX(1, 25, 0, N, N, N, N),
1555         MUX(1, 26, 0, N, N, N, N),
1556         MUX(1, 27, 0, N, N, N, N),
1557         MUX(1, 28, 0, N, N, N, N),
1558         MUX(1, 29, 0, N, N, N, N),
1559         MUX(1, 30, 0, N, N, N, N),
1560 };
1561
1562 static struct atlas7_grp_mux gnss_gpio_grp_mux = {
1563         .pad_mux_count = ARRAY_SIZE(gnss_gpio_grp_pad_mux),
1564         .pad_mux_list = gnss_gpio_grp_pad_mux,
1565 };
1566
1567 static struct atlas7_pad_mux lcd_vip_gpio_grp_pad_mux[] = {
1568         MUX(1, 74, 0, N, N, N, N),
1569         MUX(1, 75, 0, N, N, N, N),
1570         MUX(1, 76, 0, N, N, N, N),
1571         MUX(1, 77, 0, N, N, N, N),
1572         MUX(1, 78, 0, N, N, N, N),
1573         MUX(1, 79, 0, N, N, N, N),
1574         MUX(1, 80, 0, N, N, N, N),
1575         MUX(1, 81, 0, N, N, N, N),
1576         MUX(1, 82, 0, N, N, N, N),
1577         MUX(1, 83, 0, N, N, N, N),
1578         MUX(1, 84, 0, N, N, N, N),
1579         MUX(1, 53, 0, N, N, N, N),
1580         MUX(1, 54, 0, N, N, N, N),
1581         MUX(1, 55, 0, N, N, N, N),
1582         MUX(1, 56, 0, N, N, N, N),
1583         MUX(1, 57, 0, N, N, N, N),
1584         MUX(1, 58, 0, N, N, N, N),
1585         MUX(1, 59, 0, N, N, N, N),
1586         MUX(1, 60, 0, N, N, N, N),
1587         MUX(1, 61, 0, N, N, N, N),
1588         MUX(1, 62, 0, N, N, N, N),
1589         MUX(1, 63, 0, N, N, N, N),
1590         MUX(1, 64, 0, N, N, N, N),
1591         MUX(1, 65, 0, N, N, N, N),
1592         MUX(1, 66, 0, N, N, N, N),
1593         MUX(1, 67, 0, N, N, N, N),
1594         MUX(1, 68, 0, N, N, N, N),
1595         MUX(1, 69, 0, N, N, N, N),
1596         MUX(1, 70, 0, N, N, N, N),
1597         MUX(1, 71, 0, N, N, N, N),
1598         MUX(1, 72, 0, N, N, N, N),
1599         MUX(1, 73, 0, N, N, N, N),
1600 };
1601
1602 static struct atlas7_grp_mux lcd_vip_gpio_grp_mux = {
1603         .pad_mux_count = ARRAY_SIZE(lcd_vip_gpio_grp_pad_mux),
1604         .pad_mux_list = lcd_vip_gpio_grp_pad_mux,
1605 };
1606
1607 static struct atlas7_pad_mux sdio_i2s_gpio_grp_pad_mux[] = {
1608         MUX(1, 31, 0, N, N, N, N),
1609         MUX(1, 32, 0, N, N, N, N),
1610         MUX(1, 33, 0, N, N, N, N),
1611         MUX(1, 34, 0, N, N, N, N),
1612         MUX(1, 35, 0, N, N, N, N),
1613         MUX(1, 36, 0, N, N, N, N),
1614         MUX(1, 85, 0, N, N, N, N),
1615         MUX(1, 86, 0, N, N, N, N),
1616         MUX(1, 87, 0, N, N, N, N),
1617         MUX(1, 88, 0, N, N, N, N),
1618         MUX(1, 89, 0, N, N, N, N),
1619         MUX(1, 90, 0, N, N, N, N),
1620         MUX(1, 129, 0, N, N, N, N),
1621         MUX(1, 130, 0, N, N, N, N),
1622         MUX(1, 131, 0, N, N, N, N),
1623         MUX(1, 132, 0, N, N, N, N),
1624         MUX(1, 91, 0, N, N, N, N),
1625         MUX(1, 92, 0, N, N, N, N),
1626         MUX(1, 93, 0, N, N, N, N),
1627         MUX(1, 94, 0, N, N, N, N),
1628         MUX(1, 95, 0, N, N, N, N),
1629         MUX(1, 96, 0, N, N, N, N),
1630         MUX(1, 112, 0, N, N, N, N),
1631         MUX(1, 113, 0, N, N, N, N),
1632         MUX(1, 114, 0, N, N, N, N),
1633         MUX(1, 115, 0, N, N, N, N),
1634         MUX(1, 116, 0, N, N, N, N),
1635         MUX(1, 117, 0, N, N, N, N),
1636         MUX(1, 118, 0, N, N, N, N),
1637 };
1638
1639 static struct atlas7_grp_mux sdio_i2s_gpio_grp_mux = {
1640         .pad_mux_count = ARRAY_SIZE(sdio_i2s_gpio_grp_pad_mux),
1641         .pad_mux_list = sdio_i2s_gpio_grp_pad_mux,
1642 };
1643
1644 static struct atlas7_pad_mux sp_rgmii_gpio_grp_pad_mux[] = {
1645         MUX(1, 97, 0, N, N, N, N),
1646         MUX(1, 98, 0, N, N, N, N),
1647         MUX(1, 99, 0, N, N, N, N),
1648         MUX(1, 100, 0, N, N, N, N),
1649         MUX(1, 101, 0, N, N, N, N),
1650         MUX(1, 102, 0, N, N, N, N),
1651         MUX(1, 103, 0, N, N, N, N),
1652         MUX(1, 104, 0, N, N, N, N),
1653         MUX(1, 105, 0, N, N, N, N),
1654         MUX(1, 106, 0, N, N, N, N),
1655         MUX(1, 107, 0, N, N, N, N),
1656         MUX(1, 108, 0, N, N, N, N),
1657         MUX(1, 109, 0, N, N, N, N),
1658         MUX(1, 110, 0, N, N, N, N),
1659         MUX(1, 111, 0, N, N, N, N),
1660         MUX(1, 18, 0, N, N, N, N),
1661         MUX(1, 19, 0, N, N, N, N),
1662         MUX(1, 20, 0, N, N, N, N),
1663         MUX(1, 21, 0, N, N, N, N),
1664         MUX(1, 141, 0, N, N, N, N),
1665         MUX(1, 142, 0, N, N, N, N),
1666         MUX(1, 143, 0, N, N, N, N),
1667         MUX(1, 144, 0, N, N, N, N),
1668         MUX(1, 145, 0, N, N, N, N),
1669         MUX(1, 146, 0, N, N, N, N),
1670         MUX(1, 147, 0, N, N, N, N),
1671         MUX(1, 148, 0, N, N, N, N),
1672 };
1673
1674 static struct atlas7_grp_mux sp_rgmii_gpio_grp_mux = {
1675         .pad_mux_count = ARRAY_SIZE(sp_rgmii_gpio_grp_pad_mux),
1676         .pad_mux_list = sp_rgmii_gpio_grp_pad_mux,
1677 };
1678
1679 static struct atlas7_pad_mux lvds_gpio_grp_pad_mux[] = {
1680         MUX(1, 157, 0, N, N, N, N),
1681         MUX(1, 158, 0, N, N, N, N),
1682         MUX(1, 155, 0, N, N, N, N),
1683         MUX(1, 156, 0, N, N, N, N),
1684         MUX(1, 153, 0, N, N, N, N),
1685         MUX(1, 154, 0, N, N, N, N),
1686         MUX(1, 151, 0, N, N, N, N),
1687         MUX(1, 152, 0, N, N, N, N),
1688         MUX(1, 149, 0, N, N, N, N),
1689         MUX(1, 150, 0, N, N, N, N),
1690 };
1691
1692 static struct atlas7_grp_mux lvds_gpio_grp_mux = {
1693         .pad_mux_count = ARRAY_SIZE(lvds_gpio_grp_pad_mux),
1694         .pad_mux_list = lvds_gpio_grp_pad_mux,
1695 };
1696
1697 static struct atlas7_pad_mux jtag_uart_nand_gpio_grp_pad_mux[] = {
1698         MUX(1, 44, 0, N, N, N, N),
1699         MUX(1, 43, 0, N, N, N, N),
1700         MUX(1, 42, 0, N, N, N, N),
1701         MUX(1, 41, 0, N, N, N, N),
1702         MUX(1, 40, 0, N, N, N, N),
1703         MUX(1, 39, 0, N, N, N, N),
1704         MUX(1, 38, 0, N, N, N, N),
1705         MUX(1, 37, 0, N, N, N, N),
1706         MUX(1, 46, 0, N, N, N, N),
1707         MUX(1, 47, 0, N, N, N, N),
1708         MUX(1, 48, 0, N, N, N, N),
1709         MUX(1, 49, 0, N, N, N, N),
1710         MUX(1, 50, 0, N, N, N, N),
1711         MUX(1, 52, 0, N, N, N, N),
1712         MUX(1, 51, 0, N, N, N, N),
1713         MUX(1, 45, 0, N, N, N, N),
1714         MUX(1, 133, 0, N, N, N, N),
1715         MUX(1, 134, 0, N, N, N, N),
1716         MUX(1, 135, 0, N, N, N, N),
1717         MUX(1, 136, 0, N, N, N, N),
1718         MUX(1, 137, 0, N, N, N, N),
1719         MUX(1, 138, 0, N, N, N, N),
1720         MUX(1, 139, 0, N, N, N, N),
1721         MUX(1, 140, 0, N, N, N, N),
1722         MUX(1, 159, 0, N, N, N, N),
1723         MUX(1, 160, 0, N, N, N, N),
1724         MUX(1, 161, 0, N, N, N, N),
1725         MUX(1, 162, 0, N, N, N, N),
1726         MUX(1, 163, 0, N, N, N, N),
1727 };
1728
1729 static struct atlas7_grp_mux jtag_uart_nand_gpio_grp_mux = {
1730         .pad_mux_count = ARRAY_SIZE(jtag_uart_nand_gpio_grp_pad_mux),
1731         .pad_mux_list = jtag_uart_nand_gpio_grp_pad_mux,
1732 };
1733
1734 static struct atlas7_pad_mux rtc_gpio_grp_pad_mux[] = {
1735         MUX(0, 0, 0, N, N, N, N),
1736         MUX(0, 1, 0, N, N, N, N),
1737         MUX(0, 2, 0, N, N, N, N),
1738         MUX(0, 3, 0, N, N, N, N),
1739         MUX(0, 4, 0, N, N, N, N),
1740         MUX(0, 10, 0, N, N, N, N),
1741         MUX(0, 11, 0, N, N, N, N),
1742         MUX(0, 12, 0, N, N, N, N),
1743         MUX(0, 13, 0, N, N, N, N),
1744         MUX(0, 14, 0, N, N, N, N),
1745         MUX(0, 15, 0, N, N, N, N),
1746         MUX(0, 16, 0, N, N, N, N),
1747         MUX(0, 17, 0, N, N, N, N),
1748         MUX(0, 9, 0, N, N, N, N),
1749 };
1750
1751 static struct atlas7_grp_mux rtc_gpio_grp_mux = {
1752         .pad_mux_count = ARRAY_SIZE(rtc_gpio_grp_pad_mux),
1753         .pad_mux_list = rtc_gpio_grp_pad_mux,
1754 };
1755
1756 static struct atlas7_pad_mux audio_ac97_grp_pad_mux[] = {
1757         MUX(1, 113, 2, N, N, N, N),
1758         MUX(1, 118, 2, N, N, N, N),
1759         MUX(1, 115, 2, N, N, N, N),
1760         MUX(1, 114, 2, N, N, N, N),
1761 };
1762
1763 static struct atlas7_grp_mux audio_ac97_grp_mux = {
1764         .pad_mux_count = ARRAY_SIZE(audio_ac97_grp_pad_mux),
1765         .pad_mux_list = audio_ac97_grp_pad_mux,
1766 };
1767
1768 static struct atlas7_pad_mux audio_digmic_grp0_pad_mux[] = {
1769         MUX(1, 51, 3, 0xa10, 20, 0xa90, 20),
1770 };
1771
1772 static struct atlas7_grp_mux audio_digmic_grp0_mux = {
1773         .pad_mux_count = ARRAY_SIZE(audio_digmic_grp0_pad_mux),
1774         .pad_mux_list = audio_digmic_grp0_pad_mux,
1775 };
1776
1777 static struct atlas7_pad_mux audio_digmic_grp1_pad_mux[] = {
1778         MUX(1, 122, 5, 0xa10, 20, 0xa90, 20),
1779 };
1780
1781 static struct atlas7_grp_mux audio_digmic_grp1_mux = {
1782         .pad_mux_count = ARRAY_SIZE(audio_digmic_grp1_pad_mux),
1783         .pad_mux_list = audio_digmic_grp1_pad_mux,
1784 };
1785
1786 static struct atlas7_pad_mux audio_digmic_grp2_pad_mux[] = {
1787         MUX(1, 161, 7, 0xa10, 20, 0xa90, 20),
1788 };
1789
1790 static struct atlas7_grp_mux audio_digmic_grp2_mux = {
1791         .pad_mux_count = ARRAY_SIZE(audio_digmic_grp2_pad_mux),
1792         .pad_mux_list = audio_digmic_grp2_pad_mux,
1793 };
1794
1795 static struct atlas7_pad_mux audio_func_dbg_grp_pad_mux[] = {
1796         MUX(1, 141, 4, N, N, N, N),
1797         MUX(1, 144, 4, N, N, N, N),
1798         MUX(1, 44, 6, N, N, N, N),
1799         MUX(1, 43, 6, N, N, N, N),
1800         MUX(1, 42, 6, N, N, N, N),
1801         MUX(1, 41, 6, N, N, N, N),
1802         MUX(1, 40, 6, N, N, N, N),
1803         MUX(1, 39, 6, N, N, N, N),
1804         MUX(1, 38, 6, N, N, N, N),
1805         MUX(1, 37, 6, N, N, N, N),
1806         MUX(1, 74, 6, N, N, N, N),
1807         MUX(1, 75, 6, N, N, N, N),
1808         MUX(1, 76, 6, N, N, N, N),
1809         MUX(1, 77, 6, N, N, N, N),
1810         MUX(1, 78, 6, N, N, N, N),
1811         MUX(1, 79, 6, N, N, N, N),
1812         MUX(1, 81, 6, N, N, N, N),
1813         MUX(1, 113, 6, N, N, N, N),
1814         MUX(1, 114, 6, N, N, N, N),
1815         MUX(1, 118, 6, N, N, N, N),
1816         MUX(1, 115, 6, N, N, N, N),
1817         MUX(1, 49, 6, N, N, N, N),
1818         MUX(1, 50, 6, N, N, N, N),
1819         MUX(1, 142, 4, N, N, N, N),
1820         MUX(1, 143, 4, N, N, N, N),
1821         MUX(1, 80, 6, N, N, N, N),
1822 };
1823
1824 static struct atlas7_grp_mux audio_func_dbg_grp_mux = {
1825         .pad_mux_count = ARRAY_SIZE(audio_func_dbg_grp_pad_mux),
1826         .pad_mux_list = audio_func_dbg_grp_pad_mux,
1827 };
1828
1829 static struct atlas7_pad_mux audio_i2s_grp_pad_mux[] = {
1830         MUX(1, 118, 1, N, N, N, N),
1831         MUX(1, 115, 1, N, N, N, N),
1832         MUX(1, 116, 1, N, N, N, N),
1833         MUX(1, 117, 1, N, N, N, N),
1834         MUX(1, 112, 1, N, N, N, N),
1835         MUX(1, 113, 1, N, N, N, N),
1836         MUX(1, 114, 1, N, N, N, N),
1837 };
1838
1839 static struct atlas7_grp_mux audio_i2s_grp_mux = {
1840         .pad_mux_count = ARRAY_SIZE(audio_i2s_grp_pad_mux),
1841         .pad_mux_list = audio_i2s_grp_pad_mux,
1842 };
1843
1844 static struct atlas7_pad_mux audio_i2s_2ch_grp_pad_mux[] = {
1845         MUX(1, 118, 1, N, N, N, N),
1846         MUX(1, 115, 1, N, N, N, N),
1847         MUX(1, 112, 1, N, N, N, N),
1848         MUX(1, 113, 1, N, N, N, N),
1849         MUX(1, 114, 1, N, N, N, N),
1850 };
1851
1852 static struct atlas7_grp_mux audio_i2s_2ch_grp_mux = {
1853         .pad_mux_count = ARRAY_SIZE(audio_i2s_2ch_grp_pad_mux),
1854         .pad_mux_list = audio_i2s_2ch_grp_pad_mux,
1855 };
1856
1857 static struct atlas7_pad_mux audio_i2s_extclk_grp_pad_mux[] = {
1858         MUX(1, 112, 2, N, N, N, N),
1859 };
1860
1861 static struct atlas7_grp_mux audio_i2s_extclk_grp_mux = {
1862         .pad_mux_count = ARRAY_SIZE(audio_i2s_extclk_grp_pad_mux),
1863         .pad_mux_list = audio_i2s_extclk_grp_pad_mux,
1864 };
1865
1866 static struct atlas7_pad_mux audio_spdif_out_grp0_pad_mux[] = {
1867         MUX(1, 112, 3, N, N, N, N),
1868 };
1869
1870 static struct atlas7_grp_mux audio_spdif_out_grp0_mux = {
1871         .pad_mux_count = ARRAY_SIZE(audio_spdif_out_grp0_pad_mux),
1872         .pad_mux_list = audio_spdif_out_grp0_pad_mux,
1873 };
1874
1875 static struct atlas7_pad_mux audio_spdif_out_grp1_pad_mux[] = {
1876         MUX(1, 116, 3, N, N, N, N),
1877 };
1878
1879 static struct atlas7_grp_mux audio_spdif_out_grp1_mux = {
1880         .pad_mux_count = ARRAY_SIZE(audio_spdif_out_grp1_pad_mux),
1881         .pad_mux_list = audio_spdif_out_grp1_pad_mux,
1882 };
1883
1884 static struct atlas7_pad_mux audio_spdif_out_grp2_pad_mux[] = {
1885         MUX(1, 142, 3, N, N, N, N),
1886 };
1887
1888 static struct atlas7_grp_mux audio_spdif_out_grp2_mux = {
1889         .pad_mux_count = ARRAY_SIZE(audio_spdif_out_grp2_pad_mux),
1890         .pad_mux_list = audio_spdif_out_grp2_pad_mux,
1891 };
1892
1893 static struct atlas7_pad_mux audio_uart0_basic_grp_pad_mux[] = {
1894         MUX(1, 143, 1, N, N, N, N),
1895         MUX(1, 142, 1, N, N, N, N),
1896         MUX(1, 141, 1, N, N, N, N),
1897         MUX(1, 144, 1, N, N, N, N),
1898 };
1899
1900 static struct atlas7_grp_mux audio_uart0_basic_grp_mux = {
1901         .pad_mux_count = ARRAY_SIZE(audio_uart0_basic_grp_pad_mux),
1902         .pad_mux_list = audio_uart0_basic_grp_pad_mux,
1903 };
1904
1905 static struct atlas7_pad_mux audio_uart0_urfs_grp0_pad_mux[] = {
1906         MUX(1, 117, 5, 0xa10, 28, 0xa90, 28),
1907 };
1908
1909 static struct atlas7_grp_mux audio_uart0_urfs_grp0_mux = {
1910         .pad_mux_count = ARRAY_SIZE(audio_uart0_urfs_grp0_pad_mux),
1911         .pad_mux_list = audio_uart0_urfs_grp0_pad_mux,
1912 };
1913
1914 static struct atlas7_pad_mux audio_uart0_urfs_grp1_pad_mux[] = {
1915         MUX(1, 139, 3, 0xa10, 28, 0xa90, 28),
1916 };
1917
1918 static struct atlas7_grp_mux audio_uart0_urfs_grp1_mux = {
1919         .pad_mux_count = ARRAY_SIZE(audio_uart0_urfs_grp1_pad_mux),
1920         .pad_mux_list = audio_uart0_urfs_grp1_pad_mux,
1921 };
1922
1923 static struct atlas7_pad_mux audio_uart0_urfs_grp2_pad_mux[] = {
1924         MUX(1, 163, 3, 0xa10, 28, 0xa90, 28),
1925 };
1926
1927 static struct atlas7_grp_mux audio_uart0_urfs_grp2_mux = {
1928         .pad_mux_count = ARRAY_SIZE(audio_uart0_urfs_grp2_pad_mux),
1929         .pad_mux_list = audio_uart0_urfs_grp2_pad_mux,
1930 };
1931
1932 static struct atlas7_pad_mux audio_uart0_urfs_grp3_pad_mux[] = {
1933         MUX(1, 162, 6, 0xa10, 28, 0xa90, 28),
1934 };
1935
1936 static struct atlas7_grp_mux audio_uart0_urfs_grp3_mux = {
1937         .pad_mux_count = ARRAY_SIZE(audio_uart0_urfs_grp3_pad_mux),
1938         .pad_mux_list = audio_uart0_urfs_grp3_pad_mux,
1939 };
1940
1941 static struct atlas7_pad_mux audio_uart1_basic_grp_pad_mux[] = {
1942         MUX(1, 147, 1, 0xa10, 24, 0xa90, 24),
1943         MUX(1, 146, 1, 0xa10, 25, 0xa90, 25),
1944         MUX(1, 145, 1, 0xa10, 23, 0xa90, 23),
1945         MUX(1, 148, 1, 0xa10, 22, 0xa90, 22),
1946 };
1947
1948 static struct atlas7_grp_mux audio_uart1_basic_grp_mux = {
1949         .pad_mux_count = ARRAY_SIZE(audio_uart1_basic_grp_pad_mux),
1950         .pad_mux_list = audio_uart1_basic_grp_pad_mux,
1951 };
1952
1953 static struct atlas7_pad_mux audio_uart1_urfs_grp0_pad_mux[] = {
1954         MUX(1, 117, 6, 0xa10, 29, 0xa90, 29),
1955 };
1956
1957 static struct atlas7_grp_mux audio_uart1_urfs_grp0_mux = {
1958         .pad_mux_count = ARRAY_SIZE(audio_uart1_urfs_grp0_pad_mux),
1959         .pad_mux_list = audio_uart1_urfs_grp0_pad_mux,
1960 };
1961
1962 static struct atlas7_pad_mux audio_uart1_urfs_grp1_pad_mux[] = {
1963         MUX(1, 140, 3, 0xa10, 29, 0xa90, 29),
1964 };
1965
1966 static struct atlas7_grp_mux audio_uart1_urfs_grp1_mux = {
1967         .pad_mux_count = ARRAY_SIZE(audio_uart1_urfs_grp1_pad_mux),
1968         .pad_mux_list = audio_uart1_urfs_grp1_pad_mux,
1969 };
1970
1971 static struct atlas7_pad_mux audio_uart1_urfs_grp2_pad_mux[] = {
1972         MUX(1, 163, 4, 0xa10, 29, 0xa90, 29),
1973 };
1974
1975 static struct atlas7_grp_mux audio_uart1_urfs_grp2_mux = {
1976         .pad_mux_count = ARRAY_SIZE(audio_uart1_urfs_grp2_pad_mux),
1977         .pad_mux_list = audio_uart1_urfs_grp2_pad_mux,
1978 };
1979
1980 static struct atlas7_pad_mux audio_uart2_urfs_grp0_pad_mux[] = {
1981         MUX(1, 139, 4, 0xa10, 30, 0xa90, 30),
1982 };
1983
1984 static struct atlas7_grp_mux audio_uart2_urfs_grp0_mux = {
1985         .pad_mux_count = ARRAY_SIZE(audio_uart2_urfs_grp0_pad_mux),
1986         .pad_mux_list = audio_uart2_urfs_grp0_pad_mux,
1987 };
1988
1989 static struct atlas7_pad_mux audio_uart2_urfs_grp1_pad_mux[] = {
1990         MUX(1, 163, 6, 0xa10, 30, 0xa90, 30),
1991 };
1992
1993 static struct atlas7_grp_mux audio_uart2_urfs_grp1_mux = {
1994         .pad_mux_count = ARRAY_SIZE(audio_uart2_urfs_grp1_pad_mux),
1995         .pad_mux_list = audio_uart2_urfs_grp1_pad_mux,
1996 };
1997
1998 static struct atlas7_pad_mux audio_uart2_urfs_grp2_pad_mux[] = {
1999         MUX(1, 96, 3, 0xa10, 30, 0xa90, 30),
2000 };
2001
2002 static struct atlas7_grp_mux audio_uart2_urfs_grp2_mux = {
2003         .pad_mux_count = ARRAY_SIZE(audio_uart2_urfs_grp2_pad_mux),
2004         .pad_mux_list = audio_uart2_urfs_grp2_pad_mux,
2005 };
2006
2007 static struct atlas7_pad_mux audio_uart2_urxd_grp0_pad_mux[] = {
2008         MUX(1, 20, 2, 0xa00, 24, 0xa80, 24),
2009 };
2010
2011 static struct atlas7_grp_mux audio_uart2_urxd_grp0_mux = {
2012         .pad_mux_count = ARRAY_SIZE(audio_uart2_urxd_grp0_pad_mux),
2013         .pad_mux_list = audio_uart2_urxd_grp0_pad_mux,
2014 };
2015
2016 static struct atlas7_pad_mux audio_uart2_urxd_grp1_pad_mux[] = {
2017         MUX(1, 109, 2, 0xa00, 24, 0xa80, 24),
2018 };
2019
2020 static struct atlas7_grp_mux audio_uart2_urxd_grp1_mux = {
2021         .pad_mux_count = ARRAY_SIZE(audio_uart2_urxd_grp1_pad_mux),
2022         .pad_mux_list = audio_uart2_urxd_grp1_pad_mux,
2023 };
2024
2025 static struct atlas7_pad_mux audio_uart2_urxd_grp2_pad_mux[] = {
2026         MUX(1, 93, 3, 0xa00, 24, 0xa80, 24),
2027 };
2028
2029 static struct atlas7_grp_mux audio_uart2_urxd_grp2_mux = {
2030         .pad_mux_count = ARRAY_SIZE(audio_uart2_urxd_grp2_pad_mux),
2031         .pad_mux_list = audio_uart2_urxd_grp2_pad_mux,
2032 };
2033
2034 static struct atlas7_pad_mux audio_uart2_usclk_grp0_pad_mux[] = {
2035         MUX(1, 19, 2, 0xa00, 23, 0xa80, 23),
2036 };
2037
2038 static struct atlas7_grp_mux audio_uart2_usclk_grp0_mux = {
2039         .pad_mux_count = ARRAY_SIZE(audio_uart2_usclk_grp0_pad_mux),
2040         .pad_mux_list = audio_uart2_usclk_grp0_pad_mux,
2041 };
2042
2043 static struct atlas7_pad_mux audio_uart2_usclk_grp1_pad_mux[] = {
2044         MUX(1, 101, 2, 0xa00, 23, 0xa80, 23),
2045 };
2046
2047 static struct atlas7_grp_mux audio_uart2_usclk_grp1_mux = {
2048         .pad_mux_count = ARRAY_SIZE(audio_uart2_usclk_grp1_pad_mux),
2049         .pad_mux_list = audio_uart2_usclk_grp1_pad_mux,
2050 };
2051
2052 static struct atlas7_pad_mux audio_uart2_usclk_grp2_pad_mux[] = {
2053         MUX(1, 91, 3, 0xa00, 23, 0xa80, 23),
2054 };
2055
2056 static struct atlas7_grp_mux audio_uart2_usclk_grp2_mux = {
2057         .pad_mux_count = ARRAY_SIZE(audio_uart2_usclk_grp2_pad_mux),
2058         .pad_mux_list = audio_uart2_usclk_grp2_pad_mux,
2059 };
2060
2061 static struct atlas7_pad_mux audio_uart2_utfs_grp0_pad_mux[] = {
2062         MUX(1, 18, 2, 0xa00, 22, 0xa80, 22),
2063 };
2064
2065 static struct atlas7_grp_mux audio_uart2_utfs_grp0_mux = {
2066         .pad_mux_count = ARRAY_SIZE(audio_uart2_utfs_grp0_pad_mux),
2067         .pad_mux_list = audio_uart2_utfs_grp0_pad_mux,
2068 };
2069
2070 static struct atlas7_pad_mux audio_uart2_utfs_grp1_pad_mux[] = {
2071         MUX(1, 111, 2, 0xa00, 22, 0xa80, 22),
2072 };
2073
2074 static struct atlas7_grp_mux audio_uart2_utfs_grp1_mux = {
2075         .pad_mux_count = ARRAY_SIZE(audio_uart2_utfs_grp1_pad_mux),
2076         .pad_mux_list = audio_uart2_utfs_grp1_pad_mux,
2077 };
2078
2079 static struct atlas7_pad_mux audio_uart2_utfs_grp2_pad_mux[] = {
2080         MUX(1, 94, 3, 0xa00, 22, 0xa80, 22),
2081 };
2082
2083 static struct atlas7_grp_mux audio_uart2_utfs_grp2_mux = {
2084         .pad_mux_count = ARRAY_SIZE(audio_uart2_utfs_grp2_pad_mux),
2085         .pad_mux_list = audio_uart2_utfs_grp2_pad_mux,
2086 };
2087
2088 static struct atlas7_pad_mux audio_uart2_utxd_grp0_pad_mux[] = {
2089         MUX(1, 21, 2, 0xa00, 25, 0xa80, 25),
2090 };
2091
2092 static struct atlas7_grp_mux audio_uart2_utxd_grp0_mux = {
2093         .pad_mux_count = ARRAY_SIZE(audio_uart2_utxd_grp0_pad_mux),
2094         .pad_mux_list = audio_uart2_utxd_grp0_pad_mux,
2095 };
2096
2097 static struct atlas7_pad_mux audio_uart2_utxd_grp1_pad_mux[] = {
2098         MUX(1, 110, 2, 0xa00, 25, 0xa80, 25),
2099 };
2100
2101 static struct atlas7_grp_mux audio_uart2_utxd_grp1_mux = {
2102         .pad_mux_count = ARRAY_SIZE(audio_uart2_utxd_grp1_pad_mux),
2103         .pad_mux_list = audio_uart2_utxd_grp1_pad_mux,
2104 };
2105
2106 static struct atlas7_pad_mux audio_uart2_utxd_grp2_pad_mux[] = {
2107         MUX(1, 92, 3, 0xa00, 25, 0xa80, 25),
2108 };
2109
2110 static struct atlas7_grp_mux audio_uart2_utxd_grp2_mux = {
2111         .pad_mux_count = ARRAY_SIZE(audio_uart2_utxd_grp2_pad_mux),
2112         .pad_mux_list = audio_uart2_utxd_grp2_pad_mux,
2113 };
2114
2115 static struct atlas7_pad_mux c_can_trnsvr_en_grp0_pad_mux[] = {
2116         MUX(0, 2, 6, N, N, N, N),
2117 };
2118
2119 static struct atlas7_grp_mux c_can_trnsvr_en_grp0_mux = {
2120         .pad_mux_count = ARRAY_SIZE(c_can_trnsvr_en_grp0_pad_mux),
2121         .pad_mux_list = c_can_trnsvr_en_grp0_pad_mux,
2122 };
2123
2124 static struct atlas7_pad_mux c_can_trnsvr_en_grp1_pad_mux[] = {
2125         MUX(0, 0, 2, N, N, N, N),
2126 };
2127
2128 static struct atlas7_grp_mux c_can_trnsvr_en_grp1_mux = {
2129         .pad_mux_count = ARRAY_SIZE(c_can_trnsvr_en_grp1_pad_mux),
2130         .pad_mux_list = c_can_trnsvr_en_grp1_pad_mux,
2131 };
2132
2133 static struct atlas7_pad_mux c_can_trnsvr_intr_grp_pad_mux[] = {
2134         MUX(0, 1, 2, N, N, N, N),
2135 };
2136
2137 static struct atlas7_grp_mux c_can_trnsvr_intr_grp_mux = {
2138         .pad_mux_count = ARRAY_SIZE(c_can_trnsvr_intr_grp_pad_mux),
2139         .pad_mux_list = c_can_trnsvr_intr_grp_pad_mux,
2140 };
2141
2142 static struct atlas7_pad_mux c_can_trnsvr_stb_n_grp_pad_mux[] = {
2143         MUX(0, 3, 6, N, N, N, N),
2144 };
2145
2146 static struct atlas7_grp_mux c_can_trnsvr_stb_n_grp_mux = {
2147         .pad_mux_count = ARRAY_SIZE(c_can_trnsvr_stb_n_grp_pad_mux),
2148         .pad_mux_list = c_can_trnsvr_stb_n_grp_pad_mux,
2149 };
2150
2151 static struct atlas7_pad_mux c0_can_rxd_trnsv0_grp_pad_mux[] = {
2152         MUX(0, 11, 1, 0xa08, 9, 0xa88, 9),
2153 };
2154
2155 static struct atlas7_grp_mux c0_can_rxd_trnsv0_grp_mux = {
2156         .pad_mux_count = ARRAY_SIZE(c0_can_rxd_trnsv0_grp_pad_mux),
2157         .pad_mux_list = c0_can_rxd_trnsv0_grp_pad_mux,
2158 };
2159
2160 static struct atlas7_pad_mux c0_can_rxd_trnsv1_grp_pad_mux[] = {
2161         MUX(0, 2, 5, 0xa10, 9, 0xa90, 9),
2162 };
2163
2164 static struct atlas7_grp_mux c0_can_rxd_trnsv1_grp_mux = {
2165         .pad_mux_count = ARRAY_SIZE(c0_can_rxd_trnsv1_grp_pad_mux),
2166         .pad_mux_list = c0_can_rxd_trnsv1_grp_pad_mux,
2167 };
2168
2169 static struct atlas7_pad_mux c0_can_txd_trnsv0_grp_pad_mux[] = {
2170         MUX(0, 10, 1, N, N, N, N),
2171 };
2172
2173 static struct atlas7_grp_mux c0_can_txd_trnsv0_grp_mux = {
2174         .pad_mux_count = ARRAY_SIZE(c0_can_txd_trnsv0_grp_pad_mux),
2175         .pad_mux_list = c0_can_txd_trnsv0_grp_pad_mux,
2176 };
2177
2178 static struct atlas7_pad_mux c0_can_txd_trnsv1_grp_pad_mux[] = {
2179         MUX(0, 3, 5, N, N, N, N),
2180 };
2181
2182 static struct atlas7_grp_mux c0_can_txd_trnsv1_grp_mux = {
2183         .pad_mux_count = ARRAY_SIZE(c0_can_txd_trnsv1_grp_pad_mux),
2184         .pad_mux_list = c0_can_txd_trnsv1_grp_pad_mux,
2185 };
2186
2187 static struct atlas7_pad_mux c1_can_rxd_grp0_pad_mux[] = {
2188         MUX(1, 138, 2, 0xa00, 4, 0xa80, 4),
2189 };
2190
2191 static struct atlas7_grp_mux c1_can_rxd_grp0_mux = {
2192         .pad_mux_count = ARRAY_SIZE(c1_can_rxd_grp0_pad_mux),
2193         .pad_mux_list = c1_can_rxd_grp0_pad_mux,
2194 };
2195
2196 static struct atlas7_pad_mux c1_can_rxd_grp1_pad_mux[] = {
2197         MUX(1, 147, 2, 0xa00, 4, 0xa80, 4),
2198 };
2199
2200 static struct atlas7_grp_mux c1_can_rxd_grp1_mux = {
2201         .pad_mux_count = ARRAY_SIZE(c1_can_rxd_grp1_pad_mux),
2202         .pad_mux_list = c1_can_rxd_grp1_pad_mux,
2203 };
2204
2205 static struct atlas7_pad_mux c1_can_rxd_grp2_pad_mux[] = {
2206         MUX(0, 2, 2, 0xa00, 4, 0xa80, 4),
2207 };
2208
2209 static struct atlas7_grp_mux c1_can_rxd_grp2_mux = {
2210         .pad_mux_count = ARRAY_SIZE(c1_can_rxd_grp2_pad_mux),
2211         .pad_mux_list = c1_can_rxd_grp2_pad_mux,
2212 };
2213
2214 static struct atlas7_pad_mux c1_can_rxd_grp3_pad_mux[] = {
2215         MUX(1, 162, 4, 0xa00, 4, 0xa80, 4),
2216 };
2217
2218 static struct atlas7_grp_mux c1_can_rxd_grp3_mux = {
2219         .pad_mux_count = ARRAY_SIZE(c1_can_rxd_grp3_pad_mux),
2220         .pad_mux_list = c1_can_rxd_grp3_pad_mux,
2221 };
2222
2223 static struct atlas7_pad_mux c1_can_txd_grp0_pad_mux[] = {
2224         MUX(1, 137, 2, N, N, N, N),
2225 };
2226
2227 static struct atlas7_grp_mux c1_can_txd_grp0_mux = {
2228         .pad_mux_count = ARRAY_SIZE(c1_can_txd_grp0_pad_mux),
2229         .pad_mux_list = c1_can_txd_grp0_pad_mux,
2230 };
2231
2232 static struct atlas7_pad_mux c1_can_txd_grp1_pad_mux[] = {
2233         MUX(1, 146, 2, N, N, N, N),
2234 };
2235
2236 static struct atlas7_grp_mux c1_can_txd_grp1_mux = {
2237         .pad_mux_count = ARRAY_SIZE(c1_can_txd_grp1_pad_mux),
2238         .pad_mux_list = c1_can_txd_grp1_pad_mux,
2239 };
2240
2241 static struct atlas7_pad_mux c1_can_txd_grp2_pad_mux[] = {
2242         MUX(0, 3, 2, N, N, N, N),
2243 };
2244
2245 static struct atlas7_grp_mux c1_can_txd_grp2_mux = {
2246         .pad_mux_count = ARRAY_SIZE(c1_can_txd_grp2_pad_mux),
2247         .pad_mux_list = c1_can_txd_grp2_pad_mux,
2248 };
2249
2250 static struct atlas7_pad_mux c1_can_txd_grp3_pad_mux[] = {
2251         MUX(1, 161, 4, N, N, N, N),
2252 };
2253
2254 static struct atlas7_grp_mux c1_can_txd_grp3_mux = {
2255         .pad_mux_count = ARRAY_SIZE(c1_can_txd_grp3_pad_mux),
2256         .pad_mux_list = c1_can_txd_grp3_pad_mux,
2257 };
2258
2259 static struct atlas7_pad_mux ca_audio_lpc_grp_pad_mux[] = {
2260         MUX(1, 62, 4, N, N, N, N),
2261         MUX(1, 63, 4, N, N, N, N),
2262         MUX(1, 64, 4, N, N, N, N),
2263         MUX(1, 65, 4, N, N, N, N),
2264         MUX(1, 66, 4, N, N, N, N),
2265         MUX(1, 67, 4, N, N, N, N),
2266         MUX(1, 68, 4, N, N, N, N),
2267         MUX(1, 69, 4, N, N, N, N),
2268         MUX(1, 70, 4, N, N, N, N),
2269         MUX(1, 71, 4, N, N, N, N),
2270 };
2271
2272 static struct atlas7_grp_mux ca_audio_lpc_grp_mux = {
2273         .pad_mux_count = ARRAY_SIZE(ca_audio_lpc_grp_pad_mux),
2274         .pad_mux_list = ca_audio_lpc_grp_pad_mux,
2275 };
2276
2277 static struct atlas7_pad_mux ca_bt_lpc_grp_pad_mux[] = {
2278         MUX(1, 85, 5, N, N, N, N),
2279         MUX(1, 86, 5, N, N, N, N),
2280         MUX(1, 87, 5, N, N, N, N),
2281         MUX(1, 88, 5, N, N, N, N),
2282         MUX(1, 89, 5, N, N, N, N),
2283         MUX(1, 90, 5, N, N, N, N),
2284 };
2285
2286 static struct atlas7_grp_mux ca_bt_lpc_grp_mux = {
2287         .pad_mux_count = ARRAY_SIZE(ca_bt_lpc_grp_pad_mux),
2288         .pad_mux_list = ca_bt_lpc_grp_pad_mux,
2289 };
2290
2291 static struct atlas7_pad_mux ca_coex_grp_pad_mux[] = {
2292         MUX(1, 129, 1, N, N, N, N),
2293         MUX(1, 130, 1, N, N, N, N),
2294         MUX(1, 131, 1, N, N, N, N),
2295         MUX(1, 132, 1, N, N, N, N),
2296 };
2297
2298 static struct atlas7_grp_mux ca_coex_grp_mux = {
2299         .pad_mux_count = ARRAY_SIZE(ca_coex_grp_pad_mux),
2300         .pad_mux_list = ca_coex_grp_pad_mux,
2301 };
2302
2303 static struct atlas7_pad_mux ca_curator_lpc_grp_pad_mux[] = {
2304         MUX(1, 57, 4, N, N, N, N),
2305         MUX(1, 58, 4, N, N, N, N),
2306         MUX(1, 59, 4, N, N, N, N),
2307         MUX(1, 60, 4, N, N, N, N),
2308 };
2309
2310 static struct atlas7_grp_mux ca_curator_lpc_grp_mux = {
2311         .pad_mux_count = ARRAY_SIZE(ca_curator_lpc_grp_pad_mux),
2312         .pad_mux_list = ca_curator_lpc_grp_pad_mux,
2313 };
2314
2315 static struct atlas7_pad_mux ca_pcm_debug_grp_pad_mux[] = {
2316         MUX(1, 91, 5, N, N, N, N),
2317         MUX(1, 93, 5, N, N, N, N),
2318         MUX(1, 94, 5, N, N, N, N),
2319         MUX(1, 92, 5, N, N, N, N),
2320 };
2321
2322 static struct atlas7_grp_mux ca_pcm_debug_grp_mux = {
2323         .pad_mux_count = ARRAY_SIZE(ca_pcm_debug_grp_pad_mux),
2324         .pad_mux_list = ca_pcm_debug_grp_pad_mux,
2325 };
2326
2327 static struct atlas7_pad_mux ca_pio_grp_pad_mux[] = {
2328         MUX(1, 121, 2, N, N, N, N),
2329         MUX(1, 122, 2, N, N, N, N),
2330         MUX(1, 125, 6, N, N, N, N),
2331         MUX(1, 126, 6, N, N, N, N),
2332         MUX(1, 38, 5, N, N, N, N),
2333         MUX(1, 37, 5, N, N, N, N),
2334         MUX(1, 47, 5, N, N, N, N),
2335         MUX(1, 49, 5, N, N, N, N),
2336         MUX(1, 50, 5, N, N, N, N),
2337         MUX(1, 54, 4, N, N, N, N),
2338         MUX(1, 55, 4, N, N, N, N),
2339         MUX(1, 56, 4, N, N, N, N),
2340 };
2341
2342 static struct atlas7_grp_mux ca_pio_grp_mux = {
2343         .pad_mux_count = ARRAY_SIZE(ca_pio_grp_pad_mux),
2344         .pad_mux_list = ca_pio_grp_pad_mux,
2345 };
2346
2347 static struct atlas7_pad_mux ca_sdio_debug_grp_pad_mux[] = {
2348         MUX(1, 40, 5, N, N, N, N),
2349         MUX(1, 39, 5, N, N, N, N),
2350         MUX(1, 44, 5, N, N, N, N),
2351         MUX(1, 43, 5, N, N, N, N),
2352         MUX(1, 42, 5, N, N, N, N),
2353         MUX(1, 41, 5, N, N, N, N),
2354 };
2355
2356 static struct atlas7_grp_mux ca_sdio_debug_grp_mux = {
2357         .pad_mux_count = ARRAY_SIZE(ca_sdio_debug_grp_pad_mux),
2358         .pad_mux_list = ca_sdio_debug_grp_pad_mux,
2359 };
2360
2361 static struct atlas7_pad_mux ca_spi_grp_pad_mux[] = {
2362         MUX(1, 82, 5, N, N, N, N),
2363         MUX(1, 79, 5, 0xa08, 6, 0xa88, 6),
2364         MUX(1, 80, 5, N, N, N, N),
2365         MUX(1, 81, 5, N, N, N, N),
2366 };
2367
2368 static struct atlas7_grp_mux ca_spi_grp_mux = {
2369         .pad_mux_count = ARRAY_SIZE(ca_spi_grp_pad_mux),
2370         .pad_mux_list = ca_spi_grp_pad_mux,
2371 };
2372
2373 static struct atlas7_pad_mux ca_trb_grp_pad_mux[] = {
2374         MUX(1, 91, 4, N, N, N, N),
2375         MUX(1, 93, 4, N, N, N, N),
2376         MUX(1, 94, 4, N, N, N, N),
2377         MUX(1, 95, 4, N, N, N, N),
2378         MUX(1, 96, 4, N, N, N, N),
2379         MUX(1, 78, 5, N, N, N, N),
2380         MUX(1, 74, 5, N, N, N, N),
2381         MUX(1, 75, 5, N, N, N, N),
2382         MUX(1, 76, 5, N, N, N, N),
2383         MUX(1, 77, 5, N, N, N, N),
2384 };
2385
2386 static struct atlas7_grp_mux ca_trb_grp_mux = {
2387         .pad_mux_count = ARRAY_SIZE(ca_trb_grp_pad_mux),
2388         .pad_mux_list = ca_trb_grp_pad_mux,
2389 };
2390
2391 static struct atlas7_pad_mux ca_uart_debug_grp_pad_mux[] = {
2392         MUX(1, 136, 3, N, N, N, N),
2393         MUX(1, 135, 3, N, N, N, N),
2394         MUX(1, 134, 3, N, N, N, N),
2395         MUX(1, 133, 3, N, N, N, N),
2396 };
2397
2398 static struct atlas7_grp_mux ca_uart_debug_grp_mux = {
2399         .pad_mux_count = ARRAY_SIZE(ca_uart_debug_grp_pad_mux),
2400         .pad_mux_list = ca_uart_debug_grp_pad_mux,
2401 };
2402
2403 static struct atlas7_pad_mux clkc_grp0_pad_mux[] = {
2404         MUX(1, 30, 2, 0xa08, 14, 0xa88, 14),
2405         MUX(1, 47, 6, N, N, N, N),
2406 };
2407
2408 static struct atlas7_grp_mux clkc_grp0_mux = {
2409         .pad_mux_count = ARRAY_SIZE(clkc_grp0_pad_mux),
2410         .pad_mux_list = clkc_grp0_pad_mux,
2411 };
2412
2413 static struct atlas7_pad_mux clkc_grp1_pad_mux[] = {
2414         MUX(1, 78, 3, 0xa08, 14, 0xa88, 14),
2415         MUX(1, 54, 5, N, N, N, N),
2416 };
2417
2418 static struct atlas7_grp_mux clkc_grp1_mux = {
2419         .pad_mux_count = ARRAY_SIZE(clkc_grp1_pad_mux),
2420         .pad_mux_list = clkc_grp1_pad_mux,
2421 };
2422
2423 static struct atlas7_pad_mux gn_gnss_i2c_grp_pad_mux[] = {
2424         MUX(1, 128, 2, N, N, N, N),
2425         MUX(1, 127, 2, N, N, N, N),
2426 };
2427
2428 static struct atlas7_grp_mux gn_gnss_i2c_grp_mux = {
2429         .pad_mux_count = ARRAY_SIZE(gn_gnss_i2c_grp_pad_mux),
2430         .pad_mux_list = gn_gnss_i2c_grp_pad_mux,
2431 };
2432
2433 static struct atlas7_pad_mux gn_gnss_uart_nopause_grp_pad_mux[] = {
2434         MUX(1, 134, 4, N, N, N, N),
2435         MUX(1, 133, 4, N, N, N, N),
2436 };
2437
2438 static struct atlas7_grp_mux gn_gnss_uart_nopause_grp_mux = {
2439         .pad_mux_count = ARRAY_SIZE(gn_gnss_uart_nopause_grp_pad_mux),
2440         .pad_mux_list = gn_gnss_uart_nopause_grp_pad_mux,
2441 };
2442
2443 static struct atlas7_pad_mux gn_gnss_uart_grp_pad_mux[] = {
2444         MUX(1, 134, 4, N, N, N, N),
2445         MUX(1, 133, 4, N, N, N, N),
2446         MUX(1, 136, 4, N, N, N, N),
2447         MUX(1, 135, 4, N, N, N, N),
2448 };
2449
2450 static struct atlas7_grp_mux gn_gnss_uart_grp_mux = {
2451         .pad_mux_count = ARRAY_SIZE(gn_gnss_uart_grp_pad_mux),
2452         .pad_mux_list = gn_gnss_uart_grp_pad_mux,
2453 };
2454
2455 static struct atlas7_pad_mux gn_trg_spi_grp0_pad_mux[] = {
2456         MUX(1, 22, 1, N, N, N, N),
2457         MUX(1, 25, 1, N, N, N, N),
2458         MUX(1, 23, 1, 0xa00, 10, 0xa80, 10),
2459         MUX(1, 24, 1, N, N, N, N),
2460 };
2461
2462 static struct atlas7_grp_mux gn_trg_spi_grp0_mux = {
2463         .pad_mux_count = ARRAY_SIZE(gn_trg_spi_grp0_pad_mux),
2464         .pad_mux_list = gn_trg_spi_grp0_pad_mux,
2465 };
2466
2467 static struct atlas7_pad_mux gn_trg_spi_grp1_pad_mux[] = {
2468         MUX(1, 82, 3, N, N, N, N),
2469         MUX(1, 79, 3, N, N, N, N),
2470         MUX(1, 80, 3, 0xa00, 10, 0xa80, 10),
2471         MUX(1, 81, 3, N, N, N, N),
2472 };
2473
2474 static struct atlas7_grp_mux gn_trg_spi_grp1_mux = {
2475         .pad_mux_count = ARRAY_SIZE(gn_trg_spi_grp1_pad_mux),
2476         .pad_mux_list = gn_trg_spi_grp1_pad_mux,
2477 };
2478
2479 static struct atlas7_pad_mux cvbs_dbg_grp_pad_mux[] = {
2480         MUX(1, 54, 3, N, N, N, N),
2481         MUX(1, 53, 3, N, N, N, N),
2482         MUX(1, 82, 7, N, N, N, N),
2483         MUX(1, 74, 7, N, N, N, N),
2484         MUX(1, 75, 7, N, N, N, N),
2485         MUX(1, 76, 7, N, N, N, N),
2486         MUX(1, 77, 7, N, N, N, N),
2487         MUX(1, 78, 7, N, N, N, N),
2488         MUX(1, 79, 7, N, N, N, N),
2489         MUX(1, 80, 7, N, N, N, N),
2490         MUX(1, 81, 7, N, N, N, N),
2491         MUX(1, 83, 7, N, N, N, N),
2492         MUX(1, 84, 7, N, N, N, N),
2493         MUX(1, 73, 3, N, N, N, N),
2494         MUX(1, 55, 3, N, N, N, N),
2495         MUX(1, 56, 3, N, N, N, N),
2496 };
2497
2498 static struct atlas7_grp_mux cvbs_dbg_grp_mux = {
2499         .pad_mux_count = ARRAY_SIZE(cvbs_dbg_grp_pad_mux),
2500         .pad_mux_list = cvbs_dbg_grp_pad_mux,
2501 };
2502
2503 static struct atlas7_pad_mux cvbs_dbg_test_grp0_pad_mux[] = {
2504         MUX(1, 57, 3, N, N, N, N),
2505 };
2506
2507 static struct atlas7_grp_mux cvbs_dbg_test_grp0_mux = {
2508         .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp0_pad_mux),
2509         .pad_mux_list = cvbs_dbg_test_grp0_pad_mux,
2510 };
2511
2512 static struct atlas7_pad_mux cvbs_dbg_test_grp1_pad_mux[] = {
2513         MUX(1, 58, 3, N, N, N, N),
2514 };
2515
2516 static struct atlas7_grp_mux cvbs_dbg_test_grp1_mux = {
2517         .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp1_pad_mux),
2518         .pad_mux_list = cvbs_dbg_test_grp1_pad_mux,
2519 };
2520
2521 static struct atlas7_pad_mux cvbs_dbg_test_grp2_pad_mux[] = {
2522         MUX(1, 59, 3, N, N, N, N),
2523 };
2524
2525 static struct atlas7_grp_mux cvbs_dbg_test_grp2_mux = {
2526         .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp2_pad_mux),
2527         .pad_mux_list = cvbs_dbg_test_grp2_pad_mux,
2528 };
2529
2530 static struct atlas7_pad_mux cvbs_dbg_test_grp3_pad_mux[] = {
2531         MUX(1, 60, 3, N, N, N, N),
2532 };
2533
2534 static struct atlas7_grp_mux cvbs_dbg_test_grp3_mux = {
2535         .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp3_pad_mux),
2536         .pad_mux_list = cvbs_dbg_test_grp3_pad_mux,
2537 };
2538
2539 static struct atlas7_pad_mux cvbs_dbg_test_grp4_pad_mux[] = {
2540         MUX(1, 61, 3, N, N, N, N),
2541 };
2542
2543 static struct atlas7_grp_mux cvbs_dbg_test_grp4_mux = {
2544         .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp4_pad_mux),
2545         .pad_mux_list = cvbs_dbg_test_grp4_pad_mux,
2546 };
2547
2548 static struct atlas7_pad_mux cvbs_dbg_test_grp5_pad_mux[] = {
2549         MUX(1, 62, 3, N, N, N, N),
2550 };
2551
2552 static struct atlas7_grp_mux cvbs_dbg_test_grp5_mux = {
2553         .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp5_pad_mux),
2554         .pad_mux_list = cvbs_dbg_test_grp5_pad_mux,
2555 };
2556
2557 static struct atlas7_pad_mux cvbs_dbg_test_grp6_pad_mux[] = {
2558         MUX(1, 63, 3, N, N, N, N),
2559 };
2560
2561 static struct atlas7_grp_mux cvbs_dbg_test_grp6_mux = {
2562         .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp6_pad_mux),
2563         .pad_mux_list = cvbs_dbg_test_grp6_pad_mux,
2564 };
2565
2566 static struct atlas7_pad_mux cvbs_dbg_test_grp7_pad_mux[] = {
2567         MUX(1, 64, 3, N, N, N, N),
2568 };
2569
2570 static struct atlas7_grp_mux cvbs_dbg_test_grp7_mux = {
2571         .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp7_pad_mux),
2572         .pad_mux_list = cvbs_dbg_test_grp7_pad_mux,
2573 };
2574
2575 static struct atlas7_pad_mux cvbs_dbg_test_grp8_pad_mux[] = {
2576         MUX(1, 65, 3, N, N, N, N),
2577 };
2578
2579 static struct atlas7_grp_mux cvbs_dbg_test_grp8_mux = {
2580         .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp8_pad_mux),
2581         .pad_mux_list = cvbs_dbg_test_grp8_pad_mux,
2582 };
2583
2584 static struct atlas7_pad_mux cvbs_dbg_test_grp9_pad_mux[] = {
2585         MUX(1, 66, 3, N, N, N, N),
2586 };
2587
2588 static struct atlas7_grp_mux cvbs_dbg_test_grp9_mux = {
2589         .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp9_pad_mux),
2590         .pad_mux_list = cvbs_dbg_test_grp9_pad_mux,
2591 };
2592
2593 static struct atlas7_pad_mux cvbs_dbg_test_grp10_pad_mux[] = {
2594         MUX(1, 67, 3, N, N, N, N),
2595 };
2596
2597 static struct atlas7_grp_mux cvbs_dbg_test_grp10_mux = {
2598         .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp10_pad_mux),
2599         .pad_mux_list = cvbs_dbg_test_grp10_pad_mux,
2600 };
2601
2602 static struct atlas7_pad_mux cvbs_dbg_test_grp11_pad_mux[] = {
2603         MUX(1, 68, 3, N, N, N, N),
2604 };
2605
2606 static struct atlas7_grp_mux cvbs_dbg_test_grp11_mux = {
2607         .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp11_pad_mux),
2608         .pad_mux_list = cvbs_dbg_test_grp11_pad_mux,
2609 };
2610
2611 static struct atlas7_pad_mux cvbs_dbg_test_grp12_pad_mux[] = {
2612         MUX(1, 69, 3, N, N, N, N),
2613 };
2614
2615 static struct atlas7_grp_mux cvbs_dbg_test_grp12_mux = {
2616         .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp12_pad_mux),
2617         .pad_mux_list = cvbs_dbg_test_grp12_pad_mux,
2618 };
2619
2620 static struct atlas7_pad_mux cvbs_dbg_test_grp13_pad_mux[] = {
2621         MUX(1, 70, 3, N, N, N, N),
2622 };
2623
2624 static struct atlas7_grp_mux cvbs_dbg_test_grp13_mux = {
2625         .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp13_pad_mux),
2626         .pad_mux_list = cvbs_dbg_test_grp13_pad_mux,
2627 };
2628
2629 static struct atlas7_pad_mux cvbs_dbg_test_grp14_pad_mux[] = {
2630         MUX(1, 71, 3, N, N, N, N),
2631 };
2632
2633 static struct atlas7_grp_mux cvbs_dbg_test_grp14_mux = {
2634         .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp14_pad_mux),
2635         .pad_mux_list = cvbs_dbg_test_grp14_pad_mux,
2636 };
2637
2638 static struct atlas7_pad_mux cvbs_dbg_test_grp15_pad_mux[] = {
2639         MUX(1, 72, 3, N, N, N, N),
2640 };
2641
2642 static struct atlas7_grp_mux cvbs_dbg_test_grp15_mux = {
2643         .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp15_pad_mux),
2644         .pad_mux_list = cvbs_dbg_test_grp15_pad_mux,
2645 };
2646
2647 static struct atlas7_pad_mux gn_gnss_power_grp_pad_mux[] = {
2648         MUX(1, 123, 7, N, N, N, N),
2649         MUX(1, 124, 7, N, N, N, N),
2650         MUX(1, 121, 7, N, N, N, N),
2651         MUX(1, 122, 7, N, N, N, N),
2652         MUX(1, 125, 7, N, N, N, N),
2653         MUX(1, 120, 7, N, N, N, N),
2654 };
2655
2656 static struct atlas7_grp_mux gn_gnss_power_grp_mux = {
2657         .pad_mux_count = ARRAY_SIZE(gn_gnss_power_grp_pad_mux),
2658         .pad_mux_list = gn_gnss_power_grp_pad_mux,
2659 };
2660
2661 static struct atlas7_pad_mux gn_gnss_sw_status_grp_pad_mux[] = {
2662         MUX(1, 57, 7, N, N, N, N),
2663         MUX(1, 58, 7, N, N, N, N),
2664         MUX(1, 59, 7, N, N, N, N),
2665         MUX(1, 60, 7, N, N, N, N),
2666         MUX(1, 61, 7, N, N, N, N),
2667         MUX(1, 62, 7, N, N, N, N),
2668         MUX(1, 63, 7, N, N, N, N),
2669         MUX(1, 64, 7, N, N, N, N),
2670         MUX(1, 65, 7, N, N, N, N),
2671         MUX(1, 66, 7, N, N, N, N),
2672         MUX(1, 67, 7, N, N, N, N),
2673         MUX(1, 68, 7, N, N, N, N),
2674         MUX(1, 69, 7, N, N, N, N),
2675         MUX(1, 70, 7, N, N, N, N),
2676         MUX(1, 71, 7, N, N, N, N),
2677         MUX(1, 72, 7, N, N, N, N),
2678         MUX(1, 53, 7, N, N, N, N),
2679         MUX(1, 55, 7, N, N, N, N),
2680         MUX(1, 56, 7, 0xa08, 12, 0xa88, 12),
2681         MUX(1, 54, 7, N, N, N, N),
2682 };
2683
2684 static struct atlas7_grp_mux gn_gnss_sw_status_grp_mux = {
2685         .pad_mux_count = ARRAY_SIZE(gn_gnss_sw_status_grp_pad_mux),
2686         .pad_mux_list = gn_gnss_sw_status_grp_pad_mux,
2687 };
2688
2689 static struct atlas7_pad_mux gn_gnss_eclk_grp_pad_mux[] = {
2690         MUX(1, 113, 4, N, N, N, N),
2691 };
2692
2693 static struct atlas7_grp_mux gn_gnss_eclk_grp_mux = {
2694         .pad_mux_count = ARRAY_SIZE(gn_gnss_eclk_grp_pad_mux),
2695         .pad_mux_list = gn_gnss_eclk_grp_pad_mux,
2696 };
2697
2698 static struct atlas7_pad_mux gn_gnss_irq1_grp0_pad_mux[] = {
2699         MUX(1, 112, 4, 0xa08, 10, 0xa88, 10),
2700 };
2701
2702 static struct atlas7_grp_mux gn_gnss_irq1_grp0_mux = {
2703         .pad_mux_count = ARRAY_SIZE(gn_gnss_irq1_grp0_pad_mux),
2704         .pad_mux_list = gn_gnss_irq1_grp0_pad_mux,
2705 };
2706
2707 static struct atlas7_pad_mux gn_gnss_irq2_grp0_pad_mux[] = {
2708         MUX(1, 118, 4, 0xa08, 11, 0xa88, 11),
2709 };
2710
2711 static struct atlas7_grp_mux gn_gnss_irq2_grp0_mux = {
2712         .pad_mux_count = ARRAY_SIZE(gn_gnss_irq2_grp0_pad_mux),
2713         .pad_mux_list = gn_gnss_irq2_grp0_pad_mux,
2714 };
2715
2716 static struct atlas7_pad_mux gn_gnss_tm_grp_pad_mux[] = {
2717         MUX(1, 115, 4, N, N, N, N),
2718 };
2719
2720 static struct atlas7_grp_mux gn_gnss_tm_grp_mux = {
2721         .pad_mux_count = ARRAY_SIZE(gn_gnss_tm_grp_pad_mux),
2722         .pad_mux_list = gn_gnss_tm_grp_pad_mux,
2723 };
2724
2725 static struct atlas7_pad_mux gn_gnss_tsync_grp_pad_mux[] = {
2726         MUX(1, 114, 4, N, N, N, N),
2727 };
2728
2729 static struct atlas7_grp_mux gn_gnss_tsync_grp_mux = {
2730         .pad_mux_count = ARRAY_SIZE(gn_gnss_tsync_grp_pad_mux),
2731         .pad_mux_list = gn_gnss_tsync_grp_pad_mux,
2732 };
2733
2734 static struct atlas7_pad_mux gn_io_gnsssys_sw_cfg_grp_pad_mux[] = {
2735         MUX(1, 44, 7, N, N, N, N),
2736         MUX(1, 43, 7, N, N, N, N),
2737         MUX(1, 42, 7, N, N, N, N),
2738         MUX(1, 41, 7, N, N, N, N),
2739         MUX(1, 40, 7, N, N, N, N),
2740         MUX(1, 39, 7, N, N, N, N),
2741         MUX(1, 38, 7, N, N, N, N),
2742         MUX(1, 37, 7, N, N, N, N),
2743         MUX(1, 49, 7, N, N, N, N),
2744         MUX(1, 50, 7, N, N, N, N),
2745         MUX(1, 91, 7, N, N, N, N),
2746         MUX(1, 92, 7, N, N, N, N),
2747         MUX(1, 93, 7, N, N, N, N),
2748         MUX(1, 94, 7, N, N, N, N),
2749         MUX(1, 95, 7, N, N, N, N),
2750         MUX(1, 96, 7, N, N, N, N),
2751 };
2752
2753 static struct atlas7_grp_mux gn_io_gnsssys_sw_cfg_grp_mux = {
2754         .pad_mux_count = ARRAY_SIZE(gn_io_gnsssys_sw_cfg_grp_pad_mux),
2755         .pad_mux_list = gn_io_gnsssys_sw_cfg_grp_pad_mux,
2756 };
2757
2758 static struct atlas7_pad_mux gn_trg_grp0_pad_mux[] = {
2759         MUX(1, 29, 1, 0xa00, 6, 0xa80, 6),
2760         MUX(1, 28, 1, 0xa00, 7, 0xa80, 7),
2761         MUX(1, 26, 1, 0xa00, 8, 0xa80, 8),
2762         MUX(1, 27, 1, 0xa00, 9, 0xa80, 9),
2763 };
2764
2765 static struct atlas7_grp_mux gn_trg_grp0_mux = {
2766         .pad_mux_count = ARRAY_SIZE(gn_trg_grp0_pad_mux),
2767         .pad_mux_list = gn_trg_grp0_pad_mux,
2768 };
2769
2770 static struct atlas7_pad_mux gn_trg_grp1_pad_mux[] = {
2771         MUX(1, 77, 3, 0xa00, 6, 0xa80, 6),
2772         MUX(1, 76, 3, 0xa00, 7, 0xa80, 7),
2773         MUX(1, 74, 3, 0xa00, 8, 0xa80, 8),
2774         MUX(1, 75, 3, 0xa00, 9, 0xa80, 9),
2775 };
2776
2777 static struct atlas7_grp_mux gn_trg_grp1_mux = {
2778         .pad_mux_count = ARRAY_SIZE(gn_trg_grp1_pad_mux),
2779         .pad_mux_list = gn_trg_grp1_pad_mux,
2780 };
2781
2782 static struct atlas7_pad_mux gn_trg_shutdown_grp0_pad_mux[] = {
2783         MUX(1, 30, 1, N, N, N, N),
2784 };
2785
2786 static struct atlas7_grp_mux gn_trg_shutdown_grp0_mux = {
2787         .pad_mux_count = ARRAY_SIZE(gn_trg_shutdown_grp0_pad_mux),
2788         .pad_mux_list = gn_trg_shutdown_grp0_pad_mux,
2789 };
2790
2791 static struct atlas7_pad_mux gn_trg_shutdown_grp1_pad_mux[] = {
2792         MUX(1, 83, 3, N, N, N, N),
2793 };
2794
2795 static struct atlas7_grp_mux gn_trg_shutdown_grp1_mux = {
2796         .pad_mux_count = ARRAY_SIZE(gn_trg_shutdown_grp1_pad_mux),
2797         .pad_mux_list = gn_trg_shutdown_grp1_pad_mux,
2798 };
2799
2800 static struct atlas7_pad_mux gn_trg_shutdown_grp2_pad_mux[] = {
2801         MUX(1, 117, 4, N, N, N, N),
2802 };
2803
2804 static struct atlas7_grp_mux gn_trg_shutdown_grp2_mux = {
2805         .pad_mux_count = ARRAY_SIZE(gn_trg_shutdown_grp2_pad_mux),
2806         .pad_mux_list = gn_trg_shutdown_grp2_pad_mux,
2807 };
2808
2809 static struct atlas7_pad_mux gn_trg_shutdown_grp3_pad_mux[] = {
2810         MUX(1, 123, 5, N, N, N, N),
2811 };
2812
2813 static struct atlas7_grp_mux gn_trg_shutdown_grp3_mux = {
2814         .pad_mux_count = ARRAY_SIZE(gn_trg_shutdown_grp3_pad_mux),
2815         .pad_mux_list = gn_trg_shutdown_grp3_pad_mux,
2816 };
2817
2818 static struct atlas7_pad_mux i2c0_grp_pad_mux[] = {
2819         MUX(1, 128, 1, N, N, N, N),
2820         MUX(1, 127, 1, N, N, N, N),
2821 };
2822
2823 static struct atlas7_grp_mux i2c0_grp_mux = {
2824         .pad_mux_count = ARRAY_SIZE(i2c0_grp_pad_mux),
2825         .pad_mux_list = i2c0_grp_pad_mux,
2826 };
2827
2828 static struct atlas7_pad_mux i2c1_grp_pad_mux[] = {
2829         MUX(1, 126, 4, N, N, N, N),
2830         MUX(1, 125, 4, N, N, N, N),
2831 };
2832
2833 static struct atlas7_grp_mux i2c1_grp_mux = {
2834         .pad_mux_count = ARRAY_SIZE(i2c1_grp_pad_mux),
2835         .pad_mux_list = i2c1_grp_pad_mux,
2836 };
2837
2838 static struct atlas7_pad_mux i2s0_grp_pad_mux[] = {
2839         MUX(1, 91, 2, 0xa10, 12, 0xa90, 12),
2840         MUX(1, 93, 2, 0xa10, 13, 0xa90, 13),
2841         MUX(1, 94, 2, 0xa10, 14, 0xa90, 14),
2842         MUX(1, 92, 2, 0xa10, 15, 0xa90, 15),
2843 };
2844
2845 static struct atlas7_grp_mux i2s0_grp_mux = {
2846         .pad_mux_count = ARRAY_SIZE(i2s0_grp_pad_mux),
2847         .pad_mux_list = i2s0_grp_pad_mux,
2848 };
2849
2850 static struct atlas7_pad_mux i2s1_basic_grp_pad_mux[] = {
2851         MUX(1, 95, 2, 0xa10, 16, 0xa90, 16),
2852         MUX(1, 96, 2, 0xa10, 19, 0xa90, 19),
2853 };
2854
2855 static struct atlas7_grp_mux i2s1_basic_grp_mux = {
2856         .pad_mux_count = ARRAY_SIZE(i2s1_basic_grp_pad_mux),
2857         .pad_mux_list = i2s1_basic_grp_pad_mux,
2858 };
2859
2860 static struct atlas7_pad_mux i2s1_rxd0_grp0_pad_mux[] = {
2861         MUX(1, 61, 4, 0xa10, 17, 0xa90, 17),
2862 };
2863
2864 static struct atlas7_grp_mux i2s1_rxd0_grp0_mux = {
2865         .pad_mux_count = ARRAY_SIZE(i2s1_rxd0_grp0_pad_mux),
2866         .pad_mux_list = i2s1_rxd0_grp0_pad_mux,
2867 };
2868
2869 static struct atlas7_pad_mux i2s1_rxd0_grp1_pad_mux[] = {
2870         MUX(1, 131, 4, 0xa10, 17, 0xa90, 17),
2871 };
2872
2873 static struct atlas7_grp_mux i2s1_rxd0_grp1_mux = {
2874         .pad_mux_count = ARRAY_SIZE(i2s1_rxd0_grp1_pad_mux),
2875         .pad_mux_list = i2s1_rxd0_grp1_pad_mux,
2876 };
2877
2878 static struct atlas7_pad_mux i2s1_rxd0_grp2_pad_mux[] = {
2879         MUX(1, 129, 2, 0xa10, 17, 0xa90, 17),
2880 };
2881
2882 static struct atlas7_grp_mux i2s1_rxd0_grp2_mux = {
2883         .pad_mux_count = ARRAY_SIZE(i2s1_rxd0_grp2_pad_mux),
2884         .pad_mux_list = i2s1_rxd0_grp2_pad_mux,
2885 };
2886
2887 static struct atlas7_pad_mux i2s1_rxd0_grp3_pad_mux[] = {
2888         MUX(1, 117, 7, 0xa10, 17, 0xa90, 17),
2889 };
2890
2891 static struct atlas7_grp_mux i2s1_rxd0_grp3_mux = {
2892         .pad_mux_count = ARRAY_SIZE(i2s1_rxd0_grp3_pad_mux),
2893         .pad_mux_list = i2s1_rxd0_grp3_pad_mux,
2894 };
2895
2896 static struct atlas7_pad_mux i2s1_rxd0_grp4_pad_mux[] = {
2897         MUX(1, 83, 4, 0xa10, 17, 0xa90, 17),
2898 };
2899
2900 static struct atlas7_grp_mux i2s1_rxd0_grp4_mux = {
2901         .pad_mux_count = ARRAY_SIZE(i2s1_rxd0_grp4_pad_mux),
2902         .pad_mux_list = i2s1_rxd0_grp4_pad_mux,
2903 };
2904
2905 static struct atlas7_pad_mux i2s1_rxd1_grp0_pad_mux[] = {
2906         MUX(1, 72, 4, 0xa10, 18, 0xa90, 18),
2907 };
2908
2909 static struct atlas7_grp_mux i2s1_rxd1_grp0_mux = {
2910         .pad_mux_count = ARRAY_SIZE(i2s1_rxd1_grp0_pad_mux),
2911         .pad_mux_list = i2s1_rxd1_grp0_pad_mux,
2912 };
2913
2914 static struct atlas7_pad_mux i2s1_rxd1_grp1_pad_mux[] = {
2915         MUX(1, 132, 4, 0xa10, 18, 0xa90, 18),
2916 };
2917
2918 static struct atlas7_grp_mux i2s1_rxd1_grp1_mux = {
2919         .pad_mux_count = ARRAY_SIZE(i2s1_rxd1_grp1_pad_mux),
2920         .pad_mux_list = i2s1_rxd1_grp1_pad_mux,
2921 };
2922
2923 static struct atlas7_pad_mux i2s1_rxd1_grp2_pad_mux[] = {
2924         MUX(1, 130, 2, 0xa10, 18, 0xa90, 18),
2925 };
2926
2927 static struct atlas7_grp_mux i2s1_rxd1_grp2_mux = {
2928         .pad_mux_count = ARRAY_SIZE(i2s1_rxd1_grp2_pad_mux),
2929         .pad_mux_list = i2s1_rxd1_grp2_pad_mux,
2930 };
2931
2932 static struct atlas7_pad_mux i2s1_rxd1_grp3_pad_mux[] = {
2933         MUX(1, 118, 7, 0xa10, 18, 0xa90, 18),
2934 };
2935
2936 static struct atlas7_grp_mux i2s1_rxd1_grp3_mux = {
2937         .pad_mux_count = ARRAY_SIZE(i2s1_rxd1_grp3_pad_mux),
2938         .pad_mux_list = i2s1_rxd1_grp3_pad_mux,
2939 };
2940
2941 static struct atlas7_pad_mux i2s1_rxd1_grp4_pad_mux[] = {
2942         MUX(1, 84, 4, 0xa10, 18, 0xa90, 18),
2943 };
2944
2945 static struct atlas7_grp_mux i2s1_rxd1_grp4_mux = {
2946         .pad_mux_count = ARRAY_SIZE(i2s1_rxd1_grp4_pad_mux),
2947         .pad_mux_list = i2s1_rxd1_grp4_pad_mux,
2948 };
2949
2950 static struct atlas7_pad_mux jtag_jt_dbg_nsrst_grp_pad_mux[] = {
2951         MUX(1, 125, 5, 0xa08, 2, 0xa88, 2),
2952 };
2953
2954 static struct atlas7_grp_mux jtag_jt_dbg_nsrst_grp_mux = {
2955         .pad_mux_count = ARRAY_SIZE(jtag_jt_dbg_nsrst_grp_pad_mux),
2956         .pad_mux_list = jtag_jt_dbg_nsrst_grp_pad_mux,
2957 };
2958
2959 static struct atlas7_pad_mux jtag_ntrst_grp0_pad_mux[] = {
2960         MUX(0, 4, 3, 0xa08, 3, 0xa88, 3),
2961 };
2962
2963 static struct atlas7_grp_mux jtag_ntrst_grp0_mux = {
2964         .pad_mux_count = ARRAY_SIZE(jtag_ntrst_grp0_pad_mux),
2965         .pad_mux_list = jtag_ntrst_grp0_pad_mux,
2966 };
2967
2968 static struct atlas7_pad_mux jtag_ntrst_grp1_pad_mux[] = {
2969         MUX(1, 163, 1, 0xa08, 3, 0xa88, 3),
2970 };
2971
2972 static struct atlas7_grp_mux jtag_ntrst_grp1_mux = {
2973         .pad_mux_count = ARRAY_SIZE(jtag_ntrst_grp1_pad_mux),
2974         .pad_mux_list = jtag_ntrst_grp1_pad_mux,
2975 };
2976
2977 static struct atlas7_pad_mux jtag_swdiotms_grp0_pad_mux[] = {
2978         MUX(0, 2, 3, 0xa10, 10, 0xa90, 10),
2979 };
2980
2981 static struct atlas7_grp_mux jtag_swdiotms_grp0_mux = {
2982         .pad_mux_count = ARRAY_SIZE(jtag_swdiotms_grp0_pad_mux),
2983         .pad_mux_list = jtag_swdiotms_grp0_pad_mux,
2984 };
2985
2986 static struct atlas7_pad_mux jtag_swdiotms_grp1_pad_mux[] = {
2987         MUX(1, 160, 1, 0xa10, 10, 0xa90, 10),
2988 };
2989
2990 static struct atlas7_grp_mux jtag_swdiotms_grp1_mux = {
2991         .pad_mux_count = ARRAY_SIZE(jtag_swdiotms_grp1_pad_mux),
2992         .pad_mux_list = jtag_swdiotms_grp1_pad_mux,
2993 };
2994
2995 static struct atlas7_pad_mux jtag_tck_grp0_pad_mux[] = {
2996         MUX(0, 0, 3, 0xa10, 11, 0xa90, 11),
2997 };
2998
2999 static struct atlas7_grp_mux jtag_tck_grp0_mux = {
3000         .pad_mux_count = ARRAY_SIZE(jtag_tck_grp0_pad_mux),
3001         .pad_mux_list = jtag_tck_grp0_pad_mux,
3002 };
3003
3004 static struct atlas7_pad_mux jtag_tck_grp1_pad_mux[] = {
3005         MUX(1, 161, 1, 0xa10, 11, 0xa90, 11),
3006 };
3007
3008 static struct atlas7_grp_mux jtag_tck_grp1_mux = {
3009         .pad_mux_count = ARRAY_SIZE(jtag_tck_grp1_pad_mux),
3010         .pad_mux_list = jtag_tck_grp1_pad_mux,
3011 };
3012
3013 static struct atlas7_pad_mux jtag_tdi_grp0_pad_mux[] = {
3014         MUX(0, 1, 3, 0xa10, 31, 0xa90, 31),
3015 };
3016
3017 static struct atlas7_grp_mux jtag_tdi_grp0_mux = {
3018         .pad_mux_count = ARRAY_SIZE(jtag_tdi_grp0_pad_mux),
3019         .pad_mux_list = jtag_tdi_grp0_pad_mux,
3020 };
3021
3022 static struct atlas7_pad_mux jtag_tdi_grp1_pad_mux[] = {
3023         MUX(1, 162, 1, 0xa10, 31, 0xa90, 31),
3024 };
3025
3026 static struct atlas7_grp_mux jtag_tdi_grp1_mux = {
3027         .pad_mux_count = ARRAY_SIZE(jtag_tdi_grp1_pad_mux),
3028         .pad_mux_list = jtag_tdi_grp1_pad_mux,
3029 };
3030
3031 static struct atlas7_pad_mux jtag_tdo_grp0_pad_mux[] = {
3032         MUX(0, 3, 3, N, N, N, N),
3033 };
3034
3035 static struct atlas7_grp_mux jtag_tdo_grp0_mux = {
3036         .pad_mux_count = ARRAY_SIZE(jtag_tdo_grp0_pad_mux),
3037         .pad_mux_list = jtag_tdo_grp0_pad_mux,
3038 };
3039
3040 static struct atlas7_pad_mux jtag_tdo_grp1_pad_mux[] = {
3041         MUX(1, 159, 1, N, N, N, N),
3042 };
3043
3044 static struct atlas7_grp_mux jtag_tdo_grp1_mux = {
3045         .pad_mux_count = ARRAY_SIZE(jtag_tdo_grp1_pad_mux),
3046         .pad_mux_list = jtag_tdo_grp1_pad_mux,
3047 };
3048
3049 static struct atlas7_pad_mux ks_kas_spi_grp0_pad_mux[] = {
3050         MUX(1, 141, 2, N, N, N, N),
3051         MUX(1, 144, 2, 0xa08, 8, 0xa88, 8),
3052         MUX(1, 143, 2, N, N, N, N),
3053         MUX(1, 142, 2, N, N, N, N),
3054 };
3055
3056 static struct atlas7_grp_mux ks_kas_spi_grp0_mux = {
3057         .pad_mux_count = ARRAY_SIZE(ks_kas_spi_grp0_pad_mux),
3058         .pad_mux_list = ks_kas_spi_grp0_pad_mux,
3059 };
3060
3061 static struct atlas7_pad_mux ld_ldd_grp_pad_mux[] = {
3062         MUX(1, 57, 1, N, N, N, N),
3063         MUX(1, 58, 1, N, N, N, N),
3064         MUX(1, 59, 1, N, N, N, N),
3065         MUX(1, 60, 1, N, N, N, N),
3066         MUX(1, 61, 1, N, N, N, N),
3067         MUX(1, 62, 1, N, N, N, N),
3068         MUX(1, 63, 1, N, N, N, N),
3069         MUX(1, 64, 1, N, N, N, N),
3070         MUX(1, 65, 1, N, N, N, N),
3071         MUX(1, 66, 1, N, N, N, N),
3072         MUX(1, 67, 1, N, N, N, N),
3073         MUX(1, 68, 1, N, N, N, N),
3074         MUX(1, 69, 1, N, N, N, N),
3075         MUX(1, 70, 1, N, N, N, N),
3076         MUX(1, 71, 1, N, N, N, N),
3077         MUX(1, 72, 1, N, N, N, N),
3078         MUX(1, 74, 2, N, N, N, N),
3079         MUX(1, 75, 2, N, N, N, N),
3080         MUX(1, 76, 2, N, N, N, N),
3081         MUX(1, 77, 2, N, N, N, N),
3082         MUX(1, 78, 2, N, N, N, N),
3083         MUX(1, 79, 2, N, N, N, N),
3084         MUX(1, 80, 2, N, N, N, N),
3085         MUX(1, 81, 2, N, N, N, N),
3086         MUX(1, 56, 1, N, N, N, N),
3087         MUX(1, 53, 1, N, N, N, N),
3088 };
3089
3090 static struct atlas7_grp_mux ld_ldd_grp_mux = {
3091         .pad_mux_count = ARRAY_SIZE(ld_ldd_grp_pad_mux),
3092         .pad_mux_list = ld_ldd_grp_pad_mux,
3093 };
3094
3095 static struct atlas7_pad_mux ld_ldd_16bit_grp_pad_mux[] = {
3096         MUX(1, 57, 1, N, N, N, N),
3097         MUX(1, 58, 1, N, N, N, N),
3098         MUX(1, 59, 1, N, N, N, N),
3099         MUX(1, 60, 1, N, N, N, N),
3100         MUX(1, 61, 1, N, N, N, N),
3101         MUX(1, 62, 1, N, N, N, N),
3102         MUX(1, 63, 1, N, N, N, N),
3103         MUX(1, 64, 1, N, N, N, N),
3104         MUX(1, 65, 1, N, N, N, N),
3105         MUX(1, 66, 1, N, N, N, N),
3106         MUX(1, 67, 1, N, N, N, N),
3107         MUX(1, 68, 1, N, N, N, N),
3108         MUX(1, 69, 1, N, N, N, N),
3109         MUX(1, 70, 1, N, N, N, N),
3110         MUX(1, 71, 1, N, N, N, N),
3111         MUX(1, 72, 1, N, N, N, N),
3112         MUX(1, 56, 1, N, N, N, N),
3113         MUX(1, 53, 1, N, N, N, N),
3114 };
3115
3116 static struct atlas7_grp_mux ld_ldd_16bit_grp_mux = {
3117         .pad_mux_count = ARRAY_SIZE(ld_ldd_16bit_grp_pad_mux),
3118         .pad_mux_list = ld_ldd_16bit_grp_pad_mux,
3119 };
3120
3121 static struct atlas7_pad_mux ld_ldd_fck_grp_pad_mux[] = {
3122         MUX(1, 55, 1, N, N, N, N),
3123 };
3124
3125 static struct atlas7_grp_mux ld_ldd_fck_grp_mux = {
3126         .pad_mux_count = ARRAY_SIZE(ld_ldd_fck_grp_pad_mux),
3127         .pad_mux_list = ld_ldd_fck_grp_pad_mux,
3128 };
3129
3130 static struct atlas7_pad_mux ld_ldd_lck_grp_pad_mux[] = {
3131         MUX(1, 54, 1, N, N, N, N),
3132 };
3133
3134 static struct atlas7_grp_mux ld_ldd_lck_grp_mux = {
3135         .pad_mux_count = ARRAY_SIZE(ld_ldd_lck_grp_pad_mux),
3136         .pad_mux_list = ld_ldd_lck_grp_pad_mux,
3137 };
3138
3139 static struct atlas7_pad_mux lr_lcdrom_grp_pad_mux[] = {
3140         MUX(1, 73, 2, N, N, N, N),
3141         MUX(1, 54, 2, N, N, N, N),
3142         MUX(1, 57, 2, N, N, N, N),
3143         MUX(1, 58, 2, N, N, N, N),
3144         MUX(1, 59, 2, N, N, N, N),
3145         MUX(1, 60, 2, N, N, N, N),
3146         MUX(1, 61, 2, N, N, N, N),
3147         MUX(1, 62, 2, N, N, N, N),
3148         MUX(1, 63, 2, N, N, N, N),
3149         MUX(1, 64, 2, N, N, N, N),
3150         MUX(1, 65, 2, N, N, N, N),
3151         MUX(1, 66, 2, N, N, N, N),
3152         MUX(1, 67, 2, N, N, N, N),
3153         MUX(1, 68, 2, N, N, N, N),
3154         MUX(1, 69, 2, N, N, N, N),
3155         MUX(1, 70, 2, N, N, N, N),
3156         MUX(1, 71, 2, N, N, N, N),
3157         MUX(1, 72, 2, N, N, N, N),
3158         MUX(1, 56, 2, N, N, N, N),
3159         MUX(1, 53, 2, N, N, N, N),
3160         MUX(1, 55, 2, N, N, N, N),
3161 };
3162
3163 static struct atlas7_grp_mux lr_lcdrom_grp_mux = {
3164         .pad_mux_count = ARRAY_SIZE(lr_lcdrom_grp_pad_mux),
3165         .pad_mux_list = lr_lcdrom_grp_pad_mux,
3166 };
3167
3168 static struct atlas7_pad_mux lvds_analog_grp_pad_mux[] = {
3169         MUX(1, 149, 8, N, N, N, N),
3170         MUX(1, 150, 8, N, N, N, N),
3171         MUX(1, 151, 8, N, N, N, N),
3172         MUX(1, 152, 8, N, N, N, N),
3173         MUX(1, 153, 8, N, N, N, N),
3174         MUX(1, 154, 8, N, N, N, N),
3175         MUX(1, 155, 8, N, N, N, N),
3176         MUX(1, 156, 8, N, N, N, N),
3177         MUX(1, 157, 8, N, N, N, N),
3178         MUX(1, 158, 8, N, N, N, N),
3179 };
3180
3181 static struct atlas7_grp_mux lvds_analog_grp_mux = {
3182         .pad_mux_count = ARRAY_SIZE(lvds_analog_grp_pad_mux),
3183         .pad_mux_list = lvds_analog_grp_pad_mux,
3184 };
3185
3186 static struct atlas7_pad_mux nd_df_basic_grp_pad_mux[] = {
3187         MUX(1, 44, 1, N, N, N, N),
3188         MUX(1, 43, 1, N, N, N, N),
3189         MUX(1, 42, 1, N, N, N, N),
3190         MUX(1, 41, 1, N, N, N, N),
3191         MUX(1, 40, 1, N, N, N, N),
3192         MUX(1, 39, 1, N, N, N, N),
3193         MUX(1, 38, 1, N, N, N, N),
3194         MUX(1, 37, 1, N, N, N, N),
3195         MUX(1, 47, 1, N, N, N, N),
3196         MUX(1, 46, 1, N, N, N, N),
3197         MUX(1, 52, 1, N, N, N, N),
3198         MUX(1, 45, 1, N, N, N, N),
3199         MUX(1, 49, 1, N, N, N, N),
3200         MUX(1, 50, 1, N, N, N, N),
3201         MUX(1, 48, 1, N, N, N, N),
3202 };
3203
3204 static struct atlas7_grp_mux nd_df_basic_grp_mux = {
3205         .pad_mux_count = ARRAY_SIZE(nd_df_basic_grp_pad_mux),
3206         .pad_mux_list = nd_df_basic_grp_pad_mux,
3207 };
3208
3209 static struct atlas7_pad_mux nd_df_wp_grp_pad_mux[] = {
3210         MUX(1, 124, 4, N, N, N, N),
3211 };
3212
3213 static struct atlas7_grp_mux nd_df_wp_grp_mux = {
3214         .pad_mux_count = ARRAY_SIZE(nd_df_wp_grp_pad_mux),
3215         .pad_mux_list = nd_df_wp_grp_pad_mux,
3216 };
3217
3218 static struct atlas7_pad_mux nd_df_cs_grp_pad_mux[] = {
3219         MUX(1, 51, 1, N, N, N, N),
3220 };
3221
3222 static struct atlas7_grp_mux nd_df_cs_grp_mux = {
3223         .pad_mux_count = ARRAY_SIZE(nd_df_cs_grp_pad_mux),
3224         .pad_mux_list = nd_df_cs_grp_pad_mux,
3225 };
3226
3227 static struct atlas7_pad_mux ps_grp_pad_mux[] = {
3228         MUX(1, 120, 2, N, N, N, N),
3229         MUX(1, 119, 2, N, N, N, N),
3230         MUX(1, 121, 5, N, N, N, N),
3231 };
3232
3233 static struct atlas7_grp_mux ps_grp_mux = {
3234         .pad_mux_count = ARRAY_SIZE(ps_grp_pad_mux),
3235         .pad_mux_list = ps_grp_pad_mux,
3236 };
3237
3238 static struct atlas7_pad_mux ps_no_dir_grp_pad_mux[] = {
3239         MUX(1, 119, 2, N, N, N, N),
3240 };
3241
3242 static struct atlas7_grp_mux ps_no_dir_grp_mux = {
3243         .pad_mux_count = ARRAY_SIZE(ps_no_dir_grp_pad_mux),
3244         .pad_mux_list = ps_no_dir_grp_pad_mux,
3245 };
3246
3247 static struct atlas7_pad_mux pwc_core_on_grp_pad_mux[] = {
3248         MUX(0, 8, 1, N, N, N, N),
3249 };
3250
3251 static struct atlas7_grp_mux pwc_core_on_grp_mux = {
3252         .pad_mux_count = ARRAY_SIZE(pwc_core_on_grp_pad_mux),
3253         .pad_mux_list = pwc_core_on_grp_pad_mux,
3254 };
3255
3256 static struct atlas7_pad_mux pwc_ext_on_grp_pad_mux[] = {
3257         MUX(0, 6, 1, N, N, N, N),
3258 };
3259
3260 static struct atlas7_grp_mux pwc_ext_on_grp_mux = {
3261         .pad_mux_count = ARRAY_SIZE(pwc_ext_on_grp_pad_mux),
3262         .pad_mux_list = pwc_ext_on_grp_pad_mux,
3263 };
3264
3265 static struct atlas7_pad_mux pwc_gpio3_clk_grp_pad_mux[] = {
3266         MUX(0, 3, 4, N, N, N, N),
3267 };
3268
3269 static struct atlas7_grp_mux pwc_gpio3_clk_grp_mux = {
3270         .pad_mux_count = ARRAY_SIZE(pwc_gpio3_clk_grp_pad_mux),
3271         .pad_mux_list = pwc_gpio3_clk_grp_pad_mux,
3272 };
3273
3274 static struct atlas7_pad_mux pwc_io_on_grp_pad_mux[] = {
3275         MUX(0, 9, 1, N, N, N, N),
3276 };
3277
3278 static struct atlas7_grp_mux pwc_io_on_grp_mux = {
3279         .pad_mux_count = ARRAY_SIZE(pwc_io_on_grp_pad_mux),
3280         .pad_mux_list = pwc_io_on_grp_pad_mux,
3281 };
3282
3283 static struct atlas7_pad_mux pwc_lowbatt_b_grp0_pad_mux[] = {
3284         MUX(0, 4, 1, 0xa08, 4, 0xa88, 4),
3285 };
3286
3287 static struct atlas7_grp_mux pwc_lowbatt_b_grp0_mux = {
3288         .pad_mux_count = ARRAY_SIZE(pwc_lowbatt_b_grp0_pad_mux),
3289         .pad_mux_list = pwc_lowbatt_b_grp0_pad_mux,
3290 };
3291
3292 static struct atlas7_pad_mux pwc_mem_on_grp_pad_mux[] = {
3293         MUX(0, 7, 1, N, N, N, N),
3294 };
3295
3296 static struct atlas7_grp_mux pwc_mem_on_grp_mux = {
3297         .pad_mux_count = ARRAY_SIZE(pwc_mem_on_grp_pad_mux),
3298         .pad_mux_list = pwc_mem_on_grp_pad_mux,
3299 };
3300
3301 static struct atlas7_pad_mux pwc_on_key_b_grp0_pad_mux[] = {
3302         MUX(0, 5, 1, 0xa08, 5, 0xa88, 5),
3303 };
3304
3305 static struct atlas7_grp_mux pwc_on_key_b_grp0_mux = {
3306         .pad_mux_count = ARRAY_SIZE(pwc_on_key_b_grp0_pad_mux),
3307         .pad_mux_list = pwc_on_key_b_grp0_pad_mux,
3308 };
3309
3310 static struct atlas7_pad_mux pwc_wakeup_src0_grp_pad_mux[] = {
3311         MUX(0, 0, 1, N, N, N, N),
3312 };
3313
3314 static struct atlas7_grp_mux pwc_wakeup_src0_grp_mux = {
3315         .pad_mux_count = ARRAY_SIZE(pwc_wakeup_src0_grp_pad_mux),
3316         .pad_mux_list = pwc_wakeup_src0_grp_pad_mux,
3317 };
3318
3319 static struct atlas7_pad_mux pwc_wakeup_src1_grp_pad_mux[] = {
3320         MUX(0, 1, 1, N, N, N, N),
3321 };
3322
3323 static struct atlas7_grp_mux pwc_wakeup_src1_grp_mux = {
3324         .pad_mux_count = ARRAY_SIZE(pwc_wakeup_src1_grp_pad_mux),
3325         .pad_mux_list = pwc_wakeup_src1_grp_pad_mux,
3326 };
3327
3328 static struct atlas7_pad_mux pwc_wakeup_src2_grp_pad_mux[] = {
3329         MUX(0, 2, 1, N, N, N, N),
3330 };
3331
3332 static struct atlas7_grp_mux pwc_wakeup_src2_grp_mux = {
3333         .pad_mux_count = ARRAY_SIZE(pwc_wakeup_src2_grp_pad_mux),
3334         .pad_mux_list = pwc_wakeup_src2_grp_pad_mux,
3335 };
3336
3337 static struct atlas7_pad_mux pwc_wakeup_src3_grp_pad_mux[] = {
3338         MUX(0, 3, 1, N, N, N, N),
3339 };
3340
3341 static struct atlas7_grp_mux pwc_wakeup_src3_grp_mux = {
3342         .pad_mux_count = ARRAY_SIZE(pwc_wakeup_src3_grp_pad_mux),
3343         .pad_mux_list = pwc_wakeup_src3_grp_pad_mux,
3344 };
3345
3346 static struct atlas7_pad_mux pw_cko0_grp0_pad_mux[] = {
3347         MUX(1, 123, 3, N, N, N, N),
3348 };
3349
3350 static struct atlas7_grp_mux pw_cko0_grp0_mux = {
3351         .pad_mux_count = ARRAY_SIZE(pw_cko0_grp0_pad_mux),
3352         .pad_mux_list = pw_cko0_grp0_pad_mux,
3353 };
3354
3355 static struct atlas7_pad_mux pw_cko0_grp1_pad_mux[] = {
3356         MUX(1, 101, 4, N, N, N, N),
3357 };
3358
3359 static struct atlas7_grp_mux pw_cko0_grp1_mux = {
3360         .pad_mux_count = ARRAY_SIZE(pw_cko0_grp1_pad_mux),
3361         .pad_mux_list = pw_cko0_grp1_pad_mux,
3362 };
3363
3364 static struct atlas7_pad_mux pw_cko0_grp2_pad_mux[] = {
3365         MUX(1, 82, 2, N, N, N, N),
3366 };
3367
3368 static struct atlas7_grp_mux pw_cko0_grp2_mux = {
3369         .pad_mux_count = ARRAY_SIZE(pw_cko0_grp2_pad_mux),
3370         .pad_mux_list = pw_cko0_grp2_pad_mux,
3371 };
3372
3373 static struct atlas7_pad_mux pw_cko0_grp3_pad_mux[] = {
3374         MUX(1, 162, 5, N, N, N, N),
3375 };
3376
3377 static struct atlas7_grp_mux pw_cko0_grp3_mux = {
3378         .pad_mux_count = ARRAY_SIZE(pw_cko0_grp3_pad_mux),
3379         .pad_mux_list = pw_cko0_grp3_pad_mux,
3380 };
3381
3382 static struct atlas7_pad_mux pw_cko1_grp0_pad_mux[] = {
3383         MUX(1, 124, 3, N, N, N, N),
3384 };
3385
3386 static struct atlas7_grp_mux pw_cko1_grp0_mux = {
3387         .pad_mux_count = ARRAY_SIZE(pw_cko1_grp0_pad_mux),
3388         .pad_mux_list = pw_cko1_grp0_pad_mux,
3389 };
3390
3391 static struct atlas7_pad_mux pw_cko1_grp1_pad_mux[] = {
3392         MUX(1, 110, 4, N, N, N, N),
3393 };
3394
3395 static struct atlas7_grp_mux pw_cko1_grp1_mux = {
3396         .pad_mux_count = ARRAY_SIZE(pw_cko1_grp1_pad_mux),
3397         .pad_mux_list = pw_cko1_grp1_pad_mux,
3398 };
3399
3400 static struct atlas7_pad_mux pw_cko1_grp2_pad_mux[] = {
3401         MUX(1, 163, 5, N, N, N, N),
3402 };
3403
3404 static struct atlas7_grp_mux pw_cko1_grp2_mux = {
3405         .pad_mux_count = ARRAY_SIZE(pw_cko1_grp2_pad_mux),
3406         .pad_mux_list = pw_cko1_grp2_pad_mux,
3407 };
3408
3409 static struct atlas7_pad_mux pw_i2s01_clk_grp0_pad_mux[] = {
3410         MUX(1, 125, 3, N, N, N, N),
3411 };
3412
3413 static struct atlas7_grp_mux pw_i2s01_clk_grp0_mux = {
3414         .pad_mux_count = ARRAY_SIZE(pw_i2s01_clk_grp0_pad_mux),
3415         .pad_mux_list = pw_i2s01_clk_grp0_pad_mux,
3416 };
3417
3418 static struct atlas7_pad_mux pw_i2s01_clk_grp1_pad_mux[] = {
3419         MUX(1, 117, 3, N, N, N, N),
3420 };
3421
3422 static struct atlas7_grp_mux pw_i2s01_clk_grp1_mux = {
3423         .pad_mux_count = ARRAY_SIZE(pw_i2s01_clk_grp1_pad_mux),
3424         .pad_mux_list = pw_i2s01_clk_grp1_pad_mux,
3425 };
3426
3427 static struct atlas7_pad_mux pw_i2s01_clk_grp2_pad_mux[] = {
3428         MUX(1, 132, 2, N, N, N, N),
3429 };
3430
3431 static struct atlas7_grp_mux pw_i2s01_clk_grp2_mux = {
3432         .pad_mux_count = ARRAY_SIZE(pw_i2s01_clk_grp2_pad_mux),
3433         .pad_mux_list = pw_i2s01_clk_grp2_pad_mux,
3434 };
3435
3436 static struct atlas7_pad_mux pw_pwm0_grp0_pad_mux[] = {
3437         MUX(1, 119, 3, N, N, N, N),
3438 };
3439
3440 static struct atlas7_grp_mux pw_pwm0_grp0_mux = {
3441         .pad_mux_count = ARRAY_SIZE(pw_pwm0_grp0_pad_mux),
3442         .pad_mux_list = pw_pwm0_grp0_pad_mux,
3443 };
3444
3445 static struct atlas7_pad_mux pw_pwm0_grp1_pad_mux[] = {
3446         MUX(1, 159, 5, N, N, N, N),
3447 };
3448
3449 static struct atlas7_grp_mux pw_pwm0_grp1_mux = {
3450         .pad_mux_count = ARRAY_SIZE(pw_pwm0_grp1_pad_mux),
3451         .pad_mux_list = pw_pwm0_grp1_pad_mux,
3452 };
3453
3454 static struct atlas7_pad_mux pw_pwm1_grp0_pad_mux[] = {
3455         MUX(1, 120, 3, N, N, N, N),
3456 };
3457
3458 static struct atlas7_grp_mux pw_pwm1_grp0_mux = {
3459         .pad_mux_count = ARRAY_SIZE(pw_pwm1_grp0_pad_mux),
3460         .pad_mux_list = pw_pwm1_grp0_pad_mux,
3461 };
3462
3463 static struct atlas7_pad_mux pw_pwm1_grp1_pad_mux[] = {
3464         MUX(1, 160, 5, N, N, N, N),
3465 };
3466
3467 static struct atlas7_grp_mux pw_pwm1_grp1_mux = {
3468         .pad_mux_count = ARRAY_SIZE(pw_pwm1_grp1_pad_mux),
3469         .pad_mux_list = pw_pwm1_grp1_pad_mux,
3470 };
3471
3472 static struct atlas7_pad_mux pw_pwm1_grp2_pad_mux[] = {
3473         MUX(1, 131, 2, N, N, N, N),
3474 };
3475
3476 static struct atlas7_grp_mux pw_pwm1_grp2_mux = {
3477         .pad_mux_count = ARRAY_SIZE(pw_pwm1_grp2_pad_mux),
3478         .pad_mux_list = pw_pwm1_grp2_pad_mux,
3479 };
3480
3481 static struct atlas7_pad_mux pw_pwm2_grp0_pad_mux[] = {
3482         MUX(1, 121, 3, N, N, N, N),
3483 };
3484
3485 static struct atlas7_grp_mux pw_pwm2_grp0_mux = {
3486         .pad_mux_count = ARRAY_SIZE(pw_pwm2_grp0_pad_mux),
3487         .pad_mux_list = pw_pwm2_grp0_pad_mux,
3488 };
3489
3490 static struct atlas7_pad_mux pw_pwm2_grp1_pad_mux[] = {
3491         MUX(1, 98, 3, N, N, N, N),
3492 };
3493
3494 static struct atlas7_grp_mux pw_pwm2_grp1_mux = {
3495         .pad_mux_count = ARRAY_SIZE(pw_pwm2_grp1_pad_mux),
3496         .pad_mux_list = pw_pwm2_grp1_pad_mux,
3497 };
3498
3499 static struct atlas7_pad_mux pw_pwm2_grp2_pad_mux[] = {
3500         MUX(1, 161, 5, N, N, N, N),
3501 };
3502
3503 static struct atlas7_grp_mux pw_pwm2_grp2_mux = {
3504         .pad_mux_count = ARRAY_SIZE(pw_pwm2_grp2_pad_mux),
3505         .pad_mux_list = pw_pwm2_grp2_pad_mux,
3506 };
3507
3508 static struct atlas7_pad_mux pw_pwm3_grp0_pad_mux[] = {
3509         MUX(1, 122, 3, N, N, N, N),
3510 };
3511
3512 static struct atlas7_grp_mux pw_pwm3_grp0_mux = {
3513         .pad_mux_count = ARRAY_SIZE(pw_pwm3_grp0_pad_mux),
3514         .pad_mux_list = pw_pwm3_grp0_pad_mux,
3515 };
3516
3517 static struct atlas7_pad_mux pw_pwm3_grp1_pad_mux[] = {
3518         MUX(1, 73, 4, N, N, N, N),
3519 };
3520
3521 static struct atlas7_grp_mux pw_pwm3_grp1_mux = {
3522         .pad_mux_count = ARRAY_SIZE(pw_pwm3_grp1_pad_mux),
3523         .pad_mux_list = pw_pwm3_grp1_pad_mux,
3524 };
3525
3526 static struct atlas7_pad_mux pw_pwm_cpu_vol_grp0_pad_mux[] = {
3527         MUX(1, 121, 3, N, N, N, N),
3528 };
3529
3530 static struct atlas7_grp_mux pw_pwm_cpu_vol_grp0_mux = {
3531         .pad_mux_count = ARRAY_SIZE(pw_pwm_cpu_vol_grp0_pad_mux),
3532         .pad_mux_list = pw_pwm_cpu_vol_grp0_pad_mux,
3533 };
3534
3535 static struct atlas7_pad_mux pw_pwm_cpu_vol_grp1_pad_mux[] = {
3536         MUX(1, 98, 3, N, N, N, N),
3537 };
3538
3539 static struct atlas7_grp_mux pw_pwm_cpu_vol_grp1_mux = {
3540         .pad_mux_count = ARRAY_SIZE(pw_pwm_cpu_vol_grp1_pad_mux),
3541         .pad_mux_list = pw_pwm_cpu_vol_grp1_pad_mux,
3542 };
3543
3544 static struct atlas7_pad_mux pw_pwm_cpu_vol_grp2_pad_mux[] = {
3545         MUX(1, 161, 5, N, N, N, N),
3546 };
3547
3548 static struct atlas7_grp_mux pw_pwm_cpu_vol_grp2_mux = {
3549         .pad_mux_count = ARRAY_SIZE(pw_pwm_cpu_vol_grp2_pad_mux),
3550         .pad_mux_list = pw_pwm_cpu_vol_grp2_pad_mux,
3551 };
3552
3553 static struct atlas7_pad_mux pw_backlight_grp0_pad_mux[] = {
3554         MUX(1, 122, 3, N, N, N, N),
3555 };
3556
3557 static struct atlas7_grp_mux pw_backlight_grp0_mux = {
3558         .pad_mux_count = ARRAY_SIZE(pw_backlight_grp0_pad_mux),
3559         .pad_mux_list = pw_backlight_grp0_pad_mux,
3560 };
3561
3562 static struct atlas7_pad_mux pw_backlight_grp1_pad_mux[] = {
3563         MUX(1, 73, 4, N, N, N, N),
3564 };
3565
3566 static struct atlas7_grp_mux pw_backlight_grp1_mux = {
3567         .pad_mux_count = ARRAY_SIZE(pw_backlight_grp1_pad_mux),
3568         .pad_mux_list = pw_backlight_grp1_pad_mux,
3569 };
3570
3571 static struct atlas7_pad_mux rg_eth_mac_grp_pad_mux[] = {
3572         MUX(1, 108, 1, N, N, N, N),
3573         MUX(1, 103, 1, N, N, N, N),
3574         MUX(1, 104, 1, N, N, N, N),
3575         MUX(1, 105, 1, N, N, N, N),
3576         MUX(1, 106, 1, N, N, N, N),
3577         MUX(1, 107, 1, N, N, N, N),
3578         MUX(1, 102, 1, N, N, N, N),
3579         MUX(1, 97, 1, N, N, N, N),
3580         MUX(1, 98, 1, N, N, N, N),
3581         MUX(1, 99, 1, N, N, N, N),
3582         MUX(1, 100, 1, N, N, N, N),
3583         MUX(1, 101, 1, N, N, N, N),
3584 };
3585
3586 static struct atlas7_grp_mux rg_eth_mac_grp_mux = {
3587         .pad_mux_count = ARRAY_SIZE(rg_eth_mac_grp_pad_mux),
3588         .pad_mux_list = rg_eth_mac_grp_pad_mux,
3589 };
3590
3591 static struct atlas7_pad_mux rg_gmac_phy_intr_n_grp_pad_mux[] = {
3592         MUX(1, 111, 1, 0xa08, 13, 0xa88, 13),
3593 };
3594
3595 static struct atlas7_grp_mux rg_gmac_phy_intr_n_grp_mux = {
3596         .pad_mux_count = ARRAY_SIZE(rg_gmac_phy_intr_n_grp_pad_mux),
3597         .pad_mux_list = rg_gmac_phy_intr_n_grp_pad_mux,
3598 };
3599
3600 static struct atlas7_pad_mux rg_rgmii_mac_grp_pad_mux[] = {
3601         MUX(1, 109, 1, N, N, N, N),
3602         MUX(1, 110, 1, N, N, N, N),
3603 };
3604
3605 static struct atlas7_grp_mux rg_rgmii_mac_grp_mux = {
3606         .pad_mux_count = ARRAY_SIZE(rg_rgmii_mac_grp_pad_mux),
3607         .pad_mux_list = rg_rgmii_mac_grp_pad_mux,
3608 };
3609
3610 static struct atlas7_pad_mux rg_rgmii_phy_ref_clk_grp0_pad_mux[] = {
3611         MUX(1, 111, 5, N, N, N, N),
3612 };
3613
3614 static struct atlas7_grp_mux rg_rgmii_phy_ref_clk_grp0_mux = {
3615         .pad_mux_count = ARRAY_SIZE(rg_rgmii_phy_ref_clk_grp0_pad_mux),
3616         .pad_mux_list = rg_rgmii_phy_ref_clk_grp0_pad_mux,
3617 };
3618
3619 static struct atlas7_pad_mux rg_rgmii_phy_ref_clk_grp1_pad_mux[] = {
3620         MUX(1, 53, 4, N, N, N, N),
3621 };
3622
3623 static struct atlas7_grp_mux rg_rgmii_phy_ref_clk_grp1_mux = {
3624         .pad_mux_count = ARRAY_SIZE(rg_rgmii_phy_ref_clk_grp1_pad_mux),
3625         .pad_mux_list = rg_rgmii_phy_ref_clk_grp1_pad_mux,
3626 };
3627
3628 static struct atlas7_pad_mux sd0_grp_pad_mux[] = {
3629         MUX(1, 46, 2, N, N, N, N),
3630         MUX(1, 47, 2, N, N, N, N),
3631         MUX(1, 44, 2, N, N, N, N),
3632         MUX(1, 43, 2, N, N, N, N),
3633         MUX(1, 42, 2, N, N, N, N),
3634         MUX(1, 41, 2, N, N, N, N),
3635         MUX(1, 40, 2, N, N, N, N),
3636         MUX(1, 39, 2, N, N, N, N),
3637         MUX(1, 38, 2, N, N, N, N),
3638         MUX(1, 37, 2, N, N, N, N),
3639 };
3640
3641 static struct atlas7_grp_mux sd0_grp_mux = {
3642         .pad_mux_count = ARRAY_SIZE(sd0_grp_pad_mux),
3643         .pad_mux_list = sd0_grp_pad_mux,
3644 };
3645
3646 static struct atlas7_pad_mux sd0_4bit_grp_pad_mux[] = {
3647         MUX(1, 46, 2, N, N, N, N),
3648         MUX(1, 47, 2, N, N, N, N),
3649         MUX(1, 44, 2, N, N, N, N),
3650         MUX(1, 43, 2, N, N, N, N),
3651         MUX(1, 42, 2, N, N, N, N),
3652         MUX(1, 41, 2, N, N, N, N),
3653 };
3654
3655 static struct atlas7_grp_mux sd0_4bit_grp_mux = {
3656         .pad_mux_count = ARRAY_SIZE(sd0_4bit_grp_pad_mux),
3657         .pad_mux_list = sd0_4bit_grp_pad_mux,
3658 };
3659
3660 static struct atlas7_pad_mux sd1_grp_pad_mux[] = {
3661         MUX(1, 48, 3, N, N, N, N),
3662         MUX(1, 49, 3, N, N, N, N),
3663         MUX(1, 44, 3, 0xa00, 0, 0xa80, 0),
3664         MUX(1, 43, 3, 0xa00, 1, 0xa80, 1),
3665         MUX(1, 42, 3, 0xa00, 2, 0xa80, 2),
3666         MUX(1, 41, 3, 0xa00, 3, 0xa80, 3),
3667         MUX(1, 40, 3, N, N, N, N),
3668         MUX(1, 39, 3, N, N, N, N),
3669         MUX(1, 38, 3, N, N, N, N),
3670         MUX(1, 37, 3, N, N, N, N),
3671 };
3672
3673 static struct atlas7_grp_mux sd1_grp_mux = {
3674         .pad_mux_count = ARRAY_SIZE(sd1_grp_pad_mux),
3675         .pad_mux_list = sd1_grp_pad_mux,
3676 };
3677
3678 static struct atlas7_pad_mux sd1_4bit_grp0_pad_mux[] = {
3679         MUX(1, 48, 3, N, N, N, N),
3680         MUX(1, 49, 3, N, N, N, N),
3681         MUX(1, 44, 3, 0xa00, 0, 0xa80, 0),
3682         MUX(1, 43, 3, 0xa00, 1, 0xa80, 1),
3683         MUX(1, 42, 3, 0xa00, 2, 0xa80, 2),
3684         MUX(1, 41, 3, 0xa00, 3, 0xa80, 3),
3685 };
3686
3687 static struct atlas7_grp_mux sd1_4bit_grp0_mux = {
3688         .pad_mux_count = ARRAY_SIZE(sd1_4bit_grp0_pad_mux),
3689         .pad_mux_list = sd1_4bit_grp0_pad_mux,
3690 };
3691
3692 static struct atlas7_pad_mux sd1_4bit_grp1_pad_mux[] = {
3693         MUX(1, 48, 3, N, N, N, N),
3694         MUX(1, 49, 3, N, N, N, N),
3695         MUX(1, 40, 4, 0xa00, 0, 0xa80, 0),
3696         MUX(1, 39, 4, 0xa00, 1, 0xa80, 1),
3697         MUX(1, 38, 4, 0xa00, 2, 0xa80, 2),
3698         MUX(1, 37, 4, 0xa00, 3, 0xa80, 3),
3699 };
3700
3701 static struct atlas7_grp_mux sd1_4bit_grp1_mux = {
3702         .pad_mux_count = ARRAY_SIZE(sd1_4bit_grp1_pad_mux),
3703         .pad_mux_list = sd1_4bit_grp1_pad_mux,
3704 };
3705
3706 static struct atlas7_pad_mux sd2_basic_grp_pad_mux[] = {
3707         MUX(1, 31, 1, N, N, N, N),
3708         MUX(1, 32, 1, N, N, N, N),
3709         MUX(1, 33, 1, N, N, N, N),
3710         MUX(1, 34, 1, N, N, N, N),
3711         MUX(1, 35, 1, N, N, N, N),
3712         MUX(1, 36, 1, N, N, N, N),
3713 };
3714
3715 static struct atlas7_grp_mux sd2_basic_grp_mux = {
3716         .pad_mux_count = ARRAY_SIZE(sd2_basic_grp_pad_mux),
3717         .pad_mux_list = sd2_basic_grp_pad_mux,
3718 };
3719
3720 static struct atlas7_pad_mux sd2_cdb_grp0_pad_mux[] = {
3721         MUX(1, 124, 2, 0xa08, 7, 0xa88, 7),
3722 };
3723
3724 static struct atlas7_grp_mux sd2_cdb_grp0_mux = {
3725         .pad_mux_count = ARRAY_SIZE(sd2_cdb_grp0_pad_mux),
3726         .pad_mux_list = sd2_cdb_grp0_pad_mux,
3727 };
3728
3729 static struct atlas7_pad_mux sd2_cdb_grp1_pad_mux[] = {
3730         MUX(1, 161, 6, 0xa08, 7, 0xa88, 7),
3731 };
3732
3733 static struct atlas7_grp_mux sd2_cdb_grp1_mux = {
3734         .pad_mux_count = ARRAY_SIZE(sd2_cdb_grp1_pad_mux),
3735         .pad_mux_list = sd2_cdb_grp1_pad_mux,
3736 };
3737
3738 static struct atlas7_pad_mux sd2_wpb_grp0_pad_mux[] = {
3739         MUX(1, 123, 2, 0xa10, 6, 0xa90, 6),
3740 };
3741
3742 static struct atlas7_grp_mux sd2_wpb_grp0_mux = {
3743         .pad_mux_count = ARRAY_SIZE(sd2_wpb_grp0_pad_mux),
3744         .pad_mux_list = sd2_wpb_grp0_pad_mux,
3745 };
3746
3747 static struct atlas7_pad_mux sd2_wpb_grp1_pad_mux[] = {
3748         MUX(1, 163, 7, 0xa10, 6, 0xa90, 6),
3749 };
3750
3751 static struct atlas7_grp_mux sd2_wpb_grp1_mux = {
3752         .pad_mux_count = ARRAY_SIZE(sd2_wpb_grp1_pad_mux),
3753         .pad_mux_list = sd2_wpb_grp1_pad_mux,
3754 };
3755
3756 static struct atlas7_pad_mux sd3_9_grp_pad_mux[] = {
3757         MUX(1, 85, 1, N, N, N, N),
3758         MUX(1, 86, 1, N, N, N, N),
3759         MUX(1, 87, 1, N, N, N, N),
3760         MUX(1, 88, 1, N, N, N, N),
3761         MUX(1, 89, 1, N, N, N, N),
3762         MUX(1, 90, 1, N, N, N, N),
3763 };
3764
3765 static struct atlas7_grp_mux sd3_9_grp_mux = {
3766         .pad_mux_count = ARRAY_SIZE(sd3_9_grp_pad_mux),
3767         .pad_mux_list = sd3_9_grp_pad_mux,
3768 };
3769
3770 static struct atlas7_pad_mux sd5_grp_pad_mux[] = {
3771         MUX(1, 91, 1, N, N, N, N),
3772         MUX(1, 92, 1, N, N, N, N),
3773         MUX(1, 93, 1, N, N, N, N),
3774         MUX(1, 94, 1, N, N, N, N),
3775         MUX(1, 95, 1, N, N, N, N),
3776         MUX(1, 96, 1, N, N, N, N),
3777 };
3778
3779 static struct atlas7_grp_mux sd5_grp_mux = {
3780         .pad_mux_count = ARRAY_SIZE(sd5_grp_pad_mux),
3781         .pad_mux_list = sd5_grp_pad_mux,
3782 };
3783
3784 static struct atlas7_pad_mux sd6_grp0_pad_mux[] = {
3785         MUX(1, 79, 4, 0xa00, 27, 0xa80, 27),
3786         MUX(1, 78, 4, 0xa00, 26, 0xa80, 26),
3787         MUX(1, 74, 4, 0xa00, 28, 0xa80, 28),
3788         MUX(1, 75, 4, 0xa00, 29, 0xa80, 29),
3789         MUX(1, 76, 4, 0xa00, 30, 0xa80, 30),
3790         MUX(1, 77, 4, 0xa00, 31, 0xa80, 31),
3791 };
3792
3793 static struct atlas7_grp_mux sd6_grp0_mux = {
3794         .pad_mux_count = ARRAY_SIZE(sd6_grp0_pad_mux),
3795         .pad_mux_list = sd6_grp0_pad_mux,
3796 };
3797
3798 static struct atlas7_pad_mux sd6_grp1_pad_mux[] = {
3799         MUX(1, 101, 3, 0xa00, 27, 0xa80, 27),
3800         MUX(1, 99, 3, 0xa00, 26, 0xa80, 26),
3801         MUX(1, 100, 3, 0xa00, 28, 0xa80, 28),
3802         MUX(1, 110, 3, 0xa00, 29, 0xa80, 29),
3803         MUX(1, 109, 3, 0xa00, 30, 0xa80, 30),
3804         MUX(1, 111, 3, 0xa00, 31, 0xa80, 31),
3805 };
3806
3807 static struct atlas7_grp_mux sd6_grp1_mux = {
3808         .pad_mux_count = ARRAY_SIZE(sd6_grp1_pad_mux),
3809         .pad_mux_list = sd6_grp1_pad_mux,
3810 };
3811
3812 static struct atlas7_pad_mux sp0_ext_ldo_on_grp_pad_mux[] = {
3813         MUX(0, 4, 2, N, N, N, N),
3814 };
3815
3816 static struct atlas7_grp_mux sp0_ext_ldo_on_grp_mux = {
3817         .pad_mux_count = ARRAY_SIZE(sp0_ext_ldo_on_grp_pad_mux),
3818         .pad_mux_list = sp0_ext_ldo_on_grp_pad_mux,
3819 };
3820
3821 static struct atlas7_pad_mux sp0_qspi_grp_pad_mux[] = {
3822         MUX(0, 12, 1, N, N, N, N),
3823         MUX(0, 13, 1, N, N, N, N),
3824         MUX(0, 14, 1, N, N, N, N),
3825         MUX(0, 15, 1, N, N, N, N),
3826         MUX(0, 16, 1, N, N, N, N),
3827         MUX(0, 17, 1, N, N, N, N),
3828 };
3829
3830 static struct atlas7_grp_mux sp0_qspi_grp_mux = {
3831         .pad_mux_count = ARRAY_SIZE(sp0_qspi_grp_pad_mux),
3832         .pad_mux_list = sp0_qspi_grp_pad_mux,
3833 };
3834
3835 static struct atlas7_pad_mux sp1_spi_grp_pad_mux[] = {
3836         MUX(1, 19, 1, N, N, N, N),
3837         MUX(1, 20, 1, N, N, N, N),
3838         MUX(1, 21, 1, N, N, N, N),
3839         MUX(1, 18, 1, N, N, N, N),
3840 };
3841
3842 static struct atlas7_grp_mux sp1_spi_grp_mux = {
3843         .pad_mux_count = ARRAY_SIZE(sp1_spi_grp_pad_mux),
3844         .pad_mux_list = sp1_spi_grp_pad_mux,
3845 };
3846
3847 static struct atlas7_pad_mux tpiu_trace_grp_pad_mux[] = {
3848         MUX(1, 53, 5, N, N, N, N),
3849         MUX(1, 56, 5, N, N, N, N),
3850         MUX(1, 57, 5, N, N, N, N),
3851         MUX(1, 58, 5, N, N, N, N),
3852         MUX(1, 59, 5, N, N, N, N),
3853         MUX(1, 60, 5, N, N, N, N),
3854         MUX(1, 61, 5, N, N, N, N),
3855         MUX(1, 62, 5, N, N, N, N),
3856         MUX(1, 63, 5, N, N, N, N),
3857         MUX(1, 64, 5, N, N, N, N),
3858         MUX(1, 65, 5, N, N, N, N),
3859         MUX(1, 66, 5, N, N, N, N),
3860         MUX(1, 67, 5, N, N, N, N),
3861         MUX(1, 68, 5, N, N, N, N),
3862         MUX(1, 69, 5, N, N, N, N),
3863         MUX(1, 70, 5, N, N, N, N),
3864         MUX(1, 71, 5, N, N, N, N),
3865         MUX(1, 72, 5, N, N, N, N),
3866 };
3867
3868 static struct atlas7_grp_mux tpiu_trace_grp_mux = {
3869         .pad_mux_count = ARRAY_SIZE(tpiu_trace_grp_pad_mux),
3870         .pad_mux_list = tpiu_trace_grp_pad_mux,
3871 };
3872
3873 static struct atlas7_pad_mux uart0_grp_pad_mux[] = {
3874         MUX(1, 121, 4, N, N, N, N),
3875         MUX(1, 120, 4, N, N, N, N),
3876         MUX(1, 134, 1, N, N, N, N),
3877         MUX(1, 133, 1, N, N, N, N),
3878 };
3879
3880 static struct atlas7_grp_mux uart0_grp_mux = {
3881         .pad_mux_count = ARRAY_SIZE(uart0_grp_pad_mux),
3882         .pad_mux_list = uart0_grp_pad_mux,
3883 };
3884
3885 static struct atlas7_pad_mux uart0_nopause_grp_pad_mux[] = {
3886         MUX(1, 134, 1, N, N, N, N),
3887         MUX(1, 133, 1, N, N, N, N),
3888 };
3889
3890 static struct atlas7_grp_mux uart0_nopause_grp_mux = {
3891         .pad_mux_count = ARRAY_SIZE(uart0_nopause_grp_pad_mux),
3892         .pad_mux_list = uart0_nopause_grp_pad_mux,
3893 };
3894
3895 static struct atlas7_pad_mux uart1_grp_pad_mux[] = {
3896         MUX(1, 136, 1, N, N, N, N),
3897         MUX(1, 135, 1, N, N, N, N),
3898 };
3899
3900 static struct atlas7_grp_mux uart1_grp_mux = {
3901         .pad_mux_count = ARRAY_SIZE(uart1_grp_pad_mux),
3902         .pad_mux_list = uart1_grp_pad_mux,
3903 };
3904
3905 static struct atlas7_pad_mux uart2_cts_grp0_pad_mux[] = {
3906         MUX(1, 132, 3, 0xa10, 2, 0xa90, 2),
3907 };
3908
3909 static struct atlas7_grp_mux uart2_cts_grp0_mux = {
3910         .pad_mux_count = ARRAY_SIZE(uart2_cts_grp0_pad_mux),
3911         .pad_mux_list = uart2_cts_grp0_pad_mux,
3912 };
3913
3914 static struct atlas7_pad_mux uart2_cts_grp1_pad_mux[] = {
3915         MUX(1, 162, 2, 0xa10, 2, 0xa90, 2),
3916 };
3917
3918 static struct atlas7_grp_mux uart2_cts_grp1_mux = {
3919         .pad_mux_count = ARRAY_SIZE(uart2_cts_grp1_pad_mux),
3920         .pad_mux_list = uart2_cts_grp1_pad_mux,
3921 };
3922
3923 static struct atlas7_pad_mux uart2_rts_grp0_pad_mux[] = {
3924         MUX(1, 131, 3, N, N, N, N),
3925 };
3926
3927 static struct atlas7_grp_mux uart2_rts_grp0_mux = {
3928         .pad_mux_count = ARRAY_SIZE(uart2_rts_grp0_pad_mux),
3929         .pad_mux_list = uart2_rts_grp0_pad_mux,
3930 };
3931
3932 static struct atlas7_pad_mux uart2_rts_grp1_pad_mux[] = {
3933         MUX(1, 161, 2, N, N, N, N),
3934 };
3935
3936 static struct atlas7_grp_mux uart2_rts_grp1_mux = {
3937         .pad_mux_count = ARRAY_SIZE(uart2_rts_grp1_pad_mux),
3938         .pad_mux_list = uart2_rts_grp1_pad_mux,
3939 };
3940
3941 static struct atlas7_pad_mux uart2_rxd_grp0_pad_mux[] = {
3942         MUX(0, 11, 2, 0xa10, 5, 0xa90, 5),
3943 };
3944
3945 static struct atlas7_grp_mux uart2_rxd_grp0_mux = {
3946         .pad_mux_count = ARRAY_SIZE(uart2_rxd_grp0_pad_mux),
3947         .pad_mux_list = uart2_rxd_grp0_pad_mux,
3948 };
3949
3950 static struct atlas7_pad_mux uart2_rxd_grp1_pad_mux[] = {
3951         MUX(1, 160, 2, 0xa10, 5, 0xa90, 5),
3952 };
3953
3954 static struct atlas7_grp_mux uart2_rxd_grp1_mux = {
3955         .pad_mux_count = ARRAY_SIZE(uart2_rxd_grp1_pad_mux),
3956         .pad_mux_list = uart2_rxd_grp1_pad_mux,
3957 };
3958
3959 static struct atlas7_pad_mux uart2_rxd_grp2_pad_mux[] = {
3960         MUX(1, 130, 3, 0xa10, 5, 0xa90, 5),
3961 };
3962
3963 static struct atlas7_grp_mux uart2_rxd_grp2_mux = {
3964         .pad_mux_count = ARRAY_SIZE(uart2_rxd_grp2_pad_mux),
3965         .pad_mux_list = uart2_rxd_grp2_pad_mux,
3966 };
3967
3968 static struct atlas7_pad_mux uart2_txd_grp0_pad_mux[] = {
3969         MUX(0, 10, 2, N, N, N, N),
3970 };
3971
3972 static struct atlas7_grp_mux uart2_txd_grp0_mux = {
3973         .pad_mux_count = ARRAY_SIZE(uart2_txd_grp0_pad_mux),
3974         .pad_mux_list = uart2_txd_grp0_pad_mux,
3975 };
3976
3977 static struct atlas7_pad_mux uart2_txd_grp1_pad_mux[] = {
3978         MUX(1, 159, 2, N, N, N, N),
3979 };
3980
3981 static struct atlas7_grp_mux uart2_txd_grp1_mux = {
3982         .pad_mux_count = ARRAY_SIZE(uart2_txd_grp1_pad_mux),
3983         .pad_mux_list = uart2_txd_grp1_pad_mux,
3984 };
3985
3986 static struct atlas7_pad_mux uart2_txd_grp2_pad_mux[] = {
3987         MUX(1, 129, 3, N, N, N, N),
3988 };
3989
3990 static struct atlas7_grp_mux uart2_txd_grp2_mux = {
3991         .pad_mux_count = ARRAY_SIZE(uart2_txd_grp2_pad_mux),
3992         .pad_mux_list = uart2_txd_grp2_pad_mux,
3993 };
3994
3995 static struct atlas7_pad_mux uart3_cts_grp0_pad_mux[] = {
3996         MUX(1, 125, 2, 0xa08, 0, 0xa88, 0),
3997 };
3998
3999 static struct atlas7_grp_mux uart3_cts_grp0_mux = {
4000         .pad_mux_count = ARRAY_SIZE(uart3_cts_grp0_pad_mux),
4001         .pad_mux_list = uart3_cts_grp0_pad_mux,
4002 };
4003
4004 static struct atlas7_pad_mux uart3_cts_grp1_pad_mux[] = {
4005         MUX(1, 111, 4, 0xa08, 0, 0xa88, 0),
4006 };
4007
4008 static struct atlas7_grp_mux uart3_cts_grp1_mux = {
4009         .pad_mux_count = ARRAY_SIZE(uart3_cts_grp1_pad_mux),
4010         .pad_mux_list = uart3_cts_grp1_pad_mux,
4011 };
4012
4013 static struct atlas7_pad_mux uart3_cts_grp2_pad_mux[] = {
4014         MUX(1, 140, 2, 0xa08, 0, 0xa88, 0),
4015 };
4016
4017 static struct atlas7_grp_mux uart3_cts_grp2_mux = {
4018         .pad_mux_count = ARRAY_SIZE(uart3_cts_grp2_pad_mux),
4019         .pad_mux_list = uart3_cts_grp2_pad_mux,
4020 };
4021
4022 static struct atlas7_pad_mux uart3_rts_grp0_pad_mux[] = {
4023         MUX(1, 126, 2, N, N, N, N),
4024 };
4025
4026 static struct atlas7_grp_mux uart3_rts_grp0_mux = {
4027         .pad_mux_count = ARRAY_SIZE(uart3_rts_grp0_pad_mux),
4028         .pad_mux_list = uart3_rts_grp0_pad_mux,
4029 };
4030
4031 static struct atlas7_pad_mux uart3_rts_grp1_pad_mux[] = {
4032         MUX(1, 109, 4, N, N, N, N),
4033 };
4034
4035 static struct atlas7_grp_mux uart3_rts_grp1_mux = {
4036         .pad_mux_count = ARRAY_SIZE(uart3_rts_grp1_pad_mux),
4037         .pad_mux_list = uart3_rts_grp1_pad_mux,
4038 };
4039
4040 static struct atlas7_pad_mux uart3_rts_grp2_pad_mux[] = {
4041         MUX(1, 139, 2, N, N, N, N),
4042 };
4043
4044 static struct atlas7_grp_mux uart3_rts_grp2_mux = {
4045         .pad_mux_count = ARRAY_SIZE(uart3_rts_grp2_pad_mux),
4046         .pad_mux_list = uart3_rts_grp2_pad_mux,
4047 };
4048
4049 static struct atlas7_pad_mux uart3_rxd_grp0_pad_mux[] = {
4050         MUX(1, 138, 1, 0xa00, 5, 0xa80, 5),
4051 };
4052
4053 static struct atlas7_grp_mux uart3_rxd_grp0_mux = {
4054         .pad_mux_count = ARRAY_SIZE(uart3_rxd_grp0_pad_mux),
4055         .pad_mux_list = uart3_rxd_grp0_pad_mux,
4056 };
4057
4058 static struct atlas7_pad_mux uart3_rxd_grp1_pad_mux[] = {
4059         MUX(1, 84, 2, 0xa00, 5, 0xa80, 5),
4060 };
4061
4062 static struct atlas7_grp_mux uart3_rxd_grp1_mux = {
4063         .pad_mux_count = ARRAY_SIZE(uart3_rxd_grp1_pad_mux),
4064         .pad_mux_list = uart3_rxd_grp1_pad_mux,
4065 };
4066
4067 static struct atlas7_pad_mux uart3_rxd_grp2_pad_mux[] = {
4068         MUX(1, 162, 3, 0xa00, 5, 0xa80, 5),
4069 };
4070
4071 static struct atlas7_grp_mux uart3_rxd_grp2_mux = {
4072         .pad_mux_count = ARRAY_SIZE(uart3_rxd_grp2_pad_mux),
4073         .pad_mux_list = uart3_rxd_grp2_pad_mux,
4074 };
4075
4076 static struct atlas7_pad_mux uart3_txd_grp0_pad_mux[] = {
4077         MUX(1, 137, 1, N, N, N, N),
4078 };
4079
4080 static struct atlas7_grp_mux uart3_txd_grp0_mux = {
4081         .pad_mux_count = ARRAY_SIZE(uart3_txd_grp0_pad_mux),
4082         .pad_mux_list = uart3_txd_grp0_pad_mux,
4083 };
4084
4085 static struct atlas7_pad_mux uart3_txd_grp1_pad_mux[] = {
4086         MUX(1, 83, 2, N, N, N, N),
4087 };
4088
4089 static struct atlas7_grp_mux uart3_txd_grp1_mux = {
4090         .pad_mux_count = ARRAY_SIZE(uart3_txd_grp1_pad_mux),
4091         .pad_mux_list = uart3_txd_grp1_pad_mux,
4092 };
4093
4094 static struct atlas7_pad_mux uart3_txd_grp2_pad_mux[] = {
4095         MUX(1, 161, 3, N, N, N, N),
4096 };
4097
4098 static struct atlas7_grp_mux uart3_txd_grp2_mux = {
4099         .pad_mux_count = ARRAY_SIZE(uart3_txd_grp2_pad_mux),
4100         .pad_mux_list = uart3_txd_grp2_pad_mux,
4101 };
4102
4103 static struct atlas7_pad_mux uart4_basic_grp_pad_mux[] = {
4104         MUX(1, 140, 1, N, N, N, N),
4105         MUX(1, 139, 1, N, N, N, N),
4106 };
4107
4108 static struct atlas7_grp_mux uart4_basic_grp_mux = {
4109         .pad_mux_count = ARRAY_SIZE(uart4_basic_grp_pad_mux),
4110         .pad_mux_list = uart4_basic_grp_pad_mux,
4111 };
4112
4113 static struct atlas7_pad_mux uart4_cts_grp0_pad_mux[] = {
4114         MUX(1, 122, 4, 0xa08, 1, 0xa88, 1),
4115 };
4116
4117 static struct atlas7_grp_mux uart4_cts_grp0_mux = {
4118         .pad_mux_count = ARRAY_SIZE(uart4_cts_grp0_pad_mux),
4119         .pad_mux_list = uart4_cts_grp0_pad_mux,
4120 };
4121
4122 static struct atlas7_pad_mux uart4_cts_grp1_pad_mux[] = {
4123         MUX(1, 100, 4, 0xa08, 1, 0xa88, 1),
4124 };
4125
4126 static struct atlas7_grp_mux uart4_cts_grp1_mux = {
4127         .pad_mux_count = ARRAY_SIZE(uart4_cts_grp1_pad_mux),
4128         .pad_mux_list = uart4_cts_grp1_pad_mux,
4129 };
4130
4131 static struct atlas7_pad_mux uart4_cts_grp2_pad_mux[] = {
4132         MUX(1, 117, 2, 0xa08, 1, 0xa88, 1),
4133 };
4134
4135 static struct atlas7_grp_mux uart4_cts_grp2_mux = {
4136         .pad_mux_count = ARRAY_SIZE(uart4_cts_grp2_pad_mux),
4137         .pad_mux_list = uart4_cts_grp2_pad_mux,
4138 };
4139
4140 static struct atlas7_pad_mux uart4_rts_grp0_pad_mux[] = {
4141         MUX(1, 123, 4, N, N, N, N),
4142 };
4143
4144 static struct atlas7_grp_mux uart4_rts_grp0_mux = {
4145         .pad_mux_count = ARRAY_SIZE(uart4_rts_grp0_pad_mux),
4146         .pad_mux_list = uart4_rts_grp0_pad_mux,
4147 };
4148
4149 static struct atlas7_pad_mux uart4_rts_grp1_pad_mux[] = {
4150         MUX(1, 99, 4, N, N, N, N),
4151 };
4152
4153 static struct atlas7_grp_mux uart4_rts_grp1_mux = {
4154         .pad_mux_count = ARRAY_SIZE(uart4_rts_grp1_pad_mux),
4155         .pad_mux_list = uart4_rts_grp1_pad_mux,
4156 };
4157
4158 static struct atlas7_pad_mux uart4_rts_grp2_pad_mux[] = {
4159         MUX(1, 116, 2, N, N, N, N),
4160 };
4161
4162 static struct atlas7_grp_mux uart4_rts_grp2_mux = {
4163         .pad_mux_count = ARRAY_SIZE(uart4_rts_grp2_pad_mux),
4164         .pad_mux_list = uart4_rts_grp2_pad_mux,
4165 };
4166
4167 static struct atlas7_pad_mux usb0_drvvbus_grp0_pad_mux[] = {
4168         MUX(1, 51, 2, N, N, N, N),
4169 };
4170
4171 static struct atlas7_grp_mux usb0_drvvbus_grp0_mux = {
4172         .pad_mux_count = ARRAY_SIZE(usb0_drvvbus_grp0_pad_mux),
4173         .pad_mux_list = usb0_drvvbus_grp0_pad_mux,
4174 };
4175
4176 static struct atlas7_pad_mux usb0_drvvbus_grp1_pad_mux[] = {
4177         MUX(1, 162, 7, N, N, N, N),
4178 };
4179
4180 static struct atlas7_grp_mux usb0_drvvbus_grp1_mux = {
4181         .pad_mux_count = ARRAY_SIZE(usb0_drvvbus_grp1_pad_mux),
4182         .pad_mux_list = usb0_drvvbus_grp1_pad_mux,
4183 };
4184
4185 static struct atlas7_pad_mux usb1_drvvbus_grp0_pad_mux[] = {
4186         MUX(1, 134, 2, N, N, N, N),
4187 };
4188
4189 static struct atlas7_grp_mux usb1_drvvbus_grp0_mux = {
4190         .pad_mux_count = ARRAY_SIZE(usb1_drvvbus_grp0_pad_mux),
4191         .pad_mux_list = usb1_drvvbus_grp0_pad_mux,
4192 };
4193
4194 static struct atlas7_pad_mux usb1_drvvbus_grp1_pad_mux[] = {
4195         MUX(1, 163, 2, N, N, N, N),
4196 };
4197
4198 static struct atlas7_grp_mux usb1_drvvbus_grp1_mux = {
4199         .pad_mux_count = ARRAY_SIZE(usb1_drvvbus_grp1_pad_mux),
4200         .pad_mux_list = usb1_drvvbus_grp1_pad_mux,
4201 };
4202
4203 static struct atlas7_pad_mux visbus_dout_grp_pad_mux[] = {
4204         MUX(1, 57, 6, N, N, N, N),
4205         MUX(1, 58, 6, N, N, N, N),
4206         MUX(1, 59, 6, N, N, N, N),
4207         MUX(1, 60, 6, N, N, N, N),
4208         MUX(1, 61, 6, N, N, N, N),
4209         MUX(1, 62, 6, N, N, N, N),
4210         MUX(1, 63, 6, N, N, N, N),
4211         MUX(1, 64, 6, N, N, N, N),
4212         MUX(1, 65, 6, N, N, N, N),
4213         MUX(1, 66, 6, N, N, N, N),
4214         MUX(1, 67, 6, N, N, N, N),
4215         MUX(1, 68, 6, N, N, N, N),
4216         MUX(1, 69, 6, N, N, N, N),
4217         MUX(1, 70, 6, N, N, N, N),
4218         MUX(1, 71, 6, N, N, N, N),
4219         MUX(1, 72, 6, N, N, N, N),
4220         MUX(1, 53, 6, N, N, N, N),
4221         MUX(1, 54, 6, N, N, N, N),
4222         MUX(1, 55, 6, N, N, N, N),
4223         MUX(1, 56, 6, N, N, N, N),
4224         MUX(1, 85, 6, N, N, N, N),
4225         MUX(1, 86, 6, N, N, N, N),
4226         MUX(1, 87, 6, N, N, N, N),
4227         MUX(1, 88, 6, N, N, N, N),
4228         MUX(1, 89, 6, N, N, N, N),
4229         MUX(1, 90, 6, N, N, N, N),
4230         MUX(1, 91, 6, N, N, N, N),
4231         MUX(1, 92, 6, N, N, N, N),
4232         MUX(1, 93, 6, N, N, N, N),
4233         MUX(1, 94, 6, N, N, N, N),
4234         MUX(1, 95, 6, N, N, N, N),
4235         MUX(1, 96, 6, N, N, N, N),
4236 };
4237
4238 static struct atlas7_grp_mux visbus_dout_grp_mux = {
4239         .pad_mux_count = ARRAY_SIZE(visbus_dout_grp_pad_mux),
4240         .pad_mux_list = visbus_dout_grp_pad_mux,
4241 };
4242
4243 static struct atlas7_pad_mux vi_vip1_grp_pad_mux[] = {
4244         MUX(1, 74, 1, N, N, N, N),
4245         MUX(1, 75, 1, N, N, N, N),
4246         MUX(1, 76, 1, N, N, N, N),
4247         MUX(1, 77, 1, N, N, N, N),
4248         MUX(1, 78, 1, N, N, N, N),
4249         MUX(1, 79, 1, N, N, N, N),
4250         MUX(1, 80, 1, N, N, N, N),
4251         MUX(1, 81, 1, N, N, N, N),
4252         MUX(1, 82, 1, N, N, N, N),
4253         MUX(1, 83, 1, N, N, N, N),
4254         MUX(1, 84, 1, N, N, N, N),
4255         MUX(1, 103, 2, N, N, N, N),
4256         MUX(1, 104, 2, N, N, N, N),
4257         MUX(1, 105, 2, N, N, N, N),
4258         MUX(1, 106, 2, N, N, N, N),
4259         MUX(1, 107, 2, N, N, N, N),
4260         MUX(1, 102, 2, N, N, N, N),
4261         MUX(1, 97, 2, N, N, N, N),
4262         MUX(1, 98, 2, N, N, N, N),
4263 };
4264
4265 static struct atlas7_grp_mux vi_vip1_grp_mux = {
4266         .pad_mux_count = ARRAY_SIZE(vi_vip1_grp_pad_mux),
4267         .pad_mux_list = vi_vip1_grp_pad_mux,
4268 };
4269
4270 static struct atlas7_pad_mux vi_vip1_ext_grp_pad_mux[] = {
4271         MUX(1, 74, 1, N, N, N, N),
4272         MUX(1, 75, 1, N, N, N, N),
4273         MUX(1, 76, 1, N, N, N, N),
4274         MUX(1, 77, 1, N, N, N, N),
4275         MUX(1, 78, 1, N, N, N, N),
4276         MUX(1, 79, 1, N, N, N, N),
4277         MUX(1, 80, 1, N, N, N, N),
4278         MUX(1, 81, 1, N, N, N, N),
4279         MUX(1, 82, 1, N, N, N, N),
4280         MUX(1, 83, 1, N, N, N, N),
4281         MUX(1, 84, 1, N, N, N, N),
4282         MUX(1, 108, 2, N, N, N, N),
4283         MUX(1, 103, 2, N, N, N, N),
4284         MUX(1, 104, 2, N, N, N, N),
4285         MUX(1, 105, 2, N, N, N, N),
4286         MUX(1, 106, 2, N, N, N, N),
4287         MUX(1, 107, 2, N, N, N, N),
4288         MUX(1, 102, 2, N, N, N, N),
4289         MUX(1, 97, 2, N, N, N, N),
4290         MUX(1, 98, 2, N, N, N, N),
4291         MUX(1, 99, 2, N, N, N, N),
4292         MUX(1, 100, 2, N, N, N, N),
4293 };
4294
4295 static struct atlas7_grp_mux vi_vip1_ext_grp_mux = {
4296         .pad_mux_count = ARRAY_SIZE(vi_vip1_ext_grp_pad_mux),
4297         .pad_mux_list = vi_vip1_ext_grp_pad_mux,
4298 };
4299
4300 static struct atlas7_pad_mux vi_vip1_low8bit_grp_pad_mux[] = {
4301         MUX(1, 74, 1, N, N, N, N),
4302         MUX(1, 75, 1, N, N, N, N),
4303         MUX(1, 76, 1, N, N, N, N),
4304         MUX(1, 77, 1, N, N, N, N),
4305         MUX(1, 78, 1, N, N, N, N),
4306         MUX(1, 79, 1, N, N, N, N),
4307         MUX(1, 80, 1, N, N, N, N),
4308         MUX(1, 81, 1, N, N, N, N),
4309         MUX(1, 82, 1, N, N, N, N),
4310         MUX(1, 83, 1, N, N, N, N),
4311         MUX(1, 84, 1, N, N, N, N),
4312 };
4313
4314 static struct atlas7_grp_mux vi_vip1_low8bit_grp_mux = {
4315         .pad_mux_count = ARRAY_SIZE(vi_vip1_low8bit_grp_pad_mux),
4316         .pad_mux_list = vi_vip1_low8bit_grp_pad_mux,
4317 };
4318
4319 static struct atlas7_pad_mux vi_vip1_high8bit_grp_pad_mux[] = {
4320         MUX(1, 82, 1, N, N, N, N),
4321         MUX(1, 83, 1, N, N, N, N),
4322         MUX(1, 84, 1, N, N, N, N),
4323         MUX(1, 103, 2, N, N, N, N),
4324         MUX(1, 104, 2, N, N, N, N),
4325         MUX(1, 105, 2, N, N, N, N),
4326         MUX(1, 106, 2, N, N, N, N),
4327         MUX(1, 107, 2, N, N, N, N),
4328         MUX(1, 102, 2, N, N, N, N),
4329         MUX(1, 97, 2, N, N, N, N),
4330         MUX(1, 98, 2, N, N, N, N),
4331 };
4332
4333 static struct atlas7_grp_mux vi_vip1_high8bit_grp_mux = {
4334         .pad_mux_count = ARRAY_SIZE(vi_vip1_high8bit_grp_pad_mux),
4335         .pad_mux_list = vi_vip1_high8bit_grp_pad_mux,
4336 };
4337
4338 static struct atlas7_pmx_func atlas7_pmx_functions[] = {
4339         FUNCTION("gnss_gpio", gnss_gpio_grp, &gnss_gpio_grp_mux),
4340         FUNCTION("lcd_vip_gpio", lcd_vip_gpio_grp, &lcd_vip_gpio_grp_mux),
4341         FUNCTION("sdio_i2s_gpio", sdio_i2s_gpio_grp, &sdio_i2s_gpio_grp_mux),
4342         FUNCTION("sp_rgmii_gpio", sp_rgmii_gpio_grp, &sp_rgmii_gpio_grp_mux),
4343         FUNCTION("lvds_gpio", lvds_gpio_grp, &lvds_gpio_grp_mux),
4344         FUNCTION("jtag_uart_nand_gpio",
4345                         jtag_uart_nand_gpio_grp,
4346                         &jtag_uart_nand_gpio_grp_mux),
4347         FUNCTION("rtc_gpio", rtc_gpio_grp, &rtc_gpio_grp_mux),
4348         FUNCTION("audio_ac97", audio_ac97_grp, &audio_ac97_grp_mux),
4349         FUNCTION("audio_digmic_m0",
4350                         audio_digmic_grp0,
4351                         &audio_digmic_grp0_mux),
4352         FUNCTION("audio_digmic_m1",
4353                         audio_digmic_grp1,
4354                         &audio_digmic_grp1_mux),
4355         FUNCTION("audio_digmic_m2",
4356                         audio_digmic_grp2,
4357                         &audio_digmic_grp2_mux),
4358         FUNCTION("audio_func_dbg",
4359                         audio_func_dbg_grp,
4360                         &audio_func_dbg_grp_mux),
4361         FUNCTION("audio_i2s", audio_i2s_grp, &audio_i2s_grp_mux),
4362         FUNCTION("audio_i2s_2ch", audio_i2s_2ch_grp, &audio_i2s_2ch_grp_mux),
4363         FUNCTION("audio_i2s_extclk",
4364                         audio_i2s_extclk_grp,
4365                         &audio_i2s_extclk_grp_mux),
4366         FUNCTION("audio_spdif_out_m0",
4367                         audio_spdif_out_grp0,
4368                         &audio_spdif_out_grp0_mux),
4369         FUNCTION("audio_spdif_out_m1",
4370                         audio_spdif_out_grp1,
4371                         &audio_spdif_out_grp1_mux),
4372         FUNCTION("audio_spdif_out_m2",
4373                         audio_spdif_out_grp2,
4374                         &audio_spdif_out_grp2_mux),
4375         FUNCTION("audio_uart0_basic",
4376                         audio_uart0_basic_grp,
4377                         &audio_uart0_basic_grp_mux),
4378         FUNCTION("audio_uart0_urfs_m0",
4379                         audio_uart0_urfs_grp0,
4380                         &audio_uart0_urfs_grp0_mux),
4381         FUNCTION("audio_uart0_urfs_m1",
4382                         audio_uart0_urfs_grp1,
4383                         &audio_uart0_urfs_grp1_mux),
4384         FUNCTION("audio_uart0_urfs_m2",
4385                         audio_uart0_urfs_grp2,
4386                         &audio_uart0_urfs_grp2_mux),
4387         FUNCTION("audio_uart0_urfs_m3",
4388                         audio_uart0_urfs_grp3,
4389                         &audio_uart0_urfs_grp3_mux),
4390         FUNCTION("audio_uart1_basic",
4391                         audio_uart1_basic_grp,
4392                         &audio_uart1_basic_grp_mux),
4393         FUNCTION("audio_uart1_urfs_m0",
4394                         audio_uart1_urfs_grp0,
4395                         &audio_uart1_urfs_grp0_mux),
4396         FUNCTION("audio_uart1_urfs_m1",
4397                         audio_uart1_urfs_grp1,
4398                         &audio_uart1_urfs_grp1_mux),
4399         FUNCTION("audio_uart1_urfs_m2",
4400                         audio_uart1_urfs_grp2,
4401                         &audio_uart1_urfs_grp2_mux),
4402         FUNCTION("audio_uart2_urfs_m0",
4403                         audio_uart2_urfs_grp0,
4404                         &audio_uart2_urfs_grp0_mux),
4405         FUNCTION("audio_uart2_urfs_m1",
4406                         audio_uart2_urfs_grp1,
4407                         &audio_uart2_urfs_grp1_mux),
4408         FUNCTION("audio_uart2_urfs_m2",
4409                         audio_uart2_urfs_grp2,
4410                         &audio_uart2_urfs_grp2_mux),
4411         FUNCTION("audio_uart2_urxd_m0",
4412                         audio_uart2_urxd_grp0,
4413                         &audio_uart2_urxd_grp0_mux),
4414         FUNCTION("audio_uart2_urxd_m1",
4415                         audio_uart2_urxd_grp1,
4416                         &audio_uart2_urxd_grp1_mux),
4417         FUNCTION("audio_uart2_urxd_m2",
4418                         audio_uart2_urxd_grp2,
4419                         &audio_uart2_urxd_grp2_mux),
4420         FUNCTION("audio_uart2_usclk_m0",
4421                         audio_uart2_usclk_grp0,
4422                         &audio_uart2_usclk_grp0_mux),
4423         FUNCTION("audio_uart2_usclk_m1",
4424                         audio_uart2_usclk_grp1,
4425                         &audio_uart2_usclk_grp1_mux),
4426         FUNCTION("audio_uart2_usclk_m2",
4427                         audio_uart2_usclk_grp2,
4428                         &audio_uart2_usclk_grp2_mux),
4429         FUNCTION("audio_uart2_utfs_m0",
4430                         audio_uart2_utfs_grp0,
4431                         &audio_uart2_utfs_grp0_mux),
4432         FUNCTION("audio_uart2_utfs_m1",
4433                         audio_uart2_utfs_grp1,
4434                         &audio_uart2_utfs_grp1_mux),
4435         FUNCTION("audio_uart2_utfs_m2",
4436                         audio_uart2_utfs_grp2,
4437                         &audio_uart2_utfs_grp2_mux),
4438         FUNCTION("audio_uart2_utxd_m0",
4439                         audio_uart2_utxd_grp0,
4440                         &audio_uart2_utxd_grp0_mux),
4441         FUNCTION("audio_uart2_utxd_m1",
4442                         audio_uart2_utxd_grp1,
4443                         &audio_uart2_utxd_grp1_mux),
4444         FUNCTION("audio_uart2_utxd_m2",
4445                         audio_uart2_utxd_grp2,
4446                         &audio_uart2_utxd_grp2_mux),
4447         FUNCTION("c_can_trnsvr_en_m0",
4448                         c_can_trnsvr_en_grp0,
4449                         &c_can_trnsvr_en_grp0_mux),
4450         FUNCTION("c_can_trnsvr_en_m1",
4451                         c_can_trnsvr_en_grp1,
4452                         &c_can_trnsvr_en_grp1_mux),
4453         FUNCTION("c_can_trnsvr_intr",
4454                         c_can_trnsvr_intr_grp,
4455                         &c_can_trnsvr_intr_grp_mux),
4456         FUNCTION("c_can_trnsvr_stb_n",
4457                         c_can_trnsvr_stb_n_grp,
4458                         &c_can_trnsvr_stb_n_grp_mux),
4459         FUNCTION("c0_can_rxd_trnsv0",
4460                         c0_can_rxd_trnsv0_grp,
4461                         &c0_can_rxd_trnsv0_grp_mux),
4462         FUNCTION("c0_can_rxd_trnsv1",
4463                         c0_can_rxd_trnsv1_grp,
4464                         &c0_can_rxd_trnsv1_grp_mux),
4465         FUNCTION("c0_can_txd_trnsv0",
4466                         c0_can_txd_trnsv0_grp,
4467                         &c0_can_txd_trnsv0_grp_mux),
4468         FUNCTION("c0_can_txd_trnsv1",
4469                         c0_can_txd_trnsv1_grp,
4470                         &c0_can_txd_trnsv1_grp_mux),
4471         FUNCTION("c1_can_rxd_m0", c1_can_rxd_grp0, &c1_can_rxd_grp0_mux),
4472         FUNCTION("c1_can_rxd_m1", c1_can_rxd_grp1, &c1_can_rxd_grp1_mux),
4473         FUNCTION("c1_can_rxd_m2", c1_can_rxd_grp2, &c1_can_rxd_grp2_mux),
4474         FUNCTION("c1_can_rxd_m3", c1_can_rxd_grp3, &c1_can_rxd_grp3_mux),
4475         FUNCTION("c1_can_txd_m0", c1_can_txd_grp0, &c1_can_txd_grp0_mux),
4476         FUNCTION("c1_can_txd_m1", c1_can_txd_grp1, &c1_can_txd_grp1_mux),
4477         FUNCTION("c1_can_txd_m2", c1_can_txd_grp2, &c1_can_txd_grp2_mux),
4478         FUNCTION("c1_can_txd_m3", c1_can_txd_grp3, &c1_can_txd_grp3_mux),
4479         FUNCTION("ca_audio_lpc", ca_audio_lpc_grp, &ca_audio_lpc_grp_mux),
4480         FUNCTION("ca_bt_lpc", ca_bt_lpc_grp, &ca_bt_lpc_grp_mux),
4481         FUNCTION("ca_coex", ca_coex_grp, &ca_coex_grp_mux),
4482         FUNCTION("ca_curator_lpc",
4483                         ca_curator_lpc_grp,
4484                         &ca_curator_lpc_grp_mux),
4485         FUNCTION("ca_pcm_debug", ca_pcm_debug_grp, &ca_pcm_debug_grp_mux),
4486         FUNCTION("ca_pio", ca_pio_grp, &ca_pio_grp_mux),
4487         FUNCTION("ca_sdio_debug", ca_sdio_debug_grp, &ca_sdio_debug_grp_mux),
4488         FUNCTION("ca_spi", ca_spi_grp, &ca_spi_grp_mux),
4489         FUNCTION("ca_trb", ca_trb_grp, &ca_trb_grp_mux),
4490         FUNCTION("ca_uart_debug", ca_uart_debug_grp, &ca_uart_debug_grp_mux),
4491         FUNCTION("clkc_m0", clkc_grp0, &clkc_grp0_mux),
4492         FUNCTION("clkc_m1", clkc_grp1, &clkc_grp1_mux),
4493         FUNCTION("gn_gnss_i2c", gn_gnss_i2c_grp, &gn_gnss_i2c_grp_mux),
4494         FUNCTION("gn_gnss_uart_nopause",
4495                         gn_gnss_uart_nopause_grp,
4496                         &gn_gnss_uart_nopause_grp_mux),
4497         FUNCTION("gn_gnss_uart", gn_gnss_uart_grp, &gn_gnss_uart_grp_mux),
4498         FUNCTION("gn_trg_spi_m0", gn_trg_spi_grp0, &gn_trg_spi_grp0_mux),
4499         FUNCTION("gn_trg_spi_m1", gn_trg_spi_grp1, &gn_trg_spi_grp1_mux),
4500         FUNCTION("cvbs_dbg", cvbs_dbg_grp, &cvbs_dbg_grp_mux),
4501         FUNCTION("cvbs_dbg_test_m0",
4502                         cvbs_dbg_test_grp0,
4503                         &cvbs_dbg_test_grp0_mux),
4504         FUNCTION("cvbs_dbg_test_m1",
4505                         cvbs_dbg_test_grp1,
4506                         &cvbs_dbg_test_grp1_mux),
4507         FUNCTION("cvbs_dbg_test_m2",
4508                         cvbs_dbg_test_grp2,
4509                         &cvbs_dbg_test_grp2_mux),
4510         FUNCTION("cvbs_dbg_test_m3",
4511                         cvbs_dbg_test_grp3,
4512                         &cvbs_dbg_test_grp3_mux),
4513         FUNCTION("cvbs_dbg_test_m4",
4514                         cvbs_dbg_test_grp4,
4515                         &cvbs_dbg_test_grp4_mux),
4516         FUNCTION("cvbs_dbg_test_m5",
4517                         cvbs_dbg_test_grp5,
4518                         &cvbs_dbg_test_grp5_mux),
4519         FUNCTION("cvbs_dbg_test_m6",
4520                         cvbs_dbg_test_grp6,
4521                         &cvbs_dbg_test_grp6_mux),
4522         FUNCTION("cvbs_dbg_test_m7",
4523                         cvbs_dbg_test_grp7,
4524                         &cvbs_dbg_test_grp7_mux),
4525         FUNCTION("cvbs_dbg_test_m8",
4526                         cvbs_dbg_test_grp8,
4527                         &cvbs_dbg_test_grp8_mux),
4528         FUNCTION("cvbs_dbg_test_m9",
4529                         cvbs_dbg_test_grp9,
4530                         &cvbs_dbg_test_grp9_mux),
4531         FUNCTION("cvbs_dbg_test_m10",
4532                         cvbs_dbg_test_grp10,
4533                         &cvbs_dbg_test_grp10_mux),
4534         FUNCTION("cvbs_dbg_test_m11",
4535                         cvbs_dbg_test_grp11,
4536                         &cvbs_dbg_test_grp11_mux),
4537         FUNCTION("cvbs_dbg_test_m12",
4538                         cvbs_dbg_test_grp12,
4539                         &cvbs_dbg_test_grp12_mux),
4540         FUNCTION("cvbs_dbg_test_m13",
4541                         cvbs_dbg_test_grp13,
4542                         &cvbs_dbg_test_grp13_mux),
4543         FUNCTION("cvbs_dbg_test_m14",
4544                         cvbs_dbg_test_grp14,
4545                         &cvbs_dbg_test_grp14_mux),
4546         FUNCTION("cvbs_dbg_test_m15",
4547                         cvbs_dbg_test_grp15,
4548                         &cvbs_dbg_test_grp15_mux),
4549         FUNCTION("gn_gnss_power", gn_gnss_power_grp, &gn_gnss_power_grp_mux),
4550         FUNCTION("gn_gnss_sw_status",
4551                         gn_gnss_sw_status_grp,
4552                         &gn_gnss_sw_status_grp_mux),
4553         FUNCTION("gn_gnss_eclk", gn_gnss_eclk_grp, &gn_gnss_eclk_grp_mux),
4554         FUNCTION("gn_gnss_irq1_m0",
4555                         gn_gnss_irq1_grp0,
4556                         &gn_gnss_irq1_grp0_mux),
4557         FUNCTION("gn_gnss_irq2_m0",
4558                         gn_gnss_irq2_grp0,
4559                         &gn_gnss_irq2_grp0_mux),
4560         FUNCTION("gn_gnss_tm", gn_gnss_tm_grp, &gn_gnss_tm_grp_mux),
4561         FUNCTION("gn_gnss_tsync", gn_gnss_tsync_grp, &gn_gnss_tsync_grp_mux),
4562         FUNCTION("gn_io_gnsssys_sw_cfg",
4563                         gn_io_gnsssys_sw_cfg_grp,
4564                         &gn_io_gnsssys_sw_cfg_grp_mux),
4565         FUNCTION("gn_trg_m0", gn_trg_grp0, &gn_trg_grp0_mux),
4566         FUNCTION("gn_trg_m1", gn_trg_grp1, &gn_trg_grp1_mux),
4567         FUNCTION("gn_trg_shutdown_m0",
4568                         gn_trg_shutdown_grp0,
4569                         &gn_trg_shutdown_grp0_mux),
4570         FUNCTION("gn_trg_shutdown_m1",
4571                         gn_trg_shutdown_grp1,
4572                         &gn_trg_shutdown_grp1_mux),
4573         FUNCTION("gn_trg_shutdown_m2",
4574                         gn_trg_shutdown_grp2,
4575                         &gn_trg_shutdown_grp2_mux),
4576         FUNCTION("gn_trg_shutdown_m3",
4577                         gn_trg_shutdown_grp3,
4578                         &gn_trg_shutdown_grp3_mux),
4579         FUNCTION("i2c0", i2c0_grp, &i2c0_grp_mux),
4580         FUNCTION("i2c1", i2c1_grp, &i2c1_grp_mux),
4581         FUNCTION("i2s0", i2s0_grp, &i2s0_grp_mux),
4582         FUNCTION("i2s1_basic", i2s1_basic_grp, &i2s1_basic_grp_mux),
4583         FUNCTION("i2s1_rxd0_m0", i2s1_rxd0_grp0, &i2s1_rxd0_grp0_mux),
4584         FUNCTION("i2s1_rxd0_m1", i2s1_rxd0_grp1, &i2s1_rxd0_grp1_mux),
4585         FUNCTION("i2s1_rxd0_m2", i2s1_rxd0_grp2, &i2s1_rxd0_grp2_mux),
4586         FUNCTION("i2s1_rxd0_m3", i2s1_rxd0_grp3, &i2s1_rxd0_grp3_mux),
4587         FUNCTION("i2s1_rxd0_m4", i2s1_rxd0_grp4, &i2s1_rxd0_grp4_mux),
4588         FUNCTION("i2s1_rxd1_m0", i2s1_rxd1_grp0, &i2s1_rxd1_grp0_mux),
4589         FUNCTION("i2s1_rxd1_m1", i2s1_rxd1_grp1, &i2s1_rxd1_grp1_mux),
4590         FUNCTION("i2s1_rxd1_m2", i2s1_rxd1_grp2, &i2s1_rxd1_grp2_mux),
4591         FUNCTION("i2s1_rxd1_m3", i2s1_rxd1_grp3, &i2s1_rxd1_grp3_mux),
4592         FUNCTION("i2s1_rxd1_m4", i2s1_rxd1_grp4, &i2s1_rxd1_grp4_mux),
4593         FUNCTION("jtag_jt_dbg_nsrst",
4594                         jtag_jt_dbg_nsrst_grp,
4595                         &jtag_jt_dbg_nsrst_grp_mux),
4596         FUNCTION("jtag_ntrst_m0", jtag_ntrst_grp0, &jtag_ntrst_grp0_mux),
4597         FUNCTION("jtag_ntrst_m1", jtag_ntrst_grp1, &jtag_ntrst_grp1_mux),
4598         FUNCTION("jtag_swdiotms_m0",
4599                         jtag_swdiotms_grp0,
4600                         &jtag_swdiotms_grp0_mux),
4601         FUNCTION("jtag_swdiotms_m1",
4602                         jtag_swdiotms_grp1,
4603                         &jtag_swdiotms_grp1_mux),
4604         FUNCTION("jtag_tck_m0", jtag_tck_grp0, &jtag_tck_grp0_mux),
4605         FUNCTION("jtag_tck_m1", jtag_tck_grp1, &jtag_tck_grp1_mux),
4606         FUNCTION("jtag_tdi_m0", jtag_tdi_grp0, &jtag_tdi_grp0_mux),
4607         FUNCTION("jtag_tdi_m1", jtag_tdi_grp1, &jtag_tdi_grp1_mux),
4608         FUNCTION("jtag_tdo_m0", jtag_tdo_grp0, &jtag_tdo_grp0_mux),
4609         FUNCTION("jtag_tdo_m1", jtag_tdo_grp1, &jtag_tdo_grp1_mux),
4610         FUNCTION("ks_kas_spi_m0", ks_kas_spi_grp0, &ks_kas_spi_grp0_mux),
4611         FUNCTION("ld_ldd", ld_ldd_grp, &ld_ldd_grp_mux),
4612         FUNCTION("ld_ldd_16bit", ld_ldd_16bit_grp, &ld_ldd_16bit_grp_mux),
4613         FUNCTION("ld_ldd_fck", ld_ldd_fck_grp, &ld_ldd_fck_grp_mux),
4614         FUNCTION("ld_ldd_lck", ld_ldd_lck_grp, &ld_ldd_lck_grp_mux),
4615         FUNCTION("lr_lcdrom", lr_lcdrom_grp, &lr_lcdrom_grp_mux),
4616         FUNCTION("lvds_analog", lvds_analog_grp, &lvds_analog_grp_mux),
4617         FUNCTION("nd_df_basic", nd_df_basic_grp, &nd_df_basic_grp_mux),
4618         FUNCTION("nd_df_wp", nd_df_wp_grp, &nd_df_wp_grp_mux),
4619         FUNCTION("nd_df_cs", nd_df_cs_grp, &nd_df_cs_grp_mux),
4620         FUNCTION("ps", ps_grp, &ps_grp_mux),
4621         FUNCTION("ps_no_dir", ps_no_dir_grp, &ps_no_dir_grp_mux),
4622         FUNCTION("pwc_core_on", pwc_core_on_grp, &pwc_core_on_grp_mux),
4623         FUNCTION("pwc_ext_on", pwc_ext_on_grp, &pwc_ext_on_grp_mux),
4624         FUNCTION("pwc_gpio3_clk", pwc_gpio3_clk_grp, &pwc_gpio3_clk_grp_mux),
4625         FUNCTION("pwc_io_on", pwc_io_on_grp, &pwc_io_on_grp_mux),
4626         FUNCTION("pwc_lowbatt_b_m0",
4627                         pwc_lowbatt_b_grp0,
4628                         &pwc_lowbatt_b_grp0_mux),
4629         FUNCTION("pwc_mem_on", pwc_mem_on_grp, &pwc_mem_on_grp_mux),
4630         FUNCTION("pwc_on_key_b_m0",
4631                         pwc_on_key_b_grp0,
4632                         &pwc_on_key_b_grp0_mux),
4633         FUNCTION("pwc_wakeup_src0",
4634                         pwc_wakeup_src0_grp,
4635                         &pwc_wakeup_src0_grp_mux),
4636         FUNCTION("pwc_wakeup_src1",
4637                         pwc_wakeup_src1_grp,
4638                         &pwc_wakeup_src1_grp_mux),
4639         FUNCTION("pwc_wakeup_src2",
4640                         pwc_wakeup_src2_grp,
4641                         &pwc_wakeup_src2_grp_mux),
4642         FUNCTION("pwc_wakeup_src3",
4643                         pwc_wakeup_src3_grp,
4644                         &pwc_wakeup_src3_grp_mux),
4645         FUNCTION("pw_cko0_m0", pw_cko0_grp0, &pw_cko0_grp0_mux),
4646         FUNCTION("pw_cko0_m1", pw_cko0_grp1, &pw_cko0_grp1_mux),
4647         FUNCTION("pw_cko0_m2", pw_cko0_grp2, &pw_cko0_grp2_mux),
4648         FUNCTION("pw_cko0_m3", pw_cko0_grp3, &pw_cko0_grp3_mux),
4649         FUNCTION("pw_cko1_m0", pw_cko1_grp0, &pw_cko1_grp0_mux),
4650         FUNCTION("pw_cko1_m1", pw_cko1_grp1, &pw_cko1_grp1_mux),
4651         FUNCTION("pw_cko1_m2", pw_cko1_grp2, &pw_cko1_grp2_mux),
4652         FUNCTION("pw_i2s01_clk_m0",
4653                         pw_i2s01_clk_grp0,
4654                         &pw_i2s01_clk_grp0_mux),
4655         FUNCTION("pw_i2s01_clk_m1",
4656                         pw_i2s01_clk_grp1,
4657                         &pw_i2s01_clk_grp1_mux),
4658         FUNCTION("pw_i2s01_clk_m2",
4659                         pw_i2s01_clk_grp2,
4660                         &pw_i2s01_clk_grp2_mux),
4661         FUNCTION("pw_pwm0_m0", pw_pwm0_grp0, &pw_pwm0_grp0_mux),
4662         FUNCTION("pw_pwm0_m1", pw_pwm0_grp1, &pw_pwm0_grp1_mux),
4663         FUNCTION("pw_pwm1_m0", pw_pwm1_grp0, &pw_pwm1_grp0_mux),
4664         FUNCTION("pw_pwm1_m1", pw_pwm1_grp1, &pw_pwm1_grp1_mux),
4665         FUNCTION("pw_pwm1_m2", pw_pwm1_grp2, &pw_pwm1_grp2_mux),
4666         FUNCTION("pw_pwm2_m0", pw_pwm2_grp0, &pw_pwm2_grp0_mux),
4667         FUNCTION("pw_pwm2_m1", pw_pwm2_grp1, &pw_pwm2_grp1_mux),
4668         FUNCTION("pw_pwm2_m2", pw_pwm2_grp2, &pw_pwm2_grp2_mux),
4669         FUNCTION("pw_pwm3_m0", pw_pwm3_grp0, &pw_pwm3_grp0_mux),
4670         FUNCTION("pw_pwm3_m1", pw_pwm3_grp1, &pw_pwm3_grp1_mux),
4671         FUNCTION("pw_pwm_cpu_vol_m0",
4672                         pw_pwm_cpu_vol_grp0,
4673                         &pw_pwm_cpu_vol_grp0_mux),
4674         FUNCTION("pw_pwm_cpu_vol_m1",
4675                         pw_pwm_cpu_vol_grp1,
4676                         &pw_pwm_cpu_vol_grp1_mux),
4677         FUNCTION("pw_pwm_cpu_vol_m2",
4678                         pw_pwm_cpu_vol_grp2,
4679                         &pw_pwm_cpu_vol_grp2_mux),
4680         FUNCTION("pw_backlight_m0",
4681                         pw_backlight_grp0,
4682                         &pw_backlight_grp0_mux),
4683         FUNCTION("pw_backlight_m1",
4684                         pw_backlight_grp1,
4685                         &pw_backlight_grp1_mux),
4686         FUNCTION("rg_eth_mac", rg_eth_mac_grp, &rg_eth_mac_grp_mux),
4687         FUNCTION("rg_gmac_phy_intr_n",
4688                         rg_gmac_phy_intr_n_grp,
4689                         &rg_gmac_phy_intr_n_grp_mux),
4690         FUNCTION("rg_rgmii_mac", rg_rgmii_mac_grp, &rg_rgmii_mac_grp_mux),
4691         FUNCTION("rg_rgmii_phy_ref_clk_m0",
4692                         rg_rgmii_phy_ref_clk_grp0,
4693                         &rg_rgmii_phy_ref_clk_grp0_mux),
4694         FUNCTION("rg_rgmii_phy_ref_clk_m1",
4695                         rg_rgmii_phy_ref_clk_grp1,
4696                         &rg_rgmii_phy_ref_clk_grp1_mux),
4697         FUNCTION("sd0", sd0_grp, &sd0_grp_mux),
4698         FUNCTION("sd0_4bit", sd0_4bit_grp, &sd0_4bit_grp_mux),
4699         FUNCTION("sd1", sd1_grp, &sd1_grp_mux),
4700         FUNCTION("sd1_4bit_m0", sd1_4bit_grp0, &sd1_4bit_grp0_mux),
4701         FUNCTION("sd1_4bit_m1", sd1_4bit_grp1, &sd1_4bit_grp1_mux),
4702         FUNCTION("sd2_basic", sd2_basic_grp, &sd2_basic_grp_mux),
4703         FUNCTION("sd2_cdb_m0", sd2_cdb_grp0, &sd2_cdb_grp0_mux),
4704         FUNCTION("sd2_cdb_m1", sd2_cdb_grp1, &sd2_cdb_grp1_mux),
4705         FUNCTION("sd2_wpb_m0", sd2_wpb_grp0, &sd2_wpb_grp0_mux),
4706         FUNCTION("sd2_wpb_m1", sd2_wpb_grp1, &sd2_wpb_grp1_mux),
4707         FUNCTION("sd3", sd3_9_grp, &sd3_9_grp_mux),
4708         FUNCTION("sd5", sd5_grp, &sd5_grp_mux),
4709         FUNCTION("sd6_m0", sd6_grp0, &sd6_grp0_mux),
4710         FUNCTION("sd6_m1", sd6_grp1, &sd6_grp1_mux),
4711         FUNCTION("sd9", sd3_9_grp, &sd3_9_grp_mux),
4712         FUNCTION("sp0_ext_ldo_on",
4713                         sp0_ext_ldo_on_grp,
4714                         &sp0_ext_ldo_on_grp_mux),
4715         FUNCTION("sp0_qspi", sp0_qspi_grp, &sp0_qspi_grp_mux),
4716         FUNCTION("sp1_spi", sp1_spi_grp, &sp1_spi_grp_mux),
4717         FUNCTION("tpiu_trace", tpiu_trace_grp, &tpiu_trace_grp_mux),
4718         FUNCTION("uart0", uart0_grp, &uart0_grp_mux),
4719         FUNCTION("uart0_nopause", uart0_nopause_grp, &uart0_nopause_grp_mux),
4720         FUNCTION("uart1", uart1_grp, &uart1_grp_mux),
4721         FUNCTION("uart2_cts_m0", uart2_cts_grp0, &uart2_cts_grp0_mux),
4722         FUNCTION("uart2_cts_m1", uart2_cts_grp1, &uart2_cts_grp1_mux),
4723         FUNCTION("uart2_rts_m0", uart2_rts_grp0, &uart2_rts_grp0_mux),
4724         FUNCTION("uart2_rts_m1", uart2_rts_grp1, &uart2_rts_grp1_mux),
4725         FUNCTION("uart2_rxd_m0", uart2_rxd_grp0, &uart2_rxd_grp0_mux),
4726         FUNCTION("uart2_rxd_m1", uart2_rxd_grp1, &uart2_rxd_grp1_mux),
4727         FUNCTION("uart2_rxd_m2", uart2_rxd_grp2, &uart2_rxd_grp2_mux),
4728         FUNCTION("uart2_txd_m0", uart2_txd_grp0, &uart2_txd_grp0_mux),
4729         FUNCTION("uart2_txd_m1", uart2_txd_grp1, &uart2_txd_grp1_mux),
4730         FUNCTION("uart2_txd_m2", uart2_txd_grp2, &uart2_txd_grp2_mux),
4731         FUNCTION("uart3_cts_m0", uart3_cts_grp0, &uart3_cts_grp0_mux),
4732         FUNCTION("uart3_cts_m1", uart3_cts_grp1, &uart3_cts_grp1_mux),
4733         FUNCTION("uart3_cts_m2", uart3_cts_grp2, &uart3_cts_grp2_mux),
4734         FUNCTION("uart3_rts_m0", uart3_rts_grp0, &uart3_rts_grp0_mux),
4735         FUNCTION("uart3_rts_m1", uart3_rts_grp1, &uart3_rts_grp1_mux),
4736         FUNCTION("uart3_rts_m2", uart3_rts_grp2, &uart3_rts_grp2_mux),
4737         FUNCTION("uart3_rxd_m0", uart3_rxd_grp0, &uart3_rxd_grp0_mux),
4738         FUNCTION("uart3_rxd_m1", uart3_rxd_grp1, &uart3_rxd_grp1_mux),
4739         FUNCTION("uart3_rxd_m2", uart3_rxd_grp2, &uart3_rxd_grp2_mux),
4740         FUNCTION("uart3_txd_m0", uart3_txd_grp0, &uart3_txd_grp0_mux),
4741         FUNCTION("uart3_txd_m1", uart3_txd_grp1, &uart3_txd_grp1_mux),
4742         FUNCTION("uart3_txd_m2", uart3_txd_grp2, &uart3_txd_grp2_mux),
4743         FUNCTION("uart4_basic", uart4_basic_grp, &uart4_basic_grp_mux),
4744         FUNCTION("uart4_cts_m0", uart4_cts_grp0, &uart4_cts_grp0_mux),
4745         FUNCTION("uart4_cts_m1", uart4_cts_grp1, &uart4_cts_grp1_mux),
4746         FUNCTION("uart4_cts_m2", uart4_cts_grp2, &uart4_cts_grp2_mux),
4747         FUNCTION("uart4_rts_m0", uart4_rts_grp0, &uart4_rts_grp0_mux),
4748         FUNCTION("uart4_rts_m1", uart4_rts_grp1, &uart4_rts_grp1_mux),
4749         FUNCTION("uart4_rts_m2", uart4_rts_grp2, &uart4_rts_grp2_mux),
4750         FUNCTION("usb0_drvvbus_m0",
4751                         usb0_drvvbus_grp0,
4752                         &usb0_drvvbus_grp0_mux),
4753         FUNCTION("usb0_drvvbus_m1",
4754                         usb0_drvvbus_grp1,
4755                         &usb0_drvvbus_grp1_mux),
4756         FUNCTION("usb1_drvvbus_m0",
4757                         usb1_drvvbus_grp0,
4758                         &usb1_drvvbus_grp0_mux),
4759         FUNCTION("usb1_drvvbus_m1",
4760                         usb1_drvvbus_grp1,
4761                         &usb1_drvvbus_grp1_mux),
4762         FUNCTION("visbus_dout", visbus_dout_grp, &visbus_dout_grp_mux),
4763         FUNCTION("vi_vip1", vi_vip1_grp, &vi_vip1_grp_mux),
4764         FUNCTION("vi_vip1_ext", vi_vip1_ext_grp, &vi_vip1_ext_grp_mux),
4765         FUNCTION("vi_vip1_low8bit",
4766                         vi_vip1_low8bit_grp,
4767                         &vi_vip1_low8bit_grp_mux),
4768         FUNCTION("vi_vip1_high8bit",
4769                         vi_vip1_high8bit_grp,
4770                         &vi_vip1_high8bit_grp_mux),
4771 };
4772
4773 struct atlas7_pinctrl_data atlas7_ioc_data = {
4774         .pads = (struct pinctrl_pin_desc *)atlas7_ioc_pads,
4775         .pads_cnt = ARRAY_SIZE(atlas7_ioc_pads),
4776         .grps = (struct atlas7_pin_group *)altas7_pin_groups,
4777         .grps_cnt = ARRAY_SIZE(altas7_pin_groups),
4778         .funcs = (struct atlas7_pmx_func *)atlas7_pmx_functions,
4779         .funcs_cnt = ARRAY_SIZE(atlas7_pmx_functions),
4780         .confs = (struct atlas7_pad_config *)atlas7_ioc_pad_confs,
4781         .confs_cnt = ARRAY_SIZE(atlas7_ioc_pad_confs),
4782 };
4783
4784 /* Simple map data structure */
4785 struct map_data {
4786         u8 idx;
4787         u8 data;
4788 };
4789
4790 /**
4791  * struct atlas7_pull_info - Atlas7 Pad pull info
4792  * @type:The type of this Pad.
4793  * @mask:The mas value of this pin's pull bits.
4794  * @v2s: The map of pull register value to pull status.
4795  * @s2v: The map of pull status to pull register value.
4796  */
4797 struct atlas7_pull_info {
4798         u8 pad_type;
4799         u8 mask;
4800         const struct map_data *v2s;
4801         const struct map_data *s2v;
4802 };
4803
4804 /* Pull Register value map to status */
4805 static const struct map_data p4we_pull_v2s[] = {
4806         { P4WE_PULL_UP, PULL_UP },
4807         { P4WE_HIGH_HYSTERESIS, HIGH_HYSTERESIS },
4808         { P4WE_HIGH_Z, HIGH_Z },
4809         { P4WE_PULL_DOWN, PULL_DOWN },
4810 };
4811
4812 static const struct map_data p16st_pull_v2s[] = {
4813         { P16ST_PULL_UP, PULL_UP },
4814         { PD, PULL_UNKNOWN },
4815         { P16ST_HIGH_Z, HIGH_Z },
4816         { P16ST_PULL_DOWN, PULL_DOWN },
4817 };
4818
4819 static const struct map_data pm31_pull_v2s[] = {
4820         { PM31_PULL_DISABLED, PULL_DOWN },
4821         { PM31_PULL_ENABLED, PULL_UP },
4822 };
4823
4824 static const struct map_data pangd_pull_v2s[] = {
4825         { PANGD_PULL_UP, PULL_UP },
4826         { PD, PULL_UNKNOWN },
4827         { PANGD_HIGH_Z, HIGH_Z },
4828         { PANGD_PULL_DOWN, PULL_DOWN },
4829 };
4830
4831 /* Pull status map to register value */
4832 static const struct map_data p4we_pull_s2v[] = {
4833         { PULL_UP, P4WE_PULL_UP },
4834         { HIGH_HYSTERESIS, P4WE_HIGH_HYSTERESIS },
4835         { HIGH_Z, P4WE_HIGH_Z },
4836         { PULL_DOWN, P4WE_PULL_DOWN },
4837         { PULL_DISABLE, -1 },
4838         { PULL_ENABLE, -1 },
4839 };
4840
4841 static const struct map_data p16st_pull_s2v[] = {
4842         { PULL_UP, P16ST_PULL_UP },
4843         { HIGH_HYSTERESIS, -1 },
4844         { HIGH_Z, P16ST_HIGH_Z },
4845         { PULL_DOWN, P16ST_PULL_DOWN },
4846         { PULL_DISABLE, -1 },
4847         { PULL_ENABLE, -1 },
4848 };
4849
4850 static const struct map_data pm31_pull_s2v[] = {
4851         { PULL_UP, PM31_PULL_ENABLED },
4852         { HIGH_HYSTERESIS, -1 },
4853         { HIGH_Z, -1 },
4854         { PULL_DOWN, PM31_PULL_DISABLED },
4855         { PULL_DISABLE, -1 },
4856         { PULL_ENABLE, -1 },
4857 };
4858
4859 static const struct map_data pangd_pull_s2v[] = {
4860         { PULL_UP, PANGD_PULL_UP },
4861         { HIGH_HYSTERESIS, -1 },
4862         { HIGH_Z, PANGD_HIGH_Z },
4863         { PULL_DOWN, PANGD_PULL_DOWN },
4864         { PULL_DISABLE, -1 },
4865         { PULL_ENABLE, -1 },
4866 };
4867
4868 static const struct atlas7_pull_info atlas7_pull_map[] = {
4869         { PAD_T_4WE_PD, P4WE_PULL_MASK, p4we_pull_v2s, p4we_pull_s2v },
4870         { PAD_T_4WE_PU, P4WE_PULL_MASK, p4we_pull_v2s, p4we_pull_s2v },
4871         { PAD_T_16ST, P16ST_PULL_MASK, p16st_pull_v2s, p16st_pull_s2v },
4872         { PAD_T_M31_0204_PD, PM31_PULL_MASK, pm31_pull_v2s, pm31_pull_s2v },
4873         { PAD_T_M31_0204_PU, PM31_PULL_MASK, pm31_pull_v2s, pm31_pull_s2v },
4874         { PAD_T_M31_0610_PD, PM31_PULL_MASK, pm31_pull_v2s, pm31_pull_s2v },
4875         { PAD_T_M31_0610_PU, PM31_PULL_MASK, pm31_pull_v2s, pm31_pull_s2v },
4876         { PAD_T_AD, PANGD_PULL_MASK, pangd_pull_v2s, pangd_pull_s2v },
4877 };
4878
4879 /**
4880  * struct atlas7_ds_ma_info - Atlas7 Pad DriveStrength & currents info
4881  * @ma:         The Drive Strength in current value .
4882  * @ds_16st:    The correspond raw value of 16st pad.
4883  * @ds_4we:     The correspond raw value of 4we pad.
4884  * @ds_0204m31: The correspond raw value of 0204m31 pad.
4885  * @ds_0610m31: The correspond raw value of 0610m31 pad.
4886  */
4887 struct atlas7_ds_ma_info {
4888         u32 ma;
4889         u32 ds_16st;
4890         u32 ds_4we;
4891         u32 ds_0204m31;
4892         u32 ds_0610m31;
4893 };
4894
4895 static const struct atlas7_ds_ma_info atlas7_ma2ds_map[] = {
4896         { 2, DS_16ST_0, DS_4WE_0, DS_M31_0, DS_NULL },
4897         { 4, DS_16ST_1, DS_NULL, DS_M31_1, DS_NULL },
4898         { 6, DS_16ST_2, DS_NULL, DS_NULL, DS_M31_0 },
4899         { 8, DS_16ST_3, DS_4WE_1, DS_NULL, DS_NULL },
4900         { 10, DS_16ST_4, DS_NULL, DS_NULL, DS_M31_1 },
4901         { 12, DS_16ST_5, DS_NULL, DS_NULL, DS_NULL },
4902         { 14, DS_16ST_6, DS_NULL, DS_NULL, DS_NULL },
4903         { 16, DS_16ST_7, DS_4WE_2, DS_NULL, DS_NULL },
4904         { 18, DS_16ST_8, DS_NULL, DS_NULL, DS_NULL },
4905         { 20, DS_16ST_9, DS_NULL, DS_NULL, DS_NULL },
4906         { 22, DS_16ST_10, DS_NULL, DS_NULL, DS_NULL },
4907         { 24, DS_16ST_11, DS_NULL, DS_NULL, DS_NULL },
4908         { 26, DS_16ST_12, DS_NULL, DS_NULL, DS_NULL },
4909         { 28, DS_16ST_13, DS_4WE_3, DS_NULL, DS_NULL },
4910         { 30, DS_16ST_14, DS_NULL, DS_NULL, DS_NULL },
4911         { 32, DS_16ST_15, DS_NULL, DS_NULL, DS_NULL },
4912 };
4913
4914 /**
4915  * struct atlas7_ds_info - Atlas7 Pad DriveStrength info
4916  * @type:               The type of this Pad.
4917  * @mask:               The mask value of this pin's pull bits.
4918  * @imval:              The immediate value of drives trength register.
4919  */
4920 struct atlas7_ds_info {
4921         u8 type;
4922         u8 mask;
4923         u8 imval;
4924         u8 reserved;
4925 };
4926
4927 static const struct atlas7_ds_info atlas7_ds_map[] = {
4928         { PAD_T_4WE_PD, DS_2BIT_MASK, DS_2BIT_IM_VAL },
4929         { PAD_T_4WE_PU, DS_2BIT_MASK, DS_2BIT_IM_VAL },
4930         { PAD_T_16ST, DS_4BIT_MASK, DS_4BIT_IM_VAL },
4931         { PAD_T_M31_0204_PD, DS_1BIT_MASK, DS_1BIT_IM_VAL },
4932         { PAD_T_M31_0204_PU, DS_1BIT_MASK, DS_1BIT_IM_VAL },
4933         { PAD_T_M31_0610_PD, DS_1BIT_MASK, DS_1BIT_IM_VAL },
4934         { PAD_T_M31_0610_PU, DS_1BIT_MASK, DS_1BIT_IM_VAL },
4935         { PAD_T_AD, DS_NULL, DS_NULL },
4936 };
4937
4938 static inline u32 atlas7_pin_to_bank(u32 pin)
4939 {
4940         return (pin >= ATLAS7_PINCTRL_BANK_0_PINS) ? 1 : 0;
4941 }
4942
4943 static int atlas7_pmx_get_funcs_count(struct pinctrl_dev *pctldev)
4944 {
4945         struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
4946
4947         return pmx->pctl_data->funcs_cnt;
4948 }
4949
4950 static const char *atlas7_pmx_get_func_name(struct pinctrl_dev *pctldev,
4951                                         u32 selector)
4952 {
4953         struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
4954
4955         return pmx->pctl_data->funcs[selector].name;
4956 }
4957
4958 static int atlas7_pmx_get_func_groups(struct pinctrl_dev *pctldev,
4959                 u32 selector, const char * const **groups,
4960                 u32 * const num_groups)
4961 {
4962         struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
4963
4964         *groups = pmx->pctl_data->funcs[selector].groups;
4965         *num_groups = pmx->pctl_data->funcs[selector].num_groups;
4966
4967         return 0;
4968 }
4969
4970 static void __atlas7_pmx_pin_input_disable_set(struct atlas7_pmx *pmx,
4971                                 const struct atlas7_pad_mux *mux)
4972 {
4973         /* Set Input Disable to avoid input glitches
4974          *
4975          * All Input-Disable Control registers are located on IOCRTC.
4976          * So the regs bank is always 0.
4977          *
4978          */
4979         if (mux->dinput_reg && mux->dinput_val_reg) {
4980                 writel(DI_MASK << mux->dinput_bit,
4981                         pmx->regs[BANK_DS] + CLR_REG(mux->dinput_reg));
4982                 writel(DI_DISABLE << mux->dinput_bit,
4983                         pmx->regs[BANK_DS] + mux->dinput_reg);
4984
4985
4986                 writel(DIV_MASK << mux->dinput_val_bit,
4987                         pmx->regs[BANK_DS] + CLR_REG(mux->dinput_val_reg));
4988                 writel(DIV_DISABLE << mux->dinput_val_bit,
4989                         pmx->regs[BANK_DS] + mux->dinput_val_reg);
4990         }
4991 }
4992
4993 static void __atlas7_pmx_pin_input_disable_clr(struct atlas7_pmx *pmx,
4994                                 const struct atlas7_pad_mux *mux)
4995 {
4996         /* Clear Input Disable to avoid input glitches */
4997         if (mux->dinput_reg && mux->dinput_val_reg) {
4998                 writel(DI_MASK << mux->dinput_bit,
4999                         pmx->regs[BANK_DS] + CLR_REG(mux->dinput_reg));
5000                 writel(DI_ENABLE << mux->dinput_bit,
5001                         pmx->regs[BANK_DS] + mux->dinput_reg);
5002
5003                 writel(DIV_MASK << mux->dinput_val_bit,
5004                         pmx->regs[BANK_DS] + CLR_REG(mux->dinput_val_reg));
5005                 writel(DIV_ENABLE << mux->dinput_val_bit,
5006                         pmx->regs[BANK_DS] + mux->dinput_val_reg);
5007         }
5008 }
5009
5010 static int __atlas7_pmx_pin_ad_sel(struct atlas7_pmx *pmx,
5011                         struct atlas7_pad_config *conf,
5012                         u32 bank, u32 ad_sel)
5013 {
5014         unsigned long regv;
5015
5016         /* Write to clear register to clear A/D selector */
5017         writel(ANA_CLEAR_MASK << conf->ad_ctrl_bit,
5018                 pmx->regs[bank] + CLR_REG(conf->ad_ctrl_reg));
5019
5020         /* Set target pad A/D selector */
5021         regv = readl(pmx->regs[bank] + conf->ad_ctrl_reg);
5022         regv &= ~(ANA_CLEAR_MASK << conf->ad_ctrl_bit);
5023         writel(regv | (ad_sel << conf->ad_ctrl_bit),
5024                         pmx->regs[bank] + conf->ad_ctrl_reg);
5025
5026         regv = readl(pmx->regs[bank] + conf->ad_ctrl_reg);
5027         pr_debug("bank:%d reg:0x%04x val:0x%08lx\n",
5028                         bank, conf->ad_ctrl_reg, regv);
5029         return 0;
5030 }
5031
5032 static int  __atlas7_pmx_pin_analog_enable(struct atlas7_pmx *pmx,
5033                         struct atlas7_pad_config *conf, u32 bank)
5034 {
5035         /* Only PAD_T_AD pins can change between Analogue&Digital */
5036         if (conf->type != PAD_T_AD)
5037                 return -EINVAL;
5038
5039         return __atlas7_pmx_pin_ad_sel(pmx, conf, bank, 0);
5040 }
5041
5042 static int __atlas7_pmx_pin_digital_enable(struct atlas7_pmx *pmx,
5043                         struct atlas7_pad_config *conf, u32 bank)
5044 {
5045         /* Other type pads are always digital */
5046         if (conf->type != PAD_T_AD)
5047                 return 0;
5048
5049         return __atlas7_pmx_pin_ad_sel(pmx, conf, bank, 1);
5050 }
5051
5052 static int __atlas7_pmx_pin_enable(struct atlas7_pmx *pmx,
5053                                 u32 pin, u32 func)
5054 {
5055         struct atlas7_pad_config *conf;
5056         u32 bank;
5057         int ret;
5058         unsigned long regv;
5059
5060         pr_debug("PMX DUMP ### pin#%d func:%d #### START >>>\n",
5061                         pin, func);
5062
5063         /* Get this Pad's descriptor from PINCTRL */
5064         conf = &pmx->pctl_data->confs[pin];
5065         bank = atlas7_pin_to_bank(pin);
5066
5067         /* Just enable the analog function of this pad */
5068         if (FUNC_ANALOGUE == func) {
5069                 ret = __atlas7_pmx_pin_analog_enable(pmx, conf, bank);
5070                 if (ret)
5071                         dev_err(pmx->dev,
5072                                 "Convert pad#%d to analog failed, ret=%d\n",
5073                                 pin, ret);
5074                 return ret;
5075         }
5076
5077         /* Set Pads from analog to digital */
5078         ret = __atlas7_pmx_pin_digital_enable(pmx, conf, bank);
5079         if (ret) {
5080                 dev_err(pmx->dev,
5081                         "Convert pad#%d to digital failed, ret=%d\n",
5082                         pin, ret);
5083                 return ret;
5084         }
5085
5086         /* Write to clear register to clear current function */
5087         writel(FUNC_CLEAR_MASK << conf->mux_bit,
5088                 pmx->regs[bank] + CLR_REG(conf->mux_reg));
5089
5090         /* Set target pad mux function */
5091         regv = readl(pmx->regs[bank] + conf->mux_reg);
5092         regv &= ~(FUNC_CLEAR_MASK << conf->mux_bit);
5093         writel(regv | (func << conf->mux_bit),
5094                         pmx->regs[bank] + conf->mux_reg);
5095
5096         regv = readl(pmx->regs[bank] + conf->mux_reg);
5097         pr_debug("bank:%d reg:0x%04x val:0x%08lx\n",
5098                 bank, conf->mux_reg, regv);
5099
5100         return 0;
5101 }
5102
5103 static int atlas7_pmx_set_mux(struct pinctrl_dev *pctldev,
5104                         u32 func_selector, u32 group_selector)
5105 {
5106         int idx, ret;
5107         struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
5108         struct atlas7_pmx_func *pmx_func;
5109         struct atlas7_pin_group *pin_grp;
5110         const struct atlas7_grp_mux *grp_mux;
5111         const struct atlas7_pad_mux *mux;
5112
5113         pmx_func = &pmx->pctl_data->funcs[func_selector];
5114         pin_grp = &pmx->pctl_data->grps[group_selector];
5115
5116         pr_debug("PMX DUMP ### Function:[%s] Group:[%s] #### START >>>\n",
5117                         pmx_func->name, pin_grp->name);
5118
5119         /* the sd3 and sd9 pin select by SYS2PCI_SDIO9SEL register */
5120         if (pin_grp->pins == (unsigned int *)&sd3_9_pins) {
5121                 if (!strcmp(pmx_func->name, "sd9"))
5122                         writel(1, pmx->sys2pci_base + SYS2PCI_SDIO9SEL);
5123                 else
5124                         writel(0, pmx->sys2pci_base + SYS2PCI_SDIO9SEL);
5125         }
5126
5127         grp_mux = pmx_func->grpmux;
5128
5129         for (idx = 0; idx < grp_mux->pad_mux_count; idx++) {
5130                 mux = &grp_mux->pad_mux_list[idx];
5131                 __atlas7_pmx_pin_input_disable_set(pmx, mux);
5132                 ret = __atlas7_pmx_pin_enable(pmx, mux->pin, mux->func);
5133                 if (ret) {
5134                         dev_err(pmx->dev,
5135                                 "FUNC:%s GRP:%s PIN#%d.%d failed, ret=%d\n",
5136                                 pmx_func->name, pin_grp->name,
5137                                 mux->pin, mux->func, ret);
5138                         BUG_ON(1);
5139                 }
5140                 __atlas7_pmx_pin_input_disable_clr(pmx, mux);
5141         }
5142         pr_debug("PMX DUMP ### Function:[%s] Group:[%s] #### END <<<\n",
5143                         pmx_func->name, pin_grp->name);
5144
5145         return 0;
5146 }
5147
5148 static u32 convert_current_to_drive_strength(u32 type, u32 ma)
5149 {
5150         int idx;
5151
5152         for (idx = 0; idx < ARRAY_SIZE(atlas7_ma2ds_map); idx++) {
5153                 if (atlas7_ma2ds_map[idx].ma != ma)
5154                         continue;
5155
5156                 if (type == PAD_T_4WE_PD || type == PAD_T_4WE_PU)
5157                         return atlas7_ma2ds_map[idx].ds_4we;
5158                 else if (type == PAD_T_16ST)
5159                         return atlas7_ma2ds_map[idx].ds_16st;
5160                 else if (type == PAD_T_M31_0204_PD || type == PAD_T_M31_0204_PU)
5161                         return atlas7_ma2ds_map[idx].ds_0204m31;
5162                 else if (type == PAD_T_M31_0610_PD || type == PAD_T_M31_0610_PU)
5163                         return atlas7_ma2ds_map[idx].ds_0610m31;
5164         }
5165
5166         return DS_NULL;
5167 }
5168
5169 static int altas7_pinctrl_set_pull_sel(struct pinctrl_dev *pctldev,
5170                                         u32 pin, u32 sel)
5171 {
5172         struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
5173         struct atlas7_pad_config *conf = &pmx->pctl_data->confs[pin];
5174         const struct atlas7_pull_info *pull_info;
5175         u32 bank;
5176         unsigned long regv;
5177         void __iomem *pull_sel_reg;
5178
5179         bank = atlas7_pin_to_bank(pin);
5180         pull_info = &atlas7_pull_map[conf->type];
5181         pull_sel_reg = pmx->regs[bank] + conf->pupd_reg;
5182
5183         /* Retrieve correspond register value from table by sel */
5184         regv = pull_info->s2v[sel].data & pull_info->mask;
5185
5186         /* Clear & Set new value to pull register */
5187         writel(pull_info->mask << conf->pupd_bit, CLR_REG(pull_sel_reg));
5188         writel(regv << conf->pupd_bit, pull_sel_reg);
5189
5190         pr_debug("PIN_CFG ### SET PIN#%d PULL SELECTOR:%d == OK ####\n",
5191                 pin, sel);
5192         return 0;
5193 }
5194
5195 static int __altas7_pinctrl_set_drive_strength_sel(struct pinctrl_dev *pctldev,
5196                                                 u32 pin, u32 sel)
5197 {
5198         struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
5199         struct atlas7_pad_config *conf = &pmx->pctl_data->confs[pin];
5200         const struct atlas7_ds_info *ds_info;
5201         u32 bank;
5202         void __iomem *ds_sel_reg;
5203
5204         ds_info = &atlas7_ds_map[conf->type];
5205         if (sel & (~(ds_info->mask)))
5206                 goto unsupport;
5207
5208         bank = atlas7_pin_to_bank(pin);
5209         ds_sel_reg = pmx->regs[bank] + conf->drvstr_reg;
5210
5211         writel(ds_info->imval << conf->drvstr_bit, CLR_REG(ds_sel_reg));
5212         writel(sel << conf->drvstr_bit, ds_sel_reg);
5213
5214         return 0;
5215
5216 unsupport:
5217         pr_err("Pad#%d type[%d] doesn't support ds code[%d]!\n",
5218                 pin, conf->type, sel);
5219         return -ENOTSUPP;
5220 }
5221
5222 static int altas7_pinctrl_set_drive_strength_sel(struct pinctrl_dev *pctldev,
5223                                                 u32 pin, u32 ma)
5224 {
5225         struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
5226         struct atlas7_pad_config *conf = &pmx->pctl_data->confs[pin];
5227         u32 type = conf->type;
5228         u32 sel;
5229         int ret;
5230
5231         sel = convert_current_to_drive_strength(conf->type, ma);
5232         if (DS_NULL == sel) {
5233                 pr_err("Pad#%d type[%d] doesn't support ds current[%d]!\n",
5234                 pin, type, ma);
5235                 return -ENOTSUPP;
5236         }
5237
5238         ret =  __altas7_pinctrl_set_drive_strength_sel(pctldev,
5239                                                 pin, sel);
5240         pr_debug("PIN_CFG ### SET PIN#%d DS:%d MA:%d == %s ####\n",
5241                 pin, sel, ma, ret?"FAILED":"OK");
5242         return ret;
5243 }
5244
5245 static int atlas7_pmx_gpio_request_enable(struct pinctrl_dev *pctldev,
5246                 struct pinctrl_gpio_range *range, u32 pin)
5247 {
5248         struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
5249         u32 idx;
5250
5251         dev_dbg(pmx->dev,
5252                 "atlas7_pmx_gpio_request_enable: pin=%d\n", pin);
5253         for (idx = 0; idx < range->npins; idx++) {
5254                 if (pin == range->pins[idx])
5255                         break;
5256         }
5257
5258         if (idx >= range->npins) {
5259                 dev_err(pmx->dev,
5260                         "The pin#%d could not be requested as GPIO!!\n",
5261                         pin);
5262                 return -EPERM;
5263         }
5264
5265         __atlas7_pmx_pin_enable(pmx, pin, FUNC_GPIO);
5266
5267         return 0;
5268 }
5269
5270 static struct pinmux_ops atlas7_pinmux_ops = {
5271         .get_functions_count = atlas7_pmx_get_funcs_count,
5272         .get_function_name = atlas7_pmx_get_func_name,
5273         .get_function_groups = atlas7_pmx_get_func_groups,
5274         .set_mux = atlas7_pmx_set_mux,
5275         .gpio_request_enable = atlas7_pmx_gpio_request_enable,
5276 };
5277
5278 static int atlas7_pinctrl_get_groups_count(struct pinctrl_dev *pctldev)
5279 {
5280         struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
5281
5282         return pmx->pctl_data->grps_cnt;
5283 }
5284
5285 static const char *atlas7_pinctrl_get_group_name(struct pinctrl_dev *pctldev,
5286                                                 u32 group)
5287 {
5288         struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
5289
5290         return pmx->pctl_data->grps[group].name;
5291 }
5292
5293 static int atlas7_pinctrl_get_group_pins(struct pinctrl_dev *pctldev,
5294                 u32 group, const u32 **pins, u32 *num_pins)
5295 {
5296         struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
5297
5298         *num_pins = pmx->pctl_data->grps[group].num_pins;
5299         *pins = pmx->pctl_data->grps[group].pins;
5300
5301         return 0;
5302 }
5303
5304 static int atlas7_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
5305                                         struct device_node *np_config,
5306                                         struct pinctrl_map **map,
5307                                         u32 *num_maps)
5308 {
5309         return pinconf_generic_dt_node_to_map(pctldev, np_config, map,
5310                                 num_maps, PIN_MAP_TYPE_INVALID);
5311 }
5312
5313 static void atlas7_pinctrl_dt_free_map(struct pinctrl_dev *pctldev,
5314                 struct pinctrl_map *map, u32 num_maps)
5315 {
5316         kfree(map);
5317 }
5318
5319 static const struct pinctrl_ops atlas7_pinctrl_ops = {
5320         .get_groups_count = atlas7_pinctrl_get_groups_count,
5321         .get_group_name = atlas7_pinctrl_get_group_name,
5322         .get_group_pins = atlas7_pinctrl_get_group_pins,
5323         .dt_node_to_map = atlas7_pinctrl_dt_node_to_map,
5324         .dt_free_map = atlas7_pinctrl_dt_free_map,
5325 };
5326
5327 static int atlas7_pin_config_set(struct pinctrl_dev *pctldev,
5328                                 unsigned pin, unsigned long *configs,
5329                                 unsigned num_configs)
5330 {
5331         u16 param, arg;
5332         int idx, err;
5333
5334         for (idx = 0; idx < num_configs; idx++) {
5335                 param = pinconf_to_config_param(configs[idx]);
5336                 arg = pinconf_to_config_argument(configs[idx]);
5337
5338                 pr_debug("PMX CFG###### ATLAS7 PIN#%d [%s] CONFIG PARAM:%d ARG:%d >>>>>\n",
5339                         pin, atlas7_ioc_pads[pin].name, param, arg);
5340                 switch (param) {
5341                 case PIN_CONFIG_BIAS_PULL_UP:
5342                         err = altas7_pinctrl_set_pull_sel(pctldev,
5343                                                         pin, PULL_UP);
5344                         if (err)
5345                                 return err;
5346                         break;
5347
5348                 case PIN_CONFIG_BIAS_PULL_DOWN:
5349                         err = altas7_pinctrl_set_pull_sel(pctldev,
5350                                                         pin, PULL_DOWN);
5351                         if (err)
5352                                 return err;
5353                         break;
5354
5355                 case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
5356                         err = altas7_pinctrl_set_pull_sel(pctldev,
5357                                                         pin, HIGH_HYSTERESIS);
5358                         if (err)
5359                                 return err;
5360                         break;
5361                 case PIN_CONFIG_BIAS_HIGH_IMPEDANCE:
5362                         err = altas7_pinctrl_set_pull_sel(pctldev,
5363                                                         pin, HIGH_Z);
5364                         if (err)
5365                                 return err;
5366                         break;
5367
5368                 case PIN_CONFIG_DRIVE_STRENGTH:
5369                         err = altas7_pinctrl_set_drive_strength_sel(pctldev,
5370                                                         pin, arg);
5371                         if (err)
5372                                 return err;
5373                         break;
5374                 default:
5375                         return -ENOTSUPP;
5376                 }
5377                 pr_debug("PMX CFG###### ATLAS7 PIN#%d [%s] CONFIG PARAM:%d ARG:%d <<<<\n",
5378                         pin, atlas7_ioc_pads[pin].name, param, arg);
5379         }
5380
5381         return 0;
5382 }
5383
5384 static int atlas7_pin_config_group_set(struct pinctrl_dev *pctldev,
5385                                 unsigned group, unsigned long *configs,
5386                                 unsigned num_configs)
5387 {
5388         const unsigned *pins;
5389         unsigned npins;
5390         int i, ret;
5391
5392         ret = atlas7_pinctrl_get_group_pins(pctldev, group, &pins, &npins);
5393         if (ret)
5394                 return ret;
5395         for (i = 0; i < npins; i++) {
5396                 if (atlas7_pin_config_set(pctldev, pins[i],
5397                                           configs, num_configs))
5398                         return -ENOTSUPP;
5399         }
5400         return 0;
5401 }
5402
5403 static const struct pinconf_ops atlas7_pinconf_ops = {
5404         .pin_config_set = atlas7_pin_config_set,
5405         .pin_config_group_set = atlas7_pin_config_group_set,
5406         .is_generic = true,
5407 };
5408
5409 static int atlas7_pinmux_probe(struct platform_device *pdev)
5410 {
5411         int ret, idx;
5412         struct atlas7_pmx *pmx;
5413         struct device_node *np = pdev->dev.of_node;
5414         u32 banks = ATLAS7_PINCTRL_REG_BANKS;
5415         struct device_node *sys2pci_np;
5416         struct resource res;
5417
5418         /* Create state holders etc for this driver */
5419         pmx = devm_kzalloc(&pdev->dev, sizeof(*pmx), GFP_KERNEL);
5420         if (!pmx)
5421                 return -ENOMEM;
5422
5423         /* The sd3 and sd9 shared all pins, and the function select by
5424          * SYS2PCI_SDIO9SEL register
5425          */
5426         sys2pci_np = of_find_node_by_name(NULL, "sys2pci");
5427         if (!sys2pci_np)
5428                 return -EINVAL;
5429         ret = of_address_to_resource(sys2pci_np, 0, &res);
5430         if (ret)
5431                 return ret;
5432         pmx->sys2pci_base = devm_ioremap_resource(&pdev->dev, &res);
5433         if (IS_ERR(pmx->sys2pci_base))
5434                 return -ENOMEM;
5435
5436         pmx->dev = &pdev->dev;
5437
5438         pmx->pctl_data = &atlas7_ioc_data;
5439         pmx->pctl_desc.name = "pinctrl-atlas7";
5440         pmx->pctl_desc.pins = pmx->pctl_data->pads;
5441         pmx->pctl_desc.npins = pmx->pctl_data->pads_cnt;
5442         pmx->pctl_desc.pctlops = &atlas7_pinctrl_ops;
5443         pmx->pctl_desc.pmxops = &atlas7_pinmux_ops;
5444         pmx->pctl_desc.confops = &atlas7_pinconf_ops;
5445
5446         for (idx = 0; idx < banks; idx++) {
5447                 pmx->regs[idx] = of_iomap(np, idx);
5448                 if (!pmx->regs[idx]) {
5449                         dev_err(&pdev->dev,
5450                         "can't map ioc bank#%d registers\n", idx);
5451                         ret = -ENOMEM;
5452                         goto unmap_io;
5453                 }
5454         }
5455
5456         /* Now register the pin controller and all pins it handles */
5457         pmx->pctl = pinctrl_register(&pmx->pctl_desc, &pdev->dev, pmx);
5458         if (IS_ERR(pmx->pctl)) {
5459                 dev_err(&pdev->dev, "could not register atlas7 pinmux driver\n");
5460                 ret = PTR_ERR(pmx->pctl);
5461                 goto unmap_io;
5462         }
5463
5464         platform_set_drvdata(pdev, pmx);
5465
5466         dev_info(&pdev->dev, "initialized atlas7 pinmux driver\n");
5467
5468         return 0;
5469
5470 unmap_io:
5471         for (idx = 0; idx < banks; idx++) {
5472                 if (!pmx->regs[idx])
5473                         break;
5474                 iounmap(pmx->regs[idx]);
5475         }
5476
5477         return ret;
5478 }
5479
5480 #ifdef CONFIG_PM_SLEEP
5481 static int atlas7_pinmux_suspend_noirq(struct device *dev)
5482 {
5483         struct atlas7_pmx *pmx = dev_get_drvdata(dev);
5484         struct atlas7_pad_status *status;
5485         struct atlas7_pad_config *conf;
5486         const struct atlas7_ds_info *ds_info;
5487         const struct atlas7_pull_info *pull_info;
5488         int idx;
5489         u32 bank;
5490         unsigned long regv;
5491
5492         for (idx = 0; idx < pmx->pctl_desc.npins; idx++) {
5493                 /* Get this Pad's descriptor from PINCTRL */
5494                 conf = &pmx->pctl_data->confs[idx];
5495                 bank = atlas7_pin_to_bank(idx);
5496                 status = &pmx->sleep_data[idx];
5497
5498                 /* Save Function selector */
5499                 regv = readl(pmx->regs[bank] + conf->mux_reg);
5500                 status->func = (regv >> conf->mux_bit) & FUNC_CLEAR_MASK;
5501
5502                 /* Check if Pad is in Analogue selector */
5503                 if (conf->ad_ctrl_reg == -1)
5504                         goto save_ds_sel;
5505
5506                 regv = readl(pmx->regs[bank] + conf->ad_ctrl_reg);
5507                 if (!(regv & (conf->ad_ctrl_bit << ANA_CLEAR_MASK)))
5508                         status->func = FUNC_ANALOGUE;
5509
5510 save_ds_sel:
5511                 if (conf->drvstr_reg == -1)
5512                         goto save_pull_sel;
5513
5514                 /* Save Drive Strength selector */
5515                 ds_info = &atlas7_ds_map[conf->type];
5516                 regv = readl(pmx->regs[bank] + conf->drvstr_reg);
5517                 status->dstr = (regv >> conf->drvstr_bit) & ds_info->mask;
5518
5519 save_pull_sel:
5520                 /* Save Pull selector */
5521                 pull_info = &atlas7_pull_map[conf->type];
5522                 regv = readl(pmx->regs[bank] + conf->pupd_reg);
5523                 regv = (regv >> conf->pupd_bit) & pull_info->mask;
5524                 status->pull = pull_info->v2s[regv].data;
5525         }
5526
5527         /*
5528          * Save disable input selector, this selector is not for Pin,
5529          * but for Mux function.
5530          */
5531         for (idx = 0; idx < NUM_OF_IN_DISABLE_REG; idx++) {
5532                 pmx->status_ds[idx] = readl(pmx->regs[BANK_DS] +
5533                                         IN_DISABLE_0_REG_SET + 0x8 * idx);
5534                 pmx->status_dsv[idx] = readl(pmx->regs[BANK_DS] +
5535                                         IN_DISABLE_VAL_0_REG_SET + 0x8 * idx);
5536         }
5537
5538         return 0;
5539 }
5540
5541 static int atlas7_pinmux_resume_noirq(struct device *dev)
5542 {
5543         struct atlas7_pmx *pmx = dev_get_drvdata(dev);
5544         struct atlas7_pad_status *status;
5545         struct atlas7_pad_config *conf;
5546         int idx;
5547         u32 bank;
5548
5549         for (idx = 0; idx < pmx->pctl_desc.npins; idx++) {
5550                 /* Get this Pad's descriptor from PINCTRL */
5551                 conf = &pmx->pctl_data->confs[idx];
5552                 bank = atlas7_pin_to_bank(idx);
5553                 status = &pmx->sleep_data[idx];
5554
5555                 /* Restore Function selector */
5556                 __atlas7_pmx_pin_enable(pmx, idx, (u32)status->func & 0xff);
5557
5558                 if (FUNC_ANALOGUE == status->func)
5559                         goto restore_pull_sel;
5560
5561                 /* Restore Drive Strength selector */
5562                 __altas7_pinctrl_set_drive_strength_sel(pmx->pctl, idx,
5563                                                 (u32)status->dstr & 0xff);
5564
5565 restore_pull_sel:
5566                 /* Restore Pull selector */
5567                 altas7_pinctrl_set_pull_sel(pmx->pctl, idx,
5568                                                 (u32)status->pull & 0xff);
5569         }
5570
5571         /*
5572          * Restore disable input selector, this selector is not for Pin,
5573          * but for Mux function
5574          */
5575         for (idx = 0; idx < NUM_OF_IN_DISABLE_REG; idx++) {
5576                 writel(~0, pmx->regs[BANK_DS] +
5577                                         IN_DISABLE_0_REG_CLR + 0x8 * idx);
5578                 writel(pmx->status_ds[idx], pmx->regs[BANK_DS] +
5579                                         IN_DISABLE_0_REG_SET + 0x8 * idx);
5580                 writel(~0, pmx->regs[BANK_DS] +
5581                                         IN_DISABLE_VAL_0_REG_CLR + 0x8 * idx);
5582                 writel(pmx->status_dsv[idx], pmx->regs[BANK_DS] +
5583                                         IN_DISABLE_VAL_0_REG_SET + 0x8 * idx);
5584         }
5585
5586         return 0;
5587 }
5588
5589 static const struct dev_pm_ops atlas7_pinmux_pm_ops = {
5590         .suspend_noirq = atlas7_pinmux_suspend_noirq,
5591         .resume_noirq = atlas7_pinmux_resume_noirq,
5592         .freeze_noirq = atlas7_pinmux_suspend_noirq,
5593         .restore_noirq = atlas7_pinmux_resume_noirq,
5594 };
5595 #endif
5596
5597 static const struct of_device_id atlas7_pinmux_ids[] = {
5598         { .compatible = "sirf,atlas7-ioc",},
5599         {},
5600 };
5601
5602 static struct platform_driver atlas7_pinmux_driver = {
5603         .driver = {
5604                 .name = "atlas7-ioc",
5605                 .of_match_table = atlas7_pinmux_ids,
5606 #ifdef CONFIG_PM_SLEEP
5607                 .pm = &atlas7_pinmux_pm_ops,
5608 #endif
5609         },
5610         .probe = atlas7_pinmux_probe,
5611 };
5612
5613 static int __init atlas7_pinmux_init(void)
5614 {
5615         return platform_driver_register(&atlas7_pinmux_driver);
5616 }
5617 arch_initcall(atlas7_pinmux_init);
5618
5619
5620 /**
5621  * The Following is GPIO Code
5622  */
5623 static inline struct
5624 atlas7_gpio_bank *atlas7_gpio_to_bank(struct atlas7_gpio_chip *a7gc, u32 gpio)
5625 {
5626         return &a7gc->banks[GPIO_TO_BANK(gpio)];
5627 }
5628
5629 static int __atlas7_gpio_to_pin(struct atlas7_gpio_chip *a7gc, u32 gpio)
5630 {
5631         struct atlas7_gpio_bank *bank;
5632         u32 ofs;
5633
5634         bank = atlas7_gpio_to_bank(a7gc, gpio);
5635         ofs = gpio - bank->gpio_offset;
5636         if (ofs >= bank->ngpio)
5637                 return -ENODEV;
5638
5639         return bank->gpio_pins[ofs];
5640 }
5641
5642 static void atlas7_gpio_irq_ack(struct irq_data *d)
5643 {
5644         struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
5645         struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc);
5646         struct atlas7_gpio_bank *bank;
5647         void __iomem *ctrl_reg;
5648         u32 val, pin_in_bank;
5649         unsigned long flags;
5650
5651         bank = atlas7_gpio_to_bank(a7gc, d->hwirq);
5652         pin_in_bank = d->hwirq - bank->gpio_offset;
5653         ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank);
5654
5655         spin_lock_irqsave(&a7gc->lock, flags);
5656
5657         val = readl(ctrl_reg);
5658         /* clear interrupt status */
5659         writel(val, ctrl_reg);
5660
5661         spin_unlock_irqrestore(&a7gc->lock, flags);
5662 }
5663
5664 static void __atlas7_gpio_irq_mask(struct atlas7_gpio_chip *a7gc, int idx)
5665 {
5666         struct atlas7_gpio_bank *bank;
5667         void __iomem *ctrl_reg;
5668         u32 val, pin_in_bank;
5669
5670         bank = atlas7_gpio_to_bank(a7gc, idx);
5671         pin_in_bank = idx - bank->gpio_offset;
5672         ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank);
5673
5674         val = readl(ctrl_reg);
5675         val &= ~(ATLAS7_GPIO_CTL_INTR_EN_MASK |
5676                 ATLAS7_GPIO_CTL_INTR_STATUS_MASK);
5677         writel(val, ctrl_reg);
5678 }
5679
5680 static void atlas7_gpio_irq_mask(struct irq_data *d)
5681 {
5682         struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
5683         struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc);
5684         unsigned long flags;
5685
5686         spin_lock_irqsave(&a7gc->lock, flags);
5687
5688         __atlas7_gpio_irq_mask(a7gc, d->hwirq);
5689
5690         spin_unlock_irqrestore(&a7gc->lock, flags);
5691 }
5692
5693 static void atlas7_gpio_irq_unmask(struct irq_data *d)
5694 {
5695         struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
5696         struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc);
5697         struct atlas7_gpio_bank *bank;
5698         void __iomem *ctrl_reg;
5699         u32 val, pin_in_bank;
5700         unsigned long flags;
5701
5702         bank = atlas7_gpio_to_bank(a7gc, d->hwirq);
5703         pin_in_bank = d->hwirq - bank->gpio_offset;
5704         ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank);
5705
5706         spin_lock_irqsave(&a7gc->lock, flags);
5707
5708         val = readl(ctrl_reg);
5709         val &= ~ATLAS7_GPIO_CTL_INTR_STATUS_MASK;
5710         val |= ATLAS7_GPIO_CTL_INTR_EN_MASK;
5711         writel(val, ctrl_reg);
5712
5713         spin_unlock_irqrestore(&a7gc->lock, flags);
5714 }
5715
5716 static int atlas7_gpio_irq_type(struct irq_data *d,
5717                                 unsigned int type)
5718 {
5719         struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
5720         struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc);
5721         struct atlas7_gpio_bank *bank;
5722         void __iomem *ctrl_reg;
5723         u32 val, pin_in_bank;
5724         unsigned long flags;
5725
5726         bank = atlas7_gpio_to_bank(a7gc, d->hwirq);
5727         pin_in_bank = d->hwirq - bank->gpio_offset;
5728         ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank);
5729
5730         spin_lock_irqsave(&a7gc->lock, flags);
5731
5732         val = readl(ctrl_reg);
5733         val &= ~(ATLAS7_GPIO_CTL_INTR_STATUS_MASK |
5734                 ATLAS7_GPIO_CTL_INTR_EN_MASK);
5735
5736         switch (type) {
5737         case IRQ_TYPE_NONE:
5738                 break;
5739
5740         case IRQ_TYPE_EDGE_RISING:
5741                 val |= ATLAS7_GPIO_CTL_INTR_HIGH_MASK |
5742                         ATLAS7_GPIO_CTL_INTR_TYPE_MASK;
5743                 val &= ~ATLAS7_GPIO_CTL_INTR_LOW_MASK;
5744                 break;
5745
5746         case IRQ_TYPE_EDGE_FALLING:
5747                 val &= ~ATLAS7_GPIO_CTL_INTR_HIGH_MASK;
5748                 val |= ATLAS7_GPIO_CTL_INTR_LOW_MASK |
5749                         ATLAS7_GPIO_CTL_INTR_TYPE_MASK;
5750                 break;
5751
5752         case IRQ_TYPE_EDGE_BOTH:
5753                 val |= ATLAS7_GPIO_CTL_INTR_HIGH_MASK |
5754                         ATLAS7_GPIO_CTL_INTR_LOW_MASK |
5755                         ATLAS7_GPIO_CTL_INTR_TYPE_MASK;
5756                 break;
5757
5758         case IRQ_TYPE_LEVEL_LOW:
5759                 val &= ~(ATLAS7_GPIO_CTL_INTR_HIGH_MASK |
5760                         ATLAS7_GPIO_CTL_INTR_TYPE_MASK);
5761                 val |= ATLAS7_GPIO_CTL_INTR_LOW_MASK;
5762                 break;
5763
5764         case IRQ_TYPE_LEVEL_HIGH:
5765                 val |= ATLAS7_GPIO_CTL_INTR_HIGH_MASK;
5766                 val &= ~(ATLAS7_GPIO_CTL_INTR_LOW_MASK |
5767                         ATLAS7_GPIO_CTL_INTR_TYPE_MASK);
5768                 break;
5769         }
5770
5771         writel(val, ctrl_reg);
5772
5773         spin_unlock_irqrestore(&a7gc->lock, flags);
5774
5775         return 0;
5776 }
5777
5778 static struct irq_chip atlas7_gpio_irq_chip = {
5779         .name = "atlas7-gpio-irq",
5780         .irq_ack = atlas7_gpio_irq_ack,
5781         .irq_mask = atlas7_gpio_irq_mask,
5782         .irq_unmask = atlas7_gpio_irq_unmask,
5783         .irq_set_type = atlas7_gpio_irq_type,
5784 };
5785
5786 static void atlas7_gpio_handle_irq(struct irq_desc *desc)
5787 {
5788         struct gpio_chip *gc = irq_desc_get_handler_data(desc);
5789         struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc);
5790         struct atlas7_gpio_bank *bank = NULL;
5791         u32 status, ctrl;
5792         int pin_in_bank = 0, idx;
5793         struct irq_chip *chip = irq_desc_get_chip(desc);
5794         unsigned int irq = irq_desc_get_irq(desc);
5795
5796         for (idx = 0; idx < a7gc->nbank; idx++) {
5797                 bank = &a7gc->banks[idx];
5798                 if (bank->irq == irq)
5799                         break;
5800         }
5801         BUG_ON(idx == a7gc->nbank);
5802
5803         chained_irq_enter(chip, desc);
5804
5805         status = readl(ATLAS7_GPIO_INT_STATUS(bank));
5806         if (!status) {
5807                 pr_warn("%s: gpio [%s] status %#x no interrupt is flaged\n",
5808                         __func__, gc->label, status);
5809                 handle_bad_irq(desc);
5810                 return;
5811         }
5812
5813         while (status) {
5814                 ctrl = readl(ATLAS7_GPIO_CTRL(bank, pin_in_bank));
5815
5816                 /*
5817                  * Here we must check whether the corresponding GPIO's
5818                  * interrupt has been enabled, otherwise just skip it
5819                  */
5820                 if ((status & 0x1) && (ctrl & ATLAS7_GPIO_CTL_INTR_EN_MASK)) {
5821                         pr_debug("%s: chip[%s] gpio:%d happens\n",
5822                                 __func__, gc->label,
5823                                 bank->gpio_offset + pin_in_bank);
5824                         generic_handle_irq(
5825                                 irq_find_mapping(gc->irqdomain,
5826                                         bank->gpio_offset + pin_in_bank));
5827                 }
5828
5829                 if (++pin_in_bank >= bank->ngpio)
5830                         break;
5831
5832                 status = status >> 1;
5833         }
5834
5835         chained_irq_exit(chip, desc);
5836 }
5837
5838 static void __atlas7_gpio_set_input(struct atlas7_gpio_chip *a7gc,
5839                                 unsigned int gpio)
5840 {
5841         struct atlas7_gpio_bank *bank;
5842         void __iomem *ctrl_reg;
5843         u32 val, pin_in_bank;
5844
5845         bank = atlas7_gpio_to_bank(a7gc, gpio);
5846         pin_in_bank = gpio - bank->gpio_offset;
5847         ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank);
5848
5849         val = readl(ctrl_reg);
5850         val &= ~ATLAS7_GPIO_CTL_OUT_EN_MASK;
5851         writel(val, ctrl_reg);
5852 }
5853
5854 static int atlas7_gpio_request(struct gpio_chip *chip,
5855                                 unsigned int gpio)
5856 {
5857         struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip);
5858         int ret;
5859         unsigned long flags;
5860
5861         ret = __atlas7_gpio_to_pin(a7gc, gpio);
5862         if (ret < 0)
5863                 return ret;
5864
5865         if (pinctrl_request_gpio(chip->base + gpio))
5866                 return -ENODEV;
5867
5868         spin_lock_irqsave(&a7gc->lock, flags);
5869
5870         /*
5871          * default status:
5872          * set direction as input and mask irq
5873          */
5874         __atlas7_gpio_set_input(a7gc, gpio);
5875         __atlas7_gpio_irq_mask(a7gc, gpio);
5876
5877         spin_unlock_irqrestore(&a7gc->lock, flags);
5878
5879         return 0;
5880 }
5881
5882 static void atlas7_gpio_free(struct gpio_chip *chip,
5883                                 unsigned int gpio)
5884 {
5885         struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip);
5886         unsigned long flags;
5887
5888         spin_lock_irqsave(&a7gc->lock, flags);
5889
5890         __atlas7_gpio_irq_mask(a7gc, gpio);
5891         __atlas7_gpio_set_input(a7gc, gpio);
5892
5893         spin_unlock_irqrestore(&a7gc->lock, flags);
5894
5895         pinctrl_free_gpio(chip->base + gpio);
5896 }
5897
5898 static int atlas7_gpio_direction_input(struct gpio_chip *chip,
5899                                         unsigned int gpio)
5900 {
5901         struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip);
5902         unsigned long flags;
5903
5904         spin_lock_irqsave(&a7gc->lock, flags);
5905
5906         __atlas7_gpio_set_input(a7gc, gpio);
5907
5908         spin_unlock_irqrestore(&a7gc->lock, flags);
5909
5910         return 0;
5911 }
5912
5913 static void __atlas7_gpio_set_output(struct atlas7_gpio_chip *a7gc,
5914                            unsigned int gpio, int value)
5915 {
5916         struct atlas7_gpio_bank *bank;
5917         void __iomem *ctrl_reg;
5918         u32 out_ctrl, pin_in_bank;
5919
5920         bank = atlas7_gpio_to_bank(a7gc, gpio);
5921         pin_in_bank = gpio - bank->gpio_offset;
5922         ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank);
5923
5924         out_ctrl = readl(ctrl_reg);
5925         if (value)
5926                 out_ctrl |= ATLAS7_GPIO_CTL_DATAOUT_MASK;
5927         else
5928                 out_ctrl &= ~ATLAS7_GPIO_CTL_DATAOUT_MASK;
5929
5930         out_ctrl &= ~ATLAS7_GPIO_CTL_INTR_EN_MASK;
5931         out_ctrl |= ATLAS7_GPIO_CTL_OUT_EN_MASK;
5932         writel(out_ctrl, ctrl_reg);
5933 }
5934
5935 static int atlas7_gpio_direction_output(struct gpio_chip *chip,
5936                                 unsigned int gpio, int value)
5937 {
5938         struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip);
5939         unsigned long flags;
5940
5941         spin_lock_irqsave(&a7gc->lock, flags);
5942
5943         __atlas7_gpio_set_output(a7gc, gpio, value);
5944
5945         spin_unlock_irqrestore(&a7gc->lock, flags);
5946
5947         return 0;
5948 }
5949
5950 static int atlas7_gpio_get_value(struct gpio_chip *chip,
5951                                         unsigned int gpio)
5952 {
5953         struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip);
5954         struct atlas7_gpio_bank *bank;
5955         u32 val, pin_in_bank;
5956         unsigned long flags;
5957
5958         bank = atlas7_gpio_to_bank(a7gc, gpio);
5959         pin_in_bank = gpio - bank->gpio_offset;
5960
5961         spin_lock_irqsave(&a7gc->lock, flags);
5962
5963         val = readl(ATLAS7_GPIO_CTRL(bank, pin_in_bank));
5964
5965         spin_unlock_irqrestore(&a7gc->lock, flags);
5966
5967         return !!(val & ATLAS7_GPIO_CTL_DATAIN_MASK);
5968 }
5969
5970 static void atlas7_gpio_set_value(struct gpio_chip *chip,
5971                                 unsigned int gpio, int value)
5972 {
5973         struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip);
5974         struct atlas7_gpio_bank *bank;
5975         void __iomem *ctrl_reg;
5976         u32 ctrl, pin_in_bank;
5977         unsigned long flags;
5978
5979         bank = atlas7_gpio_to_bank(a7gc, gpio);
5980         pin_in_bank = gpio - bank->gpio_offset;
5981         ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank);
5982
5983         spin_lock_irqsave(&a7gc->lock, flags);
5984
5985         ctrl = readl(ctrl_reg);
5986         if (value)
5987                 ctrl |= ATLAS7_GPIO_CTL_DATAOUT_MASK;
5988         else
5989                 ctrl &= ~ATLAS7_GPIO_CTL_DATAOUT_MASK;
5990         writel(ctrl, ctrl_reg);
5991
5992         spin_unlock_irqrestore(&a7gc->lock, flags);
5993 }
5994
5995 static const struct of_device_id atlas7_gpio_ids[] = {
5996         { .compatible = "sirf,atlas7-gpio", },
5997         {},
5998 };
5999
6000 static int atlas7_gpio_probe(struct platform_device *pdev)
6001 {
6002         struct device_node *np = pdev->dev.of_node;
6003         struct atlas7_gpio_chip *a7gc;
6004         struct gpio_chip *chip;
6005         u32 nbank;
6006         int ret, idx;
6007
6008         ret = of_property_read_u32(np, "gpio-banks", &nbank);
6009         if (ret) {
6010                 dev_err(&pdev->dev,
6011                         "Could not find GPIO bank info,ret=%d!\n",
6012                         ret);
6013                 return ret;
6014         }
6015
6016         /* retrieve gpio descriptor data */
6017         a7gc = devm_kzalloc(&pdev->dev, sizeof(*a7gc) +
6018                         sizeof(struct atlas7_gpio_bank) * nbank, GFP_KERNEL);
6019         if (!a7gc)
6020                 return -ENOMEM;
6021
6022         /* Get Gpio clk */
6023         a7gc->clk = of_clk_get(np, 0);
6024         if (!IS_ERR(a7gc->clk)) {
6025                 ret = clk_prepare_enable(a7gc->clk);
6026                 if (ret) {
6027                         dev_err(&pdev->dev,
6028                                 "Could not enable clock!\n");
6029                         return ret;
6030                 }
6031         }
6032
6033         /* Get Gpio Registers */
6034         a7gc->reg = of_iomap(np, 0);
6035         if (!a7gc->reg) {
6036                 dev_err(&pdev->dev, "Could not map GPIO Registers!\n");
6037                 return -ENOMEM;
6038         }
6039
6040         a7gc->nbank = nbank;
6041         spin_lock_init(&a7gc->lock);
6042
6043         /* Setup GPIO Chip */
6044         chip = &a7gc->chip;
6045         chip->request = atlas7_gpio_request;
6046         chip->free = atlas7_gpio_free;
6047         chip->direction_input = atlas7_gpio_direction_input;
6048         chip->get = atlas7_gpio_get_value;
6049         chip->direction_output = atlas7_gpio_direction_output;
6050         chip->set = atlas7_gpio_set_value;
6051         chip->base = -1;
6052         /* Each chip can support 32 pins at one bank */
6053         chip->ngpio = NGPIO_OF_BANK * nbank;
6054         chip->label = kstrdup(np->name, GFP_KERNEL);
6055         chip->of_node = np;
6056         chip->of_gpio_n_cells = 2;
6057         chip->dev = &pdev->dev;
6058
6059         /* Add gpio chip to system */
6060         ret = gpiochip_add(chip);
6061         if (ret) {
6062                 dev_err(&pdev->dev,
6063                 "%s: error in probe function with status %d\n",
6064                 np->name, ret);
6065                 goto failed;
6066         }
6067
6068         /* Add gpio chip to irq subsystem */
6069         ret =  gpiochip_irqchip_add(chip, &atlas7_gpio_irq_chip,
6070                         0, handle_level_irq, IRQ_TYPE_NONE);
6071         if (ret) {
6072                 dev_err(&pdev->dev,
6073                         "could not connect irqchip to gpiochip\n");
6074                 goto failed;
6075         }
6076
6077         for (idx = 0; idx < nbank; idx++) {
6078                 struct gpio_pin_range *pin_range;
6079                 struct atlas7_gpio_bank *bank;
6080
6081                 bank = &a7gc->banks[idx];
6082                 /* Set ctrl registers' base of this bank */
6083                 bank->base = ATLAS7_GPIO_BASE(a7gc, idx);
6084
6085                 /* Get interrupt number from DTS */
6086                 ret = of_irq_get(np, idx);
6087                 if (ret == -EPROBE_DEFER) {
6088                         dev_err(&pdev->dev,
6089                                 "Unable to find IRQ number. ret=%d\n", ret);
6090                         goto failed;
6091                 }
6092                 bank->irq = ret;
6093
6094                 gpiochip_set_chained_irqchip(chip, &atlas7_gpio_irq_chip,
6095                                         bank->irq, atlas7_gpio_handle_irq);
6096
6097                 /* Records gpio_pin_range to a7gc */
6098                 list_for_each_entry(pin_range, &chip->pin_ranges, node) {
6099                         struct pinctrl_gpio_range *range;
6100
6101                         range = &pin_range->range;
6102                         if (range->id == NGPIO_OF_BANK * idx) {
6103                                 bank->gpio_offset = range->id;
6104                                 bank->ngpio = range->npins;
6105                                 bank->gpio_pins = range->pins;
6106                                 bank->pctldev = pin_range->pctldev;
6107                                 break;
6108                         }
6109                 }
6110
6111                 BUG_ON(!bank->pctldev);
6112         }
6113
6114         platform_set_drvdata(pdev, a7gc);
6115         dev_info(&pdev->dev, "add to system.\n");
6116         return 0;
6117 failed:
6118         return ret;
6119 }
6120
6121 #ifdef CONFIG_PM_SLEEP
6122 static int atlas7_gpio_suspend_noirq(struct device *dev)
6123 {
6124         struct atlas7_gpio_chip *a7gc = dev_get_drvdata(dev);
6125         struct atlas7_gpio_bank *bank;
6126         void __iomem *ctrl_reg;
6127         u32 idx, pin;
6128
6129         for (idx = 0; idx < a7gc->nbank; idx++) {
6130                 bank = &a7gc->banks[idx];
6131                 for (pin = 0; pin < bank->ngpio; pin++) {
6132                         ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin);
6133                         bank->sleep_data[pin] = readl(ctrl_reg);
6134                 }
6135         }
6136
6137         return 0;
6138 }
6139
6140 static int atlas7_gpio_resume_noirq(struct device *dev)
6141 {
6142         struct atlas7_gpio_chip *a7gc = dev_get_drvdata(dev);
6143         struct atlas7_gpio_bank *bank;
6144         void __iomem *ctrl_reg;
6145         u32 idx, pin;
6146
6147         for (idx = 0; idx < a7gc->nbank; idx++) {
6148                 bank = &a7gc->banks[idx];
6149                 for (pin = 0; pin < bank->ngpio; pin++) {
6150                         ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin);
6151                         writel(bank->sleep_data[pin], ctrl_reg);
6152                 }
6153         }
6154
6155         return 0;
6156 }
6157
6158 static const struct dev_pm_ops atlas7_gpio_pm_ops = {
6159         .suspend_noirq = atlas7_gpio_suspend_noirq,
6160         .resume_noirq = atlas7_gpio_resume_noirq,
6161         .freeze_noirq = atlas7_gpio_suspend_noirq,
6162         .restore_noirq = atlas7_gpio_resume_noirq,
6163 };
6164 #endif
6165
6166 static struct platform_driver atlas7_gpio_driver = {
6167         .driver = {
6168                 .name = "atlas7-gpio",
6169                 .of_match_table = atlas7_gpio_ids,
6170 #ifdef CONFIG_PM_SLEEP
6171                 .pm = &atlas7_gpio_pm_ops,
6172 #endif
6173         },
6174         .probe = atlas7_gpio_probe,
6175 };
6176
6177 static int __init atlas7_gpio_init(void)
6178 {
6179         return platform_driver_register(&atlas7_gpio_driver);
6180 }
6181 subsys_initcall(atlas7_gpio_init);
6182
6183 MODULE_DESCRIPTION("SIRFSOC Atlas7 pin control driver");
6184 MODULE_LICENSE("GPL");