aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/arm/Samsung-S3C24XX/Suspend.txt35
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c4
-rw-r--r--arch/arm/mach-omap1/clock.c20
-rw-r--r--arch/arm/mach-omap1/irq.c2
-rw-r--r--arch/arm/mach-omap1/pm.c12
-rw-r--r--arch/arm/mach-omap1/serial.c18
-rw-r--r--arch/arm/mach-omap2/board-h4.c13
-rw-r--r--arch/arm/mach-omap2/timer-gp.c3
-rw-r--r--arch/arm/mach-pxa/corgi_pm.c3
-rw-r--r--arch/arm/mach-pxa/spitz_pm.c3
-rw-r--r--arch/arm/oprofile/common.c3
-rw-r--r--arch/arm/plat-omap/dma.c14
-rw-r--r--arch/arm/plat-omap/dmtimer.c6
-rw-r--r--arch/arm/plat-omap/gpio.c9
-rw-r--r--arch/arm/plat-omap/mcbsp.c2
-rw-r--r--arch/arm/plat-omap/mux.c4
-rw-r--r--arch/arm/plat-s3c24xx/Kconfig7
-rw-r--r--drivers/acorn/char/Makefile1
-rw-r--r--drivers/acorn/char/i2c.c368
-rw-r--r--drivers/acorn/char/pcf8583.c284
-rw-r--r--drivers/acorn/char/pcf8583.h41
-rw-r--r--drivers/i2c/busses/Kconfig10
-rw-r--r--drivers/i2c/busses/Makefile1
-rw-r--r--drivers/i2c/busses/i2c-acorn.c97
-rw-r--r--drivers/rtc/Kconfig8
-rw-r--r--drivers/rtc/rtc-pcf8583.c29
-rw-r--r--drivers/scsi/arm/cumana_2.c4
-rw-r--r--drivers/scsi/arm/eesox.c4
-rw-r--r--drivers/scsi/arm/fas216.c9
-rw-r--r--drivers/scsi/arm/powertec.c5
-rw-r--r--drivers/scsi/arm/scsi.h2
-rw-r--r--include/asm-arm/arch-omap/entry-macro.S6
-rw-r--r--include/asm-arm/arch-omap/memory.h2
-rw-r--r--include/asm-arm/arch-omap/omap-alsa.h12
-rw-r--r--include/asm-arm/system.h40
36 files changed, 280 insertions, 802 deletions
diff --git a/Documentation/arm/Samsung-S3C24XX/Suspend.txt b/Documentation/arm/Samsung-S3C24XX/Suspend.txt
index e12bc3284a27..0dab6e32c130 100644
--- a/Documentation/arm/Samsung-S3C24XX/Suspend.txt
+++ b/Documentation/arm/Samsung-S3C24XX/Suspend.txt
@@ -5,10 +5,10 @@
5Introduction 5Introduction
6------------ 6------------
7 7
8 The S3C2410 supports a low-power suspend mode, where the SDRAM is kept 8 The S3C24XX supports a low-power suspend mode, where the SDRAM is kept
9 in Self-Refresh mode, and all but the essential peripheral blocks are 9 in Self-Refresh mode, and all but the essential peripheral blocks are
10 powered down. For more information on how this works, please look 10 powered down. For more information on how this works, please look
11 at the S3C2410 datasheets from Samsung. 11 at the relevant CPU datasheet from Samsung.
12 12
13 13
14Requirements 14Requirements
@@ -56,6 +56,27 @@ Machine Support
56 Note, the original method of adding an late_initcall() is wrong, 56 Note, the original method of adding an late_initcall() is wrong,
57 and will end up initialising all compiled machines' pm init! 57 and will end up initialising all compiled machines' pm init!
58 58
59 The following is an example of code used for testing wakeup from
60 an falling edge on IRQ_EINT0:
61
62
63static irqreturn_t button_irq(int irq, void *pw)
64{
65 return IRQ_HANDLED;
66}
67
68statuc void __init machine_init(void)
69{
70 ...
71
72 request_irq(IRQ_EINT0, button_irq, IRQF_TRIGGER_FALLING,
73 "button-irq-eint0", NULL);
74
75 enable_irq_wake(IRQ_EINT0);
76
77 s3c2410_pm_init();
78}
79
59 80
60Debugging 81Debugging
61--------- 82---------
@@ -70,6 +91,12 @@ Debugging
70 care should be taken that any external clock sources that the UARTs 91 care should be taken that any external clock sources that the UARTs
71 rely on are still enabled at that point. 92 rely on are still enabled at that point.
72 93
94 3) If any debugging is placed in the resume path, then it must have the
95 relevant clocks and peripherals setup before use (ie, bootloader).
96
97 For example, if you transmit a character from the UART, the baud
98 rate and uart controls must be setup beforehand.
99
73 100
74Configuration 101Configuration
75------------- 102-------------
@@ -89,6 +116,10 @@ Configuration
89 Allows the entire memory to be checksummed before and after the 116 Allows the entire memory to be checksummed before and after the
90 suspend to see if there has been any corruption of the contents. 117 suspend to see if there has been any corruption of the contents.
91 118
119 Note, the time to calculate the CRC is dependant on the CPU speed
120 and the size of memory. For an 64Mbyte RAM area on an 200MHz
121 S3C2410, this can take approximately 4 seconds to complete.
122
92 This support requires the CRC32 function to be enabled. 123 This support requires the CRC32 function to be enabled.
93 124
94 125
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index d75879d9ddeb..ac2ffdcfbbb4 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -190,6 +190,7 @@ config ARCH_CO285
190config ARCH_EBSA110 190config ARCH_EBSA110
191 bool "EBSA-110" 191 bool "EBSA-110"
192 select ISA 192 select ISA
193 select NO_IOPORT
193 help 194 help
194 This is an evaluation board for the StrongARM processor available 195 This is an evaluation board for the StrongARM processor available
195 from Digital. It has limited hardware on-board, including an 196 from Digital. It has limited hardware on-board, including an
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index cbe909bad79b..70014f751bc4 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -16,6 +16,8 @@
16 16
17#include <linux/spi/spi.h> 17#include <linux/spi/spi.h>
18#include <linux/spi/ads7846.h> 18#include <linux/spi/ads7846.h>
19#include <linux/workqueue.h>
20#include <linux/delay.h>
19 21
20#include <asm/hardware.h> 22#include <asm/hardware.h>
21#include <asm/mach-types.h> 23#include <asm/mach-types.h>
@@ -103,7 +105,7 @@ static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata =
103 105
104static struct spi_board_info nokia770_spi_board_info[] __initdata = { 106static struct spi_board_info nokia770_spi_board_info[] __initdata = {
105 [0] = { 107 [0] = {
106 .modalias = "lcd_lph8923", 108 .modalias = "lcd_mipid",
107 .bus_num = 2, 109 .bus_num = 2,
108 .chip_select = 3, 110 .chip_select = 3,
109 .max_speed_hz = 12000000, 111 .max_speed_hz = 12000000,
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index 638490e62d5f..f625f6dd228a 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -432,8 +432,7 @@ static int omap1_clk_enable(struct clk *clk)
432 } 432 }
433 433
434 if (clk->flags & CLOCK_NO_IDLE_PARENT) 434 if (clk->flags & CLOCK_NO_IDLE_PARENT)
435 if (!cpu_is_omap24xx()) 435 omap1_clk_deny_idle(clk->parent);
436 omap1_clk_deny_idle(clk->parent);
437 } 436 }
438 437
439 ret = clk->enable(clk); 438 ret = clk->enable(clk);
@@ -454,8 +453,7 @@ static void omap1_clk_disable(struct clk *clk)
454 if (likely(clk->parent)) { 453 if (likely(clk->parent)) {
455 omap1_clk_disable(clk->parent); 454 omap1_clk_disable(clk->parent);
456 if (clk->flags & CLOCK_NO_IDLE_PARENT) 455 if (clk->flags & CLOCK_NO_IDLE_PARENT)
457 if (!cpu_is_omap24xx()) 456 omap1_clk_allow_idle(clk->parent);
458 omap1_clk_allow_idle(clk->parent);
459 } 457 }
460 } 458 }
461} 459}
@@ -471,7 +469,7 @@ static int omap1_clk_enable_generic(struct clk *clk)
471 if (unlikely(clk->enable_reg == 0)) { 469 if (unlikely(clk->enable_reg == 0)) {
472 printk(KERN_ERR "clock.c: Enable for %s without enable code\n", 470 printk(KERN_ERR "clock.c: Enable for %s without enable code\n",
473 clk->name); 471 clk->name);
474 return 0; 472 return -EINVAL;
475 } 473 }
476 474
477 if (clk->flags & ENABLE_REG_32BIT) { 475 if (clk->flags & ENABLE_REG_32BIT) {
@@ -651,10 +649,18 @@ int __init omap1_clk_init(void)
651 int crystal_type = 0; /* Default 12 MHz */ 649 int crystal_type = 0; /* Default 12 MHz */
652 u32 reg; 650 u32 reg;
653 651
652#ifdef CONFIG_DEBUG_LL
653 /* Resets some clocks that may be left on from bootloader,
654 * but leaves serial clocks on.
655 */
656 omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
657#endif
658
654 /* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */ 659 /* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */
655 reg = omap_readw(SOFT_REQ_REG) & (1 << 4); 660 reg = omap_readw(SOFT_REQ_REG) & (1 << 4);
656 omap_writew(reg, SOFT_REQ_REG); 661 omap_writew(reg, SOFT_REQ_REG);
657 omap_writew(0, SOFT_REQ_REG2); 662 if (!cpu_is_omap15xx())
663 omap_writew(0, SOFT_REQ_REG2);
658 664
659 clk_init(&omap1_clk_functions); 665 clk_init(&omap1_clk_functions);
660 666
@@ -685,7 +691,7 @@ int __init omap1_clk_init(void)
685 691
686 info = omap_get_config(OMAP_TAG_CLOCK, struct omap_clock_config); 692 info = omap_get_config(OMAP_TAG_CLOCK, struct omap_clock_config);
687 if (info != NULL) { 693 if (info != NULL) {
688 if (!cpu_is_omap1510()) 694 if (!cpu_is_omap15xx())
689 crystal_type = info->system_clock_type; 695 crystal_type = info->system_clock_type;
690 } 696 }
691 697
diff --git a/arch/arm/mach-omap1/irq.c b/arch/arm/mach-omap1/irq.c
index 6383a12ad970..410d3e78dd0f 100644
--- a/arch/arm/mach-omap1/irq.c
+++ b/arch/arm/mach-omap1/irq.c
@@ -238,7 +238,7 @@ void __init omap_init_irq(void)
238 238
239 if (cpu_is_omap730()) 239 if (cpu_is_omap730())
240 omap_unmask_irq(INT_730_IH2_IRQ); 240 omap_unmask_irq(INT_730_IH2_IRQ);
241 else if (cpu_is_omap1510()) 241 else if (cpu_is_omap15xx())
242 omap_unmask_irq(INT_1510_IH2_IRQ); 242 omap_unmask_irq(INT_1510_IH2_IRQ);
243 else if (cpu_is_omap16xx()) 243 else if (cpu_is_omap16xx())
244 omap_unmask_irq(INT_1610_IH2_IRQ); 244 omap_unmask_irq(INT_1610_IH2_IRQ);
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 4834758d340c..49efe903dacd 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -256,7 +256,8 @@ void omap_pm_suspend(void)
256 tps65010_set_led(LED1, OFF); 256 tps65010_set_led(LED1, OFF);
257 } 257 }
258 258
259 omap_writew(0xffff, ULPD_SOFT_DISABLE_REQ_REG); 259 if (!cpu_is_omap15xx())
260 omap_writew(0xffff, ULPD_SOFT_DISABLE_REQ_REG);
260 261
261 /* 262 /*
262 * Step 1: turn off interrupts (FIXME: NOTE: already disabled) 263 * Step 1: turn off interrupts (FIXME: NOTE: already disabled)
@@ -434,7 +435,8 @@ void omap_pm_suspend(void)
434 MPUI1610_RESTORE(OMAP_IH2_3_MIR); 435 MPUI1610_RESTORE(OMAP_IH2_3_MIR);
435 } 436 }
436 437
437 omap_writew(0, ULPD_SOFT_DISABLE_REQ_REG); 438 if (!cpu_is_omap15xx())
439 omap_writew(0, ULPD_SOFT_DISABLE_REQ_REG);
438 440
439 /* 441 /*
440 * Reenable interrupts 442 * Reenable interrupts
@@ -704,6 +706,8 @@ static struct pm_ops omap_pm_ops ={
704 706
705static int __init omap_pm_init(void) 707static int __init omap_pm_init(void)
706{ 708{
709 int error;
710
707 printk("Power Management for TI OMAP.\n"); 711 printk("Power Management for TI OMAP.\n");
708 712
709 /* 713 /*
@@ -760,7 +764,9 @@ static int __init omap_pm_init(void)
760 omap_pm_init_proc(); 764 omap_pm_init_proc();
761#endif 765#endif
762 766
763 subsys_create_file(&power_subsys, &sleep_while_idle_attr); 767 error = subsys_create_file(&power_subsys, &sleep_while_idle_attr);
768 if (error)
769 printk(KERN_ERR "subsys_create_file failed: %d\n", error);
764 770
765 if (cpu_is_omap16xx()) { 771 if (cpu_is_omap16xx()) {
766 /* configure LOW_PWR pin */ 772 /* configure LOW_PWR pin */
diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
index 4cc98a578e4b..10a4fe88b2fd 100644
--- a/arch/arm/mach-omap1/serial.c
+++ b/arch/arm/mach-omap1/serial.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/arch/arm/mach-omap1/serial.c 2 * linux/arch/arm/mach-omap1/serial.c
3 * 3 *
4 * OMAP1 CPU identification code 4 * OMAP1 serial support.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License version 2 as
@@ -59,7 +59,7 @@ static void __init omap_serial_reset(struct plat_serial8250_port *p)
59 omap_serial_outp(p, UART_OMAP_SCR, 0x08); /* TX watermark */ 59 omap_serial_outp(p, UART_OMAP_SCR, 0x08); /* TX watermark */
60 omap_serial_outp(p, UART_OMAP_MDR1, 0x00); /* enable UART */ 60 omap_serial_outp(p, UART_OMAP_MDR1, 0x00); /* enable UART */
61 61
62 if (!cpu_is_omap1510()) { 62 if (!cpu_is_omap15xx()) {
63 omap_serial_outp(p, UART_OMAP_SYSC, 0x01); 63 omap_serial_outp(p, UART_OMAP_SYSC, 0x01);
64 while (!(omap_serial_in(p, UART_OMAP_SYSC) & 0x01)); 64 while (!(omap_serial_in(p, UART_OMAP_SYSC) & 0x01));
65 } 65 }
@@ -121,7 +121,7 @@ void __init omap_serial_init(void)
121 serial_platform_data[1].irq = INT_730_UART_MODEM_IRDA_2; 121 serial_platform_data[1].irq = INT_730_UART_MODEM_IRDA_2;
122 } 122 }
123 123
124 if (cpu_is_omap1510()) { 124 if (cpu_is_omap15xx()) {
125 serial_platform_data[0].uartclk = OMAP1510_BASE_BAUD * 16; 125 serial_platform_data[0].uartclk = OMAP1510_BASE_BAUD * 16;
126 serial_platform_data[1].uartclk = OMAP1510_BASE_BAUD * 16; 126 serial_platform_data[1].uartclk = OMAP1510_BASE_BAUD * 16;
127 serial_platform_data[2].uartclk = OMAP1510_BASE_BAUD * 16; 127 serial_platform_data[2].uartclk = OMAP1510_BASE_BAUD * 16;
@@ -147,10 +147,10 @@ void __init omap_serial_init(void)
147 printk("Could not get uart1_ck\n"); 147 printk("Could not get uart1_ck\n");
148 else { 148 else {
149 clk_enable(uart1_ck); 149 clk_enable(uart1_ck);
150 if (cpu_is_omap1510()) 150 if (cpu_is_omap15xx())
151 clk_set_rate(uart1_ck, 12000000); 151 clk_set_rate(uart1_ck, 12000000);
152 } 152 }
153 if (cpu_is_omap1510()) { 153 if (cpu_is_omap15xx()) {
154 omap_cfg_reg(UART1_TX); 154 omap_cfg_reg(UART1_TX);
155 omap_cfg_reg(UART1_RTS); 155 omap_cfg_reg(UART1_RTS);
156 if (machine_is_omap_innovator()) { 156 if (machine_is_omap_innovator()) {
@@ -167,12 +167,12 @@ void __init omap_serial_init(void)
167 printk("Could not get uart2_ck\n"); 167 printk("Could not get uart2_ck\n");
168 else { 168 else {
169 clk_enable(uart2_ck); 169 clk_enable(uart2_ck);
170 if (cpu_is_omap1510()) 170 if (cpu_is_omap15xx())
171 clk_set_rate(uart2_ck, 12000000); 171 clk_set_rate(uart2_ck, 12000000);
172 else 172 else
173 clk_set_rate(uart2_ck, 48000000); 173 clk_set_rate(uart2_ck, 48000000);
174 } 174 }
175 if (cpu_is_omap1510()) { 175 if (cpu_is_omap15xx()) {
176 omap_cfg_reg(UART2_TX); 176 omap_cfg_reg(UART2_TX);
177 omap_cfg_reg(UART2_RTS); 177 omap_cfg_reg(UART2_RTS);
178 if (machine_is_omap_innovator()) { 178 if (machine_is_omap_innovator()) {
@@ -189,10 +189,10 @@ void __init omap_serial_init(void)
189 printk("Could not get uart3_ck\n"); 189 printk("Could not get uart3_ck\n");
190 else { 190 else {
191 clk_enable(uart3_ck); 191 clk_enable(uart3_ck);
192 if (cpu_is_omap1510()) 192 if (cpu_is_omap15xx())
193 clk_set_rate(uart3_ck, 12000000); 193 clk_set_rate(uart3_ck, 12000000);
194 } 194 }
195 if (cpu_is_omap1510()) { 195 if (cpu_is_omap15xx()) {
196 omap_cfg_reg(UART3_TX); 196 omap_cfg_reg(UART3_TX);
197 omap_cfg_reg(UART3_RX); 197 omap_cfg_reg(UART3_RX);
198 } 198 }
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 3b1ad1d981a3..1e7ed6d22ca9 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -39,7 +39,6 @@
39#include "prcm-regs.h" 39#include "prcm-regs.h"
40 40
41#include <asm/io.h> 41#include <asm/io.h>
42#include <asm/delay.h>
43 42
44static unsigned int row_gpios[6] = { 88, 89, 124, 11, 6, 96 }; 43static unsigned int row_gpios[6] = { 88, 89, 124, 11, 6, 96 };
45static unsigned int col_gpios[7] = { 90, 91, 100, 36, 12, 97, 98 }; 44static unsigned int col_gpios[7] = { 90, 91, 100, 36, 12, 97, 98 };
@@ -179,9 +178,11 @@ static int h4_select_irda(struct device *dev, int state)
179 return err; 178 return err;
180} 179}
181 180
182static void set_trans_mode(void *data) 181static void set_trans_mode(struct work_struct *work)
183{ 182{
184 int *mode = data; 183 struct omap_irda_config *irda_config =
184 container_of(work, struct omap_irda_config, gpio_expa.work);
185 int mode = irda_config->mode;
185 unsigned char expa; 186 unsigned char expa;
186 int err = 0; 187 int err = 0;
187 188
@@ -191,7 +192,7 @@ static void set_trans_mode(void *data)
191 192
192 expa &= ~0x01; 193 expa &= ~0x01;
193 194
194 if (!(*mode & IR_SIRMODE)) { /* MIR/FIR */ 195 if (!(mode & IR_SIRMODE)) { /* MIR/FIR */
195 expa |= 0x01; 196 expa |= 0x01;
196 } 197 }
197 198
@@ -204,9 +205,9 @@ static int h4_transceiver_mode(struct device *dev, int mode)
204{ 205{
205 struct omap_irda_config *irda_config = dev->platform_data; 206 struct omap_irda_config *irda_config = dev->platform_data;
206 207
208 irda_config->mode = mode;
207 cancel_delayed_work(&irda_config->gpio_expa); 209 cancel_delayed_work(&irda_config->gpio_expa);
208 PREPARE_WORK(&irda_config->gpio_expa, set_trans_mode, &mode); 210 PREPARE_DELAYED_WORK(&irda_config->gpio_expa, set_trans_mode);
209#error this is not permitted - mode is an argument variable
210 schedule_delayed_work(&irda_config->gpio_expa, 0); 211 schedule_delayed_work(&irda_config->gpio_expa, 0);
211 212
212 return 0; 213 return 0;
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index 973189cd9766..45d1aaa51b57 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -24,6 +24,7 @@
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/clk.h> 25#include <linux/clk.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/irq.h>
27 28
28#include <asm/mach/time.h> 29#include <asm/mach/time.h>
29#include <asm/arch/dmtimer.h> 30#include <asm/arch/dmtimer.h>
@@ -64,7 +65,7 @@ static void __init omap2_gp_timer_init(void)
64 BUG_ON(gptimer == NULL); 65 BUG_ON(gptimer == NULL);
65 66
66 omap_dm_timer_set_source(gptimer, OMAP_TIMER_SRC_SYS_CLK); 67 omap_dm_timer_set_source(gptimer, OMAP_TIMER_SRC_SYS_CLK);
67 tick_period = clk_get_rate(omap_dm_timer_get_fclk(gptimer)) / 100; 68 tick_period = clk_get_rate(omap_dm_timer_get_fclk(gptimer)) / HZ;
68 tick_period -= 1; 69 tick_period -= 1;
69 70
70 setup_irq(omap_dm_timer_get_irq(gptimer), &omap2_gp_timer_irq); 71 setup_irq(omap_dm_timer_get_irq(gptimer), &omap2_gp_timer_irq);
diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c
index 165017de8d0d..392c38717362 100644
--- a/arch/arm/mach-pxa/corgi_pm.c
+++ b/arch/arm/mach-pxa/corgi_pm.c
@@ -16,7 +16,8 @@
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <asm/apm-emulation.h> 19#include <linux/apm-emulation.h>
20
20#include <asm/irq.h> 21#include <asm/irq.h>
21#include <asm/mach-types.h> 22#include <asm/mach-types.h>
22#include <asm/hardware.h> 23#include <asm/hardware.h>
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
index b97d543d9364..745a4dc7acdd 100644
--- a/arch/arm/mach-pxa/spitz_pm.c
+++ b/arch/arm/mach-pxa/spitz_pm.c
@@ -16,7 +16,8 @@
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <asm/apm-emulation.h> 19#include <linux/apm-emulation.h>
20
20#include <asm/irq.h> 21#include <asm/irq.h>
21#include <asm/mach-types.h> 22#include <asm/mach-types.h>
22#include <asm/hardware.h> 23#include <asm/hardware.h>
diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c
index 0a007b931f63..a9de727c9327 100644
--- a/arch/arm/oprofile/common.c
+++ b/arch/arm/oprofile/common.c
@@ -131,6 +131,8 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
131 struct op_arm_model_spec *spec = NULL; 131 struct op_arm_model_spec *spec = NULL;
132 int ret = -ENODEV; 132 int ret = -ENODEV;
133 133
134 ops->backtrace = arm_backtrace;
135
134#ifdef CONFIG_CPU_XSCALE 136#ifdef CONFIG_CPU_XSCALE
135 spec = &op_xscale_spec; 137 spec = &op_xscale_spec;
136#endif 138#endif
@@ -161,7 +163,6 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
161 ops->start = op_arm_start; 163 ops->start = op_arm_start;
162 ops->stop = op_arm_stop; 164 ops->stop = op_arm_stop;
163 ops->cpu_type = op_arm_model->name; 165 ops->cpu_type = op_arm_model->name;
164 ops->backtrace = arm_backtrace;
165 printk(KERN_INFO "oprofile: using %s\n", spec->name); 166 printk(KERN_INFO "oprofile: using %s\n", spec->name);
166 } 167 }
167 168
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index bb045e5ddbd8..f3f84fbf8b87 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -557,7 +557,7 @@ int omap_request_dma(int dev_id, const char *dev_name,
557 omap_enable_channel_irq(free_ch); 557 omap_enable_channel_irq(free_ch);
558 /* Clear the CSR register and IRQ status register */ 558 /* Clear the CSR register and IRQ status register */
559 OMAP_DMA_CSR_REG(free_ch) = OMAP2_DMA_CSR_CLEAR_MASK; 559 OMAP_DMA_CSR_REG(free_ch) = OMAP2_DMA_CSR_CLEAR_MASK;
560 omap_writel(~0x0, OMAP_DMA4_IRQSTATUS_L0); 560 omap_writel(1 << free_ch, OMAP_DMA4_IRQSTATUS_L0);
561 } 561 }
562 562
563 *dma_ch_out = free_ch; 563 *dma_ch_out = free_ch;
@@ -597,10 +597,7 @@ void omap_free_dma(int lch)
597 597
598 /* Clear the CSR register and IRQ status register */ 598 /* Clear the CSR register and IRQ status register */
599 OMAP_DMA_CSR_REG(lch) = OMAP2_DMA_CSR_CLEAR_MASK; 599 OMAP_DMA_CSR_REG(lch) = OMAP2_DMA_CSR_CLEAR_MASK;
600 600 omap_writel(1 << lch, OMAP_DMA4_IRQSTATUS_L0);
601 val = omap_readl(OMAP_DMA4_IRQSTATUS_L0);
602 val |= 1 << lch;
603 omap_writel(val, OMAP_DMA4_IRQSTATUS_L0);
604 601
605 /* Disable all DMA interrupts for the channel. */ 602 /* Disable all DMA interrupts for the channel. */
606 OMAP_DMA_CICR_REG(lch) = 0; 603 OMAP_DMA_CICR_REG(lch) = 0;
@@ -927,7 +924,6 @@ static irqreturn_t omap1_dma_irq_handler(int irq, void *dev_id)
927static int omap2_dma_handle_ch(int ch) 924static int omap2_dma_handle_ch(int ch)
928{ 925{
929 u32 status = OMAP_DMA_CSR_REG(ch); 926 u32 status = OMAP_DMA_CSR_REG(ch);
930 u32 val;
931 927
932 if (!status) 928 if (!status)
933 return 0; 929 return 0;
@@ -948,11 +944,7 @@ static int omap2_dma_handle_ch(int ch)
948 dma_chan[ch].dev_id); 944 dma_chan[ch].dev_id);
949 945
950 OMAP_DMA_CSR_REG(ch) = OMAP2_DMA_CSR_CLEAR_MASK; 946 OMAP_DMA_CSR_REG(ch) = OMAP2_DMA_CSR_CLEAR_MASK;
951 947 omap_writel(1 << ch, OMAP_DMA4_IRQSTATUS_L0);
952 val = omap_readl(OMAP_DMA4_IRQSTATUS_L0);
953 /* ch in this function is from 0-31 while in register it is 1-32 */
954 val = 1 << (ch);
955 omap_writel(val, OMAP_DMA4_IRQSTATUS_L0);
956 948
957 if (likely(dma_chan[ch].callback != NULL)) 949 if (likely(dma_chan[ch].callback != NULL))
958 dma_chan[ch].callback(ch, status, dma_chan[ch].data); 950 dma_chan[ch].callback(ch, status, dma_chan[ch].data);
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index bcbb8d7392be..45f0439bffba 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -90,8 +90,8 @@ static struct omap_dm_timer dm_timers[] = {
90 { .phys_base = 0xfffb2c00, .irq = INT_1610_GPTIMER4 }, 90 { .phys_base = 0xfffb2c00, .irq = INT_1610_GPTIMER4 },
91 { .phys_base = 0xfffb3400, .irq = INT_1610_GPTIMER5 }, 91 { .phys_base = 0xfffb3400, .irq = INT_1610_GPTIMER5 },
92 { .phys_base = 0xfffb3c00, .irq = INT_1610_GPTIMER6 }, 92 { .phys_base = 0xfffb3c00, .irq = INT_1610_GPTIMER6 },
93 { .phys_base = 0xfffb4400, .irq = INT_1610_GPTIMER7 }, 93 { .phys_base = 0xfffb7400, .irq = INT_1610_GPTIMER7 },
94 { .phys_base = 0xfffb4c00, .irq = INT_1610_GPTIMER8 }, 94 { .phys_base = 0xfffbd400, .irq = INT_1610_GPTIMER8 },
95}; 95};
96 96
97#elif defined(CONFIG_ARCH_OMAP2) 97#elif defined(CONFIG_ARCH_OMAP2)
@@ -314,6 +314,8 @@ struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer)
314__u32 omap_dm_timer_modify_idlect_mask(__u32 inputmask) 314__u32 omap_dm_timer_modify_idlect_mask(__u32 inputmask)
315{ 315{
316 BUG(); 316 BUG();
317
318 return 0;
317} 319}
318 320
319#endif 321#endif
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 4f2fd5591337..b8c01de208b4 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -974,10 +974,11 @@ static struct irq_chip gpio_irq_chip = {
974}; 974};
975 975
976static struct irq_chip mpuio_irq_chip = { 976static struct irq_chip mpuio_irq_chip = {
977 .name = "MPUIO", 977 .name = "MPUIO",
978 .ack = mpuio_ack_irq, 978 .ack = mpuio_ack_irq,
979 .mask = mpuio_mask_irq, 979 .mask = mpuio_mask_irq,
980 .unmask = mpuio_unmask_irq 980 .unmask = mpuio_unmask_irq,
981 .set_type = gpio_irq_type,
981}; 982};
982 983
983static int initialized; 984static int initialized;
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index ec50008a2df6..b8d6f17ff58f 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -20,8 +20,8 @@
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/delay.h>
23 24
24#include <asm/delay.h>
25#include <asm/io.h> 25#include <asm/io.h>
26#include <asm/irq.h> 26#include <asm/irq.h>
27 27
diff --git a/arch/arm/plat-omap/mux.c b/arch/arm/plat-omap/mux.c
index 042105ac30b8..6c798d288688 100644
--- a/arch/arm/plat-omap/mux.c
+++ b/arch/arm/plat-omap/mux.c
@@ -116,7 +116,7 @@ int __init_or_module omap_cfg_reg(const unsigned long index)
116 } 116 }
117 117
118 /* Check for pull up or pull down selection on 1610 */ 118 /* Check for pull up or pull down selection on 1610 */
119 if (!cpu_is_omap1510()) { 119 if (!cpu_is_omap15xx()) {
120 if (cfg->pu_pd_reg && cfg->pull_val) { 120 if (cfg->pu_pd_reg && cfg->pull_val) {
121 spin_lock_irqsave(&mux_spin_lock, flags); 121 spin_lock_irqsave(&mux_spin_lock, flags);
122 pu_pd_orig = omap_readl(cfg->pu_pd_reg); 122 pu_pd_orig = omap_readl(cfg->pu_pd_reg);
@@ -172,7 +172,7 @@ int __init_or_module omap_cfg_reg(const unsigned long index)
172 printk(" %s (0x%08x) = 0x%08x -> 0x%08x\n", 172 printk(" %s (0x%08x) = 0x%08x -> 0x%08x\n",
173 cfg->mux_reg_name, cfg->mux_reg, reg_orig, reg); 173 cfg->mux_reg_name, cfg->mux_reg, reg_orig, reg);
174 174
175 if (!cpu_is_omap1510()) { 175 if (!cpu_is_omap15xx()) {
176 if (cfg->pu_pd_reg && cfg->pull_val) { 176 if (cfg->pu_pd_reg && cfg->pull_val) {
177 printk(" %s (0x%08x) = 0x%08x -> 0x%08x\n", 177 printk(" %s (0x%08x) = 0x%08x -> 0x%08x\n",
178 cfg->pu_pd_name, cfg->pu_pd_reg, 178 cfg->pu_pd_name, cfg->pu_pd_reg,
diff --git a/arch/arm/plat-s3c24xx/Kconfig b/arch/arm/plat-s3c24xx/Kconfig
index 860869528f4c..b972f36d547c 100644
--- a/arch/arm/plat-s3c24xx/Kconfig
+++ b/arch/arm/plat-s3c24xx/Kconfig
@@ -58,6 +58,11 @@ config S3C2410_PM_CHECK
58 going to sleep. The blocks are then checked on resume for any 58 going to sleep. The blocks are then checked on resume for any
59 errors. 59 errors.
60 60
61 Note, this can take several seconds depending on memory size
62 and CPU speed.
63
64 See <file:Documentation/arm/Samsung-S3C24XX/Suspend.txt>
65
61config S3C2410_PM_CHECK_CHUNKSIZE 66config S3C2410_PM_CHECK_CHUNKSIZE
62 int "S3C2410 PM Suspend CRC Chunksize (KiB)" 67 int "S3C2410 PM Suspend CRC Chunksize (KiB)"
63 depends on ARCH_S3C2410 && PM && S3C2410_PM_CHECK 68 depends on ARCH_S3C2410 && PM && S3C2410_PM_CHECK
@@ -68,6 +73,8 @@ config S3C2410_PM_CHECK_CHUNKSIZE
68 the CRC data block will take more memory, but wil identify any 73 the CRC data block will take more memory, but wil identify any
69 faults with better precision. 74 faults with better precision.
70 75
76 See <file:Documentation/arm/Samsung-S3C24XX/Suspend.txt>
77
71config S3C2410_LOWLEVEL_UART_PORT 78config S3C2410_LOWLEVEL_UART_PORT
72 int "S3C2410 UART to use for low-level messages" 79 int "S3C2410 UART to use for low-level messages"
73 default 0 80 default 0
diff --git a/drivers/acorn/char/Makefile b/drivers/acorn/char/Makefile
index 2fa9a8bf48a0..d006c9f168d2 100644
--- a/drivers/acorn/char/Makefile
+++ b/drivers/acorn/char/Makefile
@@ -2,5 +2,4 @@
2# Makefile for the acorn character device drivers. 2# Makefile for the acorn character device drivers.
3# 3#
4 4
5obj-$(CONFIG_ARCH_ACORN) += i2c.o pcf8583.o
6obj-$(CONFIG_L7200_KEYB) += defkeymap-l7200.o keyb_l7200.o 5obj-$(CONFIG_L7200_KEYB) += defkeymap-l7200.o keyb_l7200.o
diff --git a/drivers/acorn/char/i2c.c b/drivers/acorn/char/i2c.c
deleted file mode 100644
index d276fd14d63a..000000000000
--- a/drivers/acorn/char/i2c.c
+++ /dev/null
@@ -1,368 +0,0 @@
1/*
2 * linux/drivers/acorn/char/i2c.c
3 *
4 * Copyright (C) 2000 Russell King
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 * ARM IOC/IOMD i2c driver.
11 *
12 * On Acorn machines, the following i2c devices are on the bus:
13 * - PCF8583 real time clock & static RAM
14 */
15#include <linux/capability.h>
16#include <linux/init.h>
17#include <linux/time.h>
18#include <linux/miscdevice.h>
19#include <linux/rtc.h>
20#include <linux/i2c.h>
21#include <linux/i2c-algo-bit.h>
22#include <linux/fs.h>
23
24#include <asm/hardware.h>
25#include <asm/io.h>
26#include <asm/hardware/ioc.h>
27#include <asm/system.h>
28#include <asm/uaccess.h>
29
30#include "pcf8583.h"
31
32extern int (*set_rtc)(void);
33
34static struct i2c_client *rtc_client;
35static const unsigned char days_in_mon[] =
36 { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
37
38#define CMOS_CHECKSUM (63)
39
40/*
41 * Acorn machines store the year in the static RAM at
42 * location 128.
43 */
44#define CMOS_YEAR (64 + 128)
45
46static inline int rtc_command(int cmd, void *data)
47{
48 int ret = -EIO;
49
50 if (rtc_client)
51 ret = rtc_client->driver->command(rtc_client, cmd, data);
52
53 return ret;
54}
55
56/*
57 * Update the century + year bytes in the CMOS RAM, ensuring
58 * that the check byte is correctly adjusted for the change.
59 */
60static int rtc_update_year(unsigned int new_year)
61{
62 unsigned char yr[2], chk;
63 struct mem cmos_year = { CMOS_YEAR, sizeof(yr), yr };
64 struct mem cmos_check = { CMOS_CHECKSUM, 1, &chk };
65 int ret;
66
67 ret = rtc_command(MEM_READ, &cmos_check);
68 if (ret)
69 goto out;
70 ret = rtc_command(MEM_READ, &cmos_year);
71 if (ret)
72 goto out;
73
74 chk -= yr[1] + yr[0];
75
76 yr[1] = new_year / 100;
77 yr[0] = new_year % 100;
78
79 chk += yr[1] + yr[0];
80
81 ret = rtc_command(MEM_WRITE, &cmos_year);
82 if (ret == 0)
83 ret = rtc_command(MEM_WRITE, &cmos_check);
84 out:
85 return ret;
86}
87
88/*
89 * Read the current RTC time and date, and update xtime.
90 */
91static void get_rtc_time(struct rtc_tm *rtctm, unsigned int *year)
92{
93 unsigned char ctrl, yr[2];
94 struct mem rtcmem = { CMOS_YEAR, sizeof(yr), yr };
95 int real_year, year_offset;
96
97 /*
98 * Ensure that the RTC is running.
99 */
100 rtc_command(RTC_GETCTRL, &ctrl);
101 if (ctrl & 0xc0) {
102 unsigned char new_ctrl = ctrl & ~0xc0;
103
104 printk(KERN_WARNING "RTC: resetting control %02x -> %02x\n",
105 ctrl, new_ctrl);
106
107 rtc_command(RTC_SETCTRL, &new_ctrl);
108 }
109
110 if (rtc_command(RTC_GETDATETIME, rtctm) ||
111 rtc_command(MEM_READ, &rtcmem))
112 return;
113
114 real_year = yr[0];
115
116 /*
117 * The RTC year holds the LSB two bits of the current
118 * year, which should reflect the LSB two bits of the
119 * CMOS copy of the year. Any difference indicates
120 * that we have to correct the CMOS version.
121 */
122 year_offset = rtctm->year_off - (real_year & 3);
123 if (year_offset < 0)
124 /*
125 * RTC year wrapped. Adjust it appropriately.
126 */
127 year_offset += 4;
128
129 *year = real_year + year_offset + yr[1] * 100;
130}
131
132static int set_rtc_time(struct rtc_tm *rtctm, unsigned int year)
133{
134 unsigned char leap;
135 int ret;
136
137 leap = (!(year % 4) && (year % 100)) || !(year % 400);
138
139 if (rtctm->mon > 12 || rtctm->mon == 0 || rtctm->mday == 0)
140 return -EINVAL;
141
142 if (rtctm->mday > (days_in_mon[rtctm->mon] + (rtctm->mon == 2 && leap)))
143 return -EINVAL;
144
145 if (rtctm->hours >= 24 || rtctm->mins >= 60 || rtctm->secs >= 60)
146 return -EINVAL;
147
148 /*
149 * The RTC's own 2-bit year must reflect the least
150 * significant two bits of the CMOS year.
151 */
152 rtctm->year_off = (year % 100) & 3;
153
154 ret = rtc_command(RTC_SETDATETIME, rtctm);
155 if (ret == 0)
156 ret = rtc_update_year(year);
157
158 return ret;
159}
160
161/*
162 * Set the RTC time only. Note that
163 * we do not touch the date.
164 */
165static int k_set_rtc_time(void)
166{
167 struct rtc_tm new_rtctm, old_rtctm;
168 unsigned long nowtime = xtime.tv_sec;
169
170 if (rtc_command(RTC_GETDATETIME, &old_rtctm))
171 return 0;
172
173 new_rtctm.cs = xtime.tv_nsec / 10000000;
174 new_rtctm.secs = nowtime % 60; nowtime /= 60;
175 new_rtctm.mins = nowtime % 60; nowtime /= 60;
176 new_rtctm.hours = nowtime % 24;
177
178 /*
179 * avoid writing when we're going to change the day
180 * of the month. We will retry in the next minute.
181 * This basically means that if the RTC must not drift
182 * by more than 1 minute in 11 minutes.
183 *
184 * [ rtc: 1/1/2000 23:58:00, real 2/1/2000 00:01:00,
185 * rtc gets set to 1/1/2000 00:01:00 ]
186 */
187 if ((old_rtctm.hours == 23 && old_rtctm.mins == 59) ||
188 (new_rtctm.hours == 23 && new_rtctm.mins == 59))
189 return 1;
190
191 return rtc_command(RTC_SETTIME, &new_rtctm);
192}
193
194static int rtc_ioctl(struct inode *inode, struct file *file,
195 unsigned int cmd, unsigned long arg)
196{
197 unsigned int year;
198 struct rtc_time rtctm;
199 struct rtc_tm rtc_raw;
200
201 switch (cmd) {
202 case RTC_ALM_READ:
203 case RTC_ALM_SET:
204 break;
205
206 case RTC_RD_TIME:
207 memset(&rtctm, 0, sizeof(struct rtc_time));
208 get_rtc_time(&rtc_raw, &year);
209 rtctm.tm_sec = rtc_raw.secs;
210 rtctm.tm_min = rtc_raw.mins;
211 rtctm.tm_hour = rtc_raw.hours;
212 rtctm.tm_mday = rtc_raw.mday;
213 rtctm.tm_mon = rtc_raw.mon - 1; /* month starts at 0 */
214 rtctm.tm_year = year - 1900; /* starts at 1900 */
215 return copy_to_user((void *)arg, &rtctm, sizeof(rtctm))
216 ? -EFAULT : 0;
217
218 case RTC_SET_TIME:
219 if (!capable(CAP_SYS_TIME))
220 return -EACCES;
221
222 if (copy_from_user(&rtctm, (void *)arg, sizeof(rtctm)))
223 return -EFAULT;
224 rtc_raw.secs = rtctm.tm_sec;
225 rtc_raw.mins = rtctm.tm_min;
226 rtc_raw.hours = rtctm.tm_hour;
227 rtc_raw.mday = rtctm.tm_mday;
228 rtc_raw.mon = rtctm.tm_mon + 1;
229 year = rtctm.tm_year + 1900;
230 return set_rtc_time(&rtc_raw, year);
231 break;
232
233 case RTC_EPOCH_READ:
234 return put_user(1900, (unsigned long *)arg);
235
236 }
237 return -EINVAL;
238}
239
240static const struct file_operations rtc_fops = {
241 .ioctl = rtc_ioctl,
242};
243
244static struct miscdevice rtc_dev = {
245 .minor = RTC_MINOR,
246 .name = "rtc",
247 .fops = &rtc_fops,
248};
249
250/* IOC / IOMD i2c driver */
251
252#define FORCE_ONES 0xdc
253#define SCL 0x02
254#define SDA 0x01
255
256/*
257 * We must preserve all non-i2c output bits in IOC_CONTROL.
258 * Note also that we need to preserve the value of SCL and
259 * SDA outputs as well (which may be different from the
260 * values read back from IOC_CONTROL).
261 */
262static u_int force_ones;
263
264static void ioc_setscl(void *data, int state)
265{
266 u_int ioc_control = ioc_readb(IOC_CONTROL) & ~(SCL | SDA);
267 u_int ones = force_ones;
268
269 if (state)
270 ones |= SCL;
271 else
272 ones &= ~SCL;
273
274 force_ones = ones;
275
276 ioc_writeb(ioc_control | ones, IOC_CONTROL);
277}
278
279static void ioc_setsda(void *data, int state)
280{
281 u_int ioc_control = ioc_readb(IOC_CONTROL) & ~(SCL | SDA);
282 u_int ones = force_ones;
283
284 if (state)
285 ones |= SDA;
286 else
287 ones &= ~SDA;
288
289 force_ones = ones;
290
291 ioc_writeb(ioc_control | ones, IOC_CONTROL);
292}
293
294static int ioc_getscl(void *data)
295{
296 return (ioc_readb(IOC_CONTROL) & SCL) != 0;
297}
298
299static int ioc_getsda(void *data)
300{
301 return (ioc_readb(IOC_CONTROL) & SDA) != 0;
302}
303
304static struct i2c_algo_bit_data ioc_data = {
305 .setsda = ioc_setsda,
306 .setscl = ioc_setscl,
307 .getsda = ioc_getsda,
308 .getscl = ioc_getscl,
309 .udelay = 80,
310 .timeout = 100
311};
312
313static int ioc_client_reg(struct i2c_client *client)
314{
315 if (client->driver->id == I2C_DRIVERID_PCF8583 &&
316 client->addr == 0x50) {
317 struct rtc_tm rtctm;
318 unsigned int year;
319 struct timespec tv;
320
321 rtc_client = client;
322 get_rtc_time(&rtctm, &year);
323
324 tv.tv_nsec = rtctm.cs * 10000000;
325 tv.tv_sec = mktime(year, rtctm.mon, rtctm.mday,
326 rtctm.hours, rtctm.mins, rtctm.secs);
327 do_settimeofday(&tv);
328 set_rtc = k_set_rtc_time;
329 }
330
331 return 0;
332}
333
334static int ioc_client_unreg(struct i2c_client *client)
335{
336 if (client == rtc_client) {
337 set_rtc = NULL;
338 rtc_client = NULL;
339 }
340
341 return 0;
342}
343
344static struct i2c_adapter ioc_ops = {
345 .id = I2C_HW_B_IOC,
346 .algo_data = &ioc_data,
347 .client_register = ioc_client_reg,
348 .client_unregister = ioc_client_unreg,
349};
350
351static int __init i2c_ioc_init(void)
352{
353 int ret;
354
355 force_ones = FORCE_ONES | SCL | SDA;
356
357 ret = i2c_bit_add_bus(&ioc_ops);
358
359 if (ret >= 0){
360 ret = misc_register(&rtc_dev);
361 if(ret < 0)
362 i2c_del_adapter(&ioc_ops);
363 }
364
365 return ret;
366}
367
368__initcall(i2c_ioc_init);
diff --git a/drivers/acorn/char/pcf8583.c b/drivers/acorn/char/pcf8583.c
deleted file mode 100644
index 9b49f316ae92..000000000000
--- a/drivers/acorn/char/pcf8583.c
+++ /dev/null
@@ -1,284 +0,0 @@
1/*
2 * linux/drivers/acorn/char/pcf8583.c
3 *
4 * Copyright (C) 2000 Russell King
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 * Driver for PCF8583 RTC & RAM chip
11 */
12#include <linux/module.h>
13#include <linux/i2c.h>
14#include <linux/slab.h>
15#include <linux/string.h>
16#include <linux/mc146818rtc.h>
17#include <linux/init.h>
18#include <linux/errno.h>
19#include <linux/bcd.h>
20
21#include "pcf8583.h"
22
23static struct i2c_driver pcf8583_driver;
24
25static unsigned short ignore[] = { I2C_CLIENT_END };
26static unsigned short normal_addr[] = { 0x50, I2C_CLIENT_END };
27static unsigned short *forces[] = { NULL };
28
29static struct i2c_client_address_data addr_data = {
30 .normal_i2c = normal_addr,
31 .probe = ignore,
32 .ignore = ignore,
33 .forces = forces,
34};
35
36#define set_ctrl(x, v) i2c_set_clientdata(x, (void *)(unsigned int)(v))
37#define get_ctrl(x) ((unsigned int)i2c_get_clientdata(x))
38
39static int
40pcf8583_attach(struct i2c_adapter *adap, int addr, int kind)
41{
42 struct i2c_client *c;
43 unsigned char buf[1], ad[1] = { 0 };
44 struct i2c_msg msgs[2] = {
45 {
46 .addr = addr,
47 .flags = 0,
48 .len = 1,
49 .buf = ad,
50 }, {
51 .addr = addr,
52 .flags = I2C_M_RD,
53 .len = 1,
54 .buf = buf,
55 }
56 };
57
58 c = kmalloc(sizeof(*c), GFP_KERNEL);
59 if (!c)
60 return -ENOMEM;
61
62 memset(c, 0, sizeof(*c));
63 c->addr = addr;
64 c->adapter = adap;
65 c->driver = &pcf8583_driver;
66
67 if (i2c_transfer(c->adapter, msgs, 2) == 2)
68 set_ctrl(c, buf[0]);
69
70 return i2c_attach_client(c);
71}
72
73static int
74pcf8583_probe(struct i2c_adapter *adap)
75{
76 return i2c_probe(adap, &addr_data, pcf8583_attach);
77}
78
79static int
80pcf8583_detach(struct i2c_client *client)
81{
82 i2c_detach_client(client);
83 kfree(client);
84 return 0;
85}
86
87static int
88pcf8583_get_datetime(struct i2c_client *client, struct rtc_tm *dt)
89{
90 unsigned char buf[8], addr[1] = { 1 };
91 struct i2c_msg msgs[2] = {
92 {
93 .addr = client->addr,
94 .flags = 0,
95 .len = 1,
96 .buf = addr,
97 }, {
98 .addr = client->addr,
99 .flags = I2C_M_RD,
100 .len = 6,
101 .buf = buf,
102 }
103 };
104 int ret = -EIO;
105
106 memset(buf, 0, sizeof(buf));
107
108 ret = i2c_transfer(client->adapter, msgs, 2);
109 if (ret == 2) {
110 dt->year_off = buf[4] >> 6;
111 dt->wday = buf[5] >> 5;
112
113 buf[4] &= 0x3f;
114 buf[5] &= 0x1f;
115
116 dt->cs = BCD_TO_BIN(buf[0]);
117 dt->secs = BCD_TO_BIN(buf[1]);
118 dt->mins = BCD_TO_BIN(buf[2]);
119 dt->hours = BCD_TO_BIN(buf[3]);
120 dt->mday = BCD_TO_BIN(buf[4]);
121 dt->mon = BCD_TO_BIN(buf[5]);
122
123 ret = 0;
124 }
125
126 return ret;
127}
128
129static int
130pcf8583_set_datetime(struct i2c_client *client, struct rtc_tm *dt, int datetoo)
131{
132 unsigned char buf[8];
133 int ret, len = 6;
134
135 buf[0] = 0;
136 buf[1] = get_ctrl(client) | 0x80;
137 buf[2] = BIN_TO_BCD(dt->cs);
138 buf[3] = BIN_TO_BCD(dt->secs);
139 buf[4] = BIN_TO_BCD(dt->mins);
140 buf[5] = BIN_TO_BCD(dt->hours);
141
142 if (datetoo) {
143 len = 8;
144 buf[6] = BIN_TO_BCD(dt->mday) | (dt->year_off << 6);
145 buf[7] = BIN_TO_BCD(dt->mon) | (dt->wday << 5);
146 }
147
148 ret = i2c_master_send(client, (char *)buf, len);
149 if (ret == len)
150 ret = 0;
151
152 buf[1] = get_ctrl(client);
153 i2c_master_send(client, (char *)buf, 2);
154
155 return ret;
156}
157
158static int
159pcf8583_get_ctrl(struct i2c_client *client, unsigned char *ctrl)
160{
161 *ctrl = get_ctrl(client);
162 return 0;
163}
164
165static int
166pcf8583_set_ctrl(struct i2c_client *client, unsigned char *ctrl)
167{
168 unsigned char buf[2];
169
170 buf[0] = 0;
171 buf[1] = *ctrl;
172 set_ctrl(client, *ctrl);
173
174 return i2c_master_send(client, (char *)buf, 2);
175}
176
177static int
178pcf8583_read_mem(struct i2c_client *client, struct mem *mem)
179{
180 unsigned char addr[1];
181 struct i2c_msg msgs[2] = {
182 {
183 .addr = client->addr,
184 .flags = 0,
185 .len = 1,
186 .buf = addr,
187 }, {
188 .addr = client->addr,
189 .flags = I2C_M_RD,
190 .len = mem->nr,
191 .buf = mem->data,
192 }
193 };
194
195 if (mem->loc < 8)
196 return -EINVAL;
197
198 addr[0] = mem->loc;
199
200 return i2c_transfer(client->adapter, msgs, 2) == 2 ? 0 : -EIO;
201}
202
203static int
204pcf8583_write_mem(struct i2c_client *client, struct mem *mem)
205{
206 unsigned char addr[1];
207 struct i2c_msg msgs[2] = {
208 {
209 .addr = client->addr,
210 .flags = 0,
211 .len = 1,
212 .buf = addr,
213 }, {
214 .addr = client->addr,
215 .flags = I2C_M_NOSTART,
216 .len = mem->nr,
217 .buf = mem->data,
218 }
219 };
220
221 if (mem->loc < 8)
222 return -EINVAL;
223
224 addr[0] = mem->loc;
225
226 return i2c_transfer(client->adapter, msgs, 2) == 2 ? 0 : -EIO;
227}
228
229static int
230pcf8583_command(struct i2c_client *client, unsigned int cmd, void *arg)
231{
232 switch (cmd) {
233 case RTC_GETDATETIME:
234 return pcf8583_get_datetime(client, arg);
235
236 case RTC_SETTIME:
237 return pcf8583_set_datetime(client, arg, 0);
238
239 case RTC_SETDATETIME:
240 return pcf8583_set_datetime(client, arg, 1);
241
242 case RTC_GETCTRL:
243 return pcf8583_get_ctrl(client, arg);
244
245 case RTC_SETCTRL:
246 return pcf8583_set_ctrl(client, arg);
247
248 case MEM_READ:
249 return pcf8583_read_mem(client, arg);
250
251 case MEM_WRITE:
252 return pcf8583_write_mem(client, arg);
253
254 default:
255 return -EINVAL;
256 }
257}
258
259static struct i2c_driver pcf8583_driver = {
260 .driver = {
261 .name = "PCF8583",
262 },
263 .id = I2C_DRIVERID_PCF8583,
264 .attach_adapter = pcf8583_probe,
265 .detach_client = pcf8583_detach,
266 .command = pcf8583_command
267};
268
269static __init int pcf8583_init(void)
270{
271 return i2c_add_driver(&pcf8583_driver);
272}
273
274static __exit void pcf8583_exit(void)
275{
276 i2c_del_driver(&pcf8583_driver);
277}
278
279module_init(pcf8583_init);
280module_exit(pcf8583_exit);
281
282MODULE_AUTHOR("Russell King");
283MODULE_DESCRIPTION("PCF8583 I2C RTC driver");
284MODULE_LICENSE("GPL");
diff --git a/drivers/acorn/char/pcf8583.h b/drivers/acorn/char/pcf8583.h
deleted file mode 100644
index 847f7fdb8763..000000000000
--- a/drivers/acorn/char/pcf8583.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * linux/drivers/acorn/char/pcf8583.h
3 *
4 * Copyright (C) 2000 Russell King
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 */
10struct rtc_tm {
11 unsigned char cs;
12 unsigned char secs;
13 unsigned char mins;
14 unsigned char hours;
15 unsigned char mday;
16 unsigned char mon;
17 unsigned char year_off;
18 unsigned char wday;
19};
20
21struct mem {
22 unsigned int loc;
23 unsigned int nr;
24 unsigned char *data;
25};
26
27#define RTC_GETDATETIME 0
28#define RTC_SETTIME 1
29#define RTC_SETDATETIME 2
30#define RTC_GETCTRL 3
31#define RTC_SETCTRL 4
32#define MEM_READ 5
33#define MEM_WRITE 6
34
35#define CTRL_STOP 0x80
36#define CTRL_HOLD 0x40
37#define CTRL_32KHZ 0x00
38#define CTRL_MASK 0x08
39#define CTRL_ALARMEN 0x04
40#define CTRL_ALARM 0x02
41#define CTRL_TIMER 0x01
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 4d44a2db29dd..fb19dbb31e42 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -495,6 +495,16 @@ config I2C_VERSATILE
495 This driver can also be built as a module. If so, the module 495 This driver can also be built as a module. If so, the module
496 will be called i2c-versatile. 496 will be called i2c-versatile.
497 497
498config I2C_ACORN
499 bool "Acorn IOC/IOMD I2C bus support"
500 depends on I2C && ARCH_ACORN
501 default y
502 select I2C_ALGOBIT
503 help
504 Say yes if you want to support the I2C bus on Acorn platforms.
505
506 If you don't know, say Y.
507
498config I2C_VIA 508config I2C_VIA
499 tristate "VIA 82C586B" 509 tristate "VIA 82C586B"
500 depends on I2C && PCI && EXPERIMENTAL 510 depends on I2C && PCI && EXPERIMENTAL
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index 03505aa44bbf..290b54018354 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_I2C_SIS630) += i2c-sis630.o
42obj-$(CONFIG_I2C_SIS96X) += i2c-sis96x.o 42obj-$(CONFIG_I2C_SIS96X) += i2c-sis96x.o
43obj-$(CONFIG_I2C_STUB) += i2c-stub.o 43obj-$(CONFIG_I2C_STUB) += i2c-stub.o
44obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o 44obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o
45obj-$(CONFIG_I2C_ACORN) += i2c-acorn.o
45obj-$(CONFIG_I2C_VIA) += i2c-via.o 46obj-$(CONFIG_I2C_VIA) += i2c-via.o
46obj-$(CONFIG_I2C_VIAPRO) += i2c-viapro.o 47obj-$(CONFIG_I2C_VIAPRO) += i2c-viapro.o
47obj-$(CONFIG_I2C_VOODOO3) += i2c-voodoo3.o 48obj-$(CONFIG_I2C_VOODOO3) += i2c-voodoo3.o
diff --git a/drivers/i2c/busses/i2c-acorn.c b/drivers/i2c/busses/i2c-acorn.c
new file mode 100644
index 000000000000..09bd7f40b90c
--- /dev/null
+++ b/drivers/i2c/busses/i2c-acorn.c
@@ -0,0 +1,97 @@
1/*
2 * linux/drivers/acorn/char/i2c.c
3 *
4 * Copyright (C) 2000 Russell King
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 * ARM IOC/IOMD i2c driver.
11 *
12 * On Acorn machines, the following i2c devices are on the bus:
13 * - PCF8583 real time clock & static RAM
14 */
15#include <linux/init.h>
16#include <linux/i2c.h>
17#include <linux/i2c-algo-bit.h>
18
19#include <asm/hardware.h>
20#include <asm/io.h>
21#include <asm/hardware/ioc.h>
22#include <asm/system.h>
23
24#define FORCE_ONES 0xdc
25#define SCL 0x02
26#define SDA 0x01
27
28/*
29 * We must preserve all non-i2c output bits in IOC_CONTROL.
30 * Note also that we need to preserve the value of SCL and
31 * SDA outputs as well (which may be different from the
32 * values read back from IOC_CONTROL).
33 */
34static u_int force_ones;
35
36static void ioc_setscl(void *data, int state)
37{
38 u_int ioc_control = ioc_readb(IOC_CONTROL) & ~(SCL | SDA);
39 u_int ones = force_ones;
40
41 if (state)
42 ones |= SCL;
43 else
44 ones &= ~SCL;
45
46 force_ones = ones;
47
48 ioc_writeb(ioc_control | ones, IOC_CONTROL);
49}
50
51static void ioc_setsda(void *data, int state)
52{
53 u_int ioc_control = ioc_readb(IOC_CONTROL) & ~(SCL | SDA);
54 u_int ones = force_ones;
55
56 if (state)
57 ones |= SDA;
58 else
59 ones &= ~SDA;
60
61 force_ones = ones;
62
63 ioc_writeb(ioc_control | ones, IOC_CONTROL);
64}
65
66static int ioc_getscl(void *data)
67{
68 return (ioc_readb(IOC_CONTROL) & SCL) != 0;
69}
70
71static int ioc_getsda(void *data)
72{
73 return (ioc_readb(IOC_CONTROL) & SDA) != 0;
74}
75
76static struct i2c_algo_bit_data ioc_data = {
77 .setsda = ioc_setsda,
78 .setscl = ioc_setscl,
79 .getsda = ioc_getsda,
80 .getscl = ioc_getscl,
81 .udelay = 80,
82 .timeout = 100
83};
84
85static struct i2c_adapter ioc_ops = {
86 .id = I2C_HW_B_IOC,
87 .algo_data = &ioc_data,
88};
89
90static int __init i2c_ioc_init(void)
91{
92 force_ones = FORCE_ONES | SCL | SDA;
93
94 return i2c_bit_add_bus(&ioc_ops);
95}
96
97__initcall(i2c_ioc_init);
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index deef29646e0e..95826b92ca4b 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -207,10 +207,12 @@ config RTC_DRV_PCF8563
207 207
208config RTC_DRV_PCF8583 208config RTC_DRV_PCF8583
209 tristate "Philips PCF8583" 209 tristate "Philips PCF8583"
210 depends on RTC_CLASS && I2C 210 depends on RTC_CLASS && I2C && ARCH_RPC
211 help 211 help
212 If you say yes here you get support for the 212 If you say yes here you get support for the Philips PCF8583
213 Philips PCF8583 RTC chip. 213 RTC chip found on Acorn RiscPCs. This driver supports the
214 platform specific method of retrieving the current year from
215 the RTC's SRAM.
214 216
215 This driver can also be built as a module. If so, the module 217 This driver can also be built as a module. If so, the module
216 will be called rtc-pcf8583. 218 will be called rtc-pcf8583.
diff --git a/drivers/rtc/rtc-pcf8583.c b/drivers/rtc/rtc-pcf8583.c
index 5875ebb8c79d..d48b03374586 100644
--- a/drivers/rtc/rtc-pcf8583.c
+++ b/drivers/rtc/rtc-pcf8583.c
@@ -40,7 +40,7 @@ struct pcf8583 {
40#define CTRL_ALARM 0x02 40#define CTRL_ALARM 0x02
41#define CTRL_TIMER 0x01 41#define CTRL_TIMER 0x01
42 42
43static unsigned short normal_i2c[] = { I2C_CLIENT_END }; 43static unsigned short normal_i2c[] = { 0x50, I2C_CLIENT_END };
44 44
45/* Module parameters */ 45/* Module parameters */
46I2C_CLIENT_INSMOD; 46I2C_CLIENT_INSMOD;
@@ -81,11 +81,11 @@ static int pcf8583_get_datetime(struct i2c_client *client, struct rtc_time *dt)
81 buf[4] &= 0x3f; 81 buf[4] &= 0x3f;
82 buf[5] &= 0x1f; 82 buf[5] &= 0x1f;
83 83
84 dt->tm_sec = BCD_TO_BIN(buf[1]); 84 dt->tm_sec = BCD2BIN(buf[1]);
85 dt->tm_min = BCD_TO_BIN(buf[2]); 85 dt->tm_min = BCD2BIN(buf[2]);
86 dt->tm_hour = BCD_TO_BIN(buf[3]); 86 dt->tm_hour = BCD2BIN(buf[3]);
87 dt->tm_mday = BCD_TO_BIN(buf[4]); 87 dt->tm_mday = BCD2BIN(buf[4]);
88 dt->tm_mon = BCD_TO_BIN(buf[5]); 88 dt->tm_mon = BCD2BIN(buf[5]) - 1;
89 } 89 }
90 90
91 return ret == 2 ? 0 : -EIO; 91 return ret == 2 ? 0 : -EIO;
@@ -99,14 +99,14 @@ static int pcf8583_set_datetime(struct i2c_client *client, struct rtc_time *dt,
99 buf[0] = 0; 99 buf[0] = 0;
100 buf[1] = get_ctrl(client) | 0x80; 100 buf[1] = get_ctrl(client) | 0x80;
101 buf[2] = 0; 101 buf[2] = 0;
102 buf[3] = BIN_TO_BCD(dt->tm_sec); 102 buf[3] = BIN2BCD(dt->tm_sec);
103 buf[4] = BIN_TO_BCD(dt->tm_min); 103 buf[4] = BIN2BCD(dt->tm_min);
104 buf[5] = BIN_TO_BCD(dt->tm_hour); 104 buf[5] = BIN2BCD(dt->tm_hour);
105 105
106 if (datetoo) { 106 if (datetoo) {
107 len = 8; 107 len = 8;
108 buf[6] = BIN_TO_BCD(dt->tm_mday) | (dt->tm_year << 6); 108 buf[6] = BIN2BCD(dt->tm_mday) | (dt->tm_year << 6);
109 buf[7] = BIN_TO_BCD(dt->tm_mon) | (dt->tm_wday << 5); 109 buf[7] = BIN2BCD(dt->tm_mon + 1) | (dt->tm_wday << 5);
110 } 110 }
111 111
112 ret = i2c_master_send(client, (char *)buf, len); 112 ret = i2c_master_send(client, (char *)buf, len);
@@ -226,7 +226,7 @@ static int pcf8583_rtc_read_time(struct device *dev, struct rtc_time *tm)
226 */ 226 */
227 year_offset += 4; 227 year_offset += 4;
228 228
229 tm->tm_year = real_year + year_offset + year[1] * 100; 229 tm->tm_year = (real_year + year_offset + year[1] * 100) - 1900;
230 230
231 return 0; 231 return 0;
232} 232}
@@ -237,6 +237,7 @@ static int pcf8583_rtc_set_time(struct device *dev, struct rtc_time *tm)
237 unsigned char year[2], chk; 237 unsigned char year[2], chk;
238 struct rtc_mem cmos_year = { CMOS_YEAR, sizeof(year), year }; 238 struct rtc_mem cmos_year = { CMOS_YEAR, sizeof(year), year };
239 struct rtc_mem cmos_check = { CMOS_CHECKSUM, 1, &chk }; 239 struct rtc_mem cmos_check = { CMOS_CHECKSUM, 1, &chk };
240 unsigned int proper_year = tm->tm_year + 1900;
240 int ret; 241 int ret;
241 242
242 /* 243 /*
@@ -258,8 +259,8 @@ static int pcf8583_rtc_set_time(struct device *dev, struct rtc_time *tm)
258 259
259 chk -= year[1] + year[0]; 260 chk -= year[1] + year[0];
260 261
261 year[1] = tm->tm_year / 100; 262 year[1] = proper_year / 100;
262 year[0] = tm->tm_year % 100; 263 year[0] = proper_year % 100;
263 264
264 chk += year[1] + year[0]; 265 chk += year[1] + year[0];
265 266
diff --git a/drivers/scsi/arm/cumana_2.c b/drivers/scsi/arm/cumana_2.c
index d2d51dc51ab8..82add77ad131 100644
--- a/drivers/scsi/arm/cumana_2.c
+++ b/drivers/scsi/arm/cumana_2.c
@@ -178,10 +178,10 @@ cumanascsi_2_dma_setup(struct Scsi_Host *host, struct scsi_pointer *SCp,
178 dma_dir = DMA_MODE_READ, 178 dma_dir = DMA_MODE_READ,
179 alatch_dir = ALATCH_DMA_IN; 179 alatch_dir = ALATCH_DMA_IN;
180 180
181 dma_map_sg(dev, info->sg, bufs + 1, map_dir); 181 dma_map_sg(dev, info->sg, bufs, map_dir);
182 182
183 disable_dma(dmach); 183 disable_dma(dmach);
184 set_dma_sg(dmach, info->sg, bufs + 1); 184 set_dma_sg(dmach, info->sg, bufs);
185 writeb(alatch_dir, info->base + CUMANASCSI2_ALATCH); 185 writeb(alatch_dir, info->base + CUMANASCSI2_ALATCH);
186 set_dma_mode(dmach, dma_dir); 186 set_dma_mode(dmach, dma_dir);
187 enable_dma(dmach); 187 enable_dma(dmach);
diff --git a/drivers/scsi/arm/eesox.c b/drivers/scsi/arm/eesox.c
index d4136524fc46..ed06a8c19ad6 100644
--- a/drivers/scsi/arm/eesox.c
+++ b/drivers/scsi/arm/eesox.c
@@ -175,10 +175,10 @@ eesoxscsi_dma_setup(struct Scsi_Host *host, struct scsi_pointer *SCp,
175 map_dir = DMA_FROM_DEVICE, 175 map_dir = DMA_FROM_DEVICE,
176 dma_dir = DMA_MODE_READ; 176 dma_dir = DMA_MODE_READ;
177 177
178 dma_map_sg(dev, info->sg, bufs + 1, map_dir); 178 dma_map_sg(dev, info->sg, bufs, map_dir);
179 179
180 disable_dma(dmach); 180 disable_dma(dmach);
181 set_dma_sg(dmach, info->sg, bufs + 1); 181 set_dma_sg(dmach, info->sg, bufs);
182 set_dma_mode(dmach, dma_dir); 182 set_dma_mode(dmach, dma_dir);
183 enable_dma(dmach); 183 enable_dma(dmach);
184 return fasdma_real_all; 184 return fasdma_real_all;
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c
index 2969cc0ff259..fb5f20284389 100644
--- a/drivers/scsi/arm/fas216.c
+++ b/drivers/scsi/arm/fas216.c
@@ -633,7 +633,7 @@ static void fas216_updateptrs(FAS216_Info *info, int bytes_transferred)
633 633
634 BUG_ON(bytes_transferred < 0); 634 BUG_ON(bytes_transferred < 0);
635 635
636 info->SCpnt->request_bufflen -= bytes_transferred; 636 SCp->phase -= bytes_transferred;
637 637
638 while (bytes_transferred != 0) { 638 while (bytes_transferred != 0) {
639 if (SCp->this_residual > bytes_transferred) 639 if (SCp->this_residual > bytes_transferred)
@@ -715,7 +715,7 @@ static void fas216_cleanuptransfer(FAS216_Info *info)
715 return; 715 return;
716 716
717 if (dmatype == fasdma_real_all) 717 if (dmatype == fasdma_real_all)
718 total = info->SCpnt->request_bufflen; 718 total = info->scsi.SCp.phase;
719 else 719 else
720 total = info->scsi.SCp.this_residual; 720 total = info->scsi.SCp.this_residual;
721 721
@@ -753,7 +753,7 @@ static void fas216_transfer(FAS216_Info *info)
753 fas216_log(info, LOG_BUFFER, 753 fas216_log(info, LOG_BUFFER,
754 "starttransfer: buffer %p length 0x%06x reqlen 0x%06x", 754 "starttransfer: buffer %p length 0x%06x reqlen 0x%06x",
755 info->scsi.SCp.ptr, info->scsi.SCp.this_residual, 755 info->scsi.SCp.ptr, info->scsi.SCp.this_residual,
756 info->SCpnt->request_bufflen); 756 info->scsi.SCp.phase);
757 757
758 if (!info->scsi.SCp.ptr) { 758 if (!info->scsi.SCp.ptr) {
759 fas216_log(info, LOG_ERROR, "null buffer passed to " 759 fas216_log(info, LOG_ERROR, "null buffer passed to "
@@ -784,7 +784,7 @@ static void fas216_transfer(FAS216_Info *info)
784 info->dma.transfer_type = dmatype; 784 info->dma.transfer_type = dmatype;
785 785
786 if (dmatype == fasdma_real_all) 786 if (dmatype == fasdma_real_all)
787 fas216_set_stc(info, info->SCpnt->request_bufflen); 787 fas216_set_stc(info, info->scsi.SCp.phase);
788 else 788 else
789 fas216_set_stc(info, info->scsi.SCp.this_residual); 789 fas216_set_stc(info, info->scsi.SCp.this_residual);
790 790
@@ -2114,6 +2114,7 @@ request_sense:
2114 SCpnt->SCp.buffers_residual = 0; 2114 SCpnt->SCp.buffers_residual = 0;
2115 SCpnt->SCp.ptr = (char *)SCpnt->sense_buffer; 2115 SCpnt->SCp.ptr = (char *)SCpnt->sense_buffer;
2116 SCpnt->SCp.this_residual = sizeof(SCpnt->sense_buffer); 2116 SCpnt->SCp.this_residual = sizeof(SCpnt->sense_buffer);
2117 SCpnt->SCp.phase = sizeof(SCpnt->sense_buffer);
2117 SCpnt->SCp.Message = 0; 2118 SCpnt->SCp.Message = 0;
2118 SCpnt->SCp.Status = 0; 2119 SCpnt->SCp.Status = 0;
2119 SCpnt->request_bufflen = sizeof(SCpnt->sense_buffer); 2120 SCpnt->request_bufflen = sizeof(SCpnt->sense_buffer);
diff --git a/drivers/scsi/arm/powertec.c b/drivers/scsi/arm/powertec.c
index f9cd20bfb958..159047a34997 100644
--- a/drivers/scsi/arm/powertec.c
+++ b/drivers/scsi/arm/powertec.c
@@ -148,10 +148,10 @@ powertecscsi_dma_setup(struct Scsi_Host *host, struct scsi_pointer *SCp,
148 map_dir = DMA_FROM_DEVICE, 148 map_dir = DMA_FROM_DEVICE,
149 dma_dir = DMA_MODE_READ; 149 dma_dir = DMA_MODE_READ;
150 150
151 dma_map_sg(dev, info->sg, bufs + 1, map_dir); 151 dma_map_sg(dev, info->sg, bufs, map_dir);
152 152
153 disable_dma(dmach); 153 disable_dma(dmach);
154 set_dma_sg(dmach, info->sg, bufs + 1); 154 set_dma_sg(dmach, info->sg, bufs);
155 set_dma_mode(dmach, dma_dir); 155 set_dma_mode(dmach, dma_dir);
156 enable_dma(dmach); 156 enable_dma(dmach);
157 return fasdma_real_all; 157 return fasdma_real_all;
@@ -342,6 +342,7 @@ powertecscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
342 info->base = base; 342 info->base = base;
343 powertecscsi_terminator_ctl(host, term[ec->slot_no]); 343 powertecscsi_terminator_ctl(host, term[ec->slot_no]);
344 344
345 info->ec = ec;
345 info->info.scsi.io_base = base + POWERTEC_FAS216_OFFSET; 346 info->info.scsi.io_base = base + POWERTEC_FAS216_OFFSET;
346 info->info.scsi.io_shift = POWERTEC_FAS216_SHIFT; 347 info->info.scsi.io_shift = POWERTEC_FAS216_SHIFT;
347 info->info.scsi.irq = ec->irq; 348 info->info.scsi.irq = ec->irq;
diff --git a/drivers/scsi/arm/scsi.h b/drivers/scsi/arm/scsi.h
index 3a39579bd08e..21ba57155bea 100644
--- a/drivers/scsi/arm/scsi.h
+++ b/drivers/scsi/arm/scsi.h
@@ -80,6 +80,7 @@ static inline void init_SCp(struct scsi_cmnd *SCpnt)
80 (page_address(SCpnt->SCp.buffer->page) + 80 (page_address(SCpnt->SCp.buffer->page) +
81 SCpnt->SCp.buffer->offset); 81 SCpnt->SCp.buffer->offset);
82 SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; 82 SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length;
83 SCpnt->SCp.phase = SCpnt->request_bufflen;
83 84
84#ifdef BELT_AND_BRACES 85#ifdef BELT_AND_BRACES
85 /* 86 /*
@@ -98,6 +99,7 @@ static inline void init_SCp(struct scsi_cmnd *SCpnt)
98 } else { 99 } else {
99 SCpnt->SCp.ptr = (unsigned char *)SCpnt->request_buffer; 100 SCpnt->SCp.ptr = (unsigned char *)SCpnt->request_buffer;
100 SCpnt->SCp.this_residual = SCpnt->request_bufflen; 101 SCpnt->SCp.this_residual = SCpnt->request_bufflen;
102 SCpnt->SCp.phase = SCpnt->request_bufflen;
101 } 103 }
102 104
103 /* 105 /*
diff --git a/include/asm-arm/arch-omap/entry-macro.S b/include/asm-arm/arch-omap/entry-macro.S
index c90dff4828f7..f6967c8df323 100644
--- a/include/asm-arm/arch-omap/entry-macro.S
+++ b/include/asm-arm/arch-omap/entry-macro.S
@@ -61,6 +61,12 @@
61 .macro disable_fiq 61 .macro disable_fiq
62 .endm 62 .endm
63 63
64 .macro get_irqnr_preamble, base, tmp
65 .endm
66
67 .macro arch_ret_to_user, tmp1, tmp2
68 .endm
69
64 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 70 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
65 ldr \base, =VA_IC_BASE 71 ldr \base, =VA_IC_BASE
66 ldr \irqnr, [\base, #0x98] /* IRQ pending reg 1 */ 72 ldr \irqnr, [\base, #0x98] /* IRQ pending reg 1 */
diff --git a/include/asm-arm/arch-omap/memory.h b/include/asm-arm/arch-omap/memory.h
index df50dd53e1dd..48fabc493163 100644
--- a/include/asm-arm/arch-omap/memory.h
+++ b/include/asm-arm/arch-omap/memory.h
@@ -70,7 +70,7 @@
70 70
71#define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET) 71#define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET)
72#define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET) 72#define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET)
73#define is_lbus_device(dev) (cpu_is_omap1510() && dev && (strncmp(dev->bus_id, "ohci", 4) == 0)) 73#define is_lbus_device(dev) (cpu_is_omap15xx() && dev && (strncmp(dev->bus_id, "ohci", 4) == 0))
74 74
75#define __arch_page_to_dma(dev, page) ({is_lbus_device(dev) ? \ 75#define __arch_page_to_dma(dev, page) ({is_lbus_device(dev) ? \
76 (dma_addr_t)virt_to_lbus(page_address(page)) : \ 76 (dma_addr_t)virt_to_lbus(page_address(page)) : \
diff --git a/include/asm-arm/arch-omap/omap-alsa.h b/include/asm-arm/arch-omap/omap-alsa.h
index df4695474e3d..fcaf44c14714 100644
--- a/include/asm-arm/arch-omap/omap-alsa.h
+++ b/include/asm-arm/arch-omap/omap-alsa.h
@@ -65,7 +65,7 @@ struct audio_stream {
65 int period; /* current transfer period */ 65 int period; /* current transfer period */
66 int periods; /* current count of periods registerd in the DMA engine */ 66 int periods; /* current count of periods registerd in the DMA engine */
67 spinlock_t dma_lock; /* for locking in DMA operations */ 67 spinlock_t dma_lock; /* for locking in DMA operations */
68 snd_pcm_substream_t *stream; /* the pcm stream */ 68 struct snd_pcm_substream *stream; /* the pcm stream */
69 unsigned linked:1; /* dma channels linked */ 69 unsigned linked:1; /* dma channels linked */
70 int offset; /* store start position of the last period in the alsa buffer */ 70 int offset; /* store start position of the last period in the alsa buffer */
71 int (*hw_start)(void); /* interface to start HW interface, e.g. McBSP */ 71 int (*hw_start)(void); /* interface to start HW interface, e.g. McBSP */
@@ -76,8 +76,8 @@ struct audio_stream {
76 * Alsa card structure for aic23 76 * Alsa card structure for aic23
77 */ 77 */
78struct snd_card_omap_codec { 78struct snd_card_omap_codec {
79 snd_card_t *card; 79 struct snd_card *card;
80 snd_pcm_t *pcm; 80 struct snd_pcm *pcm;
81 long samplerate; 81 long samplerate;
82 struct audio_stream s[2]; /* playback & capture */ 82 struct audio_stream s[2]; /* playback & capture */
83}; 83};
@@ -89,9 +89,9 @@ struct snd_card_omap_codec {
89struct omap_alsa_codec_config { 89struct omap_alsa_codec_config {
90 char *name; 90 char *name;
91 struct omap_mcbsp_reg_cfg *mcbsp_regs_alsa; 91 struct omap_mcbsp_reg_cfg *mcbsp_regs_alsa;
92 snd_pcm_hw_constraint_list_t *hw_constraints_rates; 92 struct snd_pcm_hw_constraint_list *hw_constraints_rates;
93 snd_pcm_hardware_t *snd_omap_alsa_playback; 93 struct snd_pcm_hardware *snd_omap_alsa_playback;
94 snd_pcm_hardware_t *snd_omap_alsa_capture; 94 struct snd_pcm_hardware *snd_omap_alsa_capture;
95 void (*codec_configure_dev)(void); 95 void (*codec_configure_dev)(void);
96 void (*codec_set_samplerate)(long); 96 void (*codec_set_samplerate)(long);
97 void (*codec_clock_setup)(void); 97 void (*codec_clock_setup)(void);
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index f4386906b200..f06d8a43fdee 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -167,11 +167,25 @@ extern unsigned int user_debug;
167 : : "r" (0) : "memory") 167 : : "r" (0) : "memory")
168#define dmb() __asm__ __volatile__ ("" : : : "memory") 168#define dmb() __asm__ __volatile__ ("" : : : "memory")
169#endif 169#endif
170#define mb() dmb() 170
171#define rmb() mb() 171#define mb() barrier()
172#define wmb() mb() 172#define rmb() barrier()
173#define read_barrier_depends() do { } while(0) 173#define wmb() barrier()
174#define set_mb(var, value) do { var = value; mb(); } while (0) 174#define read_barrier_depends() do { } while(0)
175
176#ifdef CONFIG_SMP
177#define smp_mb() dmb()
178#define smp_rmb() dmb()
179#define smp_wmb() dmb()
180#define smp_read_barrier_depends() read_barrier_depends()
181#else
182#define smp_mb() barrier()
183#define smp_rmb() barrier()
184#define smp_wmb() barrier()
185#define smp_read_barrier_depends() read_barrier_depends()
186#endif /* CONFIG_SMP */
187
188#define set_mb(var, value) do { var = value; smp_mb(); } while (0)
175#define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t"); 189#define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
176 190
177extern unsigned long cr_no_alignment; /* defined in entry-armv.S */ 191extern unsigned long cr_no_alignment; /* defined in entry-armv.S */
@@ -243,22 +257,6 @@ static inline void sched_cacheflush(void)
243{ 257{
244} 258}
245 259
246#ifdef CONFIG_SMP
247
248#define smp_mb() mb()
249#define smp_rmb() rmb()
250#define smp_wmb() wmb()
251#define smp_read_barrier_depends() read_barrier_depends()
252
253#else
254
255#define smp_mb() barrier()
256#define smp_rmb() barrier()
257#define smp_wmb() barrier()
258#define smp_read_barrier_depends() do { } while(0)
259
260#endif /* CONFIG_SMP */
261
262#if defined(CONFIG_CPU_SA1100) || defined(CONFIG_CPU_SA110) 260#if defined(CONFIG_CPU_SA1100) || defined(CONFIG_CPU_SA110)
263/* 261/*
264 * On the StrongARM, "swp" is terminally broken since it bypasses the 262 * On the StrongARM, "swp" is terminally broken since it bypasses the