Commit d9819eb9 authored by Maoguang Meng's avatar Maoguang Meng Committed by Linus Walleij

pinctrl: mediatek: Add EINT support to MTK pinctrl driver.

MTK SoC support external interrupt(EINT) from most SoC pins.
Add EINT support to pinctrl driver.
Signed-off-by: default avatarMaoguang Meng <maoguang.meng@mediatek.com>
Signed-off-by: default avatarHongzhou Yang <hongzhou.yang@mediatek.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent a6df410d
...@@ -314,6 +314,29 @@ static const struct mtk_pinctrl_devdata mt8135_pinctrl_data = { ...@@ -314,6 +314,29 @@ static const struct mtk_pinctrl_devdata mt8135_pinctrl_data = {
.port_shf = 4, .port_shf = 4,
.port_mask = 0xf, .port_mask = 0xf,
.port_align = 4, .port_align = 4,
.chip_type = MTK_CHIP_TYPE_BASE,
.eint_offsets = {
.name = "mt8135_eint",
.stat = 0x000,
.ack = 0x040,
.mask = 0x080,
.mask_set = 0x0c0,
.mask_clr = 0x100,
.sens = 0x140,
.sens_set = 0x180,
.sens_clr = 0x1c0,
.pol = 0x300,
.pol_set = 0x340,
.pol_clr = 0x380,
.dom_en = 0x400,
.dbnc_ctrl = 0x500,
.dbnc_set = 0x600,
.dbnc_clr = 0x700,
.port_mask = 7,
.ports = 6,
},
.ap_num = 192,
.db_cnt = 16,
}; };
static int mt8135_pinctrl_probe(struct platform_device *pdev) static int mt8135_pinctrl_probe(struct platform_device *pdev)
......
...@@ -16,10 +16,16 @@ ...@@ -16,10 +16,16 @@
#define __PINCTRL_MTK_COMMON_H #define __PINCTRL_MTK_COMMON_H
#include <linux/pinctrl/pinctrl.h> #include <linux/pinctrl/pinctrl.h>
#include <linux/spinlock.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#define NO_EINT_SUPPORT 255 #define NO_EINT_SUPPORT 255
#define MTK_CHIP_TYPE_BASE 0
#define MTK_CHIP_TYPE_PMIC 1
#define MT_EDGE_SENSITIVE 0
#define MT_LEVEL_SENSITIVE 1
#define EINT_DBNC_SET_DBNC_BITS 4
#define EINT_DBNC_RST_BIT (0x1 << 1)
#define EINT_DBNC_SET_EN (0x1 << 0)
struct mtk_desc_function { struct mtk_desc_function {
const char *name; const char *name;
...@@ -115,6 +121,27 @@ struct mtk_pin_drv_grp { ...@@ -115,6 +121,27 @@ struct mtk_pin_drv_grp {
.grp = _grp, \ .grp = _grp, \
} }
struct mtk_eint_offsets {
const char *name;
unsigned int stat;
unsigned int ack;
unsigned int mask;
unsigned int mask_set;
unsigned int mask_clr;
unsigned int sens;
unsigned int sens_set;
unsigned int sens_clr;
unsigned int pol;
unsigned int pol_set;
unsigned int pol_clr;
unsigned int dom_en;
unsigned int dbnc_ctrl;
unsigned int dbnc_set;
unsigned int dbnc_clr;
u8 port_mask;
u8 ports;
};
/** /**
* struct mtk_pinctrl_devdata - Provide HW GPIO related data. * struct mtk_pinctrl_devdata - Provide HW GPIO related data.
* @pins: An array describing all pins the pin controller affects. * @pins: An array describing all pins the pin controller affects.
...@@ -165,6 +192,10 @@ struct mtk_pinctrl_devdata { ...@@ -165,6 +192,10 @@ struct mtk_pinctrl_devdata {
unsigned char port_shf; unsigned char port_shf;
unsigned char port_mask; unsigned char port_mask;
unsigned char port_align; unsigned char port_align;
unsigned char chip_type;
struct mtk_eint_offsets eint_offsets;
unsigned int ap_num;
unsigned int db_cnt;
}; };
struct mtk_pinctrl { struct mtk_pinctrl {
...@@ -177,6 +208,8 @@ struct mtk_pinctrl { ...@@ -177,6 +208,8 @@ struct mtk_pinctrl {
const char **grp_names; const char **grp_names;
struct pinctrl_dev *pctl_dev; struct pinctrl_dev *pctl_dev;
const struct mtk_pinctrl_devdata *devdata; const struct mtk_pinctrl_devdata *devdata;
void __iomem *eint_reg_base;
struct irq_domain *domain;
}; };
int mtk_pctrl_init(struct platform_device *pdev, int mtk_pctrl_init(struct platform_device *pdev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment