1 /* 2 * Marvell Berlin SoC pinctrl driver. 3 * 4 * Copyright (C) 2014 Marvell Technology Group Ltd. 5 * 6 * Antoine Ténart <antoine.tenart@free-electrons.com> 7 * 8 * This file is licensed under the terms of the GNU General Public 9 * License version 2. This program is licensed "as is" without any 10 * warranty of any kind, whether express or implied. 11 */ 12 13 #ifndef __PINCTRL_BERLIN_H 14 #define __PINCTRL_BERLIN_H 15 16 struct berlin_desc_function { 17 const char *name; 18 u8 muxval; 19 }; 20 21 struct berlin_desc_group { 22 const char *name; 23 u8 offset; 24 u8 bit_width; 25 u8 lsb; 26 struct berlin_desc_function *functions; 27 }; 28 29 struct berlin_pinctrl_desc { 30 const struct berlin_desc_group *groups; 31 unsigned ngroups; 32 }; 33 34 struct berlin_pinctrl_function { 35 const char *name; 36 const char **groups; 37 unsigned ngroups; 38 }; 39 40 #define BERLIN_PINCTRL_GROUP(_name, _offset, _width, _lsb, ...) \ 41 { \ 42 .name = _name, \ 43 .offset = _offset, \ 44 .bit_width = _width, \ 45 .lsb = _lsb, \ 46 .functions = (struct berlin_desc_function[]){ \ 47 __VA_ARGS__, { } }, \ 48 } 49 50 #define BERLIN_PINCTRL_FUNCTION(_muxval, _name) \ 51 { \ 52 .name = _name, \ 53 .muxval = _muxval, \ 54 } 55 56 #define BERLIN_PINCTRL_FUNCTION_UNKNOWN {} 57 58 int berlin_pinctrl_probe(struct platform_device *pdev, 59 const struct berlin_pinctrl_desc *desc); 60 61 int berlin_pinctrl_probe_regmap(struct platform_device *pdev, 62 const struct berlin_pinctrl_desc *desc, 63 struct regmap *regmap); 64 65 #endif /* __PINCTRL_BERLIN_H */ 66