1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2020 TOSHIBA CORPORATION
4 * Copyright (c) 2020 Toshiba Electronic Devices & Storage Corporation
5 * Copyright (c) 2020 Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
8 #ifndef __VISCONTI_PINCTRL_COMMON_H__
9 #define __VISCONTI_PINCTRL_COMMON_H__
11 struct pinctrl_pin_desc
;
14 #define VISCONTI_PINS(pins_name, ...) \
15 static const unsigned int pins_name ## _pins[] = { __VA_ARGS__ }
17 struct visconti_desc_pin
{
18 struct pinctrl_pin_desc pin
;
19 unsigned int dsel_offset
;
20 unsigned int dsel_shift
;
21 unsigned int pude_offset
;
22 unsigned int pudsel_offset
;
23 unsigned int pud_shift
;
26 #define VISCONTI_PIN(_pin, dsel, d_sh, pude, pudsel, p_sh) \
29 .dsel_offset = dsel, \
31 .pude_offset = pude, \
32 .pudsel_offset = pudsel, \
37 #define VISCONTI_GROUPS(groups_name, ...) \
38 static const char * const groups_name ## _grps[] = { __VA_ARGS__ }
46 struct visconti_pin_group
{
48 const unsigned int *pins
;
50 struct visconti_mux mux
;
53 #define VISCONTI_PIN_GROUP(group_name, off, msk, v) \
55 .name = __stringify(group_name) "_grp", \
56 .pins = group_name ## _pins, \
57 .nr_pins = ARRAY_SIZE(group_name ## _pins), \
66 struct visconti_pin_function
{
68 const char * const *groups
;
69 unsigned int nr_groups
;
72 #define VISCONTI_PIN_FUNCTION(func) \
75 .groups = func ## _grps, \
76 .nr_groups = ARRAY_SIZE(func ## _grps), \
79 /* chip dependent data */
80 struct visconti_pinctrl_devdata
{
81 const struct visconti_desc_pin
*pins
;
83 const struct visconti_pin_group
*groups
;
84 unsigned int nr_groups
;
85 const struct visconti_pin_function
*functions
;
86 unsigned int nr_functions
;
88 const struct visconti_mux
*gpio_mux
;
90 void (*unlock
)(void __iomem
*base
);
93 int visconti_pinctrl_probe(struct platform_device
*pdev
,
94 const struct visconti_pinctrl_devdata
*devdata
);
96 #endif /* __VISCONTI_PINCTRL_COMMON_H__ */