1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2017 Sanechips Technology Co., Ltd.
4 * Copyright 2017 Linaro Ltd.
11 * struct zx_mux_desc - hardware mux descriptor
12 * @name: mux function name
13 * @muxval: mux register bit value
21 * struct zx_pin_data - hardware per-pin data
22 * @aon_pin: whether it's an AON pin
23 * @offset: register offset within TOP pinmux controller
24 * @bitpos: bit position within TOP pinmux register
25 * @width: bit width within TOP pinmux register
26 * @coffset: pinconf register offset within AON controller
27 * @cbitpos: pinconf bit position within AON register
28 * @muxes: available mux function names and corresponding register values
30 * Unlike TOP pinmux and AON pinconf registers which are arranged pretty
31 * arbitrarily, AON pinmux register bits are well organized per pin id, and
32 * each pin occupies two bits, so that we can calculate the AON register offset
33 * and bit position from pin id. Thus, we only need to define TOP pinmux and
34 * AON pinconf register data for the pin.
43 struct zx_mux_desc
*muxes
;
46 struct zx_pinctrl_soc_info
{
47 const struct pinctrl_pin_desc
*pins
;
51 #define TOP_PIN(pin, off, bp, wd, coff, cbp, ...) { \
54 .drv_data = &(struct zx_pin_data) { \
61 .muxes = (struct zx_mux_desc[]) { \
66 #define AON_PIN(pin, off, bp, wd, coff, cbp, ...) { \
69 .drv_data = &(struct zx_pin_data) { \
76 .muxes = (struct zx_mux_desc[]) { \
81 #define ZX_RESERVED(pin) PINCTRL_PIN(pin, #pin)
83 #define TOP_MUX(_val, _name) { \
89 * When the flag is set, it's a mux configuration for an AON pin that sits in
90 * AON register. Otherwise, it's one for AON pin but sitting in TOP register.
92 #define AON_MUX_FLAG BIT(7)
94 #define AON_MUX(_val, _name) { \
96 .muxval = _val | AON_MUX_FLAG, \
99 int zx_pinctrl_init(struct platform_device
*pdev
,
100 struct zx_pinctrl_soc_info
*info
);
102 #endif /* __PINCTRL_ZX_H */