18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2014-2015 MediaTek Inc. 48c2ecf20Sopenharmony_ci * Author: Hongzhou.Yang <hongzhou.yang@mediatek.com> 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <linux/init.h> 88c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 98c2ecf20Sopenharmony_ci#include <linux/of.h> 108c2ecf20Sopenharmony_ci#include <linux/of_device.h> 118c2ecf20Sopenharmony_ci#include <linux/pinctrl/pinctrl.h> 128c2ecf20Sopenharmony_ci#include <linux/regmap.h> 138c2ecf20Sopenharmony_ci#include <linux/pinctrl/pinconf-generic.h> 148c2ecf20Sopenharmony_ci#include <dt-bindings/pinctrl/mt65xx.h> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include "pinctrl-mtk-common.h" 178c2ecf20Sopenharmony_ci#include "pinctrl-mtk-mt8173.h" 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#define DRV_BASE 0xb00 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_cistatic const struct mtk_pin_spec_pupd_set_samereg mt8173_spec_pupd[] = { 228c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(119, 0xe00, 2, 1, 0), /* KROW0 */ 238c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(120, 0xe00, 6, 5, 4), /* KROW1 */ 248c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(121, 0xe00, 10, 9, 8), /* KROW2 */ 258c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(122, 0xe10, 2, 1, 0), /* KCOL0 */ 268c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(123, 0xe10, 6, 5, 4), /* KCOL1 */ 278c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(124, 0xe10, 10, 9, 8), /* KCOL2 */ 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(67, 0xd10, 2, 1, 0), /* ms0 DS */ 308c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(68, 0xd00, 2, 1, 0), /* ms0 RST */ 318c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(66, 0xc10, 2, 1, 0), /* ms0 cmd */ 328c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(65, 0xc00, 2, 1, 0), /* ms0 clk */ 338c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(57, 0xc20, 2, 1, 0), /* ms0 data0 */ 348c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(58, 0xc20, 2, 1, 0), /* ms0 data1 */ 358c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(59, 0xc20, 2, 1, 0), /* ms0 data2 */ 368c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(60, 0xc20, 2, 1, 0), /* ms0 data3 */ 378c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(61, 0xc20, 2, 1, 0), /* ms0 data4 */ 388c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(62, 0xc20, 2, 1, 0), /* ms0 data5 */ 398c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(63, 0xc20, 2, 1, 0), /* ms0 data6 */ 408c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(64, 0xc20, 2, 1, 0), /* ms0 data7 */ 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(78, 0xc50, 2, 1, 0), /* ms1 cmd */ 438c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(73, 0xd20, 2, 1, 0), /* ms1 dat0 */ 448c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(74, 0xd20, 6, 5, 4), /* ms1 dat1 */ 458c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(75, 0xd20, 10, 9, 8), /* ms1 dat2 */ 468c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(76, 0xd20, 14, 13, 12), /* ms1 dat3 */ 478c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(77, 0xc40, 2, 1, 0), /* ms1 clk */ 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(100, 0xd40, 2, 1, 0), /* ms2 dat0 */ 508c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(101, 0xd40, 6, 5, 4), /* ms2 dat1 */ 518c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(102, 0xd40, 10, 9, 8), /* ms2 dat2 */ 528c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(103, 0xd40, 14, 13, 12), /* ms2 dat3 */ 538c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(104, 0xc80, 2, 1, 0), /* ms2 clk */ 548c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(105, 0xc90, 2, 1, 0), /* ms2 cmd */ 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(22, 0xd60, 2, 1, 0), /* ms3 dat0 */ 578c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(23, 0xd60, 6, 5, 4), /* ms3 dat1 */ 588c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(24, 0xd60, 10, 9, 8), /* ms3 dat2 */ 598c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(25, 0xd60, 14, 13, 12), /* ms3 dat3 */ 608c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(26, 0xcc0, 2, 1, 0), /* ms3 clk */ 618c2ecf20Sopenharmony_ci MTK_PIN_PUPD_SPEC_SR(27, 0xcd0, 2, 1, 0) /* ms3 cmd */ 628c2ecf20Sopenharmony_ci}; 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_cistatic int mt8173_spec_pull_set(struct regmap *regmap, unsigned int pin, 658c2ecf20Sopenharmony_ci unsigned char align, bool isup, unsigned int r1r0) 668c2ecf20Sopenharmony_ci{ 678c2ecf20Sopenharmony_ci return mtk_pctrl_spec_pull_set_samereg(regmap, mt8173_spec_pupd, 688c2ecf20Sopenharmony_ci ARRAY_SIZE(mt8173_spec_pupd), pin, align, isup, r1r0); 698c2ecf20Sopenharmony_ci} 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_cistatic const struct mtk_pin_ies_smt_set mt8173_smt_set[] = { 728c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(0, 4, 0x930, 1), 738c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(5, 9, 0x930, 2), 748c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(10, 13, 0x930, 10), 758c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(14, 15, 0x940, 10), 768c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(16, 16, 0x930, 0), 778c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(17, 17, 0x950, 2), 788c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(18, 21, 0x940, 3), 798c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(22, 25, 0xce0, 13), 808c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(26, 26, 0xcc0, 13), 818c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(27, 27, 0xcd0, 13), 828c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(28, 28, 0xd70, 13), 838c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(29, 32, 0x930, 3), 848c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(33, 33, 0x930, 4), 858c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(34, 36, 0x930, 5), 868c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(37, 38, 0x930, 6), 878c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(39, 39, 0x930, 7), 888c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(40, 41, 0x930, 9), 898c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(42, 42, 0x940, 0), 908c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(43, 44, 0x930, 11), 918c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(45, 46, 0x930, 12), 928c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(57, 64, 0xc20, 13), 938c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(65, 65, 0xc10, 13), 948c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(66, 66, 0xc00, 13), 958c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(67, 67, 0xd10, 13), 968c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(68, 68, 0xd00, 13), 978c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(69, 72, 0x940, 14), 988c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(73, 76, 0xc60, 13), 998c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(77, 77, 0xc40, 13), 1008c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(78, 78, 0xc50, 13), 1018c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(79, 82, 0x940, 15), 1028c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(83, 83, 0x950, 0), 1038c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(84, 85, 0x950, 1), 1048c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(86, 91, 0x950, 2), 1058c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(92, 92, 0x930, 13), 1068c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(93, 95, 0x930, 14), 1078c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(96, 99, 0x930, 15), 1088c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(100, 103, 0xca0, 13), 1098c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(104, 104, 0xc80, 13), 1108c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(105, 105, 0xc90, 13), 1118c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(106, 107, 0x940, 4), 1128c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(108, 112, 0x940, 1), 1138c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(113, 116, 0x940, 2), 1148c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(117, 118, 0x940, 5), 1158c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(119, 124, 0x940, 6), 1168c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(125, 126, 0x940, 7), 1178c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(127, 127, 0x940, 0), 1188c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(128, 128, 0x950, 8), 1198c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(129, 130, 0x950, 9), 1208c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(131, 132, 0x950, 8), 1218c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(133, 134, 0x910, 8) 1228c2ecf20Sopenharmony_ci}; 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_cistatic const struct mtk_pin_ies_smt_set mt8173_ies_set[] = { 1258c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(0, 4, 0x900, 1), 1268c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(5, 9, 0x900, 2), 1278c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(10, 13, 0x900, 10), 1288c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(14, 15, 0x910, 10), 1298c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(16, 16, 0x900, 0), 1308c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(17, 17, 0x920, 2), 1318c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(18, 21, 0x910, 3), 1328c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(22, 25, 0xce0, 14), 1338c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(26, 26, 0xcc0, 14), 1348c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(27, 27, 0xcd0, 14), 1358c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(28, 28, 0xd70, 14), 1368c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(29, 32, 0x900, 3), 1378c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(33, 33, 0x900, 4), 1388c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(34, 36, 0x900, 5), 1398c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(37, 38, 0x900, 6), 1408c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(39, 39, 0x900, 7), 1418c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(40, 41, 0x900, 9), 1428c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(42, 42, 0x910, 0), 1438c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(43, 44, 0x900, 11), 1448c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(45, 46, 0x900, 12), 1458c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(57, 64, 0xc20, 14), 1468c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(65, 65, 0xc10, 14), 1478c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(66, 66, 0xc00, 14), 1488c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(67, 67, 0xd10, 14), 1498c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(68, 68, 0xd00, 14), 1508c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(69, 72, 0x910, 14), 1518c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(73, 76, 0xc60, 14), 1528c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(77, 77, 0xc40, 14), 1538c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(78, 78, 0xc50, 14), 1548c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(79, 82, 0x910, 15), 1558c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(83, 83, 0x920, 0), 1568c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(84, 85, 0x920, 1), 1578c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(86, 91, 0x920, 2), 1588c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(92, 92, 0x900, 13), 1598c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(93, 95, 0x900, 14), 1608c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(96, 99, 0x900, 15), 1618c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(100, 103, 0xca0, 14), 1628c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(104, 104, 0xc80, 14), 1638c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(105, 105, 0xc90, 14), 1648c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(106, 107, 0x910, 4), 1658c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(108, 112, 0x910, 1), 1668c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(113, 116, 0x910, 2), 1678c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(117, 118, 0x910, 5), 1688c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(119, 124, 0x910, 6), 1698c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(125, 126, 0x910, 7), 1708c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(127, 127, 0x910, 0), 1718c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(128, 128, 0x920, 8), 1728c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(129, 130, 0x920, 9), 1738c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(131, 132, 0x920, 8), 1748c2ecf20Sopenharmony_ci MTK_PIN_IES_SMT_SPEC(133, 134, 0x910, 8) 1758c2ecf20Sopenharmony_ci}; 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_cistatic int mt8173_ies_smt_set(struct regmap *regmap, unsigned int pin, 1788c2ecf20Sopenharmony_ci unsigned char align, int value, enum pin_config_param arg) 1798c2ecf20Sopenharmony_ci{ 1808c2ecf20Sopenharmony_ci if (arg == PIN_CONFIG_INPUT_ENABLE) 1818c2ecf20Sopenharmony_ci return mtk_pconf_spec_set_ies_smt_range(regmap, mt8173_ies_set, 1828c2ecf20Sopenharmony_ci ARRAY_SIZE(mt8173_ies_set), pin, align, value); 1838c2ecf20Sopenharmony_ci else if (arg == PIN_CONFIG_INPUT_SCHMITT_ENABLE) 1848c2ecf20Sopenharmony_ci return mtk_pconf_spec_set_ies_smt_range(regmap, mt8173_smt_set, 1858c2ecf20Sopenharmony_ci ARRAY_SIZE(mt8173_smt_set), pin, align, value); 1868c2ecf20Sopenharmony_ci return -EINVAL; 1878c2ecf20Sopenharmony_ci} 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_cistatic const struct mtk_drv_group_desc mt8173_drv_grp[] = { 1908c2ecf20Sopenharmony_ci /* 0E4E8SR 4/8/12/16 */ 1918c2ecf20Sopenharmony_ci MTK_DRV_GRP(4, 16, 1, 2, 4), 1928c2ecf20Sopenharmony_ci /* 0E2E4SR 2/4/6/8 */ 1938c2ecf20Sopenharmony_ci MTK_DRV_GRP(2, 8, 1, 2, 2), 1948c2ecf20Sopenharmony_ci /* E8E4E2 2/4/6/8/10/12/14/16 */ 1958c2ecf20Sopenharmony_ci MTK_DRV_GRP(2, 16, 0, 2, 2) 1968c2ecf20Sopenharmony_ci}; 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_cistatic const struct mtk_pin_drv_grp mt8173_pin_drv[] = { 1998c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(0, DRV_BASE+0x20, 12, 0), 2008c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(1, DRV_BASE+0x20, 12, 0), 2018c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(2, DRV_BASE+0x20, 12, 0), 2028c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(3, DRV_BASE+0x20, 12, 0), 2038c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(4, DRV_BASE+0x20, 12, 0), 2048c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(5, DRV_BASE+0x30, 0, 0), 2058c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(6, DRV_BASE+0x30, 0, 0), 2068c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(7, DRV_BASE+0x30, 0, 0), 2078c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(8, DRV_BASE+0x30, 0, 0), 2088c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(9, DRV_BASE+0x30, 0, 0), 2098c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(10, DRV_BASE+0x30, 4, 1), 2108c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(11, DRV_BASE+0x30, 4, 1), 2118c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(12, DRV_BASE+0x30, 4, 1), 2128c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(13, DRV_BASE+0x30, 4, 1), 2138c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(14, DRV_BASE+0x40, 8, 1), 2148c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(15, DRV_BASE+0x40, 8, 1), 2158c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(16, DRV_BASE, 8, 1), 2168c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(17, 0xce0, 8, 2), 2178c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(22, 0xce0, 8, 2), 2188c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(23, 0xce0, 8, 2), 2198c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(24, 0xce0, 8, 2), 2208c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(25, 0xce0, 8, 2), 2218c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(26, 0xcc0, 8, 2), 2228c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(27, 0xcd0, 8, 2), 2238c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(28, 0xd70, 8, 2), 2248c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(29, DRV_BASE+0x80, 12, 1), 2258c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(30, DRV_BASE+0x80, 12, 1), 2268c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(31, DRV_BASE+0x80, 12, 1), 2278c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(32, DRV_BASE+0x80, 12, 1), 2288c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(33, DRV_BASE+0x10, 12, 1), 2298c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(34, DRV_BASE+0x10, 8, 1), 2308c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(35, DRV_BASE+0x10, 8, 1), 2318c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(36, DRV_BASE+0x10, 8, 1), 2328c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(37, DRV_BASE+0x10, 4, 1), 2338c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(38, DRV_BASE+0x10, 4, 1), 2348c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(39, DRV_BASE+0x20, 0, 0), 2358c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(40, DRV_BASE+0x20, 8, 0), 2368c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(41, DRV_BASE+0x20, 8, 0), 2378c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(42, DRV_BASE+0x50, 8, 1), 2388c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(57, 0xc20, 8, 2), 2398c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(58, 0xc20, 8, 2), 2408c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(59, 0xc20, 8, 2), 2418c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(60, 0xc20, 8, 2), 2428c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(61, 0xc20, 8, 2), 2438c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(62, 0xc20, 8, 2), 2448c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(63, 0xc20, 8, 2), 2458c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(64, 0xc20, 8, 2), 2468c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(65, 0xc00, 8, 2), 2478c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(66, 0xc10, 8, 2), 2488c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(67, 0xd10, 8, 2), 2498c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(68, 0xd00, 8, 2), 2508c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(69, DRV_BASE+0x80, 0, 1), 2518c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(70, DRV_BASE+0x80, 0, 1), 2528c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(71, DRV_BASE+0x80, 0, 1), 2538c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(72, DRV_BASE+0x80, 0, 1), 2548c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(73, 0xc60, 8, 2), 2558c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(74, 0xc60, 8, 2), 2568c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(75, 0xc60, 8, 2), 2578c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(76, 0xc60, 8, 2), 2588c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(77, 0xc40, 8, 2), 2598c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(78, 0xc50, 8, 2), 2608c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(79, DRV_BASE+0x70, 12, 1), 2618c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(80, DRV_BASE+0x70, 12, 1), 2628c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(81, DRV_BASE+0x70, 12, 1), 2638c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(82, DRV_BASE+0x70, 12, 1), 2648c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(83, DRV_BASE, 4, 1), 2658c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(84, DRV_BASE, 0, 1), 2668c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(85, DRV_BASE, 0, 1), 2678c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(85, DRV_BASE+0x60, 8, 1), 2688c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(86, DRV_BASE+0x60, 8, 1), 2698c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(87, DRV_BASE+0x60, 8, 1), 2708c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(88, DRV_BASE+0x60, 8, 1), 2718c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(89, DRV_BASE+0x60, 8, 1), 2728c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(90, DRV_BASE+0x60, 8, 1), 2738c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(91, DRV_BASE+0x60, 8, 1), 2748c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(92, DRV_BASE+0x60, 4, 0), 2758c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(93, DRV_BASE+0x60, 0, 0), 2768c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(94, DRV_BASE+0x60, 0, 0), 2778c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(95, DRV_BASE+0x60, 0, 0), 2788c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(96, DRV_BASE+0x80, 8, 1), 2798c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(97, DRV_BASE+0x80, 8, 1), 2808c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(98, DRV_BASE+0x80, 8, 1), 2818c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(99, DRV_BASE+0x80, 8, 1), 2828c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(100, 0xca0, 8, 2), 2838c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(101, 0xca0, 8, 2), 2848c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(102, 0xca0, 8, 2), 2858c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(103, 0xca0, 8, 2), 2868c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(104, 0xc80, 8, 2), 2878c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(105, 0xc90, 8, 2), 2888c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(108, DRV_BASE+0x50, 0, 1), 2898c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(109, DRV_BASE+0x50, 0, 1), 2908c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(110, DRV_BASE+0x50, 0, 1), 2918c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(111, DRV_BASE+0x50, 0, 1), 2928c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(112, DRV_BASE+0x50, 0, 1), 2938c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(113, DRV_BASE+0x80, 4, 1), 2948c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(114, DRV_BASE+0x80, 4, 1), 2958c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(115, DRV_BASE+0x80, 4, 1), 2968c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(116, DRV_BASE+0x80, 4, 1), 2978c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(117, DRV_BASE+0x90, 0, 1), 2988c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(118, DRV_BASE+0x90, 0, 1), 2998c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(119, DRV_BASE+0x50, 4, 1), 3008c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(120, DRV_BASE+0x50, 4, 1), 3018c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(121, DRV_BASE+0x50, 4, 1), 3028c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(122, DRV_BASE+0x50, 4, 1), 3038c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(123, DRV_BASE+0x50, 4, 1), 3048c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(124, DRV_BASE+0x50, 4, 1), 3058c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(125, DRV_BASE+0x30, 12, 1), 3068c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(126, DRV_BASE+0x30, 12, 1), 3078c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(127, DRV_BASE+0x50, 8, 1), 3088c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(128, DRV_BASE+0x40, 0, 1), 3098c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(129, DRV_BASE+0x40, 0, 1), 3108c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(130, DRV_BASE+0x40, 0, 1), 3118c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(131, DRV_BASE+0x40, 0, 1), 3128c2ecf20Sopenharmony_ci MTK_PIN_DRV_GRP(132, DRV_BASE+0x40, 0, 1) 3138c2ecf20Sopenharmony_ci}; 3148c2ecf20Sopenharmony_ci 3158c2ecf20Sopenharmony_cistatic const struct mtk_pinctrl_devdata mt8173_pinctrl_data = { 3168c2ecf20Sopenharmony_ci .pins = mtk_pins_mt8173, 3178c2ecf20Sopenharmony_ci .npins = ARRAY_SIZE(mtk_pins_mt8173), 3188c2ecf20Sopenharmony_ci .grp_desc = mt8173_drv_grp, 3198c2ecf20Sopenharmony_ci .n_grp_cls = ARRAY_SIZE(mt8173_drv_grp), 3208c2ecf20Sopenharmony_ci .pin_drv_grp = mt8173_pin_drv, 3218c2ecf20Sopenharmony_ci .n_pin_drv_grps = ARRAY_SIZE(mt8173_pin_drv), 3228c2ecf20Sopenharmony_ci .spec_pull_set = mt8173_spec_pull_set, 3238c2ecf20Sopenharmony_ci .spec_ies_smt_set = mt8173_ies_smt_set, 3248c2ecf20Sopenharmony_ci .dir_offset = 0x0000, 3258c2ecf20Sopenharmony_ci .pullen_offset = 0x0100, 3268c2ecf20Sopenharmony_ci .pullsel_offset = 0x0200, 3278c2ecf20Sopenharmony_ci .dout_offset = 0x0400, 3288c2ecf20Sopenharmony_ci .din_offset = 0x0500, 3298c2ecf20Sopenharmony_ci .pinmux_offset = 0x0600, 3308c2ecf20Sopenharmony_ci .type1_start = 135, 3318c2ecf20Sopenharmony_ci .type1_end = 135, 3328c2ecf20Sopenharmony_ci .port_shf = 4, 3338c2ecf20Sopenharmony_ci .port_mask = 0xf, 3348c2ecf20Sopenharmony_ci .port_align = 4, 3358c2ecf20Sopenharmony_ci .eint_hw = { 3368c2ecf20Sopenharmony_ci .port_mask = 7, 3378c2ecf20Sopenharmony_ci .ports = 6, 3388c2ecf20Sopenharmony_ci .ap_num = 224, 3398c2ecf20Sopenharmony_ci .db_cnt = 16, 3408c2ecf20Sopenharmony_ci }, 3418c2ecf20Sopenharmony_ci}; 3428c2ecf20Sopenharmony_ci 3438c2ecf20Sopenharmony_cistatic int mt8173_pinctrl_probe(struct platform_device *pdev) 3448c2ecf20Sopenharmony_ci{ 3458c2ecf20Sopenharmony_ci return mtk_pctrl_init(pdev, &mt8173_pinctrl_data, NULL); 3468c2ecf20Sopenharmony_ci} 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_cistatic const struct of_device_id mt8173_pctrl_match[] = { 3498c2ecf20Sopenharmony_ci { 3508c2ecf20Sopenharmony_ci .compatible = "mediatek,mt8173-pinctrl", 3518c2ecf20Sopenharmony_ci }, 3528c2ecf20Sopenharmony_ci { } 3538c2ecf20Sopenharmony_ci}; 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_cistatic struct platform_driver mtk_pinctrl_driver = { 3568c2ecf20Sopenharmony_ci .probe = mt8173_pinctrl_probe, 3578c2ecf20Sopenharmony_ci .driver = { 3588c2ecf20Sopenharmony_ci .name = "mediatek-mt8173-pinctrl", 3598c2ecf20Sopenharmony_ci .of_match_table = mt8173_pctrl_match, 3608c2ecf20Sopenharmony_ci .pm = &mtk_eint_pm_ops, 3618c2ecf20Sopenharmony_ci }, 3628c2ecf20Sopenharmony_ci}; 3638c2ecf20Sopenharmony_ci 3648c2ecf20Sopenharmony_cistatic int __init mtk_pinctrl_init(void) 3658c2ecf20Sopenharmony_ci{ 3668c2ecf20Sopenharmony_ci return platform_driver_register(&mtk_pinctrl_driver); 3678c2ecf20Sopenharmony_ci} 3688c2ecf20Sopenharmony_ciarch_initcall(mtk_pinctrl_init); 369