2 * Copyright (C) Maxime Coquelin 2015
4 * License terms: GNU General Public License (GPL), version 2
6 #ifndef __PINCTRL_STM32_H
7 #define __PINCTRL_STM32_H
9 #include <linux/pinctrl/pinctrl.h>
10 #include <linux/pinctrl/pinconf-generic.h>
12 #define STM32_PIN_NO(x) ((x) << 8)
13 #define STM32_GET_PIN_NO(x) ((x) >> 8)
14 #define STM32_GET_PIN_FUNC(x) ((x) & 0xff)
16 #define STM32_PIN_GPIO 0
17 #define STM32_PIN_AF(x) ((x) + 1)
18 #define STM32_PIN_ANALOG (STM32_PIN_AF(15) + 1)
20 struct stm32_desc_function {
22 const unsigned char num;
25 struct stm32_desc_pin {
26 struct pinctrl_pin_desc pin;
27 const struct stm32_desc_function *functions;
30 #define STM32_PIN(_pin, ...) \
33 .functions = (struct stm32_desc_function[]){ \
37 #define STM32_FUNCTION(_num, _name) \
43 struct stm32_pinctrl_match_data {
44 const struct stm32_desc_pin *pins;
45 const unsigned int npins;
48 int stm32_pctl_probe(struct platform_device *pdev);
50 #endif /* __PINCTRL_STM32_H */