162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Driver for the Gemini pin controller
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright (C) 2017 Linus Walleij <linus.walleij@linaro.org>
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * This is a group-only pin controller.
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci#include <linux/err.h>
962306a36Sopenharmony_ci#include <linux/init.h>
1062306a36Sopenharmony_ci#include <linux/io.h>
1162306a36Sopenharmony_ci#include <linux/mfd/syscon.h>
1262306a36Sopenharmony_ci#include <linux/of.h>
1362306a36Sopenharmony_ci#include <linux/platform_device.h>
1462306a36Sopenharmony_ci#include <linux/regmap.h>
1562306a36Sopenharmony_ci#include <linux/seq_file.h>
1662306a36Sopenharmony_ci#include <linux/slab.h>
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci#include <linux/pinctrl/machine.h>
1962306a36Sopenharmony_ci#include <linux/pinctrl/pinconf-generic.h>
2062306a36Sopenharmony_ci#include <linux/pinctrl/pinconf.h>
2162306a36Sopenharmony_ci#include <linux/pinctrl/pinctrl.h>
2262306a36Sopenharmony_ci#include <linux/pinctrl/pinmux.h>
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#include "pinctrl-utils.h"
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#define DRIVER_NAME "pinctrl-gemini"
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci/**
2962306a36Sopenharmony_ci * struct gemini_pin_conf - information about configuring a pin
3062306a36Sopenharmony_ci * @pin: the pin number
3162306a36Sopenharmony_ci * @reg: config register
3262306a36Sopenharmony_ci * @mask: the bits affecting the configuration of the pin
3362306a36Sopenharmony_ci */
3462306a36Sopenharmony_cistruct gemini_pin_conf {
3562306a36Sopenharmony_ci	unsigned int pin;
3662306a36Sopenharmony_ci	u32 reg;
3762306a36Sopenharmony_ci	u32 mask;
3862306a36Sopenharmony_ci};
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci/**
4162306a36Sopenharmony_ci * struct gemini_pmx - state holder for the gemini pin controller
4262306a36Sopenharmony_ci * @dev: a pointer back to containing device
4362306a36Sopenharmony_ci * @virtbase: the offset to the controller in virtual memory
4462306a36Sopenharmony_ci * @map: regmap to access registers
4562306a36Sopenharmony_ci * @is_3512: whether the SoC/package is the 3512 variant
4662306a36Sopenharmony_ci * @is_3516: whether the SoC/package is the 3516 variant
4762306a36Sopenharmony_ci * @flash_pin: whether the flash pin (extended pins for parallel
4862306a36Sopenharmony_ci * flash) is set
4962306a36Sopenharmony_ci * @confs: pin config information
5062306a36Sopenharmony_ci * @nconfs: number of pin config information items
5162306a36Sopenharmony_ci */
5262306a36Sopenharmony_cistruct gemini_pmx {
5362306a36Sopenharmony_ci	struct device *dev;
5462306a36Sopenharmony_ci	struct pinctrl_dev *pctl;
5562306a36Sopenharmony_ci	struct regmap *map;
5662306a36Sopenharmony_ci	bool is_3512;
5762306a36Sopenharmony_ci	bool is_3516;
5862306a36Sopenharmony_ci	bool flash_pin;
5962306a36Sopenharmony_ci	const struct gemini_pin_conf *confs;
6062306a36Sopenharmony_ci	unsigned int nconfs;
6162306a36Sopenharmony_ci};
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci/**
6462306a36Sopenharmony_ci * struct gemini_pin_group - describes a Gemini pin group
6562306a36Sopenharmony_ci * @name: the name of this specific pin group
6662306a36Sopenharmony_ci * @pins: an array of discrete physical pins used in this group, taken
6762306a36Sopenharmony_ci *	from the driver-local pin enumeration space
6862306a36Sopenharmony_ci * @num_pins: the number of pins in this group array, i.e. the number of
6962306a36Sopenharmony_ci *	elements in .pins so we can iterate over that array
7062306a36Sopenharmony_ci * @mask: bits to clear to enable this when doing pin muxing
7162306a36Sopenharmony_ci * @value: bits to set to enable this when doing pin muxing
7262306a36Sopenharmony_ci * @driving_mask: bitmask for the IO Pad driving register for this
7362306a36Sopenharmony_ci *	group, if it supports altering the driving strength of
7462306a36Sopenharmony_ci *	its lines.
7562306a36Sopenharmony_ci */
7662306a36Sopenharmony_cistruct gemini_pin_group {
7762306a36Sopenharmony_ci	const char *name;
7862306a36Sopenharmony_ci	const unsigned int *pins;
7962306a36Sopenharmony_ci	const unsigned int num_pins;
8062306a36Sopenharmony_ci	u32 mask;
8162306a36Sopenharmony_ci	u32 value;
8262306a36Sopenharmony_ci	u32 driving_mask;
8362306a36Sopenharmony_ci};
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci/* Some straight-forward control registers */
8662306a36Sopenharmony_ci#define GLOBAL_WORD_ID		0x00
8762306a36Sopenharmony_ci#define GLOBAL_STATUS		0x04
8862306a36Sopenharmony_ci#define GLOBAL_STATUS_FLPIN	BIT(20)
8962306a36Sopenharmony_ci#define GLOBAL_IODRIVE		0x10
9062306a36Sopenharmony_ci#define GLOBAL_GMAC_CTRL_SKEW	0x1c
9162306a36Sopenharmony_ci#define GLOBAL_GMAC0_DATA_SKEW	0x20
9262306a36Sopenharmony_ci#define GLOBAL_GMAC1_DATA_SKEW	0x24
9362306a36Sopenharmony_ci/*
9462306a36Sopenharmony_ci * Global Miscellaneous Control Register
9562306a36Sopenharmony_ci * This register controls all Gemini pad/pin multiplexing
9662306a36Sopenharmony_ci *
9762306a36Sopenharmony_ci * It is a tricky register though:
9862306a36Sopenharmony_ci * - For the bits named *_ENABLE, once you DISABLE something, it simply cannot
9962306a36Sopenharmony_ci *   be brought back online, so it means permanent disablement of the
10062306a36Sopenharmony_ci *   corresponding pads.
10162306a36Sopenharmony_ci * - For the bits named *_DISABLE, once you enable something, it cannot be
10262306a36Sopenharmony_ci *   DISABLED again. So you select a flash configuration once, and then
10362306a36Sopenharmony_ci *   you are stuck with it.
10462306a36Sopenharmony_ci */
10562306a36Sopenharmony_ci#define GLOBAL_MISC_CTRL	0x30
10662306a36Sopenharmony_ci#define GEMINI_GMAC_IOSEL_MASK	GENMASK(28, 27)
10762306a36Sopenharmony_ci/* Not really used */
10862306a36Sopenharmony_ci#define GEMINI_GMAC_IOSEL_GMAC0_GMII	BIT(28)
10962306a36Sopenharmony_ci/* Activated with GMAC1 */
11062306a36Sopenharmony_ci#define GEMINI_GMAC_IOSEL_GMAC0_GMAC1_RGMII BIT(27)
11162306a36Sopenharmony_ci/* This will be the default */
11262306a36Sopenharmony_ci#define GEMINI_GMAC_IOSEL_GMAC0_RGMII_GMAC1_GPIO2 0
11362306a36Sopenharmony_ci#define TVC_CLK_PAD_ENABLE	BIT(20)
11462306a36Sopenharmony_ci#define PCI_CLK_PAD_ENABLE	BIT(17)
11562306a36Sopenharmony_ci#define LPC_CLK_PAD_ENABLE	BIT(16)
11662306a36Sopenharmony_ci#define TVC_PADS_ENABLE		BIT(9)
11762306a36Sopenharmony_ci#define SSP_PADS_ENABLE		BIT(8)
11862306a36Sopenharmony_ci#define LCD_PADS_ENABLE		BIT(7)
11962306a36Sopenharmony_ci#define LPC_PADS_ENABLE		BIT(6)
12062306a36Sopenharmony_ci#define PCI_PADS_ENABLE		BIT(5)
12162306a36Sopenharmony_ci#define IDE_PADS_ENABLE		BIT(4)
12262306a36Sopenharmony_ci#define DRAM_PADS_POWERDOWN	BIT(3)
12362306a36Sopenharmony_ci#define NAND_PADS_DISABLE	BIT(2)
12462306a36Sopenharmony_ci#define PFLASH_PADS_DISABLE	BIT(1)
12562306a36Sopenharmony_ci#define SFLASH_PADS_DISABLE	BIT(0)
12662306a36Sopenharmony_ci#define PADS_MASK		(GENMASK(9, 0) | BIT(16) | BIT(17) | BIT(20) | BIT(27))
12762306a36Sopenharmony_ci#define PADS_MAXBIT		27
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci/* Ordered by bit index */
13062306a36Sopenharmony_cistatic const char * const gemini_padgroups[] = {
13162306a36Sopenharmony_ci	"serial flash",
13262306a36Sopenharmony_ci	"parallel flash",
13362306a36Sopenharmony_ci	"NAND flash",
13462306a36Sopenharmony_ci	"DRAM",
13562306a36Sopenharmony_ci	"IDE",
13662306a36Sopenharmony_ci	"PCI",
13762306a36Sopenharmony_ci	"LPC",
13862306a36Sopenharmony_ci	"LCD",
13962306a36Sopenharmony_ci	"SSP",
14062306a36Sopenharmony_ci	"TVC",
14162306a36Sopenharmony_ci	NULL, NULL, NULL, NULL, NULL, NULL,
14262306a36Sopenharmony_ci	"LPC CLK",
14362306a36Sopenharmony_ci	"PCI CLK",
14462306a36Sopenharmony_ci	NULL, NULL,
14562306a36Sopenharmony_ci	"TVC CLK",
14662306a36Sopenharmony_ci	NULL, NULL, NULL, NULL, NULL,
14762306a36Sopenharmony_ci	"GMAC1",
14862306a36Sopenharmony_ci};
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_cistatic const struct pinctrl_pin_desc gemini_3512_pins[] = {
15162306a36Sopenharmony_ci	/* Row A */
15262306a36Sopenharmony_ci	PINCTRL_PIN(0, "A1 VREF CTRL"),
15362306a36Sopenharmony_ci	PINCTRL_PIN(1, "A2 VCC2IO CTRL"),
15462306a36Sopenharmony_ci	PINCTRL_PIN(2, "A3 DRAM CK"),
15562306a36Sopenharmony_ci	PINCTRL_PIN(3, "A4 DRAM CK N"),
15662306a36Sopenharmony_ci	PINCTRL_PIN(4, "A5 DRAM A5"),
15762306a36Sopenharmony_ci	PINCTRL_PIN(5, "A6 DRAM CKE"),
15862306a36Sopenharmony_ci	PINCTRL_PIN(6, "A7 DRAM DQ11"),
15962306a36Sopenharmony_ci	PINCTRL_PIN(7, "A8 DRAM DQ0"),
16062306a36Sopenharmony_ci	PINCTRL_PIN(8, "A9 DRAM DQ5"),
16162306a36Sopenharmony_ci	PINCTRL_PIN(9, "A10 DRAM DQ6"),
16262306a36Sopenharmony_ci	PINCTRL_PIN(10, "A11 DRAM DRAM VREF"),
16362306a36Sopenharmony_ci	PINCTRL_PIN(11, "A12 DRAM BA1"),
16462306a36Sopenharmony_ci	PINCTRL_PIN(12, "A13 DRAM A2"),
16562306a36Sopenharmony_ci	PINCTRL_PIN(13, "A14 PCI GNT1 N"),
16662306a36Sopenharmony_ci	PINCTRL_PIN(14, "A15 PCI REQ9 N"),
16762306a36Sopenharmony_ci	PINCTRL_PIN(15, "A16 PCI REQ2 N"),
16862306a36Sopenharmony_ci	PINCTRL_PIN(16, "A17 PCI REQ3 N"),
16962306a36Sopenharmony_ci	PINCTRL_PIN(17, "A18 PCI AD31"),
17062306a36Sopenharmony_ci	/* Row B */
17162306a36Sopenharmony_ci	PINCTRL_PIN(18, "B1 VCCK CTRL"),
17262306a36Sopenharmony_ci	PINCTRL_PIN(19, "B2 PWR EN"),
17362306a36Sopenharmony_ci	PINCTRL_PIN(20, "B3 RTC CLKI"),
17462306a36Sopenharmony_ci	PINCTRL_PIN(21, "B4 DRAM A4"),
17562306a36Sopenharmony_ci	PINCTRL_PIN(22, "B5 DRAM A6"),
17662306a36Sopenharmony_ci	PINCTRL_PIN(23, "B6 DRAM A12"),
17762306a36Sopenharmony_ci	PINCTRL_PIN(24, "B7 DRAM DQS1"),
17862306a36Sopenharmony_ci	PINCTRL_PIN(25, "B8 DRAM DQ15"),
17962306a36Sopenharmony_ci	PINCTRL_PIN(26, "B9 DRAM DQ4"),
18062306a36Sopenharmony_ci	PINCTRL_PIN(27, "B10 DRAM DQS0"),
18162306a36Sopenharmony_ci	PINCTRL_PIN(28, "B11 DRAM WE N"),
18262306a36Sopenharmony_ci	PINCTRL_PIN(29, "B12 DRAM A10"),
18362306a36Sopenharmony_ci	PINCTRL_PIN(30, "B13 DRAM A3"),
18462306a36Sopenharmony_ci	PINCTRL_PIN(31, "B14 PCI GNT0 N"),
18562306a36Sopenharmony_ci	PINCTRL_PIN(32, "B15 PCI GNT3 N"),
18662306a36Sopenharmony_ci	PINCTRL_PIN(33, "B16 PCI REQ1 N"),
18762306a36Sopenharmony_ci	PINCTRL_PIN(34, "B17 PCI AD30"),
18862306a36Sopenharmony_ci	PINCTRL_PIN(35, "B18 PCI AD29"),
18962306a36Sopenharmony_ci	/* Row C */
19062306a36Sopenharmony_ci	PINCTRL_PIN(36, "C1 CIR RST N"), /* REALLY? CIR is not in 3512... */
19162306a36Sopenharmony_ci	PINCTRL_PIN(37, "C2 XTALI"),
19262306a36Sopenharmony_ci	PINCTRL_PIN(38, "C3 PWR BTN"),
19362306a36Sopenharmony_ci	PINCTRL_PIN(39, "C4 RTC CLKO"),
19462306a36Sopenharmony_ci	PINCTRL_PIN(40, "C5 DRAM A7"),
19562306a36Sopenharmony_ci	PINCTRL_PIN(41, "C6 DRAM A11"),
19662306a36Sopenharmony_ci	PINCTRL_PIN(42, "C7 DRAM DQ10"),
19762306a36Sopenharmony_ci	PINCTRL_PIN(43, "C8 DRAM DQ14"),
19862306a36Sopenharmony_ci	PINCTRL_PIN(44, "C9 DRAM DQ3"),
19962306a36Sopenharmony_ci	PINCTRL_PIN(45, "C10 DRAM DQ7"),
20062306a36Sopenharmony_ci	PINCTRL_PIN(46, "C11 DRAM CAS N"),
20162306a36Sopenharmony_ci	PINCTRL_PIN(47, "C12 DRAM A0"),
20262306a36Sopenharmony_ci	PINCTRL_PIN(48, "C13 PCI INT0 N"),
20362306a36Sopenharmony_ci	PINCTRL_PIN(49, "C14 EXT RESET N"),
20462306a36Sopenharmony_ci	PINCTRL_PIN(50, "C15 PCI GNT2 N"),
20562306a36Sopenharmony_ci	PINCTRL_PIN(51, "C16 PCI AD28"),
20662306a36Sopenharmony_ci	PINCTRL_PIN(52, "C17 PCI AD27"),
20762306a36Sopenharmony_ci	PINCTRL_PIN(53, "C18 PCI AD26"),
20862306a36Sopenharmony_ci	/* Row D */
20962306a36Sopenharmony_ci	PINCTRL_PIN(54, "D1 AVCCKHA"),
21062306a36Sopenharmony_ci	PINCTRL_PIN(55, "D2 AGNDIOHA"),
21162306a36Sopenharmony_ci	PINCTRL_PIN(56, "D3 XTALO"),
21262306a36Sopenharmony_ci	PINCTRL_PIN(57, "D4 AVCC3IOHA"),
21362306a36Sopenharmony_ci	PINCTRL_PIN(58, "D5 DRAM A8"),
21462306a36Sopenharmony_ci	PINCTRL_PIN(59, "D6 DRAM A9"),
21562306a36Sopenharmony_ci	PINCTRL_PIN(60, "D7 DRAM DQ9"),
21662306a36Sopenharmony_ci	PINCTRL_PIN(61, "D8 DRAM DQ13"),
21762306a36Sopenharmony_ci	PINCTRL_PIN(62, "D9 DRAM DQ2"),
21862306a36Sopenharmony_ci	PINCTRL_PIN(63, "D10 DRAM A13"),
21962306a36Sopenharmony_ci	PINCTRL_PIN(64, "D11 DRAM RAS N"),
22062306a36Sopenharmony_ci	PINCTRL_PIN(65, "D12 DRAM A1"),
22162306a36Sopenharmony_ci	PINCTRL_PIN(66, "D13 PCI INTC N"),
22262306a36Sopenharmony_ci	PINCTRL_PIN(67, "D14 PCI CLK"),
22362306a36Sopenharmony_ci	PINCTRL_PIN(68, "D15 PCI AD25"),
22462306a36Sopenharmony_ci	PINCTRL_PIN(69, "D16 PCI AD24"),
22562306a36Sopenharmony_ci	PINCTRL_PIN(70, "D17 PCI CBE3 N"),
22662306a36Sopenharmony_ci	PINCTRL_PIN(71, "D18 PCI AD23"),
22762306a36Sopenharmony_ci	/* Row E */
22862306a36Sopenharmony_ci	PINCTRL_PIN(72, "E1 AVCC3IOHA"),
22962306a36Sopenharmony_ci	PINCTRL_PIN(73, "E2 EBG"),
23062306a36Sopenharmony_ci	PINCTRL_PIN(74, "E3 AVCC3IOHB"),
23162306a36Sopenharmony_ci	PINCTRL_PIN(75, "E4 REXT"),
23262306a36Sopenharmony_ci	PINCTRL_PIN(76, "E5 GND"),
23362306a36Sopenharmony_ci	PINCTRL_PIN(77, "E6 DRAM DQM1"),
23462306a36Sopenharmony_ci	PINCTRL_PIN(78, "E7 DRAM DQ8"),
23562306a36Sopenharmony_ci	PINCTRL_PIN(79, "E8 DRAM DQ12"),
23662306a36Sopenharmony_ci	PINCTRL_PIN(80, "E9 DRAM DQ1"),
23762306a36Sopenharmony_ci	PINCTRL_PIN(81, "E10 DRAM DQM0"),
23862306a36Sopenharmony_ci	PINCTRL_PIN(82, "E11 DRAM BA0"),
23962306a36Sopenharmony_ci	PINCTRL_PIN(83, "E12 PCI INTA N"),
24062306a36Sopenharmony_ci	PINCTRL_PIN(84, "E13 PCI INTB N"),
24162306a36Sopenharmony_ci	PINCTRL_PIN(85, "E14 GND"),
24262306a36Sopenharmony_ci	PINCTRL_PIN(86, "E15 PCI AD22"),
24362306a36Sopenharmony_ci	PINCTRL_PIN(87, "E16 PCI AD21"),
24462306a36Sopenharmony_ci	PINCTRL_PIN(88, "E17 PCI AD20"),
24562306a36Sopenharmony_ci	PINCTRL_PIN(89, "E18 PCI AD19"),
24662306a36Sopenharmony_ci	/* Row F */
24762306a36Sopenharmony_ci	PINCTRL_PIN(90, "F1 SATA0 RXDP"),
24862306a36Sopenharmony_ci	PINCTRL_PIN(91, "F2 SATA0 RXDN"),
24962306a36Sopenharmony_ci	PINCTRL_PIN(92, "F3 AGNDK 0"),
25062306a36Sopenharmony_ci	PINCTRL_PIN(93, "F4 AVCC3 S"),
25162306a36Sopenharmony_ci	PINCTRL_PIN(94, "F5 AVCCK P"),
25262306a36Sopenharmony_ci	PINCTRL_PIN(95, "F6 GND"),
25362306a36Sopenharmony_ci	PINCTRL_PIN(96, "F7 VCC2IOHA 2"),
25462306a36Sopenharmony_ci	PINCTRL_PIN(97, "F8 VCC2IOHA 2"),
25562306a36Sopenharmony_ci	PINCTRL_PIN(98, "F9 V1"),
25662306a36Sopenharmony_ci	PINCTRL_PIN(99, "F10 V1"),
25762306a36Sopenharmony_ci	PINCTRL_PIN(100, "F11 VCC2IOHA 2"),
25862306a36Sopenharmony_ci	PINCTRL_PIN(101, "F12 VCC2IOHA 2"),
25962306a36Sopenharmony_ci	PINCTRL_PIN(102, "F13 GND"),
26062306a36Sopenharmony_ci	PINCTRL_PIN(103, "F14 PCI AD18"),
26162306a36Sopenharmony_ci	PINCTRL_PIN(104, "F15 PCI AD17"),
26262306a36Sopenharmony_ci	PINCTRL_PIN(105, "F16 PCI AD16"),
26362306a36Sopenharmony_ci	PINCTRL_PIN(106, "F17 PCI CBE2 N"),
26462306a36Sopenharmony_ci	PINCTRL_PIN(107, "F18 PCI FRAME N"),
26562306a36Sopenharmony_ci	/* Row G */
26662306a36Sopenharmony_ci	PINCTRL_PIN(108, "G1 SATA0 TXDP"),
26762306a36Sopenharmony_ci	PINCTRL_PIN(109, "G2 SATA0 TXDN"),
26862306a36Sopenharmony_ci	PINCTRL_PIN(110, "G3 AGNDK 1"),
26962306a36Sopenharmony_ci	PINCTRL_PIN(111, "G4 AVCCK 0"),
27062306a36Sopenharmony_ci	PINCTRL_PIN(112, "G5 TEST CLKOUT"),
27162306a36Sopenharmony_ci	PINCTRL_PIN(113, "G6 AGND"),
27262306a36Sopenharmony_ci	PINCTRL_PIN(114, "G7 GND"),
27362306a36Sopenharmony_ci	PINCTRL_PIN(115, "G8 VCC2IOHA 2"),
27462306a36Sopenharmony_ci	PINCTRL_PIN(116, "G9 V1"),
27562306a36Sopenharmony_ci	PINCTRL_PIN(117, "G10 V1"),
27662306a36Sopenharmony_ci	PINCTRL_PIN(118, "G11 VCC2IOHA 2"),
27762306a36Sopenharmony_ci	PINCTRL_PIN(119, "G12 GND"),
27862306a36Sopenharmony_ci	PINCTRL_PIN(120, "G13 VCC3IOHA"),
27962306a36Sopenharmony_ci	PINCTRL_PIN(121, "G14 PCI IRDY N"),
28062306a36Sopenharmony_ci	PINCTRL_PIN(122, "G15 PCI TRDY N"),
28162306a36Sopenharmony_ci	PINCTRL_PIN(123, "G16 PCI DEVSEL N"),
28262306a36Sopenharmony_ci	PINCTRL_PIN(124, "G17 PCI STOP N"),
28362306a36Sopenharmony_ci	PINCTRL_PIN(125, "G18 PCI PAR"),
28462306a36Sopenharmony_ci	/* Row H */
28562306a36Sopenharmony_ci	PINCTRL_PIN(126, "H1 SATA1 TXDP"),
28662306a36Sopenharmony_ci	PINCTRL_PIN(127, "H2 SATA1 TXDN"),
28762306a36Sopenharmony_ci	PINCTRL_PIN(128, "H3 AGNDK 2"),
28862306a36Sopenharmony_ci	PINCTRL_PIN(129, "H4 AVCCK 1"),
28962306a36Sopenharmony_ci	PINCTRL_PIN(130, "H5 AVCCK S"),
29062306a36Sopenharmony_ci	PINCTRL_PIN(131, "H6 AVCCKHB"),
29162306a36Sopenharmony_ci	PINCTRL_PIN(132, "H7 AGND"),
29262306a36Sopenharmony_ci	PINCTRL_PIN(133, "H8 GND"),
29362306a36Sopenharmony_ci	PINCTRL_PIN(134, "H9 GND"),
29462306a36Sopenharmony_ci	PINCTRL_PIN(135, "H10 GND"),
29562306a36Sopenharmony_ci	PINCTRL_PIN(136, "H11 GND"),
29662306a36Sopenharmony_ci	PINCTRL_PIN(137, "H12 VCC3IOHA"),
29762306a36Sopenharmony_ci	PINCTRL_PIN(138, "H13 VCC3IOHA"),
29862306a36Sopenharmony_ci	PINCTRL_PIN(139, "H14 PCI CBE1 N"),
29962306a36Sopenharmony_ci	PINCTRL_PIN(140, "H15 PCI AD15"),
30062306a36Sopenharmony_ci	PINCTRL_PIN(141, "H16 PCI AD14"),
30162306a36Sopenharmony_ci	PINCTRL_PIN(142, "H17 PCI AD13"),
30262306a36Sopenharmony_ci	PINCTRL_PIN(143, "H18 PCI AD12"),
30362306a36Sopenharmony_ci	/* Row J (for some reason I is skipped) */
30462306a36Sopenharmony_ci	PINCTRL_PIN(144, "J1 SATA1 RXDP"),
30562306a36Sopenharmony_ci	PINCTRL_PIN(145, "J2 SATA1 RXDN"),
30662306a36Sopenharmony_ci	PINCTRL_PIN(146, "J3 AGNDK 3"),
30762306a36Sopenharmony_ci	PINCTRL_PIN(147, "J4 AVCCK 2"),
30862306a36Sopenharmony_ci	PINCTRL_PIN(148, "J5 IDE DA1"),
30962306a36Sopenharmony_ci	PINCTRL_PIN(149, "J6 V1"),
31062306a36Sopenharmony_ci	PINCTRL_PIN(150, "J7 V1"),
31162306a36Sopenharmony_ci	PINCTRL_PIN(151, "J8 GND"),
31262306a36Sopenharmony_ci	PINCTRL_PIN(152, "J9 GND"),
31362306a36Sopenharmony_ci	PINCTRL_PIN(153, "J10 GND"),
31462306a36Sopenharmony_ci	PINCTRL_PIN(154, "J11 GND"),
31562306a36Sopenharmony_ci	PINCTRL_PIN(155, "J12 V1"),
31662306a36Sopenharmony_ci	PINCTRL_PIN(156, "J13 V1"),
31762306a36Sopenharmony_ci	PINCTRL_PIN(157, "J14 PCI AD11"),
31862306a36Sopenharmony_ci	PINCTRL_PIN(158, "J15 PCI AD10"),
31962306a36Sopenharmony_ci	PINCTRL_PIN(159, "J16 PCI AD9"),
32062306a36Sopenharmony_ci	PINCTRL_PIN(160, "J17 PCI AD8"),
32162306a36Sopenharmony_ci	PINCTRL_PIN(161, "J18 PCI CBE0 N"),
32262306a36Sopenharmony_ci	/* Row K */
32362306a36Sopenharmony_ci	PINCTRL_PIN(162, "K1 IDE CS1 N"),
32462306a36Sopenharmony_ci	PINCTRL_PIN(163, "K2 IDE CS0 N"),
32562306a36Sopenharmony_ci	PINCTRL_PIN(164, "K3 AVCCK 3"),
32662306a36Sopenharmony_ci	PINCTRL_PIN(165, "K4 IDE DA2"),
32762306a36Sopenharmony_ci	PINCTRL_PIN(166, "K5 IDE DA0"),
32862306a36Sopenharmony_ci	PINCTRL_PIN(167, "K6 V1"),
32962306a36Sopenharmony_ci	PINCTRL_PIN(168, "K7 V1"),
33062306a36Sopenharmony_ci	PINCTRL_PIN(169, "K8 GND"),
33162306a36Sopenharmony_ci	PINCTRL_PIN(170, "K9 GND"),
33262306a36Sopenharmony_ci	PINCTRL_PIN(171, "K10 GND"),
33362306a36Sopenharmony_ci	PINCTRL_PIN(172, "K11 GND"),
33462306a36Sopenharmony_ci	PINCTRL_PIN(173, "K12 V1"),
33562306a36Sopenharmony_ci	PINCTRL_PIN(174, "K13 V1"),
33662306a36Sopenharmony_ci	PINCTRL_PIN(175, "K14 PCI AD3"),
33762306a36Sopenharmony_ci	PINCTRL_PIN(176, "K15 PCI AD4"),
33862306a36Sopenharmony_ci	PINCTRL_PIN(177, "K16 PCI AD5"),
33962306a36Sopenharmony_ci	PINCTRL_PIN(178, "K17 PCI AD6"),
34062306a36Sopenharmony_ci	PINCTRL_PIN(179, "K18 PCI AD7"),
34162306a36Sopenharmony_ci	/* Row L */
34262306a36Sopenharmony_ci	PINCTRL_PIN(180, "L1 IDE INTRQ"),
34362306a36Sopenharmony_ci	PINCTRL_PIN(181, "L2 IDE DMACK N"),
34462306a36Sopenharmony_ci	PINCTRL_PIN(182, "L3 IDE IORDY"),
34562306a36Sopenharmony_ci	PINCTRL_PIN(183, "L4 IDE DIOR N"),
34662306a36Sopenharmony_ci	PINCTRL_PIN(184, "L5 IDE DIOW N"),
34762306a36Sopenharmony_ci	PINCTRL_PIN(185, "L6 VCC3IOHA"),
34862306a36Sopenharmony_ci	PINCTRL_PIN(186, "L7 VCC3IOHA"),
34962306a36Sopenharmony_ci	PINCTRL_PIN(187, "L8 GND"),
35062306a36Sopenharmony_ci	PINCTRL_PIN(188, "L9 GND"),
35162306a36Sopenharmony_ci	PINCTRL_PIN(189, "L10 GND"),
35262306a36Sopenharmony_ci	PINCTRL_PIN(190, "L11 GND"),
35362306a36Sopenharmony_ci	PINCTRL_PIN(191, "L12 VCC3IOHA"),
35462306a36Sopenharmony_ci	PINCTRL_PIN(192, "L13 VCC3IOHA"),
35562306a36Sopenharmony_ci	PINCTRL_PIN(193, "L14 GPIO0 30"),
35662306a36Sopenharmony_ci	PINCTRL_PIN(194, "L15 GPIO0 31"),
35762306a36Sopenharmony_ci	PINCTRL_PIN(195, "L16 PCI AD0"),
35862306a36Sopenharmony_ci	PINCTRL_PIN(196, "L17 PCI AD1"),
35962306a36Sopenharmony_ci	PINCTRL_PIN(197, "L18 PCI AD2"),
36062306a36Sopenharmony_ci	/* Row M */
36162306a36Sopenharmony_ci	PINCTRL_PIN(198, "M1 IDE DMARQ"),
36262306a36Sopenharmony_ci	PINCTRL_PIN(199, "M2 IDE DD15"),
36362306a36Sopenharmony_ci	PINCTRL_PIN(200, "M3 IDE DD0"),
36462306a36Sopenharmony_ci	PINCTRL_PIN(201, "M4 IDE DD14"),
36562306a36Sopenharmony_ci	PINCTRL_PIN(202, "M5 IDE DD1"),
36662306a36Sopenharmony_ci	PINCTRL_PIN(203, "M6 VCC3IOHA"),
36762306a36Sopenharmony_ci	PINCTRL_PIN(204, "M7 GND"),
36862306a36Sopenharmony_ci	PINCTRL_PIN(205, "M8 VCC2IOHA 1"),
36962306a36Sopenharmony_ci	PINCTRL_PIN(206, "M9 V1"),
37062306a36Sopenharmony_ci	PINCTRL_PIN(207, "M10 V1"),
37162306a36Sopenharmony_ci	PINCTRL_PIN(208, "M11 VCC3IOHA"),
37262306a36Sopenharmony_ci	PINCTRL_PIN(209, "M12 GND"),
37362306a36Sopenharmony_ci	PINCTRL_PIN(210, "M13 VCC3IOHA"),
37462306a36Sopenharmony_ci	PINCTRL_PIN(211, "M14 GPIO0 25"),
37562306a36Sopenharmony_ci	PINCTRL_PIN(212, "M15 GPIO0 26"),
37662306a36Sopenharmony_ci	PINCTRL_PIN(213, "M16 GPIO0 27"),
37762306a36Sopenharmony_ci	PINCTRL_PIN(214, "M17 GPIO0 28"),
37862306a36Sopenharmony_ci	PINCTRL_PIN(215, "M18 GPIO0 29"),
37962306a36Sopenharmony_ci	/* Row N */
38062306a36Sopenharmony_ci	PINCTRL_PIN(216, "N1 IDE DD13"),
38162306a36Sopenharmony_ci	PINCTRL_PIN(217, "N2 IDE DD2"),
38262306a36Sopenharmony_ci	PINCTRL_PIN(218, "N3 IDE DD12"),
38362306a36Sopenharmony_ci	PINCTRL_PIN(219, "N4 IDE DD3"),
38462306a36Sopenharmony_ci	PINCTRL_PIN(220, "N5 IDE DD11"),
38562306a36Sopenharmony_ci	PINCTRL_PIN(221, "N6 GND"),
38662306a36Sopenharmony_ci	PINCTRL_PIN(222, "N7 VCC2IOHA 1"),
38762306a36Sopenharmony_ci	PINCTRL_PIN(223, "N8 VCC2IOHA 1"),
38862306a36Sopenharmony_ci	PINCTRL_PIN(224, "N9 V1"),
38962306a36Sopenharmony_ci	PINCTRL_PIN(225, "N10 V1"),
39062306a36Sopenharmony_ci	PINCTRL_PIN(226, "N11 VCC3IOHA"),
39162306a36Sopenharmony_ci	PINCTRL_PIN(227, "N12 VCC3IOHA"),
39262306a36Sopenharmony_ci	PINCTRL_PIN(228, "N13 GND"),
39362306a36Sopenharmony_ci	PINCTRL_PIN(229, "N14 GPIO0 20"),
39462306a36Sopenharmony_ci	PINCTRL_PIN(230, "N15 GPIO0 21"),
39562306a36Sopenharmony_ci	PINCTRL_PIN(231, "N16 GPIO0 22"),
39662306a36Sopenharmony_ci	PINCTRL_PIN(232, "N17 GPIO0 23"),
39762306a36Sopenharmony_ci	PINCTRL_PIN(233, "N18 GPIO0 24"),
39862306a36Sopenharmony_ci	/* Row P (for some reason O is skipped) */
39962306a36Sopenharmony_ci	PINCTRL_PIN(234, "P1 IDE DD4"),
40062306a36Sopenharmony_ci	PINCTRL_PIN(235, "P2 IDE DD10"),
40162306a36Sopenharmony_ci	PINCTRL_PIN(236, "P3 IDE DD5"),
40262306a36Sopenharmony_ci	PINCTRL_PIN(237, "P4 IDE DD9"),
40362306a36Sopenharmony_ci	PINCTRL_PIN(238, "P5 GND"),
40462306a36Sopenharmony_ci	PINCTRL_PIN(239, "P6 USB XSCO"),
40562306a36Sopenharmony_ci	PINCTRL_PIN(240, "P7 GMAC0 TXD3"),
40662306a36Sopenharmony_ci	PINCTRL_PIN(241, "P8 GMAC0 TXEN"),
40762306a36Sopenharmony_ci	PINCTRL_PIN(242, "P9 GMAC0 RXD2"),
40862306a36Sopenharmony_ci	PINCTRL_PIN(243, "P10 GMAC1 TXC"),
40962306a36Sopenharmony_ci	PINCTRL_PIN(244, "P11 GMAC1 RXD1"),
41062306a36Sopenharmony_ci	PINCTRL_PIN(245, "P12 MODE SEL 1"),
41162306a36Sopenharmony_ci	PINCTRL_PIN(246, "P13 GPIO1 28"),
41262306a36Sopenharmony_ci	PINCTRL_PIN(247, "P14 GND"),
41362306a36Sopenharmony_ci	PINCTRL_PIN(248, "P15 GPIO0 5"),
41462306a36Sopenharmony_ci	PINCTRL_PIN(249, "P16 GPIO0 17"),
41562306a36Sopenharmony_ci	PINCTRL_PIN(250, "P17 GPIO0 18"),
41662306a36Sopenharmony_ci	PINCTRL_PIN(251, "P18 GPIO0 19"),
41762306a36Sopenharmony_ci	/* Row R (for some reason Q is skipped) */
41862306a36Sopenharmony_ci	PINCTRL_PIN(252, "R1 IDE DD6"),
41962306a36Sopenharmony_ci	PINCTRL_PIN(253, "R2 IDE DD8"),
42062306a36Sopenharmony_ci	PINCTRL_PIN(254, "R3 IDE DD7"),
42162306a36Sopenharmony_ci	PINCTRL_PIN(255, "R4 IDE RESET N"),
42262306a36Sopenharmony_ci	PINCTRL_PIN(256, "R5 ICE0 DBGACK"),
42362306a36Sopenharmony_ci	PINCTRL_PIN(257, "R6 USB XSCI"),
42462306a36Sopenharmony_ci	PINCTRL_PIN(258, "R7 GMAC0 TXD2"),
42562306a36Sopenharmony_ci	PINCTRL_PIN(259, "R8 GMAC0 RXDV"),
42662306a36Sopenharmony_ci	PINCTRL_PIN(260, "R9 GMAC0 RXD3"),
42762306a36Sopenharmony_ci	PINCTRL_PIN(261, "R10 GMAC1 TXD0"),
42862306a36Sopenharmony_ci	PINCTRL_PIN(262, "R11 GMAC1 RXD0"),
42962306a36Sopenharmony_ci	PINCTRL_PIN(263, "R12 MODE SEL 0"),
43062306a36Sopenharmony_ci	PINCTRL_PIN(264, "R13 MODE SEL 3"),
43162306a36Sopenharmony_ci	PINCTRL_PIN(265, "R14 GPIO0 0"),
43262306a36Sopenharmony_ci	PINCTRL_PIN(266, "R15 GPIO0 4"),
43362306a36Sopenharmony_ci	PINCTRL_PIN(267, "R16 GPIO0 9"),
43462306a36Sopenharmony_ci	PINCTRL_PIN(268, "R17 GPIO0 15"),
43562306a36Sopenharmony_ci	PINCTRL_PIN(269, "R18 GPIO0 16"),
43662306a36Sopenharmony_ci	/* Row T (for some reason S is skipped) */
43762306a36Sopenharmony_ci	PINCTRL_PIN(270, "T1 ICE0 DBGRQ"),
43862306a36Sopenharmony_ci	PINCTRL_PIN(271, "T2 ICE0 IDO"),
43962306a36Sopenharmony_ci	PINCTRL_PIN(272, "T3 ICE0 ICK"),
44062306a36Sopenharmony_ci	PINCTRL_PIN(273, "T4 ICE0 IMS"),
44162306a36Sopenharmony_ci	PINCTRL_PIN(274, "T5 ICE0 IDI"),
44262306a36Sopenharmony_ci	PINCTRL_PIN(275, "T6 USB RREF"),
44362306a36Sopenharmony_ci	PINCTRL_PIN(276, "T7 GMAC0 TXD1"),
44462306a36Sopenharmony_ci	PINCTRL_PIN(277, "T8 GMAC0 RXC"),
44562306a36Sopenharmony_ci	PINCTRL_PIN(278, "T9 GMAC0 CRS"),
44662306a36Sopenharmony_ci	PINCTRL_PIN(279, "T10 GMAC1 TXD1"),
44762306a36Sopenharmony_ci	PINCTRL_PIN(280, "T11 GMAC1 RXC"),
44862306a36Sopenharmony_ci	PINCTRL_PIN(281, "T12 GMAC1 CRS"),
44962306a36Sopenharmony_ci	PINCTRL_PIN(282, "T13 EXT CLK"),
45062306a36Sopenharmony_ci	PINCTRL_PIN(283, "T14 GPIO1 31"),
45162306a36Sopenharmony_ci	PINCTRL_PIN(284, "T15 GPIO0 3"),
45262306a36Sopenharmony_ci	PINCTRL_PIN(285, "T16 GPIO0 8"),
45362306a36Sopenharmony_ci	PINCTRL_PIN(286, "T17 GPIO0 12"),
45462306a36Sopenharmony_ci	PINCTRL_PIN(287, "T18 GPIO0 14"),
45562306a36Sopenharmony_ci	/* Row U */
45662306a36Sopenharmony_ci	PINCTRL_PIN(288, "U1 ICE0 IRST N"),
45762306a36Sopenharmony_ci	PINCTRL_PIN(289, "U2 USB0 VCCHSRT"),
45862306a36Sopenharmony_ci	PINCTRL_PIN(290, "U3 USB0 DP"),
45962306a36Sopenharmony_ci	PINCTRL_PIN(291, "U4 USB VCCA U20"),
46062306a36Sopenharmony_ci	PINCTRL_PIN(292, "U5 USB1 DP"),
46162306a36Sopenharmony_ci	PINCTRL_PIN(293, "U6 USB1 GNDHSRT 1"),
46262306a36Sopenharmony_ci	PINCTRL_PIN(294, "U7 GMAC0 TXD0"),
46362306a36Sopenharmony_ci	PINCTRL_PIN(295, "U8 GMAC0 RXD0"),
46462306a36Sopenharmony_ci	PINCTRL_PIN(296, "U9 GMAC1 COL"),
46562306a36Sopenharmony_ci	PINCTRL_PIN(297, "U10 GMAC1 TXD2"),
46662306a36Sopenharmony_ci	PINCTRL_PIN(298, "U11 GMAC1 RXDV"),
46762306a36Sopenharmony_ci	PINCTRL_PIN(299, "U12 GMAC1 RXD3"),
46862306a36Sopenharmony_ci	PINCTRL_PIN(300, "U13 MODE SEL 2"),
46962306a36Sopenharmony_ci	PINCTRL_PIN(301, "U14 GPIO1 30"),
47062306a36Sopenharmony_ci	PINCTRL_PIN(302, "U15 GPIO0 2"),
47162306a36Sopenharmony_ci	PINCTRL_PIN(303, "U16 GPIO0 7"),
47262306a36Sopenharmony_ci	PINCTRL_PIN(304, "U17 GPIO0 11"),
47362306a36Sopenharmony_ci	PINCTRL_PIN(305, "U18 GPIO0 13"),
47462306a36Sopenharmony_ci	/* Row V */
47562306a36Sopenharmony_ci	PINCTRL_PIN(306, "V1 USB0 GNDHSRT"),
47662306a36Sopenharmony_ci	PINCTRL_PIN(307, "V2 USB0 DM"),
47762306a36Sopenharmony_ci	PINCTRL_PIN(308, "V3 USB GNDA U20"),
47862306a36Sopenharmony_ci	PINCTRL_PIN(309, "V4 USB1 DM"),
47962306a36Sopenharmony_ci	PINCTRL_PIN(310, "V5 USB1 VCCHSRT1"),
48062306a36Sopenharmony_ci	PINCTRL_PIN(311, "V6 GMAC0 COL"),
48162306a36Sopenharmony_ci	PINCTRL_PIN(312, "V7 GMAC0 TXC"),
48262306a36Sopenharmony_ci	PINCTRL_PIN(313, "V8 GMAC0 RXD1"),
48362306a36Sopenharmony_ci	PINCTRL_PIN(314, "V9 REF CLK"),
48462306a36Sopenharmony_ci	PINCTRL_PIN(315, "V10 GMAC1 TXD3"),
48562306a36Sopenharmony_ci	PINCTRL_PIN(316, "V11 GMAC1 TXEN"),
48662306a36Sopenharmony_ci	PINCTRL_PIN(317, "V12 GMAC1 RXD2"),
48762306a36Sopenharmony_ci	PINCTRL_PIN(318, "V13 M30 CLK"),
48862306a36Sopenharmony_ci	PINCTRL_PIN(319, "V14 GPIO1 29"),
48962306a36Sopenharmony_ci	PINCTRL_PIN(320, "V15 GPIO0 1"),
49062306a36Sopenharmony_ci	PINCTRL_PIN(321, "V16 GPIO0 6"),
49162306a36Sopenharmony_ci	PINCTRL_PIN(322, "V17 GPIO0 10"),
49262306a36Sopenharmony_ci	PINCTRL_PIN(323, "V18 SYS RESET N"),
49362306a36Sopenharmony_ci};
49462306a36Sopenharmony_ci
49562306a36Sopenharmony_ci
49662306a36Sopenharmony_ci/* Digital ground */
49762306a36Sopenharmony_cistatic const unsigned int gnd_3512_pins[] = {
49862306a36Sopenharmony_ci	76, 85, 95, 102, 114, 119, 133, 134, 135, 136, 151, 152, 153, 154, 169,
49962306a36Sopenharmony_ci	170, 171, 172, 187, 188, 189, 190, 204, 209, 221, 228, 238, 247
50062306a36Sopenharmony_ci};
50162306a36Sopenharmony_ci
50262306a36Sopenharmony_cistatic const unsigned int dram_3512_pins[] = {
50362306a36Sopenharmony_ci	2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 21, 22, 23, 24, 25, 26, 27, 28, 29,
50462306a36Sopenharmony_ci	30, 40, 41, 42, 43, 44, 45, 46, 47, 58, 59, 60, 61, 62, 63, 64, 65, 77,
50562306a36Sopenharmony_ci	78, 79, 80, 81, 82
50662306a36Sopenharmony_ci};
50762306a36Sopenharmony_ci
50862306a36Sopenharmony_cistatic const unsigned int rtc_3512_pins[] = { 57, 20, 39 };
50962306a36Sopenharmony_ci
51062306a36Sopenharmony_cistatic const unsigned int power_3512_pins[] = { 19, 38, 36, 55, 37, 56, 54, 72 };
51162306a36Sopenharmony_ci
51262306a36Sopenharmony_cistatic const unsigned int system_3512_pins[] = {
51362306a36Sopenharmony_ci	318, 264, 300, 245, 263, 282, 314, 323, 49,
51462306a36Sopenharmony_ci};
51562306a36Sopenharmony_ci
51662306a36Sopenharmony_cistatic const unsigned int vcontrol_3512_pins[] = { 18, 0, 1 };
51762306a36Sopenharmony_ci
51862306a36Sopenharmony_cistatic const unsigned int ice_3512_pins[] = { 256, 270, 271, 272, 273, 274, 288 };
51962306a36Sopenharmony_ci
52062306a36Sopenharmony_cistatic const unsigned int ide_3512_pins[] = {
52162306a36Sopenharmony_ci	162, 163, 165, 166, 148, 180, 181, 182, 183, 184, 198, 199, 200, 201, 202,
52262306a36Sopenharmony_ci	216, 217, 218, 219, 220, 234, 235, 236, 237, 252, 253, 254, 255
52362306a36Sopenharmony_ci};
52462306a36Sopenharmony_ci
52562306a36Sopenharmony_cistatic const unsigned int sata_3512_pins[] = {
52662306a36Sopenharmony_ci	75, 74, 73, 93, 94, 131, 112, 130, 92, 91, 90, 111, 110, 109, 108, 129,
52762306a36Sopenharmony_ci	128, 127, 126, 147, 146, 145, 144, 164
52862306a36Sopenharmony_ci};
52962306a36Sopenharmony_ci
53062306a36Sopenharmony_cistatic const unsigned int usb_3512_pins[] = {
53162306a36Sopenharmony_ci	306, 289, 307, 290, 239, 257, 275, 308, 291, 309, 292, 310, 293
53262306a36Sopenharmony_ci};
53362306a36Sopenharmony_ci
53462306a36Sopenharmony_ci/* GMII, ethernet pins */
53562306a36Sopenharmony_cistatic const unsigned int gmii_gmac0_3512_pins[] = {
53662306a36Sopenharmony_ci	240, 241, 242, 258, 259, 260, 276, 277, 278, 294, 295, 311, 312, 313
53762306a36Sopenharmony_ci};
53862306a36Sopenharmony_ci
53962306a36Sopenharmony_cistatic const unsigned int gmii_gmac1_3512_pins[] = {
54062306a36Sopenharmony_ci	243, 244, 261, 262, 279, 280, 281, 296, 297, 298, 299, 315, 316, 317
54162306a36Sopenharmony_ci};
54262306a36Sopenharmony_ci
54362306a36Sopenharmony_cistatic const unsigned int pci_3512_pins[] = {
54462306a36Sopenharmony_ci	13, 14, 15, 16, 17, 31, 32, 33, 34, 35, 48, 50, 51, 52, 53, 66, 67, 68, 69,
54562306a36Sopenharmony_ci	70, 71, 83, 84, 86, 87, 88, 89, 103, 104, 105, 106, 107, 121, 122, 123,
54662306a36Sopenharmony_ci	124, 125, 139, 140, 141, 142, 143, 157, 158, 159, 160, 161, 175, 176, 177,
54762306a36Sopenharmony_ci	178, 179, 195, 196, 197
54862306a36Sopenharmony_ci};
54962306a36Sopenharmony_ci
55062306a36Sopenharmony_ci/*
55162306a36Sopenharmony_ci * Apparently the LPC interface is using the PCICLK for the clocking so
55262306a36Sopenharmony_ci * PCI needs to be active at the same time.
55362306a36Sopenharmony_ci */
55462306a36Sopenharmony_cistatic const unsigned int lpc_3512_pins[] = {
55562306a36Sopenharmony_ci	285, /* LPC_LAD[0] */
55662306a36Sopenharmony_ci	304, /* LPC_SERIRQ */
55762306a36Sopenharmony_ci	286, /* LPC_LAD[2] */
55862306a36Sopenharmony_ci	305, /* LPC_LFRAME# */
55962306a36Sopenharmony_ci	287, /* LPC_LAD[3] */
56062306a36Sopenharmony_ci	268, /* LPC_LAD[1] */
56162306a36Sopenharmony_ci};
56262306a36Sopenharmony_ci
56362306a36Sopenharmony_ci/* Character LCD */
56462306a36Sopenharmony_cistatic const unsigned int lcd_3512_pins[] = {
56562306a36Sopenharmony_ci	262, 244, 317, 299, 246, 319, 301, 283, 269, 233, 211
56662306a36Sopenharmony_ci};
56762306a36Sopenharmony_ci
56862306a36Sopenharmony_cistatic const unsigned int ssp_3512_pins[] = {
56962306a36Sopenharmony_ci	285, /* SSP_97RST# SSP AC97 Reset, active low */
57062306a36Sopenharmony_ci	304, /* SSP_FSC */
57162306a36Sopenharmony_ci	286, /* SSP_ECLK */
57262306a36Sopenharmony_ci	305, /* SSP_TXD */
57362306a36Sopenharmony_ci	287, /* SSP_RXD */
57462306a36Sopenharmony_ci	268, /* SSP_SCLK */
57562306a36Sopenharmony_ci};
57662306a36Sopenharmony_ci
57762306a36Sopenharmony_cistatic const unsigned int uart_rxtx_3512_pins[] = {
57862306a36Sopenharmony_ci	267, /* UART_SIN serial input, RX */
57962306a36Sopenharmony_ci	322, /* UART_SOUT serial output, TX */
58062306a36Sopenharmony_ci};
58162306a36Sopenharmony_ci
58262306a36Sopenharmony_cistatic const unsigned int uart_modem_3512_pins[] = {
58362306a36Sopenharmony_ci	285, /* UART_NDCD DCD carrier detect */
58462306a36Sopenharmony_ci	304, /* UART_NDTR DTR data terminal ready */
58562306a36Sopenharmony_ci	286, /* UART_NDSR DSR data set ready */
58662306a36Sopenharmony_ci	305, /* UART_NRTS RTS request to send */
58762306a36Sopenharmony_ci	287, /* UART_NCTS CTS clear to send */
58862306a36Sopenharmony_ci	268, /* UART_NRI RI ring indicator */
58962306a36Sopenharmony_ci};
59062306a36Sopenharmony_ci
59162306a36Sopenharmony_cistatic const unsigned int tvc_3512_pins[] = {
59262306a36Sopenharmony_ci	246, /* TVC_DATA[0] */
59362306a36Sopenharmony_ci	319, /* TVC_DATA[1] */
59462306a36Sopenharmony_ci	301, /* TVC_DATA[2] */
59562306a36Sopenharmony_ci	283, /* TVC_DATA[3] */
59662306a36Sopenharmony_ci	320, /* TVC_DATA[4] */
59762306a36Sopenharmony_ci	302, /* TVC_DATA[5] */
59862306a36Sopenharmony_ci	284, /* TVC_DATA[6] */
59962306a36Sopenharmony_ci	266, /* TVC_DATA[7] */
60062306a36Sopenharmony_ci};
60162306a36Sopenharmony_ci
60262306a36Sopenharmony_cistatic const unsigned int tvc_clk_3512_pins[] = {
60362306a36Sopenharmony_ci	265, /* TVC_CLK */
60462306a36Sopenharmony_ci};
60562306a36Sopenharmony_ci
60662306a36Sopenharmony_ci/* NAND flash pins */
60762306a36Sopenharmony_cistatic const unsigned int nflash_3512_pins[] = {
60862306a36Sopenharmony_ci	199, 200, 201, 202, 216, 217, 218, 219, 220, 234, 235, 236, 237, 252,
60962306a36Sopenharmony_ci	253, 254, 249, 250, 232, 233, 211, 193, 194
61062306a36Sopenharmony_ci};
61162306a36Sopenharmony_ci
61262306a36Sopenharmony_ci/* Parallel (NOR) flash pins, D[0-15], A[16-25], CE0, CE1, RB, WE, OE, ALE */
61362306a36Sopenharmony_cistatic const unsigned int pflash_3512_pins[] = {
61462306a36Sopenharmony_ci	162, 163, 165, 166, 148, 199, 200, 201, 202, 216, 217, 218, 219, 220,
61562306a36Sopenharmony_ci	234, 235, 236, 237, 252, 253, 254, 251, 229, 232, 233, 211, 212, 213,
61662306a36Sopenharmony_ci	214, 215, 193, 194
61762306a36Sopenharmony_ci};
61862306a36Sopenharmony_ci
61962306a36Sopenharmony_ci/*
62062306a36Sopenharmony_ci * The parallel flash can be set up in a 26-bit address bus mode exposing
62162306a36Sopenharmony_ci * A[0-15] (A[15] takes the place of ALE), but it has the
62262306a36Sopenharmony_ci * side effect of stealing pins from GMAC1 and TVC so these blocks cannot be
62362306a36Sopenharmony_ci * used at the same time.
62462306a36Sopenharmony_ci */
62562306a36Sopenharmony_cistatic const unsigned int pflash_3512_pins_extended[] = {
62662306a36Sopenharmony_ci	162, 163, 165, 166, 148, 199, 200, 201, 202, 216, 217, 218, 219, 220,
62762306a36Sopenharmony_ci	234, 235, 236, 237, 252, 253, 254, 251, 229, 232, 233, 211, 212, 213,
62862306a36Sopenharmony_ci	214, 215, 193, 194,
62962306a36Sopenharmony_ci	/* The extra pins */
63062306a36Sopenharmony_ci	296, 315, 297, 279, 261, 243, 316, 298, 280, 262, 244, 317, 299, 281,
63162306a36Sopenharmony_ci	265,
63262306a36Sopenharmony_ci};
63362306a36Sopenharmony_ci
63462306a36Sopenharmony_ci/* Serial flash pins CE0, CE1, DI, DO, CK */
63562306a36Sopenharmony_cistatic const unsigned int sflash_3512_pins[] = { 230, 231, 232, 233, 211 };
63662306a36Sopenharmony_ci
63762306a36Sopenharmony_ci/* The GPIO0A (0) pin overlap with TVC CLK and extended parallel flash */
63862306a36Sopenharmony_cistatic const unsigned int gpio0a_3512_pins[] = { 265 };
63962306a36Sopenharmony_ci
64062306a36Sopenharmony_ci/* The GPIO0B (1-4) pins overlap with TVC and ICE */
64162306a36Sopenharmony_cistatic const unsigned int gpio0b_3512_pins[] = { 320, 302, 284, 266 };
64262306a36Sopenharmony_ci
64362306a36Sopenharmony_ci/* The GPIO0C (5-7) pins overlap with ICE */
64462306a36Sopenharmony_cistatic const unsigned int gpio0c_3512_pins[] = { 248, 321, 303 };
64562306a36Sopenharmony_ci
64662306a36Sopenharmony_ci/* The GPIO0D (9,10) pins overlap with UART RX/TX */
64762306a36Sopenharmony_cistatic const unsigned int gpio0d_3512_pins[] = { 267, 322 };
64862306a36Sopenharmony_ci
64962306a36Sopenharmony_ci/* The GPIO0E (8,11-15) pins overlap with LPC, UART modem pins, SSP */
65062306a36Sopenharmony_cistatic const unsigned int gpio0e_3512_pins[] = { 285, 304, 286, 305, 287, 268 };
65162306a36Sopenharmony_ci
65262306a36Sopenharmony_ci/* The GPIO0F (16) pins overlap with LCD */
65362306a36Sopenharmony_cistatic const unsigned int gpio0f_3512_pins[] = { 269 };
65462306a36Sopenharmony_ci
65562306a36Sopenharmony_ci/* The GPIO0G (17,18) pins overlap with NAND flash CE0, CE1 */
65662306a36Sopenharmony_cistatic const unsigned int gpio0g_3512_pins[] = { 249, 250 };
65762306a36Sopenharmony_ci
65862306a36Sopenharmony_ci/* The GPIO0H (19,20) pins overlap with parallel flash CE0, CE1 */
65962306a36Sopenharmony_cistatic const unsigned int gpio0h_3512_pins[] = { 251, 229 };
66062306a36Sopenharmony_ci
66162306a36Sopenharmony_ci/* The GPIO0I (21,22) pins overlap with serial flash CE0, CE1 */
66262306a36Sopenharmony_cistatic const unsigned int gpio0i_3512_pins[] = { 230, 231 };
66362306a36Sopenharmony_ci
66462306a36Sopenharmony_ci/* The GPIO0J (23) pins overlap with all flash */
66562306a36Sopenharmony_cistatic const unsigned int gpio0j_3512_pins[] = { 232 };
66662306a36Sopenharmony_ci
66762306a36Sopenharmony_ci/* The GPIO0K (24,25) pins overlap with all flash and LCD */
66862306a36Sopenharmony_cistatic const unsigned int gpio0k_3512_pins[] = { 233, 211 };
66962306a36Sopenharmony_ci
67062306a36Sopenharmony_ci/* The GPIO0L (26-29) pins overlap with parallel flash */
67162306a36Sopenharmony_cistatic const unsigned int gpio0l_3512_pins[] = { 212, 213, 214, 215 };
67262306a36Sopenharmony_ci
67362306a36Sopenharmony_ci/* The GPIO0M (30,31) pins overlap with parallel flash and NAND flash */
67462306a36Sopenharmony_cistatic const unsigned int gpio0m_3512_pins[] = { 193, 194 };
67562306a36Sopenharmony_ci
67662306a36Sopenharmony_ci/* The GPIO1A (0-4) pins that overlap with IDE and parallel flash */
67762306a36Sopenharmony_cistatic const unsigned int gpio1a_3512_pins[] = { 162, 163, 165, 166, 148 };
67862306a36Sopenharmony_ci
67962306a36Sopenharmony_ci/* The GPIO1B (5-10, 27) pins overlap with just IDE */
68062306a36Sopenharmony_cistatic const unsigned int gpio1b_3512_pins[] = {
68162306a36Sopenharmony_ci	180, 181, 182, 183, 184, 198, 255
68262306a36Sopenharmony_ci};
68362306a36Sopenharmony_ci
68462306a36Sopenharmony_ci/* The GPIO1C (11-26) pins overlap with IDE, parallel flash and NAND flash */
68562306a36Sopenharmony_cistatic const unsigned int gpio1c_3512_pins[] = {
68662306a36Sopenharmony_ci	199, 200, 201, 202, 216, 217, 218, 219, 220, 234, 235, 236, 237,
68762306a36Sopenharmony_ci	252, 253, 254
68862306a36Sopenharmony_ci};
68962306a36Sopenharmony_ci
69062306a36Sopenharmony_ci/* The GPIO1D (28-31) pins overlap with LCD and TVC */
69162306a36Sopenharmony_cistatic const unsigned int gpio1d_3512_pins[] = { 246, 319, 301, 283 };
69262306a36Sopenharmony_ci
69362306a36Sopenharmony_ci/* The GPIO2A (0-3) pins overlap with GMII GMAC1 and extended parallel flash */
69462306a36Sopenharmony_cistatic const unsigned int gpio2a_3512_pins[] = { 315, 297, 279, 261 };
69562306a36Sopenharmony_ci
69662306a36Sopenharmony_ci/* The GPIO2B (4-7) pins overlap with GMII GMAC1, extended parallel flash and LCD */
69762306a36Sopenharmony_cistatic const unsigned int gpio2b_3512_pins[] = { 262, 244, 317, 299 };
69862306a36Sopenharmony_ci
69962306a36Sopenharmony_ci/* The GPIO2C (8-31) pins overlap with PCI */
70062306a36Sopenharmony_cistatic const unsigned int gpio2c_3512_pins[] = {
70162306a36Sopenharmony_ci	17, 34, 35, 51, 52, 53, 68, 69, 71, 86, 87, 88, 89, 103, 104, 105,
70262306a36Sopenharmony_ci	140, 141, 142, 143, 157, 158, 159, 160
70362306a36Sopenharmony_ci};
70462306a36Sopenharmony_ci
70562306a36Sopenharmony_ci/* Groups for the 3512 SoC/package */
70662306a36Sopenharmony_cistatic const struct gemini_pin_group gemini_3512_pin_groups[] = {
70762306a36Sopenharmony_ci	{
70862306a36Sopenharmony_ci		.name = "gndgrp",
70962306a36Sopenharmony_ci		.pins = gnd_3512_pins,
71062306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gnd_3512_pins),
71162306a36Sopenharmony_ci	},
71262306a36Sopenharmony_ci	{
71362306a36Sopenharmony_ci		.name = "dramgrp",
71462306a36Sopenharmony_ci		.pins = dram_3512_pins,
71562306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(dram_3512_pins),
71662306a36Sopenharmony_ci		.mask = DRAM_PADS_POWERDOWN,
71762306a36Sopenharmony_ci	},
71862306a36Sopenharmony_ci	{
71962306a36Sopenharmony_ci		.name = "rtcgrp",
72062306a36Sopenharmony_ci		.pins = rtc_3512_pins,
72162306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(rtc_3512_pins),
72262306a36Sopenharmony_ci	},
72362306a36Sopenharmony_ci	{
72462306a36Sopenharmony_ci		.name = "powergrp",
72562306a36Sopenharmony_ci		.pins = power_3512_pins,
72662306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(power_3512_pins),
72762306a36Sopenharmony_ci	},
72862306a36Sopenharmony_ci	{
72962306a36Sopenharmony_ci		.name = "systemgrp",
73062306a36Sopenharmony_ci		.pins = system_3512_pins,
73162306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(system_3512_pins),
73262306a36Sopenharmony_ci	},
73362306a36Sopenharmony_ci	{
73462306a36Sopenharmony_ci		.name = "vcontrolgrp",
73562306a36Sopenharmony_ci		.pins = vcontrol_3512_pins,
73662306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(vcontrol_3512_pins),
73762306a36Sopenharmony_ci	},
73862306a36Sopenharmony_ci	{
73962306a36Sopenharmony_ci		.name = "icegrp",
74062306a36Sopenharmony_ci		.pins = ice_3512_pins,
74162306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(ice_3512_pins),
74262306a36Sopenharmony_ci		/* Conflict with some GPIO groups */
74362306a36Sopenharmony_ci	},
74462306a36Sopenharmony_ci	{
74562306a36Sopenharmony_ci		.name = "idegrp",
74662306a36Sopenharmony_ci		.pins = ide_3512_pins,
74762306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(ide_3512_pins),
74862306a36Sopenharmony_ci		/* Conflict with all flash usage */
74962306a36Sopenharmony_ci		.value = IDE_PADS_ENABLE | NAND_PADS_DISABLE |
75062306a36Sopenharmony_ci			PFLASH_PADS_DISABLE | SFLASH_PADS_DISABLE,
75162306a36Sopenharmony_ci		.driving_mask = GENMASK(21, 20),
75262306a36Sopenharmony_ci	},
75362306a36Sopenharmony_ci	{
75462306a36Sopenharmony_ci		.name = "satagrp",
75562306a36Sopenharmony_ci		.pins = sata_3512_pins,
75662306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(sata_3512_pins),
75762306a36Sopenharmony_ci	},
75862306a36Sopenharmony_ci	{
75962306a36Sopenharmony_ci		.name = "usbgrp",
76062306a36Sopenharmony_ci		.pins = usb_3512_pins,
76162306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(usb_3512_pins),
76262306a36Sopenharmony_ci	},
76362306a36Sopenharmony_ci	{
76462306a36Sopenharmony_ci		.name = "gmii_gmac0_grp",
76562306a36Sopenharmony_ci		.pins = gmii_gmac0_3512_pins,
76662306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gmii_gmac0_3512_pins),
76762306a36Sopenharmony_ci		.driving_mask = GENMASK(17, 16),
76862306a36Sopenharmony_ci	},
76962306a36Sopenharmony_ci	{
77062306a36Sopenharmony_ci		.name = "gmii_gmac1_grp",
77162306a36Sopenharmony_ci		.pins = gmii_gmac1_3512_pins,
77262306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gmii_gmac1_3512_pins),
77362306a36Sopenharmony_ci		/* Bring out RGMII on the GMAC1 pins */
77462306a36Sopenharmony_ci		.value = GEMINI_GMAC_IOSEL_GMAC0_GMAC1_RGMII,
77562306a36Sopenharmony_ci		.driving_mask = GENMASK(19, 18),
77662306a36Sopenharmony_ci	},
77762306a36Sopenharmony_ci	{
77862306a36Sopenharmony_ci		.name = "pcigrp",
77962306a36Sopenharmony_ci		.pins = pci_3512_pins,
78062306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(pci_3512_pins),
78162306a36Sopenharmony_ci		/* Conflict only with GPIO2 */
78262306a36Sopenharmony_ci		.value = PCI_PADS_ENABLE | PCI_CLK_PAD_ENABLE,
78362306a36Sopenharmony_ci		.driving_mask = GENMASK(23, 22),
78462306a36Sopenharmony_ci	},
78562306a36Sopenharmony_ci	{
78662306a36Sopenharmony_ci		.name = "lpcgrp",
78762306a36Sopenharmony_ci		.pins = lpc_3512_pins,
78862306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(lpc_3512_pins),
78962306a36Sopenharmony_ci		/* Conflict with SSP and UART modem pins */
79062306a36Sopenharmony_ci		.mask = SSP_PADS_ENABLE,
79162306a36Sopenharmony_ci		.value = LPC_PADS_ENABLE | LPC_CLK_PAD_ENABLE,
79262306a36Sopenharmony_ci	},
79362306a36Sopenharmony_ci	{
79462306a36Sopenharmony_ci		.name = "lcdgrp",
79562306a36Sopenharmony_ci		.pins = lcd_3512_pins,
79662306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(lcd_3512_pins),
79762306a36Sopenharmony_ci		/* Conflict with TVC and ICE */
79862306a36Sopenharmony_ci		.mask = TVC_PADS_ENABLE,
79962306a36Sopenharmony_ci		.value = LCD_PADS_ENABLE,
80062306a36Sopenharmony_ci	},
80162306a36Sopenharmony_ci	{
80262306a36Sopenharmony_ci		.name = "sspgrp",
80362306a36Sopenharmony_ci		.pins = ssp_3512_pins,
80462306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(ssp_3512_pins),
80562306a36Sopenharmony_ci		/* Conflict with LPC and UART modem pins */
80662306a36Sopenharmony_ci		.mask = LPC_PADS_ENABLE,
80762306a36Sopenharmony_ci		.value = SSP_PADS_ENABLE,
80862306a36Sopenharmony_ci	},
80962306a36Sopenharmony_ci	{
81062306a36Sopenharmony_ci		.name = "uartrxtxgrp",
81162306a36Sopenharmony_ci		.pins = uart_rxtx_3512_pins,
81262306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(uart_rxtx_3512_pins),
81362306a36Sopenharmony_ci		/* No conflicts except GPIO */
81462306a36Sopenharmony_ci	},
81562306a36Sopenharmony_ci	{
81662306a36Sopenharmony_ci		.name = "uartmodemgrp",
81762306a36Sopenharmony_ci		.pins = uart_modem_3512_pins,
81862306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(uart_modem_3512_pins),
81962306a36Sopenharmony_ci		/*
82062306a36Sopenharmony_ci		 * Conflict with LPC and SSP,
82162306a36Sopenharmony_ci		 * so when those are both disabled, modem UART can thrive.
82262306a36Sopenharmony_ci		 */
82362306a36Sopenharmony_ci		.mask = LPC_PADS_ENABLE | SSP_PADS_ENABLE,
82462306a36Sopenharmony_ci	},
82562306a36Sopenharmony_ci	{
82662306a36Sopenharmony_ci		.name = "tvcgrp",
82762306a36Sopenharmony_ci		.pins = tvc_3512_pins,
82862306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(tvc_3512_pins),
82962306a36Sopenharmony_ci		/* Conflict with character LCD and ICE */
83062306a36Sopenharmony_ci		.mask = LCD_PADS_ENABLE,
83162306a36Sopenharmony_ci		.value = TVC_PADS_ENABLE,
83262306a36Sopenharmony_ci	},
83362306a36Sopenharmony_ci	{
83462306a36Sopenharmony_ci		.name = "tvcclkgrp",
83562306a36Sopenharmony_ci		.pins = tvc_clk_3512_pins,
83662306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(tvc_clk_3512_pins),
83762306a36Sopenharmony_ci		.value = TVC_CLK_PAD_ENABLE,
83862306a36Sopenharmony_ci	},
83962306a36Sopenharmony_ci	/*
84062306a36Sopenharmony_ci	 * The construction is done such that it is possible to use a serial
84162306a36Sopenharmony_ci	 * flash together with a NAND or parallel (NOR) flash, but it is not
84262306a36Sopenharmony_ci	 * possible to use NAND and parallel flash together. To use serial
84362306a36Sopenharmony_ci	 * flash with one of the two others, the muxbits need to be flipped
84462306a36Sopenharmony_ci	 * around before any access.
84562306a36Sopenharmony_ci	 */
84662306a36Sopenharmony_ci	{
84762306a36Sopenharmony_ci		.name = "nflashgrp",
84862306a36Sopenharmony_ci		.pins = nflash_3512_pins,
84962306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(nflash_3512_pins),
85062306a36Sopenharmony_ci		/* Conflict with IDE, parallel and serial flash */
85162306a36Sopenharmony_ci		.mask = NAND_PADS_DISABLE | IDE_PADS_ENABLE,
85262306a36Sopenharmony_ci		.value = PFLASH_PADS_DISABLE | SFLASH_PADS_DISABLE,
85362306a36Sopenharmony_ci	},
85462306a36Sopenharmony_ci	{
85562306a36Sopenharmony_ci		.name = "pflashgrp",
85662306a36Sopenharmony_ci		.pins = pflash_3512_pins,
85762306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(pflash_3512_pins),
85862306a36Sopenharmony_ci		/* Conflict with IDE, NAND and serial flash */
85962306a36Sopenharmony_ci		.mask = PFLASH_PADS_DISABLE | IDE_PADS_ENABLE,
86062306a36Sopenharmony_ci		.value = NAND_PADS_DISABLE | SFLASH_PADS_DISABLE,
86162306a36Sopenharmony_ci	},
86262306a36Sopenharmony_ci	{
86362306a36Sopenharmony_ci		.name = "sflashgrp",
86462306a36Sopenharmony_ci		.pins = sflash_3512_pins,
86562306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(sflash_3512_pins),
86662306a36Sopenharmony_ci		/* Conflict with IDE, NAND and parallel flash */
86762306a36Sopenharmony_ci		.mask = SFLASH_PADS_DISABLE | IDE_PADS_ENABLE,
86862306a36Sopenharmony_ci		.value = NAND_PADS_DISABLE | PFLASH_PADS_DISABLE,
86962306a36Sopenharmony_ci	},
87062306a36Sopenharmony_ci	{
87162306a36Sopenharmony_ci		.name = "gpio0agrp",
87262306a36Sopenharmony_ci		.pins = gpio0a_3512_pins,
87362306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0a_3512_pins),
87462306a36Sopenharmony_ci		/* Conflict with TVC CLK */
87562306a36Sopenharmony_ci		.mask = TVC_CLK_PAD_ENABLE,
87662306a36Sopenharmony_ci	},
87762306a36Sopenharmony_ci	{
87862306a36Sopenharmony_ci		.name = "gpio0bgrp",
87962306a36Sopenharmony_ci		.pins = gpio0b_3512_pins,
88062306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0b_3512_pins),
88162306a36Sopenharmony_ci		/* Conflict with TVC and ICE */
88262306a36Sopenharmony_ci		.mask = TVC_PADS_ENABLE,
88362306a36Sopenharmony_ci	},
88462306a36Sopenharmony_ci	{
88562306a36Sopenharmony_ci		.name = "gpio0cgrp",
88662306a36Sopenharmony_ci		.pins = gpio0c_3512_pins,
88762306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0c_3512_pins),
88862306a36Sopenharmony_ci		/* Conflict with ICE */
88962306a36Sopenharmony_ci	},
89062306a36Sopenharmony_ci	{
89162306a36Sopenharmony_ci		.name = "gpio0dgrp",
89262306a36Sopenharmony_ci		.pins = gpio0d_3512_pins,
89362306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0d_3512_pins),
89462306a36Sopenharmony_ci		/* Conflict with UART RX/TX */
89562306a36Sopenharmony_ci	},
89662306a36Sopenharmony_ci	{
89762306a36Sopenharmony_ci		.name = "gpio0egrp",
89862306a36Sopenharmony_ci		.pins = gpio0e_3512_pins,
89962306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0e_3512_pins),
90062306a36Sopenharmony_ci		/* Conflict with LPC, UART modem pins, SSP */
90162306a36Sopenharmony_ci		.mask = LPC_PADS_ENABLE | SSP_PADS_ENABLE,
90262306a36Sopenharmony_ci	},
90362306a36Sopenharmony_ci	{
90462306a36Sopenharmony_ci		.name = "gpio0fgrp",
90562306a36Sopenharmony_ci		.pins = gpio0f_3512_pins,
90662306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0f_3512_pins),
90762306a36Sopenharmony_ci		/* Conflict with LCD */
90862306a36Sopenharmony_ci		.mask = LCD_PADS_ENABLE,
90962306a36Sopenharmony_ci	},
91062306a36Sopenharmony_ci	{
91162306a36Sopenharmony_ci		.name = "gpio0ggrp",
91262306a36Sopenharmony_ci		.pins = gpio0g_3512_pins,
91362306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0g_3512_pins),
91462306a36Sopenharmony_ci		/* Conflict with NAND flash */
91562306a36Sopenharmony_ci		.value = NAND_PADS_DISABLE,
91662306a36Sopenharmony_ci	},
91762306a36Sopenharmony_ci	{
91862306a36Sopenharmony_ci		.name = "gpio0hgrp",
91962306a36Sopenharmony_ci		.pins = gpio0h_3512_pins,
92062306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0h_3512_pins),
92162306a36Sopenharmony_ci		/* Conflict with parallel flash */
92262306a36Sopenharmony_ci		.value = PFLASH_PADS_DISABLE,
92362306a36Sopenharmony_ci	},
92462306a36Sopenharmony_ci	{
92562306a36Sopenharmony_ci		.name = "gpio0igrp",
92662306a36Sopenharmony_ci		.pins = gpio0i_3512_pins,
92762306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0i_3512_pins),
92862306a36Sopenharmony_ci		/* Conflict with serial flash */
92962306a36Sopenharmony_ci		.value = SFLASH_PADS_DISABLE,
93062306a36Sopenharmony_ci	},
93162306a36Sopenharmony_ci	{
93262306a36Sopenharmony_ci		.name = "gpio0jgrp",
93362306a36Sopenharmony_ci		.pins = gpio0j_3512_pins,
93462306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0j_3512_pins),
93562306a36Sopenharmony_ci		/* Conflict with all flash */
93662306a36Sopenharmony_ci		.value = PFLASH_PADS_DISABLE | NAND_PADS_DISABLE |
93762306a36Sopenharmony_ci			SFLASH_PADS_DISABLE,
93862306a36Sopenharmony_ci	},
93962306a36Sopenharmony_ci	{
94062306a36Sopenharmony_ci		.name = "gpio0kgrp",
94162306a36Sopenharmony_ci		.pins = gpio0k_3512_pins,
94262306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0k_3512_pins),
94362306a36Sopenharmony_ci		/* Conflict with all flash and LCD */
94462306a36Sopenharmony_ci		.mask = LCD_PADS_ENABLE,
94562306a36Sopenharmony_ci		.value = PFLASH_PADS_DISABLE | NAND_PADS_DISABLE |
94662306a36Sopenharmony_ci			SFLASH_PADS_DISABLE,
94762306a36Sopenharmony_ci	},
94862306a36Sopenharmony_ci	{
94962306a36Sopenharmony_ci		.name = "gpio0lgrp",
95062306a36Sopenharmony_ci		.pins = gpio0l_3512_pins,
95162306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0l_3512_pins),
95262306a36Sopenharmony_ci		/* Conflict with parallel flash */
95362306a36Sopenharmony_ci		.value = PFLASH_PADS_DISABLE,
95462306a36Sopenharmony_ci	},
95562306a36Sopenharmony_ci	{
95662306a36Sopenharmony_ci		.name = "gpio0mgrp",
95762306a36Sopenharmony_ci		.pins = gpio0m_3512_pins,
95862306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0m_3512_pins),
95962306a36Sopenharmony_ci		/* Conflict with parallel and NAND flash */
96062306a36Sopenharmony_ci		.value = PFLASH_PADS_DISABLE | NAND_PADS_DISABLE,
96162306a36Sopenharmony_ci	},
96262306a36Sopenharmony_ci	{
96362306a36Sopenharmony_ci		.name = "gpio1agrp",
96462306a36Sopenharmony_ci		.pins = gpio1a_3512_pins,
96562306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio1a_3512_pins),
96662306a36Sopenharmony_ci		/* Conflict with IDE and parallel flash */
96762306a36Sopenharmony_ci		.mask = IDE_PADS_ENABLE,
96862306a36Sopenharmony_ci		.value = PFLASH_PADS_DISABLE,
96962306a36Sopenharmony_ci	},
97062306a36Sopenharmony_ci	{
97162306a36Sopenharmony_ci		.name = "gpio1bgrp",
97262306a36Sopenharmony_ci		.pins = gpio1b_3512_pins,
97362306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio1b_3512_pins),
97462306a36Sopenharmony_ci		/* Conflict with IDE only */
97562306a36Sopenharmony_ci		.mask = IDE_PADS_ENABLE,
97662306a36Sopenharmony_ci	},
97762306a36Sopenharmony_ci	{
97862306a36Sopenharmony_ci		.name = "gpio1cgrp",
97962306a36Sopenharmony_ci		.pins = gpio1c_3512_pins,
98062306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio1c_3512_pins),
98162306a36Sopenharmony_ci		/* Conflict with IDE, parallel and NAND flash */
98262306a36Sopenharmony_ci		.mask = IDE_PADS_ENABLE,
98362306a36Sopenharmony_ci		.value = NAND_PADS_DISABLE | PFLASH_PADS_DISABLE,
98462306a36Sopenharmony_ci	},
98562306a36Sopenharmony_ci	{
98662306a36Sopenharmony_ci		.name = "gpio1dgrp",
98762306a36Sopenharmony_ci		.pins = gpio1d_3512_pins,
98862306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio1d_3512_pins),
98962306a36Sopenharmony_ci		/* Conflict with LCD and TVC */
99062306a36Sopenharmony_ci		.mask = LCD_PADS_ENABLE | TVC_PADS_ENABLE,
99162306a36Sopenharmony_ci	},
99262306a36Sopenharmony_ci	{
99362306a36Sopenharmony_ci		.name = "gpio2agrp",
99462306a36Sopenharmony_ci		.pins = gpio2a_3512_pins,
99562306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio2a_3512_pins),
99662306a36Sopenharmony_ci		.mask = GEMINI_GMAC_IOSEL_GMAC0_GMAC1_RGMII,
99762306a36Sopenharmony_ci		/* Conflict with GMII GMAC1 and extended parallel flash */
99862306a36Sopenharmony_ci	},
99962306a36Sopenharmony_ci	{
100062306a36Sopenharmony_ci		.name = "gpio2bgrp",
100162306a36Sopenharmony_ci		.pins = gpio2b_3512_pins,
100262306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio2b_3512_pins),
100362306a36Sopenharmony_ci		/* Conflict with GMII GMAC1, extended parallel flash and LCD */
100462306a36Sopenharmony_ci		.mask = LCD_PADS_ENABLE | GEMINI_GMAC_IOSEL_GMAC0_GMAC1_RGMII,
100562306a36Sopenharmony_ci	},
100662306a36Sopenharmony_ci	{
100762306a36Sopenharmony_ci		.name = "gpio2cgrp",
100862306a36Sopenharmony_ci		.pins = gpio2c_3512_pins,
100962306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio2c_3512_pins),
101062306a36Sopenharmony_ci		/* Conflict with PCI */
101162306a36Sopenharmony_ci		.mask = PCI_PADS_ENABLE,
101262306a36Sopenharmony_ci	},
101362306a36Sopenharmony_ci};
101462306a36Sopenharmony_ci
101562306a36Sopenharmony_ci/* Pin names for the pinmux subsystem, 3516 variant */
101662306a36Sopenharmony_cistatic const struct pinctrl_pin_desc gemini_3516_pins[] = {
101762306a36Sopenharmony_ci	/* Row A */
101862306a36Sopenharmony_ci	PINCTRL_PIN(0, "A1 AVCC3IOHA"),
101962306a36Sopenharmony_ci	PINCTRL_PIN(1, "A2 DRAM CK N"),
102062306a36Sopenharmony_ci	PINCTRL_PIN(2, "A3 DRAM CK"),
102162306a36Sopenharmony_ci	PINCTRL_PIN(3, "A4 DRAM DQM1"),
102262306a36Sopenharmony_ci	PINCTRL_PIN(4, "A5 DRAM DQ9"),
102362306a36Sopenharmony_ci	PINCTRL_PIN(5, "A6 DRAM DQ13"),
102462306a36Sopenharmony_ci	PINCTRL_PIN(6, "A7 DRAM DQ1"),
102562306a36Sopenharmony_ci	PINCTRL_PIN(7, "A8 DRAM DQ2"),
102662306a36Sopenharmony_ci	PINCTRL_PIN(8, "A9 DRAM DQ4"),
102762306a36Sopenharmony_ci	PINCTRL_PIN(9, "A10 DRAM VREF"),
102862306a36Sopenharmony_ci	PINCTRL_PIN(10, "A11 DRAM DQ24"),
102962306a36Sopenharmony_ci	PINCTRL_PIN(11, "A12 DRAM DQ28"),
103062306a36Sopenharmony_ci	PINCTRL_PIN(12, "A13 DRAM DQ30"),
103162306a36Sopenharmony_ci	PINCTRL_PIN(13, "A14 DRAM DQ18"),
103262306a36Sopenharmony_ci	PINCTRL_PIN(14, "A15 DRAM DQ21"),
103362306a36Sopenharmony_ci	PINCTRL_PIN(15, "A16 DRAM CAS_N"),
103462306a36Sopenharmony_ci	PINCTRL_PIN(16, "A17 DRAM BA1"),
103562306a36Sopenharmony_ci	PINCTRL_PIN(17, "A18 PCI INTA N"),
103662306a36Sopenharmony_ci	PINCTRL_PIN(18, "A19 PCI INTB N"),
103762306a36Sopenharmony_ci	PINCTRL_PIN(19, "A20 PCI INTC N"),
103862306a36Sopenharmony_ci	/* Row B */
103962306a36Sopenharmony_ci	PINCTRL_PIN(20, "B1 PWR EN"),
104062306a36Sopenharmony_ci	PINCTRL_PIN(21, "B2 GND"),
104162306a36Sopenharmony_ci	PINCTRL_PIN(22, "B3 RTC CLKO"),
104262306a36Sopenharmony_ci	PINCTRL_PIN(23, "B4 DRAM A5"),
104362306a36Sopenharmony_ci	PINCTRL_PIN(24, "B5 DRAM A6"),
104462306a36Sopenharmony_ci	PINCTRL_PIN(25, "B6 DRAM DQS1"),
104562306a36Sopenharmony_ci	PINCTRL_PIN(26, "B7 DRAM DQ11"),
104662306a36Sopenharmony_ci	PINCTRL_PIN(27, "B8 DRAM DQ0"),
104762306a36Sopenharmony_ci	PINCTRL_PIN(28, "B9 DRAM DQS0"),
104862306a36Sopenharmony_ci	PINCTRL_PIN(29, "B10 DRAM DQ7"),
104962306a36Sopenharmony_ci	PINCTRL_PIN(30, "B11 DRAM DQS3"),
105062306a36Sopenharmony_ci	PINCTRL_PIN(31, "B12 DRAM DQ27"),
105162306a36Sopenharmony_ci	PINCTRL_PIN(32, "B13 DRAM DQ31"),
105262306a36Sopenharmony_ci	PINCTRL_PIN(33, "B14 DRAM DQ20"),
105362306a36Sopenharmony_ci	PINCTRL_PIN(34, "B15 DRAM DQS2"),
105462306a36Sopenharmony_ci	PINCTRL_PIN(35, "B16 DRAM WE N"),
105562306a36Sopenharmony_ci	PINCTRL_PIN(36, "B17 DRAM A10"),
105662306a36Sopenharmony_ci	PINCTRL_PIN(37, "B18 DRAM A2"),
105762306a36Sopenharmony_ci	PINCTRL_PIN(38, "B19 GND"),
105862306a36Sopenharmony_ci	PINCTRL_PIN(39, "B20 PCI GNT0 N"),
105962306a36Sopenharmony_ci	/* Row C */
106062306a36Sopenharmony_ci	PINCTRL_PIN(40, "C1 AGNDIOHA"),
106162306a36Sopenharmony_ci	PINCTRL_PIN(41, "C2 XTALI"),
106262306a36Sopenharmony_ci	PINCTRL_PIN(42, "C3 GND"),
106362306a36Sopenharmony_ci	PINCTRL_PIN(43, "C4 RTC CLKI"),
106462306a36Sopenharmony_ci	PINCTRL_PIN(44, "C5 DRAM A12"),
106562306a36Sopenharmony_ci	PINCTRL_PIN(45, "C6 DRAM A11"),
106662306a36Sopenharmony_ci	PINCTRL_PIN(46, "C7 DRAM DQ8"),
106762306a36Sopenharmony_ci	PINCTRL_PIN(47, "C8 DRAM DQ10"),
106862306a36Sopenharmony_ci	PINCTRL_PIN(48, "C9 DRAM DQ3"),
106962306a36Sopenharmony_ci	PINCTRL_PIN(49, "C10 DRAM DQ6"),
107062306a36Sopenharmony_ci	PINCTRL_PIN(50, "C11 DRAM DQM0"),
107162306a36Sopenharmony_ci	PINCTRL_PIN(51, "C12 DRAM DQ26"),
107262306a36Sopenharmony_ci	PINCTRL_PIN(52, "C13 DRAM DQ16"),
107362306a36Sopenharmony_ci	PINCTRL_PIN(53, "C14 DRAM DQ22"),
107462306a36Sopenharmony_ci	PINCTRL_PIN(54, "C15 DRAM DQM2"),
107562306a36Sopenharmony_ci	PINCTRL_PIN(55, "C16 DRAM BA0"),
107662306a36Sopenharmony_ci	PINCTRL_PIN(56, "C17 DRAM A3"),
107762306a36Sopenharmony_ci	PINCTRL_PIN(57, "C18 GND"),
107862306a36Sopenharmony_ci	PINCTRL_PIN(58, "C19 PCI GNT1 N"),
107962306a36Sopenharmony_ci	PINCTRL_PIN(59, "C20 PCI REQ2 N"),
108062306a36Sopenharmony_ci	/* Row D */
108162306a36Sopenharmony_ci	PINCTRL_PIN(60, "D1 AVCC3IOAHA"),
108262306a36Sopenharmony_ci	PINCTRL_PIN(61, "D2 AVCCKHA"),
108362306a36Sopenharmony_ci	PINCTRL_PIN(62, "D3 XTALO"),
108462306a36Sopenharmony_ci	PINCTRL_PIN(63, "D4 GND"),
108562306a36Sopenharmony_ci	PINCTRL_PIN(64, "D5 CIR RXD"),
108662306a36Sopenharmony_ci	PINCTRL_PIN(65, "D6 DRAM A7"),
108762306a36Sopenharmony_ci	PINCTRL_PIN(66, "D7 DRAM A4"),
108862306a36Sopenharmony_ci	PINCTRL_PIN(67, "D8 DRAM A8"),
108962306a36Sopenharmony_ci	PINCTRL_PIN(68, "D9 DRAM CKE"),
109062306a36Sopenharmony_ci	PINCTRL_PIN(69, "D10 DRAM DQ14"),
109162306a36Sopenharmony_ci	PINCTRL_PIN(70, "D11 DRAM DQ5"),
109262306a36Sopenharmony_ci	PINCTRL_PIN(71, "D12 DRAM DQ25"),
109362306a36Sopenharmony_ci	PINCTRL_PIN(72, "D13 DRAM DQ17"),
109462306a36Sopenharmony_ci	PINCTRL_PIN(73, "D14 DRAM DQ23"),
109562306a36Sopenharmony_ci	PINCTRL_PIN(74, "D15 DRAM RAS N"),
109662306a36Sopenharmony_ci	PINCTRL_PIN(75, "D16 DRAM A1"),
109762306a36Sopenharmony_ci	PINCTRL_PIN(76, "D17 GND"),
109862306a36Sopenharmony_ci	PINCTRL_PIN(77, "D18 EXT RESET N"),
109962306a36Sopenharmony_ci	PINCTRL_PIN(78, "D19 PCI REQ1 N"),
110062306a36Sopenharmony_ci	PINCTRL_PIN(79, "D20 PCI REQ3 N"),
110162306a36Sopenharmony_ci	/* Row E */
110262306a36Sopenharmony_ci	PINCTRL_PIN(80, "E1 VCC2IO CTRL"),
110362306a36Sopenharmony_ci	PINCTRL_PIN(81, "E2 VREF CTRL"),
110462306a36Sopenharmony_ci	PINCTRL_PIN(82, "E3 CIR RST N"),
110562306a36Sopenharmony_ci	PINCTRL_PIN(83, "E4 PWR BTN"),
110662306a36Sopenharmony_ci	PINCTRL_PIN(84, "E5 GND"),
110762306a36Sopenharmony_ci	PINCTRL_PIN(85, "E6 CIR TXD"),
110862306a36Sopenharmony_ci	PINCTRL_PIN(86, "E7 VCCK CTRL"),
110962306a36Sopenharmony_ci	PINCTRL_PIN(87, "E8 DRAM A9"),
111062306a36Sopenharmony_ci	PINCTRL_PIN(88, "E9 DRAM DQ12"),
111162306a36Sopenharmony_ci	PINCTRL_PIN(89, "E10 DRAM DQ15"),
111262306a36Sopenharmony_ci	PINCTRL_PIN(90, "E11 DRAM DQM3"),
111362306a36Sopenharmony_ci	PINCTRL_PIN(91, "E12 DRAM DQ29"),
111462306a36Sopenharmony_ci	PINCTRL_PIN(92, "E13 DRAM DQ19"),
111562306a36Sopenharmony_ci	PINCTRL_PIN(93, "E14 DRAM A13"),
111662306a36Sopenharmony_ci	PINCTRL_PIN(94, "E15 DRAM A0"),
111762306a36Sopenharmony_ci	PINCTRL_PIN(95, "E16 GND"),
111862306a36Sopenharmony_ci	PINCTRL_PIN(96, "E17 PCI INTD N"),
111962306a36Sopenharmony_ci	PINCTRL_PIN(97, "E18 PCI GNT3 N"),
112062306a36Sopenharmony_ci	PINCTRL_PIN(98, "E19 PCI AD29"),
112162306a36Sopenharmony_ci	PINCTRL_PIN(99, "E20 PCI AD28"),
112262306a36Sopenharmony_ci	/* Row F */
112362306a36Sopenharmony_ci	PINCTRL_PIN(100, "F1 AVCCKHB"),
112462306a36Sopenharmony_ci	PINCTRL_PIN(101, "F2 AVCCK P"),
112562306a36Sopenharmony_ci	PINCTRL_PIN(102, "F3 EBG"),
112662306a36Sopenharmony_ci	PINCTRL_PIN(103, "F4 REXT"),
112762306a36Sopenharmony_ci	PINCTRL_PIN(104, "F5 AVCC3IOHB"),
112862306a36Sopenharmony_ci	PINCTRL_PIN(105, "F6 GND"),
112962306a36Sopenharmony_ci	PINCTRL_PIN(106, "F7 VCC2IOHA 2"),
113062306a36Sopenharmony_ci	PINCTRL_PIN(107, "F8 VCC2IOHA 2"),
113162306a36Sopenharmony_ci	PINCTRL_PIN(108, "F9 VCC2IOHA 2"),
113262306a36Sopenharmony_ci	PINCTRL_PIN(109, "F10 V1"),
113362306a36Sopenharmony_ci	PINCTRL_PIN(110, "F11 V1"),
113462306a36Sopenharmony_ci	PINCTRL_PIN(111, "F12 VCC2IOHA 2"),
113562306a36Sopenharmony_ci	PINCTRL_PIN(112, "F13 VCC2IOHA 2"),
113662306a36Sopenharmony_ci	PINCTRL_PIN(113, "F14 VCC2IOHA 2"),
113762306a36Sopenharmony_ci	PINCTRL_PIN(114, "F15 GND"),
113862306a36Sopenharmony_ci	PINCTRL_PIN(115, "F16 PCI CLK"),
113962306a36Sopenharmony_ci	PINCTRL_PIN(116, "F17 PCI GNT2 N"),
114062306a36Sopenharmony_ci	PINCTRL_PIN(117, "F18 PCI AD31"),
114162306a36Sopenharmony_ci	PINCTRL_PIN(118, "F19 PCI AD26"),
114262306a36Sopenharmony_ci	PINCTRL_PIN(119, "F20 PCI CBE3 N"),
114362306a36Sopenharmony_ci	/* Row G */
114462306a36Sopenharmony_ci	PINCTRL_PIN(120, "G1 SATA0 RXDP"),
114562306a36Sopenharmony_ci	PINCTRL_PIN(121, "G2 SATA0 RXDN"),
114662306a36Sopenharmony_ci	PINCTRL_PIN(122, "G3 AGNDK 0"),
114762306a36Sopenharmony_ci	PINCTRL_PIN(123, "G4 AVCCK S"),
114862306a36Sopenharmony_ci	PINCTRL_PIN(124, "G5 AVCC3 S"),
114962306a36Sopenharmony_ci	PINCTRL_PIN(125, "G6 VCC2IOHA 2"),
115062306a36Sopenharmony_ci	PINCTRL_PIN(126, "G7 GND"),
115162306a36Sopenharmony_ci	PINCTRL_PIN(127, "G8 VCC2IOHA 2"),
115262306a36Sopenharmony_ci	PINCTRL_PIN(128, "G9 V1"),
115362306a36Sopenharmony_ci	PINCTRL_PIN(129, "G10 V1"),
115462306a36Sopenharmony_ci	PINCTRL_PIN(130, "G11 V1"),
115562306a36Sopenharmony_ci	PINCTRL_PIN(131, "G12 V1"),
115662306a36Sopenharmony_ci	PINCTRL_PIN(132, "G13 VCC2IOHA 2"),
115762306a36Sopenharmony_ci	PINCTRL_PIN(133, "G14 GND"),
115862306a36Sopenharmony_ci	PINCTRL_PIN(134, "G15 VCC3IOHA"),
115962306a36Sopenharmony_ci	PINCTRL_PIN(135, "G16 PCI REQ0 N"),
116062306a36Sopenharmony_ci	PINCTRL_PIN(136, "G17 PCI AD30"),
116162306a36Sopenharmony_ci	PINCTRL_PIN(137, "G18 PCI AD24"),
116262306a36Sopenharmony_ci	PINCTRL_PIN(138, "G19 PCI AD23"),
116362306a36Sopenharmony_ci	PINCTRL_PIN(139, "G20 PCI AD21"),
116462306a36Sopenharmony_ci	/* Row H */
116562306a36Sopenharmony_ci	PINCTRL_PIN(140, "H1 SATA0 TXDP"),
116662306a36Sopenharmony_ci	PINCTRL_PIN(141, "H2 SATA0 TXDN"),
116762306a36Sopenharmony_ci	PINCTRL_PIN(142, "H3 AGNDK 1"),
116862306a36Sopenharmony_ci	PINCTRL_PIN(143, "H4 AVCCK 0"),
116962306a36Sopenharmony_ci	PINCTRL_PIN(144, "H5 TEST CLKOUT"),
117062306a36Sopenharmony_ci	PINCTRL_PIN(145, "H6 AGND"),
117162306a36Sopenharmony_ci	PINCTRL_PIN(146, "H7 VCC2IOHA 2"),
117262306a36Sopenharmony_ci	PINCTRL_PIN(147, "H8 GND"),
117362306a36Sopenharmony_ci	PINCTRL_PIN(148, "H9 GND"),
117462306a36Sopenharmony_ci	PINCTRL_PIN(149, "H10 GDN"),
117562306a36Sopenharmony_ci	PINCTRL_PIN(150, "H11 GND"),
117662306a36Sopenharmony_ci	PINCTRL_PIN(151, "H12 GND"),
117762306a36Sopenharmony_ci	PINCTRL_PIN(152, "H13 GND"),
117862306a36Sopenharmony_ci	PINCTRL_PIN(153, "H14 VCC3IOHA"),
117962306a36Sopenharmony_ci	PINCTRL_PIN(154, "H15 VCC3IOHA"),
118062306a36Sopenharmony_ci	PINCTRL_PIN(155, "H16 PCI AD27"),
118162306a36Sopenharmony_ci	PINCTRL_PIN(156, "H17 PCI AD25"),
118262306a36Sopenharmony_ci	PINCTRL_PIN(157, "H18 PCI AD22"),
118362306a36Sopenharmony_ci	PINCTRL_PIN(158, "H19 PCI AD18"),
118462306a36Sopenharmony_ci	PINCTRL_PIN(159, "H20 PCI AD17"),
118562306a36Sopenharmony_ci	/* Row J (for some reason I is skipped) */
118662306a36Sopenharmony_ci	PINCTRL_PIN(160, "J1 SATA1 TXDP"),
118762306a36Sopenharmony_ci	PINCTRL_PIN(161, "J2 SATA1 TXDN"),
118862306a36Sopenharmony_ci	PINCTRL_PIN(162, "J3 AGNDK 2"),
118962306a36Sopenharmony_ci	PINCTRL_PIN(163, "J4 AVCCK 1"),
119062306a36Sopenharmony_ci	PINCTRL_PIN(164, "J5 AGND"),
119162306a36Sopenharmony_ci	PINCTRL_PIN(165, "J6 AGND"),
119262306a36Sopenharmony_ci	PINCTRL_PIN(166, "J7 V1"),
119362306a36Sopenharmony_ci	PINCTRL_PIN(167, "J8 GND"),
119462306a36Sopenharmony_ci	PINCTRL_PIN(168, "J9 GND"),
119562306a36Sopenharmony_ci	PINCTRL_PIN(169, "J10 GND"),
119662306a36Sopenharmony_ci	PINCTRL_PIN(170, "J11 GND"),
119762306a36Sopenharmony_ci	PINCTRL_PIN(171, "J12 GND"),
119862306a36Sopenharmony_ci	PINCTRL_PIN(172, "J13 GND"),
119962306a36Sopenharmony_ci	PINCTRL_PIN(173, "J14 V1"),
120062306a36Sopenharmony_ci	PINCTRL_PIN(174, "J15 VCC3IOHA"),
120162306a36Sopenharmony_ci	PINCTRL_PIN(175, "J16 PCI AD19"),
120262306a36Sopenharmony_ci	PINCTRL_PIN(176, "J17 PCI AD20"),
120362306a36Sopenharmony_ci	PINCTRL_PIN(177, "J18 PCI AD16"),
120462306a36Sopenharmony_ci	PINCTRL_PIN(178, "J19 PCI CBE2 N"),
120562306a36Sopenharmony_ci	PINCTRL_PIN(179, "J20 PCI FRAME N"),
120662306a36Sopenharmony_ci	/* Row K */
120762306a36Sopenharmony_ci	PINCTRL_PIN(180, "K1 SATA1 RXDP"),
120862306a36Sopenharmony_ci	PINCTRL_PIN(181, "K2 SATA1 RXDN"),
120962306a36Sopenharmony_ci	PINCTRL_PIN(182, "K3 AGNDK 3"),
121062306a36Sopenharmony_ci	PINCTRL_PIN(183, "K4 AVCCK 2"),
121162306a36Sopenharmony_ci	PINCTRL_PIN(184, "K5 AGND"),
121262306a36Sopenharmony_ci	PINCTRL_PIN(185, "K6 V1"),
121362306a36Sopenharmony_ci	PINCTRL_PIN(186, "K7 V1"),
121462306a36Sopenharmony_ci	PINCTRL_PIN(187, "K8 GND"),
121562306a36Sopenharmony_ci	PINCTRL_PIN(188, "K9 GND"),
121662306a36Sopenharmony_ci	PINCTRL_PIN(189, "K10 GND"),
121762306a36Sopenharmony_ci	PINCTRL_PIN(190, "K11 GND"),
121862306a36Sopenharmony_ci	PINCTRL_PIN(191, "K12 GND"),
121962306a36Sopenharmony_ci	PINCTRL_PIN(192, "K13 GND"),
122062306a36Sopenharmony_ci	PINCTRL_PIN(193, "K14 V1"),
122162306a36Sopenharmony_ci	PINCTRL_PIN(194, "K15 V1"),
122262306a36Sopenharmony_ci	PINCTRL_PIN(195, "K16 PCI TRDY N"),
122362306a36Sopenharmony_ci	PINCTRL_PIN(196, "K17 PCI IRDY N"),
122462306a36Sopenharmony_ci	PINCTRL_PIN(197, "K18 PCI DEVSEL N"),
122562306a36Sopenharmony_ci	PINCTRL_PIN(198, "K19 PCI STOP N"),
122662306a36Sopenharmony_ci	PINCTRL_PIN(199, "K20 PCI PAR"),
122762306a36Sopenharmony_ci	/* Row L */
122862306a36Sopenharmony_ci	PINCTRL_PIN(200, "L1 IDE CS0 N"),
122962306a36Sopenharmony_ci	PINCTRL_PIN(201, "L2 IDE DA0"),
123062306a36Sopenharmony_ci	PINCTRL_PIN(202, "L3 AVCCK 3"),
123162306a36Sopenharmony_ci	PINCTRL_PIN(203, "L4 AGND"),
123262306a36Sopenharmony_ci	PINCTRL_PIN(204, "L5 IDE DIOR N"),
123362306a36Sopenharmony_ci	PINCTRL_PIN(205, "L6 V1"),
123462306a36Sopenharmony_ci	PINCTRL_PIN(206, "L7 V1"),
123562306a36Sopenharmony_ci	PINCTRL_PIN(207, "L8 GND"),
123662306a36Sopenharmony_ci	PINCTRL_PIN(208, "L9 GND"),
123762306a36Sopenharmony_ci	PINCTRL_PIN(209, "L10 GND"),
123862306a36Sopenharmony_ci	PINCTRL_PIN(210, "L11 GND"),
123962306a36Sopenharmony_ci	PINCTRL_PIN(211, "L12 GND"),
124062306a36Sopenharmony_ci	PINCTRL_PIN(212, "L13 GND"),
124162306a36Sopenharmony_ci	PINCTRL_PIN(213, "L14 V1"),
124262306a36Sopenharmony_ci	PINCTRL_PIN(214, "L15 V1"),
124362306a36Sopenharmony_ci	PINCTRL_PIN(215, "L16 PCI AD12"),
124462306a36Sopenharmony_ci	PINCTRL_PIN(216, "L17 PCI AD13"),
124562306a36Sopenharmony_ci	PINCTRL_PIN(217, "L18 PCI AD14"),
124662306a36Sopenharmony_ci	PINCTRL_PIN(218, "L19 PCI AD15"),
124762306a36Sopenharmony_ci	PINCTRL_PIN(219, "L20 PCI CBE1 N"),
124862306a36Sopenharmony_ci	/* Row M */
124962306a36Sopenharmony_ci	PINCTRL_PIN(220, "M1 IDE DA1"),
125062306a36Sopenharmony_ci	PINCTRL_PIN(221, "M2 IDE CS1 N"),
125162306a36Sopenharmony_ci	PINCTRL_PIN(222, "M3 IDE DA2"),
125262306a36Sopenharmony_ci	PINCTRL_PIN(223, "M4 IDE DMACK N"),
125362306a36Sopenharmony_ci	PINCTRL_PIN(224, "M5 IDE DD1"),
125462306a36Sopenharmony_ci	PINCTRL_PIN(225, "M6 VCC3IOHA"),
125562306a36Sopenharmony_ci	PINCTRL_PIN(226, "M7 V1"),
125662306a36Sopenharmony_ci	PINCTRL_PIN(227, "M8 GND"),
125762306a36Sopenharmony_ci	PINCTRL_PIN(228, "M9 GND"),
125862306a36Sopenharmony_ci	PINCTRL_PIN(229, "M10 GND"),
125962306a36Sopenharmony_ci	PINCTRL_PIN(230, "M11 GND"),
126062306a36Sopenharmony_ci	PINCTRL_PIN(231, "M12 GND"),
126162306a36Sopenharmony_ci	PINCTRL_PIN(232, "M13 GND"),
126262306a36Sopenharmony_ci	PINCTRL_PIN(233, "M14 V1"),
126362306a36Sopenharmony_ci	PINCTRL_PIN(234, "M15 VCC3IOHA"),
126462306a36Sopenharmony_ci	PINCTRL_PIN(235, "M16 PCI AD7"),
126562306a36Sopenharmony_ci	PINCTRL_PIN(236, "M17 PCI AD6"),
126662306a36Sopenharmony_ci	PINCTRL_PIN(237, "M18 PCI AD9"),
126762306a36Sopenharmony_ci	PINCTRL_PIN(238, "M19 PCI AD10"),
126862306a36Sopenharmony_ci	PINCTRL_PIN(239, "M20 PCI AD11"),
126962306a36Sopenharmony_ci	/* Row N */
127062306a36Sopenharmony_ci	PINCTRL_PIN(240, "N1 IDE IORDY"),
127162306a36Sopenharmony_ci	PINCTRL_PIN(241, "N2 IDE INTRQ"),
127262306a36Sopenharmony_ci	PINCTRL_PIN(242, "N3 IDE DIOW N"),
127362306a36Sopenharmony_ci	PINCTRL_PIN(243, "N4 IDE DD15"),
127462306a36Sopenharmony_ci	PINCTRL_PIN(244, "N5 IDE DMARQ"),
127562306a36Sopenharmony_ci	PINCTRL_PIN(245, "N6 VCC3IOHA"),
127662306a36Sopenharmony_ci	PINCTRL_PIN(246, "N7 VCC3IOHA"),
127762306a36Sopenharmony_ci	PINCTRL_PIN(247, "N8 GND"),
127862306a36Sopenharmony_ci	PINCTRL_PIN(248, "N9 GND"),
127962306a36Sopenharmony_ci	PINCTRL_PIN(249, "N10 GND"),
128062306a36Sopenharmony_ci	PINCTRL_PIN(250, "N11 GND"),
128162306a36Sopenharmony_ci	PINCTRL_PIN(251, "N12 GND"),
128262306a36Sopenharmony_ci	PINCTRL_PIN(252, "N13 GND"),
128362306a36Sopenharmony_ci	PINCTRL_PIN(253, "N14 VCC3IOHA"),
128462306a36Sopenharmony_ci	PINCTRL_PIN(254, "N15 VCC3IOHA"),
128562306a36Sopenharmony_ci	PINCTRL_PIN(255, "N16 PCI CLKRUN N"),
128662306a36Sopenharmony_ci	PINCTRL_PIN(256, "N17 PCI AD0"),
128762306a36Sopenharmony_ci	PINCTRL_PIN(257, "N18 PCI AD4"),
128862306a36Sopenharmony_ci	PINCTRL_PIN(258, "N19 PCI CBE0 N"),
128962306a36Sopenharmony_ci	PINCTRL_PIN(259, "N20 PCI AD8"),
129062306a36Sopenharmony_ci	/* Row P (for some reason O is skipped) */
129162306a36Sopenharmony_ci	PINCTRL_PIN(260, "P1 IDE DD0"),
129262306a36Sopenharmony_ci	PINCTRL_PIN(261, "P2 IDE DD14"),
129362306a36Sopenharmony_ci	PINCTRL_PIN(262, "P3 IDE DD2"),
129462306a36Sopenharmony_ci	PINCTRL_PIN(263, "P4 IDE DD4"),
129562306a36Sopenharmony_ci	PINCTRL_PIN(264, "P5 IDE DD3"),
129662306a36Sopenharmony_ci	PINCTRL_PIN(265, "P6 VCC3IOHA"),
129762306a36Sopenharmony_ci	PINCTRL_PIN(266, "P7 GND"),
129862306a36Sopenharmony_ci	PINCTRL_PIN(267, "P8 VCC2IOHA 1"),
129962306a36Sopenharmony_ci	PINCTRL_PIN(268, "P9 V1"),
130062306a36Sopenharmony_ci	PINCTRL_PIN(269, "P10 V1"),
130162306a36Sopenharmony_ci	PINCTRL_PIN(270, "P11 V1"),
130262306a36Sopenharmony_ci	PINCTRL_PIN(271, "P12 V1"),
130362306a36Sopenharmony_ci	PINCTRL_PIN(272, "P13 VCC3IOHA"),
130462306a36Sopenharmony_ci	PINCTRL_PIN(273, "P14 GND"),
130562306a36Sopenharmony_ci	PINCTRL_PIN(274, "P15 VCC3IOHA"),
130662306a36Sopenharmony_ci	PINCTRL_PIN(275, "P16 GPIO0 30"),
130762306a36Sopenharmony_ci	PINCTRL_PIN(276, "P17 GPIO0 28"),
130862306a36Sopenharmony_ci	PINCTRL_PIN(277, "P18 PCI AD1"),
130962306a36Sopenharmony_ci	PINCTRL_PIN(278, "P19 PCI AD3"),
131062306a36Sopenharmony_ci	PINCTRL_PIN(279, "P20 PCI AD5"),
131162306a36Sopenharmony_ci	/* Row R (for some reason Q is skipped) */
131262306a36Sopenharmony_ci	PINCTRL_PIN(280, "R1 IDE DD13"),
131362306a36Sopenharmony_ci	PINCTRL_PIN(281, "R2 IDE DD12"),
131462306a36Sopenharmony_ci	PINCTRL_PIN(282, "R3 IDE DD10"),
131562306a36Sopenharmony_ci	PINCTRL_PIN(283, "R4 IDE DD6"),
131662306a36Sopenharmony_ci	PINCTRL_PIN(284, "R5 ICE0 IDI"),
131762306a36Sopenharmony_ci	PINCTRL_PIN(285, "R6 GND"),
131862306a36Sopenharmony_ci	PINCTRL_PIN(286, "R7 VCC2IOHA 1"),
131962306a36Sopenharmony_ci	PINCTRL_PIN(287, "R8 VCC2IOHA 1"),
132062306a36Sopenharmony_ci	PINCTRL_PIN(288, "R9 VCC2IOHA 1"),
132162306a36Sopenharmony_ci	PINCTRL_PIN(289, "R10 V1"),
132262306a36Sopenharmony_ci	PINCTRL_PIN(290, "R11 V1"),
132362306a36Sopenharmony_ci	PINCTRL_PIN(291, "R12 VCC3IOHA"),
132462306a36Sopenharmony_ci	PINCTRL_PIN(292, "R13 VCC3IOHA"),
132562306a36Sopenharmony_ci	PINCTRL_PIN(293, "R14 VCC3IOHA"),
132662306a36Sopenharmony_ci	PINCTRL_PIN(294, "R15 GND"),
132762306a36Sopenharmony_ci	PINCTRL_PIN(295, "R16 GPIO0 23"),
132862306a36Sopenharmony_ci	PINCTRL_PIN(296, "R17 GPIO0 21"),
132962306a36Sopenharmony_ci	PINCTRL_PIN(297, "R18 GPIO0 26"),
133062306a36Sopenharmony_ci	PINCTRL_PIN(298, "R19 GPIO0 31"),
133162306a36Sopenharmony_ci	PINCTRL_PIN(299, "R20 PCI AD2"),
133262306a36Sopenharmony_ci	/* Row T (for some reason S is skipped) */
133362306a36Sopenharmony_ci	PINCTRL_PIN(300, "T1 IDE DD11"),
133462306a36Sopenharmony_ci	PINCTRL_PIN(301, "T2 IDE DD5"),
133562306a36Sopenharmony_ci	PINCTRL_PIN(302, "T3 IDE DD8"),
133662306a36Sopenharmony_ci	PINCTRL_PIN(303, "T4 ICE0 IDO"),
133762306a36Sopenharmony_ci	PINCTRL_PIN(304, "T5 GND"),
133862306a36Sopenharmony_ci	PINCTRL_PIN(305, "T6 USB GNDA U20"),
133962306a36Sopenharmony_ci	PINCTRL_PIN(306, "T7 GMAC0 TXD0"),
134062306a36Sopenharmony_ci	PINCTRL_PIN(307, "T8 GMAC0 TXEN"),
134162306a36Sopenharmony_ci	PINCTRL_PIN(308, "T9 GMAC1 TXD3"),
134262306a36Sopenharmony_ci	PINCTRL_PIN(309, "T10 GMAC1 RXDV"),
134362306a36Sopenharmony_ci	PINCTRL_PIN(310, "T11 GMAC1 RXD2"),
134462306a36Sopenharmony_ci	PINCTRL_PIN(311, "T12 GPIO1 29"),
134562306a36Sopenharmony_ci	PINCTRL_PIN(312, "T13 GPIO0 3"),
134662306a36Sopenharmony_ci	PINCTRL_PIN(313, "T14 GPIO0 9"),
134762306a36Sopenharmony_ci	PINCTRL_PIN(314, "T15 GPIO0 16"),
134862306a36Sopenharmony_ci	PINCTRL_PIN(315, "T16 GND"),
134962306a36Sopenharmony_ci	PINCTRL_PIN(316, "T17 GPIO0 14"),
135062306a36Sopenharmony_ci	PINCTRL_PIN(317, "T18 GPIO0 19"),
135162306a36Sopenharmony_ci	PINCTRL_PIN(318, "T19 GPIO0 27"),
135262306a36Sopenharmony_ci	PINCTRL_PIN(319, "T20 GPIO0 29"),
135362306a36Sopenharmony_ci	/* Row U */
135462306a36Sopenharmony_ci	PINCTRL_PIN(320, "U1 IDE DD9"),
135562306a36Sopenharmony_ci	PINCTRL_PIN(321, "U2 IDE DD7"),
135662306a36Sopenharmony_ci	PINCTRL_PIN(322, "U3 ICE0 ICK"),
135762306a36Sopenharmony_ci	PINCTRL_PIN(323, "U4 GND"),
135862306a36Sopenharmony_ci	PINCTRL_PIN(324, "U5 USB XSCO"),
135962306a36Sopenharmony_ci	PINCTRL_PIN(325, "U6 GMAC0 TXD1"),
136062306a36Sopenharmony_ci	PINCTRL_PIN(326, "U7 GMAC0 TXD3"),
136162306a36Sopenharmony_ci	PINCTRL_PIN(327, "U8 GMAC0 TXC"),
136262306a36Sopenharmony_ci	PINCTRL_PIN(328, "U9 GMAC0 RXD3"),
136362306a36Sopenharmony_ci	PINCTRL_PIN(329, "U10 GMAC1 TXD0"),
136462306a36Sopenharmony_ci	PINCTRL_PIN(330, "U11 GMAC1 CRS"),
136562306a36Sopenharmony_ci	PINCTRL_PIN(331, "U12 EXT CLK"),
136662306a36Sopenharmony_ci	PINCTRL_PIN(332, "U13 DEV DEF"),
136762306a36Sopenharmony_ci	PINCTRL_PIN(333, "U14 GPIO0 0"),
136862306a36Sopenharmony_ci	PINCTRL_PIN(334, "U15 GPIO0 4"),
136962306a36Sopenharmony_ci	PINCTRL_PIN(335, "U16 GPIO0 10"),
137062306a36Sopenharmony_ci	PINCTRL_PIN(336, "U17 GND"),
137162306a36Sopenharmony_ci	PINCTRL_PIN(337, "U18 GPIO0 17"),
137262306a36Sopenharmony_ci	PINCTRL_PIN(338, "U19 GPIO0 22"),
137362306a36Sopenharmony_ci	PINCTRL_PIN(339, "U20 GPIO0 25"),
137462306a36Sopenharmony_ci	/* Row V */
137562306a36Sopenharmony_ci	PINCTRL_PIN(340, "V1 ICE0 DBGACK"),
137662306a36Sopenharmony_ci	PINCTRL_PIN(341, "V2 ICE0 DBGRQ"),
137762306a36Sopenharmony_ci	PINCTRL_PIN(342, "V3 GND"),
137862306a36Sopenharmony_ci	PINCTRL_PIN(343, "V4 ICE0 IRST N"),
137962306a36Sopenharmony_ci	PINCTRL_PIN(344, "V5 USB XSCI"),
138062306a36Sopenharmony_ci	PINCTRL_PIN(345, "V6 GMAC0 COL"),
138162306a36Sopenharmony_ci	PINCTRL_PIN(346, "V7 GMAC0 TXD2"),
138262306a36Sopenharmony_ci	PINCTRL_PIN(347, "V8 GMAC0 RXDV"),
138362306a36Sopenharmony_ci	PINCTRL_PIN(348, "V9 GMAC0 RXD1"),
138462306a36Sopenharmony_ci	PINCTRL_PIN(349, "V10 GMAC1 COL"),
138562306a36Sopenharmony_ci	PINCTRL_PIN(350, "V11 GMAC1 TXC"),
138662306a36Sopenharmony_ci	PINCTRL_PIN(351, "V12 GMAC1 RXD1"),
138762306a36Sopenharmony_ci	PINCTRL_PIN(352, "V13 MODE SEL1"),
138862306a36Sopenharmony_ci	PINCTRL_PIN(353, "V14 GPIO1 28"),
138962306a36Sopenharmony_ci	PINCTRL_PIN(354, "V15 GPIO0 1"),
139062306a36Sopenharmony_ci	PINCTRL_PIN(355, "V16 GPIO0 8"),
139162306a36Sopenharmony_ci	PINCTRL_PIN(356, "V17 GPIO0 11"),
139262306a36Sopenharmony_ci	PINCTRL_PIN(357, "V18 GND"),
139362306a36Sopenharmony_ci	PINCTRL_PIN(358, "V19 GPIO0 18"),
139462306a36Sopenharmony_ci	PINCTRL_PIN(359, "V20 GPIO0 24"),
139562306a36Sopenharmony_ci	/* Row W */
139662306a36Sopenharmony_ci	PINCTRL_PIN(360, "W1 IDE RESET N"),
139762306a36Sopenharmony_ci	PINCTRL_PIN(361, "W2 GND"),
139862306a36Sopenharmony_ci	PINCTRL_PIN(362, "W3 USB0 VCCHSRT"),
139962306a36Sopenharmony_ci	PINCTRL_PIN(363, "W4 USB0 DP"),
140062306a36Sopenharmony_ci	PINCTRL_PIN(364, "W5 USB VCCA U20"),
140162306a36Sopenharmony_ci	PINCTRL_PIN(365, "W6 USB1 DP"),
140262306a36Sopenharmony_ci	PINCTRL_PIN(366, "W7 USB1 GNDHSRT"),
140362306a36Sopenharmony_ci	PINCTRL_PIN(367, "W8 GMAC0 RXD0"),
140462306a36Sopenharmony_ci	PINCTRL_PIN(368, "W9 GMAC0 CRS"),
140562306a36Sopenharmony_ci	PINCTRL_PIN(369, "W10 GMAC1 TXD2"),
140662306a36Sopenharmony_ci	PINCTRL_PIN(370, "W11 GMAC1 TXEN"),
140762306a36Sopenharmony_ci	PINCTRL_PIN(371, "W12 GMAC1 RXD3"),
140862306a36Sopenharmony_ci	PINCTRL_PIN(372, "W13 MODE SEL0"),
140962306a36Sopenharmony_ci	PINCTRL_PIN(373, "W14 MODE SEL3"),
141062306a36Sopenharmony_ci	PINCTRL_PIN(374, "W15 GPIO1 31"),
141162306a36Sopenharmony_ci	PINCTRL_PIN(375, "W16 GPIO0 5"),
141262306a36Sopenharmony_ci	PINCTRL_PIN(376, "W17 GPIO0 7"),
141362306a36Sopenharmony_ci	PINCTRL_PIN(377, "W18 GPIO0 12"),
141462306a36Sopenharmony_ci	PINCTRL_PIN(378, "W19 GND"),
141562306a36Sopenharmony_ci	PINCTRL_PIN(379, "W20 GPIO0 20"),
141662306a36Sopenharmony_ci	/* Row Y */
141762306a36Sopenharmony_ci	PINCTRL_PIN(380, "Y1 ICE0 IMS"),
141862306a36Sopenharmony_ci	PINCTRL_PIN(381, "Y2 USB0 GNDHSRT"),
141962306a36Sopenharmony_ci	PINCTRL_PIN(382, "Y3 USB0 DM"),
142062306a36Sopenharmony_ci	PINCTRL_PIN(383, "Y4 USB RREF"),
142162306a36Sopenharmony_ci	PINCTRL_PIN(384, "Y5 USB1 DM"),
142262306a36Sopenharmony_ci	PINCTRL_PIN(385, "Y6 USB1 VCCHSRT"),
142362306a36Sopenharmony_ci	PINCTRL_PIN(386, "Y7 GMAC0 RXC"),
142462306a36Sopenharmony_ci	PINCTRL_PIN(387, "Y8 GMAC0 RXD2"),
142562306a36Sopenharmony_ci	PINCTRL_PIN(388, "Y9 REF CLK"),
142662306a36Sopenharmony_ci	PINCTRL_PIN(389, "Y10 GMAC1 TXD1"),
142762306a36Sopenharmony_ci	PINCTRL_PIN(390, "Y11 GMAC1 RXC"),
142862306a36Sopenharmony_ci	PINCTRL_PIN(391, "Y12 GMAC1 RXD0"),
142962306a36Sopenharmony_ci	PINCTRL_PIN(392, "Y13 M30 CLK"),
143062306a36Sopenharmony_ci	PINCTRL_PIN(393, "Y14 MODE SEL2"),
143162306a36Sopenharmony_ci	PINCTRL_PIN(394, "Y15 GPIO1 30"),
143262306a36Sopenharmony_ci	PINCTRL_PIN(395, "Y16 GPIO0 2"),
143362306a36Sopenharmony_ci	PINCTRL_PIN(396, "Y17 GPIO0 6"),
143462306a36Sopenharmony_ci	PINCTRL_PIN(397, "Y18 SYS RESET N"),
143562306a36Sopenharmony_ci	PINCTRL_PIN(398, "Y19 GPIO0 13"),
143662306a36Sopenharmony_ci	PINCTRL_PIN(399, "Y20 GPIO0 15"),
143762306a36Sopenharmony_ci};
143862306a36Sopenharmony_ci
143962306a36Sopenharmony_ci/* Digital ground */
144062306a36Sopenharmony_cistatic const unsigned int gnd_3516_pins[] = {
144162306a36Sopenharmony_ci	21, 38, 42, 57, 63, 76, 84, 95, 105, 114, 126, 133, 147, 148, 149, 150,
144262306a36Sopenharmony_ci	151, 152, 167, 168, 169, 170, 171, 172, 187, 188, 189, 190, 191, 192,
144362306a36Sopenharmony_ci	207, 208, 209, 210, 211, 212, 227, 228, 229, 230, 231, 232, 247, 248,
144462306a36Sopenharmony_ci	249, 250, 251, 252, 266, 273, 285, 294, 304, 315, 323, 336, 342, 357,
144562306a36Sopenharmony_ci	361, 378
144662306a36Sopenharmony_ci};
144762306a36Sopenharmony_ci
144862306a36Sopenharmony_cistatic const unsigned int dram_3516_pins[] = {
144962306a36Sopenharmony_ci	1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 23, 24, 25, 26,
145062306a36Sopenharmony_ci	27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 44, 45, 46, 47, 48, 49, 50,
145162306a36Sopenharmony_ci	51, 52, 53, 54, 55, 56, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
145262306a36Sopenharmony_ci	87, 88, 89, 90, 91, 92, 93, 94
145362306a36Sopenharmony_ci};
145462306a36Sopenharmony_ci
145562306a36Sopenharmony_cistatic const unsigned int rtc_3516_pins[] = { 0, 43, 22 };
145662306a36Sopenharmony_ci
145762306a36Sopenharmony_cistatic const unsigned int power_3516_pins[] = { 20, 83, 40, 41, 60, 61, 62 };
145862306a36Sopenharmony_ci
145962306a36Sopenharmony_cistatic const unsigned int cir_3516_pins[] = { 85, 64, 82 };
146062306a36Sopenharmony_ci
146162306a36Sopenharmony_cistatic const unsigned int system_3516_pins[] = {
146262306a36Sopenharmony_ci	332, 392, 372, 373, 393, 352, 331, 388, 397, 77
146362306a36Sopenharmony_ci};
146462306a36Sopenharmony_ci
146562306a36Sopenharmony_cistatic const unsigned int vcontrol_3516_pins[] = { 86, 81, 80 };
146662306a36Sopenharmony_ci
146762306a36Sopenharmony_cistatic const unsigned int ice_3516_pins[] = { 340, 341, 303, 322, 380, 284, 343 };
146862306a36Sopenharmony_ci
146962306a36Sopenharmony_cistatic const unsigned int ide_3516_pins[] = {
147062306a36Sopenharmony_ci	200, 201, 204, 220, 221, 222, 223, 224, 240, 241, 242, 243, 244, 260,
147162306a36Sopenharmony_ci	261, 262, 263, 264, 280, 281, 282, 283, 300, 301, 302, 320, 321, 360
147262306a36Sopenharmony_ci};
147362306a36Sopenharmony_ci
147462306a36Sopenharmony_cistatic const unsigned int sata_3516_pins[] = {
147562306a36Sopenharmony_ci	100, 101, 102, 103, 104, 120, 121, 122, 123, 124, 140, 141, 142, 143,
147662306a36Sopenharmony_ci	144, 160, 161, 162, 163, 180, 181, 182, 183, 202
147762306a36Sopenharmony_ci};
147862306a36Sopenharmony_ci
147962306a36Sopenharmony_cistatic const unsigned int usb_3516_pins[] = {
148062306a36Sopenharmony_ci	305, 324, 344, 362, 363, 364, 365, 366, 381, 382, 383, 384, 385
148162306a36Sopenharmony_ci};
148262306a36Sopenharmony_ci
148362306a36Sopenharmony_ci/* GMII, ethernet pins */
148462306a36Sopenharmony_cistatic const unsigned int gmii_gmac0_3516_pins[] = {
148562306a36Sopenharmony_ci	306, 307, 325, 326, 327, 328, 345, 346, 347, 348, 367, 368, 386, 387
148662306a36Sopenharmony_ci};
148762306a36Sopenharmony_ci
148862306a36Sopenharmony_cistatic const unsigned int gmii_gmac1_3516_pins[] = {
148962306a36Sopenharmony_ci	308, 309, 310, 329, 330, 349, 350, 351, 369, 370, 371, 389, 390, 391
149062306a36Sopenharmony_ci};
149162306a36Sopenharmony_ci
149262306a36Sopenharmony_cistatic const unsigned int pci_3516_pins[] = {
149362306a36Sopenharmony_ci	17, 18, 19, 39, 58, 59, 78, 79, 96, 97, 98, 99, 115, 116, 117, 118,
149462306a36Sopenharmony_ci	119, 135, 136, 137, 138, 139, 155, 156, 157, 158, 159, 175, 176, 177,
149562306a36Sopenharmony_ci	178, 179, 195, 196, 197, 198, 199, 215, 216, 217, 218, 219, 235, 236,
149662306a36Sopenharmony_ci	237, 238, 239, 255, 256, 257, 258, 259, 277, 278, 279, 299
149762306a36Sopenharmony_ci};
149862306a36Sopenharmony_ci
149962306a36Sopenharmony_ci/*
150062306a36Sopenharmony_ci * Apparently the LPC interface is using the PCICLK for the clocking so
150162306a36Sopenharmony_ci * PCI needs to be active at the same time.
150262306a36Sopenharmony_ci */
150362306a36Sopenharmony_cistatic const unsigned int lpc_3516_pins[] = {
150462306a36Sopenharmony_ci	355, /* LPC_LAD[0] */
150562306a36Sopenharmony_ci	356, /* LPC_SERIRQ */
150662306a36Sopenharmony_ci	377, /* LPC_LAD[2] */
150762306a36Sopenharmony_ci	398, /* LPC_LFRAME# */
150862306a36Sopenharmony_ci	316, /* LPC_LAD[3] */
150962306a36Sopenharmony_ci	399, /* LPC_LAD[1] */
151062306a36Sopenharmony_ci};
151162306a36Sopenharmony_ci
151262306a36Sopenharmony_ci/* Character LCD */
151362306a36Sopenharmony_cistatic const unsigned int lcd_3516_pins[] = {
151462306a36Sopenharmony_ci	391, 351, 310, 371, 353, 311, 394, 374, 314, 359, 339
151562306a36Sopenharmony_ci};
151662306a36Sopenharmony_ci
151762306a36Sopenharmony_cistatic const unsigned int ssp_3516_pins[] = {
151862306a36Sopenharmony_ci	355, /* SSP_97RST# SSP AC97 Reset, active low */
151962306a36Sopenharmony_ci	356, /* SSP_FSC */
152062306a36Sopenharmony_ci	377, /* SSP_ECLK */
152162306a36Sopenharmony_ci	398, /* SSP_TXD */
152262306a36Sopenharmony_ci	316, /* SSP_RXD */
152362306a36Sopenharmony_ci	399, /* SSP_SCLK */
152462306a36Sopenharmony_ci};
152562306a36Sopenharmony_ci
152662306a36Sopenharmony_cistatic const unsigned int uart_rxtx_3516_pins[] = {
152762306a36Sopenharmony_ci	313, /* UART_SIN serial input, RX */
152862306a36Sopenharmony_ci	335, /* UART_SOUT serial output, TX */
152962306a36Sopenharmony_ci};
153062306a36Sopenharmony_ci
153162306a36Sopenharmony_cistatic const unsigned int uart_modem_3516_pins[] = {
153262306a36Sopenharmony_ci	355, /* UART_NDCD DCD carrier detect */
153362306a36Sopenharmony_ci	356, /* UART_NDTR DTR data terminal ready */
153462306a36Sopenharmony_ci	377, /* UART_NDSR DSR data set ready */
153562306a36Sopenharmony_ci	398, /* UART_NRTS RTS request to send */
153662306a36Sopenharmony_ci	316, /* UART_NCTS CTS clear to send */
153762306a36Sopenharmony_ci	399, /* UART_NRI RI ring indicator */
153862306a36Sopenharmony_ci};
153962306a36Sopenharmony_ci
154062306a36Sopenharmony_cistatic const unsigned int tvc_3516_pins[] = {
154162306a36Sopenharmony_ci	353, /* TVC_DATA[0] */
154262306a36Sopenharmony_ci	311, /* TVC_DATA[1] */
154362306a36Sopenharmony_ci	394, /* TVC_DATA[2] */
154462306a36Sopenharmony_ci	374, /* TVC_DATA[3] */
154562306a36Sopenharmony_ci	354, /* TVC_DATA[4] */
154662306a36Sopenharmony_ci	395, /* TVC_DATA[5] */
154762306a36Sopenharmony_ci	312, /* TVC_DATA[6] */
154862306a36Sopenharmony_ci	334, /* TVC_DATA[7] */
154962306a36Sopenharmony_ci};
155062306a36Sopenharmony_ci
155162306a36Sopenharmony_cistatic const unsigned int tvc_clk_3516_pins[] = {
155262306a36Sopenharmony_ci	333, /* TVC_CLK */
155362306a36Sopenharmony_ci};
155462306a36Sopenharmony_ci
155562306a36Sopenharmony_ci/* NAND flash pins */
155662306a36Sopenharmony_cistatic const unsigned int nflash_3516_pins[] = {
155762306a36Sopenharmony_ci	243, 260, 261, 224, 280, 262, 281, 264, 300, 263, 282, 301, 320, 283,
155862306a36Sopenharmony_ci	302, 321, 337, 358, 295, 359, 339, 275, 298
155962306a36Sopenharmony_ci};
156062306a36Sopenharmony_ci
156162306a36Sopenharmony_ci/* Parallel (NOR) flash pins, D[0-15], A[16-25], CE0, CE1, RB, WE, OE, ALE */
156262306a36Sopenharmony_cistatic const unsigned int pflash_3516_pins[] = {
156362306a36Sopenharmony_ci	221, 200, 222, 201, 220, 243, 260, 261, 224, 280, 262, 281, 264, 300,
156462306a36Sopenharmony_ci	263, 282, 301, 320, 283, 302, 321, 317, 379, 295, 359, 339, 297, 318,
156562306a36Sopenharmony_ci	276, 319, 275, 298
156662306a36Sopenharmony_ci};
156762306a36Sopenharmony_ci
156862306a36Sopenharmony_ci/*
156962306a36Sopenharmony_ci * The parallel flash can be set up in a 26-bit address bus mode exposing
157062306a36Sopenharmony_ci * A[0-15] (A[15] takes the place of ALE), but it has the
157162306a36Sopenharmony_ci * side effect of stealing pins from GMAC1 and TVC so these blocks cannot be
157262306a36Sopenharmony_ci * used at the same time.
157362306a36Sopenharmony_ci */
157462306a36Sopenharmony_cistatic const unsigned int pflash_3516_pins_extended[] = {
157562306a36Sopenharmony_ci	221, 200, 222, 201, 220, 243, 260, 261, 224, 280, 262, 281, 264, 300,
157662306a36Sopenharmony_ci	263, 282, 301, 320, 283, 302, 321, 317, 379, 295, 359, 339, 297, 318,
157762306a36Sopenharmony_ci	276, 319, 275, 298,
157862306a36Sopenharmony_ci	/* The extra pins */
157962306a36Sopenharmony_ci	349, 308, 369, 389, 329, 350, 370, 309, 390, 391, 351, 310, 371, 330,
158062306a36Sopenharmony_ci	333
158162306a36Sopenharmony_ci};
158262306a36Sopenharmony_ci
158362306a36Sopenharmony_ci/* Serial flash pins CE0, CE1, DI, DO, CK */
158462306a36Sopenharmony_cistatic const unsigned int sflash_3516_pins[] = { 296, 338, 295, 359, 339 };
158562306a36Sopenharmony_ci
158662306a36Sopenharmony_ci/* The GPIO0A (0-4) pins overlap with TVC and extended parallel flash */
158762306a36Sopenharmony_cistatic const unsigned int gpio0a_3516_pins[] = { 354, 395, 312, 334 };
158862306a36Sopenharmony_ci
158962306a36Sopenharmony_ci/* The GPIO0B (5-7) pins overlap with ICE */
159062306a36Sopenharmony_cistatic const unsigned int gpio0b_3516_pins[] = { 375, 396, 376 };
159162306a36Sopenharmony_ci
159262306a36Sopenharmony_ci/* The GPIO0C (8,11-15) pins overlap with LPC, UART and SSP */
159362306a36Sopenharmony_cistatic const unsigned int gpio0c_3516_pins[] = { 355, 356, 377, 398, 316, 399 };
159462306a36Sopenharmony_ci
159562306a36Sopenharmony_ci/* The GPIO0D (9,10) pins overlap with UART RX/TX */
159662306a36Sopenharmony_cistatic const unsigned int gpio0d_3516_pins[] = { 313, 335 };
159762306a36Sopenharmony_ci
159862306a36Sopenharmony_ci/* The GPIO0E (16) pins overlap with LCD */
159962306a36Sopenharmony_cistatic const unsigned int gpio0e_3516_pins[] = { 314 };
160062306a36Sopenharmony_ci
160162306a36Sopenharmony_ci/* The GPIO0F (17,18) pins overlap with NAND flash CE0, CE1 */
160262306a36Sopenharmony_cistatic const unsigned int gpio0f_3516_pins[] = { 337, 358 };
160362306a36Sopenharmony_ci
160462306a36Sopenharmony_ci/* The GPIO0G (19,20,26-29) pins overlap with parallel flash */
160562306a36Sopenharmony_cistatic const unsigned int gpio0g_3516_pins[] = { 317, 379, 297, 318, 276, 319 };
160662306a36Sopenharmony_ci
160762306a36Sopenharmony_ci/* The GPIO0H (21,22) pins overlap with serial flash CE0, CE1 */
160862306a36Sopenharmony_cistatic const unsigned int gpio0h_3516_pins[] = { 296, 338 };
160962306a36Sopenharmony_ci
161062306a36Sopenharmony_ci/* The GPIO0I (23) pins overlap with all flash */
161162306a36Sopenharmony_cistatic const unsigned int gpio0i_3516_pins[] = { 295 };
161262306a36Sopenharmony_ci
161362306a36Sopenharmony_ci/* The GPIO0J (24,25) pins overlap with all flash and LCD */
161462306a36Sopenharmony_cistatic const unsigned int gpio0j_3516_pins[] = { 359, 339 };
161562306a36Sopenharmony_ci
161662306a36Sopenharmony_ci/* The GPIO0K (30,31) pins overlap with NAND flash */
161762306a36Sopenharmony_cistatic const unsigned int gpio0k_3516_pins[] = { 275, 298 };
161862306a36Sopenharmony_ci
161962306a36Sopenharmony_ci/* The GPIO0L (0) pins overlap with TVC_CLK */
162062306a36Sopenharmony_cistatic const unsigned int gpio0l_3516_pins[] = { 333 };
162162306a36Sopenharmony_ci
162262306a36Sopenharmony_ci/* The GPIO1A (0-4) pins that overlap with IDE and parallel flash */
162362306a36Sopenharmony_cistatic const unsigned int gpio1a_3516_pins[] = { 221, 200, 222, 201, 220 };
162462306a36Sopenharmony_ci
162562306a36Sopenharmony_ci/* The GPIO1B (5-10,27) pins overlap with just IDE */
162662306a36Sopenharmony_cistatic const unsigned int gpio1b_3516_pins[] = { 241, 223, 240, 204, 242, 244, 360 };
162762306a36Sopenharmony_ci
162862306a36Sopenharmony_ci/* The GPIO1C (11-26) pins overlap with IDE, parallel flash and NAND flash */
162962306a36Sopenharmony_cistatic const unsigned int gpio1c_3516_pins[] = {
163062306a36Sopenharmony_ci	243, 260, 261, 224, 280, 262, 281, 264, 300, 263, 282, 301, 320, 283,
163162306a36Sopenharmony_ci	302, 321
163262306a36Sopenharmony_ci};
163362306a36Sopenharmony_ci
163462306a36Sopenharmony_ci/* The GPIO1D (28-31) pins overlap with TVC */
163562306a36Sopenharmony_cistatic const unsigned int gpio1d_3516_pins[] = { 353, 311, 394, 374 };
163662306a36Sopenharmony_ci
163762306a36Sopenharmony_ci/* The GPIO2A (0-3) pins overlap with GMII GMAC1 and extended parallel flash */
163862306a36Sopenharmony_cistatic const unsigned int gpio2a_3516_pins[] = { 308, 369, 389, 329 };
163962306a36Sopenharmony_ci
164062306a36Sopenharmony_ci/* The GPIO2B (4-7) pins overlap with GMII GMAC1, extended parallel flash and LCD */
164162306a36Sopenharmony_cistatic const unsigned int gpio2b_3516_pins[] = { 391, 351, 310, 371 };
164262306a36Sopenharmony_ci
164362306a36Sopenharmony_ci/* The GPIO2C (8-31) pins overlap with PCI */
164462306a36Sopenharmony_cistatic const unsigned int gpio2c_3516_pins[] = {
164562306a36Sopenharmony_ci	259, 237, 238, 239, 215, 216, 217, 218, 177, 159, 158, 175, 176, 139,
164662306a36Sopenharmony_ci	157, 138, 137, 156, 118, 155, 99, 98, 136, 117
164762306a36Sopenharmony_ci};
164862306a36Sopenharmony_ci
164962306a36Sopenharmony_ci/* Groups for the 3516 SoC/package */
165062306a36Sopenharmony_cistatic const struct gemini_pin_group gemini_3516_pin_groups[] = {
165162306a36Sopenharmony_ci	{
165262306a36Sopenharmony_ci		.name = "gndgrp",
165362306a36Sopenharmony_ci		.pins = gnd_3516_pins,
165462306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gnd_3516_pins),
165562306a36Sopenharmony_ci	},
165662306a36Sopenharmony_ci	{
165762306a36Sopenharmony_ci		.name = "dramgrp",
165862306a36Sopenharmony_ci		.pins = dram_3516_pins,
165962306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(dram_3516_pins),
166062306a36Sopenharmony_ci		.mask = DRAM_PADS_POWERDOWN,
166162306a36Sopenharmony_ci	},
166262306a36Sopenharmony_ci	{
166362306a36Sopenharmony_ci		.name = "rtcgrp",
166462306a36Sopenharmony_ci		.pins = rtc_3516_pins,
166562306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(rtc_3516_pins),
166662306a36Sopenharmony_ci	},
166762306a36Sopenharmony_ci	{
166862306a36Sopenharmony_ci		.name = "powergrp",
166962306a36Sopenharmony_ci		.pins = power_3516_pins,
167062306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(power_3516_pins),
167162306a36Sopenharmony_ci	},
167262306a36Sopenharmony_ci	{
167362306a36Sopenharmony_ci		.name = "cirgrp",
167462306a36Sopenharmony_ci		.pins = cir_3516_pins,
167562306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(cir_3516_pins),
167662306a36Sopenharmony_ci	},
167762306a36Sopenharmony_ci	{
167862306a36Sopenharmony_ci		.name = "systemgrp",
167962306a36Sopenharmony_ci		.pins = system_3516_pins,
168062306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(system_3516_pins),
168162306a36Sopenharmony_ci	},
168262306a36Sopenharmony_ci	{
168362306a36Sopenharmony_ci		.name = "vcontrolgrp",
168462306a36Sopenharmony_ci		.pins = vcontrol_3516_pins,
168562306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(vcontrol_3516_pins),
168662306a36Sopenharmony_ci	},
168762306a36Sopenharmony_ci	{
168862306a36Sopenharmony_ci		.name = "icegrp",
168962306a36Sopenharmony_ci		.pins = ice_3516_pins,
169062306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(ice_3516_pins),
169162306a36Sopenharmony_ci		/* Conflict with some GPIO groups */
169262306a36Sopenharmony_ci	},
169362306a36Sopenharmony_ci	{
169462306a36Sopenharmony_ci		.name = "idegrp",
169562306a36Sopenharmony_ci		.pins = ide_3516_pins,
169662306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(ide_3516_pins),
169762306a36Sopenharmony_ci		/* Conflict with all flash usage */
169862306a36Sopenharmony_ci		.value = IDE_PADS_ENABLE | NAND_PADS_DISABLE |
169962306a36Sopenharmony_ci			PFLASH_PADS_DISABLE | SFLASH_PADS_DISABLE,
170062306a36Sopenharmony_ci		.driving_mask = GENMASK(21, 20),
170162306a36Sopenharmony_ci	},
170262306a36Sopenharmony_ci	{
170362306a36Sopenharmony_ci		.name = "satagrp",
170462306a36Sopenharmony_ci		.pins = sata_3516_pins,
170562306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(sata_3516_pins),
170662306a36Sopenharmony_ci	},
170762306a36Sopenharmony_ci	{
170862306a36Sopenharmony_ci		.name = "usbgrp",
170962306a36Sopenharmony_ci		.pins = usb_3516_pins,
171062306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(usb_3516_pins),
171162306a36Sopenharmony_ci	},
171262306a36Sopenharmony_ci	{
171362306a36Sopenharmony_ci		.name = "gmii_gmac0_grp",
171462306a36Sopenharmony_ci		.pins = gmii_gmac0_3516_pins,
171562306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gmii_gmac0_3516_pins),
171662306a36Sopenharmony_ci		.mask = GEMINI_GMAC_IOSEL_MASK,
171762306a36Sopenharmony_ci		.driving_mask = GENMASK(17, 16),
171862306a36Sopenharmony_ci	},
171962306a36Sopenharmony_ci	{
172062306a36Sopenharmony_ci		.name = "gmii_gmac1_grp",
172162306a36Sopenharmony_ci		.pins = gmii_gmac1_3516_pins,
172262306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gmii_gmac1_3516_pins),
172362306a36Sopenharmony_ci		/* Bring out RGMII on the GMAC1 pins */
172462306a36Sopenharmony_ci		.mask = GEMINI_GMAC_IOSEL_MASK,
172562306a36Sopenharmony_ci		.value = GEMINI_GMAC_IOSEL_GMAC0_GMAC1_RGMII,
172662306a36Sopenharmony_ci		.driving_mask = GENMASK(19, 18),
172762306a36Sopenharmony_ci	},
172862306a36Sopenharmony_ci	{
172962306a36Sopenharmony_ci		.name = "pcigrp",
173062306a36Sopenharmony_ci		.pins = pci_3516_pins,
173162306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(pci_3516_pins),
173262306a36Sopenharmony_ci		/* Conflict only with GPIO2 */
173362306a36Sopenharmony_ci		.value = PCI_PADS_ENABLE | PCI_CLK_PAD_ENABLE,
173462306a36Sopenharmony_ci		.driving_mask = GENMASK(23, 22),
173562306a36Sopenharmony_ci	},
173662306a36Sopenharmony_ci	{
173762306a36Sopenharmony_ci		.name = "lpcgrp",
173862306a36Sopenharmony_ci		.pins = lpc_3516_pins,
173962306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(lpc_3516_pins),
174062306a36Sopenharmony_ci		/* Conflict with SSP */
174162306a36Sopenharmony_ci		.mask = SSP_PADS_ENABLE,
174262306a36Sopenharmony_ci		.value = LPC_PADS_ENABLE | LPC_CLK_PAD_ENABLE,
174362306a36Sopenharmony_ci	},
174462306a36Sopenharmony_ci	{
174562306a36Sopenharmony_ci		.name = "lcdgrp",
174662306a36Sopenharmony_ci		.pins = lcd_3516_pins,
174762306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(lcd_3516_pins),
174862306a36Sopenharmony_ci		.mask = TVC_PADS_ENABLE,
174962306a36Sopenharmony_ci		.value = LCD_PADS_ENABLE,
175062306a36Sopenharmony_ci	},
175162306a36Sopenharmony_ci	{
175262306a36Sopenharmony_ci		.name = "sspgrp",
175362306a36Sopenharmony_ci		.pins = ssp_3516_pins,
175462306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(ssp_3516_pins),
175562306a36Sopenharmony_ci		/* Conflict with LPC */
175662306a36Sopenharmony_ci		.mask = LPC_PADS_ENABLE,
175762306a36Sopenharmony_ci		.value = SSP_PADS_ENABLE,
175862306a36Sopenharmony_ci	},
175962306a36Sopenharmony_ci	{
176062306a36Sopenharmony_ci		.name = "uartrxtxgrp",
176162306a36Sopenharmony_ci		.pins = uart_rxtx_3516_pins,
176262306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(uart_rxtx_3516_pins),
176362306a36Sopenharmony_ci		/* No conflicts except GPIO */
176462306a36Sopenharmony_ci	},
176562306a36Sopenharmony_ci	{
176662306a36Sopenharmony_ci		.name = "uartmodemgrp",
176762306a36Sopenharmony_ci		.pins = uart_modem_3516_pins,
176862306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(uart_modem_3516_pins),
176962306a36Sopenharmony_ci		/*
177062306a36Sopenharmony_ci		 * Conflict with LPC and SSP,
177162306a36Sopenharmony_ci		 * so when those are both disabled, modem UART can thrive.
177262306a36Sopenharmony_ci		 */
177362306a36Sopenharmony_ci		.mask = LPC_PADS_ENABLE | SSP_PADS_ENABLE,
177462306a36Sopenharmony_ci	},
177562306a36Sopenharmony_ci	{
177662306a36Sopenharmony_ci		.name = "tvcgrp",
177762306a36Sopenharmony_ci		.pins = tvc_3516_pins,
177862306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(tvc_3516_pins),
177962306a36Sopenharmony_ci		/* Conflict with character LCD */
178062306a36Sopenharmony_ci		.mask = LCD_PADS_ENABLE,
178162306a36Sopenharmony_ci		.value = TVC_PADS_ENABLE,
178262306a36Sopenharmony_ci	},
178362306a36Sopenharmony_ci	{
178462306a36Sopenharmony_ci		.name = "tvcclkgrp",
178562306a36Sopenharmony_ci		.pins = tvc_clk_3516_pins,
178662306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(tvc_clk_3516_pins),
178762306a36Sopenharmony_ci		.value = TVC_CLK_PAD_ENABLE,
178862306a36Sopenharmony_ci	},
178962306a36Sopenharmony_ci	/*
179062306a36Sopenharmony_ci	 * The construction is done such that it is possible to use a serial
179162306a36Sopenharmony_ci	 * flash together with a NAND or parallel (NOR) flash, but it is not
179262306a36Sopenharmony_ci	 * possible to use NAND and parallel flash together. To use serial
179362306a36Sopenharmony_ci	 * flash with one of the two others, the muxbits need to be flipped
179462306a36Sopenharmony_ci	 * around before any access.
179562306a36Sopenharmony_ci	 */
179662306a36Sopenharmony_ci	{
179762306a36Sopenharmony_ci		.name = "nflashgrp",
179862306a36Sopenharmony_ci		.pins = nflash_3516_pins,
179962306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(nflash_3516_pins),
180062306a36Sopenharmony_ci		/* Conflict with IDE, parallel and serial flash */
180162306a36Sopenharmony_ci		.mask = NAND_PADS_DISABLE | IDE_PADS_ENABLE,
180262306a36Sopenharmony_ci		.value = PFLASH_PADS_DISABLE | SFLASH_PADS_DISABLE,
180362306a36Sopenharmony_ci	},
180462306a36Sopenharmony_ci	{
180562306a36Sopenharmony_ci		.name = "pflashgrp",
180662306a36Sopenharmony_ci		.pins = pflash_3516_pins,
180762306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(pflash_3516_pins),
180862306a36Sopenharmony_ci		/* Conflict with IDE, NAND and serial flash */
180962306a36Sopenharmony_ci		.mask = PFLASH_PADS_DISABLE | IDE_PADS_ENABLE,
181062306a36Sopenharmony_ci		.value = NAND_PADS_DISABLE | SFLASH_PADS_DISABLE,
181162306a36Sopenharmony_ci	},
181262306a36Sopenharmony_ci	{
181362306a36Sopenharmony_ci		.name = "sflashgrp",
181462306a36Sopenharmony_ci		.pins = sflash_3516_pins,
181562306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(sflash_3516_pins),
181662306a36Sopenharmony_ci		/* Conflict with IDE, NAND and parallel flash */
181762306a36Sopenharmony_ci		.mask = SFLASH_PADS_DISABLE | IDE_PADS_ENABLE,
181862306a36Sopenharmony_ci		.value = NAND_PADS_DISABLE | PFLASH_PADS_DISABLE,
181962306a36Sopenharmony_ci	},
182062306a36Sopenharmony_ci	{
182162306a36Sopenharmony_ci		.name = "gpio0agrp",
182262306a36Sopenharmony_ci		.pins = gpio0a_3516_pins,
182362306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0a_3516_pins),
182462306a36Sopenharmony_ci		/* Conflict with TVC and ICE */
182562306a36Sopenharmony_ci		.mask = TVC_PADS_ENABLE,
182662306a36Sopenharmony_ci	},
182762306a36Sopenharmony_ci	{
182862306a36Sopenharmony_ci		.name = "gpio0bgrp",
182962306a36Sopenharmony_ci		.pins = gpio0b_3516_pins,
183062306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0b_3516_pins),
183162306a36Sopenharmony_ci		/* Conflict with ICE */
183262306a36Sopenharmony_ci	},
183362306a36Sopenharmony_ci	{
183462306a36Sopenharmony_ci		.name = "gpio0cgrp",
183562306a36Sopenharmony_ci		.pins = gpio0c_3516_pins,
183662306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0c_3516_pins),
183762306a36Sopenharmony_ci		/* Conflict with LPC, UART and SSP */
183862306a36Sopenharmony_ci		.mask = LPC_PADS_ENABLE | SSP_PADS_ENABLE,
183962306a36Sopenharmony_ci	},
184062306a36Sopenharmony_ci	{
184162306a36Sopenharmony_ci		.name = "gpio0dgrp",
184262306a36Sopenharmony_ci		.pins = gpio0d_3516_pins,
184362306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0d_3516_pins),
184462306a36Sopenharmony_ci		/* Conflict with UART */
184562306a36Sopenharmony_ci	},
184662306a36Sopenharmony_ci	{
184762306a36Sopenharmony_ci		.name = "gpio0egrp",
184862306a36Sopenharmony_ci		.pins = gpio0e_3516_pins,
184962306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0e_3516_pins),
185062306a36Sopenharmony_ci		/* Conflict with LCD */
185162306a36Sopenharmony_ci		.mask = LCD_PADS_ENABLE,
185262306a36Sopenharmony_ci	},
185362306a36Sopenharmony_ci	{
185462306a36Sopenharmony_ci		.name = "gpio0fgrp",
185562306a36Sopenharmony_ci		.pins = gpio0f_3516_pins,
185662306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0f_3516_pins),
185762306a36Sopenharmony_ci		/* Conflict with NAND flash */
185862306a36Sopenharmony_ci		.value = NAND_PADS_DISABLE,
185962306a36Sopenharmony_ci	},
186062306a36Sopenharmony_ci	{
186162306a36Sopenharmony_ci		.name = "gpio0ggrp",
186262306a36Sopenharmony_ci		.pins = gpio0g_3516_pins,
186362306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0g_3516_pins),
186462306a36Sopenharmony_ci		/* Conflict with parallel flash */
186562306a36Sopenharmony_ci		.value = PFLASH_PADS_DISABLE,
186662306a36Sopenharmony_ci	},
186762306a36Sopenharmony_ci	{
186862306a36Sopenharmony_ci		.name = "gpio0hgrp",
186962306a36Sopenharmony_ci		.pins = gpio0h_3516_pins,
187062306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0h_3516_pins),
187162306a36Sopenharmony_ci		/* Conflict with serial flash */
187262306a36Sopenharmony_ci		.value = SFLASH_PADS_DISABLE,
187362306a36Sopenharmony_ci	},
187462306a36Sopenharmony_ci	{
187562306a36Sopenharmony_ci		.name = "gpio0igrp",
187662306a36Sopenharmony_ci		.pins = gpio0i_3516_pins,
187762306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0i_3516_pins),
187862306a36Sopenharmony_ci		/* Conflict with all flash */
187962306a36Sopenharmony_ci		.value = PFLASH_PADS_DISABLE | NAND_PADS_DISABLE |
188062306a36Sopenharmony_ci			SFLASH_PADS_DISABLE,
188162306a36Sopenharmony_ci	},
188262306a36Sopenharmony_ci	{
188362306a36Sopenharmony_ci		.name = "gpio0jgrp",
188462306a36Sopenharmony_ci		.pins = gpio0j_3516_pins,
188562306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0j_3516_pins),
188662306a36Sopenharmony_ci		/* Conflict with all flash and LCD */
188762306a36Sopenharmony_ci		.mask = LCD_PADS_ENABLE,
188862306a36Sopenharmony_ci		.value = PFLASH_PADS_DISABLE | NAND_PADS_DISABLE |
188962306a36Sopenharmony_ci			SFLASH_PADS_DISABLE,
189062306a36Sopenharmony_ci	},
189162306a36Sopenharmony_ci	{
189262306a36Sopenharmony_ci		.name = "gpio0kgrp",
189362306a36Sopenharmony_ci		.pins = gpio0k_3516_pins,
189462306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0k_3516_pins),
189562306a36Sopenharmony_ci		/* Conflict with parallel and NAND flash */
189662306a36Sopenharmony_ci		.value = PFLASH_PADS_DISABLE | NAND_PADS_DISABLE,
189762306a36Sopenharmony_ci	},
189862306a36Sopenharmony_ci	{
189962306a36Sopenharmony_ci		.name = "gpio0lgrp",
190062306a36Sopenharmony_ci		.pins = gpio0l_3516_pins,
190162306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio0l_3516_pins),
190262306a36Sopenharmony_ci		/* Conflict with TVE CLK */
190362306a36Sopenharmony_ci		.mask = TVC_CLK_PAD_ENABLE,
190462306a36Sopenharmony_ci	},
190562306a36Sopenharmony_ci	{
190662306a36Sopenharmony_ci		.name = "gpio1agrp",
190762306a36Sopenharmony_ci		.pins = gpio1a_3516_pins,
190862306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio1a_3516_pins),
190962306a36Sopenharmony_ci		/* Conflict with IDE and parallel flash */
191062306a36Sopenharmony_ci		.mask = IDE_PADS_ENABLE,
191162306a36Sopenharmony_ci		.value = PFLASH_PADS_DISABLE,
191262306a36Sopenharmony_ci	},
191362306a36Sopenharmony_ci	{
191462306a36Sopenharmony_ci		.name = "gpio1bgrp",
191562306a36Sopenharmony_ci		.pins = gpio1b_3516_pins,
191662306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio1b_3516_pins),
191762306a36Sopenharmony_ci		/* Conflict with IDE only */
191862306a36Sopenharmony_ci		.mask = IDE_PADS_ENABLE,
191962306a36Sopenharmony_ci	},
192062306a36Sopenharmony_ci	{
192162306a36Sopenharmony_ci		.name = "gpio1cgrp",
192262306a36Sopenharmony_ci		.pins = gpio1c_3516_pins,
192362306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio1c_3516_pins),
192462306a36Sopenharmony_ci		/* Conflict with IDE, parallel and NAND flash */
192562306a36Sopenharmony_ci		.mask = IDE_PADS_ENABLE,
192662306a36Sopenharmony_ci		.value = NAND_PADS_DISABLE | PFLASH_PADS_DISABLE,
192762306a36Sopenharmony_ci	},
192862306a36Sopenharmony_ci	{
192962306a36Sopenharmony_ci		.name = "gpio1dgrp",
193062306a36Sopenharmony_ci		.pins = gpio1d_3516_pins,
193162306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio1d_3516_pins),
193262306a36Sopenharmony_ci		/* Conflict with TVC */
193362306a36Sopenharmony_ci		.mask = TVC_PADS_ENABLE,
193462306a36Sopenharmony_ci	},
193562306a36Sopenharmony_ci	{
193662306a36Sopenharmony_ci		.name = "gpio2agrp",
193762306a36Sopenharmony_ci		.pins = gpio2a_3516_pins,
193862306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio2a_3516_pins),
193962306a36Sopenharmony_ci		.mask = GEMINI_GMAC_IOSEL_GMAC0_GMAC1_RGMII,
194062306a36Sopenharmony_ci		/* Conflict with GMII GMAC1 and extended parallel flash */
194162306a36Sopenharmony_ci	},
194262306a36Sopenharmony_ci	{
194362306a36Sopenharmony_ci		.name = "gpio2bgrp",
194462306a36Sopenharmony_ci		.pins = gpio2b_3516_pins,
194562306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio2b_3516_pins),
194662306a36Sopenharmony_ci		/* Conflict with GMII GMAC1, extended parallel flash and LCD */
194762306a36Sopenharmony_ci		.mask = LCD_PADS_ENABLE | GEMINI_GMAC_IOSEL_GMAC0_GMAC1_RGMII,
194862306a36Sopenharmony_ci	},
194962306a36Sopenharmony_ci	{
195062306a36Sopenharmony_ci		.name = "gpio2cgrp",
195162306a36Sopenharmony_ci		.pins = gpio2c_3516_pins,
195262306a36Sopenharmony_ci		.num_pins = ARRAY_SIZE(gpio2c_3516_pins),
195362306a36Sopenharmony_ci		/* Conflict with PCI */
195462306a36Sopenharmony_ci		.mask = PCI_PADS_ENABLE,
195562306a36Sopenharmony_ci	},
195662306a36Sopenharmony_ci};
195762306a36Sopenharmony_ci
195862306a36Sopenharmony_cistatic int gemini_get_groups_count(struct pinctrl_dev *pctldev)
195962306a36Sopenharmony_ci{
196062306a36Sopenharmony_ci	struct gemini_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
196162306a36Sopenharmony_ci
196262306a36Sopenharmony_ci	if (pmx->is_3512)
196362306a36Sopenharmony_ci		return ARRAY_SIZE(gemini_3512_pin_groups);
196462306a36Sopenharmony_ci	if (pmx->is_3516)
196562306a36Sopenharmony_ci		return ARRAY_SIZE(gemini_3516_pin_groups);
196662306a36Sopenharmony_ci	return 0;
196762306a36Sopenharmony_ci}
196862306a36Sopenharmony_ci
196962306a36Sopenharmony_cistatic const char *gemini_get_group_name(struct pinctrl_dev *pctldev,
197062306a36Sopenharmony_ci					 unsigned int selector)
197162306a36Sopenharmony_ci{
197262306a36Sopenharmony_ci	struct gemini_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
197362306a36Sopenharmony_ci
197462306a36Sopenharmony_ci	if (pmx->is_3512)
197562306a36Sopenharmony_ci		return gemini_3512_pin_groups[selector].name;
197662306a36Sopenharmony_ci	if (pmx->is_3516)
197762306a36Sopenharmony_ci		return gemini_3516_pin_groups[selector].name;
197862306a36Sopenharmony_ci	return NULL;
197962306a36Sopenharmony_ci}
198062306a36Sopenharmony_ci
198162306a36Sopenharmony_cistatic int gemini_get_group_pins(struct pinctrl_dev *pctldev,
198262306a36Sopenharmony_ci				 unsigned int selector,
198362306a36Sopenharmony_ci				 const unsigned int **pins,
198462306a36Sopenharmony_ci				 unsigned int *num_pins)
198562306a36Sopenharmony_ci{
198662306a36Sopenharmony_ci	struct gemini_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
198762306a36Sopenharmony_ci
198862306a36Sopenharmony_ci	/* The special case with the 3516 flash pin */
198962306a36Sopenharmony_ci	if (pmx->flash_pin &&
199062306a36Sopenharmony_ci	    pmx->is_3512 &&
199162306a36Sopenharmony_ci	    !strcmp(gemini_3512_pin_groups[selector].name, "pflashgrp")) {
199262306a36Sopenharmony_ci		*pins = pflash_3512_pins_extended;
199362306a36Sopenharmony_ci		*num_pins = ARRAY_SIZE(pflash_3512_pins_extended);
199462306a36Sopenharmony_ci		return 0;
199562306a36Sopenharmony_ci	}
199662306a36Sopenharmony_ci	if (pmx->flash_pin &&
199762306a36Sopenharmony_ci	    pmx->is_3516 &&
199862306a36Sopenharmony_ci	    !strcmp(gemini_3516_pin_groups[selector].name, "pflashgrp")) {
199962306a36Sopenharmony_ci		*pins = pflash_3516_pins_extended;
200062306a36Sopenharmony_ci		*num_pins = ARRAY_SIZE(pflash_3516_pins_extended);
200162306a36Sopenharmony_ci		return 0;
200262306a36Sopenharmony_ci	}
200362306a36Sopenharmony_ci	if (pmx->is_3512) {
200462306a36Sopenharmony_ci		*pins = gemini_3512_pin_groups[selector].pins;
200562306a36Sopenharmony_ci		*num_pins = gemini_3512_pin_groups[selector].num_pins;
200662306a36Sopenharmony_ci	}
200762306a36Sopenharmony_ci	if (pmx->is_3516) {
200862306a36Sopenharmony_ci		*pins = gemini_3516_pin_groups[selector].pins;
200962306a36Sopenharmony_ci		*num_pins = gemini_3516_pin_groups[selector].num_pins;
201062306a36Sopenharmony_ci	}
201162306a36Sopenharmony_ci	return 0;
201262306a36Sopenharmony_ci}
201362306a36Sopenharmony_ci
201462306a36Sopenharmony_cistatic void gemini_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
201562306a36Sopenharmony_ci				unsigned int offset)
201662306a36Sopenharmony_ci{
201762306a36Sopenharmony_ci	seq_printf(s, " " DRIVER_NAME);
201862306a36Sopenharmony_ci}
201962306a36Sopenharmony_ci
202062306a36Sopenharmony_cistatic const struct pinctrl_ops gemini_pctrl_ops = {
202162306a36Sopenharmony_ci	.get_groups_count = gemini_get_groups_count,
202262306a36Sopenharmony_ci	.get_group_name = gemini_get_group_name,
202362306a36Sopenharmony_ci	.get_group_pins = gemini_get_group_pins,
202462306a36Sopenharmony_ci	.pin_dbg_show = gemini_pin_dbg_show,
202562306a36Sopenharmony_ci	.dt_node_to_map = pinconf_generic_dt_node_to_map_all,
202662306a36Sopenharmony_ci	.dt_free_map = pinconf_generic_dt_free_map,
202762306a36Sopenharmony_ci};
202862306a36Sopenharmony_ci
202962306a36Sopenharmony_ci/**
203062306a36Sopenharmony_ci * struct gemini_pmx_func - describes Gemini pinmux functions
203162306a36Sopenharmony_ci * @name: the name of this specific function
203262306a36Sopenharmony_ci * @groups: corresponding pin groups
203362306a36Sopenharmony_ci */
203462306a36Sopenharmony_cistruct gemini_pmx_func {
203562306a36Sopenharmony_ci	const char *name;
203662306a36Sopenharmony_ci	const char * const *groups;
203762306a36Sopenharmony_ci	const unsigned int num_groups;
203862306a36Sopenharmony_ci};
203962306a36Sopenharmony_ci
204062306a36Sopenharmony_cistatic const char * const dramgrps[] = { "dramgrp" };
204162306a36Sopenharmony_cistatic const char * const rtcgrps[] = { "rtcgrp" };
204262306a36Sopenharmony_cistatic const char * const powergrps[] = { "powergrp" };
204362306a36Sopenharmony_cistatic const char * const cirgrps[] = { "cirgrp" };
204462306a36Sopenharmony_cistatic const char * const systemgrps[] = { "systemgrp" };
204562306a36Sopenharmony_cistatic const char * const vcontrolgrps[] = { "vcontrolgrp" };
204662306a36Sopenharmony_cistatic const char * const icegrps[] = { "icegrp" };
204762306a36Sopenharmony_cistatic const char * const idegrps[] = { "idegrp" };
204862306a36Sopenharmony_cistatic const char * const satagrps[] = { "satagrp" };
204962306a36Sopenharmony_cistatic const char * const usbgrps[] = { "usbgrp" };
205062306a36Sopenharmony_cistatic const char * const gmiigrps[] = { "gmii_gmac0_grp", "gmii_gmac1_grp" };
205162306a36Sopenharmony_cistatic const char * const pcigrps[] = { "pcigrp" };
205262306a36Sopenharmony_cistatic const char * const lpcgrps[] = { "lpcgrp" };
205362306a36Sopenharmony_cistatic const char * const lcdgrps[] = { "lcdgrp" };
205462306a36Sopenharmony_cistatic const char * const sspgrps[] = { "sspgrp" };
205562306a36Sopenharmony_cistatic const char * const uartgrps[] = { "uartrxtxgrp", "uartmodemgrp" };
205662306a36Sopenharmony_cistatic const char * const tvcgrps[] = { "tvcgrp" };
205762306a36Sopenharmony_cistatic const char * const nflashgrps[] = { "nflashgrp" };
205862306a36Sopenharmony_cistatic const char * const pflashgrps[] = { "pflashgrp", "pflashextgrp" };
205962306a36Sopenharmony_cistatic const char * const sflashgrps[] = { "sflashgrp" };
206062306a36Sopenharmony_cistatic const char * const gpio0grps[] = { "gpio0agrp", "gpio0bgrp", "gpio0cgrp",
206162306a36Sopenharmony_ci					  "gpio0dgrp", "gpio0egrp", "gpio0fgrp",
206262306a36Sopenharmony_ci					  "gpio0ggrp", "gpio0hgrp", "gpio0igrp",
206362306a36Sopenharmony_ci					  "gpio0jgrp", "gpio0kgrp", "gpio0lgrp",
206462306a36Sopenharmony_ci					  "gpio0mgrp" };
206562306a36Sopenharmony_cistatic const char * const gpio1grps[] = { "gpio1agrp", "gpio1bgrp", "gpio1cgrp",
206662306a36Sopenharmony_ci					  "gpio1dgrp" };
206762306a36Sopenharmony_cistatic const char * const gpio2grps[] = { "gpio2agrp", "gpio2bgrp", "gpio2cgrp" };
206862306a36Sopenharmony_ci
206962306a36Sopenharmony_cistatic const struct gemini_pmx_func gemini_pmx_functions[] = {
207062306a36Sopenharmony_ci	{
207162306a36Sopenharmony_ci		.name = "dram",
207262306a36Sopenharmony_ci		.groups = dramgrps,
207362306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(idegrps),
207462306a36Sopenharmony_ci	},
207562306a36Sopenharmony_ci	{
207662306a36Sopenharmony_ci		.name = "rtc",
207762306a36Sopenharmony_ci		.groups = rtcgrps,
207862306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(rtcgrps),
207962306a36Sopenharmony_ci	},
208062306a36Sopenharmony_ci	{
208162306a36Sopenharmony_ci		.name = "power",
208262306a36Sopenharmony_ci		.groups = powergrps,
208362306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(powergrps),
208462306a36Sopenharmony_ci	},
208562306a36Sopenharmony_ci	{
208662306a36Sopenharmony_ci		/* This function is strictly unavailable on 3512 */
208762306a36Sopenharmony_ci		.name = "cir",
208862306a36Sopenharmony_ci		.groups = cirgrps,
208962306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(cirgrps),
209062306a36Sopenharmony_ci	},
209162306a36Sopenharmony_ci	{
209262306a36Sopenharmony_ci		.name = "system",
209362306a36Sopenharmony_ci		.groups = systemgrps,
209462306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(systemgrps),
209562306a36Sopenharmony_ci	},
209662306a36Sopenharmony_ci	{
209762306a36Sopenharmony_ci		.name = "vcontrol",
209862306a36Sopenharmony_ci		.groups = vcontrolgrps,
209962306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(vcontrolgrps),
210062306a36Sopenharmony_ci	},
210162306a36Sopenharmony_ci	{
210262306a36Sopenharmony_ci		.name = "ice",
210362306a36Sopenharmony_ci		.groups = icegrps,
210462306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(icegrps),
210562306a36Sopenharmony_ci	},
210662306a36Sopenharmony_ci	{
210762306a36Sopenharmony_ci		.name = "ide",
210862306a36Sopenharmony_ci		.groups = idegrps,
210962306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(idegrps),
211062306a36Sopenharmony_ci	},
211162306a36Sopenharmony_ci	{
211262306a36Sopenharmony_ci		.name = "sata",
211362306a36Sopenharmony_ci		.groups = satagrps,
211462306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(satagrps),
211562306a36Sopenharmony_ci	},
211662306a36Sopenharmony_ci	{
211762306a36Sopenharmony_ci		.name = "usb",
211862306a36Sopenharmony_ci		.groups = usbgrps,
211962306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(usbgrps),
212062306a36Sopenharmony_ci	},
212162306a36Sopenharmony_ci	{
212262306a36Sopenharmony_ci		.name = "gmii",
212362306a36Sopenharmony_ci		.groups = gmiigrps,
212462306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(gmiigrps),
212562306a36Sopenharmony_ci	},
212662306a36Sopenharmony_ci	{
212762306a36Sopenharmony_ci		.name = "pci",
212862306a36Sopenharmony_ci		.groups = pcigrps,
212962306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(pcigrps),
213062306a36Sopenharmony_ci	},
213162306a36Sopenharmony_ci	{
213262306a36Sopenharmony_ci		.name = "lpc",
213362306a36Sopenharmony_ci		.groups = lpcgrps,
213462306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(lpcgrps),
213562306a36Sopenharmony_ci	},
213662306a36Sopenharmony_ci	{
213762306a36Sopenharmony_ci		.name = "lcd",
213862306a36Sopenharmony_ci		.groups = lcdgrps,
213962306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(lcdgrps),
214062306a36Sopenharmony_ci	},
214162306a36Sopenharmony_ci	{
214262306a36Sopenharmony_ci		.name = "ssp",
214362306a36Sopenharmony_ci		.groups = sspgrps,
214462306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(sspgrps),
214562306a36Sopenharmony_ci	},
214662306a36Sopenharmony_ci	{
214762306a36Sopenharmony_ci		.name = "uart",
214862306a36Sopenharmony_ci		.groups = uartgrps,
214962306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(uartgrps),
215062306a36Sopenharmony_ci	},
215162306a36Sopenharmony_ci	{
215262306a36Sopenharmony_ci		.name = "tvc",
215362306a36Sopenharmony_ci		.groups = tvcgrps,
215462306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(tvcgrps),
215562306a36Sopenharmony_ci	},
215662306a36Sopenharmony_ci	{
215762306a36Sopenharmony_ci		.name = "nflash",
215862306a36Sopenharmony_ci		.groups = nflashgrps,
215962306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(nflashgrps),
216062306a36Sopenharmony_ci	},
216162306a36Sopenharmony_ci	{
216262306a36Sopenharmony_ci		.name = "pflash",
216362306a36Sopenharmony_ci		.groups = pflashgrps,
216462306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(pflashgrps),
216562306a36Sopenharmony_ci	},
216662306a36Sopenharmony_ci	{
216762306a36Sopenharmony_ci		.name = "sflash",
216862306a36Sopenharmony_ci		.groups = sflashgrps,
216962306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(sflashgrps),
217062306a36Sopenharmony_ci	},
217162306a36Sopenharmony_ci	{
217262306a36Sopenharmony_ci		.name = "gpio0",
217362306a36Sopenharmony_ci		.groups = gpio0grps,
217462306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(gpio0grps),
217562306a36Sopenharmony_ci	},
217662306a36Sopenharmony_ci	{
217762306a36Sopenharmony_ci		.name = "gpio1",
217862306a36Sopenharmony_ci		.groups = gpio1grps,
217962306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(gpio1grps),
218062306a36Sopenharmony_ci	},
218162306a36Sopenharmony_ci	{
218262306a36Sopenharmony_ci		.name = "gpio2",
218362306a36Sopenharmony_ci		.groups = gpio2grps,
218462306a36Sopenharmony_ci		.num_groups = ARRAY_SIZE(gpio2grps),
218562306a36Sopenharmony_ci	},
218662306a36Sopenharmony_ci};
218762306a36Sopenharmony_ci
218862306a36Sopenharmony_ci
218962306a36Sopenharmony_cistatic int gemini_pmx_set_mux(struct pinctrl_dev *pctldev,
219062306a36Sopenharmony_ci			      unsigned int selector,
219162306a36Sopenharmony_ci			      unsigned int group)
219262306a36Sopenharmony_ci{
219362306a36Sopenharmony_ci	struct gemini_pmx *pmx;
219462306a36Sopenharmony_ci	const struct gemini_pmx_func *func;
219562306a36Sopenharmony_ci	const struct gemini_pin_group *grp;
219662306a36Sopenharmony_ci	u32 before, after, expected;
219762306a36Sopenharmony_ci	unsigned long tmp;
219862306a36Sopenharmony_ci	int i;
219962306a36Sopenharmony_ci
220062306a36Sopenharmony_ci	pmx = pinctrl_dev_get_drvdata(pctldev);
220162306a36Sopenharmony_ci
220262306a36Sopenharmony_ci	func = &gemini_pmx_functions[selector];
220362306a36Sopenharmony_ci	if (pmx->is_3512)
220462306a36Sopenharmony_ci		grp = &gemini_3512_pin_groups[group];
220562306a36Sopenharmony_ci	else if (pmx->is_3516)
220662306a36Sopenharmony_ci		grp = &gemini_3516_pin_groups[group];
220762306a36Sopenharmony_ci	else {
220862306a36Sopenharmony_ci		dev_err(pmx->dev, "invalid SoC type\n");
220962306a36Sopenharmony_ci		return -ENODEV;
221062306a36Sopenharmony_ci	}
221162306a36Sopenharmony_ci
221262306a36Sopenharmony_ci	dev_dbg(pmx->dev,
221362306a36Sopenharmony_ci		"ACTIVATE function \"%s\" with group \"%s\"\n",
221462306a36Sopenharmony_ci		func->name, grp->name);
221562306a36Sopenharmony_ci
221662306a36Sopenharmony_ci	regmap_read(pmx->map, GLOBAL_MISC_CTRL, &before);
221762306a36Sopenharmony_ci	regmap_update_bits(pmx->map, GLOBAL_MISC_CTRL,
221862306a36Sopenharmony_ci			   grp->mask | grp->value,
221962306a36Sopenharmony_ci			   grp->value);
222062306a36Sopenharmony_ci	regmap_read(pmx->map, GLOBAL_MISC_CTRL, &after);
222162306a36Sopenharmony_ci
222262306a36Sopenharmony_ci	/* Which bits changed */
222362306a36Sopenharmony_ci	before &= PADS_MASK;
222462306a36Sopenharmony_ci	after &= PADS_MASK;
222562306a36Sopenharmony_ci	expected = before &= ~grp->mask;
222662306a36Sopenharmony_ci	expected |= grp->value;
222762306a36Sopenharmony_ci	expected &= PADS_MASK;
222862306a36Sopenharmony_ci
222962306a36Sopenharmony_ci	/* Print changed states */
223062306a36Sopenharmony_ci	tmp = grp->mask;
223162306a36Sopenharmony_ci	for_each_set_bit(i, &tmp, PADS_MAXBIT) {
223262306a36Sopenharmony_ci		bool enabled = !(i > 3);
223362306a36Sopenharmony_ci
223462306a36Sopenharmony_ci		/* Did not go low though it should */
223562306a36Sopenharmony_ci		if (after & BIT(i)) {
223662306a36Sopenharmony_ci			dev_err(pmx->dev,
223762306a36Sopenharmony_ci				"pin group %s could not be %s: "
223862306a36Sopenharmony_ci				"probably a hardware limitation\n",
223962306a36Sopenharmony_ci				gemini_padgroups[i],
224062306a36Sopenharmony_ci				enabled ? "enabled" : "disabled");
224162306a36Sopenharmony_ci			dev_err(pmx->dev,
224262306a36Sopenharmony_ci				"GLOBAL MISC CTRL before: %08x, after %08x, expected %08x\n",
224362306a36Sopenharmony_ci				before, after, expected);
224462306a36Sopenharmony_ci		} else {
224562306a36Sopenharmony_ci			dev_dbg(pmx->dev,
224662306a36Sopenharmony_ci				"padgroup %s %s\n",
224762306a36Sopenharmony_ci				gemini_padgroups[i],
224862306a36Sopenharmony_ci				enabled ? "enabled" : "disabled");
224962306a36Sopenharmony_ci		}
225062306a36Sopenharmony_ci	}
225162306a36Sopenharmony_ci
225262306a36Sopenharmony_ci	tmp = grp->value;
225362306a36Sopenharmony_ci	for_each_set_bit(i, &tmp, PADS_MAXBIT) {
225462306a36Sopenharmony_ci		bool enabled = (i > 3);
225562306a36Sopenharmony_ci
225662306a36Sopenharmony_ci		/* Did not go high though it should */
225762306a36Sopenharmony_ci		if (!(after & BIT(i))) {
225862306a36Sopenharmony_ci			dev_err(pmx->dev,
225962306a36Sopenharmony_ci				"pin group %s could not be %s: "
226062306a36Sopenharmony_ci				"probably a hardware limitation\n",
226162306a36Sopenharmony_ci				gemini_padgroups[i],
226262306a36Sopenharmony_ci				enabled ? "enabled" : "disabled");
226362306a36Sopenharmony_ci			dev_err(pmx->dev,
226462306a36Sopenharmony_ci				"GLOBAL MISC CTRL before: %08x, after %08x, expected %08x\n",
226562306a36Sopenharmony_ci				before, after, expected);
226662306a36Sopenharmony_ci		} else {
226762306a36Sopenharmony_ci			dev_dbg(pmx->dev,
226862306a36Sopenharmony_ci				"padgroup %s %s\n",
226962306a36Sopenharmony_ci				gemini_padgroups[i],
227062306a36Sopenharmony_ci				enabled ? "enabled" : "disabled");
227162306a36Sopenharmony_ci		}
227262306a36Sopenharmony_ci	}
227362306a36Sopenharmony_ci
227462306a36Sopenharmony_ci	return 0;
227562306a36Sopenharmony_ci}
227662306a36Sopenharmony_ci
227762306a36Sopenharmony_cistatic int gemini_pmx_get_funcs_count(struct pinctrl_dev *pctldev)
227862306a36Sopenharmony_ci{
227962306a36Sopenharmony_ci	return ARRAY_SIZE(gemini_pmx_functions);
228062306a36Sopenharmony_ci}
228162306a36Sopenharmony_ci
228262306a36Sopenharmony_cistatic const char *gemini_pmx_get_func_name(struct pinctrl_dev *pctldev,
228362306a36Sopenharmony_ci					    unsigned int selector)
228462306a36Sopenharmony_ci{
228562306a36Sopenharmony_ci	return gemini_pmx_functions[selector].name;
228662306a36Sopenharmony_ci}
228762306a36Sopenharmony_ci
228862306a36Sopenharmony_cistatic int gemini_pmx_get_groups(struct pinctrl_dev *pctldev,
228962306a36Sopenharmony_ci				 unsigned int selector,
229062306a36Sopenharmony_ci				 const char * const **groups,
229162306a36Sopenharmony_ci				 unsigned int * const num_groups)
229262306a36Sopenharmony_ci{
229362306a36Sopenharmony_ci	*groups = gemini_pmx_functions[selector].groups;
229462306a36Sopenharmony_ci	*num_groups = gemini_pmx_functions[selector].num_groups;
229562306a36Sopenharmony_ci	return 0;
229662306a36Sopenharmony_ci}
229762306a36Sopenharmony_ci
229862306a36Sopenharmony_cistatic const struct pinmux_ops gemini_pmx_ops = {
229962306a36Sopenharmony_ci	.get_functions_count = gemini_pmx_get_funcs_count,
230062306a36Sopenharmony_ci	.get_function_name = gemini_pmx_get_func_name,
230162306a36Sopenharmony_ci	.get_function_groups = gemini_pmx_get_groups,
230262306a36Sopenharmony_ci	.set_mux = gemini_pmx_set_mux,
230362306a36Sopenharmony_ci};
230462306a36Sopenharmony_ci
230562306a36Sopenharmony_ci#define GEMINI_CFGPIN(_n, _r, _lb, _hb) {	\
230662306a36Sopenharmony_ci	.pin = _n,				\
230762306a36Sopenharmony_ci	.reg = _r,				\
230862306a36Sopenharmony_ci	.mask = GENMASK(_hb, _lb)		\
230962306a36Sopenharmony_ci}
231062306a36Sopenharmony_ci
231162306a36Sopenharmony_cistatic const struct gemini_pin_conf gemini_confs_3512[] = {
231262306a36Sopenharmony_ci	GEMINI_CFGPIN(259, GLOBAL_GMAC_CTRL_SKEW, 0, 3), /* GMAC0 RXDV */
231362306a36Sopenharmony_ci	GEMINI_CFGPIN(277, GLOBAL_GMAC_CTRL_SKEW, 4, 7), /* GMAC0 RXC */
231462306a36Sopenharmony_ci	GEMINI_CFGPIN(241, GLOBAL_GMAC_CTRL_SKEW, 8, 11), /* GMAC0 TXEN */
231562306a36Sopenharmony_ci	GEMINI_CFGPIN(312, GLOBAL_GMAC_CTRL_SKEW, 12, 15), /* GMAC0 TXC */
231662306a36Sopenharmony_ci	GEMINI_CFGPIN(298, GLOBAL_GMAC_CTRL_SKEW, 16, 19), /* GMAC1 RXDV */
231762306a36Sopenharmony_ci	GEMINI_CFGPIN(280, GLOBAL_GMAC_CTRL_SKEW, 20, 23), /* GMAC1 RXC */
231862306a36Sopenharmony_ci	GEMINI_CFGPIN(316, GLOBAL_GMAC_CTRL_SKEW, 24, 27), /* GMAC1 TXEN */
231962306a36Sopenharmony_ci	GEMINI_CFGPIN(243, GLOBAL_GMAC_CTRL_SKEW, 28, 31), /* GMAC1 TXC */
232062306a36Sopenharmony_ci	GEMINI_CFGPIN(295, GLOBAL_GMAC0_DATA_SKEW, 0, 3), /* GMAC0 RXD0 */
232162306a36Sopenharmony_ci	GEMINI_CFGPIN(313, GLOBAL_GMAC0_DATA_SKEW, 4, 7), /* GMAC0 RXD1 */
232262306a36Sopenharmony_ci	GEMINI_CFGPIN(242, GLOBAL_GMAC0_DATA_SKEW, 8, 11), /* GMAC0 RXD2 */
232362306a36Sopenharmony_ci	GEMINI_CFGPIN(260, GLOBAL_GMAC0_DATA_SKEW, 12, 15), /* GMAC0 RXD3 */
232462306a36Sopenharmony_ci	GEMINI_CFGPIN(294, GLOBAL_GMAC0_DATA_SKEW, 16, 19), /* GMAC0 TXD0 */
232562306a36Sopenharmony_ci	GEMINI_CFGPIN(276, GLOBAL_GMAC0_DATA_SKEW, 20, 23), /* GMAC0 TXD1 */
232662306a36Sopenharmony_ci	GEMINI_CFGPIN(258, GLOBAL_GMAC0_DATA_SKEW, 24, 27), /* GMAC0 TXD2 */
232762306a36Sopenharmony_ci	GEMINI_CFGPIN(240, GLOBAL_GMAC0_DATA_SKEW, 28, 31), /* GMAC0 TXD3 */
232862306a36Sopenharmony_ci	GEMINI_CFGPIN(262, GLOBAL_GMAC1_DATA_SKEW, 0, 3), /* GMAC1 RXD0 */
232962306a36Sopenharmony_ci	GEMINI_CFGPIN(244, GLOBAL_GMAC1_DATA_SKEW, 4, 7), /* GMAC1 RXD1 */
233062306a36Sopenharmony_ci	GEMINI_CFGPIN(317, GLOBAL_GMAC1_DATA_SKEW, 8, 11), /* GMAC1 RXD2 */
233162306a36Sopenharmony_ci	GEMINI_CFGPIN(299, GLOBAL_GMAC1_DATA_SKEW, 12, 15), /* GMAC1 RXD3 */
233262306a36Sopenharmony_ci	GEMINI_CFGPIN(261, GLOBAL_GMAC1_DATA_SKEW, 16, 19), /* GMAC1 TXD0 */
233362306a36Sopenharmony_ci	GEMINI_CFGPIN(279, GLOBAL_GMAC1_DATA_SKEW, 20, 23), /* GMAC1 TXD1 */
233462306a36Sopenharmony_ci	GEMINI_CFGPIN(297, GLOBAL_GMAC1_DATA_SKEW, 24, 27), /* GMAC1 TXD2 */
233562306a36Sopenharmony_ci	GEMINI_CFGPIN(315, GLOBAL_GMAC1_DATA_SKEW, 28, 31), /* GMAC1 TXD3 */
233662306a36Sopenharmony_ci};
233762306a36Sopenharmony_ci
233862306a36Sopenharmony_cistatic const struct gemini_pin_conf gemini_confs_3516[] = {
233962306a36Sopenharmony_ci	GEMINI_CFGPIN(347, GLOBAL_GMAC_CTRL_SKEW, 0, 3), /* GMAC0 RXDV */
234062306a36Sopenharmony_ci	GEMINI_CFGPIN(386, GLOBAL_GMAC_CTRL_SKEW, 4, 7), /* GMAC0 RXC */
234162306a36Sopenharmony_ci	GEMINI_CFGPIN(307, GLOBAL_GMAC_CTRL_SKEW, 8, 11), /* GMAC0 TXEN */
234262306a36Sopenharmony_ci	GEMINI_CFGPIN(327, GLOBAL_GMAC_CTRL_SKEW, 12, 15), /* GMAC0 TXC */
234362306a36Sopenharmony_ci	GEMINI_CFGPIN(309, GLOBAL_GMAC_CTRL_SKEW, 16, 19), /* GMAC1 RXDV */
234462306a36Sopenharmony_ci	GEMINI_CFGPIN(390, GLOBAL_GMAC_CTRL_SKEW, 20, 23), /* GMAC1 RXC */
234562306a36Sopenharmony_ci	GEMINI_CFGPIN(370, GLOBAL_GMAC_CTRL_SKEW, 24, 27), /* GMAC1 TXEN */
234662306a36Sopenharmony_ci	GEMINI_CFGPIN(350, GLOBAL_GMAC_CTRL_SKEW, 28, 31), /* GMAC1 TXC */
234762306a36Sopenharmony_ci	GEMINI_CFGPIN(367, GLOBAL_GMAC0_DATA_SKEW, 0, 3), /* GMAC0 RXD0 */
234862306a36Sopenharmony_ci	GEMINI_CFGPIN(348, GLOBAL_GMAC0_DATA_SKEW, 4, 7), /* GMAC0 RXD1 */
234962306a36Sopenharmony_ci	GEMINI_CFGPIN(387, GLOBAL_GMAC0_DATA_SKEW, 8, 11), /* GMAC0 RXD2 */
235062306a36Sopenharmony_ci	GEMINI_CFGPIN(328, GLOBAL_GMAC0_DATA_SKEW, 12, 15), /* GMAC0 RXD3 */
235162306a36Sopenharmony_ci	GEMINI_CFGPIN(306, GLOBAL_GMAC0_DATA_SKEW, 16, 19), /* GMAC0 TXD0 */
235262306a36Sopenharmony_ci	GEMINI_CFGPIN(325, GLOBAL_GMAC0_DATA_SKEW, 20, 23), /* GMAC0 TXD1 */
235362306a36Sopenharmony_ci	GEMINI_CFGPIN(346, GLOBAL_GMAC0_DATA_SKEW, 24, 27), /* GMAC0 TXD2 */
235462306a36Sopenharmony_ci	GEMINI_CFGPIN(326, GLOBAL_GMAC0_DATA_SKEW, 28, 31), /* GMAC0 TXD3 */
235562306a36Sopenharmony_ci	GEMINI_CFGPIN(391, GLOBAL_GMAC1_DATA_SKEW, 0, 3), /* GMAC1 RXD0 */
235662306a36Sopenharmony_ci	GEMINI_CFGPIN(351, GLOBAL_GMAC1_DATA_SKEW, 4, 7), /* GMAC1 RXD1 */
235762306a36Sopenharmony_ci	GEMINI_CFGPIN(310, GLOBAL_GMAC1_DATA_SKEW, 8, 11), /* GMAC1 RXD2 */
235862306a36Sopenharmony_ci	GEMINI_CFGPIN(371, GLOBAL_GMAC1_DATA_SKEW, 12, 15), /* GMAC1 RXD3 */
235962306a36Sopenharmony_ci	GEMINI_CFGPIN(329, GLOBAL_GMAC1_DATA_SKEW, 16, 19), /* GMAC1 TXD0 */
236062306a36Sopenharmony_ci	GEMINI_CFGPIN(389, GLOBAL_GMAC1_DATA_SKEW, 20, 23), /* GMAC1 TXD1 */
236162306a36Sopenharmony_ci	GEMINI_CFGPIN(369, GLOBAL_GMAC1_DATA_SKEW, 24, 27), /* GMAC1 TXD2 */
236262306a36Sopenharmony_ci	GEMINI_CFGPIN(308, GLOBAL_GMAC1_DATA_SKEW, 28, 31), /* GMAC1 TXD3 */
236362306a36Sopenharmony_ci};
236462306a36Sopenharmony_ci
236562306a36Sopenharmony_cistatic const struct gemini_pin_conf *gemini_get_pin_conf(struct gemini_pmx *pmx,
236662306a36Sopenharmony_ci							 unsigned int pin)
236762306a36Sopenharmony_ci{
236862306a36Sopenharmony_ci	const struct gemini_pin_conf *retconf;
236962306a36Sopenharmony_ci	int i;
237062306a36Sopenharmony_ci
237162306a36Sopenharmony_ci	for (i = 0; i < pmx->nconfs; i++) {
237262306a36Sopenharmony_ci		retconf = &pmx->confs[i];
237362306a36Sopenharmony_ci		if (retconf->pin == pin)
237462306a36Sopenharmony_ci			return retconf;
237562306a36Sopenharmony_ci	}
237662306a36Sopenharmony_ci	return NULL;
237762306a36Sopenharmony_ci}
237862306a36Sopenharmony_ci
237962306a36Sopenharmony_cistatic int gemini_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin,
238062306a36Sopenharmony_ci			      unsigned long *config)
238162306a36Sopenharmony_ci{
238262306a36Sopenharmony_ci	struct gemini_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
238362306a36Sopenharmony_ci	enum pin_config_param param = pinconf_to_config_param(*config);
238462306a36Sopenharmony_ci	const struct gemini_pin_conf *conf;
238562306a36Sopenharmony_ci	u32 val;
238662306a36Sopenharmony_ci
238762306a36Sopenharmony_ci	switch (param) {
238862306a36Sopenharmony_ci	case PIN_CONFIG_SKEW_DELAY:
238962306a36Sopenharmony_ci		conf = gemini_get_pin_conf(pmx, pin);
239062306a36Sopenharmony_ci		if (!conf)
239162306a36Sopenharmony_ci			return -ENOTSUPP;
239262306a36Sopenharmony_ci		regmap_read(pmx->map, conf->reg, &val);
239362306a36Sopenharmony_ci		val &= conf->mask;
239462306a36Sopenharmony_ci		val >>= (ffs(conf->mask) - 1);
239562306a36Sopenharmony_ci		*config = pinconf_to_config_packed(PIN_CONFIG_SKEW_DELAY, val);
239662306a36Sopenharmony_ci		break;
239762306a36Sopenharmony_ci	default:
239862306a36Sopenharmony_ci		return -ENOTSUPP;
239962306a36Sopenharmony_ci	}
240062306a36Sopenharmony_ci
240162306a36Sopenharmony_ci	return 0;
240262306a36Sopenharmony_ci}
240362306a36Sopenharmony_ci
240462306a36Sopenharmony_cistatic int gemini_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
240562306a36Sopenharmony_ci			      unsigned long *configs, unsigned int num_configs)
240662306a36Sopenharmony_ci{
240762306a36Sopenharmony_ci	struct gemini_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
240862306a36Sopenharmony_ci	const struct gemini_pin_conf *conf;
240962306a36Sopenharmony_ci	enum pin_config_param param;
241062306a36Sopenharmony_ci	u32 arg;
241162306a36Sopenharmony_ci	int ret = 0;
241262306a36Sopenharmony_ci	int i;
241362306a36Sopenharmony_ci
241462306a36Sopenharmony_ci	for (i = 0; i < num_configs; i++) {
241562306a36Sopenharmony_ci		param = pinconf_to_config_param(configs[i]);
241662306a36Sopenharmony_ci		arg = pinconf_to_config_argument(configs[i]);
241762306a36Sopenharmony_ci
241862306a36Sopenharmony_ci		switch (param) {
241962306a36Sopenharmony_ci		case PIN_CONFIG_SKEW_DELAY:
242062306a36Sopenharmony_ci			if (arg > 0xf)
242162306a36Sopenharmony_ci				return -EINVAL;
242262306a36Sopenharmony_ci			conf = gemini_get_pin_conf(pmx, pin);
242362306a36Sopenharmony_ci			if (!conf) {
242462306a36Sopenharmony_ci				dev_err(pmx->dev,
242562306a36Sopenharmony_ci					"invalid pin for skew delay %d\n", pin);
242662306a36Sopenharmony_ci				return -ENOTSUPP;
242762306a36Sopenharmony_ci			}
242862306a36Sopenharmony_ci			arg <<= (ffs(conf->mask) - 1);
242962306a36Sopenharmony_ci			dev_dbg(pmx->dev,
243062306a36Sopenharmony_ci				"set pin %d to skew delay mask %08x, val %08x\n",
243162306a36Sopenharmony_ci				pin, conf->mask, arg);
243262306a36Sopenharmony_ci			regmap_update_bits(pmx->map, conf->reg, conf->mask, arg);
243362306a36Sopenharmony_ci			break;
243462306a36Sopenharmony_ci		default:
243562306a36Sopenharmony_ci			dev_err(pmx->dev, "Invalid config param %04x\n", param);
243662306a36Sopenharmony_ci			return -ENOTSUPP;
243762306a36Sopenharmony_ci		}
243862306a36Sopenharmony_ci	}
243962306a36Sopenharmony_ci
244062306a36Sopenharmony_ci	return ret;
244162306a36Sopenharmony_ci}
244262306a36Sopenharmony_ci
244362306a36Sopenharmony_cistatic int gemini_pinconf_group_set(struct pinctrl_dev *pctldev,
244462306a36Sopenharmony_ci				    unsigned selector,
244562306a36Sopenharmony_ci				    unsigned long *configs,
244662306a36Sopenharmony_ci				    unsigned num_configs)
244762306a36Sopenharmony_ci{
244862306a36Sopenharmony_ci	struct gemini_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
244962306a36Sopenharmony_ci	const struct gemini_pin_group *grp = NULL;
245062306a36Sopenharmony_ci	enum pin_config_param param;
245162306a36Sopenharmony_ci	u32 arg;
245262306a36Sopenharmony_ci	u32 val;
245362306a36Sopenharmony_ci	int i;
245462306a36Sopenharmony_ci
245562306a36Sopenharmony_ci	if (pmx->is_3512)
245662306a36Sopenharmony_ci		grp = &gemini_3512_pin_groups[selector];
245762306a36Sopenharmony_ci	if (pmx->is_3516)
245862306a36Sopenharmony_ci		grp = &gemini_3516_pin_groups[selector];
245962306a36Sopenharmony_ci
246062306a36Sopenharmony_ci	/* First figure out if this group supports configs */
246162306a36Sopenharmony_ci	if (!grp->driving_mask) {
246262306a36Sopenharmony_ci		dev_err(pmx->dev, "pin config group \"%s\" does "
246362306a36Sopenharmony_ci			"not support drive strength setting\n",
246462306a36Sopenharmony_ci			grp->name);
246562306a36Sopenharmony_ci		return -EINVAL;
246662306a36Sopenharmony_ci	}
246762306a36Sopenharmony_ci
246862306a36Sopenharmony_ci	for (i = 0; i < num_configs; i++) {
246962306a36Sopenharmony_ci		param = pinconf_to_config_param(configs[i]);
247062306a36Sopenharmony_ci		arg = pinconf_to_config_argument(configs[i]);
247162306a36Sopenharmony_ci
247262306a36Sopenharmony_ci		switch (param) {
247362306a36Sopenharmony_ci		case PIN_CONFIG_DRIVE_STRENGTH:
247462306a36Sopenharmony_ci			switch (arg) {
247562306a36Sopenharmony_ci			case 4:
247662306a36Sopenharmony_ci				val = 0;
247762306a36Sopenharmony_ci				break;
247862306a36Sopenharmony_ci			case 8:
247962306a36Sopenharmony_ci				val = 1;
248062306a36Sopenharmony_ci				break;
248162306a36Sopenharmony_ci			case 12:
248262306a36Sopenharmony_ci				val = 2;
248362306a36Sopenharmony_ci				break;
248462306a36Sopenharmony_ci			case 16:
248562306a36Sopenharmony_ci				val = 3;
248662306a36Sopenharmony_ci				break;
248762306a36Sopenharmony_ci			default:
248862306a36Sopenharmony_ci				dev_err(pmx->dev,
248962306a36Sopenharmony_ci					"invalid drive strength %d mA\n",
249062306a36Sopenharmony_ci					arg);
249162306a36Sopenharmony_ci				return -ENOTSUPP;
249262306a36Sopenharmony_ci			}
249362306a36Sopenharmony_ci			val <<= (ffs(grp->driving_mask) - 1);
249462306a36Sopenharmony_ci			regmap_update_bits(pmx->map, GLOBAL_IODRIVE,
249562306a36Sopenharmony_ci					   grp->driving_mask,
249662306a36Sopenharmony_ci					   val);
249762306a36Sopenharmony_ci			dev_dbg(pmx->dev,
249862306a36Sopenharmony_ci				"set group %s to %d mA drive strength mask %08x val %08x\n",
249962306a36Sopenharmony_ci				grp->name, arg, grp->driving_mask, val);
250062306a36Sopenharmony_ci			break;
250162306a36Sopenharmony_ci		default:
250262306a36Sopenharmony_ci			dev_err(pmx->dev, "invalid config param %04x\n", param);
250362306a36Sopenharmony_ci			return -ENOTSUPP;
250462306a36Sopenharmony_ci		}
250562306a36Sopenharmony_ci	}
250662306a36Sopenharmony_ci
250762306a36Sopenharmony_ci	return 0;
250862306a36Sopenharmony_ci}
250962306a36Sopenharmony_ci
251062306a36Sopenharmony_cistatic const struct pinconf_ops gemini_pinconf_ops = {
251162306a36Sopenharmony_ci	.pin_config_get = gemini_pinconf_get,
251262306a36Sopenharmony_ci	.pin_config_set = gemini_pinconf_set,
251362306a36Sopenharmony_ci	.pin_config_group_set = gemini_pinconf_group_set,
251462306a36Sopenharmony_ci	.is_generic = true,
251562306a36Sopenharmony_ci};
251662306a36Sopenharmony_ci
251762306a36Sopenharmony_cistatic struct pinctrl_desc gemini_pmx_desc = {
251862306a36Sopenharmony_ci	.name = DRIVER_NAME,
251962306a36Sopenharmony_ci	.pctlops = &gemini_pctrl_ops,
252062306a36Sopenharmony_ci	.pmxops = &gemini_pmx_ops,
252162306a36Sopenharmony_ci	.confops = &gemini_pinconf_ops,
252262306a36Sopenharmony_ci	.owner = THIS_MODULE,
252362306a36Sopenharmony_ci};
252462306a36Sopenharmony_ci
252562306a36Sopenharmony_cistatic int gemini_pmx_probe(struct platform_device *pdev)
252662306a36Sopenharmony_ci{
252762306a36Sopenharmony_ci	struct gemini_pmx *pmx;
252862306a36Sopenharmony_ci	struct regmap *map;
252962306a36Sopenharmony_ci	struct device *dev = &pdev->dev;
253062306a36Sopenharmony_ci	struct device *parent;
253162306a36Sopenharmony_ci	unsigned long tmp;
253262306a36Sopenharmony_ci	u32 val;
253362306a36Sopenharmony_ci	int ret;
253462306a36Sopenharmony_ci	int i;
253562306a36Sopenharmony_ci
253662306a36Sopenharmony_ci	/* Create state holders etc for this driver */
253762306a36Sopenharmony_ci	pmx = devm_kzalloc(&pdev->dev, sizeof(*pmx), GFP_KERNEL);
253862306a36Sopenharmony_ci	if (!pmx)
253962306a36Sopenharmony_ci		return -ENOMEM;
254062306a36Sopenharmony_ci
254162306a36Sopenharmony_ci	pmx->dev = &pdev->dev;
254262306a36Sopenharmony_ci	parent = dev->parent;
254362306a36Sopenharmony_ci	if (!parent) {
254462306a36Sopenharmony_ci		dev_err(dev, "no parent to pin controller\n");
254562306a36Sopenharmony_ci		return -ENODEV;
254662306a36Sopenharmony_ci	}
254762306a36Sopenharmony_ci	map = syscon_node_to_regmap(parent->of_node);
254862306a36Sopenharmony_ci	if (IS_ERR(map)) {
254962306a36Sopenharmony_ci		dev_err(dev, "no syscon regmap\n");
255062306a36Sopenharmony_ci		return PTR_ERR(map);
255162306a36Sopenharmony_ci	}
255262306a36Sopenharmony_ci	pmx->map = map;
255362306a36Sopenharmony_ci
255462306a36Sopenharmony_ci	/* Check that regmap works at first call, then no more */
255562306a36Sopenharmony_ci	ret = regmap_read(map, GLOBAL_WORD_ID, &val);
255662306a36Sopenharmony_ci	if (ret) {
255762306a36Sopenharmony_ci		dev_err(dev, "cannot access regmap\n");
255862306a36Sopenharmony_ci		return ret;
255962306a36Sopenharmony_ci	}
256062306a36Sopenharmony_ci	val >>= 8;
256162306a36Sopenharmony_ci	val &= 0xffff;
256262306a36Sopenharmony_ci	if (val == 0x3512) {
256362306a36Sopenharmony_ci		pmx->is_3512 = true;
256462306a36Sopenharmony_ci		pmx->confs = gemini_confs_3512;
256562306a36Sopenharmony_ci		pmx->nconfs = ARRAY_SIZE(gemini_confs_3512);
256662306a36Sopenharmony_ci		gemini_pmx_desc.pins = gemini_3512_pins;
256762306a36Sopenharmony_ci		gemini_pmx_desc.npins = ARRAY_SIZE(gemini_3512_pins);
256862306a36Sopenharmony_ci		dev_info(dev, "detected 3512 chip variant\n");
256962306a36Sopenharmony_ci	} else if (val == 0x3516) {
257062306a36Sopenharmony_ci		pmx->is_3516 = true;
257162306a36Sopenharmony_ci		pmx->confs = gemini_confs_3516;
257262306a36Sopenharmony_ci		pmx->nconfs = ARRAY_SIZE(gemini_confs_3516);
257362306a36Sopenharmony_ci		gemini_pmx_desc.pins = gemini_3516_pins;
257462306a36Sopenharmony_ci		gemini_pmx_desc.npins = ARRAY_SIZE(gemini_3516_pins);
257562306a36Sopenharmony_ci		dev_info(dev, "detected 3516 chip variant\n");
257662306a36Sopenharmony_ci	} else {
257762306a36Sopenharmony_ci		dev_err(dev, "unknown chip ID: %04x\n", val);
257862306a36Sopenharmony_ci		return -ENODEV;
257962306a36Sopenharmony_ci	}
258062306a36Sopenharmony_ci
258162306a36Sopenharmony_ci	ret = regmap_read(map, GLOBAL_MISC_CTRL, &val);
258262306a36Sopenharmony_ci	dev_info(dev, "GLOBAL MISC CTRL at boot: 0x%08x\n", val);
258362306a36Sopenharmony_ci	/* Mask off relevant pads */
258462306a36Sopenharmony_ci	val &= PADS_MASK;
258562306a36Sopenharmony_ci	/* Invert the meaning of the DRAM+flash pads */
258662306a36Sopenharmony_ci	val ^= 0x0f;
258762306a36Sopenharmony_ci	/* Print initial state */
258862306a36Sopenharmony_ci	tmp = val;
258962306a36Sopenharmony_ci	for_each_set_bit(i, &tmp, PADS_MAXBIT) {
259062306a36Sopenharmony_ci		dev_dbg(dev, "pad group %s %s\n", gemini_padgroups[i],
259162306a36Sopenharmony_ci			(val & BIT(i)) ? "enabled" : "disabled");
259262306a36Sopenharmony_ci	}
259362306a36Sopenharmony_ci
259462306a36Sopenharmony_ci	/* Check if flash pin is set */
259562306a36Sopenharmony_ci	regmap_read(map, GLOBAL_STATUS, &val);
259662306a36Sopenharmony_ci	pmx->flash_pin = !!(val & GLOBAL_STATUS_FLPIN);
259762306a36Sopenharmony_ci	dev_info(dev, "flash pin is %s\n", pmx->flash_pin ? "set" : "not set");
259862306a36Sopenharmony_ci
259962306a36Sopenharmony_ci	pmx->pctl = devm_pinctrl_register(dev, &gemini_pmx_desc, pmx);
260062306a36Sopenharmony_ci	if (IS_ERR(pmx->pctl)) {
260162306a36Sopenharmony_ci		dev_err(dev, "could not register pinmux driver\n");
260262306a36Sopenharmony_ci		return PTR_ERR(pmx->pctl);
260362306a36Sopenharmony_ci	}
260462306a36Sopenharmony_ci
260562306a36Sopenharmony_ci	dev_info(dev, "initialized Gemini pin control driver\n");
260662306a36Sopenharmony_ci
260762306a36Sopenharmony_ci	return 0;
260862306a36Sopenharmony_ci}
260962306a36Sopenharmony_ci
261062306a36Sopenharmony_cistatic const struct of_device_id gemini_pinctrl_match[] = {
261162306a36Sopenharmony_ci	{ .compatible = "cortina,gemini-pinctrl" },
261262306a36Sopenharmony_ci	{},
261362306a36Sopenharmony_ci};
261462306a36Sopenharmony_ci
261562306a36Sopenharmony_cistatic struct platform_driver gemini_pmx_driver = {
261662306a36Sopenharmony_ci	.driver = {
261762306a36Sopenharmony_ci		.name = DRIVER_NAME,
261862306a36Sopenharmony_ci		.of_match_table = gemini_pinctrl_match,
261962306a36Sopenharmony_ci	},
262062306a36Sopenharmony_ci	.probe = gemini_pmx_probe,
262162306a36Sopenharmony_ci};
262262306a36Sopenharmony_ci
262362306a36Sopenharmony_cistatic int __init gemini_pmx_init(void)
262462306a36Sopenharmony_ci{
262562306a36Sopenharmony_ci	return platform_driver_register(&gemini_pmx_driver);
262662306a36Sopenharmony_ci}
262762306a36Sopenharmony_ciarch_initcall(gemini_pmx_init);
2628