aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2008-12-03 14:27:38 -0500
committerKumar Gala <galak@kernel.crashing.org>2008-12-30 12:13:43 -0500
commit1b9e89046c31fd39d08742915b6bd72f6c239608 (patch)
tree0fbb35ccfd0c0645db7b304277d48aa95b2375b5 /arch/powerpc/include/asm
parent78c7705037ed9f107660178e17aa73f8bc4127e8 (diff)
powerpc/qe: Implement QE Pin Multiplexing API
With this API we're able to set a QE pin to the GPIO mode or a dedicated peripheral function. The API relies on the fact that QE gpio controllers are registered. If they aren't, the API won't work (gracefully though). There is one caveat though: if anybody occupied the node->data before us, or overwrote it, then bad things will happen. Luckily this is all in the platform code that we fully control, so this should never happen. I could implement more checks (for example we could create a list of successfully registered QE controllers, and compare the node->data in the qe_pin_request()), but this is unneeded if nobody is going to do silly things behind our back. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/include/asm')
-rw-r--r--arch/powerpc/include/asm/qe.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/qe.h b/arch/powerpc/include/asm/qe.h
index edee15d269e..32274407b93 100644
--- a/arch/powerpc/include/asm/qe.h
+++ b/arch/powerpc/include/asm/qe.h
@@ -17,6 +17,8 @@
17#ifdef __KERNEL__ 17#ifdef __KERNEL__
18 18
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/errno.h>
21#include <linux/err.h>
20#include <asm/cpm.h> 22#include <asm/cpm.h>
21#include <asm/immap_qe.h> 23#include <asm/immap_qe.h>
22 24
@@ -112,6 +114,25 @@ extern int par_io_config_pin(u8 port, u8 pin, int dir, int open_drain,
112 int assignment, int has_irq); 114 int assignment, int has_irq);
113extern int par_io_data_set(u8 port, u8 pin, u8 val); 115extern int par_io_data_set(u8 port, u8 pin, u8 val);
114 116
117/*
118 * Pin multiplexing functions.
119 */
120struct qe_pin;
121#ifdef CONFIG_QE_GPIO
122extern struct qe_pin *qe_pin_request(struct device_node *np, int index);
123extern void qe_pin_free(struct qe_pin *qe_pin);
124extern void qe_pin_set_gpio(struct qe_pin *qe_pin);
125extern void qe_pin_set_dedicated(struct qe_pin *pin);
126#else
127static inline struct qe_pin *qe_pin_request(struct device_node *np, int index)
128{
129 return ERR_PTR(-ENOSYS);
130}
131static inline void qe_pin_free(struct qe_pin *qe_pin) {}
132static inline void qe_pin_set_gpio(struct qe_pin *qe_pin) {}
133static inline void qe_pin_set_dedicated(struct qe_pin *pin) {}
134#endif /* CONFIG_QE_GPIO */
135
115/* QE internal API */ 136/* QE internal API */
116int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input); 137int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input);
117enum qe_clock qe_clock_source(const char *source); 138enum qe_clock qe_clock_source(const char *source);