From d6694fb05efb76fcc931bd1588facd28073fcaf0 Mon Sep 17 00:00:00 2001
From: lars <lars@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Date: Thu, 30 Jul 2009 15:08:05 +0000
Subject: [s3c24xx] Get rid of gpio shadowing.

I fail really to see why this would be necessary here. So get rid of it and see if
anything breaks...


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@17052 3c298f89-4303-0410-b956-a3cf2f4a3e73
---
 .../arch/arm/mach-s3c2442/gta02-pm-bt.c            |  9 +--
 .../arch/arm/mach-s3c2442/gta02-pm-gps.c           |  2 -
 .../arch/arm/mach-s3c2442/gta02-pm-gsm.c           |  5 +-
 .../arch/arm/mach-s3c2442/gta02-pm-wlan.c          |  1 -
 .../arch/arm/mach-s3c2442/gta02-shadow.c           | 86 ----------------------
 .../arch/arm/mach-s3c2442/mach-gta02.c             | 20 ++---
 .../drivers/leds/leds-gta02-vibrator.c             |  6 +-
 .../s3c24xx/files-2.6.30/drivers/leds/leds-gta02.c |  4 +-
 .../files-2.6.30/include/linux/gta02-shadow.h      | 33 ---------
 .../s3c24xx/patches-2.6.30/014-neo1973_mach.patch  |  5 +-
 10 files changed, 22 insertions(+), 149 deletions(-)
 delete mode 100644 target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/gta02-shadow.c
 delete mode 100644 target/linux/s3c24xx/files-2.6.30/include/linux/gta02-shadow.h

(limited to 'target/linux')

diff --git a/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/gta02-pm-bt.c b/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/gta02-pm-bt.c
index 02cdd221d..95c1e59e2 100644
--- a/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/gta02-pm-bt.c
+++ b/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/gta02-pm-bt.c
@@ -20,7 +20,6 @@
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
-#include <linux/gta02-shadow.h>
 
 #include <mach/gta02.h>
 #include <linux/mfd/pcf50633/gpio.h>
@@ -62,7 +61,7 @@ static void __gta02_pm_bt_toggle_radio(struct device *dev, unsigned int on)
 
 	bt_data = dev_get_drvdata(dev);
 
-	gta02_gpb_setpin(GTA02_GPIO_BT_EN, !on);
+    s3c2410_gpio_setpin(GTA02_GPIO_BT_EN, !on);
 
 	if (on) {
 		if (!regulator_is_enabled(bt_data->regulator))
@@ -72,7 +71,7 @@ static void __gta02_pm_bt_toggle_radio(struct device *dev, unsigned int on)
 			regulator_disable(bt_data->regulator);
 	}
 
-	gta02_gpb_setpin(GTA02_GPIO_BT_EN, on);
+	s3c2410_gpio_setpin(GTA02_GPIO_BT_EN, on);
 }
 
 
@@ -100,7 +99,7 @@ static ssize_t bt_write(struct device *dev, struct device_attribute *attr,
 		__gta02_pm_bt_toggle_radio(dev, on);
 	} else if (!strcmp(attr->attr.name, "reset")) {
 		/* reset is low-active, so we need to invert */
-		gta02_gpb_setpin(GTA02_GPIO_BT_EN, on ? 0 : 1);
+		s3c2410_gpio_setpin(GTA02_GPIO_BT_EN, on ? 0 : 1);
 	}
 
 	return count;
@@ -177,7 +176,7 @@ static int __init gta02_bt_probe(struct platform_device *pdev)
 
 	/* we pull reset to low to make sure that the chip doesn't
 	 * drain power through the reset line */
-	gta02_gpb_setpin(GTA02_GPIO_BT_EN, 0);
+	s3c2410_gpio_setpin(GTA02_GPIO_BT_EN, 0);
 
 	rfkill = rfkill_allocate(&pdev->dev, RFKILL_TYPE_BLUETOOTH);
 
diff --git a/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/gta02-pm-gps.c b/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/gta02-pm-gps.c
index 9325123c0..ef598c71f 100644
--- a/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/gta02-pm-gps.c
+++ b/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/gta02-pm-gps.c
@@ -22,8 +22,6 @@
 
 #include <asm/mach-types.h>
 
-#include <linux/gta02-shadow.h>
-
 #include <mach/gta02.h>
 #include <linux/mfd/pcf50633/core.h>
 #include <linux/mfd/pcf50633/pmic.h>
