xref: /openbmc/linux/drivers/pinctrl/nxp/pinctrl-s32.h (revision f7fc5768e57cc18c24783c524f4e80e680dc4fc4)
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  *
3  * S32 pinmux core definitions
4  *
5  * Copyright 2016-2020, 2022 NXP
6  * Copyright (C) 2022 SUSE LLC
7  * Copyright 2015-2016 Freescale Semiconductor, Inc.
8  * Copyright (C) 2012 Linaro Ltd.
9  */
10 
11 #ifndef __DRIVERS_PINCTRL_S32_H
12 #define __DRIVERS_PINCTRL_S32_H
13 
14 struct platform_device;
15 
16 /**
17  * struct s32_pin_group - describes an S32 pin group
18  * @name: the name of this specific pin group
19  * @npins: the number of pins in this group array, i.e. the number of
20  *         elements in pin_ids and pin_sss so we can iterate over that array
21  * @pin_ids: an array of pin IDs in this group
22  * @pin_sss: an array of source signal select configs paired with pin_ids
23  */
24 struct s32_pin_group {
25 	const char *name;
26 	unsigned int npins;
27 	unsigned int *pin_ids;
28 	unsigned int *pin_sss;
29 };
30 
31 /**
32  * struct s32_pmx_func - describes S32 pinmux functions
33  * @name: the name of this specific function
34  * @groups: corresponding pin groups
35  * @num_groups: the number of groups
36  */
37 struct s32_pmx_func {
38 	const char *name;
39 	const char **groups;
40 	unsigned int num_groups;
41 };
42 
43 /**
44  * struct s32_pin_range - pin ID range for each memory region.
45  * @start: start pin ID
46  * @end: end pin ID
47  */
48 struct s32_pin_range {
49 	unsigned int start;
50 	unsigned int end;
51 };
52 
53 struct s32_pinctrl_soc_info {
54 	struct device *dev;
55 	const struct pinctrl_pin_desc *pins;
56 	unsigned int npins;
57 	struct s32_pin_group *groups;
58 	unsigned int ngroups;
59 	struct s32_pmx_func *functions;
60 	unsigned int nfunctions;
61 	unsigned int grp_index;
62 	const struct s32_pin_range *mem_pin_ranges;
63 	unsigned int mem_regions;
64 };
65 
66 #define S32_PINCTRL_PIN(pin)	PINCTRL_PIN(pin, #pin)
67 #define S32_PIN_RANGE(_start, _end) { .start = _start, .end = _end }
68 
69 int s32_pinctrl_probe(struct platform_device *pdev,
70 			struct s32_pinctrl_soc_info *info);
71 int s32_pinctrl_resume(struct device *dev);
72 int s32_pinctrl_suspend(struct device *dev);
73 #endif /* __DRIVERS_PINCTRL_S32_H */
74