aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig2
-rw-r--r--arch/arm/common/locomo.c4
-rw-r--r--arch/arm/common/scoop.c2
-rw-r--r--arch/arm/kernel/apm.c1
-rw-r--r--arch/arm/kernel/smp.c4
-rw-r--r--arch/arm/mach-footbridge/common.c24
-rw-r--r--arch/arm/mach-pxa/Kconfig6
-rw-r--r--arch/arm/mach-pxa/Makefile5
-rw-r--r--arch/arm/mach-pxa/akita-ioexp.c223
-rw-r--r--arch/arm/mach-pxa/corgi_pm.c228
-rw-r--r--arch/arm/mach-pxa/sharpsl.h8
-rw-r--r--arch/arm/mach-pxa/sharpsl_pm.c109
-rw-r--r--arch/arm/mach-pxa/spitz.c49
-rw-r--r--arch/arm/mach-pxa/spitz_pm.c233
-rw-r--r--arch/frv/kernel/pm.c1
-rw-r--r--arch/i386/Kconfig2
-rw-r--r--arch/i386/kernel/apm.c1
-rw-r--r--arch/i386/kernel/cpu/intel.c48
-rw-r--r--arch/i386/kernel/entry.S7
-rw-r--r--arch/i386/kernel/timers/timer_pit.c5
-rw-r--r--arch/i386/mm/init.c3
-rw-r--r--arch/m68k/fpsp040/skeleton.S6
-rw-r--r--arch/m68k/ifpsp060/iskeleton.S6
-rw-r--r--arch/m68k/kernel/asm-offsets.c10
-rw-r--r--arch/m68k/kernel/entry.S78
-rw-r--r--arch/m68k/kernel/ptrace.c15
-rw-r--r--arch/mips/au1000/common/power.c1
-rw-r--r--arch/mips/au1000/common/usbdev.c4
-rw-r--r--arch/powerpc/Makefile2
-rw-r--r--arch/powerpc/configs/pseries_defconfig206
-rw-r--r--arch/powerpc/kernel/Makefile2
-rw-r--r--arch/powerpc/kernel/asm-offsets.c6
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S2
-rw-r--r--arch/powerpc/kernel/rtas-rtc.c105
-rw-r--r--arch/powerpc/kernel/setup_64.c5
-rw-r--r--arch/powerpc/kernel/vdso32/datapage.S3
-rw-r--r--arch/powerpc/kernel/vdso32/gettimeofday.S12
-rw-r--r--arch/powerpc/kernel/vdso64/datapage.S1
-rw-r--r--arch/powerpc/kernel/vdso64/gettimeofday.S31
-rw-r--r--arch/powerpc/mm/fsl_booke_mmu.c2
-rw-r--r--arch/powerpc/oprofile/op_model_fsl_booke.c2
-rw-r--r--arch/powerpc/platforms/powermac/time.c10
-rw-r--r--arch/powerpc/platforms/pseries/setup.c26
-rw-r--r--arch/powerpc/xmon/xmon.c1
-rw-r--r--arch/ppc/kernel/head_fsl_booke.S2
-rw-r--r--arch/ppc/mm/fsl_booke_mmu.c2
-rw-r--r--arch/ppc/platforms/83xx/mpc834x_sys.c17
-rw-r--r--arch/ppc/platforms/83xx/mpc834x_sys.h2
-rw-r--r--arch/ppc/platforms/85xx/mpc8540_ads.c2
-rw-r--r--arch/ppc/platforms/85xx/mpc8540_ads.h2
-rw-r--r--arch/ppc/platforms/85xx/mpc8555_cds.h2
-rw-r--r--arch/ppc/platforms/85xx/mpc8560_ads.c2
-rw-r--r--arch/ppc/platforms/85xx/mpc8560_ads.h2
-rw-r--r--arch/ppc/platforms/85xx/mpc85xx_ads_common.c2
-rw-r--r--arch/ppc/platforms/85xx/mpc85xx_ads_common.h2
-rw-r--r--arch/ppc/platforms/85xx/mpc85xx_cds_common.c2
-rw-r--r--arch/ppc/platforms/85xx/mpc85xx_cds_common.h2
-rw-r--r--arch/ppc/platforms/85xx/sbc8560.c2
-rw-r--r--arch/ppc/platforms/pmac_feature.c8
-rw-r--r--arch/ppc/platforms/pq2ads.c2
-rw-r--r--arch/ppc/syslib/ipic.h2
-rw-r--r--arch/ppc/syslib/mpc83xx_devices.c2
-rw-r--r--arch/ppc/syslib/mpc83xx_sys.c2
-rw-r--r--arch/ppc/syslib/mpc85xx_devices.c2
-rw-r--r--arch/ppc/syslib/mpc85xx_sys.c2
-rw-r--r--arch/ppc/syslib/mpc8xx_devices.c2
-rw-r--r--arch/ppc/syslib/mpc8xx_sys.c2
-rw-r--r--arch/ppc/syslib/ppc83xx_setup.c2
-rw-r--r--arch/ppc/syslib/ppc83xx_setup.h2
-rw-r--r--arch/ppc/syslib/ppc85xx_common.c2
-rw-r--r--arch/ppc/syslib/ppc85xx_common.h2
-rw-r--r--arch/ppc/syslib/ppc85xx_setup.c2
-rw-r--r--arch/ppc/syslib/ppc85xx_setup.h2
-rw-r--r--arch/ppc/syslib/ppc_sys.c2
-rw-r--r--arch/ppc/syslib/pq2_devices.c2
-rw-r--r--arch/ppc/syslib/pq2_sys.c2
-rw-r--r--arch/ppc64/kernel/Makefile1
-rw-r--r--arch/ppc64/kernel/machine_kexec.c63
-rw-r--r--arch/ppc64/kernel/prom.c2
-rw-r--r--arch/ppc64/kernel/rtc.c358
-rw-r--r--arch/sparc/lib/atomic32.c34
-rw-r--r--arch/sparc/lib/bitext.c1
-rw-r--r--arch/um/Kconfig10
-rw-r--r--arch/um/Kconfig.i38610
-rw-r--r--arch/um/Makefile-i3861
-rw-r--r--arch/um/drivers/chan_kern.c5
-rw-r--r--arch/um/drivers/chan_user.c2
-rw-r--r--arch/um/drivers/daemon_user.c6
-rw-r--r--arch/um/drivers/fd.c9
-rw-r--r--arch/um/drivers/mcast_user.c20
-rw-r--r--arch/um/drivers/port_user.c9
-rw-r--r--arch/um/drivers/pty.c11
-rw-r--r--arch/um/drivers/tty.c9
-rw-r--r--arch/um/drivers/xterm.c9
-rw-r--r--arch/um/include/chan_user.h4
-rw-r--r--arch/um/include/um_uaccess.h19
-rw-r--r--arch/um/kernel/skas/include/uaccess-skas.h10
-rw-r--r--arch/um/kernel/skas/uaccess.c8
-rw-r--r--arch/um/kernel/trap_kern.c9
-rw-r--r--arch/um/kernel/tt/include/uaccess-tt.h8
-rw-r--r--arch/um/kernel/tt/uaccess.c8
-rw-r--r--arch/x86_64/kernel/i8259.c2
102 files changed, 1460 insertions, 754 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 3df7cbd924a1..70b007e66926 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -702,6 +702,8 @@ menu "Device Drivers"
702 702
703source "drivers/base/Kconfig" 703source "drivers/base/Kconfig"
704 704
705source "drivers/connector/Kconfig"
706
705if ALIGNMENT_TRAP 707if ALIGNMENT_TRAP
706source "drivers/mtd/Kconfig" 708source "drivers/mtd/Kconfig"
707endif 709endif
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index 557e52c1c869..1b7eaab02b9e 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -623,8 +623,6 @@ static int locomo_resume(struct platform_device *dev)
623 locomo_writel(0x1, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KCMD); 623 locomo_writel(0x1, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KCMD);
624 624
625 spin_unlock_irqrestore(&lchip->lock, flags); 625 spin_unlock_irqrestore(&lchip->lock, flags);
626
627 dev->power.saved_state = NULL;
628 kfree(save); 626 kfree(save);
629 627
630 return 0; 628 return 0;
@@ -775,7 +773,7 @@ static int locomo_probe(struct platform_device *dev)
775 773
776static int locomo_remove(struct platform_device *dev) 774static int locomo_remove(struct platform_device *dev)
777{ 775{
778 struct locomo *lchip = platform__get_drvdata(dev); 776 struct locomo *lchip = platform_get_drvdata(dev);
779 777
780 if (lchip) { 778 if (lchip) {
781 __locomo_remove(lchip); 779 __locomo_remove(lchip);
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index 32924c6714fe..0c3cbd9a388b 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -153,7 +153,7 @@ int __init scoop_probe(struct platform_device *pdev)
153 printk("Sharp Scoop Device found at 0x%08x -> 0x%08x\n",(unsigned int)mem->start,(unsigned int)devptr->base); 153 printk("Sharp Scoop Device found at 0x%08x -> 0x%08x\n",(unsigned int)mem->start,(unsigned int)devptr->base);
154 154
155 SCOOP_REG(devptr->base, SCOOP_MCR) = 0x0140; 155 SCOOP_REG(devptr->base, SCOOP_MCR) = 0x0140;
156 reset_scoop(dev); 156 reset_scoop(&pdev->dev);
157 SCOOP_REG(devptr->base, SCOOP_GPCR) = inf->io_dir & 0xffff; 157 SCOOP_REG(devptr->base, SCOOP_GPCR) = inf->io_dir & 0xffff;
158 SCOOP_REG(devptr->base, SCOOP_GPWR) = inf->io_out & 0xffff; 158 SCOOP_REG(devptr->base, SCOOP_GPWR) = inf->io_out & 0xffff;
159 159
diff --git a/arch/arm/kernel/apm.c b/arch/arm/kernel/apm.c
index b0bbd1e62ebb..a2843be05557 100644
--- a/arch/arm/kernel/apm.c
+++ b/arch/arm/kernel/apm.c
@@ -20,6 +20,7 @@
20#include <linux/apm_bios.h> 20#include <linux/apm_bios.h>
21#include <linux/sched.h> 21#include <linux/sched.h>
22#include <linux/pm.h> 22#include <linux/pm.h>
23#include <linux/pm_legacy.h>
23#include <linux/device.h> 24#include <linux/device.h>
24#include <linux/kernel.h> 25#include <linux/kernel.h>
25#include <linux/list.h> 26#include <linux/list.h>
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index e55ea952f7aa..373c0959bc2f 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -256,9 +256,7 @@ void __cpuexit cpu_die(void)
256asmlinkage void __cpuinit secondary_start_kernel(void) 256asmlinkage void __cpuinit secondary_start_kernel(void)
257{ 257{
258 struct mm_struct *mm = &init_mm; 258 struct mm_struct *mm = &init_mm;
259 unsigned int cpu; 259 unsigned int cpu = smp_processor_id();
260
261 cpu = smp_processor_id();
262 260
263 printk("CPU%u: Booted secondary processor\n", cpu); 261 printk("CPU%u: Booted secondary processor\n", cpu);
264 262
diff --git a/arch/arm/mach-footbridge/common.c b/arch/arm/mach-footbridge/common.c
index dc09fd200c16..bbe6e4a0bf6a 100644
--- a/arch/arm/mach-footbridge/common.c
+++ b/arch/arm/mach-footbridge/common.c
@@ -132,14 +132,14 @@ void __init footbridge_init_irq(void)
132static struct map_desc fb_common_io_desc[] __initdata = { 132static struct map_desc fb_common_io_desc[] __initdata = {
133 { 133 {
134 .virtual = ARMCSR_BASE, 134 .virtual = ARMCSR_BASE,
135 .pfn = DC21285_ARMCSR_BASE, 135 .pfn = __phys_to_pfn(DC21285_ARMCSR_BASE),
136 .length = ARMCSR_SIZE, 136 .length = ARMCSR_SIZE,
137 .type = MT_DEVICE 137 .type = MT_DEVICE,
138 }, { 138 }, {
139 .virtual = XBUS_BASE, 139 .virtual = XBUS_BASE,
140 .pfn = __phys_to_pfn(0x40000000), 140 .pfn = __phys_to_pfn(0x40000000),
141 .length = XBUS_SIZE, 141 .length = XBUS_SIZE,
142 .type = MT_DEVICE 142 .type = MT_DEVICE,
143 } 143 }
144}; 144};
145 145
@@ -153,28 +153,28 @@ static struct map_desc ebsa285_host_io_desc[] __initdata = {
153 .virtual = PCIMEM_BASE, 153 .virtual = PCIMEM_BASE,
154 .pfn = __phys_to_pfn(DC21285_PCI_MEM), 154 .pfn = __phys_to_pfn(DC21285_PCI_MEM),
155 .length = PCIMEM_SIZE, 155 .length = PCIMEM_SIZE,
156 .type = MT_DEVICE 156 .type = MT_DEVICE,
157 }, { 157 }, {
158 .virtual = PCICFG0_BASE, 158 .virtual = PCICFG0_BASE,
159 .pfn = __phys_to_pfn(DC21285_PCI_TYPE_0_CONFIG), 159 .pfn = __phys_to_pfn(DC21285_PCI_TYPE_0_CONFIG),
160 .length = PCICFG0_SIZE, 160 .length = PCICFG0_SIZE,
161 .type = MT_DEVICE 161 .type = MT_DEVICE,
162 }, { 162 }, {
163 .virtual = PCICFG1_BASE, 163 .virtual = PCICFG1_BASE,
164 .pfn = __phys_to_pfn(DC21285_PCI_TYPE_1_CONFIG), 164 .pfn = __phys_to_pfn(DC21285_PCI_TYPE_1_CONFIG),
165 .length = PCICFG1_SIZE, 165 .length = PCICFG1_SIZE,
166 .type = MT_DEVICE 166 .type = MT_DEVICE,
167 }, { 167 }, {
168 .virtual = PCIIACK_BASE, 168 .virtual = PCIIACK_BASE,
169 .pfn = __phys_to_pfn(DC21285_PCI_IACK), 169 .pfn = __phys_to_pfn(DC21285_PCI_IACK),
170 .length = PCIIACK_SIZE, 170 .length = PCIIACK_SIZE,
171 .type = MT_DEVICE 171 .type = MT_DEVICE,
172 }, { 172 }, {
173 .virtual = PCIO_BASE, 173 .virtual = PCIO_BASE,
174 .pfn = __phys_to_pfn(DC21285_PCI_IO), 174 .pfn = __phys_to_pfn(DC21285_PCI_IO),
175 .length = PCIO_SIZE, 175 .length = PCIO_SIZE,
176 .type = MT_DEVICE 176 .type = MT_DEVICE,
177 } 177 },
178#endif 178#endif
179}; 179};
180 180
@@ -187,13 +187,13 @@ static struct map_desc co285_io_desc[] __initdata = {
187 .virtual = PCIO_BASE, 187 .virtual = PCIO_BASE,
188 .pfn = __phys_to_pfn(DC21285_PCI_IO), 188 .pfn = __phys_to_pfn(DC21285_PCI_IO),
189 .length = PCIO_SIZE, 189 .length = PCIO_SIZE,
190 .type = MT_DEVICE 190 .type = MT_DEVICE,
191 }, { 191 }, {
192 .virtual = PCIMEM_BASE, 192 .virtual = PCIMEM_BASE,
193 .pfn = __phys_to_pfn(DC21285_PCI_MEM), 193 .pfn = __phys_to_pfn(DC21285_PCI_MEM),
194 .length = PCIMEM_SIZE, 194 .length = PCIMEM_SIZE,
195 .type = MT_DEVICE 195 .type = MT_DEVICE,
196 } 196 },
197#endif 197#endif
198}; 198};
199 199
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index e201aa9765b9..cd506646801a 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -72,6 +72,12 @@ config MACH_HUSKY
72 depends PXA_SHARPSL_25x 72 depends PXA_SHARPSL_25x
73 select PXA_SHARP_C7xx 73 select PXA_SHARP_C7xx
74 74
75config MACH_AKITA
76 bool "Enable Sharp SL-1000 (Akita) Support"
77 depends PXA_SHARPSL_27x
78 select PXA_SHARP_Cxx00
79 select MACH_SPITZ
80
75config MACH_SPITZ 81config MACH_SPITZ
76 bool "Enable Sharp Zaurus SL-3000 (Spitz) Support" 82 bool "Enable Sharp Zaurus SL-3000 (Spitz) Support"
77 depends PXA_SHARPSL_27x 83 depends PXA_SHARPSL_27x
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index d210bd5032ce..32526a0a6f86 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -11,8 +11,9 @@ obj-$(CONFIG_PXA27x) += pxa27x.o
11obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o 11obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o
12obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o 12obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o
13obj-$(CONFIG_ARCH_PXA_IDP) += idp.o 13obj-$(CONFIG_ARCH_PXA_IDP) += idp.o
14obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o corgi_ssp.o corgi_lcd.o 14obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o corgi_pm.o
15obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o corgi_ssp.o corgi_lcd.o 15obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o spitz_pm.o
16obj-$(CONFIG_MACH_AKITA) += akita-ioexp.o
16obj-$(CONFIG_MACH_POODLE) += poodle.o 17obj-$(CONFIG_MACH_POODLE) += poodle.o
17obj-$(CONFIG_MACH_TOSA) += tosa.o 18obj-$(CONFIG_MACH_TOSA) += tosa.o
18 19
diff --git a/arch/arm/mach-pxa/akita-ioexp.c b/arch/arm/mach-pxa/akita-ioexp.c
new file mode 100644
index 000000000000..f6d73cc01f78
--- /dev/null
+++ b/arch/arm/mach-pxa/akita-ioexp.c
@@ -0,0 +1,223 @@
1/*
2 * Support for the Extra GPIOs on the Sharp SL-C1000 (Akita)
3 * (uses a Maxim MAX7310 8 Port IO Expander)
4 *
5 * Copyright 2005 Openedhand Ltd.
6 *
7 * Author: Richard Purdie <richard@openedhand.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/module.h>
19#include <linux/i2c.h>
20#include <linux/slab.h>
21#include <linux/workqueue.h>
22#include <asm/arch/akita.h>
23
24/* MAX7310 Regiser Map */
25#define MAX7310_INPUT 0x00
26#define MAX7310_OUTPUT 0x01
27#define MAX7310_POLINV 0x02
28#define MAX7310_IODIR 0x03 /* 1 = Input, 0 = Output */
29#define MAX7310_TIMEOUT 0x04
30
31/* Addresses to scan */
32static unsigned short normal_i2c[] = { 0x18, I2C_CLIENT_END };
33
34/* I2C Magic */
35I2C_CLIENT_INSMOD;
36
37static int max7310_write(struct i2c_client *client, int address, int data);
38static struct i2c_client max7310_template;
39static void akita_ioexp_work(void *private_);
40
41static struct device *akita_ioexp_device;
42static unsigned char ioexp_output_value = AKITA_IOEXP_IO_OUT;
43DECLARE_WORK(akita_ioexp, akita_ioexp_work, NULL);
44
45
46/*
47 * MAX7310 Access
48 */
49static int max7310_config(struct device *dev, int iomode, int polarity)
50{
51 int ret;
52 struct i2c_client *client = to_i2c_client(dev);
53
54 ret = max7310_write(client, MAX7310_POLINV, polarity);
55 if (ret < 0)
56 return ret;
57 ret = max7310_write(client, MAX7310_IODIR, iomode);
58 return ret;
59}
60
61static int max7310_set_ouputs(struct device *dev, int outputs)
62{
63 struct i2c_client *client = to_i2c_client(dev);
64
65 return max7310_write(client, MAX7310_OUTPUT, outputs);
66}
67
68/*
69 * I2C Functions
70 */
71static int max7310_write(struct i2c_client *client, int address, int value)
72{
73 u8 data[2];
74
75 data[0] = address & 0xff;
76 data[1] = value & 0xff;
77
78 if (i2c_master_send(client, data, 2) == 2)
79 return 0;
80 return -1;
81}
82
83static int max7310_detect(struct i2c_adapter *adapter, int address, int kind)
84{
85 struct i2c_client *new_client;
86 int err;
87
88 if (!(new_client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL)))
89 return -ENOMEM;
90
91 max7310_template.adapter = adapter;
92 max7310_template.addr = address;
93
94 memcpy(new_client, &max7310_template, sizeof(struct i2c_client));
95
96 if ((err = i2c_attach_client(new_client))) {
97 kfree(new_client);
98 return err;
99 }
100
101 max7310_config(&new_client->dev, AKITA_IOEXP_IO_DIR, 0);
102 akita_ioexp_device = &new_client->dev;
103 schedule_work(&akita_ioexp);
104
105 return 0;
106}
107
108static int max7310_attach_adapter(struct i2c_adapter *adapter)
109{
110 return i2c_probe(adapter, &addr_data, max7310_detect);
111}
112
113static int max7310_detach_client(struct i2c_client *client)
114{
115 int err;
116
117 akita_ioexp_device = NULL;
118
119 if ((err = i2c_detach_client(client)))
120 return err;
121
122 kfree(client);
123 return 0;
124}
125
126static struct i2c_driver max7310_i2c_driver = {
127 .owner = THIS_MODULE,
128 .name = "akita-max7310",
129 .id = I2C_DRIVERID_AKITAIOEXP,
130 .flags = I2C_DF_NOTIFY,
131 .attach_adapter = max7310_attach_adapter,
132 .detach_client = max7310_detach_client,
133};
134
135static struct i2c_client max7310_template = {
136 name: "akita-max7310",
137 flags: I2C_CLIENT_ALLOW_USE,
138 driver: &max7310_i2c_driver,
139};
140
141void akita_set_ioexp(struct device *dev, unsigned char bit)
142{
143 ioexp_output_value |= bit;
144
145 if (akita_ioexp_device)
146 schedule_work(&akita_ioexp);
147 return;
148}
149
150void akita_reset_ioexp(struct device *dev, unsigned char bit)
151{
152 ioexp_output_value &= ~bit;
153
154 if (akita_ioexp_device)
155 schedule_work(&akita_ioexp);
156 return;
157}
158
159EXPORT_SYMBOL(akita_set_ioexp);
160EXPORT_SYMBOL(akita_reset_ioexp);
161
162static void akita_ioexp_work(void *private_)
163{
164 if (akita_ioexp_device)
165 max7310_set_ouputs(akita_ioexp_device, ioexp_output_value);
166}
167
168
169#ifdef CONFIG_PM
170static int akita_ioexp_suspend(struct platform_device *pdev, pm_message_t state)
171{
172 flush_scheduled_work();
173 return 0;
174}
175
176static int akita_ioexp_resume(struct platform_device *pdev)
177{
178 schedule_work(&akita_ioexp);
179 return 0;
180}
181#else
182#define akita_ioexp_suspend NULL
183#define akita_ioexp_resume NULL
184#endif
185
186static int __init akita_ioexp_probe(struct platform_device *pdev)
187{
188 return i2c_add_driver(&max7310_i2c_driver);
189}
190
191static int akita_ioexp_remove(struct platform_device *pdev)
192{
193 i2c_del_driver(&max7310_i2c_driver);
194 return 0;
195}
196
197static struct platform_driver akita_ioexp_driver = {
198 .probe = akita_ioexp_probe,
199 .remove = akita_ioexp_remove,
200 .suspend = akita_ioexp_suspend,
201 .resume = akita_ioexp_resume,
202 .driver = {
203 .name = "akita-ioexp",
204 },
205};
206
207static int __init akita_ioexp_init(void)
208{
209 return platform_driver_register(&akita_ioexp_driver);
210}
211
212static void __exit akita_ioexp_exit(void)
213{
214 platform_driver_unregister(&akita_ioexp_driver);
215}
216
217MODULE_AUTHOR("Richard Purdie <rpurdie@openedhand.com>");
218MODULE_DESCRIPTION("Akita IO-Expander driver");
219MODULE_LICENSE("GPL");
220
221fs_initcall(akita_ioexp_init);
222module_exit(akita_ioexp_exit);
223
diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c
new file mode 100644
index 000000000000..599be14754f9
--- /dev/null
+++ b/arch/arm/mach-pxa/corgi_pm.c
@@ -0,0 +1,228 @@
1/*
2 * Battery and Power Management code for the Sharp SL-C7xx
3 *
4 * Copyright (c) 2005 Richard Purdie
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#include <linux/module.h>
13#include <linux/stat.h>
14#include <linux/init.h>
15#include <linux/kernel.h>
16#include <linux/delay.h>
17#include <linux/interrupt.h>
18#include <linux/platform_device.h>
19#include <asm/apm.h>
20#include <asm/irq.h>
21#include <asm/mach-types.h>
22#include <asm/hardware.h>
23#include <asm/hardware/scoop.h>
24
25#include <asm/arch/sharpsl.h>
26#include <asm/arch/corgi.h>
27#include <asm/arch/pxa-regs.h>
28#include "sharpsl.h"
29
30static void corgi_charger_init(void)
31{
32 pxa_gpio_mode(CORGI_GPIO_ADC_TEMP_ON | GPIO_OUT);
33 pxa_gpio_mode(CORGI_GPIO_CHRG_ON | GPIO_OUT);
34 pxa_gpio_mode(CORGI_GPIO_CHRG_UKN | GPIO_OUT);
35 pxa_gpio_mode(CORGI_GPIO_KEY_INT | GPIO_IN);
36}
37
38static void corgi_charge_led(int val)
39{
40 if (val == SHARPSL_LED_ERROR) {
41 dev_dbg(sharpsl_pm.dev, "Charge LED Error\n");
42 } else if (val == SHARPSL_LED_ON) {
43 dev_dbg(sharpsl_pm.dev, "Charge LED On\n");
44 GPSR0 = GPIO_bit(CORGI_GPIO_LED_ORANGE);
45 } else {
46 dev_dbg(sharpsl_pm.dev, "Charge LED Off\n");
47 GPCR0 = GPIO_bit(CORGI_GPIO_LED_ORANGE);
48 }
49}
50
51static void corgi_measure_temp(int on)
52{
53 if (on)
54 GPSR(CORGI_GPIO_ADC_TEMP_ON) = GPIO_bit(CORGI_GPIO_ADC_TEMP_ON);
55 else
56 GPCR(CORGI_GPIO_ADC_TEMP_ON) = GPIO_bit(CORGI_GPIO_ADC_TEMP_ON);
57}
58
59static void corgi_charge(int on)
60{
61 if (on) {
62 if (machine_is_corgi() && (sharpsl_pm.flags & SHARPSL_SUSPENDED)) {
63 GPCR(CORGI_GPIO_CHRG_ON) = GPIO_bit(CORGI_GPIO_CHRG_ON);
64 GPSR(CORGI_GPIO_CHRG_UKN) = GPIO_bit(CORGI_GPIO_CHRG_UKN);
65 } else {
66 GPSR(CORGI_GPIO_CHRG_ON) = GPIO_bit(CORGI_GPIO_CHRG_ON);
67 GPCR(CORGI_GPIO_CHRG_UKN) = GPIO_bit(CORGI_GPIO_CHRG_UKN);
68 }
69 } else {
70 GPCR(CORGI_GPIO_CHRG_ON) = GPIO_bit(CORGI_GPIO_CHRG_ON);
71 GPCR(CORGI_GPIO_CHRG_UKN) = GPIO_bit(CORGI_GPIO_CHRG_UKN);
72 }
73}
74
75static void corgi_discharge(int on)
76{
77 if (on)
78 GPSR(CORGI_GPIO_DISCHARGE_ON) = GPIO_bit(CORGI_GPIO_DISCHARGE_ON);
79 else
80 GPCR(CORGI_GPIO_DISCHARGE_ON) = GPIO_bit(CORGI_GPIO_DISCHARGE_ON);
81}
82
83static void corgi_presuspend(void)
84{
85 int i;
86 unsigned long wakeup_mask;
87
88 /* charging , so CHARGE_ON bit is HIGH during OFF. */
89 if (READ_GPIO_BIT(CORGI_GPIO_CHRG_ON))
90 PGSR1 |= GPIO_bit(CORGI_GPIO_CHRG_ON);
91 else
92 PGSR1 &= ~GPIO_bit(CORGI_GPIO_CHRG_ON);
93
94 if (READ_GPIO_BIT(CORGI_GPIO_LED_ORANGE))
95 PGSR0 |= GPIO_bit(CORGI_GPIO_LED_ORANGE);
96 else
97 PGSR0 &= ~GPIO_bit(CORGI_GPIO_LED_ORANGE);
98
99 if (READ_GPIO_BIT(CORGI_GPIO_CHRG_UKN))
100 PGSR1 |= GPIO_bit(CORGI_GPIO_CHRG_UKN);
101 else
102 PGSR1 &= ~GPIO_bit(CORGI_GPIO_CHRG_UKN);
103
104 /* Resume on keyboard power key */
105 PGSR2 = (PGSR2 & ~CORGI_GPIO_ALL_STROBE_BIT) | CORGI_GPIO_STROBE_BIT(0);
106
107 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);
108
109 if (!machine_is_corgi())
110 wakeup_mask |= GPIO_bit(CORGI_GPIO_MAIN_BAT_LOW);
111
112 PWER = wakeup_mask | PWER_RTC;
113 PRER = wakeup_mask;
114 PFER = wakeup_mask;
115
116 for (i = 0; i <=15; i++) {
117 if (PRER & PFER & GPIO_bit(i)) {
118 if (GPLR0 & GPIO_bit(i) )
119 PRER &= ~GPIO_bit(i);
120 else
121 PFER &= ~GPIO_bit(i);
122 }
123 }
124}
125
126static void corgi_postsuspend(void)
127{
128}
129
130/*
131 * Check what brought us out of the suspend.
132 * Return: 0 to sleep, otherwise wake
133 */
134static int corgi_should_wakeup(unsigned int resume_on_alarm)
135{
136 int is_resume = 0;
137
138 dev_dbg(sharpsl_pm.dev, "GPLR0 = %x,%x\n", GPLR0, PEDR);
139
140 if ((PEDR & GPIO_bit(CORGI_GPIO_AC_IN))) {
141 if (STATUS_AC_IN()) {
142 /* charge on */
143 dev_dbg(sharpsl_pm.dev, "ac insert\n");
144 sharpsl_pm.flags |= SHARPSL_DO_OFFLINE_CHRG;
145 } else {
146 /* charge off */
147 dev_dbg(sharpsl_pm.dev, "ac remove\n");
148 CHARGE_LED_OFF();
149 CHARGE_OFF();
150 sharpsl_pm.charge_mode = CHRG_OFF;
151 }
152 }
153
154 if ((PEDR & GPIO_bit(CORGI_GPIO_CHRG_FULL)))
155 dev_dbg(sharpsl_pm.dev, "Charge full interrupt\n");
156
157 if (PEDR & GPIO_bit(CORGI_GPIO_KEY_INT))
158 is_resume |= GPIO_bit(CORGI_GPIO_KEY_INT);
159
160 if (PEDR & GPIO_bit(CORGI_GPIO_WAKEUP))
161 is_resume |= GPIO_bit(CORGI_GPIO_WAKEUP);
162
163 if (resume_on_alarm && (PEDR & PWER_RTC))
164 is_resume |= PWER_RTC;
165
166 dev_dbg(sharpsl_pm.dev, "is_resume: %x\n",is_resume);
167 return is_resume;
168}
169
170static unsigned long corgi_charger_wakeup(void)
171{
172 return ~GPLR0 & ( GPIO_bit(CORGI_GPIO_AC_IN) | GPIO_bit(CORGI_GPIO_KEY_INT) | GPIO_bit(CORGI_GPIO_WAKEUP) );
173}
174
175static int corgi_acin_status(void)
176{
177 return ((GPLR(CORGI_GPIO_AC_IN) & GPIO_bit(CORGI_GPIO_AC_IN)) != 0);
178}
179
180static struct sharpsl_charger_machinfo corgi_pm_machinfo = {
181 .init = corgi_charger_init,
182 .gpio_batlock = CORGI_GPIO_BAT_COVER,
183 .gpio_acin = CORGI_GPIO_AC_IN,
184 .gpio_batfull = CORGI_GPIO_CHRG_FULL,
185 .status_acin = corgi_acin_status,
186 .discharge = corgi_discharge,
187 .charge = corgi_charge,
188 .chargeled = corgi_charge_led,
189 .measure_temp = corgi_measure_temp,
190 .presuspend = corgi_presuspend,
191 .postsuspend = corgi_postsuspend,
192 .charger_wakeup = corgi_charger_wakeup,
193 .should_wakeup = corgi_should_wakeup,
194 .bat_levels = 40,
195 .bat_levels_noac = spitz_battery_levels_noac,
196 .bat_levels_acin = spitz_battery_levels_acin,
197 .status_high_acin = 188,
198 .status_low_acin = 178,
199 .status_high_noac = 185,
200 .status_low_noac = 175,
201};
202
203static struct platform_device *corgipm_device;
204
205static int __devinit corgipm_init(void)
206{
207 int ret;
208
209 corgipm_device = platform_device_alloc("sharpsl-pm", -1);
210 if (!corgipm_device)
211 return -ENOMEM;
212
213 corgipm_device->dev.platform_data = &corgi_pm_machinfo;
214 ret = platform_device_add(corgipm_device);
215
216 if (ret)
217 platform_device_put(corgipm_device);
218
219 return ret;
220}
221
222static void corgipm_exit(void)
223{
224 platform_device_unregister(corgipm_device);
225}
226
227module_init(corgipm_init);
228module_exit(corgipm_exit);
diff --git a/arch/arm/mach-pxa/sharpsl.h b/arch/arm/mach-pxa/sharpsl.h
index 4879c0f7da72..b0c40a1d6671 100644
--- a/arch/arm/mach-pxa/sharpsl.h
+++ b/arch/arm/mach-pxa/sharpsl.h
@@ -115,7 +115,7 @@ extern struct battery_thresh spitz_battery_levels_noac[];
115#define CHARGE_LED_ERR() sharpsl_pm.machinfo->chargeled(SHARPSL_LED_ERROR) 115#define CHARGE_LED_ERR() sharpsl_pm.machinfo->chargeled(SHARPSL_LED_ERROR)
116#define DISCHARGE_ON() sharpsl_pm.machinfo->discharge(1) 116#define DISCHARGE_ON() sharpsl_pm.machinfo->discharge(1)
117#define DISCHARGE_OFF() sharpsl_pm.machinfo->discharge(0) 117#define DISCHARGE_OFF() sharpsl_pm.machinfo->discharge(0)
118#define STATUS_AC_IN sharpsl_pm.machinfo->status_acin() 118#define STATUS_AC_IN() sharpsl_pm.machinfo->status_acin()
119#define STATUS_BATT_LOCKED READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batlock) 119#define STATUS_BATT_LOCKED() READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batlock)
120#define STATUS_CHRG_FULL READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batfull) 120#define STATUS_CHRG_FULL() READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batfull)
121#define STATUS_FATAL READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_fatal) 121#define STATUS_FATAL() READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_fatal)
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
index 6c9e871c53d8..c10be00fb526 100644
--- a/arch/arm/mach-pxa/sharpsl_pm.c
+++ b/arch/arm/mach-pxa/sharpsl_pm.c
@@ -21,7 +21,7 @@
21#include <linux/apm_bios.h> 21#include <linux/apm_bios.h>
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/device.h> 24#include <linux/platform_device.h>
25 25
26#include <asm/hardware.h> 26#include <asm/hardware.h>
27#include <asm/hardware/scoop.h> 27#include <asm/hardware/scoop.h>
@@ -45,15 +45,15 @@
45#define SHARPSL_WAIT_DISCHARGE_ON 100 /* 100 msec */ 45#define SHARPSL_WAIT_DISCHARGE_ON 100 /* 100 msec */
46#define SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP 10 /* 10 msec */ 46#define SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP 10 /* 10 msec */
47#define SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT 10 /* 10 msec */ 47#define SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT 10 /* 10 msec */
48#define SHARPSL_CHECK_BATTERY_WAIT_TIME_JKVAD 10 /* 10 msec */ 48#define SHARPSL_CHECK_BATTERY_WAIT_TIME_ACIN 10 /* 10 msec */
49#define SHARPSL_CHARGE_WAIT_TIME 15 /* 15 msec */ 49#define SHARPSL_CHARGE_WAIT_TIME 15 /* 15 msec */
50#define SHARPSL_CHARGE_CO_CHECK_TIME 5 /* 5 msec */ 50#define SHARPSL_CHARGE_CO_CHECK_TIME 5 /* 5 msec */
51#define SHARPSL_CHARGE_RETRY_CNT 1 /* eqv. 10 min */ 51#define SHARPSL_CHARGE_RETRY_CNT 1 /* eqv. 10 min */
52 52
53#define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */ 53#define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */
54#define SHARPSL_CHARGE_ON_TEMP 0xe0 /* 2.9V */ 54#define SHARPSL_CHARGE_ON_TEMP 0xe0 /* 2.9V */
55#define SHARPSL_CHARGE_ON_JKVAD_HIGH 0x9b /* 6V */ 55#define SHARPSL_CHARGE_ON_ACIN_HIGH 0x9b /* 6V */
56#define SHARPSL_CHARGE_ON_JKVAD_LOW 0x34 /* 2V */ 56#define SHARPSL_CHARGE_ON_ACIN_LOW 0x34 /* 2V */
57#define SHARPSL_FATAL_ACIN_VOLT 182 /* 3.45V */ 57#define SHARPSL_FATAL_ACIN_VOLT 182 /* 3.45V */
58#define SHARPSL_FATAL_NOACIN_VOLT 170 /* 3.40V */ 58#define SHARPSL_FATAL_NOACIN_VOLT 170 /* 3.40V */
59 59
@@ -160,9 +160,10 @@ struct battery_thresh spitz_battery_levels_noac[] = {
160/* 160/*
161 * Prototypes 161 * Prototypes
162 */ 162 */
163static int sharpsl_read_MainBattery(void); 163static int sharpsl_read_main_battery(void);
164static int sharpsl_off_charge_battery(void); 164static int sharpsl_off_charge_battery(void);
165static int sharpsl_check_battery(int mode); 165static int sharpsl_check_battery_temp(void);
166static int sharpsl_check_battery_voltage(void);
166static int sharpsl_ac_check(void); 167static int sharpsl_ac_check(void);
167static int sharpsl_fatal_check(void); 168static int sharpsl_fatal_check(void);
168static int sharpsl_average_value(int ad); 169static int sharpsl_average_value(int ad);
@@ -228,7 +229,7 @@ static void sharpsl_battery_thread(void *private_)
228 if (!sharpsl_pm.machinfo) 229 if (!sharpsl_pm.machinfo)
229 return; 230 return;
230 231
231 sharpsl_pm.battstat.ac_status = (!(STATUS_AC_IN) ? APM_AC_OFFLINE : APM_AC_ONLINE); 232 sharpsl_pm.battstat.ac_status = (STATUS_AC_IN() ? APM_AC_ONLINE : APM_AC_OFFLINE);
232 233
233 /* Corgi cannot confirm when battery fully charged so periodically kick! */ 234 /* Corgi cannot confirm when battery fully charged so periodically kick! */
234 if (machine_is_corgi() && (sharpsl_pm.charge_mode == CHRG_ON) 235 if (machine_is_corgi() && (sharpsl_pm.charge_mode == CHRG_ON)
@@ -236,7 +237,7 @@ static void sharpsl_battery_thread(void *private_)
236 schedule_work(&toggle_charger); 237 schedule_work(&toggle_charger);
237 238
238 while(1) { 239 while(1) {
239 voltage = sharpsl_read_MainBattery(); 240 voltage = sharpsl_read_main_battery();
240 if (voltage > 0) break; 241 if (voltage > 0) break;
241 if (i++ > 5) { 242 if (i++ > 5) {
242 voltage = sharpsl_pm.machinfo->bat_levels_noac[0].voltage; 243 voltage = sharpsl_pm.machinfo->bat_levels_noac[0].voltage;
@@ -317,10 +318,10 @@ static void sharpsl_charge_toggle(void *private_)
317{ 318{
318 dev_dbg(sharpsl_pm.dev, "Toogling Charger at time: %lx\n", jiffies); 319 dev_dbg(sharpsl_pm.dev, "Toogling Charger at time: %lx\n", jiffies);
319 320
320 if (STATUS_AC_IN == 0) { 321 if (STATUS_AC_IN() == 0) {
321 sharpsl_charge_off(); 322 sharpsl_charge_off();
322 return; 323 return;
323 } else if ((sharpsl_check_battery(1) < 0) || (sharpsl_ac_check() < 0)) { 324 } else if ((sharpsl_check_battery_temp() < 0) || (sharpsl_ac_check() < 0)) {
324 sharpsl_charge_error(); 325 sharpsl_charge_error();
325 return; 326 return;
326 } 327 }
@@ -335,7 +336,7 @@ static void sharpsl_charge_toggle(void *private_)
335 336
336static void sharpsl_ac_timer(unsigned long data) 337static void sharpsl_ac_timer(unsigned long data)
337{ 338{
338 int acin = STATUS_AC_IN; 339 int acin = STATUS_AC_IN();
339 340
340 dev_dbg(sharpsl_pm.dev, "AC Status: %d\n",acin); 341 dev_dbg(sharpsl_pm.dev, "AC Status: %d\n",acin);
341 342
@@ -364,7 +365,7 @@ static void sharpsl_chrg_full_timer(unsigned long data)
364 365
365 sharpsl_pm.full_count++; 366 sharpsl_pm.full_count++;
366 367
367 if (STATUS_AC_IN == 0) { 368 if (STATUS_AC_IN() == 0) {
368 dev_dbg(sharpsl_pm.dev, "Charge Full: AC removed - stop charging!\n"); 369 dev_dbg(sharpsl_pm.dev, "Charge Full: AC removed - stop charging!\n");
369 if (sharpsl_pm.charge_mode == CHRG_ON) 370 if (sharpsl_pm.charge_mode == CHRG_ON)
370 sharpsl_charge_off(); 371 sharpsl_charge_off();
@@ -399,12 +400,12 @@ static irqreturn_t sharpsl_fatal_isr(int irq, void *dev_id, struct pt_regs *fp)
399{ 400{
400 int is_fatal = 0; 401 int is_fatal = 0;
401 402
402 if (STATUS_BATT_LOCKED == 0) { 403 if (STATUS_BATT_LOCKED() == 0) {
403 dev_err(sharpsl_pm.dev, "Battery now Unlocked! Suspending.\n"); 404 dev_err(sharpsl_pm.dev, "Battery now Unlocked! Suspending.\n");
404 is_fatal = 1; 405 is_fatal = 1;
405 } 406 }
406 407
407 if (sharpsl_pm.machinfo->gpio_fatal && (STATUS_FATAL == 0)) { 408 if (sharpsl_pm.machinfo->gpio_fatal && (STATUS_FATAL() == 0)) {
408 dev_err(sharpsl_pm.dev, "Fatal Batt Error! Suspending.\n"); 409 dev_err(sharpsl_pm.dev, "Fatal Batt Error! Suspending.\n");
409 is_fatal = 1; 410 is_fatal = 1;
410 } 411 }
@@ -461,12 +462,12 @@ static int read_max1111(int channel)
461 | MAXCTRL_SGL | MAXCTRL_UNI | MAXCTRL_STR); 462 | MAXCTRL_SGL | MAXCTRL_UNI | MAXCTRL_STR);
462} 463}
463 464
464static int sharpsl_read_MainBattery(void) 465static int sharpsl_read_main_battery(void)
465{ 466{
466 return read_max1111(BATT_AD); 467 return read_max1111(BATT_AD);
467} 468}
468 469
469static int sharpsl_read_Temp(void) 470static int sharpsl_read_temp(void)
470{ 471{
471 int temp; 472 int temp;
472 473
@@ -480,7 +481,7 @@ static int sharpsl_read_Temp(void)
480 return temp; 481 return temp;
481} 482}
482 483
483static int sharpsl_read_jkvad(void) 484static int sharpsl_read_acin(void)
484{ 485{
485 return read_max1111(JK_VAD); 486 return read_max1111(JK_VAD);
486} 487}
@@ -522,16 +523,14 @@ static int get_select_val(int *val)
522 return (sum/3); 523 return (sum/3);
523} 524}
524 525
525/* mode 0 - Check temperature and voltage 526static int sharpsl_check_battery_temp(void)
526 * 1 - Check temperature only */
527static int sharpsl_check_battery(int mode)
528{ 527{
529 int val, i, buff[5]; 528 int val, i, buff[5];
530 529
531 /* Check battery temperature */ 530 /* Check battery temperature */
532 for (i=0; i<5; i++) { 531 for (i=0; i<5; i++) {
533 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP); 532 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP);
534 buff[i] = sharpsl_read_Temp(); 533 buff[i] = sharpsl_read_temp();
535 } 534 }
536 535
537 val = get_select_val(buff); 536 val = get_select_val(buff);
@@ -539,8 +538,13 @@ static int sharpsl_check_battery(int mode)
539 dev_dbg(sharpsl_pm.dev, "Temperature: %d\n", val); 538 dev_dbg(sharpsl_pm.dev, "Temperature: %d\n", val);
540 if (val > SHARPSL_CHARGE_ON_TEMP) 539 if (val > SHARPSL_CHARGE_ON_TEMP)
541 return -1; 540 return -1;
542 if (mode == 1) 541
543 return 0; 542 return 0;
543}
544
545static int sharpsl_check_battery_voltage(void)
546{
547 int val, i, buff[5];
544 548
545 /* disable charge, enable discharge */ 549 /* disable charge, enable discharge */
546 CHARGE_OFF(); 550 CHARGE_OFF();
@@ -552,7 +556,7 @@ static int sharpsl_check_battery(int mode)
552 556
553 /* Check battery voltage */ 557 /* Check battery voltage */
554 for (i=0; i<5; i++) { 558 for (i=0; i<5; i++) {
555 buff[i] = sharpsl_read_MainBattery(); 559 buff[i] = sharpsl_read_main_battery();
556 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT); 560 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT);
557 } 561 }
558 562
@@ -575,14 +579,14 @@ static int sharpsl_ac_check(void)
575 int temp, i, buff[5]; 579 int temp, i, buff[5];
576 580
577 for (i=0; i<5; i++) { 581 for (i=0; i<5; i++) {
578 buff[i] = sharpsl_read_jkvad(); 582 buff[i] = sharpsl_read_acin();
579 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_JKVAD); 583 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_ACIN);
580 } 584 }
581 585
582 temp = get_select_val(buff); 586 temp = get_select_val(buff);
583 dev_dbg(sharpsl_pm.dev, "AC Voltage: %d\n",temp); 587 dev_dbg(sharpsl_pm.dev, "AC Voltage: %d\n",temp);
584 588
585 if ((temp > SHARPSL_CHARGE_ON_JKVAD_HIGH) || (temp < SHARPSL_CHARGE_ON_JKVAD_LOW)) { 589 if ((temp > SHARPSL_CHARGE_ON_ACIN_HIGH) || (temp < SHARPSL_CHARGE_ON_ACIN_LOW)) {
586 dev_err(sharpsl_pm.dev, "Error: AC check failed.\n"); 590 dev_err(sharpsl_pm.dev, "Error: AC check failed.\n");
587 return -1; 591 return -1;
588 } 592 }
@@ -591,7 +595,7 @@ static int sharpsl_ac_check(void)
591} 595}
592 596
593#ifdef CONFIG_PM 597#ifdef CONFIG_PM
594static int sharpsl_pm_suspend(struct device *dev, pm_message_t state) 598static int sharpsl_pm_suspend(struct platform_device *pdev, pm_message_t state)
595{ 599{
596 sharpsl_pm.flags |= SHARPSL_SUSPENDED; 600 sharpsl_pm.flags |= SHARPSL_SUSPENDED;
597 flush_scheduled_work(); 601 flush_scheduled_work();
@@ -604,7 +608,7 @@ static int sharpsl_pm_suspend(struct device *dev, pm_message_t state)
604 return 0; 608 return 0;
605} 609}
606 610
607static int sharpsl_pm_resume(struct device *dev) 611static int sharpsl_pm_resume(struct platform_device *pdev)
608{ 612{
609 /* Clear the reset source indicators as they break the bootloader upon reboot */ 613 /* Clear the reset source indicators as they break the bootloader upon reboot */
610 RCSR = 0x0f; 614 RCSR = 0x0f;
@@ -622,7 +626,7 @@ static void corgi_goto_sleep(unsigned long alarm_time, unsigned int alarm_enable
622 dev_dbg(sharpsl_pm.dev, "Offline Charge Activate = %d\n",sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG); 626 dev_dbg(sharpsl_pm.dev, "Offline Charge Activate = %d\n",sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG);
623 /* not charging and AC-IN! */ 627 /* not charging and AC-IN! */
624 628
625 if ((sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG) && (STATUS_AC_IN != 0)) { 629 if ((sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG) && (STATUS_AC_IN() != 0)) {
626 dev_dbg(sharpsl_pm.dev, "Activating Offline Charger...\n"); 630 dev_dbg(sharpsl_pm.dev, "Activating Offline Charger...\n");
627 sharpsl_pm.charge_mode = CHRG_OFF; 631 sharpsl_pm.charge_mode = CHRG_OFF;
628 sharpsl_pm.flags &= ~SHARPSL_DO_OFFLINE_CHRG; 632 sharpsl_pm.flags &= ~SHARPSL_DO_OFFLINE_CHRG;
@@ -671,7 +675,7 @@ static int corgi_enter_suspend(unsigned long alarm_time, unsigned int alarm_enab
671 dev_dbg(sharpsl_pm.dev, "User triggered wakeup in offline charger.\n"); 675 dev_dbg(sharpsl_pm.dev, "User triggered wakeup in offline charger.\n");
672 } 676 }
673 677
674 if ((STATUS_BATT_LOCKED == 0) || (sharpsl_fatal_check() < 0) ) 678 if ((STATUS_BATT_LOCKED() == 0) || (sharpsl_fatal_check() < 0) )
675 { 679 {
676 dev_err(sharpsl_pm.dev, "Fatal condition. Suspend.\n"); 680 dev_err(sharpsl_pm.dev, "Fatal condition. Suspend.\n");
677 corgi_goto_sleep(alarm_time, alarm_enable, state); 681 corgi_goto_sleep(alarm_time, alarm_enable, state);
@@ -711,7 +715,7 @@ static int sharpsl_fatal_check(void)
711 dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check entered\n"); 715 dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check entered\n");
712 716
713 /* Check AC-Adapter */ 717 /* Check AC-Adapter */
714 acin = STATUS_AC_IN; 718 acin = STATUS_AC_IN();
715 719
716 if (acin && (sharpsl_pm.charge_mode == CHRG_ON)) { 720 if (acin && (sharpsl_pm.charge_mode == CHRG_ON)) {
717 CHARGE_OFF(); 721 CHARGE_OFF();
@@ -725,7 +729,7 @@ static int sharpsl_fatal_check(void)
725 729
726 /* Check battery : check inserting battery ? */ 730 /* Check battery : check inserting battery ? */
727 for (i=0; i<5; i++) { 731 for (i=0; i<5; i++) {
728 buff[i] = sharpsl_read_MainBattery(); 732 buff[i] = sharpsl_read_main_battery();
729 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT); 733 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT);
730 } 734 }
731 735
@@ -739,7 +743,7 @@ static int sharpsl_fatal_check(void)
739 } 743 }
740 744
741 temp = get_select_val(buff); 745 temp = get_select_val(buff);
742 dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check: acin: %d, discharge voltage: %d, no discharge: %d\n", acin, temp, sharpsl_read_MainBattery()); 746 dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check: acin: %d, discharge voltage: %d, no discharge: %d\n", acin, temp, sharpsl_read_main_battery());
743 747
744 if ((acin && (temp < SHARPSL_FATAL_ACIN_VOLT)) || 748 if ((acin && (temp < SHARPSL_FATAL_ACIN_VOLT)) ||
745 (!acin && (temp < SHARPSL_FATAL_NOACIN_VOLT))) 749 (!acin && (temp < SHARPSL_FATAL_NOACIN_VOLT)))
@@ -771,7 +775,7 @@ static int sharpsl_off_charge_battery(void)
771 dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 1\n"); 775 dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 1\n");
772 776
773 /* AC Check */ 777 /* AC Check */
774 if ((sharpsl_ac_check() < 0) || (sharpsl_check_battery(1) < 0)) 778 if ((sharpsl_ac_check() < 0) || (sharpsl_check_battery_temp() < 0))
775 return sharpsl_off_charge_error(); 779 return sharpsl_off_charge_error();
776 780
777 /* Start Charging */ 781 /* Start Charging */
@@ -793,7 +797,7 @@ static int sharpsl_off_charge_battery(void)
793 797
794 dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 2\n"); 798 dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 2\n");
795 799
796 if (sharpsl_check_battery(0) < 0) 800 if ((sharpsl_check_battery_temp() < 0) || (sharpsl_check_battery_voltage() < 0))
797 return sharpsl_off_charge_error(); 801 return sharpsl_off_charge_error();
798 802
799 CHARGE_OFF(); 803 CHARGE_OFF();
@@ -811,7 +815,7 @@ static int sharpsl_off_charge_battery(void)
811 /* Check for timeout */ 815 /* Check for timeout */
812 if ((RCNR - time) > SHARPSL_WAIT_CO_TIME) 816 if ((RCNR - time) > SHARPSL_WAIT_CO_TIME)
813 return 1; 817 return 1;
814 if (STATUS_CHRG_FULL) { 818 if (STATUS_CHRG_FULL()) {
815 dev_dbg(sharpsl_pm.dev, "Offline Charger: Charge full occured. Retrying to check\n"); 819 dev_dbg(sharpsl_pm.dev, "Offline Charger: Charge full occured. Retrying to check\n");
816 sharpsl_pm.full_count++; 820 sharpsl_pm.full_count++;
817 CHARGE_OFF(); 821 CHARGE_OFF();
@@ -840,7 +844,7 @@ static int sharpsl_off_charge_battery(void)
840 sharpsl_pm.full_count++; 844 sharpsl_pm.full_count++;
841 return 1; 845 return 1;
842 } 846 }
843 if (STATUS_CHRG_FULL) { 847 if (STATUS_CHRG_FULL()) {
844 dev_dbg(sharpsl_pm.dev, "Offline Charger: Charging complete.\n"); 848 dev_dbg(sharpsl_pm.dev, "Offline Charger: Charging complete.\n");
845 CHARGE_LED_OFF(); 849 CHARGE_LED_OFF();
846 CHARGE_OFF(); 850 CHARGE_OFF();
@@ -886,13 +890,13 @@ static struct pm_ops sharpsl_pm_ops = {
886 .finish = pxa_pm_finish, 890 .finish = pxa_pm_finish,
887}; 891};
888 892
889static int __init sharpsl_pm_probe(struct device *dev) 893static int __init sharpsl_pm_probe(struct platform_device *pdev)
890{ 894{
891 if (!dev->platform_data) 895 if (!pdev->dev.platform_data)
892 return -EINVAL; 896 return -EINVAL;
893 897
894 sharpsl_pm.dev = dev; 898 sharpsl_pm.dev = &pdev->dev;
895 sharpsl_pm.machinfo = dev->platform_data; 899 sharpsl_pm.machinfo = pdev->dev.platform_data;
896 sharpsl_pm.charge_mode = CHRG_OFF; 900 sharpsl_pm.charge_mode = CHRG_OFF;
897 sharpsl_pm.flags = 0; 901 sharpsl_pm.flags = 0;
898 902
@@ -935,8 +939,8 @@ static int __init sharpsl_pm_probe(struct device *dev)
935 else set_irq_type(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull),IRQT_RISING); 939 else set_irq_type(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull),IRQT_RISING);
936 } 940 }
937 941
938 device_create_file(dev, &dev_attr_battery_percentage); 942 device_create_file(&pdev->dev, &dev_attr_battery_percentage);
939 device_create_file(dev, &dev_attr_battery_voltage); 943 device_create_file(&pdev->dev, &dev_attr_battery_voltage);
940 944
941 apm_get_power_status = sharpsl_apm_get_power_status; 945 apm_get_power_status = sharpsl_apm_get_power_status;
942 946
@@ -947,12 +951,12 @@ static int __init sharpsl_pm_probe(struct device *dev)
947 return 0; 951 return 0;
948} 952}
949 953
950static int sharpsl_pm_remove(struct device *dev) 954static int sharpsl_pm_remove(struct platform_device *pdev)
951{ 955{
952 pm_set_ops(NULL); 956 pm_set_ops(NULL);
953 957
954 device_remove_file(dev, &dev_attr_battery_percentage); 958 device_remove_file(&pdev->dev, &dev_attr_battery_percentage);
955 device_remove_file(dev, &dev_attr_battery_voltage); 959 device_remove_file(&pdev->dev, &dev_attr_battery_voltage);
956 960
957 free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr); 961 free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr);
958 free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr); 962 free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr);
@@ -969,23 +973,24 @@ static int sharpsl_pm_remove(struct device *dev)
969 return 0; 973 return 0;
970} 974}
971 975
972static struct device_driver sharpsl_pm_driver = { 976static struct platform_driver sharpsl_pm_driver = {
973 .name = "sharpsl-pm",
974 .bus = &platform_bus_type,
975 .probe = sharpsl_pm_probe, 977 .probe = sharpsl_pm_probe,
976 .remove = sharpsl_pm_remove, 978 .remove = sharpsl_pm_remove,
977 .suspend = sharpsl_pm_suspend, 979 .suspend = sharpsl_pm_suspend,
978 .resume = sharpsl_pm_resume, 980 .resume = sharpsl_pm_resume,
981 .driver = {
982 .name = "sharpsl-pm",
983 },
979}; 984};
980 985
981static int __devinit sharpsl_pm_init(void) 986static int __devinit sharpsl_pm_init(void)
982{ 987{
983 return driver_register(&sharpsl_pm_driver); 988 return platform_driver_register(&sharpsl_pm_driver);
984} 989}
985 990
986static void sharpsl_pm_exit(void) 991static void sharpsl_pm_exit(void)
987{ 992{
988 driver_unregister(&sharpsl_pm_driver); 993 platform_driver_unregister(&sharpsl_pm_driver);
989} 994}
990 995
991late_initcall(sharpsl_pm_init); 996late_initcall(sharpsl_pm_init);
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 4e9a699ee428..2df1b56615b1 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -345,6 +345,16 @@ static void spitz_irda_transceiver_mode(struct device *dev, int mode)
345 reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON); 345 reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON);
346} 346}
347 347
348#ifdef CONFIG_MACH_AKITA
349static void akita_irda_transceiver_mode(struct device *dev, int mode)
350{
351 if (mode & IR_OFF)
352 akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON);
353 else
354 akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON);
355}
356#endif
357
348static struct pxaficp_platform_data spitz_ficp_platform_data = { 358static struct pxaficp_platform_data spitz_ficp_platform_data = {
349 .transceiver_cap = IR_SIRMODE | IR_OFF, 359 .transceiver_cap = IR_SIRMODE | IR_OFF,
350 .transceiver_mode = spitz_irda_transceiver_mode, 360 .transceiver_mode = spitz_irda_transceiver_mode,
@@ -417,6 +427,32 @@ static void __init spitz_init(void)
417 platform_device_register(&spitzscoop2_device); 427 platform_device_register(&spitzscoop2_device);
418} 428}
419 429
430#ifdef CONFIG_MACH_AKITA
431/*
432 * Akita IO Expander
433 */
434struct platform_device akitaioexp_device = {
435 .name = "akita-ioexp",
436 .id = -1,
437};
438
439static void __init akita_init(void)
440{
441 spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode;
442
443 /* We just pretend the second element of the array doesn't exist */
444 spitz_pcmcia_config.num_devs = 1;
445 platform_scoop_config = &spitz_pcmcia_config;
446 spitz_bl_machinfo.set_bl_intensity = akita_bl_set_intensity;
447
448 platform_device_register(&akitaioexp_device);
449
450 spitzscoop_device.dev.parent = &akitaioexp_device.dev;
451 common_init();
452}
453#endif
454
455
420static void __init fixup_spitz(struct machine_desc *desc, 456static void __init fixup_spitz(struct machine_desc *desc,
421 struct tag *tags, char **cmdline, struct meminfo *mi) 457 struct tag *tags, char **cmdline, struct meminfo *mi)
422{ 458{
@@ -452,3 +488,16 @@ MACHINE_START(BORZOI, "SHARP Borzoi")
452 .timer = &pxa_timer, 488 .timer = &pxa_timer,
453MACHINE_END 489MACHINE_END
454#endif 490#endif
491
492#ifdef CONFIG_MACH_AKITA
493MACHINE_START(AKITA, "SHARP Akita")
494 .phys_ram = 0xa0000000,
495 .phys_io = 0x40000000,
496 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
497 .fixup = fixup_spitz,
498 .map_io = pxa_map_io,
499 .init_irq = pxa_init_irq,
500 .init_machine = akita_init,
501 .timer = &pxa_timer,
502MACHINE_END
503#endif
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
new file mode 100644
index 000000000000..3ce7486daa51
--- /dev/null
+++ b/arch/arm/mach-pxa/spitz_pm.c
@@ -0,0 +1,233 @@
1/*
2 * Battery and Power Management code for the Sharp SL-Cxx00
3 *
4 * Copyright (c) 2005 Richard Purdie
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#include <linux/module.h>
13#include <linux/stat.h>
14#include <linux/init.h>
15#include <linux/kernel.h>
16#include <linux/delay.h>
17#include <linux/interrupt.h>
18#include <linux/platform_device.h>
19#include <asm/apm.h>
20#include <asm/irq.h>
21#include <asm/mach-types.h>
22#include <asm/hardware.h>
23#include <asm/hardware/scoop.h>
24
25#include <asm/arch/sharpsl.h>
26#include <asm/arch/spitz.h>
27#include <asm/arch/pxa-regs.h>
28#include "sharpsl.h"
29
30static int spitz_last_ac_status;
31
32static void spitz_charger_init(void)
33{
34 pxa_gpio_mode(SPITZ_GPIO_KEY_INT | GPIO_IN);
35 pxa_gpio_mode(SPITZ_GPIO_SYNC | GPIO_IN);
36}
37
38static void spitz_charge_led(int val)
39{
40 if (val == SHARPSL_LED_ERROR) {
41 dev_dbg(sharpsl_pm.dev, "Charge LED Error\n");
42 } else if (val == SHARPSL_LED_ON) {
43 dev_dbg(sharpsl_pm.dev, "Charge LED On\n");
44 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_ORANGE);
45 } else {
46 dev_dbg(sharpsl_pm.dev, "Charge LED Off\n");
47 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_ORANGE);
48 }
49}
50
51static void spitz_measure_temp(int on)
52{
53 if (on)
54 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_ADC_TEMP_ON);
55 else
56 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_ADC_TEMP_ON);
57}
58
59static void spitz_charge(int on)
60{
61 if (on) {
62 if (sharpsl_pm.flags & SHARPSL_SUSPENDED) {
63 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_JK_B);
64 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CHRG_ON);
65 } else {
66 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_JK_B);
67 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CHRG_ON);
68 }
69 } else {
70 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_JK_B);
71 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CHRG_ON);
72 }
73}
74
75static void spitz_discharge(int on)
76{
77 if (on)
78 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_JK_A);
79 else
80 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_JK_A);
81}
82
83/* HACK - For unknown reasons, accurate voltage readings are only made with a load
84 on the power bus which the green led on spitz provides */
85static void spitz_discharge1(int on)
86{
87 if (on)
88 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_GREEN);
89 else
90 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_GREEN);
91}
92
93static void spitz_presuspend(void)
94{
95 spitz_last_ac_status = STATUS_AC_IN();
96
97 /* GPIO Sleep Register */
98 PGSR0 = 0x00144018;
99 PGSR1 = 0x00EF0000;
100 if (machine_is_akita()) {
101 PGSR2 = 0x2121C000;
102 PGSR3 = 0x00600400;
103 } else {
104 PGSR2 = 0x0121C000;
105 PGSR3 = 0x00600000;
106 }
107
108 PGSR0 &= ~SPITZ_GPIO_G0_STROBE_BIT;
109 PGSR1 &= ~SPITZ_GPIO_G1_STROBE_BIT;
110 PGSR2 &= ~SPITZ_GPIO_G2_STROBE_BIT;
111 PGSR3 &= ~SPITZ_GPIO_G3_STROBE_BIT;
112 PGSR2 |= GPIO_bit(SPITZ_GPIO_KEY_STROBE0);
113
114 pxa_gpio_mode(GPIO18_RDY|GPIO_OUT | GPIO_DFLT_HIGH);
115
116 PRER = GPIO_bit(SPITZ_GPIO_KEY_INT);
117 PFER = GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET);
118 PWER = GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET) | PWER_RTC;
119 PKWR = GPIO_bit(SPITZ_GPIO_SYNC) | GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET);
120 PKSR = 0xffffffff; // clear
121
122 /* nRESET_OUT Disable */
123 PSLR |= PSLR_SL_ROD;
124
125 /* Clear reset status */
126 RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
127
128 /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
129 PCFR = PCFR_GPR_EN | PCFR_OPDE;
130}
131
132static void spitz_postsuspend(void)
133{
134 pxa_gpio_mode(GPIO18_RDY_MD);
135 pxa_gpio_mode(10 | GPIO_IN);
136}
137
138static int spitz_should_wakeup(unsigned int resume_on_alarm)
139{
140 int is_resume = 0;
141 int acin = STATUS_AC_IN();
142
143 if (spitz_last_ac_status != acin) {
144 if (acin) {
145 /* charge on */
146 sharpsl_pm.flags |= SHARPSL_DO_OFFLINE_CHRG;
147 dev_dbg(sharpsl_pm.dev, "AC Inserted\n");
148 } else {
149 /* charge off */
150 dev_dbg(sharpsl_pm.dev, "AC Removed\n");
151 CHARGE_LED_OFF();
152 CHARGE_OFF();
153 sharpsl_pm.charge_mode = CHRG_OFF;
154 }
155 spitz_last_ac_status = acin;
156 /* Return to suspend as this must be what we were woken for */
157 return 0;
158 }
159
160 if (PEDR & GPIO_bit(SPITZ_GPIO_KEY_INT))
161 is_resume |= GPIO_bit(SPITZ_GPIO_KEY_INT);
162
163 if (PKSR & GPIO_bit(SPITZ_GPIO_SYNC))
164 is_resume |= GPIO_bit(SPITZ_GPIO_SYNC);
165
166 if (resume_on_alarm && (PEDR & PWER_RTC))
167 is_resume |= PWER_RTC;
168
169 dev_dbg(sharpsl_pm.dev, "is_resume: %x\n",is_resume);
170 return is_resume;
171}
172
173static unsigned long spitz_charger_wakeup(void)
174{
175 return (~GPLR0 & GPIO_bit(SPITZ_GPIO_KEY_INT)) | (GPLR0 & GPIO_bit(SPITZ_GPIO_SYNC));
176}
177
178static int spitz_acin_status(void)
179{
180 return (((~GPLR(SPITZ_GPIO_AC_IN)) & GPIO_bit(SPITZ_GPIO_AC_IN)) != 0);
181}
182
183struct sharpsl_charger_machinfo spitz_pm_machinfo = {
184 .init = spitz_charger_init,
185 .gpio_batlock = SPITZ_GPIO_BAT_COVER,
186 .gpio_acin = SPITZ_GPIO_AC_IN,
187 .gpio_batfull = SPITZ_GPIO_CHRG_FULL,
188 .gpio_fatal = SPITZ_GPIO_FATAL_BAT,
189 .status_acin = spitz_acin_status,
190 .discharge = spitz_discharge,
191 .discharge1 = spitz_discharge1,
192 .charge = spitz_charge,
193 .chargeled = spitz_charge_led,
194 .measure_temp = spitz_measure_temp,
195 .presuspend = spitz_presuspend,
196 .postsuspend = spitz_postsuspend,
197 .charger_wakeup = spitz_charger_wakeup,
198 .should_wakeup = spitz_should_wakeup,
199 .bat_levels = 40,
200 .bat_levels_noac = spitz_battery_levels_noac,
201 .bat_levels_acin = spitz_battery_levels_acin,
202 .status_high_acin = 188,
203 .status_low_acin = 178,
204 .status_high_noac = 185,
205 .status_low_noac = 175,
206};
207
208static struct platform_device *spitzpm_device;
209
210static int __devinit spitzpm_init(void)
211{
212 int ret;
213
214 spitzpm_device = platform_device_alloc("sharpsl-pm", -1);
215 if (!spitzpm_device)
216 return -ENOMEM;
217
218 spitzpm_device->dev.platform_data = &spitz_pm_machinfo;
219 ret = platform_device_add(spitzpm_device);
220
221 if (ret)
222 platform_device_put(spitzpm_device);
223
224 return ret;
225}
226
227static void spitzpm_exit(void)
228{
229 platform_device_unregister(spitzpm_device);
230}
231
232module_init(spitzpm_init);
233module_exit(spitzpm_exit);
diff --git a/arch/frv/kernel/pm.c b/arch/frv/kernel/pm.c
index 1a1e8a119c3d..712c3c24c954 100644
--- a/arch/frv/kernel/pm.c
+++ b/arch/frv/kernel/pm.c
@@ -14,6 +14,7 @@
14#include <linux/config.h> 14#include <linux/config.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/pm.h> 16#include <linux/pm.h>
17#include <linux/pm_legacy.h>
17#include <linux/sched.h> 18#include <linux/sched.h>
18#include <linux/interrupt.h> 19#include <linux/interrupt.h>
19#include <linux/sysctl.h> 20#include <linux/sysctl.h>
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index dbf90ad6eac3..6004bb0795e0 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -699,7 +699,7 @@ depends on PM && !X86_VISWS
699 699
700config APM 700config APM
701 tristate "APM (Advanced Power Management) BIOS support" 701 tristate "APM (Advanced Power Management) BIOS support"
702 depends on PM 702 depends on PM && PM_LEGACY
703 ---help--- 703 ---help---
704 APM is a BIOS specification for saving power using several different 704 APM is a BIOS specification for saving power using several different
705 techniques. This is mostly useful for battery powered laptops with 705 techniques. This is mostly useful for battery powered laptops with
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c
index 003548b8735f..1e60acbed3c1 100644
--- a/arch/i386/kernel/apm.c
+++ b/arch/i386/kernel/apm.c
@@ -218,6 +218,7 @@
218#include <linux/time.h> 218#include <linux/time.h>
219#include <linux/sched.h> 219#include <linux/sched.h>
220#include <linux/pm.h> 220#include <linux/pm.h>
221#include <linux/pm_legacy.h>
221#include <linux/device.h> 222#include <linux/device.h>
222#include <linux/kernel.h> 223#include <linux/kernel.h>
223#include <linux/smp.h> 224#include <linux/smp.h>
diff --git a/arch/i386/kernel/cpu/intel.c b/arch/i386/kernel/cpu/intel.c
index 43601de0f633..c28d26fb5f24 100644
--- a/arch/i386/kernel/cpu/intel.c
+++ b/arch/i386/kernel/cpu/intel.c
@@ -6,6 +6,7 @@
6#include <linux/bitops.h> 6#include <linux/bitops.h>
7#include <linux/smp.h> 7#include <linux/smp.h>
8#include <linux/thread_info.h> 8#include <linux/thread_info.h>
9#include <linux/module.h>
9 10
10#include <asm/processor.h> 11#include <asm/processor.h>
11#include <asm/msr.h> 12#include <asm/msr.h>
@@ -264,5 +265,52 @@ __init int intel_cpu_init(void)
264 return 0; 265 return 0;
265} 266}
266 267
268#ifndef CONFIG_X86_CMPXCHG
269unsigned long cmpxchg_386_u8(volatile void *ptr, u8 old, u8 new)
270{
271 u8 prev;
272 unsigned long flags;
273
274 /* Poor man's cmpxchg for 386. Unsuitable for SMP */
275 local_irq_save(flags);
276 prev = *(u8 *)ptr;
277 if (prev == old)
278 *(u8 *)ptr = new;
279 local_irq_restore(flags);
280 return prev;
281}
282EXPORT_SYMBOL(cmpxchg_386_u8);
283
284unsigned long cmpxchg_386_u16(volatile void *ptr, u16 old, u16 new)
285{
286 u16 prev;
287 unsigned long flags;
288
289 /* Poor man's cmpxchg for 386. Unsuitable for SMP */
290 local_irq_save(flags);
291 prev = *(u16 *)ptr;
292 if (prev == old)
293 *(u16 *)ptr = new;
294 local_irq_restore(flags);
295 return prev;
296}
297EXPORT_SYMBOL(cmpxchg_386_u16);
298
299unsigned long cmpxchg_386_u32(volatile void *ptr, u32 old, u32 new)
300{
301 u32 prev;
302 unsigned long flags;
303
304 /* Poor man's cmpxchg for 386. Unsuitable for SMP */
305 local_irq_save(flags);
306 prev = *(u32 *)ptr;
307 if (prev == old)
308 *(u32 *)ptr = new;
309 local_irq_restore(flags);
310 return prev;
311}
312EXPORT_SYMBOL(cmpxchg_386_u32);
313#endif
314
267// arch_initcall(intel_cpu_init); 315// arch_initcall(intel_cpu_init);
268 316
diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
index 9e24f7b207ee..e50b93155249 100644
--- a/arch/i386/kernel/entry.S
+++ b/arch/i386/kernel/entry.S
@@ -560,11 +560,10 @@ nmi_stack_fixup:
560nmi_debug_stack_check: 560nmi_debug_stack_check:
561 cmpw $__KERNEL_CS,16(%esp) 561 cmpw $__KERNEL_CS,16(%esp)
562 jne nmi_stack_correct 562 jne nmi_stack_correct
563 cmpl $debug - 1,(%esp) 563 cmpl $debug,(%esp)
564 jle nmi_stack_correct 564 jb nmi_stack_correct
565 cmpl $debug_esp_fix_insn,(%esp) 565 cmpl $debug_esp_fix_insn,(%esp)
566 jle nmi_debug_stack_fixup 566 ja nmi_stack_correct
567nmi_debug_stack_fixup:
568 FIX_STACK(24,nmi_stack_correct, 1) 567 FIX_STACK(24,nmi_stack_correct, 1)
569 jmp nmi_stack_correct 568 jmp nmi_stack_correct
570 569
diff --git a/arch/i386/kernel/timers/timer_pit.c b/arch/i386/kernel/timers/timer_pit.c
index e42e46d35159..b9b6bd56b9ba 100644
--- a/arch/i386/kernel/timers/timer_pit.c
+++ b/arch/i386/kernel/timers/timer_pit.c
@@ -25,8 +25,9 @@ static int __init init_pit(char* override)
25{ 25{
26 /* check clock override */ 26 /* check clock override */
27 if (override[0] && strncmp(override,"pit",3)) 27 if (override[0] && strncmp(override,"pit",3))
28 printk(KERN_ERR "Warning: clock= override failed. Defaulting to PIT\n"); 28 printk(KERN_ERR "Warning: clock= override failed. Defaulting "
29 29 "to PIT\n");
30 init_cpu_khz();
30 count_p = LATCH; 31 count_p = LATCH;
31 return 0; 32 return 0;
32} 33}
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c
index 542d9298da5e..06e26f006238 100644
--- a/arch/i386/mm/init.c
+++ b/arch/i386/mm/init.c
@@ -28,6 +28,7 @@
28#include <linux/proc_fs.h> 28#include <linux/proc_fs.h>
29#include <linux/efi.h> 29#include <linux/efi.h>
30#include <linux/memory_hotplug.h> 30#include <linux/memory_hotplug.h>
31#include <linux/initrd.h>
31 32
32#include <asm/processor.h> 33#include <asm/processor.h>
33#include <asm/system.h> 34#include <asm/system.h>
@@ -267,7 +268,7 @@ static void __init permanent_kmaps_init(pgd_t *pgd_base)
267 pkmap_page_table = pte; 268 pkmap_page_table = pte;
268} 269}
269 270
270void __devinit free_new_highpage(struct page *page) 271static void __devinit free_new_highpage(struct page *page)
271{ 272{
272 set_page_count(page, 1); 273 set_page_count(page, 1);
273 __free_page(page); 274 __free_page(page);
diff --git a/arch/m68k/fpsp040/skeleton.S b/arch/m68k/fpsp040/skeleton.S
index 9571a21d6ad4..a1629194e3fd 100644
--- a/arch/m68k/fpsp040/skeleton.S
+++ b/arch/m68k/fpsp040/skeleton.S
@@ -381,10 +381,8 @@ fpsp_done:
381.Lnotkern: 381.Lnotkern:
382 SAVE_ALL_INT 382 SAVE_ALL_INT
383 GET_CURRENT(%d0) 383 GET_CURRENT(%d0)
384 tstb %curptr@(TASK_NEEDRESCHED) 384 | deliver signals, reschedule etc..
385 jne ret_from_exception | deliver signals, 385 jra ret_from_exception
386 | reschedule etc..
387 RESTORE_ALL
388 386
389| 387|
390| mem_write --- write to user or supervisor address space 388| mem_write --- write to user or supervisor address space
diff --git a/arch/m68k/ifpsp060/iskeleton.S b/arch/m68k/ifpsp060/iskeleton.S
index 4ba2c74da93d..b2dbdf5ee309 100644
--- a/arch/m68k/ifpsp060/iskeleton.S
+++ b/arch/m68k/ifpsp060/iskeleton.S
@@ -75,10 +75,8 @@ _060_isp_done:
75.Lnotkern: 75.Lnotkern:
76 SAVE_ALL_INT 76 SAVE_ALL_INT
77 GET_CURRENT(%d0) 77 GET_CURRENT(%d0)
78 tstb %curptr@(TASK_NEEDRESCHED) 78 | deliver signals, reschedule etc..
79 jne ret_from_exception | deliver signals, 79 jra ret_from_exception
80 | reschedule etc..
81 RESTORE_ALL
82 80
83| 81|
84| _060_real_chk(): 82| _060_real_chk():
diff --git a/arch/m68k/kernel/asm-offsets.c b/arch/m68k/kernel/asm-offsets.c
index cee3317b8665..c787c5ba9513 100644
--- a/arch/m68k/kernel/asm-offsets.c
+++ b/arch/m68k/kernel/asm-offsets.c
@@ -25,12 +25,8 @@ int main(void)
25 DEFINE(TASK_STATE, offsetof(struct task_struct, state)); 25 DEFINE(TASK_STATE, offsetof(struct task_struct, state));
26 DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags)); 26 DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags));
27 DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace)); 27 DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace));
28 DEFINE(TASK_WORK, offsetof(struct task_struct, thread.work));
29 DEFINE(TASK_NEEDRESCHED, offsetof(struct task_struct, thread.work.need_resched));
30 DEFINE(TASK_SYSCALL_TRACE, offsetof(struct task_struct, thread.work.syscall_trace));
31 DEFINE(TASK_SIGPENDING, offsetof(struct task_struct, thread.work.sigpending));
32 DEFINE(TASK_NOTIFY_RESUME, offsetof(struct task_struct, thread.work.notify_resume));
33 DEFINE(TASK_THREAD, offsetof(struct task_struct, thread)); 28 DEFINE(TASK_THREAD, offsetof(struct task_struct, thread));
29 DEFINE(TASK_INFO, offsetof(struct task_struct, thread.info));
34 DEFINE(TASK_MM, offsetof(struct task_struct, mm)); 30 DEFINE(TASK_MM, offsetof(struct task_struct, mm));
35 DEFINE(TASK_ACTIVE_MM, offsetof(struct task_struct, active_mm)); 31 DEFINE(TASK_ACTIVE_MM, offsetof(struct task_struct, active_mm));
36 32
@@ -45,6 +41,10 @@ int main(void)
45 DEFINE(THREAD_FPCNTL, offsetof(struct thread_struct, fpcntl)); 41 DEFINE(THREAD_FPCNTL, offsetof(struct thread_struct, fpcntl));
46 DEFINE(THREAD_FPSTATE, offsetof(struct thread_struct, fpstate)); 42 DEFINE(THREAD_FPSTATE, offsetof(struct thread_struct, fpstate));
47 43
44 /* offsets into the thread_info struct */
45 DEFINE(TINFO_PREEMPT, offsetof(struct thread_info, preempt_count));
46 DEFINE(TINFO_FLAGS, offsetof(struct thread_info, flags));
47
48 /* offsets into the pt_regs */ 48 /* offsets into the pt_regs */
49 DEFINE(PT_D0, offsetof(struct pt_regs, d0)); 49 DEFINE(PT_D0, offsetof(struct pt_regs, d0));
50 DEFINE(PT_ORIG_D0, offsetof(struct pt_regs, orig_d0)); 50 DEFINE(PT_ORIG_D0, offsetof(struct pt_regs, orig_d0));
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
index 23ca60a45552..320fde05dc63 100644
--- a/arch/m68k/kernel/entry.S
+++ b/arch/m68k/kernel/entry.S
@@ -44,9 +44,7 @@
44 44
45#include <asm/asm-offsets.h> 45#include <asm/asm-offsets.h>
46 46
47.globl system_call, buserr, trap 47.globl system_call, buserr, trap, resume
48.globl resume, ret_from_exception
49.globl ret_from_signal
50.globl inthandler, sys_call_table 48.globl inthandler, sys_call_table
51.globl sys_fork, sys_clone, sys_vfork 49.globl sys_fork, sys_clone, sys_vfork
52.globl ret_from_interrupt, bad_interrupt 50.globl ret_from_interrupt, bad_interrupt
@@ -58,7 +56,7 @@ ENTRY(buserr)
58 movel %sp,%sp@- | stack frame pointer argument 56 movel %sp,%sp@- | stack frame pointer argument
59 bsrl buserr_c 57 bsrl buserr_c
60 addql #4,%sp 58 addql #4,%sp
61 jra ret_from_exception 59 jra .Lret_from_exception
62 60
63ENTRY(trap) 61ENTRY(trap)
64 SAVE_ALL_INT 62 SAVE_ALL_INT
@@ -66,7 +64,7 @@ ENTRY(trap)
66 movel %sp,%sp@- | stack frame pointer argument 64 movel %sp,%sp@- | stack frame pointer argument
67 bsrl trap_c 65 bsrl trap_c
68 addql #4,%sp 66 addql #4,%sp
69 jra ret_from_exception 67 jra .Lret_from_exception
70 68
71 | After a fork we jump here directly from resume, 69 | After a fork we jump here directly from resume,
72 | so that %d1 contains the previous task 70 | so that %d1 contains the previous task
@@ -75,30 +73,31 @@ ENTRY(ret_from_fork)
75 movel %d1,%sp@- 73 movel %d1,%sp@-
76 jsr schedule_tail 74 jsr schedule_tail
77 addql #4,%sp 75 addql #4,%sp
78 jra ret_from_exception 76 jra .Lret_from_exception
79 77
80badsys: 78do_trace_entry:
81 movel #-ENOSYS,%sp@(PT_D0)
82 jra ret_from_exception
83
84do_trace:
85 movel #-ENOSYS,%sp@(PT_D0) | needed for strace 79 movel #-ENOSYS,%sp@(PT_D0) | needed for strace
86 subql #4,%sp 80 subql #4,%sp
87 SAVE_SWITCH_STACK 81 SAVE_SWITCH_STACK
88 jbsr syscall_trace 82 jbsr syscall_trace
89 RESTORE_SWITCH_STACK 83 RESTORE_SWITCH_STACK
90 addql #4,%sp 84 addql #4,%sp
91 movel %sp@(PT_ORIG_D0),%d1 85 movel %sp@(PT_ORIG_D0),%d0
92 movel #-ENOSYS,%d0 86 cmpl #NR_syscalls,%d0
93 cmpl #NR_syscalls,%d1 87 jcs syscall
94 jcc 1f 88badsys:
95 jbsr @(sys_call_table,%d1:l:4)@(0) 89 movel #-ENOSYS,%sp@(PT_D0)
961: movel %d0,%sp@(PT_D0) | save the return value 90 jra ret_from_syscall
97 subql #4,%sp | dummy return address 91
92do_trace_exit:
93 subql #4,%sp
98 SAVE_SWITCH_STACK 94 SAVE_SWITCH_STACK
99 jbsr syscall_trace 95 jbsr syscall_trace
96 RESTORE_SWITCH_STACK
97 addql #4,%sp
98 jra .Lret_from_exception
100 99
101ret_from_signal: 100ENTRY(ret_from_signal)
102 RESTORE_SWITCH_STACK 101 RESTORE_SWITCH_STACK
103 addql #4,%sp 102 addql #4,%sp
104/* on 68040 complete pending writebacks if any */ 103/* on 68040 complete pending writebacks if any */
@@ -111,7 +110,7 @@ ret_from_signal:
111 addql #4,%sp 110 addql #4,%sp
1121: 1111:
113#endif 112#endif
114 jra ret_from_exception 113 jra .Lret_from_exception
115 114
116ENTRY(system_call) 115ENTRY(system_call)
117 SAVE_ALL_SYS 116 SAVE_ALL_SYS
@@ -120,30 +119,34 @@ ENTRY(system_call)
120 | save top of frame 119 | save top of frame
121 movel %sp,%curptr@(TASK_THREAD+THREAD_ESP0) 120 movel %sp,%curptr@(TASK_THREAD+THREAD_ESP0)
122 121
123 tstb %curptr@(TASK_SYSCALL_TRACE) 122 | syscall trace?
124 jne do_trace 123 tstb %curptr@(TASK_INFO+TINFO_FLAGS+2)
124 jmi do_trace_entry
125 cmpl #NR_syscalls,%d0 125 cmpl #NR_syscalls,%d0
126 jcc badsys 126 jcc badsys
127syscall:
127 jbsr @(sys_call_table,%d0:l:4)@(0) 128 jbsr @(sys_call_table,%d0:l:4)@(0)
128 movel %d0,%sp@(PT_D0) | save the return value 129 movel %d0,%sp@(PT_D0) | save the return value
129 130ret_from_syscall:
130 |oriw #0x0700,%sr 131 |oriw #0x0700,%sr
131 movel %curptr@(TASK_WORK),%d0 132 movew %curptr@(TASK_INFO+TINFO_FLAGS+2),%d0
132 jne syscall_exit_work 133 jne syscall_exit_work
1331: RESTORE_ALL 1341: RESTORE_ALL
134 135
135syscall_exit_work: 136syscall_exit_work:
136 btst #5,%sp@(PT_SR) | check if returning to kernel 137 btst #5,%sp@(PT_SR) | check if returning to kernel
137 bnes 1b | if so, skip resched, signals 138 bnes 1b | if so, skip resched, signals
138 tstw %d0 139 lslw #1,%d0
139 jeq do_signal_return 140 jcs do_trace_exit
140 tstb %d0 141 jmi do_delayed_trace
141 jne do_delayed_trace 142 lslw #8,%d0
142 143 jmi do_signal_return
143 pea resume_userspace 144 pea resume_userspace
144 jmp schedule 145 jra schedule
146
145 147
146ret_from_exception: 148ENTRY(ret_from_exception)
149.Lret_from_exception:
147 btst #5,%sp@(PT_SR) | check if returning to kernel 150 btst #5,%sp@(PT_SR) | check if returning to kernel
148 bnes 1f | if so, skip resched, signals 151 bnes 1f | if so, skip resched, signals
149 | only allow interrupts when we are really the last one on the 152 | only allow interrupts when we are really the last one on the
@@ -152,19 +155,18 @@ ret_from_exception:
152 andw #ALLOWINT,%sr 155 andw #ALLOWINT,%sr
153 156
154resume_userspace: 157resume_userspace:
155 movel %curptr@(TASK_WORK),%d0 158 moveb %curptr@(TASK_INFO+TINFO_FLAGS+3),%d0
156 lsrl #8,%d0
157 jne exit_work 159 jne exit_work
1581: RESTORE_ALL 1601: RESTORE_ALL
159 161
160exit_work: 162exit_work:
161 | save top of frame 163 | save top of frame
162 movel %sp,%curptr@(TASK_THREAD+THREAD_ESP0) 164 movel %sp,%curptr@(TASK_THREAD+THREAD_ESP0)
163 tstb %d0 165 lslb #1,%d0
164 jeq do_signal_return 166 jmi do_signal_return
165
166 pea resume_userspace 167 pea resume_userspace
167 jmp schedule 168 jra schedule
169
168 170
169do_signal_return: 171do_signal_return:
170 |andw #ALLOWINT,%sr 172 |andw #ALLOWINT,%sr
@@ -254,7 +256,7 @@ ret_from_interrupt:
254 256
255 /* check if we need to do software interrupts */ 257 /* check if we need to do software interrupts */
256 tstl irq_stat+CPUSTAT_SOFTIRQ_PENDING 258 tstl irq_stat+CPUSTAT_SOFTIRQ_PENDING
257 jeq ret_from_exception 259 jeq .Lret_from_exception
258 pea ret_from_exception 260 pea ret_from_exception
259 jra do_softirq 261 jra do_softirq
260 262
diff --git a/arch/m68k/kernel/ptrace.c b/arch/m68k/kernel/ptrace.c
index 7e54422685cf..540638ca81f9 100644
--- a/arch/m68k/kernel/ptrace.c
+++ b/arch/m68k/kernel/ptrace.c
@@ -109,7 +109,7 @@ static inline void singlestep_disable(struct task_struct *child)
109{ 109{
110 unsigned long tmp = get_reg(child, PT_SR) & ~(TRACE_BITS << 16); 110 unsigned long tmp = get_reg(child, PT_SR) & ~(TRACE_BITS << 16);
111 put_reg(child, PT_SR, tmp); 111 put_reg(child, PT_SR, tmp);
112 child->thread.work.delayed_trace = 0; 112 clear_tsk_thread_flag(child, TIF_DELAYED_TRACE);
113} 113}
114 114
115/* 115/*
@@ -118,7 +118,7 @@ static inline void singlestep_disable(struct task_struct *child)
118void ptrace_disable(struct task_struct *child) 118void ptrace_disable(struct task_struct *child)
119{ 119{
120 singlestep_disable(child); 120 singlestep_disable(child);
121 child->thread.work.syscall_trace = 0; 121 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
122} 122}
123 123
124long arch_ptrace(struct task_struct *child, long request, long addr, long data) 124long arch_ptrace(struct task_struct *child, long request, long addr, long data)
@@ -198,9 +198,9 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
198 goto out_eio; 198 goto out_eio;
199 199
200 if (request == PTRACE_SYSCALL) 200 if (request == PTRACE_SYSCALL)
201 child->thread.work.syscall_trace = ~0; 201 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
202 else 202 else
203 child->thread.work.syscall_trace = 0; 203 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
204 child->exit_code = data; 204 child->exit_code = data;
205 singlestep_disable(child); 205 singlestep_disable(child);
206 wake_up_process(child); 206 wake_up_process(child);
@@ -223,10 +223,10 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
223 if (!valid_signal(data)) 223 if (!valid_signal(data))
224 goto out_eio; 224 goto out_eio;
225 225
226 child->thread.work.syscall_trace = 0; 226 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
227 tmp = get_reg(child, PT_SR) | (TRACE_BITS << 16); 227 tmp = get_reg(child, PT_SR) | (TRACE_BITS << 16);
228 put_reg(child, PT_SR, tmp); 228 put_reg(child, PT_SR, tmp);
229 child->thread.work.delayed_trace = 1; 229 set_tsk_thread_flag(child, TIF_DELAYED_TRACE);
230 230
231 child->exit_code = data; 231 child->exit_code = data;
232 /* give it a chance to run. */ 232 /* give it a chance to run. */
@@ -288,9 +288,6 @@ out_eio:
288 288
289asmlinkage void syscall_trace(void) 289asmlinkage void syscall_trace(void)
290{ 290{
291 if (!current->thread.work.delayed_trace &&
292 !current->thread.work.syscall_trace)
293 return;
294 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) 291 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
295 ? 0x80 : 0)); 292 ? 0x80 : 0));
296 /* 293 /*
diff --git a/arch/mips/au1000/common/power.c b/arch/mips/au1000/common/power.c
index f85093b8d54d..f4926315fb68 100644
--- a/arch/mips/au1000/common/power.c
+++ b/arch/mips/au1000/common/power.c
@@ -32,6 +32,7 @@
32#include <linux/config.h> 32#include <linux/config.h>
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/pm.h> 34#include <linux/pm.h>
35#include <linux/pm_legacy.h>
35#include <linux/slab.h> 36#include <linux/slab.h>
36#include <linux/sysctl.h> 37#include <linux/sysctl.h>
37#include <linux/jiffies.h> 38#include <linux/jiffies.h>
diff --git a/arch/mips/au1000/common/usbdev.c b/arch/mips/au1000/common/usbdev.c
index 0b21bed7ee55..2cab7629702c 100644
--- a/arch/mips/au1000/common/usbdev.c
+++ b/arch/mips/au1000/common/usbdev.c
@@ -348,7 +348,7 @@ endpoint_stall(endpoint_t * ep)
348{ 348{
349 u32 cs; 349 u32 cs;
350 350
351 warn(__FUNCTION__); 351 warn("%s", __FUNCTION__);
352 352
353 cs = au_readl(ep->reg->ctrl_stat) | USBDEV_CS_STALL; 353 cs = au_readl(ep->reg->ctrl_stat) | USBDEV_CS_STALL;
354 au_writel(cs, ep->reg->ctrl_stat); 354 au_writel(cs, ep->reg->ctrl_stat);
@@ -360,7 +360,7 @@ endpoint_unstall(endpoint_t * ep)
360{ 360{
361 u32 cs; 361 u32 cs;
362 362
363 warn(__FUNCTION__); 363 warn("%s", __FUNCTION__);
364 364
365 cs = au_readl(ep->reg->ctrl_stat) & ~USBDEV_CS_STALL; 365 cs = au_readl(ep->reg->ctrl_stat) & ~USBDEV_CS_STALL;
366 au_writel(cs, ep->reg->ctrl_stat); 366 au_writel(cs, ep->reg->ctrl_stat);
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 5bc11bd36c1f..d41ad2e675db 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -187,7 +187,7 @@ archprepare: checkbin
187 187
188# Temporary hack until we have migrated to asm-powerpc 188# Temporary hack until we have migrated to asm-powerpc
189include/asm: arch/$(ARCH)/include/asm 189include/asm: arch/$(ARCH)/include/asm
190arch/$(ARCH)/include/asm: 190arch/$(ARCH)/include/asm: FORCE
191 $(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi 191 $(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi
192 $(Q)ln -fsn $(srctree)/include/asm-$(OLDARCH) arch/$(ARCH)/include/asm 192 $(Q)ln -fsn $(srctree)/include/asm-$(OLDARCH) arch/$(ARCH)/include/asm
193 193
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index 9f09dff9e11a..913962c1dae0 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -1,18 +1,33 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14-rc4 3# Linux kernel version: 2.6.15-rc1
4# Thu Oct 20 08:32:17 2005 4# Mon Nov 14 15:27:00 2005
5# 5#
6CONFIG_PPC64=y
6CONFIG_64BIT=y 7CONFIG_64BIT=y
8CONFIG_PPC_MERGE=y
7CONFIG_MMU=y 9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y 11CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y 12CONFIG_GENERIC_CALIBRATE_DELAY=y
10CONFIG_GENERIC_ISA_DMA=y 13CONFIG_PPC=y
11CONFIG_EARLY_PRINTK=y 14CONFIG_EARLY_PRINTK=y
12CONFIG_COMPAT=y 15CONFIG_COMPAT=y
16CONFIG_SYSVIPC_COMPAT=y
13CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 17CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
14CONFIG_ARCH_MAY_HAVE_PC_FDC=y 18CONFIG_ARCH_MAY_HAVE_PC_FDC=y
15CONFIG_FORCE_MAX_ZONEORDER=13 19
20#
21# Processor support
22#
23# CONFIG_POWER4_ONLY is not set
24CONFIG_POWER3=y
25CONFIG_POWER4=y
26CONFIG_PPC_FPU=y
27CONFIG_ALTIVEC=y
28CONFIG_PPC_STD_MMU=y
29CONFIG_SMP=y
30CONFIG_NR_CPUS=128
16 31
17# 32#
18# Code maturity level options 33# Code maturity level options
@@ -68,75 +83,103 @@ CONFIG_MODVERSIONS=y
68CONFIG_MODULE_SRCVERSION_ALL=y 83CONFIG_MODULE_SRCVERSION_ALL=y
69CONFIG_KMOD=y 84CONFIG_KMOD=y
70CONFIG_STOP_MACHINE=y 85CONFIG_STOP_MACHINE=y
71CONFIG_SYSVIPC_COMPAT=y 86
87#
88# Block layer
89#
90
91#
92# IO Schedulers
93#
94CONFIG_IOSCHED_NOOP=y
95CONFIG_IOSCHED_AS=y
96CONFIG_IOSCHED_DEADLINE=y
97CONFIG_IOSCHED_CFQ=y
98CONFIG_DEFAULT_AS=y
99# CONFIG_DEFAULT_DEADLINE is not set
100# CONFIG_DEFAULT_CFQ is not set
101# CONFIG_DEFAULT_NOOP is not set
102CONFIG_DEFAULT_IOSCHED="anticipatory"
72 103
73# 104#
74# Platform support 105# Platform support
75# 106#
76# CONFIG_PPC_ISERIES is not set
77CONFIG_PPC_MULTIPLATFORM=y 107CONFIG_PPC_MULTIPLATFORM=y
108# CONFIG_PPC_ISERIES is not set
109# CONFIG_EMBEDDED6xx is not set
110# CONFIG_APUS is not set
78CONFIG_PPC_PSERIES=y 111CONFIG_PPC_PSERIES=y
79# CONFIG_PPC_BPA is not set
80# CONFIG_PPC_PMAC is not set 112# CONFIG_PPC_PMAC is not set
81# CONFIG_PPC_MAPLE is not set 113# CONFIG_PPC_MAPLE is not set
82CONFIG_PPC=y 114# CONFIG_PPC_CELL is not set
83CONFIG_PPC64=y
84CONFIG_PPC_OF=y 115CONFIG_PPC_OF=y
85CONFIG_XICS=y 116CONFIG_XICS=y
117# CONFIG_U3_DART is not set
86CONFIG_MPIC=y 118CONFIG_MPIC=y
87CONFIG_ALTIVEC=y 119CONFIG_PPC_RTAS=y
88CONFIG_PPC_SPLPAR=y 120CONFIG_RTAS_ERROR_LOGGING=y
89CONFIG_KEXEC=y 121CONFIG_RTAS_PROC=y
122CONFIG_RTAS_FLASH=m
123# CONFIG_MMIO_NVRAM is not set
90CONFIG_IBMVIO=y 124CONFIG_IBMVIO=y
91# CONFIG_U3_DART is not set 125# CONFIG_PPC_MPC106 is not set
92# CONFIG_BOOTX_TEXT is not set 126# CONFIG_GENERIC_TBSYNC is not set
93# CONFIG_POWER4_ONLY is not set 127# CONFIG_CPU_FREQ is not set
128# CONFIG_WANT_EARLY_SERIAL is not set
129
130#
131# Kernel options
132#
133# CONFIG_HZ_100 is not set
134CONFIG_HZ_250=y
135# CONFIG_HZ_1000 is not set
136CONFIG_HZ=250
137CONFIG_PREEMPT_NONE=y
138# CONFIG_PREEMPT_VOLUNTARY is not set
139# CONFIG_PREEMPT is not set
140# CONFIG_PREEMPT_BKL is not set
141CONFIG_BINFMT_ELF=y
142# CONFIG_BINFMT_MISC is not set
143CONFIG_FORCE_MAX_ZONEORDER=13
94CONFIG_IOMMU_VMERGE=y 144CONFIG_IOMMU_VMERGE=y
95CONFIG_SMP=y 145CONFIG_HOTPLUG_CPU=y
96CONFIG_NR_CPUS=128 146CONFIG_KEXEC=y
147# CONFIG_IRQ_ALL_CPUS is not set
148CONFIG_PPC_SPLPAR=y
149CONFIG_EEH=y
150CONFIG_SCANLOG=m
151CONFIG_LPARCFG=y
152CONFIG_NUMA=y
97CONFIG_ARCH_SELECT_MEMORY_MODEL=y 153CONFIG_ARCH_SELECT_MEMORY_MODEL=y
98CONFIG_ARCH_FLATMEM_ENABLE=y
99CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
100CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
101CONFIG_ARCH_SPARSEMEM_ENABLE=y 154CONFIG_ARCH_SPARSEMEM_ENABLE=y
155CONFIG_ARCH_SPARSEMEM_DEFAULT=y
102CONFIG_SELECT_MEMORY_MODEL=y 156CONFIG_SELECT_MEMORY_MODEL=y
103# CONFIG_FLATMEM_MANUAL is not set 157# CONFIG_FLATMEM_MANUAL is not set
104CONFIG_DISCONTIGMEM_MANUAL=y 158# CONFIG_DISCONTIGMEM_MANUAL is not set
105# CONFIG_SPARSEMEM_MANUAL is not set 159CONFIG_SPARSEMEM_MANUAL=y
106CONFIG_DISCONTIGMEM=y 160CONFIG_SPARSEMEM=y
107CONFIG_FLAT_NODE_MEM_MAP=y
108CONFIG_NEED_MULTIPLE_NODES=y 161CONFIG_NEED_MULTIPLE_NODES=y
162CONFIG_HAVE_MEMORY_PRESENT=y
109# CONFIG_SPARSEMEM_STATIC is not set 163# CONFIG_SPARSEMEM_STATIC is not set
164CONFIG_SPARSEMEM_EXTREME=y
165# CONFIG_MEMORY_HOTPLUG is not set
166CONFIG_SPLIT_PTLOCK_CPUS=4096
110CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y 167CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
111CONFIG_NODES_SPAN_OTHER_NODES=y 168CONFIG_NODES_SPAN_OTHER_NODES=y
112CONFIG_NUMA=y 169# CONFIG_PPC_64K_PAGES is not set
113CONFIG_SCHED_SMT=y 170CONFIG_SCHED_SMT=y
114CONFIG_PREEMPT_NONE=y
115# CONFIG_PREEMPT_VOLUNTARY is not set
116# CONFIG_PREEMPT is not set
117# CONFIG_PREEMPT_BKL is not set
118# CONFIG_HZ_100 is not set
119CONFIG_HZ_250=y
120# CONFIG_HZ_1000 is not set
121CONFIG_HZ=250
122CONFIG_EEH=y
123CONFIG_GENERIC_HARDIRQS=y
124CONFIG_PPC_RTAS=y
125CONFIG_RTAS_PROC=y
126CONFIG_RTAS_FLASH=m
127CONFIG_SCANLOG=m
128CONFIG_LPARCFG=y
129CONFIG_SECCOMP=y
130CONFIG_BINFMT_ELF=y
131# CONFIG_BINFMT_MISC is not set
132CONFIG_HOTPLUG_CPU=y
133CONFIG_PROC_DEVICETREE=y 171CONFIG_PROC_DEVICETREE=y
134# CONFIG_CMDLINE_BOOL is not set 172# CONFIG_CMDLINE_BOOL is not set
173# CONFIG_PM is not set
174CONFIG_SECCOMP=y
135CONFIG_ISA_DMA_API=y 175CONFIG_ISA_DMA_API=y
136 176
137# 177#
138# Bus Options 178# Bus options
139# 179#
180CONFIG_GENERIC_ISA_DMA=y
181CONFIG_PPC_I8259=y
182# CONFIG_PPC_INDIRECT_PCI is not set
140CONFIG_PCI=y 183CONFIG_PCI=y
141CONFIG_PCI_DOMAINS=y 184CONFIG_PCI_DOMAINS=y
142CONFIG_PCI_LEGACY_PROC=y 185CONFIG_PCI_LEGACY_PROC=y
@@ -156,6 +199,7 @@ CONFIG_HOTPLUG_PCI=m
156# CONFIG_HOTPLUG_PCI_SHPC is not set 199# CONFIG_HOTPLUG_PCI_SHPC is not set
157CONFIG_HOTPLUG_PCI_RPA=m 200CONFIG_HOTPLUG_PCI_RPA=m
158CONFIG_HOTPLUG_PCI_RPA_DLPAR=m 201CONFIG_HOTPLUG_PCI_RPA_DLPAR=m
202CONFIG_KERNEL_START=0xc000000000000000
159 203
160# 204#
161# Networking 205# Networking
@@ -197,6 +241,10 @@ CONFIG_TCP_CONG_BIC=y
197# CONFIG_IPV6 is not set 241# CONFIG_IPV6 is not set
198CONFIG_NETFILTER=y 242CONFIG_NETFILTER=y
199# CONFIG_NETFILTER_DEBUG is not set 243# CONFIG_NETFILTER_DEBUG is not set
244
245#
246# Core Netfilter Configuration
247#
200CONFIG_NETFILTER_NETLINK=y 248CONFIG_NETFILTER_NETLINK=y
201CONFIG_NETFILTER_NETLINK_QUEUE=m 249CONFIG_NETFILTER_NETLINK_QUEUE=m
202CONFIG_NETFILTER_NETLINK_LOG=m 250CONFIG_NETFILTER_NETLINK_LOG=m
@@ -299,6 +347,10 @@ CONFIG_LLC=y
299# CONFIG_NET_DIVERT is not set 347# CONFIG_NET_DIVERT is not set
300# CONFIG_ECONET is not set 348# CONFIG_ECONET is not set
301# CONFIG_WAN_ROUTER is not set 349# CONFIG_WAN_ROUTER is not set
350
351#
352# QoS and/or fair queueing
353#
302# CONFIG_NET_SCHED is not set 354# CONFIG_NET_SCHED is not set
303CONFIG_NET_CLS_ROUTE=y 355CONFIG_NET_CLS_ROUTE=y
304 356
@@ -368,14 +420,6 @@ CONFIG_BLK_DEV_RAM_COUNT=16
368CONFIG_BLK_DEV_RAM_SIZE=65536 420CONFIG_BLK_DEV_RAM_SIZE=65536
369CONFIG_BLK_DEV_INITRD=y 421CONFIG_BLK_DEV_INITRD=y
370# CONFIG_CDROM_PKTCDVD is not set 422# CONFIG_CDROM_PKTCDVD is not set
371
372#
373# IO Schedulers
374#
375CONFIG_IOSCHED_NOOP=y
376CONFIG_IOSCHED_AS=y
377CONFIG_IOSCHED_DEADLINE=y
378CONFIG_IOSCHED_CFQ=y
379# CONFIG_ATA_OVER_ETH is not set 423# CONFIG_ATA_OVER_ETH is not set
380 424
381# 425#
@@ -473,6 +517,7 @@ CONFIG_SCSI_ISCSI_ATTRS=m
473# 517#
474# SCSI low-level drivers 518# SCSI low-level drivers
475# 519#
520# CONFIG_ISCSI_TCP is not set
476# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 521# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
477# CONFIG_SCSI_3W_9XXX is not set 522# CONFIG_SCSI_3W_9XXX is not set
478# CONFIG_SCSI_ACARD is not set 523# CONFIG_SCSI_ACARD is not set
@@ -559,6 +604,7 @@ CONFIG_DM_MULTIPATH_EMC=m
559# 604#
560# Macintosh device drivers 605# Macintosh device drivers
561# 606#
607# CONFIG_WINDFARM is not set
562 608
563# 609#
564# Network device support 610# Network device support
@@ -645,7 +691,6 @@ CONFIG_IXGB=m
645# CONFIG_IXGB_NAPI is not set 691# CONFIG_IXGB_NAPI is not set
646CONFIG_S2IO=m 692CONFIG_S2IO=m
647# CONFIG_S2IO_NAPI is not set 693# CONFIG_S2IO_NAPI is not set
648# CONFIG_2BUFF_MODE is not set
649 694
650# 695#
651# Token Ring devices 696# Token Ring devices
@@ -674,6 +719,7 @@ CONFIG_PPP_ASYNC=m
674CONFIG_PPP_SYNC_TTY=m 719CONFIG_PPP_SYNC_TTY=m
675CONFIG_PPP_DEFLATE=m 720CONFIG_PPP_DEFLATE=m
676CONFIG_PPP_BSDCOMP=m 721CONFIG_PPP_BSDCOMP=m
722# CONFIG_PPP_MPPE is not set
677CONFIG_PPPOE=m 723CONFIG_PPPOE=m
678# CONFIG_SLIP is not set 724# CONFIG_SLIP is not set
679# CONFIG_NET_FC is not set 725# CONFIG_NET_FC is not set
@@ -784,6 +830,8 @@ CONFIG_HVCS=m
784# 830#
785# CONFIG_WATCHDOG is not set 831# CONFIG_WATCHDOG is not set
786# CONFIG_RTC is not set 832# CONFIG_RTC is not set
833CONFIG_GEN_RTC=y
834# CONFIG_GEN_RTC_X is not set
787# CONFIG_DTLK is not set 835# CONFIG_DTLK is not set
788# CONFIG_R3964 is not set 836# CONFIG_R3964 is not set
789# CONFIG_APPLICOM is not set 837# CONFIG_APPLICOM is not set
@@ -801,6 +849,7 @@ CONFIG_MAX_RAW_DEVS=1024
801# TPM devices 849# TPM devices
802# 850#
803# CONFIG_TCG_TPM is not set 851# CONFIG_TCG_TPM is not set
852# CONFIG_TELCLOCK is not set
804 853
805# 854#
806# I2C support 855# I2C support
@@ -852,6 +901,7 @@ CONFIG_I2C_ALGOBIT=y
852# CONFIG_SENSORS_PCF8591 is not set 901# CONFIG_SENSORS_PCF8591 is not set
853# CONFIG_SENSORS_RTC8564 is not set 902# CONFIG_SENSORS_RTC8564 is not set
854# CONFIG_SENSORS_MAX6875 is not set 903# CONFIG_SENSORS_MAX6875 is not set
904# CONFIG_RTC_X1205_I2C is not set
855# CONFIG_I2C_DEBUG_CORE is not set 905# CONFIG_I2C_DEBUG_CORE is not set
856# CONFIG_I2C_DEBUG_ALGO is not set 906# CONFIG_I2C_DEBUG_ALGO is not set
857# CONFIG_I2C_DEBUG_BUS is not set 907# CONFIG_I2C_DEBUG_BUS is not set
@@ -893,7 +943,6 @@ CONFIG_FB=y
893CONFIG_FB_CFB_FILLRECT=y 943CONFIG_FB_CFB_FILLRECT=y
894CONFIG_FB_CFB_COPYAREA=y 944CONFIG_FB_CFB_COPYAREA=y
895CONFIG_FB_CFB_IMAGEBLIT=y 945CONFIG_FB_CFB_IMAGEBLIT=y
896CONFIG_FB_SOFT_CURSOR=y
897CONFIG_FB_MACMODES=y 946CONFIG_FB_MACMODES=y
898CONFIG_FB_MODE_HELPERS=y 947CONFIG_FB_MODE_HELPERS=y
899CONFIG_FB_TILEBLITTING=y 948CONFIG_FB_TILEBLITTING=y
@@ -905,6 +954,7 @@ CONFIG_FB_OF=y
905# CONFIG_FB_ASILIANT is not set 954# CONFIG_FB_ASILIANT is not set
906# CONFIG_FB_IMSTT is not set 955# CONFIG_FB_IMSTT is not set
907# CONFIG_FB_VGA16 is not set 956# CONFIG_FB_VGA16 is not set
957# CONFIG_FB_S1D13XXX is not set
908# CONFIG_FB_NVIDIA is not set 958# CONFIG_FB_NVIDIA is not set
909# CONFIG_FB_RIVA is not set 959# CONFIG_FB_RIVA is not set
910CONFIG_FB_MATROX=y 960CONFIG_FB_MATROX=y
@@ -927,7 +977,6 @@ CONFIG_FB_RADEON_I2C=y
927# CONFIG_FB_VOODOO1 is not set 977# CONFIG_FB_VOODOO1 is not set
928# CONFIG_FB_CYBLA is not set 978# CONFIG_FB_CYBLA is not set
929# CONFIG_FB_TRIDENT is not set 979# CONFIG_FB_TRIDENT is not set
930# CONFIG_FB_S1D13XXX is not set
931# CONFIG_FB_VIRTUAL is not set 980# CONFIG_FB_VIRTUAL is not set
932 981
933# 982#
@@ -936,6 +985,7 @@ CONFIG_FB_RADEON_I2C=y
936# CONFIG_VGA_CONSOLE is not set 985# CONFIG_VGA_CONSOLE is not set
937CONFIG_DUMMY_CONSOLE=y 986CONFIG_DUMMY_CONSOLE=y
938CONFIG_FRAMEBUFFER_CONSOLE=y 987CONFIG_FRAMEBUFFER_CONSOLE=y
988# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
939# CONFIG_FONTS is not set 989# CONFIG_FONTS is not set
940CONFIG_FONT_8x8=y 990CONFIG_FONT_8x8=y
941CONFIG_FONT_8x16=y 991CONFIG_FONT_8x16=y
@@ -990,12 +1040,15 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
990# 1040#
991# USB Device Class drivers 1041# USB Device Class drivers
992# 1042#
993# CONFIG_USB_BLUETOOTH_TTY is not set
994# CONFIG_USB_ACM is not set 1043# CONFIG_USB_ACM is not set
995# CONFIG_USB_PRINTER is not set 1044# CONFIG_USB_PRINTER is not set
996 1045
997# 1046#
998# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information 1047# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
1048#
1049
1050#
1051# may also be needed; see USB_STORAGE Help for more information
999# 1052#
1000CONFIG_USB_STORAGE=y 1053CONFIG_USB_STORAGE=y
1001# CONFIG_USB_STORAGE_DEBUG is not set 1054# CONFIG_USB_STORAGE_DEBUG is not set
@@ -1106,6 +1159,7 @@ CONFIG_INFINIBAND_MTHCA=m
1106# CONFIG_INFINIBAND_MTHCA_DEBUG is not set 1159# CONFIG_INFINIBAND_MTHCA_DEBUG is not set
1107CONFIG_INFINIBAND_IPOIB=m 1160CONFIG_INFINIBAND_IPOIB=m
1108# CONFIG_INFINIBAND_IPOIB_DEBUG is not set 1161# CONFIG_INFINIBAND_IPOIB_DEBUG is not set
1162# CONFIG_INFINIBAND_SRP is not set
1109 1163
1110# 1164#
1111# SN Devices 1165# SN Devices
@@ -1288,10 +1342,25 @@ CONFIG_NLS_ISO8859_1=y
1288# CONFIG_NLS_UTF8 is not set 1342# CONFIG_NLS_UTF8 is not set
1289 1343
1290# 1344#
1291# Profiling support 1345# Library routines
1346#
1347CONFIG_CRC_CCITT=m
1348# CONFIG_CRC16 is not set
1349CONFIG_CRC32=y
1350CONFIG_LIBCRC32C=m
1351CONFIG_ZLIB_INFLATE=y
1352CONFIG_ZLIB_DEFLATE=m
1353CONFIG_TEXTSEARCH=y
1354CONFIG_TEXTSEARCH_KMP=m
1355CONFIG_TEXTSEARCH_BM=m
1356CONFIG_TEXTSEARCH_FSM=m
1357
1358#
1359# Instrumentation Support
1292# 1360#
1293CONFIG_PROFILING=y 1361CONFIG_PROFILING=y
1294CONFIG_OPROFILE=y 1362CONFIG_OPROFILE=y
1363# CONFIG_KPROBES is not set
1295 1364
1296# 1365#
1297# Kernel hacking 1366# Kernel hacking
@@ -1308,14 +1377,15 @@ CONFIG_DETECT_SOFTLOCKUP=y
1308# CONFIG_DEBUG_KOBJECT is not set 1377# CONFIG_DEBUG_KOBJECT is not set
1309# CONFIG_DEBUG_INFO is not set 1378# CONFIG_DEBUG_INFO is not set
1310CONFIG_DEBUG_FS=y 1379CONFIG_DEBUG_FS=y
1380# CONFIG_DEBUG_VM is not set
1381# CONFIG_RCU_TORTURE_TEST is not set
1311CONFIG_DEBUG_STACKOVERFLOW=y 1382CONFIG_DEBUG_STACKOVERFLOW=y
1312# CONFIG_KPROBES is not set
1313CONFIG_DEBUG_STACK_USAGE=y 1383CONFIG_DEBUG_STACK_USAGE=y
1314CONFIG_DEBUGGER=y 1384CONFIG_DEBUGGER=y
1315CONFIG_XMON=y 1385CONFIG_XMON=y
1316CONFIG_XMON_DEFAULT=y 1386CONFIG_XMON_DEFAULT=y
1317# CONFIG_PPCDBG is not set
1318CONFIG_IRQSTACKS=y 1387CONFIG_IRQSTACKS=y
1388# CONFIG_BOOTX_TEXT is not set
1319 1389
1320# 1390#
1321# Security options 1391# Security options
@@ -1355,17 +1425,3 @@ CONFIG_CRYPTO_TEST=m
1355# 1425#
1356# Hardware crypto devices 1426# Hardware crypto devices
1357# 1427#
1358
1359#
1360# Library routines
1361#
1362CONFIG_CRC_CCITT=m
1363# CONFIG_CRC16 is not set
1364CONFIG_CRC32=y
1365CONFIG_LIBCRC32C=m
1366CONFIG_ZLIB_INFLATE=y
1367CONFIG_ZLIB_DEFLATE=m
1368CONFIG_TEXTSEARCH=y
1369CONFIG_TEXTSEARCH_KMP=m
1370CONFIG_TEXTSEARCH_BM=m
1371CONFIG_TEXTSEARCH_FSM=m
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 9a74b7ab03a4..046b4bf1f21e 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -25,7 +25,7 @@ obj-$(CONFIG_PPC_OF) += of_device.o
25procfs-$(CONFIG_PPC64) := proc_ppc64.o 25procfs-$(CONFIG_PPC64) := proc_ppc64.o
26obj-$(CONFIG_PROC_FS) += $(procfs-y) 26obj-$(CONFIG_PROC_FS) += $(procfs-y)
27rtaspci-$(CONFIG_PPC64) := rtas_pci.o 27rtaspci-$(CONFIG_PPC64) := rtas_pci.o
28obj-$(CONFIG_PPC_RTAS) += rtas.o $(rtaspci-y) 28obj-$(CONFIG_PPC_RTAS) += rtas.o rtas-rtc.o $(rtaspci-y)
29obj-$(CONFIG_RTAS_FLASH) += rtas_flash.o 29obj-$(CONFIG_RTAS_FLASH) += rtas_flash.o
30obj-$(CONFIG_RTAS_PROC) += rtas-proc.o 30obj-$(CONFIG_RTAS_PROC) += rtas-proc.o
31obj-$(CONFIG_LPARCFG) += lparcfg.o 31obj-$(CONFIG_LPARCFG) += lparcfg.o
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 4550eb4f4fbd..91538d2445bf 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -270,13 +270,15 @@ int main(void)
270 DEFINE(TVAL64_TV_USEC, offsetof(struct timeval, tv_usec)); 270 DEFINE(TVAL64_TV_USEC, offsetof(struct timeval, tv_usec));
271 DEFINE(TVAL32_TV_SEC, offsetof(struct compat_timeval, tv_sec)); 271 DEFINE(TVAL32_TV_SEC, offsetof(struct compat_timeval, tv_sec));
272 DEFINE(TVAL32_TV_USEC, offsetof(struct compat_timeval, tv_usec)); 272 DEFINE(TVAL32_TV_USEC, offsetof(struct compat_timeval, tv_usec));
273 DEFINE(TSPC64_TV_SEC, offsetof(struct timespec, tv_sec));
274 DEFINE(TSPC64_TV_NSEC, offsetof(struct timespec, tv_nsec));
273 DEFINE(TSPC32_TV_SEC, offsetof(struct compat_timespec, tv_sec)); 275 DEFINE(TSPC32_TV_SEC, offsetof(struct compat_timespec, tv_sec));
274 DEFINE(TSPC32_TV_NSEC, offsetof(struct compat_timespec, tv_nsec)); 276 DEFINE(TSPC32_TV_NSEC, offsetof(struct compat_timespec, tv_nsec));
275#else 277#else
276 DEFINE(TVAL32_TV_SEC, offsetof(struct timeval, tv_sec)); 278 DEFINE(TVAL32_TV_SEC, offsetof(struct timeval, tv_sec));
277 DEFINE(TVAL32_TV_USEC, offsetof(struct timeval, tv_usec)); 279 DEFINE(TVAL32_TV_USEC, offsetof(struct timeval, tv_usec));
278 DEFINE(TSPEC32_TV_SEC, offsetof(struct timespec, tv_sec)); 280 DEFINE(TSPC32_TV_SEC, offsetof(struct timespec, tv_sec));
279 DEFINE(TSPEC32_TV_NSEC, offsetof(struct timespec, tv_nsec)); 281 DEFINE(TSPC32_TV_NSEC, offsetof(struct timespec, tv_nsec));
280#endif 282#endif
281 /* timeval/timezone offsets for use by vdso */ 283 /* timeval/timezone offsets for use by vdso */
282 DEFINE(TZONE_TZ_MINWEST, offsetof(struct timezone, tz_minuteswest)); 284 DEFINE(TZONE_TZ_MINWEST, offsetof(struct timezone, tz_minuteswest));
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 5063c603fad4..8d60fa99fc4b 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -24,7 +24,7 @@
24 * Copyright 2002-2004 MontaVista Software, Inc. 24 * Copyright 2002-2004 MontaVista Software, Inc.
25 * PowerPC 44x support, Matt Porter <mporter@kernel.crashing.org> 25 * PowerPC 44x support, Matt Porter <mporter@kernel.crashing.org>
26 * Copyright 2004 Freescale Semiconductor, Inc 26 * Copyright 2004 Freescale Semiconductor, Inc
27 * PowerPC e500 modifications, Kumar Gala <kumar.gala@freescale.com> 27 * PowerPC e500 modifications, Kumar Gala <galak@kernel.crashing.org>
28 * 28 *
29 * This program is free software; you can redistribute it and/or modify it 29 * This program is free software; you can redistribute it and/or modify it
30 * under the terms of the GNU General Public License as published by the 30 * under the terms of the GNU General Public License as published by the
diff --git a/arch/powerpc/kernel/rtas-rtc.c b/arch/powerpc/kernel/rtas-rtc.c
new file mode 100644
index 000000000000..7b948662704c
--- /dev/null
+++ b/arch/powerpc/kernel/rtas-rtc.c
@@ -0,0 +1,105 @@
1#include <linux/kernel.h>
2#include <linux/time.h>
3#include <linux/timer.h>
4#include <linux/init.h>
5#include <linux/rtc.h>
6#include <linux/delay.h>
7#include <asm/prom.h>
8#include <asm/rtas.h>
9#include <asm/time.h>
10
11
12#define MAX_RTC_WAIT 5000 /* 5 sec */
13#define RTAS_CLOCK_BUSY (-2)
14unsigned long __init rtas_get_boot_time(void)
15{
16 int ret[8];
17 int error, wait_time;
18 unsigned long max_wait_tb;
19
20 max_wait_tb = get_tb() + tb_ticks_per_usec * 1000 * MAX_RTC_WAIT;
21 do {
22 error = rtas_call(rtas_token("get-time-of-day"), 0, 8, ret);
23 if (error == RTAS_CLOCK_BUSY || rtas_is_extended_busy(error)) {
24 wait_time = rtas_extended_busy_delay_time(error);
25 /* This is boot time so we spin. */
26 udelay(wait_time*1000);
27 error = RTAS_CLOCK_BUSY;
28 }
29 } while (error == RTAS_CLOCK_BUSY && (get_tb() < max_wait_tb));
30
31 if (error != 0 && printk_ratelimit()) {
32 printk(KERN_WARNING "error: reading the clock failed (%d)\n",
33 error);
34 return 0;
35 }
36
37 return mktime(ret[0], ret[1], ret[2], ret[3], ret[4], ret[5]);
38}
39
40/* NOTE: get_rtc_time will get an error if executed in interrupt context
41 * and if a delay is needed to read the clock. In this case we just
42 * silently return without updating rtc_tm.
43 */
44void rtas_get_rtc_time(struct rtc_time *rtc_tm)
45{
46 int ret[8];
47 int error, wait_time;
48 unsigned long max_wait_tb;
49
50 max_wait_tb = get_tb() + tb_ticks_per_usec * 1000 * MAX_RTC_WAIT;
51 do {
52 error = rtas_call(rtas_token("get-time-of-day"), 0, 8, ret);
53 if (error == RTAS_CLOCK_BUSY || rtas_is_extended_busy(error)) {
54 if (in_interrupt() && printk_ratelimit()) {
55 memset(&rtc_tm, 0, sizeof(struct rtc_time));
56 printk(KERN_WARNING "error: reading clock"
57 " would delay interrupt\n");
58 return; /* delay not allowed */
59 }
60 wait_time = rtas_extended_busy_delay_time(error);
61 msleep(wait_time);
62 error = RTAS_CLOCK_BUSY;
63 }
64 } while (error == RTAS_CLOCK_BUSY && (get_tb() < max_wait_tb));
65
66 if (error != 0 && printk_ratelimit()) {
67 printk(KERN_WARNING "error: reading the clock failed (%d)\n",
68 error);
69 return;
70 }
71
72 rtc_tm->tm_sec = ret[5];
73 rtc_tm->tm_min = ret[4];
74 rtc_tm->tm_hour = ret[3];
75 rtc_tm->tm_mday = ret[2];
76 rtc_tm->tm_mon = ret[1] - 1;
77 rtc_tm->tm_year = ret[0] - 1900;
78}
79
80int rtas_set_rtc_time(struct rtc_time *tm)
81{
82 int error, wait_time;
83 unsigned long max_wait_tb;
84
85 max_wait_tb = get_tb() + tb_ticks_per_usec * 1000 * MAX_RTC_WAIT;
86 do {
87 error = rtas_call(rtas_token("set-time-of-day"), 7, 1, NULL,
88 tm->tm_year + 1900, tm->tm_mon + 1,
89 tm->tm_mday, tm->tm_hour, tm->tm_min,
90 tm->tm_sec, 0);
91 if (error == RTAS_CLOCK_BUSY || rtas_is_extended_busy(error)) {
92 if (in_interrupt())
93 return 1; /* probably decrementer */
94 wait_time = rtas_extended_busy_delay_time(error);
95 msleep(wait_time);
96 error = RTAS_CLOCK_BUSY;
97 }
98 } while (error == RTAS_CLOCK_BUSY && (get_tb() < max_wait_tb));
99
100 if (error != 0 && printk_ratelimit())
101 printk(KERN_WARNING "error: setting the clock failed (%d)\n",
102 error);
103
104 return 0;
105}
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index fdbd9f9122f2..608fee7c7e20 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -59,6 +59,7 @@
59#include <asm/firmware.h> 59#include <asm/firmware.h>
60#include <asm/xmon.h> 60#include <asm/xmon.h>
61#include <asm/udbg.h> 61#include <asm/udbg.h>
62#include <asm/kexec.h>
62 63
63#include "setup.h" 64#include "setup.h"
64 65
@@ -415,6 +416,10 @@ void __init setup_system(void)
415 */ 416 */
416 unflatten_device_tree(); 417 unflatten_device_tree();
417 418
419#ifdef CONFIG_KEXEC
420 kexec_setup(); /* requires unflattened device tree. */
421#endif
422
418 /* 423 /*
419 * Fill the ppc64_caches & systemcfg structures with informations 424 * Fill the ppc64_caches & systemcfg structures with informations
420 * retreived from the device-tree. Need to be called before 425 * retreived from the device-tree. Need to be called before
diff --git a/arch/powerpc/kernel/vdso32/datapage.S b/arch/powerpc/kernel/vdso32/datapage.S
index a08c26e87835..f6b38472318d 100644
--- a/arch/powerpc/kernel/vdso32/datapage.S
+++ b/arch/powerpc/kernel/vdso32/datapage.S
@@ -77,8 +77,9 @@ V_FUNCTION_BEGIN(__kernel_get_tbfreq)
77 mflr r12 77 mflr r12
78 .cfi_register lr,r12 78 .cfi_register lr,r12
79 bl __get_datapage@local 79 bl __get_datapage@local
80 lwz r3,CFG_TB_TICKS_PER_SEC(r3)
81 lwz r4,(CFG_TB_TICKS_PER_SEC + 4)(r3) 80 lwz r4,(CFG_TB_TICKS_PER_SEC + 4)(r3)
81 lwz r3,CFG_TB_TICKS_PER_SEC(r3)
82 mtlr r12 82 mtlr r12
83 blr
83 .cfi_endproc 84 .cfi_endproc
84V_FUNCTION_END(__kernel_get_tbfreq) 85V_FUNCTION_END(__kernel_get_tbfreq)
diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S b/arch/powerpc/kernel/vdso32/gettimeofday.S
index aeb5fc9b87b3..0a32a41d50b0 100644
--- a/arch/powerpc/kernel/vdso32/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso32/gettimeofday.S
@@ -83,7 +83,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
83 /* Check for supported clock IDs */ 83 /* Check for supported clock IDs */
84 cmpli cr0,r3,CLOCK_REALTIME 84 cmpli cr0,r3,CLOCK_REALTIME
85 cmpli cr1,r3,CLOCK_MONOTONIC 85 cmpli cr1,r3,CLOCK_MONOTONIC
86 cror cr0,cr0,cr1 86 cror cr0*4+eq,cr0*4+eq,cr1*4+eq
87 bne cr0,99f 87 bne cr0,99f
88 88
89 mflr r12 /* r12 saves lr */ 89 mflr r12 /* r12 saves lr */
@@ -91,7 +91,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
91 mr r10,r3 /* r10 saves id */ 91 mr r10,r3 /* r10 saves id */
92 mr r11,r4 /* r11 saves tp */ 92 mr r11,r4 /* r11 saves tp */
93 bl __get_datapage@local /* get data page */ 93 bl __get_datapage@local /* get data page */
94 mr r9, r3 /* datapage ptr in r9 */ 94 mr r9,r3 /* datapage ptr in r9 */
95 beq cr1,50f /* if monotonic -> jump there */ 95 beq cr1,50f /* if monotonic -> jump there */
96 96
97 /* 97 /*
@@ -173,10 +173,14 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
173 add r4,r4,r7 173 add r4,r4,r7
174 lis r5,NSEC_PER_SEC@h 174 lis r5,NSEC_PER_SEC@h
175 ori r5,r5,NSEC_PER_SEC@l 175 ori r5,r5,NSEC_PER_SEC@l
176 cmpli cr0,r4,r5 176 cmpl cr0,r4,r5
177 cmpli cr1,r4,0
177 blt 1f 178 blt 1f
178 subf r4,r5,r4 179 subf r4,r5,r4
179 addi r3,r3,1 180 addi r3,r3,1
1811: bge cr1,1f
182 addi r3,r3,-1
183 add r4,r4,r5
1801: stw r3,TSPC32_TV_SEC(r11) 1841: stw r3,TSPC32_TV_SEC(r11)
181 stw r4,TSPC32_TV_NSEC(r11) 185 stw r4,TSPC32_TV_NSEC(r11)
182 186
@@ -210,7 +214,7 @@ V_FUNCTION_BEGIN(__kernel_clock_getres)
210 /* Check for supported clock IDs */ 214 /* Check for supported clock IDs */
211 cmpwi cr0,r3,CLOCK_REALTIME 215 cmpwi cr0,r3,CLOCK_REALTIME
212 cmpwi cr1,r3,CLOCK_MONOTONIC 216 cmpwi cr1,r3,CLOCK_MONOTONIC
213 cror cr0,cr0,cr1 217 cror cr0*4+eq,cr0*4+eq,cr1*4+eq
214 bne cr0,99f 218 bne cr0,99f
215 219
216 li r3,0 220 li r3,0
diff --git a/arch/powerpc/kernel/vdso64/datapage.S b/arch/powerpc/kernel/vdso64/datapage.S
index e67eda0f8cda..6393e4137bc7 100644
--- a/arch/powerpc/kernel/vdso64/datapage.S
+++ b/arch/powerpc/kernel/vdso64/datapage.S
@@ -80,5 +80,6 @@ V_FUNCTION_BEGIN(__kernel_get_tbfreq)
80 bl V_LOCAL_FUNC(__get_datapage) 80 bl V_LOCAL_FUNC(__get_datapage)
81 ld r3,CFG_TB_TICKS_PER_SEC(r3) 81 ld r3,CFG_TB_TICKS_PER_SEC(r3)
82 mtlr r12 82 mtlr r12
83 blr
83 .cfi_endproc 84 .cfi_endproc
84V_FUNCTION_END(__kernel_get_tbfreq) 85V_FUNCTION_END(__kernel_get_tbfreq)
diff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S
index d371c02a8c0e..1a89094715cc 100644
--- a/arch/powerpc/kernel/vdso64/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso64/gettimeofday.S
@@ -1,4 +1,5 @@
1/* 1
2 /*
2 * Userland implementation of gettimeofday() for 64 bits processes in a 3 * Userland implementation of gettimeofday() for 64 bits processes in a
3 * ppc64 kernel for use in the vDSO 4 * ppc64 kernel for use in the vDSO
4 * 5 *
@@ -68,7 +69,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
68 /* Check for supported clock IDs */ 69 /* Check for supported clock IDs */
69 cmpwi cr0,r3,CLOCK_REALTIME 70 cmpwi cr0,r3,CLOCK_REALTIME
70 cmpwi cr1,r3,CLOCK_MONOTONIC 71 cmpwi cr1,r3,CLOCK_MONOTONIC
71 cror cr0,cr0,cr1 72 cror cr0*4+eq,cr0*4+eq,cr1*4+eq
72 bne cr0,99f 73 bne cr0,99f
73 74
74 mflr r12 /* r12 saves lr */ 75 mflr r12 /* r12 saves lr */
@@ -84,16 +85,17 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
84 85
85 bl V_LOCAL_FUNC(__do_get_xsec) /* get xsec from tb & kernel */ 86 bl V_LOCAL_FUNC(__do_get_xsec) /* get xsec from tb & kernel */
86 87
87 lis r7,0x3b9a /* r7 = 1000000000 = NSEC_PER_SEC */ 88 lis r7,15 /* r7 = 1000000 = USEC_PER_SEC */
88 ori r7,r7,0xca00 89 ori r7,r7,16960
89 rldicl r5,r4,44,20 /* r5 = sec = xsec / XSEC_PER_SEC */ 90 rldicl r5,r4,44,20 /* r5 = sec = xsec / XSEC_PER_SEC */
90 rldicr r6,r5,20,43 /* r6 = sec * XSEC_PER_SEC */ 91 rldicr r6,r5,20,43 /* r6 = sec * XSEC_PER_SEC */
91 std r5,TSPC64_TV_SEC(r11) /* store sec in tv */ 92 std r5,TSPC64_TV_SEC(r11) /* store sec in tv */
92 subf r0,r6,r4 /* r0 = xsec = (xsec - r6) */ 93 subf r0,r6,r4 /* r0 = xsec = (xsec - r6) */
93 mulld r0,r0,r7 /* nsec = (xsec * NSEC_PER_SEC) / 94 mulld r0,r0,r7 /* usec = (xsec * USEC_PER_SEC) /
94 * XSEC_PER_SEC 95 * XSEC_PER_SEC
95 */ 96 */
96 rldicl r0,r0,44,20 97 rldicl r0,r0,44,20
98 mulli r0,r0,1000 /* nsec = usec * 1000 */
97 std r0,TSPC64_TV_NSEC(r11) /* store nsec in tp */ 99 std r0,TSPC64_TV_NSEC(r11) /* store nsec in tp */
98 100
99 mtlr r12 101 mtlr r12
@@ -106,15 +108,16 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
106 108
10750: bl V_LOCAL_FUNC(__do_get_xsec) /* get xsec from tb & kernel */ 10950: bl V_LOCAL_FUNC(__do_get_xsec) /* get xsec from tb & kernel */
108 110
109 lis r7,0x3b9a /* r7 = 1000000000 = NSEC_PER_SEC */ 111 lis r7,15 /* r7 = 1000000 = USEC_PER_SEC */
110 ori r7,r7,0xca00 112 ori r7,r7,16960
111 rldicl r5,r4,44,20 /* r5 = sec = xsec / XSEC_PER_SEC */ 113 rldicl r5,r4,44,20 /* r5 = sec = xsec / XSEC_PER_SEC */
112 rldicr r6,r5,20,43 /* r6 = sec * XSEC_PER_SEC */ 114 rldicr r6,r5,20,43 /* r6 = sec * XSEC_PER_SEC */
113 subf r0,r6,r4 /* r0 = xsec = (xsec - r6) */ 115 subf r0,r6,r4 /* r0 = xsec = (xsec - r6) */
114 mulld r0,r0,r7 /* nsec = (xsec * NSEC_PER_SEC) / 116 mulld r0,r0,r7 /* usec = (xsec * USEC_PER_SEC) /
115 * XSEC_PER_SEC 117 * XSEC_PER_SEC
116 */ 118 */
117 rldicl r6,r0,44,20 119 rldicl r6,r0,44,20
120 mulli r6,r6,1000 /* nsec = usec * 1000 */
118 121
119 /* now we must fixup using wall to monotonic. We need to snapshot 122 /* now we must fixup using wall to monotonic. We need to snapshot
120 * that value and do the counter trick again. Fortunately, we still 123 * that value and do the counter trick again. Fortunately, we still
@@ -123,8 +126,8 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
123 * can be used 126 * can be used
124 */ 127 */
125 128
126 lwz r4,WTOM_CLOCK_SEC(r9) 129 lwa r4,WTOM_CLOCK_SEC(r3)
127 lwz r7,WTOM_CLOCK_NSEC(r9) 130 lwa r7,WTOM_CLOCK_NSEC(r3)
128 131
129 /* We now have our result in r4,r7. We create a fake dependency 132 /* We now have our result in r4,r7. We create a fake dependency
130 * on that result and re-check the counter 133 * on that result and re-check the counter
@@ -144,10 +147,14 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
144 add r7,r7,r6 147 add r7,r7,r6
145 lis r9,NSEC_PER_SEC@h 148 lis r9,NSEC_PER_SEC@h
146 ori r9,r9,NSEC_PER_SEC@l 149 ori r9,r9,NSEC_PER_SEC@l
147 cmpli cr0,r7,r9 150 cmpl cr0,r7,r9
151 cmpli cr1,r7,0
148 blt 1f 152 blt 1f
149 subf r7,r9,r7 153 subf r7,r9,r7
150 addi r4,r4,1 154 addi r4,r4,1
1551: bge cr1,1f
156 addi r4,r4,-1
157 add r7,r7,r9
1511: std r4,TSPC64_TV_SEC(r11) 1581: std r4,TSPC64_TV_SEC(r11)
152 std r7,TSPC64_TV_NSEC(r11) 159 std r7,TSPC64_TV_NSEC(r11)
153 160
@@ -181,7 +188,7 @@ V_FUNCTION_BEGIN(__kernel_clock_getres)
181 /* Check for supported clock IDs */ 188 /* Check for supported clock IDs */
182 cmpwi cr0,r3,CLOCK_REALTIME 189 cmpwi cr0,r3,CLOCK_REALTIME
183 cmpwi cr1,r3,CLOCK_MONOTONIC 190 cmpwi cr1,r3,CLOCK_MONOTONIC
184 cror cr0,cr0,cr1 191 cror cr0*4+eq,cr0*4+eq,cr1*4+eq
185 bne cr0,99f 192 bne cr0,99f
186 193
187 li r3,0 194 li r3,0
diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c
index af9ca0eb6d55..5d581bb3aa12 100644
--- a/arch/powerpc/mm/fsl_booke_mmu.c
+++ b/arch/powerpc/mm/fsl_booke_mmu.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Modifications by Kumar Gala (kumar.gala@freescale.com) to support 2 * Modifications by Kumar Gala (galak@kernel.crashing.org) to support
3 * E500 Book E processors. 3 * E500 Book E processors.
4 * 4 *
5 * Copyright 2004 Freescale Semiconductor, Inc 5 * Copyright 2004 Freescale Semiconductor, Inc
diff --git a/arch/powerpc/oprofile/op_model_fsl_booke.c b/arch/powerpc/oprofile/op_model_fsl_booke.c
index 86124a94c9af..26539cda6023 100644
--- a/arch/powerpc/oprofile/op_model_fsl_booke.c
+++ b/arch/powerpc/oprofile/op_model_fsl_booke.c
@@ -7,7 +7,7 @@
7 * Copyright (c) 2004 Freescale Semiconductor, Inc 7 * Copyright (c) 2004 Freescale Semiconductor, Inc
8 * 8 *
9 * Author: Andy Fleming 9 * Author: Andy Fleming
10 * Maintainer: Kumar Gala <Kumar.Gala@freescale.com> 10 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
diff --git a/arch/powerpc/platforms/powermac/time.c b/arch/powerpc/platforms/powermac/time.c
index 5947b21a8588..b1714f9bd920 100644
--- a/arch/powerpc/platforms/powermac/time.c
+++ b/arch/powerpc/platforms/powermac/time.c
@@ -102,7 +102,7 @@ static unsigned long from_rtc_time(struct rtc_time *tm)
102static unsigned long cuda_get_time(void) 102static unsigned long cuda_get_time(void)
103{ 103{
104 struct adb_request req; 104 struct adb_request req;
105 unsigned long now; 105 unsigned int now;
106 106
107 if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_GET_TIME) < 0) 107 if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_GET_TIME) < 0)
108 return 0; 108 return 0;
@@ -113,7 +113,7 @@ static unsigned long cuda_get_time(void)
113 req.reply_len); 113 req.reply_len);
114 now = (req.reply[3] << 24) + (req.reply[4] << 16) 114 now = (req.reply[3] << 24) + (req.reply[4] << 16)
115 + (req.reply[5] << 8) + req.reply[6]; 115 + (req.reply[5] << 8) + req.reply[6];
116 return now - RTC_OFFSET; 116 return ((unsigned long)now) - RTC_OFFSET;
117} 117}
118 118
119#define cuda_get_rtc_time(tm) to_rtc_time(cuda_get_time(), (tm)) 119#define cuda_get_rtc_time(tm) to_rtc_time(cuda_get_time(), (tm))
@@ -146,7 +146,7 @@ static int cuda_set_rtc_time(struct rtc_time *tm)
146static unsigned long pmu_get_time(void) 146static unsigned long pmu_get_time(void)
147{ 147{
148 struct adb_request req; 148 struct adb_request req;
149 unsigned long now; 149 unsigned int now;
150 150
151 if (pmu_request(&req, NULL, 1, PMU_READ_RTC) < 0) 151 if (pmu_request(&req, NULL, 1, PMU_READ_RTC) < 0)
152 return 0; 152 return 0;
@@ -156,7 +156,7 @@ static unsigned long pmu_get_time(void)
156 req.reply_len); 156 req.reply_len);
157 now = (req.reply[0] << 24) + (req.reply[1] << 16) 157 now = (req.reply[0] << 24) + (req.reply[1] << 16)
158 + (req.reply[2] << 8) + req.reply[3]; 158 + (req.reply[2] << 8) + req.reply[3];
159 return now - RTC_OFFSET; 159 return ((unsigned long)now) - RTC_OFFSET;
160} 160}
161 161
162#define pmu_get_rtc_time(tm) to_rtc_time(pmu_get_time(), (tm)) 162#define pmu_get_rtc_time(tm) to_rtc_time(pmu_get_time(), (tm))
@@ -199,7 +199,7 @@ static unsigned long smu_get_time(void)
199#define smu_set_rtc_time(tm, spin) 0 199#define smu_set_rtc_time(tm, spin) 0
200#endif 200#endif
201 201
202unsigned long pmac_get_boot_time(void) 202unsigned long __init pmac_get_boot_time(void)
203{ 203{
204 /* Get the time from the RTC, used only at boot time */ 204 /* Get the time from the RTC, used only at boot time */
205 switch (sys_ctrler) { 205 switch (sys_ctrler) {
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 31990829310c..b9d9732b2e06 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -200,14 +200,12 @@ static void __init pSeries_setup_arch(void)
200 if (ppc64_interrupt_controller == IC_OPEN_PIC) { 200 if (ppc64_interrupt_controller == IC_OPEN_PIC) {
201 ppc_md.init_IRQ = pSeries_init_mpic; 201 ppc_md.init_IRQ = pSeries_init_mpic;
202 ppc_md.get_irq = mpic_get_irq; 202 ppc_md.get_irq = mpic_get_irq;
203 ppc_md.cpu_irq_down = mpic_teardown_this_cpu;
204 /* Allocate the mpic now, so that find_and_init_phbs() can 203 /* Allocate the mpic now, so that find_and_init_phbs() can
205 * fill the ISUs */ 204 * fill the ISUs */
206 pSeries_setup_mpic(); 205 pSeries_setup_mpic();
207 } else { 206 } else {
208 ppc_md.init_IRQ = xics_init_IRQ; 207 ppc_md.init_IRQ = xics_init_IRQ;
209 ppc_md.get_irq = xics_get_irq; 208 ppc_md.get_irq = xics_get_irq;
210 ppc_md.cpu_irq_down = xics_teardown_cpu;
211 } 209 }
212 210
213#ifdef CONFIG_SMP 211#ifdef CONFIG_SMP
@@ -595,6 +593,27 @@ static int pSeries_pci_probe_mode(struct pci_bus *bus)
595 return PCI_PROBE_NORMAL; 593 return PCI_PROBE_NORMAL;
596} 594}
597 595
596#ifdef CONFIG_KEXEC
597static void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
598{
599 /* Don't risk a hypervisor call if we're crashing */
600 if (!crash_shutdown) {
601 unsigned long vpa = __pa(&get_paca()->lppaca);
602
603 if (unregister_vpa(hard_smp_processor_id(), vpa)) {
604 printk("VPA deregistration of cpu %u (hw_cpu_id %d) "
605 "failed\n", smp_processor_id(),
606 hard_smp_processor_id());
607 }
608 }
609
610 if (ppc64_interrupt_controller == IC_OPEN_PIC)
611 mpic_teardown_this_cpu(secondary);
612 else
613 xics_teardown_cpu(secondary);
614}
615#endif
616
598struct machdep_calls __initdata pSeries_md = { 617struct machdep_calls __initdata pSeries_md = {
599 .probe = pSeries_probe, 618 .probe = pSeries_probe,
600 .setup_arch = pSeries_setup_arch, 619 .setup_arch = pSeries_setup_arch,
@@ -617,4 +636,7 @@ struct machdep_calls __initdata pSeries_md = {
617 .check_legacy_ioport = pSeries_check_legacy_ioport, 636 .check_legacy_ioport = pSeries_check_legacy_ioport,
618 .system_reset_exception = pSeries_system_reset_exception, 637 .system_reset_exception = pSeries_system_reset_exception,
619 .machine_check_exception = pSeries_machine_check_exception, 638 .machine_check_exception = pSeries_machine_check_exception,
639#ifdef CONFIG_KEXEC
640 .kexec_cpu_down = pseries_kexec_cpu_down,
641#endif
620}; 642};
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index ef4356b29a97..c45a6ad5f3b7 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -19,6 +19,7 @@
19#include <linux/cpumask.h> 19#include <linux/cpumask.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/sysrq.h> 21#include <linux/sysrq.h>
22#include <linux/interrupt.h>
22 23
23#include <asm/ptrace.h> 24#include <asm/ptrace.h>
24#include <asm/string.h> 25#include <asm/string.h>
diff --git a/arch/ppc/kernel/head_fsl_booke.S b/arch/ppc/kernel/head_fsl_booke.S
index 5063c603fad4..8d60fa99fc4b 100644
--- a/arch/ppc/kernel/head_fsl_booke.S
+++ b/arch/ppc/kernel/head_fsl_booke.S
@@ -24,7 +24,7 @@
24 * Copyright 2002-2004 MontaVista Software, Inc. 24 * Copyright 2002-2004 MontaVista Software, Inc.
25 * PowerPC 44x support, Matt Porter <mporter@kernel.crashing.org> 25 * PowerPC 44x support, Matt Porter <mporter@kernel.crashing.org>
26 * Copyright 2004 Freescale Semiconductor, Inc 26 * Copyright 2004 Freescale Semiconductor, Inc
27 * PowerPC e500 modifications, Kumar Gala <kumar.gala@freescale.com> 27 * PowerPC e500 modifications, Kumar Gala <galak@kernel.crashing.org>
28 * 28 *
29 * This program is free software; you can redistribute it and/or modify it 29 * This program is free software; you can redistribute it and/or modify it
30 * under the terms of the GNU General Public License as published by the 30 * under the terms of the GNU General Public License as published by the
diff --git a/arch/ppc/mm/fsl_booke_mmu.c b/arch/ppc/mm/fsl_booke_mmu.c
index af9ca0eb6d55..5d581bb3aa12 100644
--- a/arch/ppc/mm/fsl_booke_mmu.c
+++ b/arch/ppc/mm/fsl_booke_mmu.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Modifications by Kumar Gala (kumar.gala@freescale.com) to support 2 * Modifications by Kumar Gala (galak@kernel.crashing.org) to support
3 * E500 Book E processors. 3 * E500 Book E processors.
4 * 4 *
5 * Copyright 2004 Freescale Semiconductor, Inc 5 * Copyright 2004 Freescale Semiconductor, Inc
diff --git a/arch/ppc/platforms/83xx/mpc834x_sys.c b/arch/ppc/platforms/83xx/mpc834x_sys.c
index 98edc75f4105..04bdc39bf47b 100644
--- a/arch/ppc/platforms/83xx/mpc834x_sys.c
+++ b/arch/ppc/platforms/83xx/mpc834x_sys.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC834x SYS board specific routines 4 * MPC834x SYS board specific routines
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2005 Freescale Semiconductor Inc. 8 * Copyright 2005 Freescale Semiconductor Inc.
9 * 9 *
@@ -73,12 +73,19 @@ mpc83xx_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
73 * A B C D 73 * A B C D
74 */ 74 */
75 { 75 {
76 {PIRQA, PIRQB, PIRQC, PIRQD}, /* idsel 0x11 */ 76 {PIRQA, PIRQB, PIRQC, PIRQD}, /* idsel 0x11 */
77 {PIRQC, PIRQD, PIRQA, PIRQB}, /* idsel 0x12 */ 77 {PIRQC, PIRQD, PIRQA, PIRQB}, /* idsel 0x12 */
78 {PIRQD, PIRQA, PIRQB, PIRQC} /* idsel 0x13 */ 78 {PIRQD, PIRQA, PIRQB, PIRQC}, /* idsel 0x13 */
79 {0, 0, 0, 0},
80 {PIRQA, PIRQB, PIRQC, PIRQD}, /* idsel 0x15 */
81 {PIRQD, PIRQA, PIRQB, PIRQC}, /* idsel 0x16 */
82 {PIRQC, PIRQD, PIRQA, PIRQB}, /* idsel 0x17 */
83 {PIRQB, PIRQC, PIRQD, PIRQA}, /* idsel 0x18 */
84 {0, 0, 0, 0}, /* idsel 0x19 */
85 {0, 0, 0, 0}, /* idsel 0x20 */
79 }; 86 };
80 87
81 const long min_idsel = 0x11, max_idsel = 0x13, irqs_per_slot = 4; 88 const long min_idsel = 0x11, max_idsel = 0x20, irqs_per_slot = 4;
82 return PCI_IRQ_TABLE_LOOKUP; 89 return PCI_IRQ_TABLE_LOOKUP;
83} 90}
84 91
diff --git a/arch/ppc/platforms/83xx/mpc834x_sys.h b/arch/ppc/platforms/83xx/mpc834x_sys.h
index 58e44c042535..2e514d316fb8 100644
--- a/arch/ppc/platforms/83xx/mpc834x_sys.h
+++ b/arch/ppc/platforms/83xx/mpc834x_sys.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC834X SYS common board definitions 4 * MPC834X SYS common board definitions
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2005 Freescale Semiconductor, Inc. 8 * Copyright 2005 Freescale Semiconductor, Inc.
9 * 9 *
diff --git a/arch/ppc/platforms/85xx/mpc8540_ads.c b/arch/ppc/platforms/85xx/mpc8540_ads.c
index 7e952c1228cb..c5cde97c6ef0 100644
--- a/arch/ppc/platforms/85xx/mpc8540_ads.c
+++ b/arch/ppc/platforms/85xx/mpc8540_ads.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC8540ADS board specific routines 4 * MPC8540ADS board specific routines
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2004 Freescale Semiconductor Inc. 8 * Copyright 2004 Freescale Semiconductor Inc.
9 * 9 *
diff --git a/arch/ppc/platforms/85xx/mpc8540_ads.h b/arch/ppc/platforms/85xx/mpc8540_ads.h
index 3d05d7c4a938..e48ca3a97397 100644
--- a/arch/ppc/platforms/85xx/mpc8540_ads.h
+++ b/arch/ppc/platforms/85xx/mpc8540_ads.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC8540ADS board definitions 4 * MPC8540ADS board definitions
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2004 Freescale Semiconductor Inc. 8 * Copyright 2004 Freescale Semiconductor Inc.
9 * 9 *
diff --git a/arch/ppc/platforms/85xx/mpc8555_cds.h b/arch/ppc/platforms/85xx/mpc8555_cds.h
index e0e75568bc57..1a8e6c67355d 100644
--- a/arch/ppc/platforms/85xx/mpc8555_cds.h
+++ b/arch/ppc/platforms/85xx/mpc8555_cds.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC8555CDS board definitions 4 * MPC8555CDS board definitions
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2004 Freescale Semiconductor Inc. 8 * Copyright 2004 Freescale Semiconductor Inc.
9 * 9 *
diff --git a/arch/ppc/platforms/85xx/mpc8560_ads.c b/arch/ppc/platforms/85xx/mpc8560_ads.c
index 208433f1e93a..8e39a5517092 100644
--- a/arch/ppc/platforms/85xx/mpc8560_ads.c
+++ b/arch/ppc/platforms/85xx/mpc8560_ads.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC8560ADS board specific routines 4 * MPC8560ADS board specific routines
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2004 Freescale Semiconductor Inc. 8 * Copyright 2004 Freescale Semiconductor Inc.
9 * 9 *
diff --git a/arch/ppc/platforms/85xx/mpc8560_ads.h b/arch/ppc/platforms/85xx/mpc8560_ads.h
index 7df885d73e9d..143ae7eefa7c 100644
--- a/arch/ppc/platforms/85xx/mpc8560_ads.h
+++ b/arch/ppc/platforms/85xx/mpc8560_ads.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC8540ADS board definitions 4 * MPC8540ADS board definitions
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2004 Freescale Semiconductor Inc. 8 * Copyright 2004 Freescale Semiconductor Inc.
9 * 9 *
diff --git a/arch/ppc/platforms/85xx/mpc85xx_ads_common.c b/arch/ppc/platforms/85xx/mpc85xx_ads_common.c
index 16ad092d8a06..17ce48fe3503 100644
--- a/arch/ppc/platforms/85xx/mpc85xx_ads_common.c
+++ b/arch/ppc/platforms/85xx/mpc85xx_ads_common.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC85xx ADS board common routines 4 * MPC85xx ADS board common routines
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2004 Freescale Semiconductor Inc. 8 * Copyright 2004 Freescale Semiconductor Inc.
9 * 9 *
diff --git a/arch/ppc/platforms/85xx/mpc85xx_ads_common.h b/arch/ppc/platforms/85xx/mpc85xx_ads_common.h
index 84acf6e8d45e..7b26bcc5d10d 100644
--- a/arch/ppc/platforms/85xx/mpc85xx_ads_common.h
+++ b/arch/ppc/platforms/85xx/mpc85xx_ads_common.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC85XX ADS common board definitions 4 * MPC85XX ADS common board definitions
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2004 Freescale Semiconductor Inc. 8 * Copyright 2004 Freescale Semiconductor Inc.
9 * 9 *
diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
index a21156967a5e..d8991b88dc9c 100644
--- a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
+++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC85xx CDS board specific routines 4 * MPC85xx CDS board specific routines
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2004 Freescale Semiconductor, Inc 8 * Copyright 2004 Freescale Semiconductor, Inc
9 * 9 *
diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.h b/arch/ppc/platforms/85xx/mpc85xx_cds_common.h
index 12b292c6ae32..5b588cfd0e41 100644
--- a/arch/ppc/platforms/85xx/mpc85xx_cds_common.h
+++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC85xx CDS board definitions 4 * MPC85xx CDS board definitions
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2004 Freescale Semiconductor, Inc 8 * Copyright 2004 Freescale Semiconductor, Inc
9 * 9 *
diff --git a/arch/ppc/platforms/85xx/sbc8560.c b/arch/ppc/platforms/85xx/sbc8560.c
index b4ee1707a836..45a5b81b4ed1 100644
--- a/arch/ppc/platforms/85xx/sbc8560.c
+++ b/arch/ppc/platforms/85xx/sbc8560.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Wind River SBC8560 board specific routines 4 * Wind River SBC8560 board specific routines
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala
7 * 7 *
8 * Copyright 2004 Freescale Semiconductor Inc. 8 * Copyright 2004 Freescale Semiconductor Inc.
9 * 9 *
diff --git a/arch/ppc/platforms/pmac_feature.c b/arch/ppc/platforms/pmac_feature.c
index 58884a63ebdb..1e69b0593162 100644
--- a/arch/ppc/platforms/pmac_feature.c
+++ b/arch/ppc/platforms/pmac_feature.c
@@ -2317,6 +2317,14 @@ static struct pmac_mb_def pmac_mb_defs[] = {
2317 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, 2317 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2318 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, 2318 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2319 }, 2319 },
2320 { "PowerBook5,8", "PowerBook G4 15\"",
2321 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2322 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2323 },
2324 { "PowerBook5,9", "PowerBook G4 17\"",
2325 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2326 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2327 },
2320 { "PowerBook6,1", "PowerBook G4 12\"", 2328 { "PowerBook6,1", "PowerBook G4 12\"",
2321 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, 2329 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2322 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE, 2330 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
diff --git a/arch/ppc/platforms/pq2ads.c b/arch/ppc/platforms/pq2ads.c
index 6a1475c1e128..71c9fca1fe9b 100644
--- a/arch/ppc/platforms/pq2ads.c
+++ b/arch/ppc/platforms/pq2ads.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * PQ2ADS platform support 4 * PQ2ADS platform support
5 * 5 *
6 * Author: Kumar Gala <kumar.gala@freescale.com> 6 * Author: Kumar Gala <galak@kernel.crashing.org>
7 * Derived from: est8260_setup.c by Allen Curtis 7 * Derived from: est8260_setup.c by Allen Curtis
8 * 8 *
9 * Copyright 2004 Freescale Semiconductor, Inc. 9 * Copyright 2004 Freescale Semiconductor, Inc.
diff --git a/arch/ppc/syslib/ipic.h b/arch/ppc/syslib/ipic.h
index 2b56a4fcf373..a7ce7da8785c 100644
--- a/arch/ppc/syslib/ipic.h
+++ b/arch/ppc/syslib/ipic.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * IPIC private definitions and structure. 4 * IPIC private definitions and structure.
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2005 Freescale Semiconductor, Inc 8 * Copyright 2005 Freescale Semiconductor, Inc
9 * 9 *
diff --git a/arch/ppc/syslib/mpc83xx_devices.c b/arch/ppc/syslib/mpc83xx_devices.c
index f43fbf9a9389..847df4409982 100644
--- a/arch/ppc/syslib/mpc83xx_devices.c
+++ b/arch/ppc/syslib/mpc83xx_devices.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC83xx Device descriptions 4 * MPC83xx Device descriptions
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2005 Freescale Semiconductor Inc. 8 * Copyright 2005 Freescale Semiconductor Inc.
9 * 9 *
diff --git a/arch/ppc/syslib/mpc83xx_sys.c b/arch/ppc/syslib/mpc83xx_sys.c
index da743446789b..a1523989aff4 100644
--- a/arch/ppc/syslib/mpc83xx_sys.c
+++ b/arch/ppc/syslib/mpc83xx_sys.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC83xx System descriptions 4 * MPC83xx System descriptions
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2005 Freescale Semiconductor Inc. 8 * Copyright 2005 Freescale Semiconductor Inc.
9 * 9 *
diff --git a/arch/ppc/syslib/mpc85xx_devices.c b/arch/ppc/syslib/mpc85xx_devices.c
index 2ede677a0a53..69949d255658 100644
--- a/arch/ppc/syslib/mpc85xx_devices.c
+++ b/arch/ppc/syslib/mpc85xx_devices.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC85xx Device descriptions 4 * MPC85xx Device descriptions
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2005 Freescale Semiconductor Inc. 8 * Copyright 2005 Freescale Semiconductor Inc.
9 * 9 *
diff --git a/arch/ppc/syslib/mpc85xx_sys.c b/arch/ppc/syslib/mpc85xx_sys.c
index cb68d8c58348..397cfbcce5ea 100644
--- a/arch/ppc/syslib/mpc85xx_sys.c
+++ b/arch/ppc/syslib/mpc85xx_sys.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC85xx System descriptions 4 * MPC85xx System descriptions
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2005 Freescale Semiconductor Inc. 8 * Copyright 2005 Freescale Semiconductor Inc.
9 * 9 *
diff --git a/arch/ppc/syslib/mpc8xx_devices.c b/arch/ppc/syslib/mpc8xx_devices.c
index 2b5f0e701687..92dc98b36bde 100644
--- a/arch/ppc/syslib/mpc8xx_devices.c
+++ b/arch/ppc/syslib/mpc8xx_devices.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC8xx Device descriptions 4 * MPC8xx Device descriptions
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2005 MontaVista Software, Inc. by Vitaly Bordug<vbordug@ru.mvista.com> 8 * Copyright 2005 MontaVista Software, Inc. by Vitaly Bordug<vbordug@ru.mvista.com>
9 * 9 *
diff --git a/arch/ppc/syslib/mpc8xx_sys.c b/arch/ppc/syslib/mpc8xx_sys.c
index 3cc27d29e3af..d3c617521603 100644
--- a/arch/ppc/syslib/mpc8xx_sys.c
+++ b/arch/ppc/syslib/mpc8xx_sys.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC8xx System descriptions 4 * MPC8xx System descriptions
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2005 MontaVista Software, Inc. by Vitaly Bordug <vbordug@ru.mvista.com> 8 * Copyright 2005 MontaVista Software, Inc. by Vitaly Bordug <vbordug@ru.mvista.com>
9 * 9 *
diff --git a/arch/ppc/syslib/ppc83xx_setup.c b/arch/ppc/syslib/ppc83xx_setup.c
index 4da168a6ad03..1b5fe9e398d4 100644
--- a/arch/ppc/syslib/ppc83xx_setup.c
+++ b/arch/ppc/syslib/ppc83xx_setup.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC83XX common board code 4 * MPC83XX common board code
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2005 Freescale Semiconductor Inc. 8 * Copyright 2005 Freescale Semiconductor Inc.
9 * 9 *
diff --git a/arch/ppc/syslib/ppc83xx_setup.h b/arch/ppc/syslib/ppc83xx_setup.h
index c766c1a5f786..a122a7322e5e 100644
--- a/arch/ppc/syslib/ppc83xx_setup.h
+++ b/arch/ppc/syslib/ppc83xx_setup.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC83XX common board definitions 4 * MPC83XX common board definitions
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2005 Freescale Semiconductor Inc. 8 * Copyright 2005 Freescale Semiconductor Inc.
9 * 9 *
diff --git a/arch/ppc/syslib/ppc85xx_common.c b/arch/ppc/syslib/ppc85xx_common.c
index da841dacdc13..19ad537225e4 100644
--- a/arch/ppc/syslib/ppc85xx_common.c
+++ b/arch/ppc/syslib/ppc85xx_common.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC85xx support routines 4 * MPC85xx support routines
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2004 Freescale Semiconductor Inc. 8 * Copyright 2004 Freescale Semiconductor Inc.
9 * 9 *
diff --git a/arch/ppc/syslib/ppc85xx_common.h b/arch/ppc/syslib/ppc85xx_common.h
index 2c8f304441bf..94edf32151dd 100644
--- a/arch/ppc/syslib/ppc85xx_common.h
+++ b/arch/ppc/syslib/ppc85xx_common.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC85xx support routines 4 * MPC85xx support routines
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2004 Freescale Semiconductor Inc. 8 * Copyright 2004 Freescale Semiconductor Inc.
9 * 9 *
diff --git a/arch/ppc/syslib/ppc85xx_setup.c b/arch/ppc/syslib/ppc85xx_setup.c
index de2f90576577..1a47ff4b831d 100644
--- a/arch/ppc/syslib/ppc85xx_setup.c
+++ b/arch/ppc/syslib/ppc85xx_setup.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC85XX common board code 4 * MPC85XX common board code
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2004 Freescale Semiconductor Inc. 8 * Copyright 2004 Freescale Semiconductor Inc.
9 * 9 *
diff --git a/arch/ppc/syslib/ppc85xx_setup.h b/arch/ppc/syslib/ppc85xx_setup.h
index 6e6cfe162faf..e340b0545fb5 100644
--- a/arch/ppc/syslib/ppc85xx_setup.h
+++ b/arch/ppc/syslib/ppc85xx_setup.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * MPC85XX common board definitions 4 * MPC85XX common board definitions
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2004 Freescale Semiconductor Inc. 8 * Copyright 2004 Freescale Semiconductor Inc.
9 * 9 *
diff --git a/arch/ppc/syslib/ppc_sys.c b/arch/ppc/syslib/ppc_sys.c
index 603f01190816..c0b93c4191ee 100644
--- a/arch/ppc/syslib/ppc_sys.c
+++ b/arch/ppc/syslib/ppc_sys.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * PPC System library functions 4 * PPC System library functions
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * Copyright 2005 Freescale Semiconductor Inc. 8 * Copyright 2005 Freescale Semiconductor Inc.
9 * Copyright 2005 MontaVista, Inc. by Vitaly Bordug <vbordug@ru.mvista.com> 9 * Copyright 2005 MontaVista, Inc. by Vitaly Bordug <vbordug@ru.mvista.com>
diff --git a/arch/ppc/syslib/pq2_devices.c b/arch/ppc/syslib/pq2_devices.c
index e960fe935325..6ff3aab82fc3 100644
--- a/arch/ppc/syslib/pq2_devices.c
+++ b/arch/ppc/syslib/pq2_devices.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * PQ2 Device descriptions 4 * PQ2 Device descriptions
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * This file is licensed under the terms of the GNU General Public License 8 * This file is licensed under the terms of the GNU General Public License
9 * version 2. This program is licensed "as is" without any warranty of any 9 * version 2. This program is licensed "as is" without any warranty of any
diff --git a/arch/ppc/syslib/pq2_sys.c b/arch/ppc/syslib/pq2_sys.c
index 7b6c9ebdb9e3..36d6e2179940 100644
--- a/arch/ppc/syslib/pq2_sys.c
+++ b/arch/ppc/syslib/pq2_sys.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * PQ2 System descriptions 4 * PQ2 System descriptions
5 * 5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
8 * This file is licensed under the terms of the GNU General Public License 8 * This file is licensed under the terms of the GNU General Public License
9 * version 2. This program is licensed "as is" without any warranty of any 9 * version 2. This program is licensed "as is" without any warranty of any
diff --git a/arch/ppc64/kernel/Makefile b/arch/ppc64/kernel/Makefile
index dac4cc20fa93..d0edea503c49 100644
--- a/arch/ppc64/kernel/Makefile
+++ b/arch/ppc64/kernel/Makefile
@@ -13,7 +13,6 @@ endif
13 13
14obj-y += idle.o dma.o \ 14obj-y += idle.o dma.o \
15 align.o \ 15 align.o \
16 rtc.o \
17 iommu.o 16 iommu.o
18 17
19pci-obj-$(CONFIG_PPC_MULTIPLATFORM) += pci_dn.o pci_direct_iommu.o 18pci-obj-$(CONFIG_PPC_MULTIPLATFORM) += pci_dn.o pci_direct_iommu.o
diff --git a/arch/ppc64/kernel/machine_kexec.c b/arch/ppc64/kernel/machine_kexec.c
index 07ea03598c00..97c51e452be7 100644
--- a/arch/ppc64/kernel/machine_kexec.c
+++ b/arch/ppc64/kernel/machine_kexec.c
@@ -185,8 +185,8 @@ void kexec_copy_flush(struct kimage *image)
185 */ 185 */
186void kexec_smp_down(void *arg) 186void kexec_smp_down(void *arg)
187{ 187{
188 if (ppc_md.cpu_irq_down) 188 if (ppc_md.kexec_cpu_down)
189 ppc_md.cpu_irq_down(1); 189 ppc_md.kexec_cpu_down(0, 1);
190 190
191 local_irq_disable(); 191 local_irq_disable();
192 kexec_smp_wait(); 192 kexec_smp_wait();
@@ -233,8 +233,8 @@ static void kexec_prepare_cpus(void)
233 } 233 }
234 234
235 /* after we tell the others to go down */ 235 /* after we tell the others to go down */
236 if (ppc_md.cpu_irq_down) 236 if (ppc_md.kexec_cpu_down)
237 ppc_md.cpu_irq_down(0); 237 ppc_md.kexec_cpu_down(0, 0);
238 238
239 put_cpu(); 239 put_cpu();
240 240
@@ -255,8 +255,8 @@ static void kexec_prepare_cpus(void)
255 * UP to an SMP kernel. 255 * UP to an SMP kernel.
256 */ 256 */
257 smp_release_cpus(); 257 smp_release_cpus();
258 if (ppc_md.cpu_irq_down) 258 if (ppc_md.kexec_cpu_down)
259 ppc_md.cpu_irq_down(0); 259 ppc_md.kexec_cpu_down(0, 0);
260 local_irq_disable(); 260 local_irq_disable();
261} 261}
262 262
@@ -305,3 +305,54 @@ void machine_kexec(struct kimage *image)
305 ppc_md.hpte_clear_all); 305 ppc_md.hpte_clear_all);
306 /* NOTREACHED */ 306 /* NOTREACHED */
307} 307}
308
309/* Values we need to export to the second kernel via the device tree. */
310static unsigned long htab_base, htab_size, kernel_end;
311
312static struct property htab_base_prop = {
313 .name = "linux,htab-base",
314 .length = sizeof(unsigned long),
315 .value = (unsigned char *)&htab_base,
316};
317
318static struct property htab_size_prop = {
319 .name = "linux,htab-size",
320 .length = sizeof(unsigned long),
321 .value = (unsigned char *)&htab_size,
322};
323
324static struct property kernel_end_prop = {
325 .name = "linux,kernel-end",
326 .length = sizeof(unsigned long),
327 .value = (unsigned char *)&kernel_end,
328};
329
330static void __init export_htab_values(void)
331{
332 struct device_node *node;
333
334 node = of_find_node_by_path("/chosen");
335 if (!node)
336 return;
337
338 kernel_end = __pa(_end);
339 prom_add_property(node, &kernel_end_prop);
340
341 /* On machines with no htab htab_address is NULL */
342 if (NULL == htab_address)
343 goto out;
344
345 htab_base = __pa(htab_address);
346 prom_add_property(node, &htab_base_prop);
347
348 htab_size = 1UL << ppc64_pft_size;
349 prom_add_property(node, &htab_size_prop);
350
351 out:
352 of_node_put(node);
353}
354
355void __init kexec_setup(void)
356{
357 export_htab_values();
358}
diff --git a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c
index fbad2c360784..47cc26e78957 100644
--- a/arch/ppc64/kernel/prom.c
+++ b/arch/ppc64/kernel/prom.c
@@ -1261,6 +1261,7 @@ prom_n_addr_cells(struct device_node* np)
1261 /* No #address-cells property for the root node, default to 1 */ 1261 /* No #address-cells property for the root node, default to 1 */
1262 return 1; 1262 return 1;
1263} 1263}
1264EXPORT_SYMBOL_GPL(prom_n_addr_cells);
1264 1265
1265int 1266int
1266prom_n_size_cells(struct device_node* np) 1267prom_n_size_cells(struct device_node* np)
@@ -1276,6 +1277,7 @@ prom_n_size_cells(struct device_node* np)
1276 /* No #size-cells property for the root node, default to 1 */ 1277 /* No #size-cells property for the root node, default to 1 */
1277 return 1; 1278 return 1;
1278} 1279}
1280EXPORT_SYMBOL_GPL(prom_n_size_cells);
1279 1281
1280/** 1282/**
1281 * Work out the sense (active-low level / active-high edge) 1283 * Work out the sense (active-low level / active-high edge)
diff --git a/arch/ppc64/kernel/rtc.c b/arch/ppc64/kernel/rtc.c
deleted file mode 100644
index 79e7ed2858dd..000000000000
--- a/arch/ppc64/kernel/rtc.c
+++ /dev/null
@@ -1,358 +0,0 @@
1/*
2 * Real Time Clock interface for PPC64.
3 *
4 * Based on rtc.c by Paul Gortmaker
5 *
6 * This driver allows use of the real time clock
7 * from user space. It exports the /dev/rtc
8 * interface supporting various ioctl() and also the
9 * /proc/driver/rtc pseudo-file for status information.
10 *
11 * Interface does not support RTC interrupts nor an alarm.
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version
16 * 2 of the License, or (at your option) any later version.
17 *
18 * 1.0 Mike Corrigan: IBM iSeries rtc support
19 * 1.1 Dave Engebretsen: IBM pSeries rtc support
20 */
21
22#define RTC_VERSION "1.1"
23
24#include <linux/config.h>
25#include <linux/module.h>
26#include <linux/kernel.h>
27#include <linux/types.h>
28#include <linux/miscdevice.h>
29#include <linux/ioport.h>
30#include <linux/fcntl.h>
31#include <linux/mc146818rtc.h>
32#include <linux/init.h>
33#include <linux/poll.h>
34#include <linux/proc_fs.h>
35#include <linux/spinlock.h>
36#include <linux/bcd.h>
37#include <linux/interrupt.h>
38#include <linux/delay.h>
39
40#include <asm/io.h>
41#include <asm/uaccess.h>
42#include <asm/system.h>
43#include <asm/time.h>
44#include <asm/rtas.h>
45
46#include <asm/machdep.h>
47
48/*
49 * We sponge a minor off of the misc major. No need slurping
50 * up another valuable major dev number for this. If you add
51 * an ioctl, make sure you don't conflict with SPARC's RTC
52 * ioctls.
53 */
54
55static ssize_t rtc_read(struct file *file, char __user *buf,
56 size_t count, loff_t *ppos);
57
58static int rtc_ioctl(struct inode *inode, struct file *file,
59 unsigned int cmd, unsigned long arg);
60
61static int rtc_read_proc(char *page, char **start, off_t off,
62 int count, int *eof, void *data);
63
64/*
65 * If this driver ever becomes modularised, it will be really nice
66 * to make the epoch retain its value across module reload...
67 */
68
69static unsigned long epoch = 1900; /* year corresponding to 0x00 */
70
71static const unsigned char days_in_mo[] =
72{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
73
74/*
75 * Now all the various file operations that we export.
76 */
77
78static ssize_t rtc_read(struct file *file, char __user *buf,
79 size_t count, loff_t *ppos)
80{
81 return -EIO;
82}
83
84static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
85 unsigned long arg)
86{
87 struct rtc_time wtime;
88
89 switch (cmd) {
90 case RTC_RD_TIME: /* Read the time/date from RTC */
91 {
92 memset(&wtime, 0, sizeof(struct rtc_time));
93 ppc_md.get_rtc_time(&wtime);
94 break;
95 }
96 case RTC_SET_TIME: /* Set the RTC */
97 {
98 struct rtc_time rtc_tm;
99 unsigned char mon, day, hrs, min, sec, leap_yr;
100 unsigned int yrs;
101
102 if (!capable(CAP_SYS_TIME))
103 return -EACCES;
104
105 if (copy_from_user(&rtc_tm, (struct rtc_time __user *)arg,
106 sizeof(struct rtc_time)))
107 return -EFAULT;
108
109 yrs = rtc_tm.tm_year;
110 mon = rtc_tm.tm_mon + 1; /* tm_mon starts at zero */
111 day = rtc_tm.tm_mday;
112 hrs = rtc_tm.tm_hour;
113 min = rtc_tm.tm_min;
114 sec = rtc_tm.tm_sec;
115
116 if (yrs < 70)
117 return -EINVAL;
118
119 leap_yr = ((!(yrs % 4) && (yrs % 100)) || !(yrs % 400));
120
121 if ((mon > 12) || (day == 0))
122 return -EINVAL;
123
124 if (day > (days_in_mo[mon] + ((mon == 2) && leap_yr)))
125 return -EINVAL;
126
127 if ((hrs >= 24) || (min >= 60) || (sec >= 60))
128 return -EINVAL;
129
130 if ( yrs > 169 )
131 return -EINVAL;
132
133 ppc_md.set_rtc_time(&rtc_tm);
134
135 return 0;
136 }
137 case RTC_EPOCH_READ: /* Read the epoch. */
138 {
139 return put_user (epoch, (unsigned long __user *)arg);
140 }
141 case RTC_EPOCH_SET: /* Set the epoch. */
142 {
143 /*
144 * There were no RTC clocks before 1900.
145 */
146 if (arg < 1900)
147 return -EINVAL;
148
149 if (!capable(CAP_SYS_TIME))
150 return -EACCES;
151
152 epoch = arg;
153 return 0;
154 }
155 default:
156 return -EINVAL;
157 }
158 return copy_to_user((void __user *)arg, &wtime, sizeof wtime) ? -EFAULT : 0;
159}
160
161static int rtc_open(struct inode *inode, struct file *file)
162{
163 nonseekable_open(inode, file);
164 return 0;
165}
166
167static int rtc_release(struct inode *inode, struct file *file)
168{
169 return 0;
170}
171
172/*
173 * The various file operations we support.
174 */
175static struct file_operations rtc_fops = {
176 .owner = THIS_MODULE,
177 .llseek = no_llseek,
178 .read = rtc_read,
179 .ioctl = rtc_ioctl,
180 .open = rtc_open,
181 .release = rtc_release,
182};
183
184static struct miscdevice rtc_dev = {
185 .minor = RTC_MINOR,
186 .name = "rtc",
187 .fops = &rtc_fops
188};
189
190static int __init rtc_init(void)
191{
192 int retval;
193
194 retval = misc_register(&rtc_dev);
195 if(retval < 0)
196 return retval;
197
198#ifdef CONFIG_PROC_FS
199 if (create_proc_read_entry("driver/rtc", 0, NULL, rtc_read_proc, NULL)
200 == NULL) {
201 misc_deregister(&rtc_dev);
202 return -ENOMEM;
203 }
204#endif
205
206 printk(KERN_INFO "i/pSeries Real Time Clock Driver v" RTC_VERSION "\n");
207
208 return 0;
209}
210
211static void __exit rtc_exit (void)
212{
213 remove_proc_entry ("driver/rtc", NULL);
214 misc_deregister(&rtc_dev);
215}
216
217module_init(rtc_init);
218module_exit(rtc_exit);
219
220/*
221 * Info exported via "/proc/driver/rtc".
222 */
223
224static int rtc_proc_output (char *buf)
225{
226
227 char *p;
228 struct rtc_time tm;
229
230 p = buf;
231
232 ppc_md.get_rtc_time(&tm);
233
234 /*
235 * There is no way to tell if the luser has the RTC set for local
236 * time or for Universal Standard Time (GMT). Probably local though.
237 */
238 p += sprintf(p,
239 "rtc_time\t: %02d:%02d:%02d\n"
240 "rtc_date\t: %04d-%02d-%02d\n"
241 "rtc_epoch\t: %04lu\n",
242 tm.tm_hour, tm.tm_min, tm.tm_sec,
243 tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, epoch);
244
245 p += sprintf(p,
246 "DST_enable\t: no\n"
247 "BCD\t\t: yes\n"
248 "24hr\t\t: yes\n" );
249
250 return p - buf;
251}
252
253static int rtc_read_proc(char *page, char **start, off_t off,
254 int count, int *eof, void *data)
255{
256 int len = rtc_proc_output (page);
257 if (len <= off+count) *eof = 1;
258 *start = page + off;
259 len -= off;
260 if (len>count) len = count;
261 if (len<0) len = 0;
262 return len;
263}
264
265#ifdef CONFIG_PPC_RTAS
266#define MAX_RTC_WAIT 5000 /* 5 sec */
267#define RTAS_CLOCK_BUSY (-2)
268unsigned long rtas_get_boot_time(void)
269{
270 int ret[8];
271 int error, wait_time;
272 unsigned long max_wait_tb;
273
274 max_wait_tb = __get_tb() + tb_ticks_per_usec * 1000 * MAX_RTC_WAIT;
275 do {
276 error = rtas_call(rtas_token("get-time-of-day"), 0, 8, ret);
277 if (error == RTAS_CLOCK_BUSY || rtas_is_extended_busy(error)) {
278 wait_time = rtas_extended_busy_delay_time(error);
279 /* This is boot time so we spin. */
280 udelay(wait_time*1000);
281 error = RTAS_CLOCK_BUSY;
282 }
283 } while (error == RTAS_CLOCK_BUSY && (__get_tb() < max_wait_tb));
284
285 if (error != 0 && printk_ratelimit()) {
286 printk(KERN_WARNING "error: reading the clock failed (%d)\n",
287 error);
288 return 0;
289 }
290
291 return mktime(ret[0], ret[1], ret[2], ret[3], ret[4], ret[5]);
292}
293
294/* NOTE: get_rtc_time will get an error if executed in interrupt context
295 * and if a delay is needed to read the clock. In this case we just
296 * silently return without updating rtc_tm.
297 */
298void rtas_get_rtc_time(struct rtc_time *rtc_tm)
299{
300 int ret[8];
301 int error, wait_time;
302 unsigned long max_wait_tb;
303
304 max_wait_tb = __get_tb() + tb_ticks_per_usec * 1000 * MAX_RTC_WAIT;
305 do {
306 error = rtas_call(rtas_token("get-time-of-day"), 0, 8, ret);
307 if (error == RTAS_CLOCK_BUSY || rtas_is_extended_busy(error)) {
308 if (in_interrupt() && printk_ratelimit()) {
309 printk(KERN_WARNING "error: reading clock would delay interrupt\n");
310 return; /* delay not allowed */
311 }
312 wait_time = rtas_extended_busy_delay_time(error);
313 msleep_interruptible(wait_time);
314 error = RTAS_CLOCK_BUSY;
315 }
316 } while (error == RTAS_CLOCK_BUSY && (__get_tb() < max_wait_tb));
317
318 if (error != 0 && printk_ratelimit()) {
319 printk(KERN_WARNING "error: reading the clock failed (%d)\n",
320 error);
321 return;
322 }
323
324 rtc_tm->tm_sec = ret[5];
325 rtc_tm->tm_min = ret[4];
326 rtc_tm->tm_hour = ret[3];
327 rtc_tm->tm_mday = ret[2];
328 rtc_tm->tm_mon = ret[1] - 1;
329 rtc_tm->tm_year = ret[0] - 1900;
330}
331
332int rtas_set_rtc_time(struct rtc_time *tm)
333{
334 int error, wait_time;
335 unsigned long max_wait_tb;
336
337 max_wait_tb = __get_tb() + tb_ticks_per_usec * 1000 * MAX_RTC_WAIT;
338 do {
339 error = rtas_call(rtas_token("set-time-of-day"), 7, 1, NULL,
340 tm->tm_year + 1900, tm->tm_mon + 1,
341 tm->tm_mday, tm->tm_hour, tm->tm_min,
342 tm->tm_sec, 0);
343 if (error == RTAS_CLOCK_BUSY || rtas_is_extended_busy(error)) {
344 if (in_interrupt())
345 return 1; /* probably decrementer */
346 wait_time = rtas_extended_busy_delay_time(error);
347 msleep_interruptible(wait_time);
348 error = RTAS_CLOCK_BUSY;
349 }
350 } while (error == RTAS_CLOCK_BUSY && (__get_tb() < max_wait_tb));
351
352 if (error != 0 && printk_ratelimit())
353 printk(KERN_WARNING "error: setting the clock failed (%d)\n",
354 error);
355
356 return 0;
357}
358#endif
diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c
index 2e64e8c3e8e5..cb3cf0f22822 100644
--- a/arch/sparc/lib/atomic32.c
+++ b/arch/sparc/lib/atomic32.c
@@ -37,17 +37,43 @@ int __atomic_add_return(int i, atomic_t *v)
37 spin_unlock_irqrestore(ATOMIC_HASH(v), flags); 37 spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
38 return ret; 38 return ret;
39} 39}
40EXPORT_SYMBOL(__atomic_add_return);
40 41
41void atomic_set(atomic_t *v, int i) 42int atomic_cmpxchg(atomic_t *v, int old, int new)
42{ 43{
44 int ret;
43 unsigned long flags; 45 unsigned long flags;
46
44 spin_lock_irqsave(ATOMIC_HASH(v), flags); 47 spin_lock_irqsave(ATOMIC_HASH(v), flags);
48 ret = v->counter;
49 if (likely(ret == old))
50 v->counter = new;
45 51
46 v->counter = i; 52 spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
53 return ret;
54}
55
56int atomic_add_unless(atomic_t *v, int a, int u)
57{
58 int ret;
59 unsigned long flags;
47 60
61 spin_lock_irqsave(ATOMIC_HASH(v), flags);
62 ret = v->counter;
63 if (ret != u)
64 v->counter += a;
48 spin_unlock_irqrestore(ATOMIC_HASH(v), flags); 65 spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
66 return ret != u;
49} 67}
50 68
51EXPORT_SYMBOL(__atomic_add_return); 69static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
52EXPORT_SYMBOL(atomic_set); 70/* Atomic operations are already serializing */
71void atomic_set(atomic_t *v, int i)
72{
73 unsigned long flags;
53 74
75 spin_lock_irqsave(ATOMIC_HASH(v), flags);
76 v->counter = i;
77 spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
78}
79EXPORT_SYMBOL(atomic_set);
diff --git a/arch/sparc/lib/bitext.c b/arch/sparc/lib/bitext.c
index 94b05e8c906c..2e168d16547f 100644
--- a/arch/sparc/lib/bitext.c
+++ b/arch/sparc/lib/bitext.c
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/smp_lock.h> 12#include <linux/smp_lock.h>
13#include <linux/string.h>
13#include <linux/bitops.h> 14#include <linux/bitops.h>
14 15
15#include <asm/bitext.h> 16#include <asm/bitext.h>
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index 3b5f47c46907..563301fe5df8 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -7,7 +7,6 @@ config UML
7 bool 7 bool
8 default y 8 default y
9 9
10# XXX: does UM have a mmu/swap?
11config MMU 10config MMU
12 bool 11 bool
13 default y 12 default y
@@ -36,12 +35,6 @@ config IRQ_RELEASE_METHOD
36 bool 35 bool
37 default y 36 default y
38 37
39menu "Host processor type and features"
40
41source "arch/i386/Kconfig.cpu"
42
43endmenu
44
45menu "UML-specific options" 38menu "UML-specific options"
46 39
47config MODE_TT 40config MODE_TT
@@ -209,7 +202,8 @@ config MAGIC_SYSRQ
209config SMP 202config SMP
210 bool "Symmetric multi-processing support (EXPERIMENTAL)" 203 bool "Symmetric multi-processing support (EXPERIMENTAL)"
211 default n 204 default n
212 depends on (MODE_TT && EXPERIMENTAL && !SMP_BROKEN) || (BROKEN && SMP_BROKEN) 205 #SMP_BROKEN is for x86_64.
206 depends on MODE_TT && EXPERIMENTAL && (!SMP_BROKEN || (BROKEN && SMP_BROKEN))
213 help 207 help
214 This option enables UML SMP support. 208 This option enables UML SMP support.
215 It is NOT related to having a real SMP box. Not directly, at least. 209 It is NOT related to having a real SMP box. Not directly, at least.
diff --git a/arch/um/Kconfig.i386 b/arch/um/Kconfig.i386
index 5d92cacd56c6..c71b39a677aa 100644
--- a/arch/um/Kconfig.i386
+++ b/arch/um/Kconfig.i386
@@ -1,3 +1,9 @@
1menu "Host processor type and features"
2
3source "arch/i386/Kconfig.cpu"
4
5endmenu
6
1config UML_X86 7config UML_X86
2 bool 8 bool
3 default y 9 default y
@@ -42,7 +48,3 @@ config ARCH_HAS_SC_SIGNALS
42config ARCH_REUSE_HOST_VSYSCALL_AREA 48config ARCH_REUSE_HOST_VSYSCALL_AREA
43 bool 49 bool
44 default y 50 default y
45
46config X86_CMPXCHG
47 bool
48 default y
diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386
index 1f7dcb064aee..7a0e04e34bf9 100644
--- a/arch/um/Makefile-i386
+++ b/arch/um/Makefile-i386
@@ -35,4 +35,3 @@ cflags-y += $(call cc-option,-mpreferred-stack-boundary=2)
35 35
36CFLAGS += $(cflags-y) 36CFLAGS += $(cflags-y)
37USER_CFLAGS += $(cflags-y) 37USER_CFLAGS += $(cflags-y)
38
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index 16e7dc89f61d..5b58fad45290 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -89,8 +89,7 @@ static int not_configged_write(int fd, const char *buf, int len, void *data)
89 return(-EIO); 89 return(-EIO);
90} 90}
91 91
92static int not_configged_console_write(int fd, const char *buf, int len, 92static int not_configged_console_write(int fd, const char *buf, int len)
93 void *data)
94{ 93{
95 my_puts("Using a channel type which is configured out of " 94 my_puts("Using a channel type which is configured out of "
96 "UML\n"); 95 "UML\n");
@@ -299,7 +298,7 @@ int console_write_chan(struct list_head *chans, const char *buf, int len)
299 chan = list_entry(ele, struct chan, list); 298 chan = list_entry(ele, struct chan, list);
300 if(!chan->output || (chan->ops->console_write == NULL)) 299 if(!chan->output || (chan->ops->console_write == NULL))
301 continue; 300 continue;
302 n = chan->ops->console_write(chan->fd, buf, len, chan->data); 301 n = chan->ops->console_write(chan->fd, buf, len);
303 if(chan->primary) ret = n; 302 if(chan->primary) ret = n;
304 } 303 }
305 return(ret); 304 return(ret);
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c
index 1c55d5802489..5d50d4a44abf 100644
--- a/arch/um/drivers/chan_user.c
+++ b/arch/um/drivers/chan_user.c
@@ -20,7 +20,7 @@
20#include "choose-mode.h" 20#include "choose-mode.h"
21#include "mode.h" 21#include "mode.h"
22 22
23int generic_console_write(int fd, const char *buf, int n, void *unused) 23int generic_console_write(int fd, const char *buf, int n)
24{ 24{
25 struct termios save, new; 25 struct termios save, new;
26 int err; 26 int err;
diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c
index c1b03f7c1daa..1bb085b2824d 100644
--- a/arch/um/drivers/daemon_user.c
+++ b/arch/um/drivers/daemon_user.c
@@ -98,7 +98,7 @@ static int connect_to_switch(struct daemon_data *pri)
98 printk("daemon_open : control setup request failed, err = %d\n", 98 printk("daemon_open : control setup request failed, err = %d\n",
99 -n); 99 -n);
100 err = -ENOTCONN; 100 err = -ENOTCONN;
101 goto out; 101 goto out_free;
102 } 102 }
103 103
104 n = os_read_file(pri->control, sun, sizeof(*sun)); 104 n = os_read_file(pri->control, sun, sizeof(*sun));
@@ -106,12 +106,14 @@ static int connect_to_switch(struct daemon_data *pri)
106 printk("daemon_open : read of data socket failed, err = %d\n", 106 printk("daemon_open : read of data socket failed, err = %d\n",
107 -n); 107 -n);
108 err = -ENOTCONN; 108 err = -ENOTCONN;
109 goto out_close; 109 goto out_free;
110 } 110 }
111 111
112 pri->data_addr = sun; 112 pri->data_addr = sun;
113 return(fd); 113 return(fd);
114 114
115 out_free:
116 kfree(sun);
115 out_close: 117 out_close:
116 os_close_file(fd); 118 os_close_file(fd);
117 out: 119 out:
diff --git a/arch/um/drivers/fd.c b/arch/um/drivers/fd.c
index f0b888f66e05..3296e86a03a5 100644
--- a/arch/um/drivers/fd.c
+++ b/arch/um/drivers/fd.c
@@ -76,13 +76,6 @@ static void fd_close(int fd, void *d)
76 } 76 }
77} 77}
78 78
79static int fd_console_write(int fd, const char *buf, int n, void *d)
80{
81 struct fd_chan *data = d;
82
83 return(generic_console_write(fd, buf, n, &data->tt));
84}
85
86struct chan_ops fd_ops = { 79struct chan_ops fd_ops = {
87 .type = "fd", 80 .type = "fd",
88 .init = fd_init, 81 .init = fd_init,
@@ -90,7 +83,7 @@ struct chan_ops fd_ops = {
90 .close = fd_close, 83 .close = fd_close,
91 .read = generic_read, 84 .read = generic_read,
92 .write = generic_write, 85 .write = generic_write,
93 .console_write = fd_console_write, 86 .console_write = generic_console_write,
94 .window_size = generic_window_size, 87 .window_size = generic_window_size,
95 .free = generic_free, 88 .free = generic_free,
96 .winch = 1, 89 .winch = 1,
diff --git a/arch/um/drivers/mcast_user.c b/arch/um/drivers/mcast_user.c
index 5db136e2651c..afe85bfa66e0 100644
--- a/arch/um/drivers/mcast_user.c
+++ b/arch/um/drivers/mcast_user.c
@@ -54,7 +54,7 @@ static int mcast_open(void *data)
54 struct mcast_data *pri = data; 54 struct mcast_data *pri = data;
55 struct sockaddr_in *sin = pri->mcast_addr; 55 struct sockaddr_in *sin = pri->mcast_addr;
56 struct ip_mreq mreq; 56 struct ip_mreq mreq;
57 int fd, yes = 1, err = 0; 57 int fd, yes = 1, err = -EINVAL;
58 58
59 59
60 if ((sin->sin_addr.s_addr == 0) || (sin->sin_port == 0)) 60 if ((sin->sin_addr.s_addr == 0) || (sin->sin_port == 0))
@@ -63,40 +63,40 @@ static int mcast_open(void *data)
63 fd = socket(AF_INET, SOCK_DGRAM, 0); 63 fd = socket(AF_INET, SOCK_DGRAM, 0);
64 64
65 if (fd < 0){ 65 if (fd < 0){
66 err = -errno;
66 printk("mcast_open : data socket failed, errno = %d\n", 67 printk("mcast_open : data socket failed, errno = %d\n",
67 errno); 68 errno);
68 err = -errno;
69 goto out; 69 goto out;
70 } 70 }
71 71
72 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0) { 72 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0) {
73 err = -errno;
73 printk("mcast_open: SO_REUSEADDR failed, errno = %d\n", 74 printk("mcast_open: SO_REUSEADDR failed, errno = %d\n",
74 errno); 75 errno);
75 err = -errno;
76 goto out_close; 76 goto out_close;
77 } 77 }
78 78
79 /* set ttl according to config */ 79 /* set ttl according to config */
80 if (setsockopt(fd, SOL_IP, IP_MULTICAST_TTL, &pri->ttl, 80 if (setsockopt(fd, SOL_IP, IP_MULTICAST_TTL, &pri->ttl,
81 sizeof(pri->ttl)) < 0) { 81 sizeof(pri->ttl)) < 0) {
82 err = -errno;
82 printk("mcast_open: IP_MULTICAST_TTL failed, error = %d\n", 83 printk("mcast_open: IP_MULTICAST_TTL failed, error = %d\n",
83 errno); 84 errno);
84 err = -errno;
85 goto out_close; 85 goto out_close;
86 } 86 }
87 87
88 /* set LOOP, so data does get fed back to local sockets */ 88 /* set LOOP, so data does get fed back to local sockets */
89 if (setsockopt(fd, SOL_IP, IP_MULTICAST_LOOP, &yes, sizeof(yes)) < 0) { 89 if (setsockopt(fd, SOL_IP, IP_MULTICAST_LOOP, &yes, sizeof(yes)) < 0) {
90 err = -errno;
90 printk("mcast_open: IP_MULTICAST_LOOP failed, error = %d\n", 91 printk("mcast_open: IP_MULTICAST_LOOP failed, error = %d\n",
91 errno); 92 errno);
92 err = -errno;
93 goto out_close; 93 goto out_close;
94 } 94 }
95 95
96 /* bind socket to mcast address */ 96 /* bind socket to mcast address */
97 if (bind(fd, (struct sockaddr *) sin, sizeof(*sin)) < 0) { 97 if (bind(fd, (struct sockaddr *) sin, sizeof(*sin)) < 0) {
98 printk("mcast_open : data bind failed, errno = %d\n", errno);
99 err = -errno; 98 err = -errno;
99 printk("mcast_open : data bind failed, errno = %d\n", errno);
100 goto out_close; 100 goto out_close;
101 } 101 }
102 102
@@ -105,22 +105,22 @@ static int mcast_open(void *data)
105 mreq.imr_interface.s_addr = 0; 105 mreq.imr_interface.s_addr = 0;
106 if (setsockopt(fd, SOL_IP, IP_ADD_MEMBERSHIP, 106 if (setsockopt(fd, SOL_IP, IP_ADD_MEMBERSHIP,
107 &mreq, sizeof(mreq)) < 0) { 107 &mreq, sizeof(mreq)) < 0) {
108 err = -errno;
108 printk("mcast_open: IP_ADD_MEMBERSHIP failed, error = %d\n", 109 printk("mcast_open: IP_ADD_MEMBERSHIP failed, error = %d\n",
109 errno); 110 errno);
110 printk("There appears not to be a multicast-capable network " 111 printk("There appears not to be a multicast-capable network "
111 "interface on the host.\n"); 112 "interface on the host.\n");
112 printk("eth0 should be configured in order to use the " 113 printk("eth0 should be configured in order to use the "
113 "multicast transport.\n"); 114 "multicast transport.\n");
114 err = -errno; 115 goto out_close;
115 goto out_close;
116 } 116 }
117 117
118 return fd; 118 return fd;
119 119
120 out_close: 120 out_close:
121 os_close_file(fd); 121 os_close_file(fd);
122 out: 122 out:
123 return err; 123 return err;
124} 124}
125 125
126static void mcast_close(int fd, void *data) 126static void mcast_close(int fd, void *data)
diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c
index ed4a1a6c5d83..c43e8bb32502 100644
--- a/arch/um/drivers/port_user.c
+++ b/arch/um/drivers/port_user.c
@@ -100,13 +100,6 @@ static void port_close(int fd, void *d)
100 os_close_file(fd); 100 os_close_file(fd);
101} 101}
102 102
103static int port_console_write(int fd, const char *buf, int n, void *d)
104{
105 struct port_chan *data = d;
106
107 return(generic_console_write(fd, buf, n, &data->tt));
108}
109
110struct chan_ops port_ops = { 103struct chan_ops port_ops = {
111 .type = "port", 104 .type = "port",
112 .init = port_init, 105 .init = port_init,
@@ -114,7 +107,7 @@ struct chan_ops port_ops = {
114 .close = port_close, 107 .close = port_close,
115 .read = generic_read, 108 .read = generic_read,
116 .write = generic_write, 109 .write = generic_write,
117 .console_write = port_console_write, 110 .console_write = generic_console_write,
118 .window_size = generic_window_size, 111 .window_size = generic_window_size,
119 .free = port_free, 112 .free = port_free,
120 .winch = 1, 113 .winch = 1,
diff --git a/arch/um/drivers/pty.c b/arch/um/drivers/pty.c
index 0306a1b215b7..1c555c38de4d 100644
--- a/arch/um/drivers/pty.c
+++ b/arch/um/drivers/pty.c
@@ -118,13 +118,6 @@ static int pty_open(int input, int output, int primary, void *d,
118 return(fd); 118 return(fd);
119} 119}
120 120
121static int pty_console_write(int fd, const char *buf, int n, void *d)
122{
123 struct pty_chan *data = d;
124
125 return(generic_console_write(fd, buf, n, &data->tt));
126}
127
128struct chan_ops pty_ops = { 121struct chan_ops pty_ops = {
129 .type = "pty", 122 .type = "pty",
130 .init = pty_chan_init, 123 .init = pty_chan_init,
@@ -132,7 +125,7 @@ struct chan_ops pty_ops = {
132 .close = generic_close, 125 .close = generic_close,
133 .read = generic_read, 126 .read = generic_read,
134 .write = generic_write, 127 .write = generic_write,
135 .console_write = pty_console_write, 128 .console_write = generic_console_write,
136 .window_size = generic_window_size, 129 .window_size = generic_window_size,
137 .free = generic_free, 130 .free = generic_free,
138 .winch = 0, 131 .winch = 0,
@@ -145,7 +138,7 @@ struct chan_ops pts_ops = {
145 .close = generic_close, 138 .close = generic_close,
146 .read = generic_read, 139 .read = generic_read,
147 .write = generic_write, 140 .write = generic_write,
148 .console_write = pty_console_write, 141 .console_write = generic_console_write,
149 .window_size = generic_window_size, 142 .window_size = generic_window_size,
150 .free = generic_free, 143 .free = generic_free,
151 .winch = 0, 144 .winch = 0,
diff --git a/arch/um/drivers/tty.c b/arch/um/drivers/tty.c
index 6fbb670ee274..94c9265a4f2c 100644
--- a/arch/um/drivers/tty.c
+++ b/arch/um/drivers/tty.c
@@ -60,13 +60,6 @@ static int tty_open(int input, int output, int primary, void *d,
60 return(fd); 60 return(fd);
61} 61}
62 62
63static int tty_console_write(int fd, const char *buf, int n, void *d)
64{
65 struct tty_chan *data = d;
66
67 return(generic_console_write(fd, buf, n, &data->tt));
68}
69
70struct chan_ops tty_ops = { 63struct chan_ops tty_ops = {
71 .type = "tty", 64 .type = "tty",
72 .init = tty_chan_init, 65 .init = tty_chan_init,
@@ -74,7 +67,7 @@ struct chan_ops tty_ops = {
74 .close = generic_close, 67 .close = generic_close,
75 .read = generic_read, 68 .read = generic_read,
76 .write = generic_write, 69 .write = generic_write,
77 .console_write = tty_console_write, 70 .console_write = generic_console_write,
78 .window_size = generic_window_size, 71 .window_size = generic_window_size,
79 .free = generic_free, 72 .free = generic_free,
80 .winch = 0, 73 .winch = 0,
diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c
index b530f1a6540d..aaa636661043 100644
--- a/arch/um/drivers/xterm.c
+++ b/arch/um/drivers/xterm.c
@@ -194,13 +194,6 @@ static void xterm_free(void *d)
194 free(d); 194 free(d);
195} 195}
196 196
197static int xterm_console_write(int fd, const char *buf, int n, void *d)
198{
199 struct xterm_chan *data = d;
200
201 return(generic_console_write(fd, buf, n, &data->tt));
202}
203
204struct chan_ops xterm_ops = { 197struct chan_ops xterm_ops = {
205 .type = "xterm", 198 .type = "xterm",
206 .init = xterm_init, 199 .init = xterm_init,
@@ -208,7 +201,7 @@ struct chan_ops xterm_ops = {
208 .close = xterm_close, 201 .close = xterm_close,
209 .read = generic_read, 202 .read = generic_read,
210 .write = generic_write, 203 .write = generic_write,
211 .console_write = xterm_console_write, 204 .console_write = generic_console_write,
212 .window_size = generic_window_size, 205 .window_size = generic_window_size,
213 .free = xterm_free, 206 .free = xterm_free,
214 .winch = 1, 207 .winch = 1,
diff --git a/arch/um/include/chan_user.h b/arch/um/include/chan_user.h
index f77d9aa4c164..659bb3cac32f 100644
--- a/arch/um/include/chan_user.h
+++ b/arch/um/include/chan_user.h
@@ -25,7 +25,7 @@ struct chan_ops {
25 void (*close)(int, void *); 25 void (*close)(int, void *);
26 int (*read)(int, char *, void *); 26 int (*read)(int, char *, void *);
27 int (*write)(int, const char *, int, void *); 27 int (*write)(int, const char *, int, void *);
28 int (*console_write)(int, const char *, int, void *); 28 int (*console_write)(int, const char *, int);
29 int (*window_size)(int, void *, unsigned short *, unsigned short *); 29 int (*window_size)(int, void *, unsigned short *, unsigned short *);
30 void (*free)(void *); 30 void (*free)(void *);
31 int winch; 31 int winch;
@@ -37,7 +37,7 @@ extern struct chan_ops fd_ops, null_ops, port_ops, pts_ops, pty_ops, tty_ops,
37extern void generic_close(int fd, void *unused); 37extern void generic_close(int fd, void *unused);
38extern int generic_read(int fd, char *c_out, void *unused); 38extern int generic_read(int fd, char *c_out, void *unused);
39extern int generic_write(int fd, const char *buf, int n, void *unused); 39extern int generic_write(int fd, const char *buf, int n, void *unused);
40extern int generic_console_write(int fd, const char *buf, int n, void *state); 40extern int generic_console_write(int fd, const char *buf, int n);
41extern int generic_window_size(int fd, void *unused, unsigned short *rows_out, 41extern int generic_window_size(int fd, void *unused, unsigned short *rows_out,
42 unsigned short *cols_out); 42 unsigned short *cols_out);
43extern void generic_free(void *data); 43extern void generic_free(void *data);
diff --git a/arch/um/include/um_uaccess.h b/arch/um/include/um_uaccess.h
index 84c0868cd561..f8760a3f43b0 100644
--- a/arch/um/include/um_uaccess.h
+++ b/arch/um/include/um_uaccess.h
@@ -17,8 +17,25 @@
17#include "uaccess-skas.h" 17#include "uaccess-skas.h"
18#endif 18#endif
19 19
20#define __under_task_size(addr, size) \
21 (((unsigned long) (addr) < TASK_SIZE) && \
22 (((unsigned long) (addr) + (size)) < TASK_SIZE))
23
24#define __access_ok_vsyscall(type, addr, size) \
25 ((type == VERIFY_READ) && \
26 ((unsigned long) (addr) >= FIXADDR_USER_START) && \
27 ((unsigned long) (addr) + (size) <= FIXADDR_USER_END) && \
28 ((unsigned long) (addr) + (size) >= (unsigned long)(addr)))
29
30#define __addr_range_nowrap(addr, size) \
31 ((unsigned long) (addr) <= ((unsigned long) (addr) + (size)))
32
20#define access_ok(type, addr, size) \ 33#define access_ok(type, addr, size) \
21 CHOOSE_MODE_PROC(access_ok_tt, access_ok_skas, type, addr, size) 34 (__addr_range_nowrap(addr, size) && \
35 (__under_task_size(addr, size) || \
36 __access_ok_vsyscall(type, addr, size) || \
37 segment_eq(get_fs(), KERNEL_DS) || \
38 CHOOSE_MODE_PROC(access_ok_tt, access_ok_skas, type, addr, size)))
22 39
23static inline int copy_from_user(void *to, const void __user *from, int n) 40static inline int copy_from_user(void *to, const void __user *from, int n)
24{ 41{
diff --git a/arch/um/kernel/skas/include/uaccess-skas.h b/arch/um/kernel/skas/include/uaccess-skas.h
index 7da0c2def0ef..f611f83ad4ff 100644
--- a/arch/um/kernel/skas/include/uaccess-skas.h
+++ b/arch/um/kernel/skas/include/uaccess-skas.h
@@ -9,14 +9,8 @@
9#include "asm/errno.h" 9#include "asm/errno.h"
10#include "asm/fixmap.h" 10#include "asm/fixmap.h"
11 11
12#define access_ok_skas(type, addr, size) \ 12/* No SKAS-specific checking. */
13 ((segment_eq(get_fs(), KERNEL_DS)) || \ 13#define access_ok_skas(type, addr, size) 0
14 (((unsigned long) (addr) < TASK_SIZE) && \
15 ((unsigned long) (addr) + (size) <= TASK_SIZE)) || \
16 ((type == VERIFY_READ ) && \
17 ((unsigned long) (addr) >= FIXADDR_USER_START) && \
18 ((unsigned long) (addr) + (size) <= FIXADDR_USER_END) && \
19 ((unsigned long) (addr) + (size) >= (unsigned long)(addr))))
20 14
21extern int copy_from_user_skas(void *to, const void __user *from, int n); 15extern int copy_from_user_skas(void *to, const void __user *from, int n);
22extern int copy_to_user_skas(void __user *to, const void *from, int n); 16extern int copy_to_user_skas(void __user *to, const void *from, int n);
diff --git a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c
index 75195281081e..a5a47528dec7 100644
--- a/arch/um/kernel/skas/uaccess.c
+++ b/arch/um/kernel/skas/uaccess.c
@@ -143,7 +143,7 @@ int copy_from_user_skas(void *to, const void __user *from, int n)
143 return(0); 143 return(0);
144 } 144 }
145 145
146 return(access_ok_skas(VERIFY_READ, from, n) ? 146 return(access_ok(VERIFY_READ, from, n) ?
147 buffer_op((unsigned long) from, n, 0, copy_chunk_from_user, &to): 147 buffer_op((unsigned long) from, n, 0, copy_chunk_from_user, &to):
148 n); 148 n);
149} 149}
@@ -164,7 +164,7 @@ int copy_to_user_skas(void __user *to, const void *from, int n)
164 return(0); 164 return(0);
165 } 165 }
166 166
167 return(access_ok_skas(VERIFY_WRITE, to, n) ? 167 return(access_ok(VERIFY_WRITE, to, n) ?
168 buffer_op((unsigned long) to, n, 1, copy_chunk_to_user, &from) : 168 buffer_op((unsigned long) to, n, 1, copy_chunk_to_user, &from) :
169 n); 169 n);
170} 170}
@@ -193,7 +193,7 @@ int strncpy_from_user_skas(char *dst, const char __user *src, int count)
193 return(strnlen(dst, count)); 193 return(strnlen(dst, count));
194 } 194 }
195 195
196 if(!access_ok_skas(VERIFY_READ, src, 1)) 196 if(!access_ok(VERIFY_READ, src, 1))
197 return(-EFAULT); 197 return(-EFAULT);
198 198
199 n = buffer_op((unsigned long) src, count, 0, strncpy_chunk_from_user, 199 n = buffer_op((unsigned long) src, count, 0, strncpy_chunk_from_user,
@@ -221,7 +221,7 @@ int clear_user_skas(void __user *mem, int len)
221 return(0); 221 return(0);
222 } 222 }
223 223
224 return(access_ok_skas(VERIFY_WRITE, mem, len) ? 224 return(access_ok(VERIFY_WRITE, mem, len) ?
225 buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL) : len); 225 buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL) : len);
226} 226}
227 227
diff --git a/arch/um/kernel/trap_kern.c b/arch/um/kernel/trap_kern.c
index 95c8f8733baf..0d4c10a73607 100644
--- a/arch/um/kernel/trap_kern.c
+++ b/arch/um/kernel/trap_kern.c
@@ -95,7 +95,16 @@ survive:
95 pte = pte_offset_kernel(pmd, address); 95 pte = pte_offset_kernel(pmd, address);
96 } while(!pte_present(*pte)); 96 } while(!pte_present(*pte));
97 err = 0; 97 err = 0;
98 /* The below warning was added in place of
99 * pte_mkyoung(); if (is_write) pte_mkdirty();
100 * If it's triggered, we'd see normally a hang here (a clean pte is
101 * marked read-only to emulate the dirty bit).
102 * However, the generic code can mark a PTE writable but clean on a
103 * concurrent read fault, triggering this harmlessly. So comment it out.
104 */
105#if 0
98 WARN_ON(!pte_young(*pte) || (is_write && !pte_dirty(*pte))); 106 WARN_ON(!pte_young(*pte) || (is_write && !pte_dirty(*pte)));
107#endif
99 flush_tlb_page(vma, address); 108 flush_tlb_page(vma, address);
100out: 109out:
101 up_read(&mm->mmap_sem); 110 up_read(&mm->mmap_sem);
diff --git a/arch/um/kernel/tt/include/uaccess-tt.h b/arch/um/kernel/tt/include/uaccess-tt.h
index dc2ebfa8c54f..b9bfe9c481c4 100644
--- a/arch/um/kernel/tt/include/uaccess-tt.h
+++ b/arch/um/kernel/tt/include/uaccess-tt.h
@@ -19,19 +19,13 @@
19extern unsigned long end_vm; 19extern unsigned long end_vm;
20extern unsigned long uml_physmem; 20extern unsigned long uml_physmem;
21 21
22#define under_task_size(addr, size) \
23 (((unsigned long) (addr) < TASK_SIZE) && \
24 (((unsigned long) (addr) + (size)) < TASK_SIZE))
25
26#define is_stack(addr, size) \ 22#define is_stack(addr, size) \
27 (((unsigned long) (addr) < STACK_TOP) && \ 23 (((unsigned long) (addr) < STACK_TOP) && \
28 ((unsigned long) (addr) >= STACK_TOP - ABOVE_KMEM) && \ 24 ((unsigned long) (addr) >= STACK_TOP - ABOVE_KMEM) && \
29 (((unsigned long) (addr) + (size)) <= STACK_TOP)) 25 (((unsigned long) (addr) + (size)) <= STACK_TOP))
30 26
31#define access_ok_tt(type, addr, size) \ 27#define access_ok_tt(type, addr, size) \
32 ((type == VERIFY_READ) || (segment_eq(get_fs(), KERNEL_DS)) || \ 28 (is_stack(addr, size))
33 (((unsigned long) (addr) <= ((unsigned long) (addr) + (size))) && \
34 (under_task_size(addr, size) || is_stack(addr, size))))
35 29
36extern unsigned long get_fault_addr(void); 30extern unsigned long get_fault_addr(void);
37 31
diff --git a/arch/um/kernel/tt/uaccess.c b/arch/um/kernel/tt/uaccess.c
index a72aa632972f..1cb60726567e 100644
--- a/arch/um/kernel/tt/uaccess.c
+++ b/arch/um/kernel/tt/uaccess.c
@@ -8,7 +8,7 @@
8 8
9int copy_from_user_tt(void *to, const void __user *from, int n) 9int copy_from_user_tt(void *to, const void __user *from, int n)
10{ 10{
11 if(!access_ok_tt(VERIFY_READ, from, n)) 11 if(!access_ok(VERIFY_READ, from, n))
12 return(n); 12 return(n);
13 13
14 return(__do_copy_from_user(to, from, n, &current->thread.fault_addr, 14 return(__do_copy_from_user(to, from, n, &current->thread.fault_addr,
@@ -17,7 +17,7 @@ int copy_from_user_tt(void *to, const void __user *from, int n)
17 17
18int copy_to_user_tt(void __user *to, const void *from, int n) 18int copy_to_user_tt(void __user *to, const void *from, int n)
19{ 19{
20 if(!access_ok_tt(VERIFY_WRITE, to, n)) 20 if(!access_ok(VERIFY_WRITE, to, n))
21 return(n); 21 return(n);
22 22
23 return(__do_copy_to_user(to, from, n, &current->thread.fault_addr, 23 return(__do_copy_to_user(to, from, n, &current->thread.fault_addr,
@@ -28,7 +28,7 @@ int strncpy_from_user_tt(char *dst, const char __user *src, int count)
28{ 28{
29 int n; 29 int n;
30 30
31 if(!access_ok_tt(VERIFY_READ, src, 1)) 31 if(!access_ok(VERIFY_READ, src, 1))
32 return(-EFAULT); 32 return(-EFAULT);
33 33
34 n = __do_strncpy_from_user(dst, src, count, 34 n = __do_strncpy_from_user(dst, src, count,
@@ -47,7 +47,7 @@ int __clear_user_tt(void __user *mem, int len)
47 47
48int clear_user_tt(void __user *mem, int len) 48int clear_user_tt(void __user *mem, int len)
49{ 49{
50 if(!access_ok_tt(VERIFY_WRITE, mem, len)) 50 if(!access_ok(VERIFY_WRITE, mem, len))
51 return(len); 51 return(len);
52 52
53 return(__do_clear_user(mem, len, &current->thread.fault_addr, 53 return(__do_clear_user(mem, len, &current->thread.fault_addr,
diff --git a/arch/x86_64/kernel/i8259.c b/arch/x86_64/kernel/i8259.c
index c6c9791d77c1..a9368d4c4aba 100644
--- a/arch/x86_64/kernel/i8259.c
+++ b/arch/x86_64/kernel/i8259.c
@@ -515,7 +515,7 @@ void i8254_timer_resume(void)
515} 515}
516 516
517static struct sysdev_class timer_sysclass = { 517static struct sysdev_class timer_sysclass = {
518 set_kset_name("timer"), 518 set_kset_name("timer_pit"),
519 .resume = timer_resume, 519 .resume = timer_resume,
520}; 520};
521 521