diff --git a/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/gta02-pm-gsm.c b/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/gta02-pm-gsm.c
index afb4182bf..687b260e1 100644
--- a/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/gta02-pm-gsm.c
+++ b/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/gta02-pm-gsm.c
@@ -30,7 +30,6 @@
 #include <linux/mfd/pcf50633/gpio.h>
 #include <mach/regs-gpio.h>
 #include <mach/regs-gpioj.h>
-#include <linux/gta02-shadow.h>
 
 int gta_gsm_interrupts;
 EXPORT_SYMBOL(gta_gsm_interrupts);
@@ -114,9 +113,9 @@ static void gsm_on_off(struct device *dev, int on)
 
 	msleep(100);
 
-	gta02_gpb_setpin(GTA02_GPIO_MODEM_ON, 1);
+	s3c2410_gpio_setpin(GTA02_GPIO_MODEM_ON, 1);
 	msleep(500);
-	gta02_gpb_setpin(GTA02_GPIO_MODEM_ON, 0);
+	s3c2410_gpio_setpin(GTA02_GPIO_MODEM_ON, 0);
 
 	/*
 	 * workaround for calypso firmware moko10 and earlier,
diff --git a/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/gta02-pm-wlan.c b/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/gta02-pm-wlan.c
index 5f2b159ed..9cb8e6a5e 100644
--- a/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/gta02-pm-wlan.c
+++ b/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/gta02-pm-wlan.c
@@ -19,7 +19,6 @@
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
-#include <linux/gta02-shadow.h>
 
 #include <mach/gta02.h>
 #include <mach/gta02-pm-wlan.h>
diff --git a/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/gta02-shadow.c b/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/gta02-shadow.c
deleted file mode 100644
index c65304ae1..000000000
--- a/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/gta02-shadow.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Common utility code for GTA02
- *
- * Copyright (C) 2008 by Openmoko, Inc.
- * Author: Holger Hans Peter Freyther <freyther@openmoko.org>
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- */
-
-#include <linux/module.h>
-#include <linux/io.h>
-#include <linux/irq.h>
-
-#include <asm/gpio.h>
-#include <mach/regs-gpio.h>
-#include <linux/gta02-shadow.h>
-
-/**
- * Shadow GPIO bank B handling. For the LEDs we need to keep track of the state
- * in software. The s3c2410_gpio_setpin must not be used for GPIOs on bank B
- */
-static unsigned long gpb_mask;
-static unsigned long gpb_state;
-
-void gta02_gpb_add_shadow_gpio(unsigned int gpio)
-{
-	unsigned long offset = S3C2410_GPIO_OFFSET(gpio);
-	unsigned long flags;
-
-	local_irq_save(flags);
-	gpb_mask |= 1L << offset;
-	local_irq_restore(flags);
-}
-EXPORT_SYMBOL(gta02_gpb_add_shadow_gpio);
-
-static void set_shadow_gpio(unsigned long offset, unsigned int value)
-{
-	unsigned long state = value != 0;
-
-	gpb_state &= ~(1L << offset);
-	gpb_state |= state << offset;
-}
-
-void gta02_gpb_setpin(unsigned int pin, unsigned to)
-{
-	void __iomem *base = S3C24XX_GPIO_BASE(S3C2410_GPB0);
-	unsigned long offset = S3C2410_GPIO_OFFSET(pin);
-	unsigned long flags;
-	unsigned long dat;
-
-	BUG_ON(base != S3C24XX_GPIO_BASE(pin));
-
-	local_irq_save(flags);
-	dat = __raw_readl(base + 0x04);
-
-	/* Add the shadow values */
-	dat &= ~gpb_mask;
-	dat |= gpb_state;
-
-	/* Do the operation like s3c2410_gpio_setpin */
-	dat &= ~(1L << offset);
-	dat |= to << offset;
-
-	/* Update the shadow state */
-	if ((1L << offset) & gpb_mask)
-		set_shadow_gpio(offset, to);
-
-	__raw_writel(dat, base + 0x04);
-	local_irq_restore(flags);
-}
-EXPORT_SYMBOL(gta02_gpb_setpin);
diff --git a/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/mach-gta02.c b/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/mach-gta02.c
index 30405ad80..88377dac2 100644
--- a/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/mach-gta02.c
+++ b/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/mach-gta02.c
@@ -112,7 +112,6 @@
 #include <asm/fiq.h>
 
 #include <linux/gta02-vibrator.h>
-#include <linux/gta02-shadow.h>
 
 /* arbitrates which sensor IRQ owns the shared SPI bus */
 static spinlock_t motion_irq_lock;
