Jerome Brunet | 7c9dcfe | 2018-10-05 09:35:26 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com> |
| 4 | * Copyright (C) 2017 Jerome Brunet <jbrunet@baylibre.com> |
| 5 | */ |
| 6 | |
| 7 | #ifndef __PINCTRL_MESON_GX_H__ |
| 8 | #define __PINCTRL_MESON_GX_H__ |
| 9 | |
| 10 | #include "pinctrl-meson.h" |
| 11 | |
| 12 | struct meson_gx_pmx_data { |
| 13 | bool is_gpio; |
| 14 | unsigned int reg; |
| 15 | unsigned int bit; |
| 16 | }; |
| 17 | |
| 18 | #define PMX_DATA(r, b, g) \ |
| 19 | { \ |
| 20 | .reg = r, \ |
| 21 | .bit = b, \ |
| 22 | .is_gpio = g, \ |
| 23 | } |
| 24 | |
| 25 | #define GROUP(grp, r, b) \ |
| 26 | { \ |
| 27 | .name = #grp, \ |
| 28 | .pins = grp ## _pins, \ |
| 29 | .num_pins = ARRAY_SIZE(grp ## _pins), \ |
| 30 | .data = (const struct meson_gx_pmx_data[]){ \ |
| 31 | PMX_DATA(r, b, false), \ |
| 32 | }, \ |
| 33 | } |
| 34 | |
| 35 | #define GPIO_GROUP(gpio, b) \ |
| 36 | { \ |
| 37 | .name = #gpio, \ |
| 38 | .pins = (const unsigned int[]){ PIN(gpio, b) }, \ |
| 39 | .num_pins = 1, \ |
| 40 | .data = (const struct meson_gx_pmx_data[]){ \ |
| 41 | PMX_DATA(0, 0, true), \ |
| 42 | }, \ |
| 43 | } |
| 44 | |
| 45 | extern const struct pinctrl_ops meson_gx_pinctrl_ops; |
| 46 | extern const struct driver meson_gx_gpio_driver; |
| 47 | |
| 48 | #endif /* __PINCTRL_MESON_GX_H__ */ |