.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Pin controller and GPIO driver for Amlogic Meson SoCs |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com> |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or |
---|
7 | | - * modify it under the terms of the GNU General Public License |
---|
8 | | - * version 2 as published by the Free Software Foundation. |
---|
9 | | - * |
---|
10 | | - * You should have received a copy of the GNU General Public License |
---|
11 | | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
12 | 6 | */ |
---|
13 | 7 | |
---|
14 | | -#include <linux/gpio.h> |
---|
| 8 | +#include <linux/gpio/driver.h> |
---|
15 | 9 | #include <linux/pinctrl/pinctrl.h> |
---|
16 | 10 | #include <linux/platform_device.h> |
---|
17 | 11 | #include <linux/regmap.h> |
---|
18 | 12 | #include <linux/types.h> |
---|
| 13 | +#include <linux/module.h> |
---|
| 14 | + |
---|
| 15 | +struct meson_pinctrl; |
---|
19 | 16 | |
---|
20 | 17 | /** |
---|
21 | 18 | * struct meson_pmx_group - a pinmux group |
---|
.. | .. |
---|
71 | 68 | REG_DIR, |
---|
72 | 69 | REG_OUT, |
---|
73 | 70 | REG_IN, |
---|
| 71 | + REG_DS, |
---|
74 | 72 | NUM_REG, |
---|
| 73 | +}; |
---|
| 74 | + |
---|
| 75 | +/** |
---|
| 76 | + * enum meson_pinconf_drv - value of drive-strength supported |
---|
| 77 | + */ |
---|
| 78 | +enum meson_pinconf_drv { |
---|
| 79 | + MESON_PINCONF_DRV_500UA, |
---|
| 80 | + MESON_PINCONF_DRV_2500UA, |
---|
| 81 | + MESON_PINCONF_DRV_3000UA, |
---|
| 82 | + MESON_PINCONF_DRV_4000UA, |
---|
75 | 83 | }; |
---|
76 | 84 | |
---|
77 | 85 | /** |
---|
.. | .. |
---|
109 | 117 | unsigned int num_banks; |
---|
110 | 118 | const struct pinmux_ops *pmx_ops; |
---|
111 | 119 | void *pmx_data; |
---|
| 120 | + int (*parse_dt)(struct meson_pinctrl *pc); |
---|
112 | 121 | }; |
---|
113 | 122 | |
---|
114 | 123 | struct meson_pinctrl { |
---|
.. | .. |
---|
120 | 129 | struct regmap *reg_pullen; |
---|
121 | 130 | struct regmap *reg_pull; |
---|
122 | 131 | struct regmap *reg_gpio; |
---|
| 132 | + struct regmap *reg_ds; |
---|
123 | 133 | struct gpio_chip chip; |
---|
124 | 134 | struct device_node *of_node; |
---|
125 | 135 | }; |
---|
.. | .. |
---|
131 | 141 | .num_groups = ARRAY_SIZE(fn ## _groups), \ |
---|
132 | 142 | } |
---|
133 | 143 | |
---|
134 | | -#define BANK(n, f, l, fi, li, per, peb, pr, pb, dr, db, or, ob, ir, ib) \ |
---|
| 144 | +#define BANK_DS(n, f, l, fi, li, per, peb, pr, pb, dr, db, or, ob, ir, ib, \ |
---|
| 145 | + dsr, dsb) \ |
---|
135 | 146 | { \ |
---|
136 | 147 | .name = n, \ |
---|
137 | 148 | .first = f, \ |
---|
.. | .. |
---|
144 | 155 | [REG_DIR] = { dr, db }, \ |
---|
145 | 156 | [REG_OUT] = { or, ob }, \ |
---|
146 | 157 | [REG_IN] = { ir, ib }, \ |
---|
| 158 | + [REG_DS] = { dsr, dsb }, \ |
---|
147 | 159 | }, \ |
---|
148 | 160 | } |
---|
| 161 | + |
---|
| 162 | +#define BANK(n, f, l, fi, li, per, peb, pr, pb, dr, db, or, ob, ir, ib) \ |
---|
| 163 | + BANK_DS(n, f, l, fi, li, per, peb, pr, pb, dr, db, or, ob, ir, ib, 0, 0) |
---|
149 | 164 | |
---|
150 | 165 | #define MESON_PIN(x) PINCTRL_PIN(x, #x) |
---|
151 | 166 | |
---|
.. | .. |
---|
160 | 175 | |
---|
161 | 176 | /* Common probe function */ |
---|
162 | 177 | int meson_pinctrl_probe(struct platform_device *pdev); |
---|
| 178 | +/* Common ao groups extra dt parse function for SoCs before g12a */ |
---|
| 179 | +int meson8_aobus_parse_dt_extra(struct meson_pinctrl *pc); |
---|
| 180 | +/* Common extra dt parse function for SoCs like A1 */ |
---|
| 181 | +int meson_a1_parse_dt_extra(struct meson_pinctrl *pc); |
---|