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