Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2da4c74d authored by Hauke Mehrtens's avatar Hauke Mehrtens Committed by John Crispin
Browse files

MIPS: BCM47XX: remove GPIO driver



Instated of providing an own GPIO driver use the one provided by ssb and
bcma.

Signed-off-by: default avatarHauke Mehrtens <hauke@hauke-m.de>
Patchwork: http://patchwork.linux-mips.org/patch/4592


Acked-by: default avatarFlorian Fainelli <florian@openwrt.org>
parent ec43b08b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@ config ATH79

config BCM47XX
	bool "Broadcom BCM47XX based boards"
	select ARCH_WANT_OPTIONAL_GPIOLIB
	select CEVT_R4K
	select CSRC_R4K
	select DMA_NONCOHERENT
@@ -112,7 +113,6 @@ config BCM47XX
	select IRQ_CPU
	select SYS_SUPPORTS_32BIT_KERNEL
	select SYS_SUPPORTS_LITTLE_ENDIAN
	select GENERIC_GPIO
	select SYS_HAS_EARLY_PRINTK
	select CFE
	help
+2 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ config BCM47XX_SSB
	select SSB_EMBEDDED
	select SSB_B43_PCI_BRIDGE if PCI
	select SSB_PCICORE_HOSTMODE if PCI
	select SSB_DRIVER_GPIO
	default y
	help
	 Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support.
@@ -23,6 +24,7 @@ config BCM47XX_BCMA
	select BCMA_DRIVER_MIPS
	select BCMA_HOST_PCI if PCI
	select BCMA_DRIVER_PCI_HOSTMODE if PCI
	select BCMA_DRIVER_GPIO
	default y
	help
	 Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus.
+1 −1
Original line number Diff line number Diff line
@@ -3,5 +3,5 @@
# under Linux.
#

obj-y 				+= gpio.o irq.o nvram.o prom.o serial.o setup.o time.o sprom.o
obj-y 				+= irq.o nvram.o prom.o serial.o setup.o time.o sprom.o
obj-$(CONFIG_BCM47XX_SSB)	+= wgt634u.o

arch/mips/bcm47xx/gpio.c

deleted100644 → 0
+0 −102
Original line number Diff line number Diff line
/*
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * Copyright (C) 2007 Aurelien Jarno <aurelien@aurel32.net>
 */

#include <linux/export.h>
#include <linux/ssb/ssb.h>
#include <linux/ssb/ssb_driver_chipcommon.h>
#include <linux/ssb/ssb_driver_extif.h>
#include <asm/mach-bcm47xx/bcm47xx.h>
#include <asm/mach-bcm47xx/gpio.h>

#if (BCM47XX_CHIPCO_GPIO_LINES > BCM47XX_EXTIF_GPIO_LINES)
static DECLARE_BITMAP(gpio_in_use, BCM47XX_CHIPCO_GPIO_LINES);
#else
static DECLARE_BITMAP(gpio_in_use, BCM47XX_EXTIF_GPIO_LINES);
#endif

int gpio_request(unsigned gpio, const char *tag)
{
	switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
	case BCM47XX_BUS_TYPE_SSB:
		if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco) &&
		    ((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES))
			return -EINVAL;

		if (ssb_extif_available(&bcm47xx_bus.ssb.extif) &&
		    ((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES))
			return -EINVAL;

		if (test_and_set_bit(gpio, gpio_in_use))
			return -EBUSY;

		return 0;
#endif
#ifdef CONFIG_BCM47XX_BCMA
	case BCM47XX_BUS_TYPE_BCMA:
		if (gpio >= BCM47XX_CHIPCO_GPIO_LINES)
			return -EINVAL;

		if (test_and_set_bit(gpio, gpio_in_use))
			return -EBUSY;

		return 0;
#endif
	}
	return -EINVAL;
}
EXPORT_SYMBOL(gpio_request);

void gpio_free(unsigned gpio)
{
	switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
	case BCM47XX_BUS_TYPE_SSB:
		if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco) &&
		    ((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES))
			return;

		if (ssb_extif_available(&bcm47xx_bus.ssb.extif) &&
		    ((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES))
			return;

		clear_bit(gpio, gpio_in_use);
		return;
#endif
#ifdef CONFIG_BCM47XX_BCMA
	case BCM47XX_BUS_TYPE_BCMA:
		if (gpio >= BCM47XX_CHIPCO_GPIO_LINES)
			return;

		clear_bit(gpio, gpio_in_use);
		return;
#endif
	}
}
EXPORT_SYMBOL(gpio_free);

int gpio_to_irq(unsigned gpio)
{
	switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
	case BCM47XX_BUS_TYPE_SSB:
		if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco))
			return ssb_mips_irq(bcm47xx_bus.ssb.chipco.dev) + 2;
		else if (ssb_extif_available(&bcm47xx_bus.ssb.extif))
			return ssb_mips_irq(bcm47xx_bus.ssb.extif.dev) + 2;
		else
			return -EINVAL;
#endif
#ifdef CONFIG_BCM47XX_BCMA
	case BCM47XX_BUS_TYPE_BCMA:
		return bcma_core_mips_irq(bcm47xx_bus.bcma.bus.drv_cc.core) + 2;
#endif
	}
	return -EINVAL;
}
EXPORT_SYMBOL_GPL(gpio_to_irq);
+6 −2
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
#include <linux/leds.h>
#include <linux/mtd/physmap.h>
#include <linux/ssb/ssb.h>
#include <linux/ssb/ssb_embedded.h>
#include <linux/interrupt.h>
#include <linux/reboot.h>
#include <linux/gpio.h>
@@ -116,7 +117,8 @@ static irqreturn_t gpio_interrupt(int irq, void *ignored)

	/* Interrupt are level triggered, revert the interrupt polarity
	   to clear the interrupt. */
	gpio_polarity(WGT634U_GPIO_RESET, state);
	ssb_gpio_polarity(&bcm47xx_bus.ssb, 1 << WGT634U_GPIO_RESET,
			  state ? 1 << WGT634U_GPIO_RESET : 0);

	if (!state) {
		printk(KERN_INFO "Reset button pressed");
@@ -150,7 +152,9 @@ static int __init wgt634u_init(void)
				 gpio_interrupt, IRQF_SHARED,
				 "WGT634U GPIO", &bcm47xx_bus.ssb.chipco)) {
			gpio_direction_input(WGT634U_GPIO_RESET);
			gpio_intmask(WGT634U_GPIO_RESET, 1);
			ssb_gpio_intmask(&bcm47xx_bus.ssb,
					 1 << WGT634U_GPIO_RESET,
					 1 << WGT634U_GPIO_RESET);
			ssb_chipco_irq_mask(&bcm47xx_bus.ssb.chipco,
					    SSB_CHIPCO_IRQ_GPIO,
					    SSB_CHIPCO_IRQ_GPIO);
Loading