Gregory CLEMENT | 2a62643 | 2018-12-08 09:59:01 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: (GPL-2.0 OR MIT) */ |
| 2 | /* |
| 3 | * Microsemi SoCs pinctrl driver |
| 4 | * |
| 5 | * Author: <alexandre.belloni@free-electrons.com> |
| 6 | * License: Dual MIT/GPL |
| 7 | * Copyright (c) 2017 Microsemi Corporation |
| 8 | */ |
| 9 | |
| 10 | #define MSCC_FUNC_PER_PIN 4 |
| 11 | |
| 12 | struct mscc_pin_caps { |
| 13 | unsigned int pin; |
| 14 | unsigned char functions[MSCC_FUNC_PER_PIN]; |
| 15 | }; |
| 16 | |
| 17 | struct mscc_pin_data { |
| 18 | const char *name; |
| 19 | struct mscc_pin_caps *drv_data; |
| 20 | }; |
| 21 | |
| 22 | #define MSCC_P(p, f0, f1, f2) \ |
| 23 | static struct mscc_pin_caps mscc_pin_##p = { \ |
| 24 | .pin = p, \ |
| 25 | .functions = { \ |
| 26 | FUNC_GPIO, FUNC_##f0, FUNC_##f1, FUNC_##f2, \ |
| 27 | }, \ |
| 28 | } |
| 29 | |
| 30 | struct mscc_pmx_func { |
| 31 | const char **groups; |
| 32 | unsigned int ngroups; |
| 33 | }; |
| 34 | |
| 35 | struct mscc_pinctrl { |
| 36 | struct udevice *dev; |
| 37 | struct pinctrl_dev *pctl; |
| 38 | void __iomem *regs; |
| 39 | struct mscc_pmx_func *func; |
| 40 | int num_func; |
| 41 | const struct mscc_pin_data *mscc_pins; |
| 42 | int num_pins; |
| 43 | char * const *function_names; |
| 44 | }; |
| 45 | |
| 46 | int mscc_pinctrl_probe(struct udevice *dev, int num_func, |
| 47 | const struct mscc_pin_data *mscc_pins, int num_pins, |
| 48 | char * const *function_names); |
| 49 | const struct pinctrl_ops mscc_pinctrl_ops; |
| 50 | |
| 51 | const struct dm_gpio_ops mscc_gpio_ops; |