aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorTiejun Chen <tiejun.chen@windriver.com>2008-11-25 03:33:20 -0500
committerRalf Baechle <ralf@linux-mips.org>2008-12-04 12:47:27 -0500
commit192cc7f0900a088e464635a59a63d974ee7a3e97 (patch)
tree18b8c7f2104f18314e82f6cc186a7f68c7375bba /arch/mips
parente807f9574e37a3f202e677feaaad1b7c5d2c0db8 (diff)
MIPS: Malta: Add back RTC support
With the conversion of MIPS to RTC_LIB the old RTC driver CONFIG_RTC became unselectable. Fix by setting up a platform device. Also enable RTC_CLASS so system time gets set from RTC on kernel initialization. [Ralf: Original patch by Tiejun; polished nice and shiny by me] Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/configs/malta_defconfig39
-rw-r--r--arch/mips/mti-malta/malta-platform.c56
2 files changed, 84 insertions, 11 deletions
diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig
index 74daa0cf87e6..a69956573d17 100644
--- a/arch/mips/configs/malta_defconfig
+++ b/arch/mips/configs/malta_defconfig
@@ -1126,7 +1126,6 @@ CONFIG_LEGACY_PTY_COUNT=256
1126# CONFIG_IPMI_HANDLER is not set 1126# CONFIG_IPMI_HANDLER is not set
1127# CONFIG_WATCHDOG is not set 1127# CONFIG_WATCHDOG is not set
1128CONFIG_HW_RANDOM=m 1128CONFIG_HW_RANDOM=m
1129CONFIG_RTC=y
1130# CONFIG_R3964 is not set 1129# CONFIG_R3964 is not set
1131# CONFIG_APPLICOM is not set 1130# CONFIG_APPLICOM is not set
1132# CONFIG_DRM is not set 1131# CONFIG_DRM is not set
@@ -1199,7 +1198,43 @@ CONFIG_USB_ARCH_HAS_EHCI=y
1199# CONFIG_MMC is not set 1198# CONFIG_MMC is not set
1200# CONFIG_NEW_LEDS is not set 1199# CONFIG_NEW_LEDS is not set
1201# CONFIG_INFINIBAND is not set 1200# CONFIG_INFINIBAND is not set
1202# CONFIG_RTC_CLASS is not set 1201CONFIG_RTC_LIB=y
1202CONFIG_RTC_CLASS=y
1203CONFIG_RTC_HCTOSYS=y
1204CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
1205# CONFIG_RTC_DEBUG is not set
1206
1207#
1208# RTC interfaces
1209#
1210CONFIG_RTC_INTF_SYSFS=y
1211CONFIG_RTC_INTF_PROC=y
1212CONFIG_RTC_INTF_DEV=y
1213# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1214# CONFIG_RTC_DRV_TEST is not set
1215
1216#
1217# SPI RTC drivers
1218#
1219
1220#
1221# Platform RTC drivers
1222#
1223CONFIG_RTC_DRV_CMOS=y
1224# CONFIG_RTC_DRV_DS1286 is not set
1225# CONFIG_RTC_DRV_DS1511 is not set
1226# CONFIG_RTC_DRV_DS1553 is not set
1227# CONFIG_RTC_DRV_DS1742 is not set
1228# CONFIG_RTC_DRV_STK17TA8 is not set
1229# CONFIG_RTC_DRV_M48T86 is not set
1230# CONFIG_RTC_DRV_M48T35 is not set
1231# CONFIG_RTC_DRV_M48T59 is not set
1232# CONFIG_RTC_DRV_BQ4802 is not set
1233# CONFIG_RTC_DRV_V3020 is not set
1234
1235#
1236# on-CPU RTC drivers
1237#
1203 1238
1204# 1239#
1205# DMA Engine support 1240# DMA Engine support
diff --git a/arch/mips/mti-malta/malta-platform.c b/arch/mips/mti-malta/malta-platform.c
index 83b9bab3cd3f..6a476f7733b3 100644
--- a/arch/mips/mti-malta/malta-platform.c
+++ b/arch/mips/mti-malta/malta-platform.c
@@ -6,7 +6,10 @@
6 * Copyright (C) 2007 MIPS Technologies, Inc. 6 * Copyright (C) 2007 MIPS Technologies, Inc.
7 * written by Ralf Baechle (ralf@linux-mips.org) 7 * written by Ralf Baechle (ralf@linux-mips.org)
8 * 8 *
9 * Probe driver for the Malta's UART ports: 9 * Copyright (C) 2008 Wind River Systems, Inc.
10 * updated by Tiejun Chen <tiejun.chen@windriver.com>
11 *
12 * 1. Probe driver for the Malta's UART ports:
10 * 13 *
11 * o 2 ports in the SMC SuperIO 14 * o 2 ports in the SMC SuperIO
12 * o 1 port in the CBUS UART, a discrete 16550 which normally is only used 15 * o 1 port in the CBUS UART, a discrete 16550 which normally is only used
@@ -14,10 +17,14 @@
14 * 17 *
15 * We don't use 8250_platform.c on Malta as it would result in the CBUS 18 * We don't use 8250_platform.c on Malta as it would result in the CBUS
16 * UART becoming ttyS0. 19 * UART becoming ttyS0.
20 *
21 * 2. Register RTC-CMOS platform device on Malta.
17 */ 22 */
18#include <linux/module.h> 23#include <linux/module.h>
19#include <linux/init.h> 24#include <linux/init.h>
20#include <linux/serial_8250.h> 25#include <linux/serial_8250.h>
26#include <linux/mc146818rtc.h>
27#include <linux/platform_device.h>
21 28
22#define SMC_PORT(base, int) \ 29#define SMC_PORT(base, int) \
23{ \ 30{ \
@@ -45,7 +52,7 @@ static struct plat_serial8250_port uart8250_data[] = {
45 { }, 52 { },
46}; 53};
47 54
48static struct platform_device uart8250_device = { 55static struct platform_device malta_uart8250_device = {
49 .name = "serial8250", 56 .name = "serial8250",
50 .id = PLAT8250_DEV_PLATFORM2, 57 .id = PLAT8250_DEV_PLATFORM2,
51 .dev = { 58 .dev = {
@@ -53,13 +60,44 @@ static struct platform_device uart8250_device = {
53 }, 60 },
54}; 61};
55 62
56static int __init uart8250_init(void) 63struct resource malta_rtc_resources[] = {
64 {
65 .start = RTC_PORT(0),
66 .end = RTC_PORT(7),
67 .flags = IORESOURCE_IO,
68 }, {
69 .start = RTC_IRQ,
70 .end = RTC_IRQ,
71 .flags = IORESOURCE_IRQ,
72 }
73};
74
75static struct platform_device malta_rtc_device = {
76 .name = "rtc_cmos",
77 .id = -1,
78 .resource = malta_rtc_resources,
79 .num_resources = ARRAY_SIZE(malta_rtc_resources),
80};
81
82static struct platform_device *malta_devices[] __initdata = {
83 &malta_uart8250_device,
84 &malta_rtc_device,
85};
86
87static int __init malta_add_devices(void)
57{ 88{
58 return platform_device_register(&uart8250_device); 89 int err;
59}
60 90
61module_init(uart8250_init); 91 err = platform_add_devices(malta_devices, ARRAY_SIZE(malta_devices));
92 if (err)
93 return err;
94
95 /*
96 * Set RTC to BCD mode to support current alarm code.
97 */
98 CMOS_WRITE(CMOS_READ(RTC_CONTROL) & ~RTC_DM_BINARY, RTC_CONTROL);
99
100 return 0;
101}
62 102
63MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>"); 103device_initcall(malta_add_devices);
64MODULE_LICENSE("GPL");
65MODULE_DESCRIPTION("8250 UART probe driver for the Malta CBUS UART");