From patchwork Wed Nov 4 15:49:44 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 37593 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-yx0-f158.google.com (mail-yx0-f158.google.com [209.85.210.158]) by ozlabs.org (Postfix) with ESMTP id 4B3BCB7BA8 for ; Thu, 5 Nov 2009 02:50:02 +1100 (EST) Received: by yxe30 with SMTP id 30so11601079yxe.29 for ; Wed, 04 Nov 2009 07:50:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:received:x-sender:x-apparently-to :received:received:received:received-spf:received:dkim-signature :domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:reply-to:sender:precedence:x-google-loop :mailing-list:list-id:list-post:list-help:list-unsubscribe :x-beenthere-env:x-beenthere; bh=MerEWG9gkoE8uEjDlz/Mv6C62MM5jgn+KOG5Dt1ENjA=; b=aifWsEqZ8aZrut9K/RZBayUEMPOCKB2xSynIHUZoQz5oGYcWxgVwN2cHCXQcmrbTI5 TRskgj0dQJQe4eRqJKa1VAdeCsk8C35/KATTrHgy3bqspXKC+xt3pVkA1cy/IktrX8a7 W2tMQOPsTld9StduZkfG/u00O4KGaWuYoqTyI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-sender:x-apparently-to:received-spf:authentication-results :dkim-signature:domainkey-signature:from:to:cc:subject:date :message-id:x-mailer:reply-to:sender:precedence:x-google-loop :mailing-list:list-id:list-post:list-help:list-unsubscribe :x-beenthere-env:x-beenthere; b=s5O2TjX7wB04slBz39mjU0YKh+QoNpq5RyKzLhMF1KEuwfZfOzbSxPVxYJHe0FwHjp 9qEqj3cDTDkSK5PTrXpYJE0a5aoTLoON7WZYckB2FzpdE2YYWod50FhJrfaNaU0X8oTZ /wKLY28m5MFWBohy+gimbyHLu5Cb3A9LFZwLU= Received: by 10.150.17.1 with SMTP id 1mr30050ybq.44.1257349798859; Wed, 04 Nov 2009 07:49:58 -0800 (PST) Received: by 10.176.133.2 with SMTP id g2gr3013yqd.0; Wed, 04 Nov 2009 07:49:58 -0800 (PST) X-Sender: wuzhangjin@gmail.com X-Apparently-To: rtc-linux@googlegroups.com Received: by 10.213.57.197 with SMTP id d5mr189665ebh.4.1257349797864; Wed, 04 Nov 2009 07:49:57 -0800 (PST) Received: by 10.213.57.197 with SMTP id d5mr189664ebh.4.1257349797834; Wed, 04 Nov 2009 07:49:57 -0800 (PST) Received: from mail-ew0-f216.google.com (mail-ew0-f216.google.com [209.85.219.216]) by gmr-mx.google.com with ESMTP id 13si1968314ewy.2.2009.11.04.07.49.56; Wed, 04 Nov 2009 07:49:56 -0800 (PST) Received-SPF: pass (google.com: domain of wuzhangjin@gmail.com designates 209.85.219.216 as permitted sender) client-ip=209.85.219.216; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of wuzhangjin@gmail.com designates 209.85.219.216 as permitted sender) smtp.mail=wuzhangjin@gmail.com; dkim=pass (test mode) header.i=@gmail.com Received: by mail-ew0-f216.google.com with SMTP id 12so1842396ewy.24 for ; Wed, 04 Nov 2009 07:49:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=pXg76eGKgVLobzobc1iTlMyzb4x1a8DF/jeBTMBXkbY=; b=NBkyM2dizG2BDe6dGW3Syh5exJfOSQyhloaThkpKkmxiKexsnYxmbwzEK+qHVzfQU8 LNeye/Wpiq+Rp+z7leG5ltK2P2hQZCzewkOtB4TYbj6rhpNVItG9XFyo+5Pzbzj7MGrX /u4V4uSAr21NXFD6Wdq+qP3LvRYjj8llh9OiY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=QfFI5voY8/lL2vZ/6p8QLF/mrbpBLPUrrjmsXRfh3a59FMJnZkn+Z2LP3q5FQWlT2/ gJO9ZhMqAVGN0l1GrnQKloG8q5EQLjwICxmamXlDd2Jt2YMK/OecfVReqskqJsxFcWKK /Yeo0sbAwVs1LY5QfcQ6X0++TNaKann3HUxMI= Received: by 10.216.86.142 with SMTP id w14mr495451wee.74.1257349796606; Wed, 04 Nov 2009 07:49:56 -0800 (PST) Received: from localhost.localdomain ([222.92.8.142]) by mx.google.com with ESMTPS id x6sm3550035gvf.1.2009.11.04.07.49.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 04 Nov 2009 07:49:55 -0800 (PST) From: Wu Zhangjin To: Ralf Baechle Cc: Arnaud Patard , Wu Zhangjin , linux-mips@linux-mips.org, rtc-linux@googlegroups.com Subject: [rtc-linux] [PATCH 2/2] [loongson] fuloong: add RTC_LIB Support Date: Wed, 4 Nov 2009 23:49:44 +0800 Message-Id: <1257349784-21444-1-git-send-email-wuzhangjin@gmail.com> X-Mailer: git-send-email 1.6.2.1 Reply-To: rtc-linux@googlegroups.com Sender: rtc-linux@googlegroups.com Precedence: bulk X-Google-Loop: groups Mailing-List: list rtc-linux@googlegroups.com; contact rtc-linux+owner@googlegroups.com List-Id: List-Post: List-Help: List-Unsubscribe: , X-BeenThere-Env: rtc-linux@googlegroups.com X-BeenThere: rtc-linux@googlegroups.com 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 --- 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 + * Copyright (C) 2009 Wu Zhangjin + * + * 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 +#include +#include +#include + +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);