All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] [loongson] fuloong: add RTC_LIB Support
@ 2009-11-04 15:49 Wu Zhangjin
  2009-11-04 16:03 ` Arnaud Patard
  0 siblings, 1 reply; 3+ messages in thread
From: Wu Zhangjin @ 2009-11-04 15:49 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Arnaud Patard, Wu Zhangjin, linux-mips, rtc-linux

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.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 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

diff --git a/arch/mips/loongson/common/Makefile b/arch/mips/loongson/common/Makefile
index d3138b8..d2184c8 100644
--- a/arch/mips/loongson/common/Makefile
+++ b/arch/mips/loongson/common/Makefile
@@ -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
diff --git a/arch/mips/loongson/common/rtc.c b/arch/mips/loongson/common/rtc.c
new file mode 100644
index 0000000..fe9464a
--- /dev/null
+++ b/arch/mips/loongson/common/rtc.c
@@ -0,0 +1,45 @@
+/*
+ *  Registration of Cobalt RTC platform device.
+ *
+ *  Copyright (C) 2007  Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
+ *  Copyright (C) 2009  Wu Zhangjin <wuzj@lemote.com>
+ *
+ *  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.
+ */
+
+#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
+};
+
+static __init int rtc_cmos_init(void)
+{
+	platform_device_register(&rtc_cmos_device);
+
+	return 0;
+}
+
+device_initcall(rtc_cmos_init);
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] [loongson] fuloong: add RTC_LIB Support
  2009-11-04 15:49 [PATCH 2/2] [loongson] fuloong: add RTC_LIB Support Wu Zhangjin
@ 2009-11-04 16:03 ` Arnaud Patard
  2009-11-05  0:37   ` Wu Zhangjin
  0 siblings, 1 reply; 3+ messages in thread
From: Arnaud Patard @ 2009-11-04 16:03 UTC (permalink / raw)
  To: Wu Zhangjin; +Cc: Ralf Baechle, linux-mips, rtc-linux

Wu Zhangjin <wuzhangjin@gmail.com> writes:
Hi,

> + *  Registration of Cobalt RTC platform device.

Of Cobalt platform device ? I thought we were on loongson :)

> + *
> + *  Copyright (C) 2007  Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
> + *  Copyright (C) 2009  Wu Zhangjin <wuzj@lemote.com>
> + *
> + *  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.
> + */
> +
> +#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
> +};
> +
> +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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] [loongson] fuloong: add RTC_LIB Support
  2009-11-04 16:03 ` Arnaud Patard
@ 2009-11-05  0:37   ` Wu Zhangjin
  0 siblings, 0 replies; 3+ messages in thread
From: Wu Zhangjin @ 2009-11-05  0:37 UTC (permalink / raw)
  To: Arnaud Patard; +Cc: Ralf Baechle, linux-mips, rtc-linux

Hi,

On Wed, 2009-11-04 at 17:03 +0100, Arnaud Patard wrote:
> Wu Zhangjin <wuzhangjin@gmail.com> writes:
> Hi,
> 
> > + *  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.

> > + *
> > + *  Copyright (C) 2007  Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
> > + *  Copyright (C) 2009  Wu Zhangjin <wuzj@lemote.com>
> > + *
> > + *  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.
> > + */
> > +
> > +#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
> > +};
> > +
> > +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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-05  0:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-04 15:49 [PATCH 2/2] [loongson] fuloong: add RTC_LIB Support Wu Zhangjin
2009-11-04 16:03 ` Arnaud Patard
2009-11-05  0:37   ` Wu Zhangjin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.