18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2015 MediaTek Inc. 48c2ecf20Sopenharmony_ci * Author: Hongzhou.Yang <hongzhou.yang@mediatek.com> 58c2ecf20Sopenharmony_ci * Yingjoe Chen <yingjoe.chen@mediatek.com> 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#include <linux/init.h> 98c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 108c2ecf20Sopenharmony_ci#include <linux/of.h> 118c2ecf20Sopenharmony_ci#include <linux/of_device.h> 128c2ecf20Sopenharmony_ci#include <linux/pinctrl/pinctrl.h> 138c2ecf20Sopenharmony_ci#include <linux/regmap.h> 148c2ecf20Sopenharmony_ci#include <dt-bindings/pinctrl/mt65xx.h> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include "pinctrl-mtk-common.h" 178c2ecf20Sopenharmony_ci#include "pinctrl-mtk-mt8127.h" 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_cistatic const struct mtk_drv_group_desc mt8127_drv_grp[] = { 208c2ecf20Sopenharmony_ci /* 0E4E8SR 4/8/12/16 */ 218c2ecf20Sopenharmony_ci MTK_DRV_GRP(4, 16, 1, 2, 4), 228c2ecf20Sopenharmony_ci /* 0E2E4SR 2/4/6/8 */ 238c2ecf20Sopenharmony_ci MTK_DRV_GRP(2, 8, 1, 2, 2), 248c2ecf20Sopenharmony_ci /* E8E4E2 2/4/6/8/10/12/14/16 */ 258c2ecf20Sopenharmony_ci MTK_DRV_GRP(2, 16, 0, 2, 2) 268c2ecf20Sopenharmony_ci}; 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_cistatic const struct mtk_pin_drv_grp mt8127_pin_drv[] = { 298c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(0, 0xb00, 0, 1), 308c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(1, 0xb00, 0, 1), 318c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(2, 0xb00, 0, 1), 328c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(3, 0xb00, 0, 1), 338c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(4, 0xb00, 0, 1), 348c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(5, 0xb00, 0, 1), 358c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(6, 0xb00, 0, 1), 368c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(7, 0xb00, 12, 1), 378c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(8, 0xb00, 12, 1), 388c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(9, 0xb00, 12, 1), 398c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(10, 0xb00, 8, 1), 408c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(11, 0xb00, 8, 1), 418c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(12, 0xb00, 8, 1), 428c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(13, 0xb00, 8, 1), 438c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(14, 0xb10, 4, 0), 448c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(15, 0xb10, 4, 0), 458c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(16, 0xb10, 4, 0), 468c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(17, 0xb10, 4, 0), 478c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(18, 0xb10, 8, 0), 488c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(19, 0xb10, 8, 0), 498c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(20, 0xb10, 8, 0), 508c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(21, 0xb10, 8, 0), 518c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(22, 0xb20, 0, 0), 528c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(23, 0xb20, 0, 0), 538c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(24, 0xb20, 0, 0), 548c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(25, 0xb20, 0, 0), 558c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(26, 0xb20, 0, 0), 568c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(27, 0xb20, 4, 0), 578c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(28, 0xb20, 4, 0), 588c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(29, 0xb20, 4, 0), 598c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(30, 0xb20, 4, 0), 608c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(31, 0xb20, 4, 0), 618c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(32, 0xb20, 4, 0), 628c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(33, 0xb30, 4, 1), 638c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(34, 0xb30, 8, 1), 648c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(35, 0xb30, 8, 1), 658c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(36, 0xb30, 8, 1), 668c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(37, 0xb30, 8, 1), 678c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(38, 0xb30, 8, 1), 688c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(39, 0xb30, 12, 1), 698c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(40, 0xb30, 12, 1), 708c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(41, 0xb30, 12, 1), 718c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(42, 0xb30, 12, 1), 728c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(43, 0xb40, 12, 0), 738c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(44, 0xb40, 12, 0), 748c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(45, 0xb40, 12, 0), 758c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(46, 0xb50, 0, 2), 768c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(47, 0xb50, 0, 2), 778c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(48, 0xb50, 0, 2), 788c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(49, 0xb50, 0, 2), 798c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(50, 0xb70, 0, 1), 808c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(51, 0xb70, 0, 1), 818c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(52, 0xb70, 0, 1), 828c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(53, 0xb50, 12, 1), 838c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(54, 0xb50, 12, 1), 848c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(55, 0xb50, 12, 1), 858c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(56, 0xb50, 12, 1), 868c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(59, 0xb40, 4, 1), 878c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(60, 0xb40, 0, 1), 888c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(61, 0xb40, 0, 1), 898c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(62, 0xb40, 0, 1), 908c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(63, 0xb40, 4, 1), 918c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(64, 0xb40, 4, 1), 928c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(65, 0xb40, 4, 1), 938c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(66, 0xb40, 8, 1), 948c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(67, 0xb40, 8, 1), 958c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(68, 0xb40, 8, 1), 968c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(69, 0xb40, 8, 1), 978c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(70, 0xb40, 8, 1), 988c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(71, 0xb40, 8, 1), 998c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(72, 0xb50, 4, 1), 1008c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(73, 0xb50, 4, 1), 1018c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(74, 0xb50, 4, 1), 1028c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(79, 0xb50, 8, 1), 1038c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(80, 0xb50, 8, 1), 1048c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(81, 0xb50, 8, 1), 1058c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(82, 0xb50, 8, 1), 1068c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(83, 0xb50, 8, 1), 1078c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(84, 0xb50, 8, 1), 1088c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(85, 0xce0, 0, 2), 1098c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(86, 0xcd0, 0, 2), 1108c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(87, 0xcf0, 0, 2), 1118c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(88, 0xcf0, 0, 2), 1128c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(89, 0xcf0, 0, 2), 1138c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(90, 0xcf0, 0, 2), 1148c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(117, 0xb60, 12, 1), 1158c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(118, 0xb60, 12, 1), 1168c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(119, 0xb60, 12, 1), 1178c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(120, 0xb60, 12, 1), 1188c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(121, 0xc80, 0, 2), 1198c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(122, 0xc70, 0, 2), 1208c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(123, 0xc90, 0, 2), 1218c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(124, 0xc90, 0, 2), 1228c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(125, 0xc90, 0, 2), 1238c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(126, 0xc90, 0, 2), 1248c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(127, 0xc20, 0, 2), 1258c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(128, 0xc20, 0, 2), 1268c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(129, 0xc20, 0, 2), 1278c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(130, 0xc20, 0, 2), 1288c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(131, 0xc20, 0, 2), 1298c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(132, 0xc10, 0, 2), 1308c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(133, 0xc00, 0, 2), 1318c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(134, 0xc20, 0, 2), 1328c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(135, 0xc20, 0, 2), 1338c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(136, 0xc20, 0, 2), 1348c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(137, 0xc20, 0, 2), 1358c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(142, 0xb50, 0, 2), 1368c2ecf20Sopenharmony_ci}; 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_cistatic const struct mtk_pin_spec_pupd_set_samereg mt8127_spec_pupd[] = { 1398c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(33, 0xd90, 2, 0, 1), /* KPROW0 */ 1408c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(34, 0xd90, 6, 4, 5), /* KPROW1 */ 1418c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(35, 0xd90, 10, 8, 9), /* KPROW2 */ 1428c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(36, 0xda0, 2, 0, 1), /* KPCOL0 */ 1438c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(37, 0xda0, 6, 4, 5), /* KPCOL1 */ 1448c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(38, 0xda0, 10, 8, 9), /* KPCOL2 */ 1458c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(46, 0xdb0, 2, 0, 1), /* EINT14 */ 1468c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(47, 0xdb0, 6, 4, 5), /* EINT15 */ 1478c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(48, 0xdb0, 10, 8, 9), /* EINT16 */ 1488c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(49, 0xdb0, 14, 12, 13), /* EINT17 */ 1498c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(85, 0xce0, 8, 10, 9), /* MSDC2_CMD */ 1508c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(86, 0xcd0, 8, 10, 9), /* MSDC2_CLK */ 1518c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(87, 0xd00, 0, 2, 1), /* MSDC2_DAT0 */ 1528c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(88, 0xd00, 4, 6, 5), /* MSDC2_DAT1 */ 1538c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(89, 0xd00, 8, 10, 9), /* MSDC2_DAT2 */ 1548c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(90, 0xd00, 12, 14, 13), /* MSDC2_DAT3 */ 1558c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(121, 0xc80, 8, 10, 9), /* MSDC1_CMD */ 1568c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(122, 0xc70, 8, 10, 9), /* MSDC1_CLK */ 1578c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(123, 0xca0, 0, 2, 1), /* MSDC1_DAT0 */ 1588c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(124, 0xca0, 4, 6, 5), /* MSDC1_DAT1 */ 1598c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(125, 0xca0, 8, 10, 9), /* MSDC1_DAT2 */ 1608c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(126, 0xca0, 12, 14, 13), /* MSDC1_DAT3 */ 1618c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(127, 0xc40, 12, 14, 13), /* MSDC0_DAT7 */ 1628c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(128, 0xc40, 8, 10, 9), /* MSDC0_DAT6 */ 1638c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(129, 0xc40, 4, 6, 5), /* MSDC0_DAT5 */ 1648c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(130, 0xc40, 0, 2, 1), /* MSDC0_DAT4 */ 1658c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(131, 0xc50, 0, 2, 1), /* MSDC0_RSTB */ 1668c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(132, 0xc10, 8, 10, 9), /* MSDC0_CMD */ 1678c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(133, 0xc00, 8, 10, 9), /* MSDC0_CLK */ 1688c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(134, 0xc30, 12, 14, 13), /* MSDC0_DAT3 */ 1698c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(135, 0xc30, 8, 10, 9), /* MSDC0_DAT2 */ 1708c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(136, 0xc30, 4, 6, 5), /* MSDC0_DAT1 */ 1718c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(137, 0xc30, 0, 2, 1), /* MSDC0_DAT0 */ 1728c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(142, 0xdc0, 2, 0, 1), /* EINT21 */ 1738c2ecf20Sopenharmony_ci}; 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_cistatic int mt8127_spec_pull_set(struct regmap *regmap, unsigned int pin, 1768c2ecf20Sopenharmony_ci unsigned char align, bool isup, unsigned int r1r0) 1778c2ecf20Sopenharmony_ci{ 1788c2ecf20Sopenharmony_ci return mtk_pctrl_spec_pull_set_samereg(regmap, mt8127_spec_pupd, 1798c2ecf20Sopenharmony_ci ARRAY_SIZE(mt8127_spec_pupd), pin, align, isup, r1r0); 1808c2ecf20Sopenharmony_ci} 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_cistatic const struct mtk_pin_ies_smt_set mt8127_ies_set[] = { 1838c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(0, 9, 0x900, 0), 1848c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(10, 13, 0x900, 1), 1858c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(14, 28, 0x900, 2), 1868c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(29, 32, 0x900, 3), 1878c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(33, 33, 0x910, 11), 1888c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(34, 38, 0x900, 10), 1898c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(39, 42, 0x900, 11), 1908c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(43, 45, 0x900, 12), 1918c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(46, 49, 0x900, 13), 1928c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(50, 52, 0x910, 10), 1938c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(53, 56, 0x900, 14), 1948c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(57, 58, 0x910, 0), 1958c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(59, 65, 0x910, 2), 1968c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(66, 71, 0x910, 3), 1978c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(72, 74, 0x910, 4), 1988c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(75, 76, 0x900, 15), 1998c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(77, 78, 0x910, 1), 2008c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(79, 82, 0x910, 5), 2018c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(83, 84, 0x910, 6), 2028c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(117, 120, 0x910, 7), 2038c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(121, 121, 0xc80, 4), 2048c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(122, 122, 0xc70, 4), 2058c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(123, 126, 0xc90, 4), 2068c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(127, 131, 0xc20, 4), 2078c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(132, 132, 0xc10, 4), 2088c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(133, 133, 0xc00, 4), 2098c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(134, 137, 0xc20, 4), 2108c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(138, 141, 0x910, 9), 2118c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(142, 142, 0x900, 13), 2128c2ecf20Sopenharmony_ci}; 2138c2ecf20Sopenharmony_ci 2148c2ecf20Sopenharmony_cistatic const struct mtk_pin_ies_smt_set mt8127_smt_set[] = { 2158c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(0, 9, 0x920, 0), 2168c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(10, 13, 0x920, 1), 2178c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(14, 28, 0x920, 2), 2188c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(29, 32, 0x920, 3), 2198c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(33, 33, 0x930, 11), 2208c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(34, 38, 0x920, 10), 2218c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(39, 42, 0x920, 11), 2228c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(43, 45, 0x920, 12), 2238c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(46, 49, 0x920, 13), 2248c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(50, 52, 0x930, 10), 2258c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(53, 56, 0x920, 14), 2268c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(57, 58, 0x930, 0), 2278c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(59, 65, 0x930, 2), 2288c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(66, 71, 0x930, 3), 2298c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(72, 74, 0x930, 4), 2308c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(75, 76, 0x920, 15), 2318c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(77, 78, 0x930, 1), 2328c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(79, 82, 0x930, 5), 2338c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(83, 84, 0x930, 6), 2348c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(85, 85, 0xce0, 11), 2358c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(86, 86, 0xcd0, 11), 2368c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(87, 87, 0xd00, 3), 2378c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(88, 88, 0xd00, 7), 2388c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(89, 89, 0xd00, 11), 2398c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(90, 90, 0xd00, 15), 2408c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(117, 120, 0x930, 7), 2418c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(121, 121, 0xc80, 11), 2428c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(122, 122, 0xc70, 11), 2438c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(123, 123, 0xca0, 3), 2448c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(124, 124, 0xca0, 7), 2458c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(125, 125, 0xca0, 11), 2468c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(126, 126, 0xca0, 15), 2478c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(127, 127, 0xc40, 15), 2488c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(128, 128, 0xc40, 11), 2498c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(129, 129, 0xc40, 7), 2508c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(130, 130, 0xc40, 3), 2518c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(131, 131, 0xc50, 3), 2528c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(132, 132, 0xc10, 11), 2538c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(133, 133, 0xc00, 11), 2548c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(134, 134, 0xc30, 15), 2558c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(135, 135, 0xc30, 11), 2568c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(136, 136, 0xc30, 7), 2578c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(137, 137, 0xc30, 3), 2588c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(138, 141, 0x930, 9), 2598c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(142, 142, 0x920, 13), 2608c2ecf20Sopenharmony_ci}; 2618c2ecf20Sopenharmony_ci 2628c2ecf20Sopenharmony_cistatic int mt8127_ies_smt_set(struct regmap *regmap, unsigned int pin, 2638c2ecf20Sopenharmony_ci unsigned char align, int value, enum pin_config_param arg) 2648c2ecf20Sopenharmony_ci{ 2658c2ecf20Sopenharmony_ci if (arg == PIN_CONFIG_INPUT_ENABLE) 2668c2ecf20Sopenharmony_ci return mtk_pconf_spec_set_ies_smt_range(regmap, mt8127_ies_set, 2678c2ecf20Sopenharmony_ci ARRAY_SIZE(mt8127_ies_set), pin, align, value); 2688c2ecf20Sopenharmony_ci else if (arg == PIN_CONFIG_INPUT_SCHMITT_ENABLE) 2698c2ecf20Sopenharmony_ci return mtk_pconf_spec_set_ies_smt_range(regmap, mt8127_smt_set, 2708c2ecf20Sopenharmony_ci ARRAY_SIZE(mt8127_smt_set), pin, align, value); 2718c2ecf20Sopenharmony_ci return -EINVAL; 2728c2ecf20Sopenharmony_ci} 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_cistatic const struct mtk_pinctrl_devdata mt8127_pinctrl_data = { 2768c2ecf20Sopenharmony_ci .pins = mtk_pins_mt8127, 2778c2ecf20Sopenharmony_ci .npins = ARRAY_SIZE(mtk_pins_mt8127), 2788c2ecf20Sopenharmony_ci .grp_desc = mt8127_drv_grp, 2798c2ecf20Sopenharmony_ci .n_grp_cls = ARRAY_SIZE(mt8127_drv_grp), 2808c2ecf20Sopenharmony_ci .pin_drv_grp = mt8127_pin_drv, 2818c2ecf20Sopenharmony_ci .n_pin_drv_grps = ARRAY_SIZE(mt8127_pin_drv), 2828c2ecf20Sopenharmony_ci .spec_pull_set = mt8127_spec_pull_set, 2838c2ecf20Sopenharmony_ci .spec_ies_smt_set = mt8127_ies_smt_set, 2848c2ecf20Sopenharmony_ci .dir_offset = 0x0000, 2858c2ecf20Sopenharmony_ci .pullen_offset = 0x0100, 2868c2ecf20Sopenharmony_ci .pullsel_offset = 0x0200, 2878c2ecf20Sopenharmony_ci .dout_offset = 0x0400, 2888c2ecf20Sopenharmony_ci .din_offset = 0x0500, 2898c2ecf20Sopenharmony_ci .pinmux_offset = 0x0600, 2908c2ecf20Sopenharmony_ci .type1_start = 143, 2918c2ecf20Sopenharmony_ci .type1_end = 143, 2928c2ecf20Sopenharmony_ci .port_shf = 4, 2938c2ecf20Sopenharmony_ci .port_mask = 0xf, 2948c2ecf20Sopenharmony_ci .port_align = 4, 2958c2ecf20Sopenharmony_ci .eint_hw = { 2968c2ecf20Sopenharmony_ci .port_mask = 7, 2978c2ecf20Sopenharmony_ci .ports = 6, 2988c2ecf20Sopenharmony_ci .ap_num = 143, 2998c2ecf20Sopenharmony_ci .db_cnt = 16, 3008c2ecf20Sopenharmony_ci }, 3018c2ecf20Sopenharmony_ci}; 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_cistatic int mt8127_pinctrl_probe(struct platform_device *pdev) 3048c2ecf20Sopenharmony_ci{ 3058c2ecf20Sopenharmony_ci return mtk_pctrl_init(pdev, &mt8127_pinctrl_data, NULL); 3068c2ecf20Sopenharmony_ci} 3078c2ecf20Sopenharmony_ci 3088c2ecf20Sopenharmony_cistatic const struct of_device_id mt8127_pctrl_match[] = { 3098c2ecf20Sopenharmony_ci { .compatible = "mediatek,mt8127-pinctrl", }, 3108c2ecf20Sopenharmony_ci { } 3118c2ecf20Sopenharmony_ci}; 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_cistatic struct platform_driver mtk_pinctrl_driver = { 3148c2ecf20Sopenharmony_ci .probe = mt8127_pinctrl_probe, 3158c2ecf20Sopenharmony_ci .driver = { 3168c2ecf20Sopenharmony_ci .name = "mediatek-mt8127-pinctrl", 3178c2ecf20Sopenharmony_ci .of_match_table = mt8127_pctrl_match, 3188c2ecf20Sopenharmony_ci }, 3198c2ecf20Sopenharmony_ci}; 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_cistatic int __init mtk_pinctrl_init(void) 3228c2ecf20Sopenharmony_ci{ 3238c2ecf20Sopenharmony_ci return platform_driver_register(&mtk_pinctrl_driver); 3248c2ecf20Sopenharmony_ci} 3258c2ecf20Sopenharmony_ciarch_initcall(mtk_pinctrl_init); 326