@@ -275,7 +274,7 @@ static long gta02_panic_blink(long count)
 
 	led ^= 1;
 	s3c2410_gpio_cfgpin(GTA02_GPIO_AUX_LED, S3C2410_GPIO_OUTPUT);
-	gta02_gpb_setpin(GTA02_GPIO_AUX_LED, led);
+	s3c2410_gpio_setpin(GTA02_GPIO_AUX_LED, led);
 
 	last_blink = count;
 	return delay;
@@ -938,11 +937,11 @@ static void gta02_udc_command(enum s3c2410_udc_cmd_e cmd)
 	switch (cmd) {
 	case S3C2410_UDC_P_ENABLE:
 		printk(KERN_DEBUG "%s S3C2410_UDC_P_ENABLE\n", __func__);
-	    gta02_gpb_setpin(GTA02_GPIO_USB_PULLUP, 1);
+	    s3c2410_gpio_setpin(GTA02_GPIO_USB_PULLUP, 1);
 		break;
 	case S3C2410_UDC_P_DISABLE:
 		printk(KERN_DEBUG "%s S3C2410_UDC_P_DISABLE\n", __func__);
-		gta02_gpb_setpin(GTA02_GPIO_USB_PULLUP, 0);
+		s3c2410_gpio_setpin(GTA02_GPIO_USB_PULLUP, 0);
 		break;
 	case S3C2410_UDC_P_RESET:
 		printk(KERN_DEBUG "%s S3C2410_UDC_P_RESET\n", __func__);
@@ -1570,11 +1569,12 @@ static struct platform_device *gta02_devices_pmu_children[] = {
 	&gta02_resume_reason_device,
 };
 
-static void gta02_register_glamo() {
+static void gta02_register_glamo(void)
+{
 	platform_device_register(&gta02_glamo_dev);
-    if (!gpio_request(GTA02_GPIO_GLAMO(4), "jbt6k74 reset"))
+    if (gpio_request(GTA02_GPIO_GLAMO(4), "jbt6k74 reset"))
         printk("gta02: Failed to request jbt6k74 reset pin\n");
-    if (!gpio_direction_output(GTA02_GPIO_GLAMO(4), 1))
+    if (gpio_direction_output(GTA02_GPIO_GLAMO(4), 1))
         printk("gta02: Failed to configure jbt6k74 reset pin\n");
 	platform_device_register(&spigpio_device);
 }
@@ -1725,13 +1725,13 @@ void DEBUG_LED(int n)
 {
 	switch (n) {
 	case 0:
-		gta02_gpb_setpin(GTA02_GPIO_PWR_LED1, 1);
+		s3c2410_gpio_setpin(GTA02_GPIO_PWR_LED1, 1);
 		break;
 	case 1:
-		gta02_gpb_setpin(GTA02_GPIO_PWR_LED2, 1);
+		s3c2410_gpio_setpin(GTA02_GPIO_PWR_LED2, 1);
 		break;
 	default:
-		gta02_gpb_setpin(GTA02_GPIO_AUX_LED, 1);
+		s3c2410_gpio_setpin(GTA02_GPIO_AUX_LED, 1);
 		break;
 	}
 }
diff --git a/target/linux/s3c24xx/files-2.6.30/drivers/leds/leds-gta02-vibrator.c b/target/linux/s3c24xx/files-2.6.30/drivers/leds/leds-gta02-vibrator.c
index 653a9fb28..e560ab76c 100644
--- a/target/linux/s3c24xx/files-2.6.30/drivers/leds/leds-gta02-vibrator.c
+++ b/target/linux/s3c24xx/files-2.6.30/drivers/leds/leds-gta02-vibrator.c
@@ -52,14 +52,14 @@ int gta02_vibrator_fiq_handler(void)
 		return 0;
 
 	if ((u8)gta02_vib_priv.fiq_count == gta02_vib_priv.vib_pwm_latched)
-		gta02_gpb_setpin(gta02_vib_priv.vib_gpio_pin, 0);
+		s3c2410_gpio_setpin(gta02_vib_priv.vib_gpio_pin, 0);
 
 	if ((u8)gta02_vib_priv.fiq_count)
 		return 1;
 
 	gta02_vib_priv.vib_pwm_latched = gta02_vib_priv.vib_pwm;
 	if (gta02_vib_priv.vib_pwm_latched)
-		gta02_gpb_setpin(gta02_vib_priv.vib_gpio_pin, 1);
+		s3c2410_gpio_setpin(gta02_vib_priv.vib_gpio_pin, 1);
 
 	return 1;
 }
@@ -139,7 +139,7 @@ static int __init gta02_vib_probe(struct platform_device *pdev)
 	gta02_vib_priv.pdata = pdev->dev.platform_data;
 	platform_set_drvdata(pdev, &gta02_vib_led);
 
-    gta02_gpb_setpin(gta02_vib_led.gpio, 0); /* off */
+    s3c2410_gpio_setpin(gta02_vib_led.gpio, 0); /* off */
     s3c2410_gpio_cfgpin(gta02_vib_led.gpio, S3C2410_GPIO_OUTPUT);
     /* safe, kmalloc'd copy needed for FIQ ISR */
     gta02_vib_priv.vib_gpio_pin = gta02_vib_led.gpio;
diff --git a/target/linux/s3c24xx/files-2.6.30/drivers/leds/leds-gta02.c b/target/linux/s3c24xx/files-2.6.30/drivers/leds/leds-gta02.c
index 1d65eeaf3..48559b113 100644
--- a/target/linux/s3c24xx/files-2.6.30/drivers/leds/leds-gta02.c
+++ b/target/linux/s3c24xx/files-2.6.30/drivers/leds/leds-gta02.c
@@ -19,7 +19,6 @@
 #include <asm/mach-types.h>
 #include <mach/gta02.h>
 #include <plat/regs-timer.h>
-#include <linux/gta02-shadow.h>
 
 #define MAX_LEDS 3
 #define COUNTER 256
@@ -54,7 +53,7 @@ static void gta02led_set(struct led_classdev *led_cdev,
 	struct gta02_led_priv *lp = to_priv(led_cdev);
 
 	spin_lock_irqsave(&lp->lock, flags);
-	gta02_gpb_setpin(lp->gpio, value ? 1 : 0);
+	s3c2410_gpio_setpin(lp->gpio, value ? 1 : 0);
 	spin_unlock_irqrestore(&lp->lock, flags);
 }
 
@@ -117,7 +116,6 @@ static int __init gta02led_probe(struct platform_device *pdev)
 		case S3C2410_GPB1:
 		case S3C2410_GPB2:
 			s3c2410_gpio_cfgpin(lp->gpio, S3C2410_GPIO_OUTPUT);
-			gta02_gpb_add_shadow_gpio(lp->gpio);
 			break;
 		default:
 			break;
diff --git a/target/linux/s3c24xx/files-2.6.30/include/linux/gta02-shadow.h b/target/linux/s3c24xx/files-2.6.30/include/linux/gta02-shadow.h
deleted file mode 100644
index 8d723a2f0..000000000
--- a/target/linux/s3c24xx/files-2.6.30/include/linux/gta02-shadow.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * include/linux/gta02-shadow.h
- *
- * Common utility code for GTA02
- *
- * Copyright (C) 2008 by Openmoko, Inc.
- * Author: Holger Hans Peter Freyther <freyther@openmoko.org>
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- */
-
-#ifndef GTA02_SHADOW_H
-#define GTA02_SHADOW_H
-
-void gta02_gpb_add_shadow_gpio(unsigned int gpio);
-void gta02_gpb_setpin(unsigned int pin, unsigned to);
-
-#endif
diff --git a/target/linux/s3c24xx/patches-2.6.30/014-neo1973_mach.patch b/target/linux/s3c24xx/patches-2.6.30/014-neo1973_mach.patch
index 5513f980c..926af21b8 100644
--- a/target/linux/s3c24xx/patches-2.6.30/014-neo1973_mach.patch
+++ b/target/linux/s3c24xx/patches-2.6.30/014-neo1973_mach.patch
@@ -23,7 +23,7 @@
  endif
 --- a/arch/arm/mach-s3c2442/Makefile
 +++ b/arch/arm/mach-s3c2442/Makefile
-@@ -14,3 +14,9 @@ obj-$(CONFIG_CPU_S3C2442)	+= clock.o
+@@ -14,3 +14,8 @@ obj-$(CONFIG_CPU_S3C2442)	+= clock.o
  
  # Machine support
  
@@ -31,8 +31,7 @@
 +                                   gta02-pm-gsm.o \
 +                                   gta02-pm-gps.o \
 +                                   gta02-pm-bt.o  \
-+                                   gta02-pm-wlan.o  \
-+                                   gta02-shadow.o
++                                   gta02-pm-wlan.o
 --- a/drivers/misc/Makefile
 +++ b/drivers/misc/Makefile
 @@ -21,3 +21,6 @@ obj-$(CONFIG_HP_ILO)		+= hpilo.o
-- 
cgit v1.2.3