18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Marvell Berlin BG2Q pinctrl driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2014 Marvell Technology Group Ltd.
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Antoine Ténart <antoine.tenart@free-electrons.com>
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <linux/init.h>
118c2ecf20Sopenharmony_ci#include <linux/of_device.h>
128c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
138c2ecf20Sopenharmony_ci#include <linux/regmap.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#include "berlin.h"
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_cistatic const struct berlin_desc_group berlin2q_soc_pinctrl_groups[] = {
188c2ecf20Sopenharmony_ci	/* G */
198c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G0", 0x18, 0x3, 0x00,
208c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
218c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "mmc"),
228c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
238c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G1", 0x18, 0x3, 0x03,
248c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
258c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
268c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G2", 0x18, 0x3, 0x06,
278c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
288c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "arc"),
298c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "lvds")),
308c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G3", 0x18, 0x3, 0x09,
318c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
328c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "i2s2"),
338c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "lvds")),
348c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G4", 0x18, 0x3, 0x0c,
358c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "pll"),
368c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
378c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
388c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "gpio"),
398c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x5, "sata_dbg"),
408c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
418c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
428c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G5", 0x18, 0x3, 0x0f,
438c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
448c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
458c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
468c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x5, "sata_dbg"),
478c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
488c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
498c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G6", 0x18, 0x3, 0x12,
508c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "jtag"),
518c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "twsi0"),
528c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
538c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G7", 0x18, 0x3, 0x15,
548c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "jtag"),
558c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "twsi1"),
568c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
578c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "eddc")),
588c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G8", 0x18, 0x3, 0x18,
598c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* CLK/SDI/SDO */
608c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
618c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G9", 0x18, 0x3, 0x1b,
628c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SS0n/SS1n */
638c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "gpio"),
648c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x5, "sata")),
658c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G10", 0x1c, 0x3, 0x00,
668c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
678c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), /* SS2n */
688c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "i2s0"),
698c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "pwm"),
708c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x5, "sata")),
718c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G11", 0x1c, 0x3, 0x03,
728c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "jtag"),
738c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), /* SS3n */
748c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
758c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "i2s1"),
768c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "pwm"),
778c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x5, "sata")),
788c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G12", 0x1c, 0x3, 0x06,
798c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "agc"),
808c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
818c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G13", 0x1c, 0x3, 0x09,
828c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
838c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "sts1"),
848c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
858c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
868c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
878c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G14", 0x1c, 0x3, 0x0c,
888c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
898c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "sts0"),
908c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "sts1"),
918c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
928c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
938c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G15", 0x1c, 0x3, 0x0f,
948c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
958c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "sts0"),
968c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "sts1"),
978c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x5, "vdac"),
988c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
998c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
1008c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G16", 0x1c, 0x3, 0x12,
1018c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
1028c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "sts0"),
1038c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "sts1"),
1048c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x5, "osco"),
1058c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
1068c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
1078c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G17", 0x1c, 0x3, 0x15,
1088c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
1098c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
1108c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "spdif"),
1118c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "sts1"),
1128c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
1138c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
1148c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G18", 0x1c, 0x3, 0x18,
1158c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
1168c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
1178c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "i2s2"),
1188c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "sts1")),
1198c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G19", 0x1c, 0x3, 0x1b,
1208c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
1218c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
1228c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "i2s3"),
1238c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "sts1"),
1248c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x5, "osco")),
1258c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G20", 0x20, 0x3, 0x00,
1268c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
1278c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
1288c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "demod"),
1298c2ecf20Sopenharmony_ci			/*
1308c2ecf20Sopenharmony_ci			 * Mode 0x4 mux usb2_dbg *and* usb3_dbg:
1318c2ecf20Sopenharmony_ci			 * add two functions so it can be used with other groups
1328c2ecf20Sopenharmony_ci			 * within the same subnode in the device tree
1338c2ecf20Sopenharmony_ci			 */
1348c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "usb2_dbg"),
1358c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "usb3_dbg")),
1368c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G21", 0x20, 0x3, 0x03,
1378c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
1388c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "sts2"),
1398c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
1408c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "demod")),
1418c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G22", 0x20, 0x3, 0x06,
1428c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
1438c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
1448c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G23", 0x20, 0x3, 0x09,
1458c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
1468c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
1478c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "avif"),
1488c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "usb2_dbg")),
1498c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G24", 0x20, 0x3, 0x0c,
1508c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
1518c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
1528c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "demod"),
1538c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "usb2_dbg")),
1548c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G25", 0x20, 0x3, 0x0f,
1558c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
1568c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "vga"),
1578c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
1588c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "avif"),
1598c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "usb2_dbg")),
1608c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G26", 0x20, 0x3, 0x12,
1618c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
1628c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "lvds"),
1638c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
1648c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G27", 0x20, 0x3, 0x15,
1658c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
1668c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "agc"),
1678c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
1688c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G28", 0x20, 0x3, 0x18,
1698c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
1708c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
1718c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "avif"),
1728c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "usb2_dbg")),
1738c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G29", 0x20, 0x3, 0x1b,
1748c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
1758c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "scrd0"),
1768c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
1778c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G30", 0x24, 0x3, 0x00,
1788c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
1798c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "scrd1"),
1808c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
1818c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G31", 0x24, 0x3, 0x03,
1828c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
1838c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "sd1"),
1848c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
1858c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("G32", 0x24, 0x3, 0x06,
1868c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
1878c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "sd1"),
1888c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
1898c2ecf20Sopenharmony_ci	/* GAV */
1908c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GAV0", 0x24, 0x3, 0x09,
1918c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
1928c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
1938c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
1948c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "lvds")),
1958c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GAV1", 0x24, 0x3, 0x0c,
1968c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
1978c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
1988c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
1998c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "vga")),
2008c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GAV2", 0x24, 0x3, 0x0f,
2018c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
2028c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
2038c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
2048c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "i2s3"),
2058c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "pdm"),
2068c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x6, "adac")),
2078c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GAV3", 0x24, 0x3, 0x12,
2088c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
2098c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
2108c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
2118c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "i2s3"),
2128c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x6, "adac")),
2138c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GAV4", 0x24, 0x3, 0x15,
2148c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
2158c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
2168c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
2178c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "i2s1"),
2188c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x6, "adac")),
2198c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GAV5", 0x24, 0x3, 0x18,
2208c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
2218c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
2228c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
2238c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "spdif")),
2248c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GAV6", 0x24, 0x3, 0x1b,
2258c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
2268c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
2278c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
2288c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "i2s2")),
2298c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GAV7", 0x28, 0x3, 0x00,
2308c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
2318c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
2328c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
2338c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "i2s3")),
2348c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GAV8", 0x28, 0x3, 0x03,
2358c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
2368c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "dv0"),
2378c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
2388c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "pwm")),
2398c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GAV9", 0x28, 0x3, 0x06,
2408c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
2418c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "dv0"),
2428c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
2438c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "pwm")),
2448c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GAV10", 0x28, 0x3, 0x09,
2458c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
2468c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "dv0"),
2478c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
2488c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "agc")),
2498c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GAV11", 0x28, 0x3, 0x0c,
2508c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
2518c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "dv0"),
2528c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
2538c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "i2s0"),
2548c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "pwm"),
2558c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x5, "vclki")),
2568c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GAV12", 0x28, 0x3, 0x0f,
2578c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
2588c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"),
2598c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "i2s1")),
2608c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GAV13", 0x28, 0x3, 0x12,
2618c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
2628c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "i2s2")),
2638c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GAV14", 0x28, 0x3, 0x15,
2648c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
2658c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"),
2668c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "i2s1")),
2678c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GAV15", 0x28, 0x3, 0x18,
2688c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
2698c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"),
2708c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x6, "dac_dbg")),
2718c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GAV16", 0x28, 0x3, 0x1b,
2728c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
2738c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "i2s0"),
2748c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "i2s1"),
2758c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "i2s3"),
2768c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x5, "pdm"),
2778c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x6, "dac_dbg")),
2788c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GAV17", 0x2c, 0x3, 0x00,
2798c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
2808c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "i2s0"),
2818c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "i2s1"),
2828c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "pwm"),
2838c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "i2s3"),
2848c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x5, "pdm"),
2858c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x6, "dac_dbg")),
2868c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GAV18", 0x2c, 0x3, 0x03,
2878c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
2888c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "spdif"),
2898c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "arc")),
2908c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GAV19", 0x2c, 0x3, 0x06,
2918c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
2928c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "spdif"),
2938c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x4, "i2s3"),
2948c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x5, "pdm")),
2958c2ecf20Sopenharmony_ci};
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_cistatic const struct berlin_desc_group berlin2q_sysmgr_pinctrl_groups[] = {
2988c2ecf20Sopenharmony_ci	/* GSM */
2998c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GSM0", 0x40, 0x2, 0x00,
3008c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
3018c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), /* SS0n */
3028c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "eth1")),
3038c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GSM1", 0x40, 0x2, 0x02,
3048c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
3058c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), /* SS1n */
3068c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "eth1")),
3078c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GSM2", 0x40, 0x2, 0x04,
3088c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
3098c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), /* SS2n/SS3n */
3108c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "eddc")),
3118c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GSM3", 0x40, 0x2, 0x06,
3128c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
3138c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), /* CLK/SDO */
3148c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "eddc")),
3158c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GSM4", 0x40, 0x1, 0x08,
3168c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
3178c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
3188c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GSM5", 0x40, 0x1, 0x09,
3198c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
3208c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
3218c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GSM6", 0x40, 0x1, 0x0a,
3228c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
3238c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
3248c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GSM7", 0x40, 0x1, 0x0b,
3258c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
3268c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
3278c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GSM8", 0x40, 0x1, 0x0c,
3288c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
3298c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
3308c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GSM9", 0x40, 0x1, 0x0d,
3318c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
3328c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
3338c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GSM10", 0x40, 0x1, 0x0e,
3348c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
3358c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "led")),
3368c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GSM11", 0x40, 0x1, 0x0f,
3378c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
3388c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "led")),
3398c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GSM12", 0x40, 0x2, 0x10,
3408c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "uart0"), /* RX/TX */
3418c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "irda0"),
3428c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
3438c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GSM13", 0x40, 0x2, 0x12,
3448c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
3458c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "uart0"), /* CTS/RTS */
3468c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "uart1"), /* RX/TX */
3478c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "twsi2")),
3488c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GSM14", 0x40, 0x2, 0x14,
3498c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
3508c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "uart1"), /* RX/TX */
3518c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "irda1"),
3528c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x3, "twsi3")),
3538c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GSM15", 0x40, 0x2, 0x16,
3548c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "pwr"),
3558c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "led"),
3568c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
3578c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GSM16", 0x40, 0x1, 0x18,
3588c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
3598c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "eddc")),
3608c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GSM17", 0x40, 0x1, 0x19,
3618c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
3628c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "eddc")),
3638c2ecf20Sopenharmony_ci	BERLIN_PINCTRL_GROUP("GSM18", 0x40, 0x1, 0x1a,
3648c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
3658c2ecf20Sopenharmony_ci			BERLIN_PINCTRL_FUNCTION(0x1, "eddc")),
3668c2ecf20Sopenharmony_ci};
3678c2ecf20Sopenharmony_ci
3688c2ecf20Sopenharmony_cistatic const struct berlin_pinctrl_desc berlin2q_soc_pinctrl_data = {
3698c2ecf20Sopenharmony_ci	.groups = berlin2q_soc_pinctrl_groups,
3708c2ecf20Sopenharmony_ci	.ngroups = ARRAY_SIZE(berlin2q_soc_pinctrl_groups),
3718c2ecf20Sopenharmony_ci};
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_cistatic const struct berlin_pinctrl_desc berlin2q_sysmgr_pinctrl_data = {
3748c2ecf20Sopenharmony_ci	.groups = berlin2q_sysmgr_pinctrl_groups,
3758c2ecf20Sopenharmony_ci	.ngroups = ARRAY_SIZE(berlin2q_sysmgr_pinctrl_groups),
3768c2ecf20Sopenharmony_ci};
3778c2ecf20Sopenharmony_ci
3788c2ecf20Sopenharmony_cistatic const struct of_device_id berlin2q_pinctrl_match[] = {
3798c2ecf20Sopenharmony_ci	{
3808c2ecf20Sopenharmony_ci		.compatible = "marvell,berlin2q-soc-pinctrl",
3818c2ecf20Sopenharmony_ci		.data = &berlin2q_soc_pinctrl_data,
3828c2ecf20Sopenharmony_ci	},
3838c2ecf20Sopenharmony_ci	{
3848c2ecf20Sopenharmony_ci		.compatible = "marvell,berlin2q-system-pinctrl",
3858c2ecf20Sopenharmony_ci		.data = &berlin2q_sysmgr_pinctrl_data,
3868c2ecf20Sopenharmony_ci	},
3878c2ecf20Sopenharmony_ci	{}
3888c2ecf20Sopenharmony_ci};
3898c2ecf20Sopenharmony_ci
3908c2ecf20Sopenharmony_cistatic int berlin2q_pinctrl_probe(struct platform_device *pdev)
3918c2ecf20Sopenharmony_ci{
3928c2ecf20Sopenharmony_ci	const struct of_device_id *match =
3938c2ecf20Sopenharmony_ci		of_match_device(berlin2q_pinctrl_match, &pdev->dev);
3948c2ecf20Sopenharmony_ci
3958c2ecf20Sopenharmony_ci	return berlin_pinctrl_probe(pdev, match->data);
3968c2ecf20Sopenharmony_ci}
3978c2ecf20Sopenharmony_ci
3988c2ecf20Sopenharmony_cistatic struct platform_driver berlin2q_pinctrl_driver = {
3998c2ecf20Sopenharmony_ci	.probe	= berlin2q_pinctrl_probe,
4008c2ecf20Sopenharmony_ci	.driver	= {
4018c2ecf20Sopenharmony_ci		.name = "berlin-bg2q-pinctrl",
4028c2ecf20Sopenharmony_ci		.of_match_table = berlin2q_pinctrl_match,
4038c2ecf20Sopenharmony_ci	},
4048c2ecf20Sopenharmony_ci};
4058c2ecf20Sopenharmony_cibuiltin_platform_driver(berlin2q_pinctrl_driver);
406