aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/Kconfig9
-rw-r--r--arch/arm/common/rtctime.c108
-rw-r--r--arch/arm/common/sharpsl_pm.c10
-rw-r--r--arch/arm/kernel/process.c1
-rw-r--r--arch/arm/lib/copy_template.S2
-rw-r--r--arch/arm/mach-ep93xx/core.c68
-rw-r--r--arch/arm/mach-footbridge/time.c17
-rw-r--r--arch/arm/mach-integrator/core.c46
-rw-r--r--arch/arm/mach-integrator/time.c16
-rw-r--r--arch/arm/mach-omap1/board-netstar.c2
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c2
-rw-r--r--arch/arm/mach-pxa/corgi.c11
-rw-r--r--arch/arm/mach-pxa/generic.c6
-rw-r--r--arch/arm/mach-pxa/spitz.c11
-rw-r--r--arch/arm/mach-pxa/tosa.c9
-rw-r--r--arch/arm/mach-sa1100/generic.c6
16 files changed, 199 insertions, 125 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 1077c671256f..dc5a9332c915 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -8,6 +8,7 @@ mainmenu "Linux Kernel Configuration"
8config ARM 8config ARM
9 bool 9 bool
10 default y 10 default y
11 select RTC_LIB
11 help 12 help
12 The ARM series is a line of low-power-consumption RISC chip designs 13 The ARM series is a line of low-power-consumption RISC chip designs
13 licensed by ARM Ltd and targeted at embedded applications and 14 licensed by ARM Ltd and targeted at embedded applications and
@@ -53,6 +54,10 @@ config RWSEM_GENERIC_SPINLOCK
53config RWSEM_XCHGADD_ALGORITHM 54config RWSEM_XCHGADD_ALGORITHM
54 bool 55 bool
55 56
57config GENERIC_HWEIGHT
58 bool
59 default y
60
56config GENERIC_CALIBRATE_DELAY 61config GENERIC_CALIBRATE_DELAY
57 bool 62 bool
58 default y 63 default y
@@ -842,6 +847,8 @@ source "drivers/misc/Kconfig"
842 847
843source "drivers/mfd/Kconfig" 848source "drivers/mfd/Kconfig"
844 849
850source "drivers/leds/Kconfig"
851
845source "drivers/media/Kconfig" 852source "drivers/media/Kconfig"
846 853
847source "drivers/video/Kconfig" 854source "drivers/video/Kconfig"
@@ -852,6 +859,8 @@ source "drivers/usb/Kconfig"
852 859
853source "drivers/mmc/Kconfig" 860source "drivers/mmc/Kconfig"
854 861
862source "drivers/rtc/Kconfig"
863
855endmenu 864endmenu
856 865
857source "fs/Kconfig" 866source "fs/Kconfig"
diff --git a/arch/arm/common/rtctime.c b/arch/arm/common/rtctime.c
index e851d86c212c..35c9a64ac14c 100644
--- a/arch/arm/common/rtctime.c
+++ b/arch/arm/common/rtctime.c
@@ -20,6 +20,7 @@
20#include <linux/capability.h> 20#include <linux/capability.h>
21#include <linux/device.h> 21#include <linux/device.h>
22#include <linux/mutex.h> 22#include <linux/mutex.h>
23#include <linux/rtc.h>
23 24
24#include <asm/rtc.h> 25#include <asm/rtc.h>
25#include <asm/semaphore.h> 26#include <asm/semaphore.h>
@@ -42,89 +43,6 @@ static struct rtc_ops *rtc_ops;
42 43
43#define rtc_epoch 1900UL 44#define rtc_epoch 1900UL
44 45
45static const unsigned char days_in_month[] = {
46 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
47};
48
49#define LEAPS_THRU_END_OF(y) ((y)/4 - (y)/100 + (y)/400)
50#define LEAP_YEAR(year) ((!(year % 4) && (year % 100)) || !(year % 400))
51
52static int month_days(unsigned int month, unsigned int year)
53{
54 return days_in_month[month] + (LEAP_YEAR(year) && month == 1);
55}
56
57/*
58 * Convert seconds since 01-01-1970 00:00:00 to Gregorian date.
59 */
60void rtc_time_to_tm(unsigned long time, struct rtc_time *tm)
61{
62 int days, month, year;
63
64 days = time / 86400;
65 time -= days * 86400;
66
67 tm->tm_wday = (days + 4) % 7;
68
69 year = 1970 + days / 365;
70 days -= (year - 1970) * 365
71 + LEAPS_THRU_END_OF(year - 1)
72 - LEAPS_THRU_END_OF(1970 - 1);
73 if (days < 0) {
74 year -= 1;
75 days += 365 + LEAP_YEAR(year);
76 }
77 tm->tm_year = year - 1900;
78 tm->tm_yday = days + 1;
79
80 for (month = 0; month < 11; month++) {
81 int newdays;
82
83 newdays = days - month_days(month, year);
84 if (newdays < 0)
85 break;
86 days = newdays;
87 }
88 tm->tm_mon = month;
89 tm->tm_mday = days + 1;
90
91 tm->tm_hour = time / 3600;
92 time -= tm->tm_hour * 3600;
93 tm->tm_min = time / 60;
94 tm->tm_sec = time - tm->tm_min * 60;
95}
96EXPORT_SYMBOL(rtc_time_to_tm);
97
98/*
99 * Does the rtc_time represent a valid date/time?
100 */
101int rtc_valid_tm(struct rtc_time *tm)
102{
103 if (tm->tm_year < 70 ||
104 tm->tm_mon >= 12 ||
105 tm->tm_mday < 1 ||
106 tm->tm_mday > month_days(tm->tm_mon, tm->tm_year + 1900) ||
107 tm->tm_hour >= 24 ||
108 tm->tm_min >= 60 ||
109 tm->tm_sec >= 60)
110 return -EINVAL;
111
112 return 0;
113}
114EXPORT_SYMBOL(rtc_valid_tm);
115
116/*
117 * Convert Gregorian date to seconds since 01-01-1970 00:00:00.
118 */
119int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time)
120{
121 *time = mktime(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
122 tm->tm_hour, tm->tm_min, tm->tm_sec);
123
124 return 0;
125}
126EXPORT_SYMBOL(rtc_tm_to_time);
127
128/* 46/*
129 * Calculate the next alarm time given the requested alarm time mask 47 * Calculate the next alarm time given the requested alarm time mask
130 * and the current time. 48 * and the current time.
@@ -151,13 +69,13 @@ void rtc_next_alarm_time(struct rtc_time *next, struct rtc_time *now, struct rtc
151 } 69 }
152} 70}
153 71
154static inline int rtc_read_time(struct rtc_ops *ops, struct rtc_time *tm) 72static inline int rtc_arm_read_time(struct rtc_ops *ops, struct rtc_time *tm)
155{ 73{
156 memset(tm, 0, sizeof(struct rtc_time)); 74 memset(tm, 0, sizeof(struct rtc_time));
157 return ops->read_time(tm); 75 return ops->read_time(tm);
158} 76}
159 77
160static inline int rtc_set_time(struct rtc_ops *ops, struct rtc_time *tm) 78static inline int rtc_arm_set_time(struct rtc_ops *ops, struct rtc_time *tm)
161{ 79{
162 int ret; 80 int ret;
163 81
@@ -168,7 +86,7 @@ static inline int rtc_set_time(struct rtc_ops *ops, struct rtc_time *tm)
168 return ret; 86 return ret;
169} 87}
170 88
171static inline int rtc_read_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm) 89static inline int rtc_arm_read_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm)
172{ 90{
173 int ret = -EINVAL; 91 int ret = -EINVAL;
174 if (ops->read_alarm) { 92 if (ops->read_alarm) {
@@ -178,7 +96,7 @@ static inline int rtc_read_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm)
178 return ret; 96 return ret;
179} 97}
180 98
181static inline int rtc_set_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm) 99static inline int rtc_arm_set_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm)
182{ 100{
183 int ret = -EINVAL; 101 int ret = -EINVAL;
184 if (ops->set_alarm) 102 if (ops->set_alarm)
@@ -266,7 +184,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
266 184
267 switch (cmd) { 185 switch (cmd) {
268 case RTC_ALM_READ: 186 case RTC_ALM_READ:
269 ret = rtc_read_alarm(ops, &alrm); 187 ret = rtc_arm_read_alarm(ops, &alrm);
270 if (ret) 188 if (ret)
271 break; 189 break;
272 ret = copy_to_user(uarg, &alrm.time, sizeof(tm)); 190 ret = copy_to_user(uarg, &alrm.time, sizeof(tm));
@@ -288,11 +206,11 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
288 alrm.time.tm_wday = -1; 206 alrm.time.tm_wday = -1;
289 alrm.time.tm_yday = -1; 207 alrm.time.tm_yday = -1;
290 alrm.time.tm_isdst = -1; 208 alrm.time.tm_isdst = -1;
291 ret = rtc_set_alarm(ops, &alrm); 209 ret = rtc_arm_set_alarm(ops, &alrm);
292 break; 210 break;
293 211
294 case RTC_RD_TIME: 212 case RTC_RD_TIME:
295 ret = rtc_read_time(ops, &tm); 213 ret = rtc_arm_read_time(ops, &tm);
296 if (ret) 214 if (ret)
297 break; 215 break;
298 ret = copy_to_user(uarg, &tm, sizeof(tm)); 216 ret = copy_to_user(uarg, &tm, sizeof(tm));
@@ -310,7 +228,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
310 ret = -EFAULT; 228 ret = -EFAULT;
311 break; 229 break;
312 } 230 }
313 ret = rtc_set_time(ops, &tm); 231 ret = rtc_arm_set_time(ops, &tm);
314 break; 232 break;
315 233
316 case RTC_EPOCH_SET: 234 case RTC_EPOCH_SET:
@@ -341,11 +259,11 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
341 ret = -EFAULT; 259 ret = -EFAULT;
342 break; 260 break;
343 } 261 }
344 ret = rtc_set_alarm(ops, &alrm); 262 ret = rtc_arm_set_alarm(ops, &alrm);
345 break; 263 break;
346 264
347 case RTC_WKALM_RD: 265 case RTC_WKALM_RD:
348 ret = rtc_read_alarm(ops, &alrm); 266 ret = rtc_arm_read_alarm(ops, &alrm);
349 if (ret) 267 if (ret)
350 break; 268 break;
351 ret = copy_to_user(uarg, &alrm, sizeof(alrm)); 269 ret = copy_to_user(uarg, &alrm, sizeof(alrm));
@@ -435,7 +353,7 @@ static int rtc_read_proc(char *page, char **start, off_t off, int count, int *eo
435 struct rtc_time tm; 353 struct rtc_time tm;
436 char *p = page; 354 char *p = page;
437 355
438 if (rtc_read_time(ops, &tm) == 0) { 356 if (rtc_arm_read_time(ops, &tm) == 0) {
439 p += sprintf(p, 357 p += sprintf(p,
440 "rtc_time\t: %02d:%02d:%02d\n" 358 "rtc_time\t: %02d:%02d:%02d\n"
441 "rtc_date\t: %04d-%02d-%02d\n" 359 "rtc_date\t: %04d-%02d-%02d\n"
@@ -445,7 +363,7 @@ static int rtc_read_proc(char *page, char **start, off_t off, int count, int *eo
445 rtc_epoch); 363 rtc_epoch);
446 } 364 }
447 365
448 if (rtc_read_alarm(ops, &alrm) == 0) { 366 if (rtc_arm_read_alarm(ops, &alrm) == 0) {
449 p += sprintf(p, "alrm_time\t: "); 367 p += sprintf(p, "alrm_time\t: ");
450 if ((unsigned int)alrm.time.tm_hour <= 24) 368 if ((unsigned int)alrm.time.tm_hour <= 24)
451 p += sprintf(p, "%02d:", alrm.time.tm_hour); 369 p += sprintf(p, "%02d:", alrm.time.tm_hour);
diff --git a/arch/arm/common/sharpsl_pm.c b/arch/arm/common/sharpsl_pm.c
index 978d32e82d39..3cd8c9ee4510 100644
--- a/arch/arm/common/sharpsl_pm.c
+++ b/arch/arm/common/sharpsl_pm.c
@@ -22,6 +22,7 @@
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/leds.h>
25 26
26#include <asm/hardware.h> 27#include <asm/hardware.h>
27#include <asm/mach-types.h> 28#include <asm/mach-types.h>
@@ -75,6 +76,7 @@ static void sharpsl_battery_thread(void *private_);
75struct sharpsl_pm_status sharpsl_pm; 76struct sharpsl_pm_status sharpsl_pm;
76DECLARE_WORK(toggle_charger, sharpsl_charge_toggle, NULL); 77DECLARE_WORK(toggle_charger, sharpsl_charge_toggle, NULL);
77DECLARE_WORK(sharpsl_bat, sharpsl_battery_thread, NULL); 78DECLARE_WORK(sharpsl_bat, sharpsl_battery_thread, NULL);
79DEFINE_LED_TRIGGER(sharpsl_charge_led_trigger);
78 80
79 81
80static int get_percentage(int voltage) 82static int get_percentage(int voltage)
@@ -190,10 +192,10 @@ void sharpsl_pm_led(int val)
190 dev_err(sharpsl_pm.dev, "Charging Error!\n"); 192 dev_err(sharpsl_pm.dev, "Charging Error!\n");
191 } else if (val == SHARPSL_LED_ON) { 193 } else if (val == SHARPSL_LED_ON) {
192 dev_dbg(sharpsl_pm.dev, "Charge LED On\n"); 194 dev_dbg(sharpsl_pm.dev, "Charge LED On\n");
193 195 led_trigger_event(sharpsl_charge_led_trigger, LED_FULL);
194 } else { 196 } else {
195 dev_dbg(sharpsl_pm.dev, "Charge LED Off\n"); 197 dev_dbg(sharpsl_pm.dev, "Charge LED Off\n");
196 198 led_trigger_event(sharpsl_charge_led_trigger, LED_OFF);
197 } 199 }
198} 200}
199 201
@@ -786,6 +788,8 @@ static int __init sharpsl_pm_probe(struct platform_device *pdev)
786 init_timer(&sharpsl_pm.chrg_full_timer); 788 init_timer(&sharpsl_pm.chrg_full_timer);
787 sharpsl_pm.chrg_full_timer.function = sharpsl_chrg_full_timer; 789 sharpsl_pm.chrg_full_timer.function = sharpsl_chrg_full_timer;
788 790
791 led_trigger_register_simple("sharpsl-charge", &sharpsl_charge_led_trigger);
792
789 sharpsl_pm.machinfo->init(); 793 sharpsl_pm.machinfo->init();
790 794
791 device_create_file(&pdev->dev, &dev_attr_battery_percentage); 795 device_create_file(&pdev->dev, &dev_attr_battery_percentage);
@@ -807,6 +811,8 @@ static int sharpsl_pm_remove(struct platform_device *pdev)
807 device_remove_file(&pdev->dev, &dev_attr_battery_percentage); 811 device_remove_file(&pdev->dev, &dev_attr_battery_percentage);
808 device_remove_file(&pdev->dev, &dev_attr_battery_voltage); 812 device_remove_file(&pdev->dev, &dev_attr_battery_voltage);
809 813
814 led_trigger_unregister_simple(sharpsl_charge_led_trigger);
815
810 sharpsl_pm.machinfo->exit(); 816 sharpsl_pm.machinfo->exit();
811 817
812 del_timer_sync(&sharpsl_pm.chrg_full_timer); 818 del_timer_sync(&sharpsl_pm.chrg_full_timer);
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 489c069e5c3e..1ff75cee4b0d 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -474,4 +474,3 @@ unsigned long get_wchan(struct task_struct *p)
474 } while (count ++ < 16); 474 } while (count ++ < 16);
475 return 0; 475 return 0;
476} 476}
477EXPORT_SYMBOL(get_wchan);
diff --git a/arch/arm/lib/copy_template.S b/arch/arm/lib/copy_template.S
index 838e435e4922..cab355c0c1f7 100644
--- a/arch/arm/lib/copy_template.S
+++ b/arch/arm/lib/copy_template.S
@@ -236,7 +236,7 @@
236 236
237 237
238/* 238/*
239 * Abort preanble and completion macros. 239 * Abort preamble and completion macros.
240 * If a fixup handler is required then those macros must surround it. 240 * If a fixup handler is required then those macros must surround it.
241 * It is assumed that the fixup code will handle the private part of 241 * It is assumed that the fixup code will handle the private part of
242 * the exit macro. 242 * the exit macro.
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 865427bfad7e..2d892e4daa07 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -30,7 +30,9 @@
30#include <linux/time.h> 30#include <linux/time.h>
31#include <linux/timex.h> 31#include <linux/timex.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/termios.h>
33#include <linux/amba/bus.h> 34#include <linux/amba/bus.h>
35#include <linux/amba/serial.h>
34 36
35#include <asm/types.h> 37#include <asm/types.h>
36#include <asm/setup.h> 38#include <asm/setup.h>
@@ -360,6 +362,68 @@ void __init ep93xx_init_irq(void)
360/************************************************************************* 362/*************************************************************************
361 * EP93xx peripheral handling 363 * EP93xx peripheral handling
362 *************************************************************************/ 364 *************************************************************************/
365#define EP93XX_UART_MCR_OFFSET (0x0100)
366
367static void ep93xx_uart_set_mctrl(struct amba_device *dev,
368 void __iomem *base, unsigned int mctrl)
369{
370 unsigned int mcr;
371
372 mcr = 0;
373 if (!(mctrl & TIOCM_RTS))
374 mcr |= 2;
375 if (!(mctrl & TIOCM_DTR))
376 mcr |= 1;
377
378 __raw_writel(mcr, base + EP93XX_UART_MCR_OFFSET);
379}
380
381static struct amba_pl010_data ep93xx_uart_data = {
382 .set_mctrl = ep93xx_uart_set_mctrl,
383};
384
385static struct amba_device uart1_device = {
386 .dev = {
387 .bus_id = "apb:uart1",
388 .platform_data = &ep93xx_uart_data,
389 },
390 .res = {
391 .start = EP93XX_UART1_PHYS_BASE,
392 .end = EP93XX_UART1_PHYS_BASE + 0x0fff,
393 .flags = IORESOURCE_MEM,
394 },
395 .irq = { IRQ_EP93XX_UART1, NO_IRQ },
396 .periphid = 0x00041010,
397};
398
399static struct amba_device uart2_device = {
400 .dev = {
401 .bus_id = "apb:uart2",
402 .platform_data = &ep93xx_uart_data,
403 },
404 .res = {
405 .start = EP93XX_UART2_PHYS_BASE,
406 .end = EP93XX_UART2_PHYS_BASE + 0x0fff,
407 .flags = IORESOURCE_MEM,
408 },
409 .irq = { IRQ_EP93XX_UART2, NO_IRQ },
410 .periphid = 0x00041010,
411};
412
413static struct amba_device uart3_device = {
414 .dev = {
415 .bus_id = "apb:uart3",
416 .platform_data = &ep93xx_uart_data,
417 },
418 .res = {
419 .start = EP93XX_UART3_PHYS_BASE,
420 .end = EP93XX_UART3_PHYS_BASE + 0x0fff,
421 .flags = IORESOURCE_MEM,
422 },
423 .irq = { IRQ_EP93XX_UART3, NO_IRQ },
424 .periphid = 0x00041010,
425};
426
363void __init ep93xx_init_devices(void) 427void __init ep93xx_init_devices(void)
364{ 428{
365 unsigned int v; 429 unsigned int v;
@@ -371,4 +435,8 @@ void __init ep93xx_init_devices(void)
371 v &= ~EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE; 435 v &= ~EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE;
372 __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK); 436 __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK);
373 __raw_writel(v, EP93XX_SYSCON_DEVICE_CONFIG); 437 __raw_writel(v, EP93XX_SYSCON_DEVICE_CONFIG);
438
439 amba_device_register(&uart1_device, &iomem_resource);
440 amba_device_register(&uart2_device, &iomem_resource);
441 amba_device_register(&uart3_device, &iomem_resource);
374} 442}
diff --git a/arch/arm/mach-footbridge/time.c b/arch/arm/mach-footbridge/time.c
index 2c64a0b0502e..5d02e95dede3 100644
--- a/arch/arm/mach-footbridge/time.c
+++ b/arch/arm/mach-footbridge/time.c
@@ -34,27 +34,12 @@ static int rtc_base;
34static unsigned long __init get_isa_cmos_time(void) 34static unsigned long __init get_isa_cmos_time(void)
35{ 35{
36 unsigned int year, mon, day, hour, min, sec; 36 unsigned int year, mon, day, hour, min, sec;
37 int i;
38 37
39 // check to see if the RTC makes sense..... 38 // check to see if the RTC makes sense.....
40 if ((CMOS_READ(RTC_VALID) & RTC_VRT) == 0) 39 if ((CMOS_READ(RTC_VALID) & RTC_VRT) == 0)
41 return mktime(1970, 1, 1, 0, 0, 0); 40 return mktime(1970, 1, 1, 0, 0, 0);
42 41
43 /* The Linux interpretation of the CMOS clock register contents: 42 do {
44 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
45 * RTC registers show the second which has precisely just started.
46 * Let's hope other operating systems interpret the RTC the same way.
47 */
48 /* read RTC exactly on falling edge of update flag */
49 for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */
50 if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)
51 break;
52
53 for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */
54 if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP))
55 break;
56
57 do { /* Isn't this overkill ? UIP above should guarantee consistency */
58 sec = CMOS_READ(RTC_SECONDS); 43 sec = CMOS_READ(RTC_SECONDS);
59 min = CMOS_READ(RTC_MINUTES); 44 min = CMOS_READ(RTC_MINUTES);
60 hour = CMOS_READ(RTC_HOURS); 45 hour = CMOS_READ(RTC_HOURS);
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index 20071a2767cc..576a5e979c00 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -15,7 +15,9 @@
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/smp.h> 17#include <linux/smp.h>
18#include <linux/termios.h>
18#include <linux/amba/bus.h> 19#include <linux/amba/bus.h>
20#include <linux/amba/serial.h>
19 21
20#include <asm/hardware.h> 22#include <asm/hardware.h>
21#include <asm/irq.h> 23#include <asm/irq.h>
@@ -28,6 +30,8 @@
28 30
29#include "common.h" 31#include "common.h"
30 32
33static struct amba_pl010_data integrator_uart_data;
34
31static struct amba_device rtc_device = { 35static struct amba_device rtc_device = {
32 .dev = { 36 .dev = {
33 .bus_id = "mb:15", 37 .bus_id = "mb:15",
@@ -44,6 +48,7 @@ static struct amba_device rtc_device = {
44static struct amba_device uart0_device = { 48static struct amba_device uart0_device = {
45 .dev = { 49 .dev = {
46 .bus_id = "mb:16", 50 .bus_id = "mb:16",
51 .platform_data = &integrator_uart_data,
47 }, 52 },
48 .res = { 53 .res = {
49 .start = INTEGRATOR_UART0_BASE, 54 .start = INTEGRATOR_UART0_BASE,
@@ -57,6 +62,7 @@ static struct amba_device uart0_device = {
57static struct amba_device uart1_device = { 62static struct amba_device uart1_device = {
58 .dev = { 63 .dev = {
59 .bus_id = "mb:17", 64 .bus_id = "mb:17",
65 .platform_data = &integrator_uart_data,
60 }, 66 },
61 .res = { 67 .res = {
62 .start = INTEGRATOR_UART1_BASE, 68 .start = INTEGRATOR_UART1_BASE,
@@ -115,6 +121,46 @@ static int __init integrator_init(void)
115 121
116arch_initcall(integrator_init); 122arch_initcall(integrator_init);
117 123
124/*
125 * On the Integrator platform, the port RTS and DTR are provided by
126 * bits in the following SC_CTRLS register bits:
127 * RTS DTR
128 * UART0 7 6
129 * UART1 5 4
130 */
131#define SC_CTRLC (IO_ADDRESS(INTEGRATOR_SC_BASE) + INTEGRATOR_SC_CTRLC_OFFSET)
132#define SC_CTRLS (IO_ADDRESS(INTEGRATOR_SC_BASE) + INTEGRATOR_SC_CTRLS_OFFSET)
133
134static void integrator_uart_set_mctrl(struct amba_device *dev, void __iomem *base, unsigned int mctrl)
135{
136 unsigned int ctrls = 0, ctrlc = 0, rts_mask, dtr_mask;
137
138 if (dev == &uart0_device) {
139 rts_mask = 1 << 4;
140 dtr_mask = 1 << 5;
141 } else {
142 rts_mask = 1 << 6;
143 dtr_mask = 1 << 7;
144 }
145
146 if (mctrl & TIOCM_RTS)
147 ctrlc |= rts_mask;
148 else
149 ctrls |= rts_mask;
150
151 if (mctrl & TIOCM_DTR)
152 ctrlc |= dtr_mask;
153 else
154 ctrls |= dtr_mask;
155
156 __raw_writel(ctrls, SC_CTRLS);
157 __raw_writel(ctrlc, SC_CTRLC);
158}
159
160static struct amba_pl010_data integrator_uart_data = {
161 .set_mctrl = integrator_uart_set_mctrl,
162};
163
118#define CM_CTRL IO_ADDRESS(INTEGRATOR_HDR_BASE) + INTEGRATOR_HDR_CTRL_OFFSET 164#define CM_CTRL IO_ADDRESS(INTEGRATOR_HDR_BASE) + INTEGRATOR_HDR_CTRL_OFFSET
119 165
120static DEFINE_SPINLOCK(cm_lock); 166static DEFINE_SPINLOCK(cm_lock);
diff --git a/arch/arm/mach-integrator/time.c b/arch/arm/mach-integrator/time.c
index 3c22c16b38bf..bc07f52a6fd7 100644
--- a/arch/arm/mach-integrator/time.c
+++ b/arch/arm/mach-integrator/time.c
@@ -40,13 +40,13 @@ static int integrator_set_rtc(void)
40 return 1; 40 return 1;
41} 41}
42 42
43static int rtc_read_alarm(struct rtc_wkalrm *alrm) 43static int integrator_rtc_read_alarm(struct rtc_wkalrm *alrm)
44{ 44{
45 rtc_time_to_tm(readl(rtc_base + RTC_MR), &alrm->time); 45 rtc_time_to_tm(readl(rtc_base + RTC_MR), &alrm->time);
46 return 0; 46 return 0;
47} 47}
48 48
49static inline int rtc_set_alarm(struct rtc_wkalrm *alrm) 49static inline int integrator_rtc_set_alarm(struct rtc_wkalrm *alrm)
50{ 50{
51 unsigned long time; 51 unsigned long time;
52 int ret; 52 int ret;
@@ -62,7 +62,7 @@ static inline int rtc_set_alarm(struct rtc_wkalrm *alrm)
62 return ret; 62 return ret;
63} 63}
64 64
65static int rtc_read_time(struct rtc_time *tm) 65static int integrator_rtc_read_time(struct rtc_time *tm)
66{ 66{
67 rtc_time_to_tm(readl(rtc_base + RTC_DR), tm); 67 rtc_time_to_tm(readl(rtc_base + RTC_DR), tm);
68 return 0; 68 return 0;
@@ -76,7 +76,7 @@ static int rtc_read_time(struct rtc_time *tm)
76 * edge of the 1Hz clock, we must write the time one second 76 * edge of the 1Hz clock, we must write the time one second
77 * in advance. 77 * in advance.
78 */ 78 */
79static inline int rtc_set_time(struct rtc_time *tm) 79static inline int integrator_rtc_set_time(struct rtc_time *tm)
80{ 80{
81 unsigned long time; 81 unsigned long time;
82 int ret; 82 int ret;
@@ -90,10 +90,10 @@ static inline int rtc_set_time(struct rtc_time *tm)
90 90
91static struct rtc_ops rtc_ops = { 91static struct rtc_ops rtc_ops = {
92 .owner = THIS_MODULE, 92 .owner = THIS_MODULE,
93 .read_time = rtc_read_time, 93 .read_time = integrator_rtc_read_time,
94 .set_time = rtc_set_time, 94 .set_time = integrator_rtc_set_time,
95 .read_alarm = rtc_read_alarm, 95 .read_alarm = integrator_rtc_read_alarm,
96 .set_alarm = rtc_set_alarm, 96 .set_alarm = integrator_rtc_set_alarm,
97}; 97};
98 98
99static irqreturn_t arm_rtc_interrupt(int irq, void *dev_id, 99static irqreturn_t arm_rtc_interrupt(int irq, void *dev_id,
diff --git a/arch/arm/mach-omap1/board-netstar.c b/arch/arm/mach-omap1/board-netstar.c
index 60d5f8a3339c..7520e602d7a2 100644
--- a/arch/arm/mach-omap1/board-netstar.c
+++ b/arch/arm/mach-omap1/board-netstar.c
@@ -141,7 +141,7 @@ static int __init netstar_late_init(void)
141 /* TODO: Setup front panel switch here */ 141 /* TODO: Setup front panel switch here */
142 142
143 /* Setup panic notifier */ 143 /* Setup panic notifier */
144 notifier_chain_register(&panic_notifier_list, &panic_block); 144 atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
145 145
146 return 0; 146 return 0;
147} 147}
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index bfd5fdd1a875..52e4a9d69642 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -235,7 +235,7 @@ static struct notifier_block panic_block = {
235static int __init voiceblue_setup(void) 235static int __init voiceblue_setup(void)
236{ 236{
237 /* Setup panic notifier */ 237 /* Setup panic notifier */
238 notifier_chain_register(&panic_notifier_list, &panic_block); 238 atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
239 239
240 return 0; 240 return 0;
241} 241}
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 68923b1d2b62..d6d726036361 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -141,6 +141,8 @@ struct corgissp_machinfo corgi_ssp_machinfo = {
141 */ 141 */
142static struct corgibl_machinfo corgi_bl_machinfo = { 142static struct corgibl_machinfo corgi_bl_machinfo = {
143 .max_intensity = 0x2f, 143 .max_intensity = 0x2f,
144 .default_intensity = 0x1f,
145 .limit_mask = 0x0b,
144 .set_bl_intensity = corgi_bl_set_intensity, 146 .set_bl_intensity = corgi_bl_set_intensity,
145}; 147};
146 148
@@ -164,6 +166,14 @@ static struct platform_device corgikbd_device = {
164 166
165 167
166/* 168/*
169 * Corgi LEDs
170 */
171static struct platform_device corgiled_device = {
172 .name = "corgi-led",
173 .id = -1,
174};
175
176/*
167 * Corgi Touch Screen Device 177 * Corgi Touch Screen Device
168 */ 178 */
169static struct resource corgits_resources[] = { 179static struct resource corgits_resources[] = {
@@ -297,6 +307,7 @@ static struct platform_device *devices[] __initdata = {
297 &corgikbd_device, 307 &corgikbd_device,
298 &corgibl_device, 308 &corgibl_device,
299 &corgits_device, 309 &corgits_device,
310 &corgiled_device,
300}; 311};
301 312
302static void __init corgi_init(void) 313static void __init corgi_init(void)
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 9b48a90aefce..5efa84749f37 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -319,6 +319,11 @@ void __init pxa_set_ficp_info(struct pxaficp_platform_data *info)
319 pxaficp_device.dev.platform_data = info; 319 pxaficp_device.dev.platform_data = info;
320} 320}
321 321
322static struct platform_device pxartc_device = {
323 .name = "sa1100-rtc",
324 .id = -1,
325};
326
322static struct platform_device *devices[] __initdata = { 327static struct platform_device *devices[] __initdata = {
323 &pxamci_device, 328 &pxamci_device,
324 &udc_device, 329 &udc_device,
@@ -329,6 +334,7 @@ static struct platform_device *devices[] __initdata = {
329 &pxaficp_device, 334 &pxaficp_device,
330 &i2c_device, 335 &i2c_device,
331 &i2s_device, 336 &i2s_device,
337 &pxartc_device,
332}; 338};
333 339
334static int __init pxa_init(void) 340static int __init pxa_init(void)
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 0dbb079ecd25..19b372df544a 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -220,6 +220,8 @@ struct corgissp_machinfo spitz_ssp_machinfo = {
220 * Spitz Backlight Device 220 * Spitz Backlight Device
221 */ 221 */
222static struct corgibl_machinfo spitz_bl_machinfo = { 222static struct corgibl_machinfo spitz_bl_machinfo = {
223 .default_intensity = 0x1f,
224 .limit_mask = 0x0b,
223 .max_intensity = 0x2f, 225 .max_intensity = 0x2f,
224}; 226};
225 227
@@ -242,6 +244,14 @@ static struct platform_device spitzkbd_device = {
242 244
243 245
244/* 246/*
247 * Spitz LEDs
248 */
249static struct platform_device spitzled_device = {
250 .name = "spitz-led",
251 .id = -1,
252};
253
254/*
245 * Spitz Touch Screen Device 255 * Spitz Touch Screen Device
246 */ 256 */
247static struct resource spitzts_resources[] = { 257static struct resource spitzts_resources[] = {
@@ -418,6 +428,7 @@ static struct platform_device *devices[] __initdata = {
418 &spitzkbd_device, 428 &spitzkbd_device,
419 &spitzts_device, 429 &spitzts_device,
420 &spitzbl_device, 430 &spitzbl_device,
431 &spitzled_device,
421}; 432};
422 433
423static void __init common_init(void) 434static void __init common_init(void)
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 66ec71756d0f..76c0e7f0a219 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -251,10 +251,19 @@ static struct platform_device tosakbd_device = {
251 .id = -1, 251 .id = -1,
252}; 252};
253 253
254/*
255 * Tosa LEDs
256 */
257static struct platform_device tosaled_device = {
258 .name = "tosa-led",
259 .id = -1,
260};
261
254static struct platform_device *devices[] __initdata = { 262static struct platform_device *devices[] __initdata = {
255 &tosascoop_device, 263 &tosascoop_device,
256 &tosascoop_jc_device, 264 &tosascoop_jc_device,
257 &tosakbd_device, 265 &tosakbd_device,
266 &tosaled_device,
258}; 267};
259 268
260static void __init tosa_init(void) 269static void __init tosa_init(void)
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 2abdc419e984..9ea71551fc04 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -324,6 +324,11 @@ void sa11x0_set_irda_data(struct irda_platform_data *irda)
324 sa11x0ir_device.dev.platform_data = irda; 324 sa11x0ir_device.dev.platform_data = irda;
325} 325}
326 326
327static struct platform_device sa11x0rtc_device = {
328 .name = "sa1100-rtc",
329 .id = -1,
330};
331
327static struct platform_device *sa11x0_devices[] __initdata = { 332static struct platform_device *sa11x0_devices[] __initdata = {
328 &sa11x0udc_device, 333 &sa11x0udc_device,
329 &sa11x0uart1_device, 334 &sa11x0uart1_device,
@@ -333,6 +338,7 @@ static struct platform_device *sa11x0_devices[] __initdata = {
333 &sa11x0pcmcia_device, 338 &sa11x0pcmcia_device,
334 &sa11x0fb_device, 339 &sa11x0fb_device,
335 &sa11x0mtd_device, 340 &sa11x0mtd_device,
341 &sa11x0rtc_device,
336}; 342};
337 343
338static int __init sa1100_init(void) 344static int __init sa1100_init(void)