diff options
author | Paul Mundt <lethal@linux-sh.org> | 2012-06-20 04:29:04 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2012-06-20 04:29:04 -0400 |
commit | b3c185a7614cd95ea9b68d89a8d1ee4227ee9018 (patch) | |
tree | 312cbb6d297097b98cdd7b41b4378069938e5f66 /include/linux/sh_pfc.h | |
parent | 2fe8ac608bf1a9c947f03f5d8cbf25c91b4f1a7c (diff) |
sh: pfc: Split out gpio chip support.
This implements a bit of rework for the PFC code, making the core itself
slightly more pluggable and moving out the gpio chip handling completely.
The API is preserved in such a way that platforms that depend on it for
early configuration are still able to do so, while making it possible to
migrate to alternate interfaces going forward.
This is the first step of chainsawing necessary to support the pinctrl
API, with the eventual goal being able to decouple pin function state
from the gpio API while retaining gpio chip tie-in for gpio pin functions
only, relying on the pinctrl/pinmux API for non-gpio function demux.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'include/linux/sh_pfc.h')
-rw-r--r-- | include/linux/sh_pfc.h | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h index 5c15aed9c4b2..95dad340794a 100644 --- a/include/linux/sh_pfc.h +++ b/include/linux/sh_pfc.h | |||
@@ -89,7 +89,7 @@ struct pfc_window { | |||
89 | unsigned long size; | 89 | unsigned long size; |
90 | }; | 90 | }; |
91 | 91 | ||
92 | struct pinmux_info { | 92 | struct sh_pfc { |
93 | char *name; | 93 | char *name; |
94 | pinmux_enum_t reserved_id; | 94 | pinmux_enum_t reserved_id; |
95 | struct pinmux_range data; | 95 | struct pinmux_range data; |
@@ -112,17 +112,44 @@ struct pinmux_info { | |||
112 | struct pinmux_irq *gpio_irq; | 112 | struct pinmux_irq *gpio_irq; |
113 | unsigned int gpio_irq_size; | 113 | unsigned int gpio_irq_size; |
114 | 114 | ||
115 | spinlock_t lock; | ||
116 | |||
115 | struct resource *resource; | 117 | struct resource *resource; |
116 | unsigned int num_resources; | 118 | unsigned int num_resources; |
117 | struct pfc_window *window; | 119 | struct pfc_window *window; |
118 | 120 | ||
119 | unsigned long unlock_reg; | 121 | unsigned long unlock_reg; |
120 | |||
121 | struct gpio_chip chip; | ||
122 | }; | 122 | }; |
123 | 123 | ||
124 | int register_pinmux(struct pinmux_info *pip); | 124 | /* XXX compat for now */ |
125 | int unregister_pinmux(struct pinmux_info *pip); | 125 | #define pinmux_info sh_pfc |
126 | |||
127 | /* drivers/sh/pfc-gpio.c */ | ||
128 | int sh_pfc_register_gpiochip(struct sh_pfc *pfc); | ||
129 | |||
130 | /* drivers/sh/pfc.c */ | ||
131 | int register_sh_pfc(struct sh_pfc *pfc); | ||
132 | |||
133 | int sh_pfc_read_bit(struct pinmux_data_reg *dr, unsigned long in_pos); | ||
134 | void sh_pfc_write_bit(struct pinmux_data_reg *dr, unsigned long in_pos, | ||
135 | unsigned long value); | ||
136 | int sh_pfc_get_data_reg(struct sh_pfc *pfc, unsigned gpio, | ||
137 | struct pinmux_data_reg **drp, int *bitp); | ||
138 | int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos, | ||
139 | pinmux_enum_t *enum_idp); | ||
140 | int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type, | ||
141 | int cfg_mode); | ||
142 | int sh_pfc_set_direction(struct sh_pfc *pfc, unsigned gpio, | ||
143 | int new_pinmux_type); | ||
144 | |||
145 | /* xxx */ | ||
146 | static inline int register_pinmux(struct pinmux_info *pip) | ||
147 | { | ||
148 | struct sh_pfc *pfc = pip; | ||
149 | return register_sh_pfc(pfc); | ||
150 | } | ||
151 | |||
152 | enum { GPIO_CFG_DRYRUN, GPIO_CFG_REQ, GPIO_CFG_FREE }; | ||
126 | 153 | ||
127 | /* helper macro for port */ | 154 | /* helper macro for port */ |
128 | #define PORT_1(fn, pfx, sfx) fn(pfx, sfx) | 155 | #define PORT_1(fn, pfx, sfx) fn(pfx, sfx) |