From: Lars-Peter Clausen Date: Thu, 30 Jul 2009 15:08:05 +0000 (+0000) Subject: Get rid of gpio shadowing. X-Git-Tag: reboot~22815 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=bf028c1dedb024858533821798eacee1ce655428;p=openwrt%2Fopenwrt.git 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... SVN-Revision: 17052 --- 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 02cdd221d6..95c1e59e2f 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 #include -#include #include #include @@ -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 9325123c0e..ef598c71f8 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 -#include - #include #include #include 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 afb4182bf3..687b260e10 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 #include #include -#include 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 5f2b159eda..9cb8e6a5e8 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 #include -#include #include #include 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 c65304ae19..0000000000 --- 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 - * 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 -#include -#include - -#include -#include -#include - -/** - * 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 30405ad80c..88377dac28 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 #include -#include /* 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[] = { >a02_resume_reason_device, }; -static void gta02_register_glamo() { +static void gta02_register_glamo(void) +{ platform_device_register(>a02_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 653a9fb287..e560ab76c3 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, >a02_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 1d65eeaf30..48559b1136 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 #include #include -#include #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 8d723a2f0e..0000000000 --- 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 - * 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 5513f980cd..926af21b83 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