rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * Copyright (C) 2019 MediaTek Inc. |
| 4 | * Author: Andy Teng <andy.teng@mediatek.com> |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #include "pinctrl-mtk-mt2731.h" |
| 9 | #include "pinctrl-paris.h" |
| 10 | |
| 11 | /* MT2731 have multiple bases to program pin configuration listed as the below: |
| 12 | * gpio:0x10005000, iocfg_lm:0x10002000, iocfg_lb:0x10002200, |
| 13 | * iocfg_bl:0x10002400, iocfg_br:0x10002600, iocfg_rb:0x10002800, |
| 14 | * iocfg_rm:0x10002A00, iocfg_tr:0x10002C00, iocfg_tl:0x10002E00 |
| 15 | * _i_based could be used to indicate what base the pin should be mapped into. |
| 16 | */ |
| 17 | |
| 18 | #define PIN_FIELD_BASE(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits) \ |
| 19 | PIN_FIELD_CALC(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits, \ |
| 20 | 32, 0) |
| 21 | |
| 22 | static const struct mtk_pin_field_calc mt2731_pin_mode_range[] = { |
| 23 | PIN_FIELD_BASE(0, 7, 0, 0x0300, 0x10, 0, 4), |
| 24 | PIN_FIELD_BASE(8, 15, 0, 0x0310, 0x10, 0, 4), |
| 25 | PIN_FIELD_BASE(16, 23, 0, 0x0320, 0x10, 0, 4), |
| 26 | PIN_FIELD_BASE(24, 31, 0, 0x0330, 0x10, 0, 4), |
| 27 | PIN_FIELD_BASE(32, 39, 0, 0x0340, 0x10, 0, 4), |
| 28 | PIN_FIELD_BASE(40, 47, 0, 0x0350, 0x10, 0, 4), |
| 29 | PIN_FIELD_BASE(48, 55, 0, 0x0360, 0x10, 0, 4), |
| 30 | PIN_FIELD_BASE(56, 63, 0, 0x0370, 0x10, 0, 4), |
| 31 | PIN_FIELD_BASE(64, 71, 0, 0x0380, 0x10, 0, 4), |
| 32 | PIN_FIELD_BASE(72, 79, 0, 0x0390, 0x10, 0, 4), |
| 33 | PIN_FIELD_BASE(80, 87, 0, 0x03A0, 0x10, 0, 4), |
| 34 | PIN_FIELD_BASE(88, 95, 0, 0x03B0, 0x10, 0, 4), |
| 35 | PIN_FIELD_BASE(96, 103, 0, 0x03C0, 0x10, 0, 4), |
| 36 | PIN_FIELD_BASE(104, 111, 0, 0x03D0, 0x10, 0, 4), |
| 37 | PIN_FIELD_BASE(112, 119, 0, 0x03E0, 0x10, 0, 4), |
| 38 | PIN_FIELD_BASE(120, 127, 0, 0x03F0, 0x10, 0, 4), |
| 39 | PIN_FIELD_BASE(128, 135, 0, 0x0400, 0x10, 0, 4), |
| 40 | PIN_FIELD_BASE(136, 143, 0, 0x0410, 0x10, 0, 4), |
| 41 | PIN_FIELD_BASE(144, 151, 0, 0x0420, 0x10, 0, 4), |
| 42 | PIN_FIELD_BASE(152, 159, 0, 0x0430, 0x10, 0, 4), |
| 43 | PIN_FIELD_BASE(160, 160, 0, 0x0440, 0x10, 0, 4), |
| 44 | }; |
| 45 | |
| 46 | static const struct mtk_pin_field_calc mt2731_pin_dir_range[] = { |
| 47 | PIN_FIELD_BASE(0, 31, 0, 0x0000, 0x10, 0, 1), |
| 48 | PIN_FIELD_BASE(32, 63, 0, 0x0010, 0x10, 0, 1), |
| 49 | PIN_FIELD_BASE(64, 95, 0, 0x0020, 0x10, 0, 1), |
| 50 | PIN_FIELD_BASE(96, 127, 0, 0x0030, 0x10, 0, 1), |
| 51 | PIN_FIELD_BASE(128, 159, 0, 0x0040, 0x10, 0, 1), |
| 52 | PIN_FIELD_BASE(160, 160, 0, 0x0050, 0x10, 0, 1), |
| 53 | }; |
| 54 | |
| 55 | static const struct mtk_pin_field_calc mt2731_pin_di_range[] = { |
| 56 | PIN_FIELD_BASE(0, 31, 0, 0x0200, 0x10, 0, 1), |
| 57 | PIN_FIELD_BASE(32, 63, 0, 0x0210, 0x10, 0, 1), |
| 58 | PIN_FIELD_BASE(64, 95, 0, 0x0220, 0x10, 0, 1), |
| 59 | PIN_FIELD_BASE(96, 127, 0, 0x0230, 0x10, 0, 1), |
| 60 | PIN_FIELD_BASE(128, 159, 0, 0x0240, 0x10, 0, 1), |
| 61 | PIN_FIELD_BASE(160, 160, 0, 0x0250, 0x10, 0, 1), |
| 62 | }; |
| 63 | |
| 64 | static const struct mtk_pin_field_calc mt2731_pin_do_range[] = { |
| 65 | PIN_FIELD_BASE(0, 31, 0, 0x0100, 0x10, 0, 1), |
| 66 | PIN_FIELD_BASE(32, 63, 0, 0x0110, 0x10, 0, 1), |
| 67 | PIN_FIELD_BASE(64, 95, 0, 0x0120, 0x10, 0, 1), |
| 68 | PIN_FIELD_BASE(96, 127, 0, 0x0130, 0x10, 0, 1), |
| 69 | PIN_FIELD_BASE(128, 159, 0, 0x0140, 0x10, 0, 1), |
| 70 | PIN_FIELD_BASE(160, 160, 0, 0x0150, 0x10, 0, 1), |
| 71 | }; |
| 72 | |
| 73 | static const struct mtk_pin_field_calc mt2731_pin_smt_range[] = { |
| 74 | PIN_FIELD_BASE(0, 2, 1, 0x00b0, 0x10, 2, 1), |
| 75 | PIN_FIELD_BASE(3, 3, 3, 0x00b0, 0x10, 3, 1), |
| 76 | PIN_FIELD_BASE(4, 7, 2, 0x00a0, 0x10, 0, 1), |
| 77 | PIN_FIELD_BASE(8, 9, 3, 0x00b0, 0x10, 4, 1), |
| 78 | PIN_FIELD_BASE(10, 12, 5, 0x0080, 0x10, 7, 1), |
| 79 | PIN_FIELD_BASE(13, 13, 2, 0x00a0, 0x10, 17, 1), |
| 80 | PIN_FIELD_BASE(14, 15, 2, 0x00a0, 0x10, 15, 1), |
| 81 | PIN_FIELD_BASE(16, 16, 1, 0x00b0, 0x10, 22, 1), |
| 82 | PIN_FIELD_BASE(17, 17, 1, 0x00b0, 0x10, 24, 1), |
| 83 | PIN_FIELD_BASE(18, 18, 1, 0x00b0, 0x10, 23, 1), |
| 84 | PIN_FIELD_BASE(19, 19, 1, 0x00b0, 0x10, 25, 1), |
| 85 | PIN_FIELD_BASE(20, 20, 1, 0x00b0, 0x10, 16, 1), |
| 86 | PIN_FIELD_BASE(21, 23, 1, 0x00b0, 0x10, 13, 1), |
| 87 | PIN_FIELD_BASE(24, 24, 1, 0x00b0, 0x10, 1, 1), |
| 88 | PIN_FIELD_BASE(25, 25, 1, 0x00b0, 0x10, 5, 1), |
| 89 | PIN_FIELD_BASE(26, 26, 1, 0x00b0, 0x10, 21, 1), |
| 90 | PIN_FIELD_BASE(27, 27, 1, 0x00b0, 0x10, 20, 1), |
| 91 | PIN_FIELD_BASE(28, 28, 1, 0x00b0, 0x10, 19, 1), |
| 92 | PIN_FIELD_BASE(29, 29, 1, 0x00b0, 0x10, 0, 1), |
| 93 | PIN_FIELD_BASE(30, 30, 1, 0x00b0, 0x10, 12, 1), |
| 94 | PIN_FIELD_BASE(31, 32, 1, 0x00b0, 0x10, 6, 1), |
| 95 | PIN_FIELD_BASE(33, 33, 1, 0x00b0, 0x10, 11, 1), |
| 96 | PIN_FIELD_BASE(34, 34, 1, 0x00b0, 0x10, 10, 1), |
| 97 | PIN_FIELD_BASE(35, 35, 1, 0x00b0, 0x10, 9, 1), |
| 98 | PIN_FIELD_BASE(36, 36, 1, 0x00b0, 0x10, 8, 1), |
| 99 | PIN_FIELD_BASE(37, 37, 2, 0x00a0, 0x10, 9, 1), |
| 100 | PIN_FIELD_BASE(38, 38, 2, 0x00a0, 0x10, 6, 1), |
| 101 | PIN_FIELD_BASE(39, 39, 2, 0x00a0, 0x10, 10, 1), |
| 102 | PIN_FIELD_BASE(40, 41, 2, 0x00a0, 0x10, 7, 1), |
| 103 | PIN_FIELD_BASE(42, 42, 2, 0x00a0, 0x10, 5, 1), |
| 104 | PIN_FIELD_BASE(43, 43, 2, 0x00a0, 0x10, 4, 1), |
| 105 | PIN_FIELD_BASE(44, 44, 8, 0x0080, 0x10, 14, 1), |
| 106 | PIN_FIELD_BASE(45, 45, 8, 0x0080, 0x10, 16, 1), |
| 107 | PIN_FIELD_BASE(46, 46, 8, 0x0080, 0x10, 15, 1), |
| 108 | PIN_FIELD_BASE(47, 48, 2, 0x00a0, 0x10, 12, 1), |
| 109 | PIN_FIELD_BASE(49, 49, 2, 0x00a0, 0x10, 11, 1), |
| 110 | PIN_FIELD_BASE(50, 50, 2, 0x00a0, 0x10, 14, 1), |
| 111 | PIN_FIELD_BASE(51, 51, 3, 0x00b0, 0x10, 9, 1), |
| 112 | PIN_FIELD_BASE(52, 54, 3, 0x00b0, 0x10, 6, 1), |
| 113 | PIN_FIELD_BASE(55, 55, 3, 0x00b0, 0x10, 10, 1), |
| 114 | PIN_FIELD_BASE(56, 56, 1, 0x00b0, 0x10, 18, 1), |
| 115 | PIN_FIELD_BASE(57, 57, 1, 0x00b0, 0x10, 17, 1), |
| 116 | PIN_FIELD_BASE(58, 58, 3, 0x00b0, 0x10, 11, 1), |
| 117 | PIN_FIELD_BASE(59, 59, 3, 0x00b0, 0x10, 13, 1), |
| 118 | PIN_FIELD_BASE(60, 60, 3, 0x00b0, 0x10, 17, 1), |
| 119 | PIN_FIELD_BASE(61, 61, 3, 0x00b0, 0x10, 16, 1), |
| 120 | PIN_FIELD_BASE(62, 62, 3, 0x00b0, 0x10, 15, 1), |
| 121 | PIN_FIELD_BASE(63, 63, 3, 0x00b0, 0x10, 14, 1), |
| 122 | PIN_FIELD_BASE(64, 64, 3, 0x00b0, 0x10, 12, 1), |
| 123 | PIN_FIELD_BASE(65, 65, 3, 0x00b0, 0x10, 0, 1), |
| 124 | PIN_FIELD_BASE(66, 66, 3, 0x00b0, 0x10, 2, 1), |
| 125 | PIN_FIELD_BASE(67, 67, 3, 0x00b0, 0x10, 1, 1), |
| 126 | PIN_FIELD_BASE(68, 70, 3, 0x00b0, 0x10, 19, 1), |
| 127 | PIN_FIELD_BASE(71, 71, 3, 0x00b0, 0x10, 18, 1), |
| 128 | PIN_FIELD_BASE(72, 72, 3, 0x00b0, 0x10, 22, 1), |
| 129 | PIN_FIELD_BASE(73, 73, 4, 0x0090, 0x10, 14, 1), |
| 130 | PIN_FIELD_BASE(74, 74, 4, 0x0090, 0x10, 11, 1), |
| 131 | PIN_FIELD_BASE(75, 75, 4, 0x0090, 0x10, 13, 1), |
| 132 | PIN_FIELD_BASE(76, 76, 4, 0x0090, 0x10, 10, 1), |
| 133 | PIN_FIELD_BASE(77, 77, 4, 0x0090, 0x10, 12, 1), |
| 134 | PIN_FIELD_BASE(78, 78, 4, 0x0090, 0x10, 15, 1), |
| 135 | PIN_FIELD_BASE(79, 80, 4, 0x0090, 0x10, 6, 1), |
| 136 | PIN_FIELD_BASE(81, 81, 4, 0x0090, 0x10, 5, 1), |
| 137 | PIN_FIELD_BASE(82, 82, 4, 0x0090, 0x10, 4, 1), |
| 138 | PIN_FIELD_BASE(83, 83, 4, 0x0090, 0x10, 3, 1), |
| 139 | PIN_FIELD_BASE(84, 84, 4, 0x0090, 0x10, 2, 1), |
| 140 | PIN_FIELD_BASE(85, 85, 4, 0x0090, 0x10, 1, 1), |
| 141 | PIN_FIELD_BASE(86, 86, 4, 0x0090, 0x10, 0, 1), |
| 142 | PIN_FIELD_BASE(87, 87, 4, 0x0090, 0x10, 9, 1), |
| 143 | PIN_FIELD_BASE(88, 88, 4, 0x0090, 0x10, 8, 1), |
| 144 | PIN_FIELD_BASE(89, 92, 4, 0x0090, 0x10, 16, 1), |
| 145 | PIN_FIELD_BASE(93, 93, 5, 0x0080, 0x10, 15, 1), |
| 146 | PIN_FIELD_BASE(94, 94, 5, 0x0080, 0x10, 14, 1), |
| 147 | PIN_FIELD_BASE(95, 96, 5, 0x0080, 0x10, 16, 1), |
| 148 | PIN_FIELD_BASE(97, 97, 5, 0x0080, 0x10, 1, 1), |
| 149 | PIN_FIELD_BASE(98, 98, 5, 0x0080, 0x10, 4, 1), |
| 150 | PIN_FIELD_BASE(99, 99, 5, 0x0080, 0x10, 6, 1), |
| 151 | PIN_FIELD_BASE(100, 100, 5, 0x0080, 0x10, 0, 1), |
| 152 | PIN_FIELD_BASE(101, 101, 5, 0x0080, 0x10, 11, 1), |
| 153 | PIN_FIELD_BASE(102, 102, 5, 0x0080, 0x10, 5, 1), |
| 154 | PIN_FIELD_BASE(103, 103, 5, 0x0080, 0x10, 2, 1), |
| 155 | PIN_FIELD_BASE(104, 105, 5, 0x0080, 0x10, 18, 1), |
| 156 | PIN_FIELD_BASE(106, 106, 5, 0x0080, 0x10, 13, 1), |
| 157 | PIN_FIELD_BASE(107, 107, 5, 0x0080, 0x10, 3, 1), |
| 158 | PIN_FIELD_BASE(108, 108, 5, 0x0080, 0x10, 10, 1), |
| 159 | PIN_FIELD_BASE(109, 109, 5, 0x0080, 0x10, 12, 1), |
| 160 | PIN_FIELD_BASE(110, 111, 6, 0x00e0, 0x10, 23, 1), |
| 161 | PIN_FIELD_BASE(112, 112, 6, 0x00e0, 0x10, 22, 1), |
| 162 | PIN_FIELD_BASE(113, 114, 6, 0x00e0, 0x10, 20, 1), |
| 163 | PIN_FIELD_BASE(115, 115, 6, 0x00e0, 0x10, 19, 1), |
| 164 | PIN_FIELD_BASE(116, 116, 6, 0x00e0, 0x10, 15, 1), |
| 165 | PIN_FIELD_BASE(117, 117, 6, 0x00e0, 0x10, 14, 1), |
| 166 | PIN_FIELD_BASE(118, 118, 6, 0x00e0, 0x10, 13, 1), |
| 167 | PIN_FIELD_BASE(119, 119, 6, 0x00e0, 0x10, 12, 1), |
| 168 | PIN_FIELD_BASE(120, 120, 6, 0x00e0, 0x10, 8, 1), |
| 169 | PIN_FIELD_BASE(121, 121, 6, 0x00e0, 0x10, 7, 1), |
| 170 | PIN_FIELD_BASE(122, 122, 6, 0x00e0, 0x10, 6, 1), |
| 171 | PIN_FIELD_BASE(123, 123, 6, 0x00e0, 0x10, 5, 1), |
| 172 | PIN_FIELD_BASE(124, 124, 6, 0x00e0, 0x10, 11, 1), |
| 173 | PIN_FIELD_BASE(125, 125, 6, 0x00e0, 0x10, 4, 1), |
| 174 | PIN_FIELD_BASE(126, 126, 6, 0x00e0, 0x10, 9, 1), |
| 175 | PIN_FIELD_BASE(127, 127, 6, 0x00e0, 0x10, 16, 1), |
| 176 | PIN_FIELD_BASE(128, 129, 6, 0x00e0, 0x10, 2, 1), |
| 177 | PIN_FIELD_BASE(130, 130, 6, 0x00e0, 0x10, 17, 1), |
| 178 | PIN_FIELD_BASE(131, 131, 6, 0x00e0, 0x10, 10, 1), |
| 179 | PIN_FIELD_BASE(132, 133, 6, 0x00e0, 0x10, 0, 1), |
| 180 | PIN_FIELD_BASE(134, 134, 7, 0x0080, 0x10, 8, 1), |
| 181 | PIN_FIELD_BASE(135, 135, 7, 0x0080, 0x10, 7, 1), |
| 182 | PIN_FIELD_BASE(136, 137, 7, 0x0080, 0x10, 9, 1), |
| 183 | PIN_FIELD_BASE(138, 138, 7, 0x0080, 0x10, 0, 1), |
| 184 | PIN_FIELD_BASE(139, 139, 7, 0x0080, 0x10, 5, 1), |
| 185 | PIN_FIELD_BASE(140, 140, 7, 0x0080, 0x10, 11, 1), |
| 186 | PIN_FIELD_BASE(141, 141, 7, 0x0080, 0x10, 2, 1), |
| 187 | PIN_FIELD_BASE(142, 142, 7, 0x0080, 0x10, 1, 1), |
| 188 | PIN_FIELD_BASE(143, 143, 7, 0x0080, 0x10, 4, 1), |
| 189 | PIN_FIELD_BASE(144, 144, 7, 0x0080, 0x10, 6, 1), |
| 190 | PIN_FIELD_BASE(145, 145, 7, 0x0080, 0x10, 3, 1), |
| 191 | PIN_FIELD_BASE(146, 146, 6, 0x00e0, 0x10, 18, 1), |
| 192 | PIN_FIELD_BASE(147, 155, 8, 0x0080, 0x10, 0, 1), |
| 193 | PIN_FIELD_BASE(156, 156, 8, 0x0080, 0x10, 10, 1), |
| 194 | PIN_FIELD_BASE(157, 158, 8, 0x0080, 0x10, 12, 1), |
| 195 | PIN_FIELD_BASE(159, 159, 8, 0x0080, 0x10, 11, 1), |
| 196 | PIN_FIELD_BASE(160, 160, 8, 0x0080, 0x10, 9, 1), |
| 197 | }; |
| 198 | |
| 199 | static const struct mtk_pin_field_calc mt2731_pin_ies_range[] = { |
| 200 | PIN_FIELD_BASE(0, 2, 1, 0x0030, 0x10, 2, 1), |
| 201 | PIN_FIELD_BASE(3, 3, 3, 0x0030, 0x10, 3, 1), |
| 202 | PIN_FIELD_BASE(4, 7, 2, 0x0030, 0x10, 0, 1), |
| 203 | PIN_FIELD_BASE(8, 9, 3, 0x0030, 0x10, 4, 1), |
| 204 | PIN_FIELD_BASE(10, 12, 5, 0x0030, 0x10, 7, 1), |
| 205 | PIN_FIELD_BASE(13, 13, 2, 0x0030, 0x10, 17, 1), |
| 206 | PIN_FIELD_BASE(14, 15, 2, 0x0030, 0x10, 15, 1), |
| 207 | PIN_FIELD_BASE(16, 16, 1, 0x0030, 0x10, 22, 1), |
| 208 | PIN_FIELD_BASE(17, 17, 1, 0x0030, 0x10, 24, 1), |
| 209 | PIN_FIELD_BASE(18, 18, 1, 0x0030, 0x10, 23, 1), |
| 210 | PIN_FIELD_BASE(19, 19, 1, 0x0030, 0x10, 25, 1), |
| 211 | PIN_FIELD_BASE(20, 20, 1, 0x0030, 0x10, 16, 1), |
| 212 | PIN_FIELD_BASE(21, 23, 1, 0x0030, 0x10, 13, 1), |
| 213 | PIN_FIELD_BASE(24, 24, 1, 0x0030, 0x10, 1, 1), |
| 214 | PIN_FIELD_BASE(25, 25, 1, 0x0030, 0x10, 5, 1), |
| 215 | PIN_FIELD_BASE(26, 26, 1, 0x0030, 0x10, 21, 1), |
| 216 | PIN_FIELD_BASE(27, 27, 1, 0x0030, 0x10, 20, 1), |
| 217 | PIN_FIELD_BASE(28, 28, 1, 0x0030, 0x10, 19, 1), |
| 218 | PIN_FIELD_BASE(29, 29, 1, 0x0030, 0x10, 0, 1), |
| 219 | PIN_FIELD_BASE(30, 30, 1, 0x0030, 0x10, 12, 1), |
| 220 | PIN_FIELD_BASE(31, 32, 1, 0x0030, 0x10, 6, 1), |
| 221 | PIN_FIELD_BASE(33, 33, 1, 0x0030, 0x10, 11, 1), |
| 222 | PIN_FIELD_BASE(34, 34, 1, 0x0030, 0x10, 10, 1), |
| 223 | PIN_FIELD_BASE(35, 35, 1, 0x0030, 0x10, 9, 1), |
| 224 | PIN_FIELD_BASE(36, 36, 1, 0x0030, 0x10, 8, 1), |
| 225 | PIN_FIELD_BASE(37, 37, 2, 0x0030, 0x10, 9, 1), |
| 226 | PIN_FIELD_BASE(38, 38, 2, 0x0030, 0x10, 6, 1), |
| 227 | PIN_FIELD_BASE(39, 39, 2, 0x0030, 0x10, 10, 1), |
| 228 | PIN_FIELD_BASE(40, 41, 2, 0x0030, 0x10, 7, 1), |
| 229 | PIN_FIELD_BASE(42, 42, 2, 0x0030, 0x10, 5, 1), |
| 230 | PIN_FIELD_BASE(43, 43, 2, 0x0030, 0x10, 4, 1), |
| 231 | PIN_FIELD_BASE(44, 44, 8, 0x0030, 0x10, 14, 1), |
| 232 | PIN_FIELD_BASE(45, 45, 8, 0x0030, 0x10, 16, 1), |
| 233 | PIN_FIELD_BASE(46, 46, 8, 0x0030, 0x10, 15, 1), |
| 234 | PIN_FIELD_BASE(47, 48, 2, 0x0030, 0x10, 12, 1), |
| 235 | PIN_FIELD_BASE(49, 49, 2, 0x0030, 0x10, 11, 1), |
| 236 | PIN_FIELD_BASE(50, 50, 2, 0x0030, 0x10, 14, 1), |
| 237 | PIN_FIELD_BASE(51, 51, 3, 0x0030, 0x10, 9, 1), |
| 238 | PIN_FIELD_BASE(52, 54, 3, 0x0030, 0x10, 6, 1), |
| 239 | PIN_FIELD_BASE(55, 55, 3, 0x0030, 0x10, 10, 1), |
| 240 | PIN_FIELD_BASE(56, 56, 1, 0x0030, 0x10, 18, 1), |
| 241 | PIN_FIELD_BASE(57, 57, 1, 0x0030, 0x10, 17, 1), |
| 242 | PIN_FIELD_BASE(58, 58, 3, 0x0030, 0x10, 11, 1), |
| 243 | PIN_FIELD_BASE(59, 59, 3, 0x0030, 0x10, 13, 1), |
| 244 | PIN_FIELD_BASE(60, 60, 3, 0x0030, 0x10, 17, 1), |
| 245 | PIN_FIELD_BASE(61, 61, 3, 0x0030, 0x10, 16, 1), |
| 246 | PIN_FIELD_BASE(62, 62, 3, 0x0030, 0x10, 15, 1), |
| 247 | PIN_FIELD_BASE(63, 63, 3, 0x0030, 0x10, 14, 1), |
| 248 | PIN_FIELD_BASE(64, 64, 3, 0x0030, 0x10, 12, 1), |
| 249 | PIN_FIELD_BASE(65, 65, 3, 0x0030, 0x10, 0, 1), |
| 250 | PIN_FIELD_BASE(66, 66, 3, 0x0030, 0x10, 2, 1), |
| 251 | PIN_FIELD_BASE(67, 67, 3, 0x0030, 0x10, 1, 1), |
| 252 | PIN_FIELD_BASE(68, 70, 3, 0x0030, 0x10, 19, 1), |
| 253 | PIN_FIELD_BASE(71, 71, 3, 0x0030, 0x10, 18, 1), |
| 254 | PIN_FIELD_BASE(72, 72, 3, 0x0030, 0x10, 22, 1), |
| 255 | PIN_FIELD_BASE(73, 73, 4, 0x0040, 0x10, 14, 1), |
| 256 | PIN_FIELD_BASE(74, 74, 4, 0x0040, 0x10, 11, 1), |
| 257 | PIN_FIELD_BASE(75, 75, 4, 0x0040, 0x10, 13, 1), |
| 258 | PIN_FIELD_BASE(76, 76, 4, 0x0040, 0x10, 10, 1), |
| 259 | PIN_FIELD_BASE(77, 77, 4, 0x0040, 0x10, 12, 1), |
| 260 | PIN_FIELD_BASE(78, 78, 4, 0x0040, 0x10, 15, 1), |
| 261 | PIN_FIELD_BASE(79, 80, 4, 0x0040, 0x10, 6, 1), |
| 262 | PIN_FIELD_BASE(81, 81, 4, 0x0040, 0x10, 5, 1), |
| 263 | PIN_FIELD_BASE(82, 82, 4, 0x0040, 0x10, 4, 1), |
| 264 | PIN_FIELD_BASE(83, 83, 4, 0x0040, 0x10, 3, 1), |
| 265 | PIN_FIELD_BASE(84, 84, 4, 0x0040, 0x10, 2, 1), |
| 266 | PIN_FIELD_BASE(85, 85, 4, 0x0040, 0x10, 1, 1), |
| 267 | PIN_FIELD_BASE(86, 86, 4, 0x0040, 0x10, 0, 1), |
| 268 | PIN_FIELD_BASE(87, 87, 4, 0x0040, 0x10, 9, 1), |
| 269 | PIN_FIELD_BASE(88, 88, 4, 0x0040, 0x10, 8, 1), |
| 270 | PIN_FIELD_BASE(89, 92, 4, 0x0040, 0x10, 16, 1), |
| 271 | PIN_FIELD_BASE(93, 93, 5, 0x0030, 0x10, 15, 1), |
| 272 | PIN_FIELD_BASE(94, 94, 5, 0x0030, 0x10, 14, 1), |
| 273 | PIN_FIELD_BASE(95, 96, 5, 0x0030, 0x10, 16, 1), |
| 274 | PIN_FIELD_BASE(97, 97, 5, 0x0030, 0x10, 1, 1), |
| 275 | PIN_FIELD_BASE(98, 98, 5, 0x0030, 0x10, 4, 1), |
| 276 | PIN_FIELD_BASE(99, 99, 5, 0x0030, 0x10, 6, 1), |
| 277 | PIN_FIELD_BASE(100, 100, 5, 0x0030, 0x10, 0, 1), |
| 278 | PIN_FIELD_BASE(101, 101, 5, 0x0030, 0x10, 11, 1), |
| 279 | PIN_FIELD_BASE(102, 102, 5, 0x0030, 0x10, 5, 1), |
| 280 | PIN_FIELD_BASE(103, 103, 5, 0x0030, 0x10, 2, 1), |
| 281 | PIN_FIELD_BASE(104, 105, 5, 0x0030, 0x10, 18, 1), |
| 282 | PIN_FIELD_BASE(106, 106, 5, 0x0030, 0x10, 13, 1), |
| 283 | PIN_FIELD_BASE(107, 107, 5, 0x0030, 0x10, 3, 1), |
| 284 | PIN_FIELD_BASE(108, 108, 5, 0x0030, 0x10, 10, 1), |
| 285 | PIN_FIELD_BASE(109, 109, 5, 0x0030, 0x10, 12, 1), |
| 286 | PIN_FIELD_BASE(110, 111, 6, 0x0030, 0x10, 23, 1), |
| 287 | PIN_FIELD_BASE(112, 112, 6, 0x0030, 0x10, 22, 1), |
| 288 | PIN_FIELD_BASE(113, 114, 6, 0x0030, 0x10, 20, 1), |
| 289 | PIN_FIELD_BASE(115, 115, 6, 0x0030, 0x10, 19, 1), |
| 290 | PIN_FIELD_BASE(116, 116, 6, 0x0030, 0x10, 15, 1), |
| 291 | PIN_FIELD_BASE(117, 117, 6, 0x0030, 0x10, 14, 1), |
| 292 | PIN_FIELD_BASE(118, 118, 6, 0x0030, 0x10, 13, 1), |
| 293 | PIN_FIELD_BASE(119, 119, 6, 0x0030, 0x10, 12, 1), |
| 294 | PIN_FIELD_BASE(120, 120, 6, 0x0030, 0x10, 8, 1), |
| 295 | PIN_FIELD_BASE(121, 121, 6, 0x0030, 0x10, 7, 1), |
| 296 | PIN_FIELD_BASE(122, 122, 6, 0x0030, 0x10, 6, 1), |
| 297 | PIN_FIELD_BASE(123, 123, 6, 0x0030, 0x10, 5, 1), |
| 298 | PIN_FIELD_BASE(124, 124, 6, 0x0030, 0x10, 11, 1), |
| 299 | PIN_FIELD_BASE(125, 125, 6, 0x0030, 0x10, 4, 1), |
| 300 | PIN_FIELD_BASE(126, 126, 6, 0x0030, 0x10, 9, 1), |
| 301 | PIN_FIELD_BASE(127, 127, 6, 0x0030, 0x10, 16, 1), |
| 302 | PIN_FIELD_BASE(128, 129, 6, 0x0030, 0x10, 2, 1), |
| 303 | PIN_FIELD_BASE(130, 130, 6, 0x0030, 0x10, 17, 1), |
| 304 | PIN_FIELD_BASE(131, 131, 6, 0x0030, 0x10, 10, 1), |
| 305 | PIN_FIELD_BASE(132, 133, 6, 0x0030, 0x10, 0, 1), |
| 306 | PIN_FIELD_BASE(134, 134, 7, 0x0020, 0x10, 8, 1), |
| 307 | PIN_FIELD_BASE(135, 135, 7, 0x0020, 0x10, 7, 1), |
| 308 | PIN_FIELD_BASE(136, 137, 7, 0x0020, 0x10, 9, 1), |
| 309 | PIN_FIELD_BASE(138, 138, 7, 0x0020, 0x10, 0, 1), |
| 310 | PIN_FIELD_BASE(139, 139, 7, 0x0020, 0x10, 5, 1), |
| 311 | PIN_FIELD_BASE(140, 140, 7, 0x0020, 0x10, 11, 1), |
| 312 | PIN_FIELD_BASE(141, 141, 7, 0x0020, 0x10, 2, 1), |
| 313 | PIN_FIELD_BASE(142, 142, 7, 0x0020, 0x10, 1, 1), |
| 314 | PIN_FIELD_BASE(143, 143, 7, 0x0020, 0x10, 4, 1), |
| 315 | PIN_FIELD_BASE(144, 144, 7, 0x0020, 0x10, 6, 1), |
| 316 | PIN_FIELD_BASE(145, 145, 7, 0x0020, 0x10, 3, 1), |
| 317 | PIN_FIELD_BASE(146, 146, 6, 0x0030, 0x10, 18, 1), |
| 318 | PIN_FIELD_BASE(147, 155, 8, 0x0030, 0x10, 0, 1), |
| 319 | PIN_FIELD_BASE(156, 156, 8, 0x0030, 0x10, 10, 1), |
| 320 | PIN_FIELD_BASE(157, 158, 8, 0x0030, 0x10, 12, 1), |
| 321 | PIN_FIELD_BASE(159, 159, 8, 0x0030, 0x10, 11, 1), |
| 322 | PIN_FIELD_BASE(160, 160, 8, 0x0030, 0x10, 9, 1), |
| 323 | }; |
| 324 | |
| 325 | static const struct mtk_pin_field_calc mt2731_pin_pu_range[] = { |
| 326 | PIN_FIELD_BASE(0, 2, 1, 0x0060, 0x10, 2, 1), |
| 327 | PIN_FIELD_BASE(3, 3, 3, 0x0060, 0x10, 3, 1), |
| 328 | PIN_FIELD_BASE(4, 7, 2, 0x0050, 0x10, 0, 1), |
| 329 | PIN_FIELD_BASE(8, 9, 3, 0x0060, 0x10, 4, 1), |
| 330 | PIN_FIELD_BASE(10, 12, 5, 0x0050, 0x10, 7, 1), |
| 331 | PIN_FIELD_BASE(13, 13, 2, 0x0050, 0x10, 17, 1), |
| 332 | PIN_FIELD_BASE(14, 15, 2, 0x0050, 0x10, 15, 1), |
| 333 | PIN_FIELD_BASE(16, 16, 1, 0x0060, 0x10, 15, 1), |
| 334 | PIN_FIELD_BASE(17, 17, 1, 0x0060, 0x10, 17, 1), |
| 335 | PIN_FIELD_BASE(18, 18, 1, 0x0060, 0x10, 16, 1), |
| 336 | PIN_FIELD_BASE(19, 19, 1, 0x0060, 0x10, 18, 1), |
| 337 | PIN_FIELD_BASE(20, 20, 1, 0x0060, 0x10, 9, 1), |
| 338 | PIN_FIELD_BASE(21, 23, 1, 0x0060, 0x10, 6, 1), |
| 339 | PIN_FIELD_BASE(24, 24, 1, 0x0060, 0x10, 1, 1), |
| 340 | PIN_FIELD_BASE(25, 25, 1, 0x0060, 0x10, 5, 1), |
| 341 | PIN_FIELD_BASE(26, 26, 1, 0x0060, 0x10, 14, 1), |
| 342 | PIN_FIELD_BASE(27, 27, 1, 0x0060, 0x10, 13, 1), |
| 343 | PIN_FIELD_BASE(28, 28, 1, 0x0060, 0x10, 12, 1), |
| 344 | PIN_FIELD_BASE(29, 29, 1, 0x0060, 0x10, 0, 1), |
| 345 | PIN_FIELD_BASE(37, 37, 2, 0x0050, 0x10, 9, 1), |
| 346 | PIN_FIELD_BASE(38, 38, 2, 0x0050, 0x10, 6, 1), |
| 347 | PIN_FIELD_BASE(39, 39, 2, 0x0050, 0x10, 10, 1), |
| 348 | PIN_FIELD_BASE(40, 41, 2, 0x0050, 0x10, 7, 1), |
| 349 | PIN_FIELD_BASE(42, 42, 2, 0x0050, 0x10, 5, 1), |
| 350 | PIN_FIELD_BASE(43, 43, 2, 0x0050, 0x10, 4, 1), |
| 351 | PIN_FIELD_BASE(44, 44, 8, 0x0050, 0x10, 14, 1), |
| 352 | PIN_FIELD_BASE(45, 45, 8, 0x0050, 0x10, 16, 1), |
| 353 | PIN_FIELD_BASE(46, 46, 8, 0x0050, 0x10, 15, 1), |
| 354 | PIN_FIELD_BASE(47, 48, 2, 0x0050, 0x10, 12, 1), |
| 355 | PIN_FIELD_BASE(49, 49, 2, 0x0050, 0x10, 11, 1), |
| 356 | PIN_FIELD_BASE(50, 50, 2, 0x0050, 0x10, 14, 1), |
| 357 | PIN_FIELD_BASE(51, 51, 3, 0x0060, 0x10, 9, 1), |
| 358 | PIN_FIELD_BASE(52, 54, 3, 0x0060, 0x10, 6, 1), |
| 359 | PIN_FIELD_BASE(55, 55, 3, 0x0060, 0x10, 10, 1), |
| 360 | PIN_FIELD_BASE(56, 56, 1, 0x0060, 0x10, 11, 1), |
| 361 | PIN_FIELD_BASE(57, 57, 1, 0x0060, 0x10, 10, 1), |
| 362 | PIN_FIELD_BASE(58, 58, 3, 0x0060, 0x10, 11, 1), |
| 363 | PIN_FIELD_BASE(65, 65, 3, 0x0060, 0x10, 0, 1), |
| 364 | PIN_FIELD_BASE(66, 66, 3, 0x0060, 0x10, 2, 1), |
| 365 | PIN_FIELD_BASE(67, 67, 3, 0x0060, 0x10, 1, 1), |
| 366 | PIN_FIELD_BASE(68, 70, 3, 0x0060, 0x10, 13, 1), |
| 367 | PIN_FIELD_BASE(71, 71, 3, 0x0060, 0x10, 12, 1), |
| 368 | PIN_FIELD_BASE(72, 72, 3, 0x0060, 0x10, 16, 1), |
| 369 | PIN_FIELD_BASE(73, 73, 4, 0x0060, 0x10, 14, 1), |
| 370 | PIN_FIELD_BASE(74, 74, 4, 0x0060, 0x10, 11, 1), |
| 371 | PIN_FIELD_BASE(75, 75, 4, 0x0060, 0x10, 13, 1), |
| 372 | PIN_FIELD_BASE(76, 76, 4, 0x0060, 0x10, 10, 1), |
| 373 | PIN_FIELD_BASE(77, 77, 4, 0x0060, 0x10, 12, 1), |
| 374 | PIN_FIELD_BASE(78, 78, 4, 0x0060, 0x10, 15, 1), |
| 375 | PIN_FIELD_BASE(79, 80, 4, 0x0060, 0x10, 6, 1), |
| 376 | PIN_FIELD_BASE(81, 81, 4, 0x0060, 0x10, 5, 1), |
| 377 | PIN_FIELD_BASE(82, 82, 4, 0x0060, 0x10, 4, 1), |
| 378 | PIN_FIELD_BASE(83, 83, 4, 0x0060, 0x10, 3, 1), |
| 379 | PIN_FIELD_BASE(84, 84, 4, 0x0060, 0x10, 2, 1), |
| 380 | PIN_FIELD_BASE(85, 85, 4, 0x0060, 0x10, 1, 1), |
| 381 | PIN_FIELD_BASE(86, 86, 4, 0x0060, 0x10, 0, 1), |
| 382 | PIN_FIELD_BASE(87, 87, 4, 0x0060, 0x10, 9, 1), |
| 383 | PIN_FIELD_BASE(88, 88, 4, 0x0060, 0x10, 8, 1), |
| 384 | PIN_FIELD_BASE(89, 92, 4, 0x0060, 0x10, 16, 1), |
| 385 | PIN_FIELD_BASE(93, 93, 5, 0x0050, 0x10, 15, 1), |
| 386 | PIN_FIELD_BASE(94, 94, 5, 0x0050, 0x10, 14, 1), |
| 387 | PIN_FIELD_BASE(95, 96, 5, 0x0050, 0x10, 16, 1), |
| 388 | PIN_FIELD_BASE(97, 97, 5, 0x0050, 0x10, 1, 1), |
| 389 | PIN_FIELD_BASE(98, 98, 5, 0x0050, 0x10, 4, 1), |
| 390 | PIN_FIELD_BASE(99, 99, 5, 0x0050, 0x10, 6, 1), |
| 391 | PIN_FIELD_BASE(100, 100, 5, 0x0050, 0x10, 0, 1), |
| 392 | PIN_FIELD_BASE(101, 101, 5, 0x0050, 0x10, 11, 1), |
| 393 | PIN_FIELD_BASE(102, 102, 5, 0x0050, 0x10, 5, 1), |
| 394 | PIN_FIELD_BASE(103, 103, 5, 0x0050, 0x10, 2, 1), |
| 395 | PIN_FIELD_BASE(104, 105, 5, 0x0050, 0x10, 18, 1), |
| 396 | PIN_FIELD_BASE(106, 106, 5, 0x0050, 0x10, 13, 1), |
| 397 | PIN_FIELD_BASE(107, 107, 5, 0x0050, 0x10, 3, 1), |
| 398 | PIN_FIELD_BASE(108, 108, 5, 0x0050, 0x10, 10, 1), |
| 399 | PIN_FIELD_BASE(109, 109, 5, 0x0050, 0x10, 12, 1), |
| 400 | PIN_FIELD_BASE(116, 116, 6, 0x0070, 0x10, 15, 1), |
| 401 | PIN_FIELD_BASE(117, 117, 6, 0x0070, 0x10, 14, 1), |
| 402 | PIN_FIELD_BASE(118, 118, 6, 0x0070, 0x10, 13, 1), |
| 403 | PIN_FIELD_BASE(119, 119, 6, 0x0070, 0x10, 12, 1), |
| 404 | PIN_FIELD_BASE(120, 120, 6, 0x0070, 0x10, 8, 1), |
| 405 | PIN_FIELD_BASE(121, 121, 6, 0x0070, 0x10, 7, 1), |
| 406 | PIN_FIELD_BASE(122, 122, 6, 0x0070, 0x10, 6, 1), |
| 407 | PIN_FIELD_BASE(123, 123, 6, 0x0070, 0x10, 5, 1), |
| 408 | PIN_FIELD_BASE(124, 124, 6, 0x0070, 0x10, 11, 1), |
| 409 | PIN_FIELD_BASE(125, 125, 6, 0x0070, 0x10, 4, 1), |
| 410 | PIN_FIELD_BASE(126, 126, 6, 0x0070, 0x10, 9, 1), |
| 411 | PIN_FIELD_BASE(127, 127, 6, 0x0070, 0x10, 16, 1), |
| 412 | PIN_FIELD_BASE(128, 129, 6, 0x0070, 0x10, 2, 1), |
| 413 | PIN_FIELD_BASE(130, 130, 6, 0x0070, 0x10, 17, 1), |
| 414 | PIN_FIELD_BASE(131, 131, 6, 0x0070, 0x10, 10, 1), |
| 415 | PIN_FIELD_BASE(132, 133, 6, 0x0070, 0x10, 0, 1), |
| 416 | PIN_FIELD_BASE(146, 146, 6, 0x0070, 0x10, 18, 1), |
| 417 | PIN_FIELD_BASE(147, 155, 8, 0x0050, 0x10, 0, 1), |
| 418 | PIN_FIELD_BASE(156, 156, 8, 0x0050, 0x10, 10, 1), |
| 419 | PIN_FIELD_BASE(157, 158, 8, 0x0050, 0x10, 12, 1), |
| 420 | PIN_FIELD_BASE(159, 159, 8, 0x0050, 0x10, 11, 1), |
| 421 | PIN_FIELD_BASE(160, 160, 8, 0x0050, 0x10, 9, 1), |
| 422 | }; |
| 423 | |
| 424 | static const struct mtk_pin_field_calc mt2731_pin_pd_range[] = { |
| 425 | PIN_FIELD_BASE(0, 2, 1, 0x0040, 0x10, 2, 1), |
| 426 | PIN_FIELD_BASE(3, 3, 3, 0x0040, 0x10, 3, 1), |
| 427 | PIN_FIELD_BASE(4, 7, 2, 0x0040, 0x10, 0, 1), |
| 428 | PIN_FIELD_BASE(8, 9, 3, 0x0040, 0x10, 4, 1), |
| 429 | PIN_FIELD_BASE(10, 12, 5, 0x0040, 0x10, 7, 1), |
| 430 | PIN_FIELD_BASE(13, 13, 2, 0x0040, 0x10, 17, 1), |
| 431 | PIN_FIELD_BASE(14, 15, 2, 0x0040, 0x10, 15, 1), |
| 432 | PIN_FIELD_BASE(16, 16, 1, 0x0040, 0x10, 15, 1), |
| 433 | PIN_FIELD_BASE(17, 17, 1, 0x0040, 0x10, 17, 1), |
| 434 | PIN_FIELD_BASE(18, 18, 1, 0x0040, 0x10, 16, 1), |
| 435 | PIN_FIELD_BASE(19, 19, 1, 0x0040, 0x10, 18, 1), |
| 436 | PIN_FIELD_BASE(20, 20, 1, 0x0040, 0x10, 9, 1), |
| 437 | PIN_FIELD_BASE(21, 23, 1, 0x0040, 0x10, 6, 1), |
| 438 | PIN_FIELD_BASE(24, 24, 1, 0x0040, 0x10, 1, 1), |
| 439 | PIN_FIELD_BASE(25, 25, 1, 0x0040, 0x10, 5, 1), |
| 440 | PIN_FIELD_BASE(26, 26, 1, 0x0040, 0x10, 14, 1), |
| 441 | PIN_FIELD_BASE(27, 27, 1, 0x0040, 0x10, 13, 1), |
| 442 | PIN_FIELD_BASE(28, 28, 1, 0x0040, 0x10, 12, 1), |
| 443 | PIN_FIELD_BASE(29, 29, 1, 0x0040, 0x10, 0, 1), |
| 444 | PIN_FIELD_BASE(37, 37, 2, 0x0040, 0x10, 9, 1), |
| 445 | PIN_FIELD_BASE(38, 38, 2, 0x0040, 0x10, 6, 1), |
| 446 | PIN_FIELD_BASE(39, 39, 2, 0x0040, 0x10, 10, 1), |
| 447 | PIN_FIELD_BASE(40, 41, 2, 0x0040, 0x10, 7, 1), |
| 448 | PIN_FIELD_BASE(42, 42, 2, 0x0040, 0x10, 5, 1), |
| 449 | PIN_FIELD_BASE(43, 43, 2, 0x0040, 0x10, 4, 1), |
| 450 | PIN_FIELD_BASE(44, 44, 8, 0x0040, 0x10, 14, 1), |
| 451 | PIN_FIELD_BASE(45, 45, 8, 0x0040, 0x10, 16, 1), |
| 452 | PIN_FIELD_BASE(46, 46, 8, 0x0040, 0x10, 15, 1), |
| 453 | PIN_FIELD_BASE(47, 48, 2, 0x0040, 0x10, 12, 1), |
| 454 | PIN_FIELD_BASE(49, 49, 2, 0x0040, 0x10, 11, 1), |
| 455 | PIN_FIELD_BASE(50, 50, 2, 0x0040, 0x10, 14, 1), |
| 456 | PIN_FIELD_BASE(51, 51, 3, 0x0040, 0x10, 9, 1), |
| 457 | PIN_FIELD_BASE(52, 54, 3, 0x0040, 0x10, 6, 1), |
| 458 | PIN_FIELD_BASE(55, 55, 3, 0x0040, 0x10, 10, 1), |
| 459 | PIN_FIELD_BASE(56, 56, 1, 0x0040, 0x10, 11, 1), |
| 460 | PIN_FIELD_BASE(57, 57, 1, 0x0040, 0x10, 10, 1), |
| 461 | PIN_FIELD_BASE(58, 58, 3, 0x0040, 0x10, 11, 1), |
| 462 | PIN_FIELD_BASE(65, 65, 3, 0x0040, 0x10, 0, 1), |
| 463 | PIN_FIELD_BASE(66, 66, 3, 0x0040, 0x10, 2, 1), |
| 464 | PIN_FIELD_BASE(67, 67, 3, 0x0040, 0x10, 1, 1), |
| 465 | PIN_FIELD_BASE(68, 70, 3, 0x0040, 0x10, 13, 1), |
| 466 | PIN_FIELD_BASE(71, 71, 3, 0x0040, 0x10, 12, 1), |
| 467 | PIN_FIELD_BASE(72, 72, 3, 0x0040, 0x10, 16, 1), |
| 468 | PIN_FIELD_BASE(73, 73, 4, 0x0050, 0x10, 14, 1), |
| 469 | PIN_FIELD_BASE(74, 74, 4, 0x0050, 0x10, 11, 1), |
| 470 | PIN_FIELD_BASE(75, 75, 4, 0x0050, 0x10, 13, 1), |
| 471 | PIN_FIELD_BASE(76, 76, 4, 0x0050, 0x10, 10, 1), |
| 472 | PIN_FIELD_BASE(77, 77, 4, 0x0050, 0x10, 12, 1), |
| 473 | PIN_FIELD_BASE(78, 78, 4, 0x0050, 0x10, 15, 1), |
| 474 | PIN_FIELD_BASE(79, 80, 4, 0x0050, 0x10, 6, 1), |
| 475 | PIN_FIELD_BASE(81, 81, 4, 0x0050, 0x10, 5, 1), |
| 476 | PIN_FIELD_BASE(82, 82, 4, 0x0050, 0x10, 4, 1), |
| 477 | PIN_FIELD_BASE(83, 83, 4, 0x0050, 0x10, 3, 1), |
| 478 | PIN_FIELD_BASE(84, 84, 4, 0x0050, 0x10, 2, 1), |
| 479 | PIN_FIELD_BASE(85, 85, 4, 0x0050, 0x10, 1, 1), |
| 480 | PIN_FIELD_BASE(86, 86, 4, 0x0050, 0x10, 0, 1), |
| 481 | PIN_FIELD_BASE(87, 87, 4, 0x0050, 0x10, 9, 1), |
| 482 | PIN_FIELD_BASE(88, 88, 4, 0x0050, 0x10, 8, 1), |
| 483 | PIN_FIELD_BASE(89, 92, 4, 0x0050, 0x10, 16, 1), |
| 484 | PIN_FIELD_BASE(93, 93, 5, 0x0040, 0x10, 15, 1), |
| 485 | PIN_FIELD_BASE(94, 94, 5, 0x0040, 0x10, 14, 1), |
| 486 | PIN_FIELD_BASE(95, 96, 5, 0x0040, 0x10, 16, 1), |
| 487 | PIN_FIELD_BASE(97, 97, 5, 0x0040, 0x10, 1, 1), |
| 488 | PIN_FIELD_BASE(98, 98, 5, 0x0040, 0x10, 4, 1), |
| 489 | PIN_FIELD_BASE(99, 99, 5, 0x0040, 0x10, 6, 1), |
| 490 | PIN_FIELD_BASE(100, 100, 5, 0x0040, 0x10, 0, 1), |
| 491 | PIN_FIELD_BASE(101, 101, 5, 0x0040, 0x10, 11, 1), |
| 492 | PIN_FIELD_BASE(102, 102, 5, 0x0040, 0x10, 5, 1), |
| 493 | PIN_FIELD_BASE(103, 103, 5, 0x0040, 0x10, 2, 1), |
| 494 | PIN_FIELD_BASE(104, 105, 5, 0x0040, 0x10, 18, 1), |
| 495 | PIN_FIELD_BASE(106, 106, 5, 0x0040, 0x10, 13, 1), |
| 496 | PIN_FIELD_BASE(107, 107, 5, 0x0040, 0x10, 3, 1), |
| 497 | PIN_FIELD_BASE(108, 108, 5, 0x0040, 0x10, 10, 1), |
| 498 | PIN_FIELD_BASE(109, 109, 5, 0x0040, 0x10, 12, 1), |
| 499 | PIN_FIELD_BASE(116, 116, 6, 0x0050, 0x10, 15, 1), |
| 500 | PIN_FIELD_BASE(117, 117, 6, 0x0050, 0x10, 14, 1), |
| 501 | PIN_FIELD_BASE(118, 118, 6, 0x0050, 0x10, 13, 1), |
| 502 | PIN_FIELD_BASE(119, 119, 6, 0x0050, 0x10, 12, 1), |
| 503 | PIN_FIELD_BASE(120, 120, 6, 0x0050, 0x10, 8, 1), |
| 504 | PIN_FIELD_BASE(121, 121, 6, 0x0050, 0x10, 7, 1), |
| 505 | PIN_FIELD_BASE(122, 122, 6, 0x0050, 0x10, 6, 1), |
| 506 | PIN_FIELD_BASE(123, 123, 6, 0x0050, 0x10, 5, 1), |
| 507 | PIN_FIELD_BASE(124, 124, 6, 0x0050, 0x10, 11, 1), |
| 508 | PIN_FIELD_BASE(125, 125, 6, 0x0050, 0x10, 4, 1), |
| 509 | PIN_FIELD_BASE(126, 126, 6, 0x0050, 0x10, 9, 1), |
| 510 | PIN_FIELD_BASE(127, 127, 6, 0x0050, 0x10, 16, 1), |
| 511 | PIN_FIELD_BASE(128, 129, 6, 0x0050, 0x10, 2, 1), |
| 512 | PIN_FIELD_BASE(130, 130, 6, 0x0050, 0x10, 17, 1), |
| 513 | PIN_FIELD_BASE(131, 131, 6, 0x0050, 0x10, 10, 1), |
| 514 | PIN_FIELD_BASE(132, 133, 6, 0x0050, 0x10, 0, 1), |
| 515 | PIN_FIELD_BASE(146, 146, 6, 0x0050, 0x10, 18, 1), |
| 516 | PIN_FIELD_BASE(147, 155, 8, 0x0040, 0x10, 0, 1), |
| 517 | PIN_FIELD_BASE(156, 156, 8, 0x0040, 0x10, 10, 1), |
| 518 | PIN_FIELD_BASE(157, 158, 8, 0x0040, 0x10, 12, 1), |
| 519 | PIN_FIELD_BASE(159, 159, 8, 0x0040, 0x10, 11, 1), |
| 520 | PIN_FIELD_BASE(160, 160, 8, 0x0040, 0x10, 9, 1), |
| 521 | }; |
| 522 | |
| 523 | static const struct mtk_pin_field_calc mt2731_pin_drv_range[] = { |
| 524 | PIN_FIELD_BASE(0, 2, 1, 0x0000, 0x10, 6, 3), |
| 525 | PIN_FIELD_BASE(3, 3, 3, 0x0000, 0x10, 9, 3), |
| 526 | PIN_FIELD_BASE(4, 7, 2, 0x0000, 0x10, 0, 2), |
| 527 | PIN_FIELD_BASE(8, 9, 3, 0x0000, 0x10, 12, 3), |
| 528 | PIN_FIELD_BASE(10, 12, 5, 0x0000, 0x10, 21, 3), |
| 529 | PIN_FIELD_BASE(13, 13, 2, 0x0010, 0x10, 8, 2), |
| 530 | PIN_FIELD_BASE(14, 15, 2, 0x0010, 0x10, 4, 2), |
| 531 | PIN_FIELD_BASE(16, 16, 1, 0x0020, 0x10, 6, 3), |
| 532 | PIN_FIELD_BASE(17, 17, 1, 0x0020, 0x10, 12, 3), |
| 533 | PIN_FIELD_BASE(18, 18, 1, 0x0020, 0x10, 9, 3), |
| 534 | PIN_FIELD_BASE(19, 19, 1, 0x0020, 0x10, 15, 3), |
| 535 | PIN_FIELD_BASE(20, 20, 1, 0x0010, 0x10, 18, 3), |
| 536 | PIN_FIELD_BASE(21, 23, 1, 0x0010, 0x10, 9, 3), |
| 537 | PIN_FIELD_BASE(24, 24, 1, 0x0000, 0x10, 3, 3), |
| 538 | PIN_FIELD_BASE(25, 25, 1, 0x0000, 0x10, 15, 3), |
| 539 | PIN_FIELD_BASE(26, 26, 1, 0x0020, 0x10, 3, 3), |
| 540 | PIN_FIELD_BASE(27, 27, 1, 0x0020, 0x10, 0, 3), |
| 541 | PIN_FIELD_BASE(28, 28, 1, 0x0010, 0x10, 27, 3), |
| 542 | PIN_FIELD_BASE(29, 29, 1, 0x0000, 0x10, 0, 3), |
| 543 | PIN_FIELD_BASE(30, 30, 1, 0x0010, 0x10, 6, 3), |
| 544 | PIN_FIELD_BASE(31, 32, 1, 0x0000, 0x10, 18, 3), |
| 545 | PIN_FIELD_BASE(33, 33, 1, 0x0010, 0x10, 3, 3), |
| 546 | PIN_FIELD_BASE(34, 34, 1, 0x0010, 0x10, 0, 3), |
| 547 | PIN_FIELD_BASE(35, 35, 1, 0x0000, 0x10, 27, 3), |
| 548 | PIN_FIELD_BASE(36, 36, 1, 0x0000, 0x10, 24, 3), |
| 549 | PIN_FIELD_BASE(37, 37, 2, 0x0000, 0x10, 22, 3), |
| 550 | PIN_FIELD_BASE(38, 38, 2, 0x0000, 0x10, 13, 3), |
| 551 | PIN_FIELD_BASE(39, 39, 2, 0x0000, 0x10, 25, 3), |
| 552 | PIN_FIELD_BASE(40, 41, 2, 0x0000, 0x10, 16, 3), |
| 553 | PIN_FIELD_BASE(42, 42, 2, 0x0000, 0x10, 10, 3), |
| 554 | PIN_FIELD_BASE(43, 43, 2, 0x0000, 0x10, 8, 2), |
| 555 | PIN_FIELD_BASE(44, 44, 8, 0x0010, 0x10, 12, 3), |
| 556 | PIN_FIELD_BASE(45, 45, 8, 0x0010, 0x10, 18, 3), |
| 557 | PIN_FIELD_BASE(46, 46, 8, 0x0010, 0x10, 15, 3), |
| 558 | PIN_FIELD_BASE(47, 47, 2, 0x0000, 0x10, 30, 2), |
| 559 | PIN_FIELD_BASE(48, 48, 2, 0x0010, 0x10, 0, 2), |
| 560 | PIN_FIELD_BASE(49, 49, 2, 0x0000, 0x10, 28, 2), |
| 561 | PIN_FIELD_BASE(50, 50, 2, 0x0010, 0x10, 2, 2), |
| 562 | PIN_FIELD_BASE(51, 51, 3, 0x0000, 0x10, 27, 3), |
| 563 | PIN_FIELD_BASE(52, 54, 3, 0x0000, 0x10, 18, 3), |
| 564 | PIN_FIELD_BASE(55, 55, 3, 0x0010, 0x10, 0, 3), |
| 565 | PIN_FIELD_BASE(56, 56, 1, 0x0010, 0x10, 24, 3), |
| 566 | PIN_FIELD_BASE(57, 57, 1, 0x0010, 0x10, 21, 3), |
| 567 | PIN_FIELD_BASE(58, 58, 3, 0x0010, 0x10, 3, 3), |
| 568 | PIN_FIELD_BASE(59, 59, 3, 0x0010, 0x10, 9, 3), |
| 569 | PIN_FIELD_BASE(60, 60, 3, 0x0010, 0x10, 21, 3), |
| 570 | PIN_FIELD_BASE(61, 61, 3, 0x0010, 0x10, 18, 3), |
| 571 | PIN_FIELD_BASE(62, 62, 3, 0x0010, 0x10, 15, 3), |
| 572 | PIN_FIELD_BASE(63, 63, 3, 0x0010, 0x10, 12, 3), |
| 573 | PIN_FIELD_BASE(64, 64, 3, 0x0010, 0x10, 6, 3), |
| 574 | PIN_FIELD_BASE(65, 65, 3, 0x0000, 0x10, 0, 3), |
| 575 | PIN_FIELD_BASE(66, 66, 3, 0x0000, 0x10, 6, 3), |
| 576 | PIN_FIELD_BASE(67, 67, 3, 0x0000, 0x10, 3, 3), |
| 577 | PIN_FIELD_BASE(68, 68, 3, 0x0010, 0x10, 27, 3), |
| 578 | PIN_FIELD_BASE(69, 70, 3, 0x0020, 0x10, 0, 3), |
| 579 | PIN_FIELD_BASE(71, 71, 3, 0x0010, 0x10, 24, 3), |
| 580 | PIN_FIELD_BASE(72, 72, 3, 0x0020, 0x10, 6, 3), |
| 581 | PIN_FIELD_BASE(73, 73, 4, 0x0010, 0x10, 12, 3), |
| 582 | PIN_FIELD_BASE(74, 74, 4, 0x0010, 0x10, 3, 3), |
| 583 | PIN_FIELD_BASE(75, 75, 4, 0x0010, 0x10, 9, 3), |
| 584 | PIN_FIELD_BASE(76, 76, 4, 0x0010, 0x10, 0, 3), |
| 585 | PIN_FIELD_BASE(77, 77, 4, 0x0010, 0x10, 6, 3), |
| 586 | PIN_FIELD_BASE(78, 78, 4, 0x0010, 0x10, 15, 3), |
| 587 | PIN_FIELD_BASE(79, 80, 4, 0x0000, 0x10, 18, 3), |
| 588 | PIN_FIELD_BASE(81, 81, 4, 0x0000, 0x10, 15, 3), |
| 589 | PIN_FIELD_BASE(82, 82, 4, 0x0000, 0x10, 12, 3), |
| 590 | PIN_FIELD_BASE(83, 83, 4, 0x0000, 0x10, 9, 3), |
| 591 | PIN_FIELD_BASE(84, 84, 4, 0x0000, 0x10, 6, 3), |
| 592 | PIN_FIELD_BASE(85, 85, 4, 0x0000, 0x10, 3, 3), |
| 593 | PIN_FIELD_BASE(86, 86, 4, 0x0000, 0x10, 0, 3), |
| 594 | PIN_FIELD_BASE(87, 87, 4, 0x0000, 0x10, 27, 3), |
| 595 | PIN_FIELD_BASE(88, 88, 4, 0x0000, 0x10, 24, 3), |
| 596 | PIN_FIELD_BASE(89, 92, 4, 0x0010, 0x10, 18, 3), |
| 597 | PIN_FIELD_BASE(93, 93, 5, 0x0010, 0x10, 15, 3), |
| 598 | PIN_FIELD_BASE(94, 94, 5, 0x0010, 0x10, 12, 3), |
| 599 | PIN_FIELD_BASE(95, 96, 5, 0x0010, 0x10, 18, 3), |
| 600 | PIN_FIELD_BASE(97, 97, 5, 0x0000, 0x10, 3, 3), |
| 601 | PIN_FIELD_BASE(98, 98, 5, 0x0000, 0x10, 12, 3), |
| 602 | PIN_FIELD_BASE(99, 99, 5, 0x0000, 0x10, 18, 3), |
| 603 | PIN_FIELD_BASE(100, 100, 5, 0x0000, 0x10, 0, 3), |
| 604 | PIN_FIELD_BASE(101, 101, 5, 0x0010, 0x10, 3, 3), |
| 605 | PIN_FIELD_BASE(102, 102, 5, 0x0000, 0x10, 15, 3), |
| 606 | PIN_FIELD_BASE(103, 103, 5, 0x0000, 0x10, 6, 3), |
| 607 | PIN_FIELD_BASE(104, 105, 5, 0x0010, 0x10, 24, 3), |
| 608 | PIN_FIELD_BASE(106, 106, 5, 0x0010, 0x10, 9, 3), |
| 609 | PIN_FIELD_BASE(107, 107, 5, 0x0000, 0x10, 9, 3), |
| 610 | PIN_FIELD_BASE(108, 108, 5, 0x0010, 0x10, 0, 3), |
| 611 | PIN_FIELD_BASE(109, 109, 5, 0x0010, 0x10, 6, 3), |
| 612 | PIN_FIELD_BASE(110, 111, 6, 0x0010, 0x10, 14, 2), |
| 613 | PIN_FIELD_BASE(112, 112, 6, 0x0010, 0x10, 12, 2), |
| 614 | PIN_FIELD_BASE(113, 114, 6, 0x0010, 0x10, 8, 2), |
| 615 | PIN_FIELD_BASE(115, 115, 6, 0x0010, 0x10, 6, 2), |
| 616 | PIN_FIELD_BASE(116, 116, 6, 0x0000, 0x10, 30, 2), |
| 617 | PIN_FIELD_BASE(117, 117, 6, 0x0000, 0x10, 28, 2), |
| 618 | PIN_FIELD_BASE(118, 118, 6, 0x0000, 0x10, 26, 2), |
| 619 | PIN_FIELD_BASE(119, 119, 6, 0x0000, 0x10, 24, 2), |
| 620 | PIN_FIELD_BASE(120, 120, 6, 0x0000, 0x10, 16, 2), |
| 621 | PIN_FIELD_BASE(121, 121, 6, 0x0000, 0x10, 14, 2), |
| 622 | PIN_FIELD_BASE(122, 122, 6, 0x0000, 0x10, 12, 2), |
| 623 | PIN_FIELD_BASE(123, 123, 6, 0x0000, 0x10, 10, 2), |
| 624 | PIN_FIELD_BASE(124, 124, 6, 0x0000, 0x10, 22, 2), |
| 625 | PIN_FIELD_BASE(125, 125, 6, 0x0000, 0x10, 8, 2), |
| 626 | PIN_FIELD_BASE(126, 126, 6, 0x0000, 0x10, 18, 2), |
| 627 | PIN_FIELD_BASE(127, 127, 6, 0x0010, 0x10, 0, 2), |
| 628 | PIN_FIELD_BASE(128, 129, 6, 0x0000, 0x10, 4, 2), |
| 629 | PIN_FIELD_BASE(130, 130, 6, 0x0010, 0x10, 2, 2), |
| 630 | PIN_FIELD_BASE(131, 131, 6, 0x0000, 0x10, 20, 2), |
| 631 | PIN_FIELD_BASE(132, 133, 6, 0x0000, 0x10, 0, 2), |
| 632 | PIN_FIELD_BASE(134, 134, 7, 0x0000, 0x10, 24, 3), |
| 633 | PIN_FIELD_BASE(135, 135, 7, 0x0000, 0x10, 21, 3), |
| 634 | PIN_FIELD_BASE(136, 136, 7, 0x0000, 0x10, 27, 3), |
| 635 | PIN_FIELD_BASE(137, 137, 7, 0x0010, 0x10, 0, 3), |
| 636 | PIN_FIELD_BASE(138, 138, 7, 0x0000, 0x10, 0, 3), |
| 637 | PIN_FIELD_BASE(139, 139, 7, 0x0000, 0x10, 15, 3), |
| 638 | PIN_FIELD_BASE(140, 140, 7, 0x0010, 0x10, 3, 3), |
| 639 | PIN_FIELD_BASE(141, 141, 7, 0x0000, 0x10, 6, 3), |
| 640 | PIN_FIELD_BASE(142, 142, 7, 0x0000, 0x10, 3, 3), |
| 641 | PIN_FIELD_BASE(143, 143, 7, 0x0000, 0x10, 12, 3), |
| 642 | PIN_FIELD_BASE(144, 144, 7, 0x0000, 0x10, 18, 3), |
| 643 | PIN_FIELD_BASE(145, 145, 7, 0x0000, 0x10, 9, 3), |
| 644 | PIN_FIELD_BASE(146, 146, 6, 0x0010, 0x10, 4, 2), |
| 645 | PIN_FIELD_BASE(147, 155, 8, 0x0000, 0x10, 0, 3), |
| 646 | PIN_FIELD_BASE(156, 156, 8, 0x0010, 0x10, 0, 3), |
| 647 | PIN_FIELD_BASE(157, 158, 8, 0x0010, 0x10, 6, 3), |
| 648 | PIN_FIELD_BASE(159, 159, 8, 0x0010, 0x10, 3, 3), |
| 649 | PIN_FIELD_BASE(160, 160, 8, 0x0000, 0x10, 27, 3), |
| 650 | }; |
| 651 | |
| 652 | static const struct mtk_pin_field_calc mt2731_pin_pupd_range[] = { |
| 653 | PIN_FIELD_BASE(30, 30, 1, 0x0050, 0x10, 6, 1), |
| 654 | PIN_FIELD_BASE(31, 32, 1, 0x0050, 0x10, 0, 1), |
| 655 | PIN_FIELD_BASE(33, 33, 1, 0x0050, 0x10, 5, 1), |
| 656 | PIN_FIELD_BASE(34, 34, 1, 0x0050, 0x10, 4, 1), |
| 657 | PIN_FIELD_BASE(35, 35, 1, 0x0050, 0x10, 3, 1), |
| 658 | PIN_FIELD_BASE(36, 36, 1, 0x0050, 0x10, 2, 1), |
| 659 | PIN_FIELD_BASE(59, 59, 3, 0x0050, 0x10, 1, 1), |
| 660 | PIN_FIELD_BASE(60, 60, 3, 0x0050, 0x10, 5, 1), |
| 661 | PIN_FIELD_BASE(61, 61, 3, 0x0050, 0x10, 4, 1), |
| 662 | PIN_FIELD_BASE(62, 62, 3, 0x0050, 0x10, 3, 1), |
| 663 | PIN_FIELD_BASE(63, 63, 3, 0x0050, 0x10, 2, 1), |
| 664 | PIN_FIELD_BASE(64, 64, 3, 0x0050, 0x10, 0, 1), |
| 665 | PIN_FIELD_BASE(110, 111, 6, 0x0060, 0x10, 4, 1), |
| 666 | PIN_FIELD_BASE(112, 112, 6, 0x0060, 0x10, 3, 1), |
| 667 | PIN_FIELD_BASE(113, 114, 6, 0x0060, 0x10, 1, 1), |
| 668 | PIN_FIELD_BASE(115, 115, 6, 0x0060, 0x10, 0, 1), |
| 669 | PIN_FIELD_BASE(134, 134, 7, 0x0030, 0x10, 8, 1), |
| 670 | PIN_FIELD_BASE(135, 135, 7, 0x0030, 0x10, 7, 1), |
| 671 | PIN_FIELD_BASE(136, 137, 7, 0x0030, 0x10, 9, 1), |
| 672 | PIN_FIELD_BASE(138, 138, 7, 0x0030, 0x10, 0, 1), |
| 673 | PIN_FIELD_BASE(139, 139, 7, 0x0030, 0x10, 5, 1), |
| 674 | PIN_FIELD_BASE(140, 140, 7, 0x0030, 0x10, 11, 1), |
| 675 | PIN_FIELD_BASE(141, 141, 7, 0x0030, 0x10, 2, 1), |
| 676 | PIN_FIELD_BASE(142, 142, 7, 0x0030, 0x10, 1, 1), |
| 677 | PIN_FIELD_BASE(143, 143, 7, 0x0030, 0x10, 4, 1), |
| 678 | PIN_FIELD_BASE(144, 144, 7, 0x0030, 0x10, 6, 1), |
| 679 | PIN_FIELD_BASE(145, 145, 7, 0x0030, 0x10, 3, 1), |
| 680 | }; |
| 681 | |
| 682 | static const struct mtk_pin_field_calc mt2731_pin_r0_range[] = { |
| 683 | PIN_FIELD_BASE(30, 30, 1, 0x0070, 0x10, 6, 1), |
| 684 | PIN_FIELD_BASE(31, 32, 1, 0x0070, 0x10, 0, 1), |
| 685 | PIN_FIELD_BASE(33, 33, 1, 0x0070, 0x10, 5, 1), |
| 686 | PIN_FIELD_BASE(34, 34, 1, 0x0070, 0x10, 4, 1), |
| 687 | PIN_FIELD_BASE(35, 35, 1, 0x0070, 0x10, 3, 1), |
| 688 | PIN_FIELD_BASE(36, 36, 1, 0x0070, 0x10, 2, 1), |
| 689 | PIN_FIELD_BASE(59, 59, 3, 0x0070, 0x10, 1, 1), |
| 690 | PIN_FIELD_BASE(60, 60, 3, 0x0070, 0x10, 5, 1), |
| 691 | PIN_FIELD_BASE(61, 61, 3, 0x0070, 0x10, 4, 1), |
| 692 | PIN_FIELD_BASE(62, 62, 3, 0x0070, 0x10, 3, 1), |
| 693 | PIN_FIELD_BASE(63, 63, 3, 0x0070, 0x10, 2, 1), |
| 694 | PIN_FIELD_BASE(64, 64, 3, 0x0070, 0x10, 0, 1), |
| 695 | PIN_FIELD_BASE(110, 111, 6, 0x0080, 0x10, 4, 1), |
| 696 | PIN_FIELD_BASE(112, 112, 6, 0x0080, 0x10, 3, 1), |
| 697 | PIN_FIELD_BASE(113, 114, 6, 0x0080, 0x10, 1, 1), |
| 698 | PIN_FIELD_BASE(115, 115, 6, 0x0080, 0x10, 0, 1), |
| 699 | PIN_FIELD_BASE(134, 134, 7, 0x0040, 0x10, 8, 1), |
| 700 | PIN_FIELD_BASE(135, 135, 7, 0x0040, 0x10, 7, 1), |
| 701 | PIN_FIELD_BASE(136, 137, 7, 0x0040, 0x10, 9, 1), |
| 702 | PIN_FIELD_BASE(138, 138, 7, 0x0040, 0x10, 0, 1), |
| 703 | PIN_FIELD_BASE(139, 139, 7, 0x0040, 0x10, 5, 1), |
| 704 | PIN_FIELD_BASE(140, 140, 7, 0x0040, 0x10, 11, 1), |
| 705 | PIN_FIELD_BASE(141, 141, 7, 0x0040, 0x10, 2, 1), |
| 706 | PIN_FIELD_BASE(142, 142, 7, 0x0040, 0x10, 1, 1), |
| 707 | PIN_FIELD_BASE(143, 143, 7, 0x0040, 0x10, 4, 1), |
| 708 | PIN_FIELD_BASE(144, 144, 7, 0x0040, 0x10, 6, 1), |
| 709 | PIN_FIELD_BASE(145, 145, 7, 0x0040, 0x10, 3, 1), |
| 710 | }; |
| 711 | |
| 712 | static const struct mtk_pin_field_calc mt2731_pin_r1_range[] = { |
| 713 | PIN_FIELD_BASE(30, 30, 1, 0x0080, 0x10, 6, 1), |
| 714 | PIN_FIELD_BASE(31, 32, 1, 0x0080, 0x10, 0, 1), |
| 715 | PIN_FIELD_BASE(33, 33, 1, 0x0080, 0x10, 5, 1), |
| 716 | PIN_FIELD_BASE(34, 34, 1, 0x0080, 0x10, 4, 1), |
| 717 | PIN_FIELD_BASE(35, 35, 1, 0x0080, 0x10, 3, 1), |
| 718 | PIN_FIELD_BASE(36, 36, 1, 0x0080, 0x10, 2, 1), |
| 719 | PIN_FIELD_BASE(59, 59, 3, 0x0080, 0x10, 1, 1), |
| 720 | PIN_FIELD_BASE(60, 60, 3, 0x0080, 0x10, 5, 1), |
| 721 | PIN_FIELD_BASE(61, 61, 3, 0x0080, 0x10, 4, 1), |
| 722 | PIN_FIELD_BASE(62, 62, 3, 0x0080, 0x10, 3, 1), |
| 723 | PIN_FIELD_BASE(63, 63, 3, 0x0080, 0x10, 2, 1), |
| 724 | PIN_FIELD_BASE(64, 64, 3, 0x0080, 0x10, 0, 1), |
| 725 | PIN_FIELD_BASE(110, 111, 6, 0x0090, 0x10, 4, 1), |
| 726 | PIN_FIELD_BASE(112, 112, 6, 0x0090, 0x10, 3, 1), |
| 727 | PIN_FIELD_BASE(113, 114, 6, 0x0090, 0x10, 1, 1), |
| 728 | PIN_FIELD_BASE(115, 115, 6, 0x0090, 0x10, 0, 1), |
| 729 | PIN_FIELD_BASE(134, 134, 7, 0x0050, 0x10, 8, 1), |
| 730 | PIN_FIELD_BASE(135, 135, 7, 0x0050, 0x10, 7, 1), |
| 731 | PIN_FIELD_BASE(136, 137, 7, 0x0050, 0x10, 9, 1), |
| 732 | PIN_FIELD_BASE(138, 138, 7, 0x0050, 0x10, 0, 1), |
| 733 | PIN_FIELD_BASE(139, 139, 7, 0x0050, 0x10, 5, 1), |
| 734 | PIN_FIELD_BASE(140, 140, 7, 0x0050, 0x10, 11, 1), |
| 735 | PIN_FIELD_BASE(141, 141, 7, 0x0050, 0x10, 2, 1), |
| 736 | PIN_FIELD_BASE(142, 142, 7, 0x0050, 0x10, 1, 1), |
| 737 | PIN_FIELD_BASE(143, 143, 7, 0x0050, 0x10, 4, 1), |
| 738 | PIN_FIELD_BASE(144, 144, 7, 0x0050, 0x10, 6, 1), |
| 739 | PIN_FIELD_BASE(145, 145, 7, 0x0050, 0x10, 3, 1), |
| 740 | }; |
| 741 | |
| 742 | static const struct mtk_pin_reg_calc mt2731_reg_cals[PINCTRL_PIN_REG_MAX] = { |
| 743 | [PINCTRL_PIN_REG_MODE] = MTK_RANGE(mt2731_pin_mode_range), |
| 744 | [PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt2731_pin_dir_range), |
| 745 | [PINCTRL_PIN_REG_DI] = MTK_RANGE(mt2731_pin_di_range), |
| 746 | [PINCTRL_PIN_REG_DO] = MTK_RANGE(mt2731_pin_do_range), |
| 747 | [PINCTRL_PIN_REG_SR] = MTK_RANGE(mt2731_pin_dir_range), |
| 748 | [PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt2731_pin_smt_range), |
| 749 | [PINCTRL_PIN_REG_IES] = MTK_RANGE(mt2731_pin_ies_range), |
| 750 | [PINCTRL_PIN_REG_PU] = MTK_RANGE(mt2731_pin_pu_range), |
| 751 | [PINCTRL_PIN_REG_PD] = MTK_RANGE(mt2731_pin_pd_range), |
| 752 | [PINCTRL_PIN_REG_DRV] = MTK_RANGE(mt2731_pin_drv_range), |
| 753 | [PINCTRL_PIN_REG_PUPD] = MTK_RANGE(mt2731_pin_pupd_range), |
| 754 | [PINCTRL_PIN_REG_R0] = MTK_RANGE(mt2731_pin_r0_range), |
| 755 | [PINCTRL_PIN_REG_R1] = MTK_RANGE(mt2731_pin_r1_range), |
| 756 | }; |
| 757 | |
| 758 | static const char * const mt2731_pinctrl_register_base_names[] = { |
| 759 | "gpio", "iocfg_lm", "iocfg_lb", "iocfg_bl", "iocfg_br", |
| 760 | "iocfg_rb", "iocfg_rm", "iocfg_tr", "iocfg_tl", |
| 761 | }; |
| 762 | |
| 763 | static const struct mtk_eint_hw mt2731_eint_hw = { |
| 764 | .port_mask = 7, |
| 765 | .ports = 6, |
| 766 | .ap_num = ARRAY_SIZE(mtk_pins_mt2731), |
| 767 | .db_cnt = 13, |
| 768 | }; |
| 769 | |
| 770 | static const struct mtk_pin_soc mt2731_data = { |
| 771 | .reg_cal = mt2731_reg_cals, |
| 772 | .pins = mtk_pins_mt2731, |
| 773 | .npins = ARRAY_SIZE(mtk_pins_mt2731), |
| 774 | .ngrps = ARRAY_SIZE(mtk_pins_mt2731), |
| 775 | .eint_hw = &mt2731_eint_hw, |
| 776 | #ifdef CONFIG_PINCTRL_MTK_DEBUG |
| 777 | .pins_dir = mtk_bi_dir_mapping_mt2731, |
| 778 | .npins_dir = ARRAY_SIZE(mtk_bi_dir_mapping_mt2731), |
| 779 | #endif |
| 780 | .gpio_m = 0, |
| 781 | .ies_present = true, |
| 782 | .base_names = mt2731_pinctrl_register_base_names, |
| 783 | .nbase_names = ARRAY_SIZE(mt2731_pinctrl_register_base_names), |
| 784 | .bias_disable_set = mtk_pinconf_bias_disable_set, |
| 785 | .bias_disable_get = mtk_pinconf_bias_disable_get, |
| 786 | .bias_set = mtk_pinconf_bias_set, |
| 787 | .bias_get = mtk_pinconf_bias_get, |
| 788 | .drive_set = mtk_pinconf_drive_set_rev1, |
| 789 | .drive_get = mtk_pinconf_drive_get_rev1, |
| 790 | .adv_pull_get = mtk_pinconf_adv_pull_get, |
| 791 | .adv_pull_set = mtk_pinconf_adv_pull_set, |
| 792 | }; |
| 793 | |
| 794 | static const struct of_device_id mt2731_pinctrl_of_match[] = { |
| 795 | { .compatible = "mediatek,mt2731-pinctrl", }, |
| 796 | { } |
| 797 | }; |
| 798 | |
| 799 | static int mt2731_pinctrl_probe(struct platform_device *pdev) |
| 800 | { |
| 801 | void __iomem *event_mask = ioremap(0x1000B880, 0x16); |
| 802 | unsigned int i; |
| 803 | |
| 804 | /* |
| 805 | * Set all event_mask unmasked to avoid wakeup source |
| 806 | * blocked in suspend |
| 807 | */ |
| 808 | for (i = 0; i < 5; i++) { |
| 809 | writel(0xffffffff, event_mask); |
| 810 | event_mask += 4; |
| 811 | } |
| 812 | |
| 813 | return mtk_paris_pinctrl_probe(pdev, &mt2731_data); |
| 814 | } |
| 815 | |
| 816 | static struct platform_driver mt2731_pinctrl_driver = { |
| 817 | .driver = { |
| 818 | .name = "mt2731-pinctrl", |
| 819 | .of_match_table = mt2731_pinctrl_of_match, |
| 820 | }, |
| 821 | .probe = mt2731_pinctrl_probe, |
| 822 | }; |
| 823 | |
| 824 | static int __init mt2731_pinctrl_init(void) |
| 825 | { |
| 826 | return platform_driver_register(&mt2731_pinctrl_driver); |
| 827 | } |
| 828 | arch_initcall(mt2731_pinctrl_init); |