summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/nxp/pinctrl-s32.h
blob: b6d530a6205147dbbc38cb7825f8a244772a4001 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* SPDX-License-Identifier: GPL-2.0-or-later
 *
 * S32 pinmux core definitions
 *
 * Copyright 2016-2020, 2022 NXP
 * Copyright (C) 2022 SUSE LLC
 * Copyright 2015-2016 Freescale Semiconductor, Inc.
 * Copyright (C) 2012 Linaro Ltd.
 */

#ifndef __DRIVERS_PINCTRL_S32_H
#define __DRIVERS_PINCTRL_S32_H

struct platform_device;

/**
 * struct s32_pin_group - describes an S32 pin group
 * @name: the name of this specific pin group
 * @npins: the number of pins in this group array, i.e. the number of
 *         elements in pin_ids and pin_sss so we can iterate over that array
 * @pin_ids: an array of pin IDs in this group
 * @pin_sss: an array of source signal select configs paired with pin_ids
 */
struct s32_pin_group {
	const char *name;
	unsigned int npins;
	unsigned int *pin_ids;
	unsigned int *pin_sss;
};

/**
 * struct s32_pmx_func - describes S32 pinmux functions
 * @name: the name of this specific function
 * @groups: corresponding pin groups
 * @num_groups: the number of groups
 */
struct s32_pmx_func {
	const char *name;
	const char **groups;
	unsigned int num_groups;
};

/**
 * struct s32_pin_range - pin ID range for each memory region.
 * @start: start pin ID
 * @end: end pin ID
 */
struct s32_pin_range {
	unsigned int start;
	unsigned int end;
};

struct s32_pinctrl_soc_info {
	struct device *dev;
	const struct pinctrl_pin_desc *pins;
	unsigned int npins;
	struct s32_pin_group *groups;
	unsigned int ngroups;
	struct s32_pmx_func *functions;
	unsigned int nfunctions;
	unsigned int grp_index;
	const struct s32_pin_range *mem_pin_ranges;
	unsigned int mem_regions;
};

#define S32_PINCTRL_PIN(pin)	PINCTRL_PIN(pin, #pin)
#define S32_PIN_RANGE(_start, _end) { .start = _start, .end = _end }

int s32_pinctrl_probe(struct platform_device *pdev,
			struct s32_pinctrl_soc_info *info);
#ifdef CONFIG_PM_SLEEP
int __maybe_unused s32_pinctrl_resume(struct device *dev);
int __maybe_unused s32_pinctrl_suspend(struct device *dev);
#endif
#endif /* __DRIVERS_PINCTRL_S32_H */