| 1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
| 2 |
/* |
| 3 |
* Copyright (C) 2024 Inochi Amaoto <[email protected]> |
| 4 |
*/ |
| 5 |
|
| 6 |
#ifndef _PINCTRL_SOPHGO_SG2042_H |
| 7 |
#define _PINCTRL_SOPHGO_SG2042_H |
| 8 |
|
| 9 |
#include <linux/pinctrl/pinctrl.h> |
| 10 |
#include <linux/pinctrl/pinconf.h> |
| 11 |
|
| 12 |
#include "pinctrl-sophgo.h" |
| 13 |
|
| 14 |
#define PIN_FLAG_DEFAULT 0 |
| 15 |
#define PIN_FLAG_WRITE_HIGH BIT(0) |
| 16 |
#define PIN_FLAG_ONLY_ONE_PULL BIT(1) |
| 17 |
#define PIN_FLAG_NO_PINMUX BIT(2) |
| 18 |
#define PIN_FLAG_NO_OEX_EN BIT(3) |
| 19 |
#define PIN_FLAG_IS_ETH BIT(4) |
| 20 |
|
| 21 |
struct sg2042_pin { |
| 22 |
struct sophgo_pin pin; |
| 23 |
u16 offset; |
| 24 |
}; |
| 25 |
|
| 26 |
#define sophgo_to_sg2042_pin(_pin) \ |
| 27 |
container_of((_pin), struct sg2042_pin, pin) |
| 28 |
|
| 29 |
extern const struct pinctrl_ops sg2042_pctrl_ops; |
| 30 |
extern const struct pinmux_ops sg2042_pmx_ops; |
| 31 |
extern const struct pinconf_ops sg2042_pconf_ops; |
| 32 |
extern const struct sophgo_cfg_ops sg2042_cfg_ops; |
| 33 |
|
| 34 |
#define SG2042_GENERAL_PIN(_id, _offset, _flag) \ |
| 35 |
{ \ |
| 36 |
.pin = { \ |
| 37 |
.id = (_id), \ |
| 38 |
.flags = (_flag), \ |
| 39 |
}, \ |
| 40 |
.offset = (_offset), \ |
| 41 |
} |
| 42 |
|
| 43 |
#endif |