OSDN Git Service

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