Jisheng Zhang | c6114f2 | 2018-05-16 15:33:37 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Antoine Tenart | 3de68d3 | 2014-05-19 19:36:29 +0200 | [diff] [blame] | 2 | /* |
| 3 | * Marvell Berlin SoC pinctrl driver. |
| 4 | * |
| 5 | * Copyright (C) 2014 Marvell Technology Group Ltd. |
| 6 | * |
Antoine Ténart | 1d48fb6e | 2015-10-13 23:31:41 +0200 | [diff] [blame] | 7 | * Antoine Ténart <antoine.tenart@free-electrons.com> |
Antoine Tenart | 3de68d3 | 2014-05-19 19:36:29 +0200 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #ifndef __PINCTRL_BERLIN_H |
| 11 | #define __PINCTRL_BERLIN_H |
| 12 | |
| 13 | struct berlin_desc_function { |
| 14 | const char *name; |
| 15 | u8 muxval; |
| 16 | }; |
| 17 | |
| 18 | struct berlin_desc_group { |
| 19 | const char *name; |
| 20 | u8 offset; |
| 21 | u8 bit_width; |
| 22 | u8 lsb; |
| 23 | struct berlin_desc_function *functions; |
| 24 | }; |
| 25 | |
| 26 | struct berlin_pinctrl_desc { |
| 27 | const struct berlin_desc_group *groups; |
| 28 | unsigned ngroups; |
| 29 | }; |
| 30 | |
| 31 | struct berlin_pinctrl_function { |
| 32 | const char *name; |
| 33 | const char **groups; |
| 34 | unsigned ngroups; |
| 35 | }; |
| 36 | |
| 37 | #define BERLIN_PINCTRL_GROUP(_name, _offset, _width, _lsb, ...) \ |
| 38 | { \ |
| 39 | .name = _name, \ |
| 40 | .offset = _offset, \ |
| 41 | .bit_width = _width, \ |
| 42 | .lsb = _lsb, \ |
| 43 | .functions = (struct berlin_desc_function[]){ \ |
| 44 | __VA_ARGS__, { } }, \ |
| 45 | } |
| 46 | |
| 47 | #define BERLIN_PINCTRL_FUNCTION(_muxval, _name) \ |
| 48 | { \ |
| 49 | .name = _name, \ |
| 50 | .muxval = _muxval, \ |
| 51 | } |
| 52 | |
| 53 | #define BERLIN_PINCTRL_FUNCTION_UNKNOWN {} |
| 54 | |
| 55 | int berlin_pinctrl_probe(struct platform_device *pdev, |
| 56 | const struct berlin_pinctrl_desc *desc); |
| 57 | |
Jisheng Zhang | d5c79fc | 2015-10-16 15:37:06 +0800 | [diff] [blame] | 58 | int berlin_pinctrl_probe_regmap(struct platform_device *pdev, |
| 59 | const struct berlin_pinctrl_desc *desc, |
| 60 | struct regmap *regmap); |
| 61 | |
Antoine Tenart | 3de68d3 | 2014-05-19 19:36:29 +0200 | [diff] [blame] | 62 | #endif /* __PINCTRL_BERLIN_H */ |