aboutsummaryrefslogtreecommitdiffstats
path: root/arch/openrisc/include/asm/gpio.h
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-15 05:52:54 -0400
committerGrant Likely <grant.likely@secretlab.ca>2012-05-11 20:00:14 -0400
commit7563bbf89d065a2c3f05059ecbcc805645edcc62 (patch)
tree2b8231e8145a73cce0da67ce38e0360fcd0a802e /arch/openrisc/include/asm/gpio.h
parent25cf25073a4e1e0563c288908481f10f98acb19a (diff)
gpiolib/arches: Centralise bolierplate asm/gpio.h
Rather than requiring architectures that use gpiolib but don't have any need to define anything custom to copy an asm/gpio.h provide a Kconfig symbol which architectures must select in order to include gpio.h and for other architectures just provide the trivial implementation directly. This makes it much easier to do gpiolib updates and is also a step towards making gpiolib APIs available on every architecture. For architectures with existing boilerplate code leave a stub header in place which warns on direct inclusion of asm/gpio.h and includes linux/gpio.h to catch code that's doing this. Direct inclusion of asm/gpio.h has long been deprecated. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Jonas Bonn <jonas@southpole.se> Acked-by: Tony Luck <tony.luck@intel.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'arch/openrisc/include/asm/gpio.h')
-rw-r--r--arch/openrisc/include/asm/gpio.h69
1 files changed, 4 insertions, 65 deletions
diff --git a/arch/openrisc/include/asm/gpio.h b/arch/openrisc/include/asm/gpio.h
index 0b0d174f47cd..b3799d88ffcf 100644
--- a/arch/openrisc/include/asm/gpio.h
+++ b/arch/openrisc/include/asm/gpio.h
@@ -1,65 +1,4 @@
1/* 1#ifndef __LINUX_GPIO_H
2 * OpenRISC Linux 2#warning Include linux/gpio.h instead of asm/gpio.h
3 * 3#include <linux/gpio.h>
4 * Linux architectural port borrowing liberally from similar works of 4#endif
5 * others. All original copyrights apply as per the original source
6 * declaration.
7 *
8 * OpenRISC implementation:
9 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
10 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
11 * et al.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 */
18
19#ifndef __ASM_OPENRISC_GPIO_H
20#define __ASM_OPENRISC_GPIO_H
21
22#include <linux/errno.h>
23#include <asm-generic/gpio.h>
24
25#ifdef CONFIG_GPIOLIB
26
27/*
28 * OpenRISC (or1k) does not have on-chip GPIO's so there is not really
29 * any standardized implementation that makes sense here. If passing
30 * through gpiolib becomes a bottleneck then it may make sense, on a
31 * case-by-case basis, to implement these inlined/rapid versions.
32 *
33 * Just call gpiolib.
34 */
35static inline int gpio_get_value(unsigned int gpio)
36{
37 return __gpio_get_value(gpio);
38}
39
40static inline void gpio_set_value(unsigned int gpio, int value)
41{
42 __gpio_set_value(gpio, value);
43}
44
45static inline int gpio_cansleep(unsigned int gpio)
46{
47 return __gpio_cansleep(gpio);
48}
49
50/*
51 * Not implemented, yet.
52 */
53static inline int gpio_to_irq(unsigned int gpio)
54{
55 return -ENOSYS;
56}
57
58static inline int irq_to_gpio(unsigned int irq)
59{
60 return -EINVAL;
61}
62
63#endif /* CONFIG_GPIOLIB */
64
65#endif /* __ASM_OPENRISC_GPIO_H */