18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2015 MediaTek Inc.
48c2ecf20Sopenharmony_ci * Author: Biao Huang <biao.huang@mediatek.com>
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#include <dt-bindings/pinctrl/mt65xx.h>
88c2ecf20Sopenharmony_ci#include <linux/module.h>
98c2ecf20Sopenharmony_ci#include <linux/of.h>
108c2ecf20Sopenharmony_ci#include <linux/of_device.h>
118c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
128c2ecf20Sopenharmony_ci#include <linux/pinctrl/pinctrl.h>
138c2ecf20Sopenharmony_ci#include <linux/regmap.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#include "pinctrl-mtk-common.h"
168c2ecf20Sopenharmony_ci#include "pinctrl-mtk-mt2701.h"
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/**
198c2ecf20Sopenharmony_ci * struct mtk_spec_pinmux_set
208c2ecf20Sopenharmony_ci * - For special pins' mode setting
218c2ecf20Sopenharmony_ci * @pin: The pin number.
228c2ecf20Sopenharmony_ci * @offset: The offset of extra setting register.
238c2ecf20Sopenharmony_ci * @bit: The bit of extra setting register.
248c2ecf20Sopenharmony_ci */
258c2ecf20Sopenharmony_cistruct mtk_spec_pinmux_set {
268c2ecf20Sopenharmony_ci	unsigned short pin;
278c2ecf20Sopenharmony_ci	unsigned short offset;
288c2ecf20Sopenharmony_ci	unsigned char bit;
298c2ecf20Sopenharmony_ci};
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#define MTK_PINMUX_SPEC(_pin, _offset, _bit)	\
328c2ecf20Sopenharmony_ci	{					\
338c2ecf20Sopenharmony_ci		.pin = _pin,			\
348c2ecf20Sopenharmony_ci		.offset = _offset,		\
358c2ecf20Sopenharmony_ci		.bit = _bit,			\
368c2ecf20Sopenharmony_ci	}
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_cistatic const struct mtk_drv_group_desc mt2701_drv_grp[] =  {
398c2ecf20Sopenharmony_ci	/* 0E4E8SR 4/8/12/16 */
408c2ecf20Sopenharmony_ci	MTK_DRV_GRP(4, 16, 1, 2, 4),
418c2ecf20Sopenharmony_ci	/* 0E2E4SR  2/4/6/8 */
428c2ecf20Sopenharmony_ci	MTK_DRV_GRP(2, 8, 1, 2, 2),
438c2ecf20Sopenharmony_ci	/* E8E4E2  2/4/6/8/10/12/14/16 */
448c2ecf20Sopenharmony_ci	MTK_DRV_GRP(2, 16, 0, 2, 2)
458c2ecf20Sopenharmony_ci};
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_cistatic const struct mtk_pin_drv_grp mt2701_pin_drv[] = {
488c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(0, 0xf50, 0, 1),
498c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(1, 0xf50, 0, 1),
508c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(2, 0xf50, 0, 1),
518c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(3, 0xf50, 0, 1),
528c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(4, 0xf50, 0, 1),
538c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(5, 0xf50, 0, 1),
548c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(6, 0xf50, 0, 1),
558c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(7, 0xf50, 4, 1),
568c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(8, 0xf50, 4, 1),
578c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(9, 0xf50, 4, 1),
588c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(10, 0xf50, 8, 1),
598c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(11, 0xf50, 8, 1),
608c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(12, 0xf50, 8, 1),
618c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(13, 0xf50, 8, 1),
628c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(14, 0xf50, 12, 0),
638c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(15, 0xf50, 12, 0),
648c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(16, 0xf60, 0, 0),
658c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(17, 0xf60, 0, 0),
668c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(18, 0xf60, 4, 0),
678c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(19, 0xf60, 4, 0),
688c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(20, 0xf60, 4, 0),
698c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(21, 0xf60, 4, 0),
708c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(22, 0xf60, 8, 0),
718c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(23, 0xf60, 8, 0),
728c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(24, 0xf60, 8, 0),
738c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(25, 0xf60, 8, 0),
748c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(26, 0xf60, 8, 0),
758c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(27, 0xf60, 12, 0),
768c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(28, 0xf60, 12, 0),
778c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(29, 0xf60, 12, 0),
788c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(30, 0xf60, 0, 0),
798c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(31, 0xf60, 0, 0),
808c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(32, 0xf60, 0, 0),
818c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(33, 0xf70, 0, 0),
828c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(34, 0xf70, 0, 0),
838c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(35, 0xf70, 0, 0),
848c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(36, 0xf70, 0, 0),
858c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(37, 0xf70, 0, 0),
868c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(38, 0xf70, 4, 0),
878c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(39, 0xf70, 8, 1),
888c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(40, 0xf70, 8, 1),
898c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(41, 0xf70, 8, 1),
908c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(42, 0xf70, 8, 1),
918c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(43, 0xf70, 12, 0),
928c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(44, 0xf70, 12, 0),
938c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(45, 0xf70, 12, 0),
948c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(47, 0xf80, 0, 0),
958c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(48, 0xf80, 0, 0),
968c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(49, 0xf80, 4, 0),
978c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(50, 0xf70, 4, 0),
988c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(51, 0xf70, 4, 0),
998c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(52, 0xf70, 4, 0),
1008c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(53, 0xf80, 12, 0),
1018c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(54, 0xf80, 12, 0),
1028c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(55, 0xf80, 12, 0),
1038c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(56, 0xf80, 12, 0),
1048c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(60, 0xf90, 8, 1),
1058c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(61, 0xf90, 8, 1),
1068c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(62, 0xf90, 8, 1),
1078c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(63, 0xf90, 12, 1),
1088c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(64, 0xf90, 12, 1),
1098c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(65, 0xf90, 12, 1),
1108c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(66, 0xfa0, 0, 1),
1118c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(67, 0xfa0, 0, 1),
1128c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(68, 0xfa0, 0, 1),
1138c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(69, 0xfa0, 0, 1),
1148c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(70, 0xfa0, 0, 1),
1158c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(71, 0xfa0, 0, 1),
1168c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(72, 0xf80, 4, 0),
1178c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(73, 0xf80, 4, 0),
1188c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(74, 0xf80, 4, 0),
1198c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(85, 0xda0, 0, 2),
1208c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(86, 0xd90, 0, 2),
1218c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(87, 0xdb0, 0, 2),
1228c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(88, 0xdb0, 0, 2),
1238c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(89, 0xdb0, 0, 2),
1248c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(90, 0xdb0, 0, 2),
1258c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(105, 0xd40, 0, 2),
1268c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(106, 0xd30, 0, 2),
1278c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(107, 0xd50, 0, 2),
1288c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(108, 0xd50, 0, 2),
1298c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(109, 0xd50, 0, 2),
1308c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(110, 0xd50, 0, 2),
1318c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(111, 0xce0, 0, 2),
1328c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(112, 0xce0, 0, 2),
1338c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(113, 0xce0, 0, 2),
1348c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(114, 0xce0, 0, 2),
1358c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(115, 0xce0, 0, 2),
1368c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(116, 0xcd0, 0, 2),
1378c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(117, 0xcc0, 0, 2),
1388c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(118, 0xce0, 0, 2),
1398c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(119, 0xce0, 0, 2),
1408c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(120, 0xce0, 0, 2),
1418c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(121, 0xce0, 0, 2),
1428c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(126, 0xf80, 4, 0),
1438c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(188, 0xf70, 4, 0),
1448c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(189, 0xfe0, 8, 0),
1458c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(190, 0xfe0, 8, 0),
1468c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(191, 0xfe0, 8, 0),
1478c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(192, 0xfe0, 8, 0),
1488c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(193, 0xfe0, 8, 0),
1498c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(194, 0xfe0, 12, 0),
1508c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(195, 0xfe0, 12, 0),
1518c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(196, 0xfe0, 12, 0),
1528c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(197, 0xfe0, 12, 0),
1538c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(198, 0xfe0, 12, 0),
1548c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(199, 0xf50, 4, 1),
1558c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(200, 0xfd0, 0, 0),
1568c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(201, 0xfd0, 0, 0),
1578c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(202, 0xfd0, 0, 0),
1588c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(203, 0xfd0, 4, 0),
1598c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(204, 0xfd0, 4, 0),
1608c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(205, 0xfd0, 4, 0),
1618c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(206, 0xfd0, 4, 0),
1628c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(207, 0xfd0, 4, 0),
1638c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(208, 0xfd0, 8, 0),
1648c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(209, 0xfd0, 8, 0),
1658c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(210, 0xfd0, 12, 1),
1668c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(211, 0xff0, 0, 1),
1678c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(212, 0xff0, 0, 1),
1688c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(213, 0xff0, 0, 1),
1698c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(214, 0xff0, 0, 1),
1708c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(215, 0xff0, 0, 1),
1718c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(216, 0xff0, 0, 1),
1728c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(217, 0xff0, 0, 1),
1738c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(218, 0xff0, 0, 1),
1748c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(219, 0xff0, 0, 1),
1758c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(220, 0xff0, 0, 1),
1768c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(221, 0xff0, 0, 1),
1778c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(222, 0xff0, 0, 1),
1788c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(223, 0xff0, 0, 1),
1798c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(224, 0xff0, 0, 1),
1808c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(225, 0xff0, 0, 1),
1818c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(226, 0xff0, 0, 1),
1828c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(227, 0xff0, 0, 1),
1838c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(228, 0xff0, 0, 1),
1848c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(229, 0xff0, 0, 1),
1858c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(230, 0xff0, 0, 1),
1868c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(231, 0xff0, 0, 1),
1878c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(232, 0xff0, 0, 1),
1888c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(233, 0xff0, 0, 1),
1898c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(234, 0xff0, 0, 1),
1908c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(235, 0xff0, 0, 1),
1918c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(236, 0xff0, 4, 0),
1928c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(237, 0xff0, 4, 0),
1938c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(238, 0xff0, 4, 0),
1948c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(239, 0xff0, 4, 0),
1958c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(240, 0xff0, 4, 0),
1968c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(241, 0xff0, 4, 0),
1978c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(242, 0xff0, 8, 0),
1988c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(243, 0xff0, 8, 0),
1998c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(248, 0xf00, 0, 0),
2008c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(249, 0xfc0, 0, 2),
2018c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(250, 0xfc0, 0, 2),
2028c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(251, 0xfc0, 0, 2),
2038c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(252, 0xfc0, 0, 2),
2048c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(253, 0xfc0, 0, 2),
2058c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(254, 0xfc0, 0, 2),
2068c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(255, 0xfc0, 0, 2),
2078c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(256, 0xfc0, 0, 2),
2088c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(257, 0xce0, 0, 2),
2098c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(258, 0xcb0, 0, 2),
2108c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(259, 0xc90, 0, 2),
2118c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(260, 0x3a0, 0, 2),
2128c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(261, 0xd50, 0, 2),
2138c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(262, 0xf00, 8, 0),
2148c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(263, 0xf00, 8, 0),
2158c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(264, 0xf00, 8, 0),
2168c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(265, 0xf00, 8, 0),
2178c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(266, 0xf00, 8, 0),
2188c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(267, 0xf00, 8, 0),
2198c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(268, 0xf00, 8, 0),
2208c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(269, 0xf00, 8, 0),
2218c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(270, 0xf00, 8, 0),
2228c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(271, 0xf00, 8, 0),
2238c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(272, 0xf00, 8, 0),
2248c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(273, 0xf00, 8, 0),
2258c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(274, 0xf00, 8, 0),
2268c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(275, 0xf00, 8, 0),
2278c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(276, 0xf00, 8, 0),
2288c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(277, 0xf00, 8, 0),
2298c2ecf20Sopenharmony_ci	MTK_PIN_DRV_GRP(278, 0xf70, 8, 1),
2308c2ecf20Sopenharmony_ci};
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_cistatic const struct mtk_pin_spec_pupd_set_samereg mt2701_spec_pupd[] = {
2338c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(111, 0xd00, 12, 13, 14),	/* ms0 data7 */
2348c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(112, 0xd00, 8, 9, 10),	/* ms0 data6 */
2358c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(113, 0xd00, 4, 5, 6),	/* ms0 data5 */
2368c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(114, 0xd00, 0, 1, 2),	/* ms0 data4 */
2378c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(115, 0xd10, 0, 1, 2),	/* ms0 rstb */
2388c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(116, 0xcd0, 8, 9, 10),	/* ms0 cmd */
2398c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(117, 0xcc0, 8, 9, 10),	/* ms0 clk */
2408c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(118, 0xcf0, 12, 13, 14),	/* ms0 data3 */
2418c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(119, 0xcf0, 8, 9, 10),	/* ms0 data2 */
2428c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(120, 0xcf0, 4, 5, 6),	/* ms0 data1 */
2438c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(121, 0xcf0, 0, 1, 2),	/* ms0 data0 */
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(105, 0xd40, 8, 9, 10),	/* ms1 cmd */
2468c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(106, 0xd30, 8, 9, 10),	/* ms1 clk */
2478c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(107, 0xd60, 0, 1, 2),	/* ms1 dat0 */
2488c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(108, 0xd60, 10, 9, 8),	/* ms1 dat1 */
2498c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(109, 0xd60, 4, 5, 6),	/* ms1 dat2 */
2508c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(110, 0xc60, 12, 13, 14),	/* ms1 dat3 */
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(85, 0xda0, 8, 9, 10),	/* ms2 cmd */
2538c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(86, 0xd90, 8, 9, 10),	/* ms2 clk */
2548c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(87, 0xdc0, 0, 1, 2),	/* ms2 dat0 */
2558c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(88, 0xdc0, 10, 9, 8),	/* ms2 dat1 */
2568c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(89, 0xdc0, 4, 5, 6),	/* ms2 dat2 */
2578c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(90, 0xdc0, 12, 13, 14),	/* ms2 dat3 */
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(249, 0x140, 0, 1, 2),	/* ms0e rstb */
2608c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(250, 0x130, 12, 13, 14),	/* ms0e dat7 */
2618c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(251, 0x130, 8, 9, 10),	/* ms0e dat6 */
2628c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(252, 0x130, 4, 5, 6),	/* ms0e dat5 */
2638c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(253, 0x130, 0, 1, 2),	/* ms0e dat4 */
2648c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(254, 0xf40, 12, 13, 14),	/* ms0e dat3 */
2658c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(255, 0xf40, 8, 9, 10),	/* ms0e dat2 */
2668c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(256, 0xf40, 4, 5, 6),	/* ms0e dat1 */
2678c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(257, 0xf40, 0, 1, 2),	/* ms0e dat0 */
2688c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(258, 0xcb0, 8, 9, 10),	/* ms0e cmd */
2698c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(259, 0xc90, 8, 9, 10),	/* ms0e clk */
2708c2ecf20Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(261, 0x140, 8, 9, 10),	/* ms1 ins */
2718c2ecf20Sopenharmony_ci};
2728c2ecf20Sopenharmony_ci
2738c2ecf20Sopenharmony_cistatic int mt2701_spec_pull_set(struct regmap *regmap, unsigned int pin,
2748c2ecf20Sopenharmony_ci		unsigned char align, bool isup, unsigned int r1r0)
2758c2ecf20Sopenharmony_ci{
2768c2ecf20Sopenharmony_ci	return mtk_pctrl_spec_pull_set_samereg(regmap, mt2701_spec_pupd,
2778c2ecf20Sopenharmony_ci		ARRAY_SIZE(mt2701_spec_pupd), pin, align, isup, r1r0);
2788c2ecf20Sopenharmony_ci}
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_cistatic const struct mtk_pin_ies_smt_set mt2701_ies_set[] = {
2818c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(0, 6, 0xb20, 0),
2828c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(7, 9, 0xb20, 1),
2838c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(10, 13, 0xb30, 3),
2848c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(14, 15, 0xb30, 13),
2858c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(16, 17, 0xb40, 7),
2868c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(18, 21, 0xb40, 13),
2878c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(22, 26, 0xb40, 13),
2888c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(27, 29, 0xb40, 13),
2898c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(30, 32, 0xb40, 7),
2908c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(33, 37, 0xb40, 13),
2918c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(38, 38, 0xb20, 13),
2928c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(39, 42, 0xb40, 13),
2938c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(43, 45, 0xb20, 10),
2948c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(47, 48, 0xb20, 11),
2958c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(49, 49, 0xb20, 12),
2968c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(50, 52, 0xb20, 13),
2978c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(53, 56, 0xb20, 14),
2988c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(57, 58, 0xb20, 15),
2998c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(59, 59, 0xb30, 10),
3008c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(60, 62, 0xb30, 0),
3018c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(63, 65, 0xb30, 1),
3028c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(66, 71, 0xb30, 2),
3038c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(72, 74, 0xb20, 12),
3048c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(75, 76, 0xb30, 3),
3058c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(77, 78, 0xb30, 4),
3068c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(79, 82, 0xb30, 5),
3078c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(83, 84, 0xb30, 2),
3088c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(85, 85, 0xda0, 4),
3098c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(86, 86, 0xd90, 4),
3108c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(87, 90, 0xdb0, 4),
3118c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(101, 104, 0xb30, 6),
3128c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(105, 105, 0xd40, 4),
3138c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(106, 106, 0xd30, 4),
3148c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(107, 110, 0xd50, 4),
3158c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(111, 115, 0xce0, 4),
3168c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(116, 116, 0xcd0, 4),
3178c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(117, 117, 0xcc0, 4),
3188c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(118, 121, 0xce0, 4),
3198c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(122, 125, 0xb30, 7),
3208c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(126, 126, 0xb20, 12),
3218c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(127, 142, 0xb30, 9),
3228c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(143, 160, 0xb30, 10),
3238c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(161, 168, 0xb30, 12),
3248c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(169, 183, 0xb30, 10),
3258c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(184, 186, 0xb30, 9),
3268c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(187, 187, 0xb30, 14),
3278c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(188, 188, 0xb20, 13),
3288c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(189, 193, 0xb30, 15),
3298c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(194, 198, 0xb40, 0),
3308c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(199, 199, 0xb20, 1),
3318c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(200, 202, 0xb40, 1),
3328c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(203, 207, 0xb40, 2),
3338c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(208, 209, 0xb40, 3),
3348c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(210, 210, 0xb40, 4),
3358c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(211, 235, 0xb40, 5),
3368c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(236, 241, 0xb40, 6),
3378c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(242, 243, 0xb40, 7),
3388c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(244, 247, 0xb40, 8),
3398c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(248, 248, 0xb40, 9),
3408c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(249, 257, 0xfc0, 4),
3418c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(258, 258, 0xcb0, 4),
3428c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(259, 259, 0xc90, 4),
3438c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(260, 260, 0x3a0, 4),
3448c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(261, 261, 0xd50, 4),
3458c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(262, 277, 0xb40, 12),
3468c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(278, 278, 0xb40, 13),
3478c2ecf20Sopenharmony_ci};
3488c2ecf20Sopenharmony_ci
3498c2ecf20Sopenharmony_cistatic const struct mtk_pin_ies_smt_set mt2701_smt_set[] = {
3508c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(0, 6, 0xb50, 0),
3518c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(7, 9, 0xb50, 1),
3528c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(10, 13, 0xb60, 3),
3538c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(14, 15, 0xb60, 13),
3548c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(16, 17, 0xb70, 7),
3558c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(18, 21, 0xb70, 13),
3568c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(22, 26, 0xb70, 13),
3578c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(27, 29, 0xb70, 13),
3588c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(30, 32, 0xb70, 7),
3598c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(33, 37, 0xb70, 13),
3608c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(38, 38, 0xb50, 13),
3618c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(39, 42, 0xb70, 13),
3628c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(43, 45, 0xb50, 10),
3638c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(47, 48, 0xb50, 11),
3648c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(49, 49, 0xb50, 12),
3658c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(50, 52, 0xb50, 13),
3668c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(53, 56, 0xb50, 14),
3678c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(57, 58, 0xb50, 15),
3688c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(59, 59, 0xb60, 10),
3698c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(60, 62, 0xb60, 0),
3708c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(63, 65, 0xb60, 1),
3718c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(66, 71, 0xb60, 2),
3728c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(72, 74, 0xb50, 12),
3738c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(75, 76, 0xb60, 3),
3748c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(77, 78, 0xb60, 4),
3758c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(79, 82, 0xb60, 5),
3768c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(83, 84, 0xb60, 2),
3778c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(85, 85, 0xda0, 11),
3788c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(86, 86, 0xd90, 11),
3798c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(87, 87, 0xdc0, 3),
3808c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(88, 88, 0xdc0, 7),
3818c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(89, 89, 0xdc0, 11),
3828c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(90, 90, 0xdc0, 15),
3838c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(101, 104, 0xb60, 6),
3848c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(105, 105, 0xd40, 11),
3858c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(106, 106, 0xd30, 11),
3868c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(107, 107, 0xd60, 3),
3878c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(108, 108, 0xd60, 7),
3888c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(109, 109, 0xd60, 11),
3898c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(110, 110, 0xd60, 15),
3908c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(111, 111, 0xd00, 15),
3918c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(112, 112, 0xd00, 11),
3928c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(113, 113, 0xd00, 7),
3938c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(114, 114, 0xd00, 3),
3948c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(115, 115, 0xd10, 3),
3958c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(116, 116, 0xcd0, 11),
3968c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(117, 117, 0xcc0, 11),
3978c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(118, 118, 0xcf0, 15),
3988c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(119, 119, 0xcf0, 11),
3998c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(120, 120, 0xcf0, 7),
4008c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(121, 121, 0xcf0, 3),
4018c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(122, 125, 0xb60, 7),
4028c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(126, 126, 0xb50, 12),
4038c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(127, 142, 0xb60, 9),
4048c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(143, 160, 0xb60, 10),
4058c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(161, 168, 0xb60, 12),
4068c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(169, 183, 0xb60, 10),
4078c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(184, 186, 0xb60, 9),
4088c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(187, 187, 0xb60, 14),
4098c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(188, 188, 0xb50, 13),
4108c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(189, 193, 0xb60, 15),
4118c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(194, 198, 0xb70, 0),
4128c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(199, 199, 0xb50, 1),
4138c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(200, 202, 0xb70, 1),
4148c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(203, 207, 0xb70, 2),
4158c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(208, 209, 0xb70, 3),
4168c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(210, 210, 0xb70, 4),
4178c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(211, 235, 0xb70, 5),
4188c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(236, 241, 0xb70, 6),
4198c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(242, 243, 0xb70, 7),
4208c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(244, 247, 0xb70, 8),
4218c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(248, 248, 0xb70, 9),
4228c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(249, 249, 0x140, 3),
4238c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(250, 250, 0x130, 15),
4248c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(251, 251, 0x130, 11),
4258c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(252, 252, 0x130, 7),
4268c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(253, 253, 0x130, 3),
4278c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(254, 254, 0xf40, 15),
4288c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(255, 255, 0xf40, 11),
4298c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(256, 256, 0xf40, 7),
4308c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(257, 257, 0xf40, 3),
4318c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(258, 258, 0xcb0, 11),
4328c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(259, 259, 0xc90, 11),
4338c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(260, 260, 0x3a0, 11),
4348c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(261, 261, 0x0b0, 3),
4358c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(262, 277, 0xb70, 12),
4368c2ecf20Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(278, 278, 0xb70, 13),
4378c2ecf20Sopenharmony_ci};
4388c2ecf20Sopenharmony_ci
4398c2ecf20Sopenharmony_cistatic int mt2701_ies_smt_set(struct regmap *regmap, unsigned int pin,
4408c2ecf20Sopenharmony_ci		unsigned char align, int value, enum pin_config_param arg)
4418c2ecf20Sopenharmony_ci{
4428c2ecf20Sopenharmony_ci	if (arg == PIN_CONFIG_INPUT_ENABLE)
4438c2ecf20Sopenharmony_ci		return mtk_pconf_spec_set_ies_smt_range(regmap, mt2701_ies_set,
4448c2ecf20Sopenharmony_ci			ARRAY_SIZE(mt2701_ies_set), pin, align, value);
4458c2ecf20Sopenharmony_ci	else if (arg == PIN_CONFIG_INPUT_SCHMITT_ENABLE)
4468c2ecf20Sopenharmony_ci		return mtk_pconf_spec_set_ies_smt_range(regmap, mt2701_smt_set,
4478c2ecf20Sopenharmony_ci			ARRAY_SIZE(mt2701_smt_set), pin, align, value);
4488c2ecf20Sopenharmony_ci	return -EINVAL;
4498c2ecf20Sopenharmony_ci}
4508c2ecf20Sopenharmony_ci
4518c2ecf20Sopenharmony_cistatic const struct mtk_spec_pinmux_set mt2701_spec_pinmux[] = {
4528c2ecf20Sopenharmony_ci	MTK_PINMUX_SPEC(22, 0xb10, 3),
4538c2ecf20Sopenharmony_ci	MTK_PINMUX_SPEC(23, 0xb10, 4),
4548c2ecf20Sopenharmony_ci	MTK_PINMUX_SPEC(24, 0xb10, 5),
4558c2ecf20Sopenharmony_ci	MTK_PINMUX_SPEC(29, 0xb10, 9),
4568c2ecf20Sopenharmony_ci	MTK_PINMUX_SPEC(208, 0xb10, 7),
4578c2ecf20Sopenharmony_ci	MTK_PINMUX_SPEC(209, 0xb10, 8),
4588c2ecf20Sopenharmony_ci	MTK_PINMUX_SPEC(203, 0xf20, 0),
4598c2ecf20Sopenharmony_ci	MTK_PINMUX_SPEC(204, 0xf20, 1),
4608c2ecf20Sopenharmony_ci	MTK_PINMUX_SPEC(249, 0xef0, 0),
4618c2ecf20Sopenharmony_ci	MTK_PINMUX_SPEC(250, 0xef0, 0),
4628c2ecf20Sopenharmony_ci	MTK_PINMUX_SPEC(251, 0xef0, 0),
4638c2ecf20Sopenharmony_ci	MTK_PINMUX_SPEC(252, 0xef0, 0),
4648c2ecf20Sopenharmony_ci	MTK_PINMUX_SPEC(253, 0xef0, 0),
4658c2ecf20Sopenharmony_ci	MTK_PINMUX_SPEC(254, 0xef0, 0),
4668c2ecf20Sopenharmony_ci	MTK_PINMUX_SPEC(255, 0xef0, 0),
4678c2ecf20Sopenharmony_ci	MTK_PINMUX_SPEC(256, 0xef0, 0),
4688c2ecf20Sopenharmony_ci	MTK_PINMUX_SPEC(257, 0xef0, 0),
4698c2ecf20Sopenharmony_ci	MTK_PINMUX_SPEC(258, 0xef0, 0),
4708c2ecf20Sopenharmony_ci	MTK_PINMUX_SPEC(259, 0xef0, 0),
4718c2ecf20Sopenharmony_ci	MTK_PINMUX_SPEC(260, 0xef0, 0),
4728c2ecf20Sopenharmony_ci};
4738c2ecf20Sopenharmony_ci
4748c2ecf20Sopenharmony_cistatic void mt2701_spec_pinmux_set(struct regmap *reg, unsigned int pin,
4758c2ecf20Sopenharmony_ci			unsigned int mode)
4768c2ecf20Sopenharmony_ci{
4778c2ecf20Sopenharmony_ci	unsigned int i, value, mask;
4788c2ecf20Sopenharmony_ci	unsigned int info_num = ARRAY_SIZE(mt2701_spec_pinmux);
4798c2ecf20Sopenharmony_ci	unsigned int spec_flag;
4808c2ecf20Sopenharmony_ci
4818c2ecf20Sopenharmony_ci	for (i = 0; i < info_num; i++) {
4828c2ecf20Sopenharmony_ci		if (pin == mt2701_spec_pinmux[i].pin)
4838c2ecf20Sopenharmony_ci			break;
4848c2ecf20Sopenharmony_ci	}
4858c2ecf20Sopenharmony_ci
4868c2ecf20Sopenharmony_ci	if (i == info_num)
4878c2ecf20Sopenharmony_ci		return;
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_ci	spec_flag = (mode >> 3);
4908c2ecf20Sopenharmony_ci	mask = BIT(mt2701_spec_pinmux[i].bit);
4918c2ecf20Sopenharmony_ci	if (!spec_flag)
4928c2ecf20Sopenharmony_ci		value = mask;
4938c2ecf20Sopenharmony_ci	else
4948c2ecf20Sopenharmony_ci		value = 0;
4958c2ecf20Sopenharmony_ci	regmap_update_bits(reg, mt2701_spec_pinmux[i].offset, mask, value);
4968c2ecf20Sopenharmony_ci}
4978c2ecf20Sopenharmony_ci
4988c2ecf20Sopenharmony_cistatic void mt2701_spec_dir_set(unsigned int *reg_addr, unsigned int pin)
4998c2ecf20Sopenharmony_ci{
5008c2ecf20Sopenharmony_ci	if (pin > 175)
5018c2ecf20Sopenharmony_ci		*reg_addr += 0x10;
5028c2ecf20Sopenharmony_ci}
5038c2ecf20Sopenharmony_ci
5048c2ecf20Sopenharmony_cistatic const struct mtk_pinctrl_devdata mt2701_pinctrl_data = {
5058c2ecf20Sopenharmony_ci	.pins = mtk_pins_mt2701,
5068c2ecf20Sopenharmony_ci	.npins = ARRAY_SIZE(mtk_pins_mt2701),
5078c2ecf20Sopenharmony_ci	.grp_desc = mt2701_drv_grp,
5088c2ecf20Sopenharmony_ci	.n_grp_cls = ARRAY_SIZE(mt2701_drv_grp),
5098c2ecf20Sopenharmony_ci	.pin_drv_grp = mt2701_pin_drv,
5108c2ecf20Sopenharmony_ci	.n_pin_drv_grps = ARRAY_SIZE(mt2701_pin_drv),
5118c2ecf20Sopenharmony_ci	.spec_pull_set = mt2701_spec_pull_set,
5128c2ecf20Sopenharmony_ci	.spec_ies_smt_set = mt2701_ies_smt_set,
5138c2ecf20Sopenharmony_ci	.spec_pinmux_set = mt2701_spec_pinmux_set,
5148c2ecf20Sopenharmony_ci	.spec_dir_set = mt2701_spec_dir_set,
5158c2ecf20Sopenharmony_ci	.dir_offset = 0x0000,
5168c2ecf20Sopenharmony_ci	.pullen_offset = 0x0150,
5178c2ecf20Sopenharmony_ci	.pullsel_offset = 0x0280,
5188c2ecf20Sopenharmony_ci	.dout_offset = 0x0500,
5198c2ecf20Sopenharmony_ci	.din_offset = 0x0630,
5208c2ecf20Sopenharmony_ci	.pinmux_offset = 0x0760,
5218c2ecf20Sopenharmony_ci	.type1_start = 280,
5228c2ecf20Sopenharmony_ci	.type1_end = 280,
5238c2ecf20Sopenharmony_ci	.port_shf = 4,
5248c2ecf20Sopenharmony_ci	.port_mask = 0x1f,
5258c2ecf20Sopenharmony_ci	.port_align = 4,
5268c2ecf20Sopenharmony_ci	.eint_hw = {
5278c2ecf20Sopenharmony_ci		.port_mask = 6,
5288c2ecf20Sopenharmony_ci		.ports     = 6,
5298c2ecf20Sopenharmony_ci		.ap_num    = 169,
5308c2ecf20Sopenharmony_ci		.db_cnt    = 16,
5318c2ecf20Sopenharmony_ci	},
5328c2ecf20Sopenharmony_ci};
5338c2ecf20Sopenharmony_ci
5348c2ecf20Sopenharmony_cistatic int mt2701_pinctrl_probe(struct platform_device *pdev)
5358c2ecf20Sopenharmony_ci{
5368c2ecf20Sopenharmony_ci	return mtk_pctrl_init(pdev, &mt2701_pinctrl_data, NULL);
5378c2ecf20Sopenharmony_ci}
5388c2ecf20Sopenharmony_ci
5398c2ecf20Sopenharmony_cistatic const struct of_device_id mt2701_pctrl_match[] = {
5408c2ecf20Sopenharmony_ci	{ .compatible = "mediatek,mt2701-pinctrl", },
5418c2ecf20Sopenharmony_ci	{ .compatible = "mediatek,mt7623-pinctrl", },
5428c2ecf20Sopenharmony_ci	{}
5438c2ecf20Sopenharmony_ci};
5448c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(of, mt2701_pctrl_match);
5458c2ecf20Sopenharmony_ci
5468c2ecf20Sopenharmony_cistatic struct platform_driver mtk_pinctrl_driver = {
5478c2ecf20Sopenharmony_ci	.probe = mt2701_pinctrl_probe,
5488c2ecf20Sopenharmony_ci	.driver = {
5498c2ecf20Sopenharmony_ci		.name = "mediatek-mt2701-pinctrl",
5508c2ecf20Sopenharmony_ci		.of_match_table = mt2701_pctrl_match,
5518c2ecf20Sopenharmony_ci		.pm = &mtk_eint_pm_ops,
5528c2ecf20Sopenharmony_ci	},
5538c2ecf20Sopenharmony_ci};
5548c2ecf20Sopenharmony_ci
5558c2ecf20Sopenharmony_cistatic int __init mtk_pinctrl_init(void)
5568c2ecf20Sopenharmony_ci{
5578c2ecf20Sopenharmony_ci	return platform_driver_register(&mtk_pinctrl_driver);
5588c2ecf20Sopenharmony_ci}
5598c2ecf20Sopenharmony_ciarch_initcall(mtk_pinctrl_init);
560