summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/mediatek
diff options
context:
space:
mode:
authorSean Wang <sean.wang@mediatek.com>2018-09-08 07:07:20 -0400
committerLinus Walleij <linus.walleij@linaro.org>2018-09-18 17:52:42 -0400
commitfb5fa8dc151b2364c975a9070eedb28a354a995a (patch)
treee30c6247a6ca5d58f915e735ce6cb6f4100b0917 /drivers/pinctrl/mediatek
parentb906faf7b61db890733003d5dc513bee9cd52294 (diff)
pinctrl: mediatek: extend struct mtk_pin_desc to pinctrl-mtk-common-v2.c
This patch introduces a data structure mtk_pin_desc, which is used to provide information per pin characteristic such as driving current, eint number and a driving index, that is used to lookup table describing the details about the groups of driving current by which the pin is able to adjust the driving strength so that the driver could get the appropriate driving group when calls .pin_config_get()/set(). Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/mediatek')
-rw-r--r--drivers/pinctrl/mediatek/pinctrl-moore.c49
-rw-r--r--drivers/pinctrl/mediatek/pinctrl-moore.h8
-rw-r--r--drivers/pinctrl/mediatek/pinctrl-mt7622.c213
-rw-r--r--drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h28
4 files changed, 183 insertions, 115 deletions
diff --git a/drivers/pinctrl/mediatek/pinctrl-moore.c b/drivers/pinctrl/mediatek/pinctrl-moore.c
index fef8db8c86a5..ba7511d4964c 100644
--- a/drivers/pinctrl/mediatek/pinctrl-moore.c
+++ b/drivers/pinctrl/mediatek/pinctrl-moore.c
@@ -402,31 +402,36 @@ static int mtk_gpio_direction_output(struct gpio_chip *chip, unsigned int gpio,
402static int mtk_gpio_to_irq(struct gpio_chip *chip, unsigned int offset) 402static int mtk_gpio_to_irq(struct gpio_chip *chip, unsigned int offset)
403{ 403{
404 struct mtk_pinctrl *hw = gpiochip_get_data(chip); 404 struct mtk_pinctrl *hw = gpiochip_get_data(chip);
405 unsigned long eint_n; 405 const struct mtk_pin_desc *desc;
406 406
407 if (!hw->eint) 407 if (!hw->eint)
408 return -ENOTSUPP; 408 return -ENOTSUPP;
409 409
410 eint_n = offset; 410 desc = (const struct mtk_pin_desc *)&hw->soc->pins[offset];
411 411
412 return mtk_eint_find_irq(hw->eint, eint_n); 412 if (desc->eint_n == EINT_NA)
413 return -ENOTSUPP;
414
415 return mtk_eint_find_irq(hw->eint, desc->eint_n);
413} 416}
414 417
415static int mtk_gpio_set_config(struct gpio_chip *chip, unsigned int offset, 418static int mtk_gpio_set_config(struct gpio_chip *chip, unsigned int offset,
416 unsigned long config) 419 unsigned long config)
417{ 420{
418 struct mtk_pinctrl *hw = gpiochip_get_data(chip); 421 struct mtk_pinctrl *hw = gpiochip_get_data(chip);
419 unsigned long eint_n; 422 const struct mtk_pin_desc *desc;
420 u32 debounce; 423 u32 debounce;
421 424
425 desc = (const struct mtk_pin_desc *)&hw->soc->pins[offset];
426
422 if (!hw->eint || 427 if (!hw->eint ||
423 pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE) 428 pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE ||
429 desc->eint_n == EINT_NA)
424 return -ENOTSUPP; 430 return -ENOTSUPP;
425 431
426 debounce = pinconf_to_config_argument(config); 432 debounce = pinconf_to_config_argument(config);
427 eint_n = offset;
428 433
429 return mtk_eint_set_debounce(hw->eint, eint_n, debounce); 434 return mtk_eint_set_debounce(hw->eint, desc->eint_n, debounce);
430} 435}
431 436
432static int mtk_build_gpiochip(struct mtk_pinctrl *hw, struct device_node *np) 437static int mtk_build_gpiochip(struct mtk_pinctrl *hw, struct device_node *np)
@@ -513,16 +518,40 @@ static int mtk_build_functions(struct mtk_pinctrl *hw)
513 return 0; 518 return 0;
514} 519}
515 520
521static int mtk_xt_find_eint_num(struct mtk_pinctrl *hw,
522 unsigned long eint_n)
523{
524 const struct mtk_pin_desc *desc;
525 int i = 0;
526
527 desc = (const struct mtk_pin_desc *)hw->soc->pins;
528
529 while (i < hw->soc->npins) {
530 if (desc[i].eint_n == eint_n)
531 return desc[i].number;
532 i++;
533 }
534
535 return EINT_NA;
536}
537
516static int mtk_xt_get_gpio_n(void *data, unsigned long eint_n, 538static int mtk_xt_get_gpio_n(void *data, unsigned long eint_n,
517 unsigned int *gpio_n, 539 unsigned int *gpio_n,
518 struct gpio_chip **gpio_chip) 540 struct gpio_chip **gpio_chip)
519{ 541{
520 struct mtk_pinctrl *hw = (struct mtk_pinctrl *)data; 542 struct mtk_pinctrl *hw = (struct mtk_pinctrl *)data;
543 const struct mtk_pin_desc *desc;
521 544
545 desc = (const struct mtk_pin_desc *)hw->soc->pins;
522 *gpio_chip = &hw->chip; 546 *gpio_chip = &hw->chip;
523 *gpio_n = eint_n;
524 547
525 return 0; 548 /* Be greedy to guess first gpio_n is equal to eint_n */
549 if (desc[eint_n].eint_n == eint_n)
550 *gpio_n = eint_n;
551 else
552 *gpio_n = mtk_xt_find_eint_num(hw, eint_n);
553
554 return *gpio_n == EINT_NA ? -EINVAL : 0;
526} 555}
527 556
528static int mtk_xt_get_gpio_state(void *data, unsigned long eint_n) 557static int mtk_xt_get_gpio_state(void *data, unsigned long eint_n)
@@ -635,7 +664,7 @@ int mtk_moore_pinctrl_probe(struct platform_device *pdev,
635 return PTR_ERR(hw->base); 664 return PTR_ERR(hw->base);
636 665
637 /* Setup pins descriptions per SoC types */ 666 /* Setup pins descriptions per SoC types */
638 mtk_desc.pins = hw->soc->pins; 667 mtk_desc.pins = (const struct pinctrl_pin_desc *)hw->soc->pins;
639 mtk_desc.npins = hw->soc->npins; 668 mtk_desc.npins = hw->soc->npins;
640 mtk_desc.num_custom_params = ARRAY_SIZE(mtk_custom_bindings); 669 mtk_desc.num_custom_params = ARRAY_SIZE(mtk_custom_bindings);
641 mtk_desc.custom_params = mtk_custom_bindings; 670 mtk_desc.custom_params = mtk_custom_bindings;
diff --git a/drivers/pinctrl/mediatek/pinctrl-moore.h b/drivers/pinctrl/mediatek/pinctrl-moore.h
index 1011e9056ee4..b965cc1ba9f6 100644
--- a/drivers/pinctrl/mediatek/pinctrl-moore.h
+++ b/drivers/pinctrl/mediatek/pinctrl-moore.h
@@ -27,6 +27,14 @@
27#include "pinctrl-mtk-common-v2.h" 27#include "pinctrl-mtk-common-v2.h"
28 28
29#define MTK_RANGE(_a) { .range = (_a), .nranges = ARRAY_SIZE(_a), } 29#define MTK_RANGE(_a) { .range = (_a), .nranges = ARRAY_SIZE(_a), }
30
31#define MTK_PIN(_number, _name, _eint_n, _drv_n) { \
32 .number = _number, \
33 .name = _name, \
34 .eint_n = _eint_n, \
35 .drv_n = _drv_n, \
36 }
37
30#define PINCTRL_PIN_GROUP(name, id) \ 38#define PINCTRL_PIN_GROUP(name, id) \
31 { \ 39 { \
32 name, \ 40 name, \
diff --git a/drivers/pinctrl/mediatek/pinctrl-mt7622.c b/drivers/pinctrl/mediatek/pinctrl-mt7622.c
index b9c1680184be..a0045bb1cfe3 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt7622.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt7622.c
@@ -8,6 +8,9 @@
8 8
9#include "pinctrl-moore.h" 9#include "pinctrl-moore.h"
10 10
11#define MT7622_PIN(_number, _name) \
12 MTK_PIN(_number, _name, _number, DRV_GRP0)
13
11static const struct mtk_pin_field_calc mt7622_pin_mode_range[] = { 14static const struct mtk_pin_field_calc mt7622_pin_mode_range[] = {
12 PIN_FIELD(0, 0, 0x320, 0x10, 16, 4), 15 PIN_FIELD(0, 0, 0x320, 0x10, 16, 4),
13 PIN_FIELD(1, 4, 0x3a0, 0x10, 16, 4), 16 PIN_FIELD(1, 4, 0x3a0, 0x10, 16, 4),
@@ -149,110 +152,110 @@ static const struct mtk_pin_reg_calc mt7622_reg_cals[PINCTRL_PIN_REG_MAX] = {
149 [PINCTRL_PIN_REG_RDSEL] = MTK_RANGE(mt7622_pin_rdsel_range), 152 [PINCTRL_PIN_REG_RDSEL] = MTK_RANGE(mt7622_pin_rdsel_range),
150}; 153};
151 154
152static const struct pinctrl_pin_desc mt7622_pins[] = { 155static const struct mtk_pin_desc mt7622_pins[] = {
153 PINCTRL_PIN(0, "GPIO_A"), 156 MT7622_PIN(0, "GPIO_A"),
154 PINCTRL_PIN(1, "I2S1_IN"), 157 MT7622_PIN(1, "I2S1_IN"),
155 PINCTRL_PIN(2, "I2S1_OUT"), 158 MT7622_PIN(2, "I2S1_OUT"),
156 PINCTRL_PIN(3, "I2S_BCLK"), 159 MT7622_PIN(3, "I2S_BCLK"),
157 PINCTRL_PIN(4, "I2S_WS"), 160 MT7622_PIN(4, "I2S_WS"),
158 PINCTRL_PIN(5, "I2S_MCLK"), 161 MT7622_PIN(5, "I2S_MCLK"),
159 PINCTRL_PIN(6, "TXD0"), 162 MT7622_PIN(6, "TXD0"),
160 PINCTRL_PIN(7, "RXD0"), 163 MT7622_PIN(7, "RXD0"),
161 PINCTRL_PIN(8, "SPI_WP"), 164 MT7622_PIN(8, "SPI_WP"),
162 PINCTRL_PIN(9, "SPI_HOLD"), 165 MT7622_PIN(9, "SPI_HOLD"),
163 PINCTRL_PIN(10, "SPI_CLK"), 166 MT7622_PIN(10, "SPI_CLK"),
164 PINCTRL_PIN(11, "SPI_MOSI"), 167 MT7622_PIN(11, "SPI_MOSI"),
165 PINCTRL_PIN(12, "SPI_MISO"), 168 MT7622_PIN(12, "SPI_MISO"),
166 PINCTRL_PIN(13, "SPI_CS"), 169 MT7622_PIN(13, "SPI_CS"),
167 PINCTRL_PIN(14, "I2C_SDA"), 170 MT7622_PIN(14, "I2C_SDA"),
168 PINCTRL_PIN(15, "I2C_SCL"), 171 MT7622_PIN(15, "I2C_SCL"),
169 PINCTRL_PIN(16, "I2S2_IN"), 172 MT7622_PIN(16, "I2S2_IN"),
170 PINCTRL_PIN(17, "I2S3_IN"), 173 MT7622_PIN(17, "I2S3_IN"),
171 PINCTRL_PIN(18, "I2S4_IN"), 174 MT7622_PIN(18, "I2S4_IN"),
172 PINCTRL_PIN(19, "I2S2_OUT"), 175 MT7622_PIN(19, "I2S2_OUT"),
173 PINCTRL_PIN(20, "I2S3_OUT"), 176 MT7622_PIN(20, "I2S3_OUT"),
174 PINCTRL_PIN(21, "I2S4_OUT"), 177 MT7622_PIN(21, "I2S4_OUT"),
175 PINCTRL_PIN(22, "GPIO_B"), 178 MT7622_PIN(22, "GPIO_B"),
176 PINCTRL_PIN(23, "MDC"), 179 MT7622_PIN(23, "MDC"),
177 PINCTRL_PIN(24, "MDIO"), 180 MT7622_PIN(24, "MDIO"),
178 PINCTRL_PIN(25, "G2_TXD0"), 181 MT7622_PIN(25, "G2_TXD0"),
179 PINCTRL_PIN(26, "G2_TXD1"), 182 MT7622_PIN(26, "G2_TXD1"),
180 PINCTRL_PIN(27, "G2_TXD2"), 183 MT7622_PIN(27, "G2_TXD2"),
181 PINCTRL_PIN(28, "G2_TXD3"), 184 MT7622_PIN(28, "G2_TXD3"),
182 PINCTRL_PIN(29, "G2_TXEN"), 185 MT7622_PIN(29, "G2_TXEN"),
183 PINCTRL_PIN(30, "G2_TXC"), 186 MT7622_PIN(30, "G2_TXC"),
184 PINCTRL_PIN(31, "G2_RXD0"), 187 MT7622_PIN(31, "G2_RXD0"),
185 PINCTRL_PIN(32, "G2_RXD1"), 188 MT7622_PIN(32, "G2_RXD1"),
186 PINCTRL_PIN(33, "G2_RXD2"), 189 MT7622_PIN(33, "G2_RXD2"),
187 PINCTRL_PIN(34, "G2_RXD3"), 190 MT7622_PIN(34, "G2_RXD3"),
188 PINCTRL_PIN(35, "G2_RXDV"), 191 MT7622_PIN(35, "G2_RXDV"),
189 PINCTRL_PIN(36, "G2_RXC"), 192 MT7622_PIN(36, "G2_RXC"),
190 PINCTRL_PIN(37, "NCEB"), 193 MT7622_PIN(37, "NCEB"),
191 PINCTRL_PIN(38, "NWEB"), 194 MT7622_PIN(38, "NWEB"),
192 PINCTRL_PIN(39, "NREB"), 195 MT7622_PIN(39, "NREB"),
193 PINCTRL_PIN(40, "NDL4"), 196 MT7622_PIN(40, "NDL4"),
194 PINCTRL_PIN(41, "NDL5"), 197 MT7622_PIN(41, "NDL5"),
195 PINCTRL_PIN(42, "NDL6"), 198 MT7622_PIN(42, "NDL6"),
196 PINCTRL_PIN(43, "NDL7"), 199 MT7622_PIN(43, "NDL7"),
197 PINCTRL_PIN(44, "NRB"), 200 MT7622_PIN(44, "NRB"),
198 PINCTRL_PIN(45, "NCLE"), 201 MT7622_PIN(45, "NCLE"),
199 PINCTRL_PIN(46, "NALE"), 202 MT7622_PIN(46, "NALE"),
200 PINCTRL_PIN(47, "NDL0"), 203 MT7622_PIN(47, "NDL0"),
201 PINCTRL_PIN(48, "NDL1"), 204 MT7622_PIN(48, "NDL1"),
202 PINCTRL_PIN(49, "NDL2"), 205 MT7622_PIN(49, "NDL2"),
203 PINCTRL_PIN(50, "NDL3"), 206 MT7622_PIN(50, "NDL3"),
204 PINCTRL_PIN(51, "MDI_TP_P0"), 207 MT7622_PIN(51, "MDI_TP_P0"),
205 PINCTRL_PIN(52, "MDI_TN_P0"), 208 MT7622_PIN(52, "MDI_TN_P0"),
206 PINCTRL_PIN(53, "MDI_RP_P0"), 209 MT7622_PIN(53, "MDI_RP_P0"),
207 PINCTRL_PIN(54, "MDI_RN_P0"), 210 MT7622_PIN(54, "MDI_RN_P0"),
208 PINCTRL_PIN(55, "MDI_TP_P1"), 211 MT7622_PIN(55, "MDI_TP_P1"),
209 PINCTRL_PIN(56, "MDI_TN_P1"), 212 MT7622_PIN(56, "MDI_TN_P1"),
210 PINCTRL_PIN(57, "MDI_RP_P1"), 213 MT7622_PIN(57, "MDI_RP_P1"),
211 PINCTRL_PIN(58, "MDI_RN_P1"), 214 MT7622_PIN(58, "MDI_RN_P1"),
212 PINCTRL_PIN(59, "MDI_RP_P2"), 215 MT7622_PIN(59, "MDI_RP_P2"),
213 PINCTRL_PIN(60, "MDI_RN_P2"), 216 MT7622_PIN(60, "MDI_RN_P2"),
214 PINCTRL_PIN(61, "MDI_TP_P2"), 217 MT7622_PIN(61, "MDI_TP_P2"),
215 PINCTRL_PIN(62, "MDI_TN_P2"), 218 MT7622_PIN(62, "MDI_TN_P2"),
216 PINCTRL_PIN(63, "MDI_TP_P3"), 219 MT7622_PIN(63, "MDI_TP_P3"),
217 PINCTRL_PIN(64, "MDI_TN_P3"), 220 MT7622_PIN(64, "MDI_TN_P3"),
218 PINCTRL_PIN(65, "MDI_RP_P3"), 221 MT7622_PIN(65, "MDI_RP_P3"),
219 PINCTRL_PIN(66, "MDI_RN_P3"), 222 MT7622_PIN(66, "MDI_RN_P3"),
220 PINCTRL_PIN(67, "MDI_RP_P4"), 223 MT7622_PIN(67, "MDI_RP_P4"),
221 PINCTRL_PIN(68, "MDI_RN_P4"), 224 MT7622_PIN(68, "MDI_RN_P4"),
222 PINCTRL_PIN(69, "MDI_TP_P4"), 225 MT7622_PIN(69, "MDI_TP_P4"),
223 PINCTRL_PIN(70, "MDI_TN_P4"), 226 MT7622_PIN(70, "MDI_TN_P4"),
224 PINCTRL_PIN(71, "PMIC_SCL"), 227 MT7622_PIN(71, "PMIC_SCL"),
225 PINCTRL_PIN(72, "PMIC_SDA"), 228 MT7622_PIN(72, "PMIC_SDA"),
226 PINCTRL_PIN(73, "SPIC1_CLK"), 229 MT7622_PIN(73, "SPIC1_CLK"),
227 PINCTRL_PIN(74, "SPIC1_MOSI"), 230 MT7622_PIN(74, "SPIC1_MOSI"),
228 PINCTRL_PIN(75, "SPIC1_MISO"), 231 MT7622_PIN(75, "SPIC1_MISO"),
229 PINCTRL_PIN(76, "SPIC1_CS"), 232 MT7622_PIN(76, "SPIC1_CS"),
230 PINCTRL_PIN(77, "GPIO_D"), 233 MT7622_PIN(77, "GPIO_D"),
231 PINCTRL_PIN(78, "WATCHDOG"), 234 MT7622_PIN(78, "WATCHDOG"),
232 PINCTRL_PIN(79, "RTS3_N"), 235 MT7622_PIN(79, "RTS3_N"),
233 PINCTRL_PIN(80, "CTS3_N"), 236 MT7622_PIN(80, "CTS3_N"),
234 PINCTRL_PIN(81, "TXD3"), 237 MT7622_PIN(81, "TXD3"),
235 PINCTRL_PIN(82, "RXD3"), 238 MT7622_PIN(82, "RXD3"),
236 PINCTRL_PIN(83, "PERST0_N"), 239 MT7622_PIN(83, "PERST0_N"),
237 PINCTRL_PIN(84, "PERST1_N"), 240 MT7622_PIN(84, "PERST1_N"),
238 PINCTRL_PIN(85, "WLED_N"), 241 MT7622_PIN(85, "WLED_N"),
239 PINCTRL_PIN(86, "EPHY_LED0_N"), 242 MT7622_PIN(86, "EPHY_LED0_N"),
240 PINCTRL_PIN(87, "AUXIN0"), 243 MT7622_PIN(87, "AUXIN0"),
241 PINCTRL_PIN(88, "AUXIN1"), 244 MT7622_PIN(88, "AUXIN1"),
242 PINCTRL_PIN(89, "AUXIN2"), 245 MT7622_PIN(89, "AUXIN2"),
243 PINCTRL_PIN(90, "AUXIN3"), 246 MT7622_PIN(90, "AUXIN3"),
244 PINCTRL_PIN(91, "TXD4"), 247 MT7622_PIN(91, "TXD4"),
245 PINCTRL_PIN(92, "RXD4"), 248 MT7622_PIN(92, "RXD4"),
246 PINCTRL_PIN(93, "RTS4_N"), 249 MT7622_PIN(93, "RTS4_N"),
247 PINCTRL_PIN(94, "CTS4_N"), 250 MT7622_PIN(94, "CTS4_N"),
248 PINCTRL_PIN(95, "PWM1"), 251 MT7622_PIN(95, "PWM1"),
249 PINCTRL_PIN(96, "PWM2"), 252 MT7622_PIN(96, "PWM2"),
250 PINCTRL_PIN(97, "PWM3"), 253 MT7622_PIN(97, "PWM3"),
251 PINCTRL_PIN(98, "PWM4"), 254 MT7622_PIN(98, "PWM4"),
252 PINCTRL_PIN(99, "PWM5"), 255 MT7622_PIN(99, "PWM5"),
253 PINCTRL_PIN(100, "PWM6"), 256 MT7622_PIN(100, "PWM6"),
254 PINCTRL_PIN(101, "PWM7"), 257 MT7622_PIN(101, "PWM7"),
255 PINCTRL_PIN(102, "GPIO_E"), 258 MT7622_PIN(102, "GPIO_E"),
256}; 259};
257 260
258/* List all groups consisting of these pins dedicated to the enablement of 261/* List all groups consisting of these pins dedicated to the enablement of
@@ -755,7 +758,7 @@ static const struct mtk_eint_hw mt7622_eint_hw = {
755 758
756static const struct mtk_pin_soc mt7622_data = { 759static const struct mtk_pin_soc mt7622_data = {
757 .reg_cal = mt7622_reg_cals, 760 .reg_cal = mt7622_reg_cals,
758 .pins = mt7622_pins, 761 .pins = (const struct pinctrl_pin_desc *)mt7622_pins,
759 .npins = ARRAY_SIZE(mt7622_pins), 762 .npins = ARRAY_SIZE(mt7622_pins),
760 .grps = mt7622_groups, 763 .grps = mt7622_groups,
761 .ngrps = ARRAY_SIZE(mt7622_groups), 764 .ngrps = ARRAY_SIZE(mt7622_groups),
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h
index f05c8020ca1c..a8e12ac90f0b 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h
@@ -15,6 +15,8 @@
15#define MTK_DISABLE 0 15#define MTK_DISABLE 0
16#define MTK_ENABLE 1 16#define MTK_ENABLE 1
17 17
18#define EINT_NA -1
19
18#define PIN_FIELD_CALC(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, \ 20#define PIN_FIELD_CALC(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, \
19 _x_bits, _sz_reg, _fixed) { \ 21 _x_bits, _sz_reg, _fixed) { \
20 .s_pin = _s_pin, \ 22 .s_pin = _s_pin, \
@@ -52,6 +54,17 @@ enum {
52 PINCTRL_PIN_REG_MAX, 54 PINCTRL_PIN_REG_MAX,
53}; 55};
54 56
57/* Group the pins by the driving current */
58enum {
59 DRV_FIXED,
60 DRV_GRP0,
61 DRV_GRP1,
62 DRV_GRP2,
63 DRV_GRP3,
64 DRV_GRP4,
65 DRV_GRP_MAX,
66};
67
55/* struct mtk_pin_field - the structure that holds the information of the field 68/* struct mtk_pin_field - the structure that holds the information of the field
56 * used to describe the attribute for the pin 69 * used to describe the attribute for the pin
57 * @offset: the register offset relative to the base address 70 * @offset: the register offset relative to the base address
@@ -103,6 +116,21 @@ struct mtk_pin_reg_calc {
103 unsigned int nranges; 116 unsigned int nranges;
104}; 117};
105 118
119/**
120 * struct mtk_pin_desc - the structure that providing information
121 * for each pin of chips
122 * @number: unique pin number from the global pin number space
123 * @name: name for this pin
124 * @eint_n: the eint number for this pin
125 * @drv_n: the index with the driving group
126 */
127struct mtk_pin_desc {
128 unsigned int number;
129 const char *name;
130 u16 eint_n;
131 u8 drv_n;
132};
133
106/* struct mtk_pin_soc - the structure that holds SoC-specific data */ 134/* struct mtk_pin_soc - the structure that holds SoC-specific data */
107struct mtk_pin_soc { 135struct mtk_pin_soc {
108 const struct mtk_pin_reg_calc *reg_cal; 136 const struct mtk_pin_reg_calc *reg_cal;