xref: /linux/drivers/pinctrl/mediatek/pinctrl-moore.h (revision a1ff5a7d78a036d6c2178ee5acd6ba4946243800)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2017-2018 MediaTek Inc.
4  *
5  * Author: Sean Wang <sean.wang@mediatek.com>
6  *
7  */
8 #ifndef __PINCTRL_MOORE_H
9 #define __PINCTRL_MOORE_H
10 
11 #include <linux/io.h>
12 #include <linux/init.h>
13 #include <linux/of.h>
14 #include <linux/of_platform.h>
15 #include <linux/platform_device.h>
16 #include <linux/pinctrl/pinctrl.h>
17 #include <linux/pinctrl/pinmux.h>
18 #include <linux/pinctrl/pinconf.h>
19 #include <linux/pinctrl/pinconf-generic.h>
20 
21 #include "../core.h"
22 #include "../pinconf.h"
23 #include "../pinmux.h"
24 #include "mtk-eint.h"
25 #include "pinctrl-mtk-common-v2.h"
26 
27 #define MTK_RANGE(_a)		{ .range = (_a), .nranges = ARRAY_SIZE(_a), }
28 
29 #define MTK_PIN(_number, _name, _eint_m, _eint_n, _drv_n) {	\
30 		.number = _number,			\
31 		.name = _name,				\
32 		.eint = {				\
33 			.eint_m = _eint_m,		\
34 			.eint_n = _eint_n,		\
35 		},					\
36 		.drv_n = _drv_n,			\
37 		.funcs = NULL,				\
38 	}
39 
40 #define PINCTRL_PIN_GROUP(_name_, id)							\
41 	{										\
42 		.grp = PINCTRL_PINGROUP(_name_, id##_pins, ARRAY_SIZE(id##_pins)),	\
43 		.data = id##_funcs,							\
44 	}
45 
46 #define PINCTRL_PIN_FUNCTION(_name_, id)							\
47 	{											\
48 		.func = PINCTRL_PINFUNCTION(_name_, id##_groups, ARRAY_SIZE(id##_groups)),	\
49 		.data = NULL,									\
50 	}
51 
52 int mtk_moore_pinctrl_probe(struct platform_device *pdev,
53 			    const struct mtk_pin_soc *soc);
54 
55 #endif /* __PINCTRL_MOORE_H */
56