blob: c70c1f51c6de1115ab638ef5fb974592dca42045 [file] [log] [blame]
Jerome Brunet7c9dcfe2018-10-05 09:35:26 +02001/* 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
12struct 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
45extern const struct pinctrl_ops meson_gx_pinctrl_ops;
Simon Glass886d36e2021-11-13 07:07:15 -070046extern U_BOOT_DRIVER(meson_gx_gpio_driver);
Jerome Brunet7c9dcfe2018-10-05 09:35:26 +020047
48#endif /* __PINCTRL_MESON_GX_H__ */