Commit 70ac5516 authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/home/rmk/linux-2.6-arm

parents 7f729ccf bd5d080a
......@@ -702,6 +702,8 @@ menu "Device Drivers"
source "drivers/base/Kconfig"
source "drivers/connector/Kconfig"
if ALIGNMENT_TRAP
source "drivers/mtd/Kconfig"
endif
......
......@@ -623,8 +623,6 @@ static int locomo_resume(struct platform_device *dev)
locomo_writel(0x1, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KCMD);
spin_unlock_irqrestore(&lchip->lock, flags);
dev->power.saved_state = NULL;
kfree(save);
return 0;
......@@ -775,7 +773,7 @@ static int locomo_probe(struct platform_device *dev)
static int locomo_remove(struct platform_device *dev)
{
struct locomo *lchip = platform__get_drvdata(dev);
struct locomo *lchip = platform_get_drvdata(dev);
if (lchip) {
__locomo_remove(lchip);
......
......@@ -153,7 +153,7 @@ int __init scoop_probe(struct platform_device *pdev)
printk("Sharp Scoop Device found at 0x%08x -> 0x%08x\n",(unsigned int)mem->start,(unsigned int)devptr->base);
SCOOP_REG(devptr->base, SCOOP_MCR) = 0x0140;
reset_scoop(dev);
reset_scoop(&pdev->dev);
SCOOP_REG(devptr->base, SCOOP_GPCR) = inf->io_dir & 0xffff;
SCOOP_REG(devptr->base, SCOOP_GPWR) = inf->io_out & 0xffff;
......
......@@ -256,9 +256,7 @@ void __cpuexit cpu_die(void)
asmlinkage void __cpuinit secondary_start_kernel(void)
{
struct mm_struct *mm = &init_mm;
unsigned int cpu;
cpu = smp_processor_id();
unsigned int cpu = smp_processor_id();
printk("CPU%u: Booted secondary processor\n", cpu);
......
......@@ -132,14 +132,14 @@ void __init footbridge_init_irq(void)
static struct map_desc fb_common_io_desc[] __initdata = {
{
.virtual = ARMCSR_BASE,
.pfn = DC21285_ARMCSR_BASE,
.pfn = __phys_to_pfn(DC21285_ARMCSR_BASE),
.length = ARMCSR_SIZE,
.type = MT_DEVICE
.type = MT_DEVICE,
}, {
.virtual = XBUS_BASE,
.pfn = __phys_to_pfn(0x40000000),
.length = XBUS_SIZE,
.type = MT_DEVICE
.type = MT_DEVICE,
}
};
......@@ -153,28 +153,28 @@ static struct map_desc ebsa285_host_io_desc[] __initdata = {
.virtual = PCIMEM_BASE,
.pfn = __phys_to_pfn(DC21285_PCI_MEM),
.length = PCIMEM_SIZE,
.type = MT_DEVICE
.type = MT_DEVICE,
}, {
.virtual = PCICFG0_BASE,
.pfn = __phys_to_pfn(DC21285_PCI_TYPE_0_CONFIG),
.length = PCICFG0_SIZE,
.type = MT_DEVICE
.type = MT_DEVICE,
}, {
.virtual = PCICFG1_BASE,
.pfn = __phys_to_pfn(DC21285_PCI_TYPE_1_CONFIG),
.length = PCICFG1_SIZE,
.type = MT_DEVICE
.type = MT_DEVICE,
}, {
.virtual = PCIIACK_BASE,
.pfn = __phys_to_pfn(DC21285_PCI_IACK),
.length = PCIIACK_SIZE,
.type = MT_DEVICE
.type = MT_DEVICE,
}, {
.virtual = PCIO_BASE,
.pfn = __phys_to_pfn(DC21285_PCI_IO),
.length = PCIO_SIZE,
.type = MT_DEVICE
}
.type = MT_DEVICE,
},
#endif
};
......@@ -187,13 +187,13 @@ static struct map_desc co285_io_desc[] __initdata = {
.virtual = PCIO_BASE,
.pfn = __phys_to_pfn(DC21285_PCI_IO),
.length = PCIO_SIZE,
.type = MT_DEVICE
.type = MT_DEVICE,
}, {
.virtual = PCIMEM_BASE,
.pfn = __phys_to_pfn(DC21285_PCI_MEM),
.length = PCIMEM_SIZE,
.type = MT_DEVICE
}
.type = MT_DEVICE,
},
#endif
};
......
......@@ -72,6 +72,12 @@ config MACH_HUSKY
depends PXA_SHARPSL_25x
select PXA_SHARP_C7xx
config MACH_AKITA
bool "Enable Sharp SL-1000 (Akita) Support"
depends PXA_SHARPSL_27x
select PXA_SHARP_Cxx00
select MACH_SPITZ
config MACH_SPITZ
bool "Enable Sharp Zaurus SL-3000 (Spitz) Support"
depends PXA_SHARPSL_27x
......
......@@ -11,8 +11,9 @@ obj-$(CONFIG_PXA27x) += pxa27x.o
obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o
obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o
obj-$(CONFIG_ARCH_PXA_IDP) += idp.o
obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o corgi_ssp.o corgi_lcd.o
obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o corgi_ssp.o corgi_lcd.o
obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o corgi_pm.o
obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o spitz_pm.o
obj-$(CONFIG_MACH_AKITA) += akita-ioexp.o
obj-$(CONFIG_MACH_POODLE) += poodle.o
obj-$(CONFIG_MACH_TOSA) += tosa.o
......
/*
* Support for the Extra GPIOs on the Sharp SL-C1000 (Akita)
* (uses a Maxim MAX7310 8 Port IO Expander)
*
* Copyright 2005 Openedhand Ltd.
*
* Author: Richard Purdie <richard@openedhand.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <asm/arch/akita.h>
/* MAX7310 Regiser Map */
#define MAX7310_INPUT 0x00
#define MAX7310_OUTPUT 0x01
#define MAX7310_POLINV 0x02
#define MAX7310_IODIR 0x03 /* 1 = Input, 0 = Output */
#define MAX7310_TIMEOUT 0x04
/* Addresses to scan */
static unsigned short normal_i2c[] = { 0x18, I2C_CLIENT_END };
/* I2C Magic */
I2C_CLIENT_INSMOD;
static int max7310_write(struct i2c_client *client, int address, int data);
static struct i2c_client max7310_template;
static void akita_ioexp_work(void *private_);
static struct device *akita_ioexp_device;
static unsigned char ioexp_output_value = AKITA_IOEXP_IO_OUT;
DECLARE_WORK(akita_ioexp, akita_ioexp_work, NULL);
/*
* MAX7310 Access
*/
static int max7310_config(struct device *dev, int iomode, int polarity)
{
int ret;
struct i2c_client *client = to_i2c_client(dev);
ret = max7310_write(client, MAX7310_POLINV, polarity);
if (ret < 0)
return ret;
ret = max7310_write(client, MAX7310_IODIR, iomode);
return ret;
}
static int max7310_set_ouputs(struct device *dev, int outputs)
{
struct i2c_client *client = to_i2c_client(dev);
return max7310_write(client, MAX7310_OUTPUT, outputs);
}
/*
* I2C Functions
*/
static int max7310_write(struct i2c_client *client, int address, int value)
{
u8 data[2];
data[0] = address & 0xff;
data[1] = value & 0xff;
if (i2c_master_send(client, data, 2) == 2)
return 0;
return -1;
}
static int max7310_detect(struct i2c_adapter *adapter, int address, int kind)
{
struct i2c_client *new_client;
int err;
if (!(new_client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL)))
return -ENOMEM;
max7310_template.adapter = adapter;
max7310_template.addr = address;
memcpy(new_client, &max7310_template, sizeof(struct i2c_client));
if ((err = i2c_attach_client(new_client))) {
kfree(new_client);
return err;
}
max7310_config(&new_client->dev, AKITA_IOEXP_IO_DIR, 0);
akita_ioexp_device = &new_client->dev;
schedule_work(&akita_ioexp);
return 0;
}
static int max7310_attach_adapter(struct i2c_adapter *adapter)
{
return i2c_probe(adapter, &addr_data, max7310_detect);
}
static int max7310_detach_client(struct i2c_client *client)
{
int err;
akita_ioexp_device = NULL;
if ((err = i2c_detach_client(client)))
return err;
kfree(client);
return 0;
}
static struct i2c_driver max7310_i2c_driver = {
.owner = THIS_MODULE,
.name = "akita-max7310",
.id = I2C_DRIVERID_AKITAIOEXP,
.flags = I2C_DF_NOTIFY,
.attach_adapter = max7310_attach_adapter,
.detach_client = max7310_detach_client,
};
static struct i2c_client max7310_template = {
name: "akita-max7310",
flags: I2C_CLIENT_ALLOW_USE,
driver: &max7310_i2c_driver,
};
void akita_set_ioexp(struct device *dev, unsigned char bit)
{
ioexp_output_value |= bit;
if (akita_ioexp_device)
schedule_work(&akita_ioexp);
return;
}
void akita_reset_ioexp(struct device *dev, unsigned char bit)
{
ioexp_output_value &= ~bit;
if (akita_ioexp_device)
schedule_work(&akita_ioexp);
return;
}
EXPORT_SYMBOL(akita_set_ioexp);
EXPORT_SYMBOL(akita_reset_ioexp);
static void akita_ioexp_work(void *private_)
{
if (akita_ioexp_device)
max7310_set_ouputs(akita_ioexp_device, ioexp_output_value);
}
#ifdef CONFIG_PM
static int akita_ioexp_suspend(struct platform_device *pdev, pm_message_t state)
{
flush_scheduled_work();
return 0;
}
static int akita_ioexp_resume(struct platform_device *pdev)
{
schedule_work(&akita_ioexp);
return 0;
}
#else
#define akita_ioexp_suspend NULL
#define akita_ioexp_resume NULL
#endif
static int __init akita_ioexp_probe(struct platform_device *pdev)
{
return i2c_add_driver(&max7310_i2c_driver);
}
static int akita_ioexp_remove(struct platform_device *pdev)
{
i2c_del_driver(&max7310_i2c_driver);
return 0;
}
static struct platform_driver akita_ioexp_driver = {
.probe = akita_ioexp_probe,
.remove = akita_ioexp_remove,
.suspend = akita_ioexp_suspend,
.resume = akita_ioexp_resume,
.driver = {
.name = "akita-ioexp",
},
};
static int __init akita_ioexp_init(void)
{
return platform_driver_register(&akita_ioexp_driver);
}
static void __exit akita_ioexp_exit(void)
{
platform_driver_unregister(&akita_ioexp_driver);
}
MODULE_AUTHOR("Richard Purdie <rpurdie@openedhand.com>");
MODULE_DESCRIPTION("Akita IO-Expander driver");
MODULE_LICENSE("GPL");
fs_initcall(akita_ioexp_init);
module_exit(akita_ioexp_exit);
/*
* Battery and Power Management code for the Sharp SL-C7xx
*
* Copyright (c) 2005 Richard Purdie
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#include <linux/module.h>
#include <linux/stat.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <asm/apm.h>
#include <asm/irq.h>
#include <asm/mach-types.h>
#include <asm/hardware.h>
#include <asm/hardware/scoop.h>
#include <asm/arch/sharpsl.h>
#include <asm/arch/corgi.h>
#include <asm/arch/pxa-regs.h>
#include "sharpsl.h"
static void corgi_charger_init(void)
{
pxa_gpio_mode(CORGI_GPIO_ADC_TEMP_ON | GPIO_OUT);
pxa_gpio_mode(CORGI_GPIO_CHRG_ON | GPIO_OUT);
pxa_gpio_mode(CORGI_GPIO_CHRG_UKN | GPIO_OUT);
pxa_gpio_mode(CORGI_GPIO_KEY_INT | GPIO_IN);
}
static void corgi_charge_led(int val)
{
if (val == SHARPSL_LED_ERROR) {
dev_dbg(sharpsl_pm.dev, "Charge LED Error\n");
} else if (val == SHARPSL_LED_ON) {
dev_dbg(sharpsl_pm.dev, "Charge LED On\n");
GPSR0 = GPIO_bit(CORGI_GPIO_LED_ORANGE);
} else {
dev_dbg(sharpsl_pm.dev, "Charge LED Off\n");
GPCR0 = GPIO_bit(CORGI_GPIO_LED_ORANGE);
}
}
static void corgi_measure_temp(int on)
{
if (on)
GPSR(CORGI_GPIO_ADC_TEMP_ON) = GPIO_bit(CORGI_GPIO_ADC_TEMP_ON);
else
GPCR(CORGI_GPIO_ADC_TEMP_ON) = GPIO_bit(CORGI_GPIO_ADC_TEMP_ON);
}
static void corgi_charge(int on)
{
if (on) {
if (machine_is_corgi() && (sharpsl_pm.flags & SHARPSL_SUSPENDED)) {
GPCR(CORGI_GPIO_CHRG_ON) = GPIO_bit(CORGI_GPIO_CHRG_ON);
GPSR(CORGI_GPIO_CHRG_UKN) = GPIO_bit(CORGI_GPIO_CHRG_UKN);
} else {
GPSR(CORGI_GPIO_CHRG_ON) = GPIO_bit(CORGI_GPIO_CHRG_ON);
GPCR(CORGI_GPIO_CHRG_UKN) = GPIO_bit(CORGI_GPIO_CHRG_UKN);
}
} else {
GPCR(CORGI_GPIO_CHRG_ON) = GPIO_bit(CORGI_GPIO_CHRG_ON);
GPCR(CORGI_GPIO_CHRG_UKN) = GPIO_bit(CORGI_GPIO_CHRG_UKN);
}
}
static void corgi_discharge(int on)
{
if (on)
GPSR(CORGI_GPIO_DISCHARGE_ON) = GPIO_bit(CORGI_GPIO_DISCHARGE_ON);
else
GPCR(CORGI_GPIO_DISCHARGE_ON) = GPIO_bit(CORGI_GPIO_DISCHARGE_ON);
}
static void corgi_presuspend(void)
{
int i;
unsigned long wakeup_mask;
/* charging , so CHARGE_ON bit is HIGH during OFF. */
if (READ_GPIO_BIT(CORGI_GPIO_CHRG_ON))
PGSR1 |= GPIO_bit(CORGI_GPIO_CHRG_ON);
else
PGSR1 &= ~GPIO_bit(CORGI_GPIO_CHRG_ON);
if (READ_GPIO_BIT(CORGI_GPIO_LED_ORANGE))
PGSR0 |= GPIO_bit(CORGI_GPIO_LED_ORANGE);
else
PGSR0 &= ~GPIO_bit(CORGI_GPIO_LED_ORANGE);
if (READ_GPIO_BIT(CORGI_GPIO_CHRG_UKN))
PGSR1 |= GPIO_bit(CORGI_GPIO_CHRG_UKN);
else
PGSR1 &= ~GPIO_bit(CORGI_GPIO_CHRG_UKN);
/* Resume on keyboard power key */
PGSR2 = (PGSR2 & ~CORGI_GPIO_ALL_STROBE_BIT) | CORGI_GPIO_STROBE_BIT(0);
wakeup_mask = GPIO_bit(CORGI_GPIO_KEY_INT) | GPIO_bit(CORGI_GPIO_WAKEUP) | GPIO_bit(CORGI_GPIO_AC_IN) | GPIO_bit(CORGI_GPIO_CHRG_FULL);
if (!machine_is_corgi())
wakeup_mask |= GPIO_bit(CORGI_GPIO_MAIN_BAT_LOW);
PWER = wakeup_mask | PWER_RTC;
PRER = wakeup_mask;
PFER = wakeup_mask;
for (i = 0; i <=15; i++) {
if (PRER & PFER & GPIO_bit(i)) {
if (GPLR0 & GPIO_bit(i) )
PRER &= ~GPIO_bit(i);
else
PFER &= ~GPIO_bit(i);
}
}
}
static void corgi_postsuspend(void)
{
}
/*
* Check what brought us out of the suspend.
* Return: 0 to sleep, otherwise wake
*/
static int corgi_should_wakeup(unsigned int resume_on_alarm)
{
int is_resume = 0;
dev_dbg(sharpsl_pm.dev, "GPLR0 = %x,%x\n", GPLR0, PEDR);
if ((PEDR & GPIO_bit(CORGI_GPIO_AC_IN))) {
if (STATUS_AC_IN()) {
/* charge on */
dev_dbg(sharpsl_pm.dev, "ac insert\n");
sharpsl_pm.flags |= SHARPSL_DO_OFFLINE_CHRG;
} else {
/* charge off */
dev_dbg(sharpsl_pm.dev, "ac remove\n");
CHARGE_LED_OFF();
CHARGE_OFF();
sharpsl_pm.charge_mode = CHRG_OFF;
}
}
if ((PEDR & GPIO_bit(CORGI_GPIO_CHRG_FULL)))
dev_dbg(sharpsl_pm.dev, "Charge full interrupt\n");
if (PEDR & GPIO_bit(CORGI_GPIO_KEY_INT))
is_resume |= GPIO_bit(CORGI_GPIO_KEY_INT);
if (PEDR & GPIO_bit(CORGI_GPIO_WAKEUP))
is_resume |= GPIO_bit(CORGI_GPIO_WAKEUP);
if (resume_on_alarm && (PEDR & PWER_RTC))
is_resume |= PWER_RTC;
dev_dbg(sharpsl_pm.dev, "is_resume: %x\n",is_resume);
return is_resume;
}
static unsigned long corgi_charger_wakeup(void)
{
return ~GPLR0 & ( GPIO_bit(CORGI_GPIO_AC_IN) | GPIO_bit(CORGI_GPIO_KEY_INT) | GPIO_bit(CORGI_GPIO_WAKEUP) );
}
static int corgi_acin_status(void)
{
return ((GPLR(CORGI_GPIO_AC_IN) & GPIO_bit(CORGI_GPIO_AC_IN)) != 0);
}
static struct sharpsl_charger_machinfo corgi_pm_machinfo = {
.init = corgi_charger_init,
.gpio_batlock = CORGI_GPIO_BAT_COVER,
.gpio_acin = CORGI_GPIO_AC_IN,
.gpio_batfull = CORGI_GPIO_CHRG_FULL,
.status_acin = corgi_acin_status,
.discharge = corgi_discharge,
.charge = corgi_charge,
.chargeled = corgi_charge_led,
.measure_temp = corgi_measure_temp,
.presuspend = corgi_presuspend,
.postsuspend = corgi_postsuspend,
.charger_wakeup = corgi_charger_wakeup,
.should_wakeup = corgi_should_wakeup,
.bat_levels = 40,
.bat_levels_noac = spitz_battery_levels_noac,
.bat_levels_acin = spitz_battery_levels_acin,
.status_high_acin = 188,
.status_low_acin = 178,
.status_high_noac = 185,
.status_low_noac = 175,
};
static struct platform_device *corgipm_device;
static int __devinit corgipm_init(void)
{
int ret;
corgipm_device = platform_device_alloc("sharpsl-pm", -1);
if (!corgipm_device)
return -ENOMEM;
corgipm_device->dev.platform_data = &corgi_pm_machinfo;
ret = platform_device_add(corgipm_device);
if (ret)
platform_device_put(corgipm_device);
return ret;
}
static void corgipm_exit(void)
{
platform_device_unregister(corgipm_device);
}
module_init(corgipm_init);
module_exit(corgipm_exit);
......@@ -115,7 +115,7 @@ extern struct battery_thresh spitz_battery_levels_noac[];
#define CHARGE_LED_ERR() sharpsl_pm.machinfo->chargeled(SHARPSL_LED_ERROR)
#define DISCHARGE_ON() sharpsl_pm.machinfo->discharge(1)
#define DISCHARGE_OFF() sharpsl_pm.machinfo->discharge(0)
#define STATUS_AC_IN sharpsl_pm.machinfo->status_acin()
#define STATUS_BATT_LOCKED READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batlock)
#define STATUS_CHRG_FULL READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batfull)
#define STATUS_FATAL READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_fatal)
#define STATUS_AC_IN() sharpsl_pm.machinfo->status_acin()
#define STATUS_BATT_LOCKED() READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batlock)
#define STATUS_CHRG_FULL() READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batfull)
#define STATUS_FATAL() READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_fatal)
This diff is collapsed.
......@@ -345,6 +345,16 @@ static void spitz_irda_transceiver_mode(struct device *dev, int mode)
reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON);
}
#ifdef CONFIG_MACH_AKITA
static void akita_irda_transceiver_mode(struct device *dev, int mode)
{
if (mode & IR_OFF)
akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON);
else
akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON);
}
#endif
static struct pxaficp_platform_data spitz_ficp_platform_data = {
.transceiver_cap = IR_SIRMODE | IR_OFF,
.transceiver_mode = spitz_irda_transceiver_mode,
......@@ -417,6 +427,32 @@ static void __init spitz_init(void)
platform_device_register(&spitzscoop2_device);
}
#ifdef CONFIG_MACH_AKITA
/*
* Akita IO Expander
*/
struct platform_device akitaioexp_device = {
.name = "akita-ioexp",
.id = -1,
};
static void __init akita_init(void)
{
spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode;
/* We just pretend the second element of the array doesn't exist */
spitz_pcmcia_config.num_devs = 1;
platform_scoop_config = &spitz_pcmcia_config;
spitz_bl_machinfo.set_bl_intensity = akita_bl_set_intensity;
platform_device_register(&akitaioexp_device);
spitzscoop_device.dev.parent = &akitaioexp_device.dev;
common_init();
}
#endif
static void __init fixup_spitz(struct machine_desc *desc,
struct tag *tags, char **cmdline, struct meminfo *mi)
{
......@@ -452,3 +488,16 @@ MACHINE_START(BORZOI, "SHARP Borzoi")
.timer = &pxa_timer,
MACHINE_END
#endif
#ifdef CONFIG_MACH_AKITA
MACHINE_START(AKITA, "SHARP Akita")
.phys_ram = 0xa0000000,
.phys_io = 0x40000000,
.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
.fixup = fixup_spitz,
.map_io = pxa_map_io,
.init_irq = pxa_init_irq,
.init_machine = akita_init,
.timer = &pxa_timer,
MACHINE_END
#endif
/*
* Battery and Power Management code for the Sharp SL-Cxx00
*
* Copyright (c) 2005 Richard Purdie
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#include <linux/module.h>
#include <linux/stat.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <asm/apm.h>
#include <asm/irq.h>
#include <asm/mach-types.h>
#include <asm/hardware.h>
#include <asm/hardware/scoop.h>
#include <asm/arch/sharpsl.h>
#include <asm/arch/spitz.h>
#include <asm/arch/pxa-regs.h>
#include "sharpsl.h"
static int spitz_last_ac_status;
static void spitz_charger_init(void)
{
pxa_gpio_mode(SPITZ_GPIO_KEY_INT | GPIO_IN);
pxa_gpio_mode(SPITZ_GPIO_SYNC | GPIO_IN);
}
static void spitz_charge_led(int val)
{
if (val == SHARPSL_LED_ERROR) {
dev_dbg(sharpsl_pm.dev, "Charge LED Error\n");
} else if (val == SHARPSL_LED_ON) {
dev_dbg(sharpsl_pm.dev, "Charge LED On\n");
set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_ORANGE);
} else {
dev_dbg(sharpsl_pm.dev, "Charge LED Off\n");
reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_ORANGE);
}
}
static void spitz_measure_temp(int on)
{
if (on)
set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_ADC_TEMP_ON);
else
reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_ADC_TEMP_ON);
}
static void spitz_charge(int on)
{
if (on) {
if (sharpsl_pm.flags & SHARPSL_SUSPENDED) {
set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_JK_B);
reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CHRG_ON);
} else {
reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_JK_B);
reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CHRG_ON);
}
} else {
reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_JK_B);
set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CHRG_ON);
}
}
static void spitz_discharge(int on)
{
if (on)
set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_JK_A);
else
reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_JK_A);
}
/* HACK - For unknown reasons, accurate voltage readings are only made with a load
on the power bus which the green led on spitz provides */
static void spitz_discharge1(int on)
{
if (on)
set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_GREEN);
else
reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_GREEN);
}
static void spitz_presuspend(void)
{
spitz_last_ac_status = STATUS_AC_IN();
/* GPIO Sleep Register */
PGSR0 = 0x00144018;
PGSR1 = 0x00EF0000;
if (machine_is_akita()) {
PGSR2 = 0x2121C000;
PGSR3 = 0x00600400;
} else {
PGSR2 = 0x0121C000;
PGSR3 = 0x00600000;
}
PGSR0 &= ~SPITZ_GPIO_G0_STROBE_BIT;
PGSR1 &= ~SPITZ_GPIO_G1_STROBE_BIT;
PGSR2 &= ~SPITZ_GPIO_G2_STROBE_BIT;
PGSR3 &= ~SPITZ_GPIO_G3_STROBE_BIT;
PGSR2 |= GPIO_bit(SPITZ_GPIO_KEY_STROBE0);
pxa_gpio_mode(GPIO18_RDY|GPIO_OUT | GPIO_DFLT_HIGH);
PRER = GPIO_bit(SPITZ_GPIO_KEY_INT);
PFER = GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET);
PWER = GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET) | PWER_RTC;
PKWR = GPIO_bit(SPITZ_GPIO_SYNC) | GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET);
PKSR = 0xffffffff; // clear
/* nRESET_OUT Disable */
PSLR |= PSLR_SL_ROD;
/* Clear reset status */
RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
/* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
PCFR = PCFR_GPR_EN | PCFR_OPDE;
}
static void spitz_postsuspend(void)
{
pxa_gpio_mode(GPIO18_RDY_MD);
pxa_gpio_mode(10 | GPIO_IN);
}
static int spitz_should_wakeup(unsigned int resume_on_alarm)
{
int is_resume = 0;
int acin = STATUS_AC_IN();
if (spitz_last_ac_status != acin) {
if (acin) {
/* charge on */
sharpsl_pm.flags |= SHARPSL_DO_OFFLINE_CHRG;
dev_dbg(sharpsl_pm.dev, "AC Inserted\n");
} else {
/* charge off */
dev_dbg(sharpsl_pm.dev, "AC Removed\n");
CHARGE_LED_OFF();
CHARGE_OFF();
sharpsl_pm.charge_mode = CHRG_OFF;
}
spitz_last_ac_status = acin;
/* Return to suspend as this must be what we were woken for */
return 0;
}
if (PEDR & GPIO_bit(SPITZ_GPIO_KEY_INT))
is_resume |= GPIO_bit(SPITZ_GPIO_KEY_INT);
if (PKSR & GPIO_bit(SPITZ_GPIO_SYNC))
is_resume |= GPIO_bit(SPITZ_GPIO_SYNC);
if (resume_on_alarm && (PEDR & PWER_RTC))
is_resume |= PWER_RTC;
dev_dbg(sharpsl_pm.dev, "is_resume: %x\n",is_resume);
return is_resume;
}
static unsigned long spitz_charger_wakeup(void)
{
return (~GPLR0 & GPIO_bit(SPITZ_GPIO_KEY_INT)) | (GPLR0 & GPIO_bit(SPITZ_GPIO_SYNC));
}
static int spitz_acin_status(void)
{
return (((~GPLR(SPITZ_GPIO_AC_IN)) & GPIO_bit(SPITZ_GPIO_AC_IN)) != 0);
}
struct sharpsl_charger_machinfo spitz_pm_machinfo = {
.init = spitz_charger_init,
.gpio_batlock = SPITZ_GPIO_BAT_COVER,
.gpio_acin = SPITZ_GPIO_AC_IN,
.gpio_batfull = SPITZ_GPIO_CHRG_FULL,
.gpio_fatal = SPITZ_GPIO_FATAL_BAT,
.status_acin = spitz_acin_status,
.discharge = spitz_discharge,
.discharge1 = spitz_discharge1,
.charge = spitz_charge,
.chargeled = spitz_charge_led,
.measure_temp = spitz_measure_temp,
.presuspend = spitz_presuspend,
.postsuspend = spitz_postsuspend,
.charger_wakeup = spitz_charger_wakeup,
.should_wakeup = spitz_should_wakeup,
.bat_levels = 40,
.bat_levels_noac = spitz_battery_levels_noac,
.bat_levels_acin = spitz_battery_levels_acin,
.status_high_acin = 188,
.status_low_acin = 178,
.status_high_noac = 185,
.status_low_noac = 175,
};
static struct platform_device *spitzpm_device;
static int __devinit spitzpm_init(void)
{
int ret;
spitzpm_device = platform_device_alloc("sharpsl-pm", -1);
if (!spitzpm_device)
return -ENOMEM;
spitzpm_device->dev.platform_data = &spitz_pm_machinfo;
ret = platform_device_add(spitzpm_device);
if (ret)
platform_device_put(spitzpm_device);
return ret;
}
static void spitzpm_exit(void)
{
platform_device_unregister(spitzpm_device);
}
module_init(spitzpm_init);
module_exit(spitzpm_exit);
......@@ -399,34 +399,6 @@ static unsigned int __devinit init_chipset_sl82c105(struct pci_dev *dev, const c
return dev->irq;
}
static void __devinit init_dma_sl82c105(ide_hwif_t *hwif, unsigned long dma_base)
{
unsigned int rev;
u8 dma_state;
DBG(("init_dma_sl82c105(hwif: ide%d, dma_base: 0x%08x)\n", hwif->index, dma_base));
hwif->autodma = 0;
if (!dma_base)
return;
dma_state = hwif->INB(dma_base + 2);
rev = sl82c105_bridge_revision(hwif->pci_dev);
if (rev <= 5) {
printk(" %s: Winbond 553 bridge revision %d, BM-DMA disabled\n",
hwif->name, rev);
dma_state &= ~0x60;
} else {
dma_state |= 0x60;
if (!noautodma)
hwif->autodma = 1;
}
hwif->OUTB(dma_state, dma_base + 2);
ide_setup_dma(hwif, dma_base, 8);
}
/*
* Initialise the chip
*/
......@@ -434,6 +406,8 @@ static void __devinit init_dma_sl82c105(ide_hwif_t *hwif, unsigned long dma_base
static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif)
{
struct pci_dev *dev = hwif->pci_dev;
unsigned int rev;
u8 dma_state;
u32 val;
DBG(("init_hwif_sl82c105(hwif: ide%d)\n", hwif->index));
......@@ -455,33 +429,54 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif)
pci_read_config_dword(dev, 0x40, &val);
*((u32 *)&hwif->hwif_data) = val;
hwif->atapi_dma = 0;
hwif->mwdma_mask = 0;
hwif->swdma_mask = 0;
hwif->autodma = 0;
if (!hwif->dma_base)
return;
hwif->atapi_dma = 1;
hwif->mwdma_mask = 0x07;
hwif->swdma_mask = 0x07;
dma_state = hwif->INB(hwif->dma_base + 2) & ~0x60;
rev = sl82c105_bridge_revision(hwif->pci_dev);
if (rev <= 5) {
/*
* Never ever EVER under any circumstances enable
* DMA when the bridge is this old.
*/
printk(" %s: Winbond 553 bridge revision %d, BM-DMA disabled\n",
hwif->name, rev);
} else {
#ifdef CONFIG_BLK_DEV_IDEDMA
hwif->ide_dma_check = &sl82c105_check_drive;
hwif->ide_dma_on = &sl82c105_ide_dma_on;
hwif->ide_dma_off_quietly = &sl82c105_ide_dma_off_quietly;
hwif->ide_dma_lostirq = &sl82c105_ide_dma_lost_irq;
hwif->dma_start = &sl82c105_ide_dma_start;
hwif->ide_dma_timeout = &sl82c105_ide_dma_timeout;
if (!noautodma)
hwif->autodma = 1;
hwif->drives[0].autodma = hwif->autodma;
hwif->drives[1].autodma = hwif->autodma;
dma_state |= 0x60;
hwif->atapi_dma = 1;
hwif->mwdma_mask = 0x07;
hwif->swdma_mask = 0x07;
hwif->ide_dma_check = &sl82c105_check_drive;
hwif->ide_dma_on = &sl82c105_ide_dma_on;
hwif->ide_dma_off_quietly = &sl82c105_ide_dma_off_quietly;
hwif->ide_dma_lostirq = &sl82c105_ide_dma_lost_irq;
hwif->dma_start = &sl82c105_ide_dma_start;
hwif->ide_dma_timeout = &sl82c105_ide_dma_timeout;
if (!noautodma)
hwif->autodma = 1;
hwif->drives[0].autodma = hwif->autodma;
hwif->drives[1].autodma = hwif->autodma;
if (hwif->mate)
hwif->serialized = hwif->mate->serialized = 1;
#endif /* CONFIG_BLK_DEV_IDEDMA */
}
hwif->OUTB(dma_state, hwif->dma_base + 2);
}
static ide_pci_device_t sl82c105_chipset __devinitdata = {
.name = "W82C105",
.init_chipset = init_chipset_sl82c105,
.init_hwif = init_hwif_sl82c105,
.init_dma = init_dma_sl82c105,
.channels = 2,
.autodma = NOAUTODMA,
.enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}},
......
......@@ -100,14 +100,14 @@
#define SMC_IO_SHIFT 0
#define SMC_NOWAIT 1
#define SMC_inb(a, r) inb((a) + (r))
#define SMC_insb(a, r, p, l) insb((a) + (r), p, (l))
#define SMC_inw(a, r) inw((a) + (r))
#define SMC_insw(a, r, p, l) insw((a) + (r), p, l)
#define SMC_outb(v, a, r) outb(v, (a) + (r))
#define SMC_outsb(a, r, p, l) outsb((a) + (r), p, (l))
#define SMC_outw(v, a, r) outw(v, (a) + (r))
#define SMC_outsw(a, r, p, l) outsw((a) + (r), p, l)
#define SMC_inb(a, r) readb((a) + (r))
#define SMC_insb(a, r, p, l) readsb((a) + (r), p, (l))
#define SMC_inw(a, r) readw((a) + (r))
#define SMC_insw(a, r, p, l) readsw((a) + (r), p, l)
#define SMC_outb(v, a, r) writeb(v, (a) + (r))
#define SMC_outsb(a, r, p, l) writesb((a) + (r), p, (l))
#define SMC_outw(v, a, r) writew(v, (a) + (r))
#define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l)
#define set_irq_type(irq, type) do {} while (0)
......
......@@ -25,6 +25,8 @@
/* Default Values */
#define AKITA_IOEXP_IO_OUT (AKITA_IOEXP_IR_ON | AKITA_IOEXP_AKIN_PULLUP)
extern struct platform_device akitaioexp_device;
void akita_set_ioexp(struct device *dev, unsigned char bitmask);
void akita_reset_ioexp(struct device *dev, unsigned char bitmask);
......@@ -107,6 +107,7 @@
#define I2C_DRIVERID_CX25840 71 /* cx2584x video encoder */
#define I2C_DRIVERID_SAA7127 72 /* saa7124 video encoder */
#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */
#define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */
#define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */
#define I2C_DRIVERID_EXP1 0xF1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment