18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Synaptics AS370 pinctrl driver 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2018 Synaptics Incorporated 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Author: Jisheng Zhang <jszhang@kernel.org> 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 as370_soc_pinctrl_groups[] = { 188c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S1_BCLKIO", 0x0, 0x3, 0x00, 198c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO0 */ 208c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"), /* BCLKIO */ 218c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG0 */ 228c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S1_LRCKIO", 0x0, 0x3, 0x03, 238c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO1 */ 248c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"), /* LRCKIO */ 258c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG1 */ 268c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S1_DO0", 0x0, 0x3, 0x06, 278c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "por"), /* 1P8V RSTB*/ 288c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"), /* DO0 */ 298c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "gpio"), /* GPIO2 */ 308c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG2 */ 318c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S1_DO1", 0x0, 0x3, 0x09, 328c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "por"), /* 3P3V RSTB */ 338c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"), /* DO1 */ 348c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "gpio"), /* GPIO3 */ 358c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG3 */ 368c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S1_DO2", 0x0, 0x3, 0x0c, 378c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "por"), /* CORE RSTB */ 388c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"), /* DO2 */ 398c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM4 */ 408c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "gpio"), /* GPIO4 */ 418c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG4 */ 428c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S1_DO3", 0x0, 0x3, 0x0f, 438c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO5 */ 448c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"), /* DO3 */ 458c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM5 */ 468c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "spdifib"), /* SPDIFIB */ 478c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "spdifo"), /* SPDIFO */ 488c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG5 */ 498c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S1_MCLK", 0x0, 0x3, 0x12, 508c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO6 */ 518c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"), /* MCLK */ 528c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG6 */ 538c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S2_BCLKIO", 0x0, 0x3, 0x15, 548c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO7 */ 558c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"), /* BCLKIO */ 568c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG7 */ 578c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S2_LRCKIO", 0x0, 0x3, 0x18, 588c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO8 */ 598c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"), /* LRCKIO */ 608c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG8 */ 618c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S2_DI0", 0x0, 0x3, 0x1b, 628c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO9 */ 638c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"), /* DI0 */ 648c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM2 */ 658c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG9 */ 668c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S2_DI1", 0x4, 0x3, 0x00, 678c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO10 */ 688c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"), /* DI1 */ 698c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM3 */ 708c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG10 */ 718c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S2_DI2", 0x4, 0x3, 0x03, 728c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO11 */ 738c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"), /* DI2 */ 748c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM6 */ 758c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "spdific"), /* SPDIFIC */ 768c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "spdifo"), /* SPDIFO */ 778c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG11 */ 788c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S2_DI3", 0x4, 0x3, 0x06, 798c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO12 */ 808c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"), /* DI3 */ 818c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM7 */ 828c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "spdifia"), /* SPDIFIA */ 838c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "spdifo"), /* SPDIFO */ 848c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG12 */ 858c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("PDM_CLKO", 0x4, 0x3, 0x09, 868c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO13 */ 878c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pdm"), /* CLKO */ 888c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "i2s2"), /* MCLK */ 898c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG13 */ 908c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("PDM_DI0", 0x4, 0x3, 0x0c, 918c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO14 */ 928c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pdm"), /* DI0 */ 938c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG14 */ 948c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("PDM_DI1", 0x4, 0x3, 0x0f, 958c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO15 */ 968c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pdm"), /* DI1 */ 978c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG15 */ 988c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("PDM_DI2", 0x4, 0x3, 0x12, 998c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO16 */ 1008c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pdm"), /* DI2 */ 1018c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM4 */ 1028c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "spdifid"), /* SPDIFID */ 1038c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "spdifo"), /* SPDIFO */ 1048c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG16 */ 1058c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("PDM_DI3", 0x4, 0x3, 0x15, 1068c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO17 */ 1078c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pdm"), /* DI3 */ 1088c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM5 */ 1098c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "spdifi"), /* SPDIFI */ 1108c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "spdifo"), /* SPDIFO */ 1118c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG17 */ 1128c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_IO0", 0x4, 0x3, 0x18, 1138c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* IO0 */ 1148c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc"), /* DATA0 */ 1158c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "pcie0")), /* MDIO */ 1168c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_IO1", 0x4, 0x3, 0x1b, 1178c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* IO1 */ 1188c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc"), /* DATA1 */ 1198c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "pcie0")), /* MDC */ 1208c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_IO2", 0x8, 0x3, 0x00, 1218c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* IO2 */ 1228c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc"), /* DATA2 */ 1238c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "pcie1")), /* MDIO */ 1248c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_IO3", 0x8, 0x3, 0x03, 1258c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* IO3 */ 1268c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc"), /* DATA3 */ 1278c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "pcie1")), /* MDC */ 1288c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_IO4", 0x8, 0x3, 0x06, 1298c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* IO4 */ 1308c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc")), /* DATA4 */ 1318c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_IO5", 0x8, 0x3, 0x09, 1328c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* IO5 */ 1338c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc")), /* DATA5 */ 1348c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_IO6", 0x8, 0x3, 0x0c, 1358c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* IO6 */ 1368c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc")), /* DATA6 */ 1378c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_IO7", 0x8, 0x3, 0x0f, 1388c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* IO7 */ 1398c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc")), /* DATA7 */ 1408c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_ALE", 0x8, 0x3, 0x12, 1418c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* ALE */ 1428c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM6 */ 1438c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "gpio")), /* GPIO18 */ 1448c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_CLE", 0x8, 0x3, 0x15, 1458c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* CLE */ 1468c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM7 */ 1478c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "gpio")), /* GPIO19 */ 1488c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_WEn", 0x8, 0x3, 0x18, 1498c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* WEn */ 1508c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "gpio")), /* GPIO20 */ 1518c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_REn", 0x8, 0x3, 0x1b, 1528c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* REn */ 1538c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "gpio")), /* GPIO21 */ 1548c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_WPn", 0xc, 0x3, 0x00, 1558c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* WPn */ 1568c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc"), /* CLK */ 1578c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "gpio")), /* GPIO22 */ 1588c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_CEn", 0xc, 0x3, 0x03, 1598c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* CEn */ 1608c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc"), /* RSTn */ 1618c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "gpio")), /* GPIO23 */ 1628c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_RDY", 0xc, 0x3, 0x06, 1638c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* RDY */ 1648c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc"), /* CMD */ 1658c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "gpio")), /* GPIO24 */ 1668c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("SPI1_SS0n", 0xc, 0x3, 0x09, 1678c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SS0n */ 1688c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "gpio")), /* GPIO25 */ 1698c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("SPI1_SS1n", 0xc, 0x3, 0x0c, 1708c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SS1n */ 1718c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "gpio"), /* GPIO26 */ 1728c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "pwm")), /* PWM2 */ 1738c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("SPI1_SS2n", 0xc, 0x3, 0x0f, 1748c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "uart0"), /* RXD */ 1758c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), /* SS2n */ 1768c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "gpio"), /* GPIO27 */ 1778c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "pwm")), /* PWM3 */ 1788c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("SPI1_SS3n", 0xc, 0x3, 0x12, 1798c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "uart0"), /* TXD */ 1808c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), /* SS3n */ 1818c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "gpio")), /* GPIO28 */ 1828c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("SPI1_SCLK", 0xc, 0x3, 0x15, 1838c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SCLK */ 1848c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "gpio"), /* GPIO29 */ 1858c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "pwm")), /* PWM4 */ 1868c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("SPI1_SDO", 0xc, 0x3, 0x18, 1878c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SDO */ 1888c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "gpio"), /* GPIO30 */ 1898c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "pwm")), /* PWM5 */ 1908c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("SPI1_SDI", 0xc, 0x3, 0x1b, 1918c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SDI */ 1928c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "gpio")), /* GPIO31 */ 1938c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("USB0_DRV_VBUS", 0x10, 0x3, 0x00, 1948c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "usb0"), /* VBUS */ 1958c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "gpio"), /* GPIO32 */ 1968c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "refclko")), /* 25M */ 1978c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("TW1_SCL", 0x10, 0x3, 0x03, 1988c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO33 */ 1998c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "tw1")), /* SCL */ 2008c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("TW1_SDA", 0x10, 0x3, 0x06, 2018c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO34 */ 2028c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "tw1")), /* SDA */ 2038c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("TW0_SCL", 0x10, 0x3, 0x09, 2048c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO35 */ 2058c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "tw0")), /* SCL */ 2068c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("TW0_SDA", 0x10, 0x3, 0x0c, 2078c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO36 */ 2088c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "tw0")), /* SDA */ 2098c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("TMS", 0x10, 0x3, 0x0f, 2108c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "jtag"), /* TMS */ 2118c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "gpio"), /* GPIO37 */ 2128c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "pwm")), /* PWM0 */ 2138c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("TDI", 0x10, 0x3, 0x12, 2148c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "jtag"), /* TDI */ 2158c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "gpio"), /* GPIO38 */ 2168c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "pwm")), /* PWM1 */ 2178c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("TDO", 0x10, 0x3, 0x15, 2188c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "jtag"), /* TDO */ 2198c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "gpio"), /* GPIO39 */ 2208c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "pwm")), /* PWM0 */ 2218c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("PWM6", 0x10, 0x3, 0x18, 2228c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO40 */ 2238c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pwm")), /* PWM6 */ 2248c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("PWM7", 0x10, 0x3, 0x1b, 2258c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO41 */ 2268c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pwm")), /* PWM7 */ 2278c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("PWM0", 0x14, 0x3, 0x00, 2288c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "por"), /* VDDCPUSOC RSTB */ 2298c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pwm"), /* PWM0 */ 2308c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "gpio")), /* GPIO42 */ 2318c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("PWM1", 0x14, 0x3, 0x03, 2328c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO43 */ 2338c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pwm")), /* PWM1 */ 2348c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("PWM2", 0x14, 0x3, 0x06, 2358c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO44 */ 2368c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pwm")), /* PWM2 */ 2378c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("PWM3", 0x14, 0x3, 0x09, 2388c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO45 */ 2398c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pwm")), /* PWM3 */ 2408c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("PWM4", 0x14, 0x3, 0x0c, 2418c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO46 */ 2428c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pwm")), /* PWM4 */ 2438c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("PWM5", 0x14, 0x3, 0x0f, 2448c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO47 */ 2458c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pwm")), /* PWM5 */ 2468c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("URT1_RTSn", 0x14, 0x3, 0x12, 2478c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO48 */ 2488c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "uart1"), /* RTSn */ 2498c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM6 */ 2508c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "tw1a"), /* SCL */ 2518c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "aio"), /* DBG0 */ 2528c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG18 */ 2538c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("URT1_CTSn", 0x14, 0x3, 0x15, 2548c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO49 */ 2558c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "uart1"), /* CTSn */ 2568c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM7 */ 2578c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "tw1a"), /* SDA */ 2588c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "aio"), /* DBG1 */ 2598c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG19 */ 2608c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("URT1_RXD", 0x14, 0x3, 0x18, 2618c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO50 */ 2628c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "uart1"), /* RXD */ 2638c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "aio"), /* DBG2 */ 2648c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG20 */ 2658c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("URT1_TXD", 0x14, 0x3, 0x1b, 2668c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO51 */ 2678c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "uart1"), /* TXD */ 2688c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "aio"), /* DBG3 */ 2698c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG21 */ 2708c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S3_DI", 0x18, 0x3, 0x00, 2718c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO52 */ 2728c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s3"), /* DI */ 2738c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG22 */ 2748c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S3_DO", 0x18, 0x3, 0x03, 2758c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO53 */ 2768c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s3"), /* DO */ 2778c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG23 */ 2788c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S3_BCLKIO", 0x18, 0x3, 0x06, 2798c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO54 */ 2808c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s3"), /* BCLKIO */ 2818c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "clk")), /* DBG */ 2828c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S3_LRCKIO", 0x18, 0x3, 0x09, 2838c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO55 */ 2848c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s3")), /* LRCKIO */ 2858c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("SD0_DAT0", 0x18, 0x3, 0x0c, 2868c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "cpupll"), /* OUT */ 2878c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "sd0"), /* DAT0 */ 2888c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "gpio")), /* GPIO56 */ 2898c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("SD0_DAT1", 0x18, 0x3, 0x0f, 2908c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "syspll"), /* OUT */ 2918c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "sd0"), /* DAT1 */ 2928c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "gpio")), /* GPIO57 */ 2938c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("SD0_CLK", 0x18, 0x3, 0x12, 2948c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO58 */ 2958c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "sd0")), /* CLK */ 2968c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("SD0_DAT2", 0x18, 0x3, 0x15, 2978c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "mempll"), /* OUT */ 2988c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "sd0"), /* DAT2 */ 2998c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "gpio")), /* GPIO59 */ 3008c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("SD0_DAT3", 0x18, 0x3, 0x18, 3018c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "apll0"), /* OUT */ 3028c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "sd0"), /* DAT3 */ 3038c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "gpio")), /* GPIO60 */ 3048c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("SD0_CMD", 0x18, 0x3, 0x1b, 3058c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "apll1"), /* OUT */ 3068c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "sd0"), /* CMD */ 3078c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "gpio")), /* GPIO61 */ 3088c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("SD0_CDn", 0x1c, 0x3, 0x00, 3098c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO62 */ 3108c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "sd0"), /* CDn */ 3118c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "pwm")), /* PWM2 */ 3128c2ecf20Sopenharmony_ci BERLIN_PINCTRL_GROUP("SD0_WP", 0x1c, 0x3, 0x03, 3138c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO63 */ 3148c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "sd0"), /* WP */ 3158c2ecf20Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "pwm")), /* PWM3 */ 3168c2ecf20Sopenharmony_ci}; 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_cistatic const struct berlin_pinctrl_desc as370_soc_pinctrl_data = { 3198c2ecf20Sopenharmony_ci .groups = as370_soc_pinctrl_groups, 3208c2ecf20Sopenharmony_ci .ngroups = ARRAY_SIZE(as370_soc_pinctrl_groups), 3218c2ecf20Sopenharmony_ci}; 3228c2ecf20Sopenharmony_ci 3238c2ecf20Sopenharmony_cistatic const struct of_device_id as370_pinctrl_match[] = { 3248c2ecf20Sopenharmony_ci { 3258c2ecf20Sopenharmony_ci .compatible = "syna,as370-soc-pinctrl", 3268c2ecf20Sopenharmony_ci .data = &as370_soc_pinctrl_data, 3278c2ecf20Sopenharmony_ci }, 3288c2ecf20Sopenharmony_ci {} 3298c2ecf20Sopenharmony_ci}; 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_cistatic int as370_pinctrl_probe(struct platform_device *pdev) 3328c2ecf20Sopenharmony_ci{ 3338c2ecf20Sopenharmony_ci const struct of_device_id *match = 3348c2ecf20Sopenharmony_ci of_match_device(as370_pinctrl_match, &pdev->dev); 3358c2ecf20Sopenharmony_ci struct regmap_config *rmconfig; 3368c2ecf20Sopenharmony_ci struct regmap *regmap; 3378c2ecf20Sopenharmony_ci struct resource *res; 3388c2ecf20Sopenharmony_ci void __iomem *base; 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_ci rmconfig = devm_kzalloc(&pdev->dev, sizeof(*rmconfig), GFP_KERNEL); 3418c2ecf20Sopenharmony_ci if (!rmconfig) 3428c2ecf20Sopenharmony_ci return -ENOMEM; 3438c2ecf20Sopenharmony_ci 3448c2ecf20Sopenharmony_ci res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 3458c2ecf20Sopenharmony_ci base = devm_ioremap_resource(&pdev->dev, res); 3468c2ecf20Sopenharmony_ci if (IS_ERR(base)) 3478c2ecf20Sopenharmony_ci return PTR_ERR(base); 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_ci rmconfig->reg_bits = 32, 3508c2ecf20Sopenharmony_ci rmconfig->val_bits = 32, 3518c2ecf20Sopenharmony_ci rmconfig->reg_stride = 4, 3528c2ecf20Sopenharmony_ci rmconfig->max_register = resource_size(res); 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_ci regmap = devm_regmap_init_mmio(&pdev->dev, base, rmconfig); 3558c2ecf20Sopenharmony_ci if (IS_ERR(regmap)) 3568c2ecf20Sopenharmony_ci return PTR_ERR(regmap); 3578c2ecf20Sopenharmony_ci 3588c2ecf20Sopenharmony_ci return berlin_pinctrl_probe_regmap(pdev, match->data, regmap); 3598c2ecf20Sopenharmony_ci} 3608c2ecf20Sopenharmony_ci 3618c2ecf20Sopenharmony_cistatic struct platform_driver as370_pinctrl_driver = { 3628c2ecf20Sopenharmony_ci .probe = as370_pinctrl_probe, 3638c2ecf20Sopenharmony_ci .driver = { 3648c2ecf20Sopenharmony_ci .name = "as370-pinctrl", 3658c2ecf20Sopenharmony_ci .of_match_table = as370_pinctrl_match, 3668c2ecf20Sopenharmony_ci }, 3678c2ecf20Sopenharmony_ci}; 3688c2ecf20Sopenharmony_cibuiltin_platform_driver(as370_pinctrl_driver); 369