1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-20 00:29:43 +02:00

[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
This commit is contained in:
lars 2009-07-30 15:08:05 +00:00
parent 5c0a059eb9
commit d6694fb05e
10 changed files with 22 additions and 149 deletions

View File

@ -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);

View File

@ -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>

View File

@ -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,

View File

@ -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>

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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