162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Synaptics AS370 pinctrl driver 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2018 Synaptics Incorporated 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Author: Jisheng Zhang <jszhang@kernel.org> 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#include <linux/init.h> 1162306a36Sopenharmony_ci#include <linux/of_device.h> 1262306a36Sopenharmony_ci#include <linux/platform_device.h> 1362306a36Sopenharmony_ci#include <linux/regmap.h> 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci#include "berlin.h" 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_cistatic const struct berlin_desc_group as370_soc_pinctrl_groups[] = { 1862306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S1_BCLKIO", 0x0, 0x3, 0x00, 1962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO0 */ 2062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"), /* BCLKIO */ 2162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG0 */ 2262306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S1_LRCKIO", 0x0, 0x3, 0x03, 2362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO1 */ 2462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"), /* LRCKIO */ 2562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG1 */ 2662306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S1_DO0", 0x0, 0x3, 0x06, 2762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "por"), /* 1P8V RSTB*/ 2862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"), /* DO0 */ 2962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "gpio"), /* GPIO2 */ 3062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG2 */ 3162306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S1_DO1", 0x0, 0x3, 0x09, 3262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "por"), /* 3P3V RSTB */ 3362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"), /* DO1 */ 3462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "gpio"), /* GPIO3 */ 3562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG3 */ 3662306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S1_DO2", 0x0, 0x3, 0x0c, 3762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "por"), /* CORE RSTB */ 3862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"), /* DO2 */ 3962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM4 */ 4062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "gpio"), /* GPIO4 */ 4162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG4 */ 4262306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S1_DO3", 0x0, 0x3, 0x0f, 4362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO5 */ 4462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"), /* DO3 */ 4562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM5 */ 4662306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "spdifib"), /* SPDIFIB */ 4762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "spdifo"), /* SPDIFO */ 4862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG5 */ 4962306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S1_MCLK", 0x0, 0x3, 0x12, 5062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO6 */ 5162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"), /* MCLK */ 5262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG6 */ 5362306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S2_BCLKIO", 0x0, 0x3, 0x15, 5462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO7 */ 5562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"), /* BCLKIO */ 5662306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG7 */ 5762306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S2_LRCKIO", 0x0, 0x3, 0x18, 5862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO8 */ 5962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"), /* LRCKIO */ 6062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG8 */ 6162306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S2_DI0", 0x0, 0x3, 0x1b, 6262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO9 */ 6362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"), /* DI0 */ 6462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM2 */ 6562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG9 */ 6662306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S2_DI1", 0x4, 0x3, 0x00, 6762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO10 */ 6862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"), /* DI1 */ 6962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM3 */ 7062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG10 */ 7162306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S2_DI2", 0x4, 0x3, 0x03, 7262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO11 */ 7362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"), /* DI2 */ 7462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM6 */ 7562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "spdific"), /* SPDIFIC */ 7662306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "spdifo"), /* SPDIFO */ 7762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG11 */ 7862306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S2_DI3", 0x4, 0x3, 0x06, 7962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO12 */ 8062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"), /* DI3 */ 8162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM7 */ 8262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "spdifia"), /* SPDIFIA */ 8362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "spdifo"), /* SPDIFO */ 8462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG12 */ 8562306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("PDM_CLKO", 0x4, 0x3, 0x09, 8662306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO13 */ 8762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pdm"), /* CLKO */ 8862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "i2s2"), /* MCLK */ 8962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG13 */ 9062306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("PDM_DI0", 0x4, 0x3, 0x0c, 9162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO14 */ 9262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pdm"), /* DI0 */ 9362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG14 */ 9462306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("PDM_DI1", 0x4, 0x3, 0x0f, 9562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO15 */ 9662306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pdm"), /* DI1 */ 9762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG15 */ 9862306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("PDM_DI2", 0x4, 0x3, 0x12, 9962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO16 */ 10062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pdm"), /* DI2 */ 10162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM4 */ 10262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "spdifid"), /* SPDIFID */ 10362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "spdifo"), /* SPDIFO */ 10462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG16 */ 10562306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("PDM_DI3", 0x4, 0x3, 0x15, 10662306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO17 */ 10762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pdm"), /* DI3 */ 10862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM5 */ 10962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "spdifi"), /* SPDIFI */ 11062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "spdifo"), /* SPDIFO */ 11162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG17 */ 11262306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_IO0", 0x4, 0x3, 0x18, 11362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* IO0 */ 11462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc"), /* DATA0 */ 11562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "pcie0")), /* MDIO */ 11662306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_IO1", 0x4, 0x3, 0x1b, 11762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* IO1 */ 11862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc"), /* DATA1 */ 11962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "pcie0")), /* MDC */ 12062306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_IO2", 0x8, 0x3, 0x00, 12162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* IO2 */ 12262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc"), /* DATA2 */ 12362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "pcie1")), /* MDIO */ 12462306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_IO3", 0x8, 0x3, 0x03, 12562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* IO3 */ 12662306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc"), /* DATA3 */ 12762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "pcie1")), /* MDC */ 12862306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_IO4", 0x8, 0x3, 0x06, 12962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* IO4 */ 13062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc")), /* DATA4 */ 13162306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_IO5", 0x8, 0x3, 0x09, 13262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* IO5 */ 13362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc")), /* DATA5 */ 13462306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_IO6", 0x8, 0x3, 0x0c, 13562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* IO6 */ 13662306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc")), /* DATA6 */ 13762306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_IO7", 0x8, 0x3, 0x0f, 13862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* IO7 */ 13962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc")), /* DATA7 */ 14062306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_ALE", 0x8, 0x3, 0x12, 14162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* ALE */ 14262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM6 */ 14362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "gpio")), /* GPIO18 */ 14462306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_CLE", 0x8, 0x3, 0x15, 14562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* CLE */ 14662306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM7 */ 14762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "gpio")), /* GPIO19 */ 14862306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_WEn", 0x8, 0x3, 0x18, 14962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* WEn */ 15062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "gpio")), /* GPIO20 */ 15162306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_REn", 0x8, 0x3, 0x1b, 15262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* REn */ 15362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "gpio")), /* GPIO21 */ 15462306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_WPn", 0xc, 0x3, 0x00, 15562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* WPn */ 15662306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc"), /* CLK */ 15762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "gpio")), /* GPIO22 */ 15862306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_CEn", 0xc, 0x3, 0x03, 15962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* CEn */ 16062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc"), /* RSTn */ 16162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "gpio")), /* GPIO23 */ 16262306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("NAND_RDY", 0xc, 0x3, 0x06, 16362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "nand"), /* RDY */ 16462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "emmc"), /* CMD */ 16562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "gpio")), /* GPIO24 */ 16662306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("SPI1_SS0n", 0xc, 0x3, 0x09, 16762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SS0n */ 16862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "gpio")), /* GPIO25 */ 16962306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("SPI1_SS1n", 0xc, 0x3, 0x0c, 17062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SS1n */ 17162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "gpio"), /* GPIO26 */ 17262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "pwm")), /* PWM2 */ 17362306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("SPI1_SS2n", 0xc, 0x3, 0x0f, 17462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "uart0"), /* RXD */ 17562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), /* SS2n */ 17662306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "gpio"), /* GPIO27 */ 17762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "pwm")), /* PWM3 */ 17862306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("SPI1_SS3n", 0xc, 0x3, 0x12, 17962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "uart0"), /* TXD */ 18062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), /* SS3n */ 18162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "gpio")), /* GPIO28 */ 18262306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("SPI1_SCLK", 0xc, 0x3, 0x15, 18362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SCLK */ 18462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "gpio"), /* GPIO29 */ 18562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "pwm")), /* PWM4 */ 18662306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("SPI1_SDO", 0xc, 0x3, 0x18, 18762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SDO */ 18862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "gpio"), /* GPIO30 */ 18962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "pwm")), /* PWM5 */ 19062306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("SPI1_SDI", 0xc, 0x3, 0x1b, 19162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SDI */ 19262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "gpio")), /* GPIO31 */ 19362306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("USB0_DRV_VBUS", 0x10, 0x3, 0x00, 19462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "usb0"), /* VBUS */ 19562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "gpio"), /* GPIO32 */ 19662306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "refclko")), /* 25M */ 19762306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("TW1_SCL", 0x10, 0x3, 0x03, 19862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO33 */ 19962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "tw1")), /* SCL */ 20062306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("TW1_SDA", 0x10, 0x3, 0x06, 20162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO34 */ 20262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "tw1")), /* SDA */ 20362306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("TW0_SCL", 0x10, 0x3, 0x09, 20462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO35 */ 20562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "tw0")), /* SCL */ 20662306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("TW0_SDA", 0x10, 0x3, 0x0c, 20762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO36 */ 20862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "tw0")), /* SDA */ 20962306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("TMS", 0x10, 0x3, 0x0f, 21062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "jtag"), /* TMS */ 21162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "gpio"), /* GPIO37 */ 21262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "pwm")), /* PWM0 */ 21362306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("TDI", 0x10, 0x3, 0x12, 21462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "jtag"), /* TDI */ 21562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "gpio"), /* GPIO38 */ 21662306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "pwm")), /* PWM1 */ 21762306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("TDO", 0x10, 0x3, 0x15, 21862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "jtag"), /* TDO */ 21962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "gpio"), /* GPIO39 */ 22062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "pwm")), /* PWM0 */ 22162306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("PWM6", 0x10, 0x3, 0x18, 22262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO40 */ 22362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pwm")), /* PWM6 */ 22462306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("PWM7", 0x10, 0x3, 0x1b, 22562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO41 */ 22662306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pwm")), /* PWM7 */ 22762306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("PWM0", 0x14, 0x3, 0x00, 22862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "por"), /* VDDCPUSOC RSTB */ 22962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pwm"), /* PWM0 */ 23062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "gpio")), /* GPIO42 */ 23162306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("PWM1", 0x14, 0x3, 0x03, 23262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO43 */ 23362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pwm")), /* PWM1 */ 23462306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("PWM2", 0x14, 0x3, 0x06, 23562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO44 */ 23662306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pwm")), /* PWM2 */ 23762306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("PWM3", 0x14, 0x3, 0x09, 23862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO45 */ 23962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pwm")), /* PWM3 */ 24062306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("PWM4", 0x14, 0x3, 0x0c, 24162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO46 */ 24262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pwm")), /* PWM4 */ 24362306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("PWM5", 0x14, 0x3, 0x0f, 24462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO47 */ 24562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "pwm")), /* PWM5 */ 24662306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("URT1_RTSn", 0x14, 0x3, 0x12, 24762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO48 */ 24862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "uart1"), /* RTSn */ 24962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM6 */ 25062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "tw1a"), /* SCL */ 25162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "aio"), /* DBG0 */ 25262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG18 */ 25362306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("URT1_CTSn", 0x14, 0x3, 0x15, 25462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO49 */ 25562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "uart1"), /* CTSn */ 25662306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM7 */ 25762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "tw1a"), /* SDA */ 25862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "aio"), /* DBG1 */ 25962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG19 */ 26062306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("URT1_RXD", 0x14, 0x3, 0x18, 26162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO50 */ 26262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "uart1"), /* RXD */ 26362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "aio"), /* DBG2 */ 26462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG20 */ 26562306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("URT1_TXD", 0x14, 0x3, 0x1b, 26662306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO51 */ 26762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "uart1"), /* TXD */ 26862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x4, "aio"), /* DBG3 */ 26962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG21 */ 27062306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S3_DI", 0x18, 0x3, 0x00, 27162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO52 */ 27262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s3"), /* DI */ 27362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG22 */ 27462306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S3_DO", 0x18, 0x3, 0x03, 27562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO53 */ 27662306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s3"), /* DO */ 27762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG23 */ 27862306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S3_BCLKIO", 0x18, 0x3, 0x06, 27962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO54 */ 28062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s3"), /* BCLKIO */ 28162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x5, "clk")), /* DBG */ 28262306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("I2S3_LRCKIO", 0x18, 0x3, 0x09, 28362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO55 */ 28462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "i2s3")), /* LRCKIO */ 28562306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("SD0_DAT0", 0x18, 0x3, 0x0c, 28662306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "cpupll"), /* OUT */ 28762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "sd0"), /* DAT0 */ 28862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "gpio")), /* GPIO56 */ 28962306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("SD0_DAT1", 0x18, 0x3, 0x0f, 29062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "syspll"), /* OUT */ 29162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "sd0"), /* DAT1 */ 29262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "gpio")), /* GPIO57 */ 29362306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("SD0_CLK", 0x18, 0x3, 0x12, 29462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO58 */ 29562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "sd0")), /* CLK */ 29662306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("SD0_DAT2", 0x18, 0x3, 0x15, 29762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "mempll"), /* OUT */ 29862306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "sd0"), /* DAT2 */ 29962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "gpio")), /* GPIO59 */ 30062306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("SD0_DAT3", 0x18, 0x3, 0x18, 30162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "apll0"), /* OUT */ 30262306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "sd0"), /* DAT3 */ 30362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "gpio")), /* GPIO60 */ 30462306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("SD0_CMD", 0x18, 0x3, 0x1b, 30562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "apll1"), /* OUT */ 30662306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "sd0"), /* CMD */ 30762306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x2, "gpio")), /* GPIO61 */ 30862306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("SD0_CDn", 0x1c, 0x3, 0x00, 30962306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO62 */ 31062306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "sd0"), /* CDn */ 31162306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "pwm")), /* PWM2 */ 31262306a36Sopenharmony_ci BERLIN_PINCTRL_GROUP("SD0_WP", 0x1c, 0x3, 0x03, 31362306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO63 */ 31462306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x1, "sd0"), /* WP */ 31562306a36Sopenharmony_ci BERLIN_PINCTRL_FUNCTION(0x3, "pwm")), /* PWM3 */ 31662306a36Sopenharmony_ci}; 31762306a36Sopenharmony_ci 31862306a36Sopenharmony_cistatic const struct berlin_pinctrl_desc as370_soc_pinctrl_data = { 31962306a36Sopenharmony_ci .groups = as370_soc_pinctrl_groups, 32062306a36Sopenharmony_ci .ngroups = ARRAY_SIZE(as370_soc_pinctrl_groups), 32162306a36Sopenharmony_ci}; 32262306a36Sopenharmony_ci 32362306a36Sopenharmony_cistatic const struct of_device_id as370_pinctrl_match[] = { 32462306a36Sopenharmony_ci { 32562306a36Sopenharmony_ci .compatible = "syna,as370-soc-pinctrl", 32662306a36Sopenharmony_ci .data = &as370_soc_pinctrl_data, 32762306a36Sopenharmony_ci }, 32862306a36Sopenharmony_ci {} 32962306a36Sopenharmony_ci}; 33062306a36Sopenharmony_ci 33162306a36Sopenharmony_cistatic int as370_pinctrl_probe(struct platform_device *pdev) 33262306a36Sopenharmony_ci{ 33362306a36Sopenharmony_ci const struct of_device_id *match = 33462306a36Sopenharmony_ci of_match_device(as370_pinctrl_match, &pdev->dev); 33562306a36Sopenharmony_ci struct regmap_config *rmconfig; 33662306a36Sopenharmony_ci struct regmap *regmap; 33762306a36Sopenharmony_ci struct resource *res; 33862306a36Sopenharmony_ci void __iomem *base; 33962306a36Sopenharmony_ci 34062306a36Sopenharmony_ci rmconfig = devm_kzalloc(&pdev->dev, sizeof(*rmconfig), GFP_KERNEL); 34162306a36Sopenharmony_ci if (!rmconfig) 34262306a36Sopenharmony_ci return -ENOMEM; 34362306a36Sopenharmony_ci 34462306a36Sopenharmony_ci base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); 34562306a36Sopenharmony_ci if (IS_ERR(base)) 34662306a36Sopenharmony_ci return PTR_ERR(base); 34762306a36Sopenharmony_ci 34862306a36Sopenharmony_ci rmconfig->reg_bits = 32, 34962306a36Sopenharmony_ci rmconfig->val_bits = 32, 35062306a36Sopenharmony_ci rmconfig->reg_stride = 4, 35162306a36Sopenharmony_ci rmconfig->max_register = resource_size(res); 35262306a36Sopenharmony_ci 35362306a36Sopenharmony_ci regmap = devm_regmap_init_mmio(&pdev->dev, base, rmconfig); 35462306a36Sopenharmony_ci if (IS_ERR(regmap)) 35562306a36Sopenharmony_ci return PTR_ERR(regmap); 35662306a36Sopenharmony_ci 35762306a36Sopenharmony_ci return berlin_pinctrl_probe_regmap(pdev, match->data, regmap); 35862306a36Sopenharmony_ci} 35962306a36Sopenharmony_ci 36062306a36Sopenharmony_cistatic struct platform_driver as370_pinctrl_driver = { 36162306a36Sopenharmony_ci .probe = as370_pinctrl_probe, 36262306a36Sopenharmony_ci .driver = { 36362306a36Sopenharmony_ci .name = "as370-pinctrl", 36462306a36Sopenharmony_ci .of_match_table = as370_pinctrl_match, 36562306a36Sopenharmony_ci }, 36662306a36Sopenharmony_ci}; 36762306a36Sopenharmony_cibuiltin_platform_driver(as370_pinctrl_driver); 368