fuloong: add RTC_LIB Support
PATCH 2/2 fuloong: add RTC_LIB Support
This patch add the RTC_LIB support for fuloong2e,fuloong2f.
To make hwclock work with it normally, please do:
kernel configuration:
Device Drivers --->
<*> Real Time Clock --->
<*> PC-style 'CMOS'
user-space configuration:
$ mknod /dev/rtc0 c 254 0
/dev/rtc0 is the default RTC device file.
of course, if udevd is installed, ignore the above user-space configuration.
--- arch/mips/loongson/common/Makefile | 7 +++++ arch/mips/loongson/common/rtc.c | 45 ++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 0 deletions(-) create mode 100644 arch/mips/loongson/common/rtc.c
arch/mips/loongson/common/Makefile +7 -0
@@ -16,3 +16,10 @@ obj-$(CONFIG_SERIAL_8250) += serial.o # space # obj-$(CONFIG_CS5536) += cs5536/ + +# +# Enable RTC Class support +# +# please enable CONFIG_RTC_DRV_CMOS +# +obj-$(CONFIG_RTC_DRV_CMOS) += rtc.o
arch/mips/loongson/common/rtc.c new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
1.6.2.1
Wu Zhangjin <[email protected]> writes:
Hi,
Quoted 1 line
+ * Registration of Cobalt RTC platform device.
Of Cobalt platform device ? I thought we were on loongson :)
Quoted 30 lines
+ *
+ * Copyright (C) 2007 Yoichi Yuasa <[email protected]> + * Copyright (C) 2009 Wu Zhangjin <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version.+ */
arch/mips/loongson/common/rtc.c new file +21
-0+ +#include <linux/init.h> +#include <linux/ioport.h> +#include <linux/mc146818rtc.h> +#include <linux/platform_device.h> + +static struct resource rtc_cmos_resource[] = { + { + .start =RTC_PORT (0 ), + .end =RTC_PORT (1 ), + .flags =IORESOURCE_IO , + }, + { + .start =RTC_IRQ , + .end =RTC_IRQ , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct platform_device rtc_cmos_device = { + .name ="rtc_cmos" ,
arch/mips/loongson/common/rtc.c line 42
Quoted 10 lines
arch/mips/loongson/common/rtc.c new file +10
-0+ .id = -1, + .num_resources = ARRAY_SIZE(rtc_cmos_resource), + .resource = rtc_cmos_resource +}; + +static __init int rtc_cmos_init (void ) +{ +platform_device_register (&rtc_cmos_device); + +return 0 ;
what about return platform_device_register(&rtc_cmos_device); ?
Arnaud
Hi,
Quoted 7 lines · Arnaud Patard
Wu Zhangjin <[email protected]> writes:
Hi,Quoted 1 line
+ * Registration of Cobalt RTC platform device.
Of Cobalt platform device ? I thought we were on loongson :)
Ooh, I just copied the header ;) will remove it later.
Quoted 34 lines
Quoted 34 lines
+ *
+ * Copyright (C) 2007 Yoichi Yuasa <[email protected]> + * Copyright (C) 2009 Wu Zhangjin <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version.+ */
arch/mips/loongson/common/rtc.c new file +25
-0+ +#include <linux/init.h> +#include <linux/ioport.h> +#include <linux/mc146818rtc.h> +#include <linux/platform_device.h> + +static struct resource rtc_cmos_resource[] = { + { + .start =RTC_PORT (0 ), + .end =RTC_PORT (1 ), + .flags =IORESOURCE_IO , + }, + { + .start =RTC_IRQ , + .end =RTC_IRQ , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct platform_device rtc_cmos_device = { + .name ="rtc_cmos" , + .id =-1 , + .num_resources =ARRAY_SIZE (rtc_cmos_resource), + .resource = rtc_cmos_resource +};
Quoted 10 lines
arch/mips/loongson/common/rtc.c line 42
Quoted 6 lines
arch/mips/loongson/common/rtc.c new file +6
-0+ +static __init int rtc_cmos_init (void ) +{ +platform_device_register (&rtc_cmos_device); + +return 0 ;what about return
platform_device_register(&rtc_cmos_device); ?
Okay, later.
Regards,
Wu Zhangjin