| xj | b04a402 | 2021-11-25 15:01:52 +0800 | [diff] [blame] | 1 | /* |
| 2 | * First generation of pinmux driver for Amlogic Meson SoCs |
| 3 | * |
| 4 | * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com> |
| 5 | * Copyright (C) 2017 Jerome Brunet <jbrunet@baylibre.com> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License |
| 9 | * version 2 as published by the Free Software Foundation. |
| 10 | * |
| 11 | * You should have received a copy of the GNU General Public License |
| 12 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 13 | */ |
| 14 | |
| 15 | struct meson8_pmx_data { |
| 16 | bool is_gpio; |
| 17 | unsigned int reg; |
| 18 | unsigned int bit; |
| 19 | }; |
| 20 | |
| 21 | #define PMX_DATA(r, b, g) \ |
| 22 | { \ |
| 23 | .reg = r, \ |
| 24 | .bit = b, \ |
| 25 | .is_gpio = g, \ |
| 26 | } |
| 27 | |
| 28 | #define GROUP(grp, r, b) \ |
| 29 | { \ |
| 30 | .name = #grp, \ |
| 31 | .pins = grp ## _pins, \ |
| 32 | .num_pins = ARRAY_SIZE(grp ## _pins), \ |
| 33 | .data = (const struct meson8_pmx_data[]){ \ |
| 34 | PMX_DATA(r, b, false), \ |
| 35 | }, \ |
| 36 | } |
| 37 | |
| 38 | #define GPIO_GROUP(gpio) \ |
| 39 | { \ |
| 40 | .name = #gpio, \ |
| 41 | .pins = (const unsigned int[]){ gpio }, \ |
| 42 | .num_pins = 1, \ |
| 43 | .data = (const struct meson8_pmx_data[]){ \ |
| 44 | PMX_DATA(0, 0, true), \ |
| 45 | }, \ |
| 46 | } |
| 47 | |
| 48 | extern const struct pinmux_ops meson8_pmx_ops; |