18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright 2019~2020 NXP 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#include <dt-bindings/pinctrl/pads-imx8dxl.h> 78c2ecf20Sopenharmony_ci#include <linux/err.h> 88c2ecf20Sopenharmony_ci#include <linux/firmware/imx/sci.h> 98c2ecf20Sopenharmony_ci#include <linux/init.h> 108c2ecf20Sopenharmony_ci#include <linux/io.h> 118c2ecf20Sopenharmony_ci#include <linux/module.h> 128c2ecf20Sopenharmony_ci#include <linux/of.h> 138c2ecf20Sopenharmony_ci#include <linux/of_device.h> 148c2ecf20Sopenharmony_ci#include <linux/pinctrl/pinctrl.h> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include "pinctrl-imx.h" 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_cistatic const struct pinctrl_pin_desc imx8dxl_pinctrl_pads[] = { 198c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_PCIE_CTRL0_PERST_B), 208c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_PCIE_CTRL0_CLKREQ_B), 218c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_PCIE_CTRL0_WAKE_B), 228c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_COMP_CTL_GPIO_1V8_3V3_PCIESEP), 238c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_USB_SS3_TC0), 248c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_USB_SS3_TC1), 258c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_USB_SS3_TC2), 268c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_USB_SS3_TC3), 278c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_COMP_CTL_GPIO_3V3_USB3IO), 288c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_EMMC0_CLK), 298c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_EMMC0_CMD), 308c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_EMMC0_DATA0), 318c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_EMMC0_DATA1), 328c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_EMMC0_DATA2), 338c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_EMMC0_DATA3), 348c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_EMMC0_DATA4), 358c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_EMMC0_DATA5), 368c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_EMMC0_DATA6), 378c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_EMMC0_DATA7), 388c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_EMMC0_STROBE), 398c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_EMMC0_RESET_B), 408c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_COMP_CTL_GPIO_1V8_3V3_SD1FIX0), 418c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_USDHC1_RESET_B), 428c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_USDHC1_VSELECT), 438c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_CTL_NAND_RE_P_N), 448c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_USDHC1_WP), 458c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_USDHC1_CD_B), 468c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_CTL_NAND_DQS_P_N), 478c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_COMP_CTL_GPIO_1V8_3V3_VSELSEP), 488c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET0_RGMII_TXC), 498c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET0_RGMII_TX_CTL), 508c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET0_RGMII_TXD0), 518c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET0_RGMII_TXD1), 528c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET0_RGMII_TXD2), 538c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET0_RGMII_TXD3), 548c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_COMP_CTL_GPIO_1V8_3V3_ENET_ENETB0), 558c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET0_RGMII_RXC), 568c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET0_RGMII_RX_CTL), 578c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET0_RGMII_RXD0), 588c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET0_RGMII_RXD1), 598c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET0_RGMII_RXD2), 608c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET0_RGMII_RXD3), 618c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_COMP_CTL_GPIO_1V8_3V3_ENET_ENETB1), 628c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET0_REFCLK_125M_25M), 638c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET0_MDIO), 648c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET0_MDC), 658c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_COMP_CTL_GPIO_1V8_3V3_GPIOCT), 668c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET1_RGMII_TXC), 678c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET1_RGMII_TXD2), 688c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET1_RGMII_TX_CTL), 698c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET1_RGMII_TXD3), 708c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET1_RGMII_RXC), 718c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET1_RGMII_RXD3), 728c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET1_RGMII_RXD2), 738c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET1_RGMII_RXD1), 748c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET1_RGMII_TXD0), 758c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET1_RGMII_TXD1), 768c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET1_RGMII_RXD0), 778c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET1_RGMII_RX_CTL), 788c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ENET1_REFCLK_125M_25M), 798c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_COMP_CTL_GPIO_1V8_3V3_GPIORHB), 808c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SPI3_SCK), 818c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SPI3_SDO), 828c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SPI3_SDI), 838c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SPI3_CS0), 848c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SPI3_CS1), 858c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_MCLK_IN1), 868c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_MCLK_IN0), 878c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_MCLK_OUT0), 888c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_UART1_TX), 898c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_UART1_RX), 908c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_UART1_RTS_B), 918c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_UART1_CTS_B), 928c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_COMP_CTL_GPIO_1V8_3V3_GPIORHK), 938c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SPI0_SCK), 948c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SPI0_SDI), 958c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SPI0_SDO), 968c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SPI0_CS1), 978c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SPI0_CS0), 988c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_COMP_CTL_GPIO_1V8_3V3_GPIORHT), 998c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ADC_IN1), 1008c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ADC_IN0), 1018c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ADC_IN3), 1028c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ADC_IN2), 1038c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ADC_IN5), 1048c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_ADC_IN4), 1058c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_FLEXCAN0_RX), 1068c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_FLEXCAN0_TX), 1078c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_FLEXCAN1_RX), 1088c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_FLEXCAN1_TX), 1098c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_FLEXCAN2_RX), 1108c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_FLEXCAN2_TX), 1118c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_UART0_RX), 1128c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_UART0_TX), 1138c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_UART2_TX), 1148c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_UART2_RX), 1158c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_COMP_CTL_GPIO_1V8_3V3_GPIOLH), 1168c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_JTAG_TRST_B), 1178c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_PMIC_I2C_SCL), 1188c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_PMIC_I2C_SDA), 1198c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_PMIC_INT_B), 1208c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SCU_GPIO0_00), 1218c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SCU_GPIO0_01), 1228c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SCU_PMIC_STANDBY), 1238c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SCU_BOOT_MODE1), 1248c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SCU_BOOT_MODE0), 1258c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SCU_BOOT_MODE2), 1268c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SNVS_TAMPER_OUT1), 1278c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SNVS_TAMPER_OUT2), 1288c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SNVS_TAMPER_OUT3), 1298c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SNVS_TAMPER_OUT4), 1308c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SNVS_TAMPER_IN0), 1318c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SNVS_TAMPER_IN1), 1328c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SNVS_TAMPER_IN2), 1338c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SNVS_TAMPER_IN3), 1348c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SPI1_SCK), 1358c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SPI1_SDO), 1368c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SPI1_SDI), 1378c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_SPI1_CS0), 1388c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_COMP_CTL_GPIO_1V8_3V3_GPIORHD), 1398c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_QSPI0A_DATA1), 1408c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_QSPI0A_DATA0), 1418c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_QSPI0A_DATA3), 1428c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_QSPI0A_DATA2), 1438c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_QSPI0A_SS0_B), 1448c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_QSPI0A_DQS), 1458c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_QSPI0A_SCLK), 1468c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_COMP_CTL_GPIO_1V8_3V3_QSPI0A), 1478c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_QSPI0B_SCLK), 1488c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_QSPI0B_DQS), 1498c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_QSPI0B_DATA1), 1508c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_QSPI0B_DATA0), 1518c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_QSPI0B_DATA3), 1528c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_QSPI0B_DATA2), 1538c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_QSPI0B_SS0_B), 1548c2ecf20Sopenharmony_ci IMX_PINCTRL_PIN(IMX8DXL_COMP_CTL_GPIO_1V8_3V3_QSPI0B) 1558c2ecf20Sopenharmony_ci}; 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_cistatic struct imx_pinctrl_soc_info imx8dxl_pinctrl_info = { 1598c2ecf20Sopenharmony_ci .pins = imx8dxl_pinctrl_pads, 1608c2ecf20Sopenharmony_ci .npins = ARRAY_SIZE(imx8dxl_pinctrl_pads), 1618c2ecf20Sopenharmony_ci .flags = IMX_USE_SCU, 1628c2ecf20Sopenharmony_ci .imx_pinconf_get = imx_pinconf_get_scu, 1638c2ecf20Sopenharmony_ci .imx_pinconf_set = imx_pinconf_set_scu, 1648c2ecf20Sopenharmony_ci .imx_pinctrl_parse_pin = imx_pinctrl_parse_pin_scu, 1658c2ecf20Sopenharmony_ci}; 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_cistatic const struct of_device_id imx8dxl_pinctrl_of_match[] = { 1688c2ecf20Sopenharmony_ci { .compatible = "fsl,imx8dxl-iomuxc", }, 1698c2ecf20Sopenharmony_ci { /* sentinel */ } 1708c2ecf20Sopenharmony_ci}; 1718c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(of, imx8dxl_pinctrl_of_match); 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_cistatic int imx8dxl_pinctrl_probe(struct platform_device *pdev) 1748c2ecf20Sopenharmony_ci{ 1758c2ecf20Sopenharmony_ci int ret; 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ci ret = imx_pinctrl_sc_ipc_init(pdev); 1788c2ecf20Sopenharmony_ci if (ret) 1798c2ecf20Sopenharmony_ci return ret; 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci return imx_pinctrl_probe(pdev, &imx8dxl_pinctrl_info); 1828c2ecf20Sopenharmony_ci} 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_cistatic struct platform_driver imx8dxl_pinctrl_driver = { 1858c2ecf20Sopenharmony_ci .driver = { 1868c2ecf20Sopenharmony_ci .name = "fsl,imx8dxl-iomuxc", 1878c2ecf20Sopenharmony_ci .of_match_table = of_match_ptr(imx8dxl_pinctrl_of_match), 1888c2ecf20Sopenharmony_ci .suppress_bind_attrs = true, 1898c2ecf20Sopenharmony_ci }, 1908c2ecf20Sopenharmony_ci .probe = imx8dxl_pinctrl_probe, 1918c2ecf20Sopenharmony_ci}; 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_cistatic int __init imx8dxl_pinctrl_init(void) 1948c2ecf20Sopenharmony_ci{ 1958c2ecf20Sopenharmony_ci return platform_driver_register(&imx8dxl_pinctrl_driver); 1968c2ecf20Sopenharmony_ci} 1978c2ecf20Sopenharmony_ciarch_initcall(imx8dxl_pinctrl_init); 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ciMODULE_AUTHOR("Anson Huang <Anson.Huang@nxp.com>"); 2008c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("NXP i.MX8DXL pinctrl driver"); 2018c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL v2"); 202