Debian Codegraph @

drivers/pinctrl/intel/pinctrl-tangier.h

raw
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Intel Tangier pinctrl functions
4 *
5 * Copyright (C) 2016-2023 Intel Corporation
6 *
7 * Authors: Andy Shevchenko <[email protected]>
8 * Raag Jadav <[email protected]>
9 */
10
11 #ifndef PINCTRL_TANGIER_H
12 #define PINCTRL_TANGIER_H
13
14 #include <linux/spinlock_types.h>
15 #include <linux/types.h>
16
17 #include <linux/pinctrl/pinctrl.h>
18
19 #include "pinctrl-intel.h"
20
21 struct device;
22 struct platform_device;
23
24 #define TNG_FAMILY_NR 64
25 #define TNG_FAMILY_LEN 0x400
26
27 /**
28 * struct tng_family - Tangier pin family description
29 * @barno: MMIO BAR number where registers for this family reside
30 * @pin_base: Starting pin of pins in this family
31 * @npins: Number of pins in this family
32 * @protected: True if family is protected by access
33 * @regs: Family specific common registers
34 */
35 struct tng_family {
36 unsigned int barno;
37 unsigned int pin_base;
38 size_t npins;
39 bool protected;
40 void __iomem *regs;
41 };
42
43 #define TNG_FAMILY(b, s, e) \
44 { \
45 .barno = (b), \
46 .pin_base = (s), \
47 .npins = (e) - (s) + 1, \
48 }
49
50 #define TNG_FAMILY_PROTECTED(b, s, e) \
51 { \
52 .barno = (b), \
53 .pin_base = (s), \
54 .npins = (e) - (s) + 1, \
55 .protected = true, \
56 }
57
58 /**
59 * struct tng_pinctrl - Tangier pinctrl private structure
60 * @dev: Pointer to the device structure
61 * @lock: Lock to serialize register access
62 * @pctldesc: Pin controller description
63 * @pctldev: Pointer to the pin controller device
64 * @families: Array of families this pinctrl handles
65 * @nfamilies: Number of families in the array
66 * @functions: Array of functions
67 * @nfunctions: Number of functions in the array
68 * @groups: Array of pin groups
69 * @ngroups: Number of groups in the array
70 * @pins: Array of pins this pinctrl controls
71 * @npins: Number of pins in the array
72 */
73 struct tng_pinctrl {
74 struct device *dev;
75 raw_spinlock_t lock;
76 struct pinctrl_desc pctldesc;
77 struct pinctrl_dev *pctldev;
78
79 /* Pin controller configuration */
80 const struct tng_family *families;
81 size_t nfamilies;
82 const struct intel_function *functions;
83 size_t nfunctions;
84 const struct intel_pingroup *groups;
85 size_t ngroups;
86 const struct pinctrl_pin_desc *pins;
87 size_t npins;
88 };
89
90 int devm_tng_pinctrl_probe(struct platform_device *pdev);
91
92 #endif /* PINCTRL_TANGIER_H */