From patchwork Thu Nov 5 01:24:10 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 37716 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-pz0-f142.google.com (mail-pz0-f142.google.com [209.85.222.142]) by ozlabs.org (Postfix) with ESMTP id 0BC07B7BB3 for ; Thu, 5 Nov 2009 12:24:26 +1100 (EST) Received: by pzk6 with SMTP id 6so1349303pzk.29 for ; Wed, 04 Nov 2009 17:24:25 -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:in-reply-to:references:reply-to:sender :precedence:x-google-loop:mailing-list:list-id:list-post:list-help :list-unsubscribe:x-beenthere-env:x-beenthere; bh=DG3Dof0SPyTjXrcC+EW3Z+7HjCpex9bJ+awqxyy0+P8=; b=m/y235ntFpqHrmr7HtUODAQsZijQd+EZv8Di5YUV0aLWNDsSGNGc2ftPGKKST6124U lpZrJYbU2qcTHUg7x4jc0a/5veGNJdnBht+IlX97gDorp8f7B3j2DlgpYc8Ts/ZHvQWt uPR8YvpDvqFpo91CHOFwEvtn8poee1C7fXtvw= 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:in-reply-to:references:reply-to:sender :precedence:x-google-loop:mailing-list:list-id:list-post:list-help :list-unsubscribe:x-beenthere-env:x-beenthere; b=C6fw7JIMBsUFB4CZ1bnZytEaTCVL6UtYYnXiBRpkKCrUEG7RxA/zkmMOLkEP+ZQofC fNkPp9deoTyxATHlXlfBi5AHleIdaqXW/swYD+thul+G23pCxBr+OeS7+BLppfaw9/uc yOoi3AwRYYihhM8x04S/dEBB+4J9SKrEjqJCI= Received: by 10.114.4.31 with SMTP id 31mr37044wad.25.1257384264238; Wed, 04 Nov 2009 17:24:24 -0800 (PST) Received: by 10.106.225.38 with SMTP id x38gr3026prg.0; Wed, 04 Nov 2009 17:24:24 -0800 (PST) X-Sender: wuzhangjin@gmail.com X-Apparently-To: rtc-linux@googlegroups.com Received: by 10.140.148.15 with SMTP id v15mr288980rvd.1.1257384263112; Wed, 04 Nov 2009 17:24:23 -0800 (PST) Received: by 10.140.148.15 with SMTP id v15mr288979rvd.1.1257384263093; Wed, 04 Nov 2009 17:24:23 -0800 (PST) Received: from mail-pw0-f47.google.com (mail-pw0-f47.google.com [209.85.160.47]) by gmr-mx.google.com with ESMTP id 10si335607pxi.6.2009.11.04.17.24.22; Wed, 04 Nov 2009 17:24:22 -0800 (PST) Received-SPF: pass (google.com: domain of wuzhangjin@gmail.com designates 209.85.160.47 as permitted sender) client-ip=209.85.160.47; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of wuzhangjin@gmail.com designates 209.85.160.47 as permitted sender) smtp.mail=wuzhangjin@gmail.com; dkim=pass (test mode) header.i=@gmail.com Received: by pwj10 with SMTP id 10so4307291pwj.6 for ; Wed, 04 Nov 2009 17:24:22 -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:in-reply-to:references; bh=2on5FOJXrA9KtJSD8vnSTyMwTNogkrYX6cvxtxNM7HM=; b=tLGadlXgxRvYF76J7TIiZj2JGZQUj/EQ8zETB9kDBYhH1qJQjErUBfSJ6VAyGPaeDo fnSpHq/xSC7PHRNlUFLyMLs7AbgWEJ9X+3DWYfNkEJfzX1POddvUB1tP9sWfjrn3cSey 7NpiMj3z+90vsDmuV63H91/6eLKh7hE4wPk3Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=l3PF5DlqtudQ9IM79d8fI+Lx1HkML2t89cDsjw+JVFh/+MTwMugzFVDna9GDDY8UzJ gcvrLcylSshJpbuEO3oDGdQcCQjlupDzlFNd+iMFiJbLt99lemupPZZjta8hqsg7daQF T5Uoz5YH5vNUnxaE30PSqU+TLBR5Ghb4A9SrU= Received: by 10.114.7.39 with SMTP id 39mr3497440wag.188.1257384261352; Wed, 04 Nov 2009 17:24:21 -0800 (PST) Received: from localhost.localdomain ([222.92.8.142]) by mx.google.com with ESMTPS id 23sm913705pzk.0.2009.11.04.17.24.16 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 04 Nov 2009 17:24:20 -0800 (PST) From: Wu Zhangjin To: Ralf Baechle , Arnaud Patard Cc: linux-mips@linux-mips.org, rtc-linux@googlegroups.com, Paul Gortmaker , Alessandro Zummo , Wu Zhangjin Subject: [rtc-linux] [PATCH v1 3/3] [loongson] RTC: Registration of Loongson RTC platform device Date: Thu, 5 Nov 2009 09:24:10 +0800 Message-Id: X-Mailer: git-send-email 1.6.2.1 In-Reply-To: References: 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 installed, ignore the above user-space configuration. Signed-off-by: Wu Zhangjin --- arch/mips/loongson/common/Makefile | 6 +++++ arch/mips/loongson/common/rtc.c | 43 ++++++++++++++++++++++++++++++++++++ 2 files changed, 49 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 d21d116..d1bd38c 100644 --- a/arch/mips/loongson/common/Makefile +++ b/arch/mips/loongson/common/Makefile @@ -10,3 +10,9 @@ obj-y += setup.o init.o cmdline.o env.o time.o reset.o irq.o \ # obj-$(CONFIG_EARLY_PRINTK) += early_printk.o obj-$(CONFIG_SERIAL_8250) += serial.o + +# 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..1f88791 --- /dev/null +++ b/arch/mips/loongson/common/rtc.c @@ -0,0 +1,43 @@ +/* + * Registration of Loongson 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) +{ + return platform_device_register(&rtc_cmos_device); +} + +device_initcall(rtc_cmos_init);