1*3c910ecbSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 2ce385aa2SJerome Brunet /* 3ce385aa2SJerome Brunet * First generation of pinmux driver for Amlogic Meson SoCs 4ce385aa2SJerome Brunet * 5ce385aa2SJerome Brunet * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com> 6ce385aa2SJerome Brunet * Copyright (C) 2017 Jerome Brunet <jbrunet@baylibre.com> 7ce385aa2SJerome Brunet */ 8ce385aa2SJerome Brunet 9ce385aa2SJerome Brunet struct meson8_pmx_data { 10ce385aa2SJerome Brunet bool is_gpio; 11ce385aa2SJerome Brunet unsigned int reg; 12ce385aa2SJerome Brunet unsigned int bit; 13ce385aa2SJerome Brunet }; 14ce385aa2SJerome Brunet 15ce385aa2SJerome Brunet #define PMX_DATA(r, b, g) \ 16ce385aa2SJerome Brunet { \ 17ce385aa2SJerome Brunet .reg = r, \ 18ce385aa2SJerome Brunet .bit = b, \ 19ce385aa2SJerome Brunet .is_gpio = g, \ 20ce385aa2SJerome Brunet } 21ce385aa2SJerome Brunet 22ce385aa2SJerome Brunet #define GROUP(grp, r, b) \ 23ce385aa2SJerome Brunet { \ 24ce385aa2SJerome Brunet .name = #grp, \ 25ce385aa2SJerome Brunet .pins = grp ## _pins, \ 26ce385aa2SJerome Brunet .num_pins = ARRAY_SIZE(grp ## _pins), \ 27ce385aa2SJerome Brunet .data = (const struct meson8_pmx_data[]){ \ 28ce385aa2SJerome Brunet PMX_DATA(r, b, false), \ 29ce385aa2SJerome Brunet }, \ 30ce385aa2SJerome Brunet } 31ce385aa2SJerome Brunet 32ce385aa2SJerome Brunet #define GPIO_GROUP(gpio) \ 33ce385aa2SJerome Brunet { \ 34ce385aa2SJerome Brunet .name = #gpio, \ 35ce385aa2SJerome Brunet .pins = (const unsigned int[]){ gpio }, \ 36ce385aa2SJerome Brunet .num_pins = 1, \ 37ce385aa2SJerome Brunet .data = (const struct meson8_pmx_data[]){ \ 38ce385aa2SJerome Brunet PMX_DATA(0, 0, true), \ 39ce385aa2SJerome Brunet }, \ 40ce385aa2SJerome Brunet } 41ce385aa2SJerome Brunet 42ce385aa2SJerome Brunet extern const struct pinmux_ops meson8_pmx_ops; 43