blob: c8d2b3af03639c796409fff56bcc25c2b183a6f6 [file] [log] [blame]
Jerome Brunet85878392018-10-05 09:36:37 +02001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Copyright (C) 2017 Jerome Brunet <jbrunet@baylibre.com>
4 * Copyright (C) 2017 Xingyu Chen <xingyu.chen@amlogic.com>
5 */
6
7#ifndef __PINCTRL_MESON_AXG_H__
8#define __PINCTRL_MESON_AXG_H__
9
10#include "pinctrl-meson.h"
11
12struct meson_pmx_bank {
13 const char *name;
14 unsigned int first;
15 unsigned int last;
16 unsigned int reg;
17 unsigned int offset;
18};
19
20struct meson_axg_pmx_data {
21 struct meson_pmx_bank *pmx_banks;
22 unsigned int num_pmx_banks;
23};
24
25#define BANK_PMX(n, f, l, r, o) \
26 { \
27 .name = n, \
28 .first = f, \
29 .last = l, \
30 .reg = r, \
31 .offset = o, \
32 }
33
34struct meson_pmx_axg_data {
35 unsigned int func;
36};
37
38#define PMX_DATA(f) \
39 { \
40 .func = f, \
41 }
42
43#define GROUP(grp, f) \
44 { \
45 .name = #grp, \
46 .pins = grp ## _pins, \
47 .num_pins = ARRAY_SIZE(grp ## _pins), \
48 .data = (const struct meson_pmx_axg_data[]){ \
49 PMX_DATA(f), \
50 }, \
51 }
52
53#define GPIO_GROUP(gpio, b) \
54 { \
55 .name = #gpio, \
56 .pins = (const unsigned int[]){ PIN(gpio, b) }, \
57 .num_pins = 1, \
58 .data = (const struct meson_pmx_axg_data[]){ \
59 PMX_DATA(0), \
60 }, \
61 }
62
63extern const struct pinctrl_ops meson_axg_pinctrl_ops;
64extern const struct driver meson_axg_gpio_driver;
65
66#endif /* __PINCTRL_MESON_AXG_H__ */