1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2024 Yixun Lan <dlan@gentoo.org> */
4 #ifndef _PINCTRL_SPACEMIT_K1_H
5 #define _PINCTRL_SPACEMIT_K1_H
7 #include <linux/bits.h>
8 #include <linux/bitfield.h>
9 #include <linux/device.h>
10 #include <linux/mutex.h>
11 #include <linux/spinlock.h>
12 #include <linux/platform_device.h>
13 #include <linux/pinctrl/pinctrl.h>
14 #include <linux/pinctrl/pinconf.h>
16 enum spacemit_pin_io_type
{
23 #define PIN_POWER_STATE_1V8 1800
24 #define PIN_POWER_STATE_3V3 3300
26 #define K1_PIN_IO_TYPE GENMASK(2, 1)
28 #define K1_PIN_CAP_IO_TYPE(type) \
29 FIELD_PREP_CONST(K1_PIN_IO_TYPE, type)
30 #define K1_PIN_GET_IO_TYPE(val) \
31 FIELD_GET(K1_PIN_IO_TYPE, val)
33 #define K1_FUNC_PIN(_id, _gpiofunc, _io) \
36 .gpiofunc = (_gpiofunc), \
37 .flags = (K1_PIN_CAP_IO_TYPE(_io)), \
40 #endif /* _PINCTRL_SPACEMIT_K1_H */