aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/bcm47xx/gpio.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-14 17:27:45 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-14 17:27:45 -0500
commitcebfa85eb86d92bf85d3b041c6b044184517a988 (patch)
treebe0a374556fe335ce96dfdb296c89537750d5868 /arch/mips/bcm47xx/gpio.c
parentd42b3a2906a10b732ea7d7f849d49be79d242ef0 (diff)
parent241738bd51cb0efe58e6c570223153e970afe3ae (diff)
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS updates from Ralf Baechle: "The MIPS bits for 3.8. This also includes a bunch fixes that were sitting in the linux-mips.org git tree for a long time. This pull request contains updates to several OCTEON drivers and the board support code for BCM47XX, BCM63XX, XLP, XLR, XLS, lantiq, Loongson1B, updates to the SSB bus support, MIPS kexec code and adds support for kdump. When pulling this, there are two expected merge conflicts in include/linux/bcma/bcma_driver_chipcommon.h which are trivial to resolve, just remove the conflict markers and keep both alternatives." * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (90 commits) MIPS: PMC-Sierra Yosemite: Remove support. VIDEO: Newport Fix console crashes MIPS: wrppmc: Fix build of PCI code. MIPS: IP22/IP28: Fix build of EISA code. MIPS: RB532: Fix build of prom code. MIPS: PowerTV: Fix build. MIPS: IP27: Correct fucked grammar in ops-bridge.c MIPS: Highmem: Fix build error if CONFIG_DEBUG_HIGHMEM is disabled MIPS: Fix potencial corruption MIPS: Fix for warning from FPU emulation code MIPS: Handle COP3 Unusable exception as COP1X for FP emulation MIPS: Fix poweroff failure when HOTPLUG_CPU configured. MIPS: MT: Fix build with CONFIG_UIDGID_STRICT_TYPE_CHECKS=y MIPS: Remove unused smvp.h MIPS/EDAC: Improve OCTEON EDAC support. MIPS: OCTEON: Add definitions for OCTEON memory contoller registers. MIPS: OCTEON: Add OCTEON family definitions to octeon-model.h ata: pata_octeon_cf: Use correct byte order for DMA in when built little-endian. MIPS/OCTEON/ata: Convert pata_octeon_cf.c to use device tree. MIPS: Remove usage of CEVT_R4K_LIB config option. ...
Diffstat (limited to 'arch/mips/bcm47xx/gpio.c')
-rw-r--r--arch/mips/bcm47xx/gpio.c102
1 files changed, 0 insertions, 102 deletions
diff --git a/arch/mips/bcm47xx/gpio.c b/arch/mips/bcm47xx/gpio.c
deleted file mode 100644
index 5ebdf62e96bb..000000000000
--- a/arch/mips/bcm47xx/gpio.c
+++ /dev/null
@@ -1,102 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2007 Aurelien Jarno <aurelien@aurel32.net>
7 */
8
9#include <linux/export.h>
10#include <linux/ssb/ssb.h>
11#include <linux/ssb/ssb_driver_chipcommon.h>
12#include <linux/ssb/ssb_driver_extif.h>
13#include <asm/mach-bcm47xx/bcm47xx.h>
14#include <asm/mach-bcm47xx/gpio.h>
15
16#if (BCM47XX_CHIPCO_GPIO_LINES > BCM47XX_EXTIF_GPIO_LINES)
17static DECLARE_BITMAP(gpio_in_use, BCM47XX_CHIPCO_GPIO_LINES);
18#else
19static DECLARE_BITMAP(gpio_in_use, BCM47XX_EXTIF_GPIO_LINES);
20#endif
21
22int gpio_request(unsigned gpio, const char *tag)
23{
24 switch (bcm47xx_bus_type) {
25#ifdef CONFIG_BCM47XX_SSB
26 case BCM47XX_BUS_TYPE_SSB:
27 if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco) &&
28 ((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES))
29 return -EINVAL;
30
31 if (ssb_extif_available(&bcm47xx_bus.ssb.extif) &&
32 ((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES))
33 return -EINVAL;
34
35 if (test_and_set_bit(gpio, gpio_in_use))
36 return -EBUSY;
37
38 return 0;
39#endif
40#ifdef CONFIG_BCM47XX_BCMA
41 case BCM47XX_BUS_TYPE_BCMA:
42 if (gpio >= BCM47XX_CHIPCO_GPIO_LINES)
43 return -EINVAL;
44
45 if (test_and_set_bit(gpio, gpio_in_use))
46 return -EBUSY;
47
48 return 0;
49#endif
50 }
51 return -EINVAL;
52}
53EXPORT_SYMBOL(gpio_request);
54
55void gpio_free(unsigned gpio)
56{
57 switch (bcm47xx_bus_type) {
58#ifdef CONFIG_BCM47XX_SSB
59 case BCM47XX_BUS_TYPE_SSB:
60 if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco) &&
61 ((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES))
62 return;
63
64 if (ssb_extif_available(&bcm47xx_bus.ssb.extif) &&
65 ((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES))
66 return;
67
68 clear_bit(gpio, gpio_in_use);
69 return;
70#endif
71#ifdef CONFIG_BCM47XX_BCMA
72 case BCM47XX_BUS_TYPE_BCMA:
73 if (gpio >= BCM47XX_CHIPCO_GPIO_LINES)
74 return;
75
76 clear_bit(gpio, gpio_in_use);
77 return;
78#endif
79 }
80}
81EXPORT_SYMBOL(gpio_free);
82
83int gpio_to_irq(unsigned gpio)
84{
85 switch (bcm47xx_bus_type) {
86#ifdef CONFIG_BCM47XX_SSB
87 case BCM47XX_BUS_TYPE_SSB:
88 if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco))
89 return ssb_mips_irq(bcm47xx_bus.ssb.chipco.dev) + 2;
90 else if (ssb_extif_available(&bcm47xx_bus.ssb.extif))
91 return ssb_mips_irq(bcm47xx_bus.ssb.extif.dev) + 2;
92 else
93 return -EINVAL;
94#endif
95#ifdef CONFIG_BCM47XX_BCMA
96 case BCM47XX_BUS_TYPE_BCMA:
97 return bcma_core_mips_irq(bcm47xx_bus.bcma.bus.drv_cc.core) + 2;
98#endif
99 }
100 return -EINVAL;
101}
102EXPORT_SYMBOL_GPL(gpio_to_irq);