Linus Walleij | e98ea77 | 2012-04-26 23:57:25 +0200 | [diff] [blame] | 1 | #ifndef PINCTRL_PINCTRL_NOMADIK_H |
| 2 | #define PINCTRL_PINCTRL_NOMADIK_H |
| 3 | |
| 4 | #include <plat/gpio-nomadik.h> |
| 5 | |
| 6 | /* Package definitions */ |
| 7 | #define PINCTRL_NMK_STN8815 0 |
| 8 | #define PINCTRL_NMK_DB8500 1 |
| 9 | |
| 10 | /** |
Linus Walleij | dbfe8ca | 2012-05-02 22:56:47 +0200 | [diff] [blame] | 11 | * struct nmk_function - Nomadik pinctrl mux function |
| 12 | * @name: The name of the function, exported to pinctrl core. |
| 13 | * @groups: An array of pin groups that may select this function. |
| 14 | * @ngroups: The number of entries in @groups. |
| 15 | */ |
| 16 | struct nmk_function { |
| 17 | const char *name; |
| 18 | const char * const *groups; |
| 19 | unsigned ngroups; |
| 20 | }; |
| 21 | |
| 22 | /** |
Linus Walleij | e98ea77 | 2012-04-26 23:57:25 +0200 | [diff] [blame] | 23 | * struct nmk_pingroup - describes a Nomadik pin group |
| 24 | * @name: the name of this specific pin group |
| 25 | * @pins: an array of discrete physical pins used in this group, taken |
| 26 | * from the driver-local pin enumeration space |
| 27 | * @num_pins: the number of pins in this group array, i.e. the number of |
| 28 | * elements in .pins so we can iterate over that array |
| 29 | * @altsetting: the altsetting to apply to all pins in this group to |
| 30 | * configure them to be used by a function |
| 31 | */ |
| 32 | struct nmk_pingroup { |
| 33 | const char *name; |
| 34 | const unsigned int *pins; |
| 35 | const unsigned npins; |
Linus Walleij | dbfe8ca | 2012-05-02 22:56:47 +0200 | [diff] [blame] | 36 | int altsetting; |
Linus Walleij | e98ea77 | 2012-04-26 23:57:25 +0200 | [diff] [blame] | 37 | }; |
| 38 | |
| 39 | /** |
| 40 | * struct nmk_pinctrl_soc_data - Nomadik pin controller per-SoC configuration |
| 41 | * @gpio_ranges: An array of GPIO ranges for this SoC |
| 42 | * @gpio_num_ranges: The number of GPIO ranges for this SoC |
| 43 | * @pins: An array describing all pins the pin controller affects. |
| 44 | * All pins which are also GPIOs must be listed first within the |
| 45 | * array, and be numbered identically to the GPIO controller's |
| 46 | * numbering. |
Linus Walleij | dbfe8ca | 2012-05-02 22:56:47 +0200 | [diff] [blame] | 47 | * @npins: The number of entries in @pins. |
| 48 | * @functions: The functions supported on this SoC. |
| 49 | * @nfunction: The number of entries in @functions. |
Linus Walleij | e98ea77 | 2012-04-26 23:57:25 +0200 | [diff] [blame] | 50 | * @groups: An array describing all pin groups the pin SoC supports. |
| 51 | * @ngroups: The number of entries in @groups. |
| 52 | */ |
| 53 | struct nmk_pinctrl_soc_data { |
| 54 | struct pinctrl_gpio_range *gpio_ranges; |
| 55 | unsigned gpio_num_ranges; |
| 56 | const struct pinctrl_pin_desc *pins; |
| 57 | unsigned npins; |
Linus Walleij | dbfe8ca | 2012-05-02 22:56:47 +0200 | [diff] [blame] | 58 | const struct nmk_function *functions; |
| 59 | unsigned nfunctions; |
Linus Walleij | e98ea77 | 2012-04-26 23:57:25 +0200 | [diff] [blame] | 60 | const struct nmk_pingroup *groups; |
| 61 | unsigned ngroups; |
| 62 | }; |
| 63 | |
| 64 | #ifdef CONFIG_PINCTRL_DB8500 |
| 65 | |
| 66 | void nmk_pinctrl_db8500_init(const struct nmk_pinctrl_soc_data **soc); |
| 67 | |
| 68 | #else |
| 69 | |
| 70 | static inline void |
| 71 | nmk_pinctrl_db8500_init(const struct nmk_pinctrl_soc_data **soc) |
| 72 | { |
| 73 | } |
| 74 | |
| 75 | #endif |
| 76 | |
| 77 | #endif /* PINCTRL_PINCTRL_NOMADIK_H */ |