diff options
author | Sean Wang <sean.wang@mediatek.com> | 2018-09-08 07:07:38 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2018-09-18 17:53:42 -0400 |
commit | 6561859b067fcd6c5b89fd625b2c7dc324b706b5 (patch) | |
tree | 8a9ac55237bdf531704c65e86c247221d43031a2 /drivers/pinctrl/mediatek | |
parent | 89132dd8ffd2218fad3f53a9ca529e609237448a (diff) |
pinctrl: mediatek: add eint support to MT8183 pinctrl driver
Just add eint support to MT8183 pinctrl driver as usual as
happens on the other SoCs.
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-mt8183.c | 8 | ||||
-rw-r--r-- | drivers/pinctrl/mediatek/pinctrl-paris.c | 22 |
2 files changed, 30 insertions, 0 deletions
diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8183.c b/drivers/pinctrl/mediatek/pinctrl-mt8183.c index 9d5aa277911c..6262fd3678ea 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mt8183.c +++ b/drivers/pinctrl/mediatek/pinctrl-mt8183.c | |||
@@ -492,11 +492,19 @@ static const char * const mt8183_pinctrl_register_base_names[] = { | |||
492 | "iocfg6", "iocfg7", "iocfg8", | 492 | "iocfg6", "iocfg7", "iocfg8", |
493 | }; | 493 | }; |
494 | 494 | ||
495 | static const struct mtk_eint_hw mt8183_eint_hw = { | ||
496 | .port_mask = 7, | ||
497 | .ports = 6, | ||
498 | .ap_num = 212, | ||
499 | .db_cnt = 13, | ||
500 | }; | ||
501 | |||
495 | static const struct mtk_pin_soc mt8183_data = { | 502 | static const struct mtk_pin_soc mt8183_data = { |
496 | .reg_cal = mt8183_reg_cals, | 503 | .reg_cal = mt8183_reg_cals, |
497 | .pins = mtk_pins_mt8183, | 504 | .pins = mtk_pins_mt8183, |
498 | .npins = ARRAY_SIZE(mtk_pins_mt8183), | 505 | .npins = ARRAY_SIZE(mtk_pins_mt8183), |
499 | .ngrps = ARRAY_SIZE(mtk_pins_mt8183), | 506 | .ngrps = ARRAY_SIZE(mtk_pins_mt8183), |
507 | .eint_hw = &mt8183_eint_hw, | ||
500 | .gpio_m = 0, | 508 | .gpio_m = 0, |
501 | .ies_present = true, | 509 | .ies_present = true, |
502 | .base_names = mt8183_pinctrl_register_base_names, | 510 | .base_names = mt8183_pinctrl_register_base_names, |
diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c index 50d689371590..9f4224f9d605 100644 --- a/drivers/pinctrl/mediatek/pinctrl-paris.c +++ b/drivers/pinctrl/mediatek/pinctrl-paris.c | |||
@@ -718,6 +718,22 @@ static int mtk_gpio_direction_output(struct gpio_chip *chip, unsigned int gpio, | |||
718 | return pinctrl_gpio_direction_output(chip->base + gpio); | 718 | return pinctrl_gpio_direction_output(chip->base + gpio); |
719 | } | 719 | } |
720 | 720 | ||
721 | static int mtk_gpio_to_irq(struct gpio_chip *chip, unsigned int offset) | ||
722 | { | ||
723 | struct mtk_pinctrl *hw = gpiochip_get_data(chip); | ||
724 | const struct mtk_pin_desc *desc; | ||
725 | |||
726 | if (!hw->eint) | ||
727 | return -ENOTSUPP; | ||
728 | |||
729 | desc = (const struct mtk_pin_desc *)&hw->soc->pins[offset]; | ||
730 | |||
731 | if (desc->eint.eint_n == EINT_NA) | ||
732 | return -ENOTSUPP; | ||
733 | |||
734 | return mtk_eint_find_irq(hw->eint, desc->eint.eint_n); | ||
735 | } | ||
736 | |||
721 | static int mtk_gpio_set_config(struct gpio_chip *chip, unsigned int offset, | 737 | static int mtk_gpio_set_config(struct gpio_chip *chip, unsigned int offset, |
722 | unsigned long config) | 738 | unsigned long config) |
723 | { | 739 | { |
@@ -751,6 +767,7 @@ static int mtk_build_gpiochip(struct mtk_pinctrl *hw, struct device_node *np) | |||
751 | chip->direction_output = mtk_gpio_direction_output; | 767 | chip->direction_output = mtk_gpio_direction_output; |
752 | chip->get = mtk_gpio_get; | 768 | chip->get = mtk_gpio_get; |
753 | chip->set = mtk_gpio_set; | 769 | chip->set = mtk_gpio_set; |
770 | chip->to_irq = mtk_gpio_to_irq, | ||
754 | chip->set_config = mtk_gpio_set_config, | 771 | chip->set_config = mtk_gpio_set_config, |
755 | chip->base = -1; | 772 | chip->base = -1; |
756 | chip->ngpio = hw->soc->npins; | 773 | chip->ngpio = hw->soc->npins; |
@@ -871,6 +888,11 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev, | |||
871 | if (err) | 888 | if (err) |
872 | return err; | 889 | return err; |
873 | 890 | ||
891 | err = mtk_build_eint(hw, pdev); | ||
892 | if (err) | ||
893 | dev_warn(&pdev->dev, | ||
894 | "Failed to add EINT, but pinctrl still can work\n"); | ||
895 | |||
874 | /* Build gpiochip should be after pinctrl_enable is done */ | 896 | /* Build gpiochip should be after pinctrl_enable is done */ |
875 | err = mtk_build_gpiochip(hw, pdev->dev.of_node); | 897 | err = mtk_build_gpiochip(hw, pdev->dev.of_node); |
876 | if (err) { | 898 | if (err) { |