From patchwork Thu Apr 4 03:54:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Gilbert X-Patchwork-Id: 2390451 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id 237FA3FD8C for ; Thu, 4 Apr 2013 04:04:03 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UNbP6-0001Z5-6D for patchwork-linux-arm@patchwork.kernel.org; Thu, 04 Apr 2013 04:04:00 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UNbH0-0002k7-8o; Thu, 04 Apr 2013 03:55:38 +0000 Received: from smtp.infotech.no ([82.134.31.41]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UNbGw-0002jl-UE for linux-arm-kernel@lists.infradead.org; Thu, 04 Apr 2013 03:55:35 +0000 Received: from localhost (localhost [127.0.0.1]) by smtp.infotech.no (Postfix) with ESMTP id 651902041BB; Thu, 4 Apr 2013 05:55:31 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.6.6 (20110518) (Debian) at infotech.no Received: from smtp.infotech.no ([127.0.0.1]) by localhost (smtp.infotech.no [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id l8pIPUF1YSR0; Thu, 4 Apr 2013 05:55:29 +0200 (CEST) Received: from [192.168.48.66] (unknown [98.143.101.107]) by smtp.infotech.no (Postfix) with ESMTPA id 7C8FD2041B5; Thu, 4 Apr 2013 05:55:28 +0200 (CEST) Message-ID: <515CF985.6050009@interlog.com> Date: Wed, 03 Apr 2013 23:54:45 -0400 From: Douglas Gilbert User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] rtc: rtc-at91sam9.c add DT support X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130403_235535_163020_5CDDE1E9 X-CRM114-Status: GOOD ( 13.43 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Jean-Christophe PLAGNIOL-VILLARD , Johan Hovold , Nicolas Ferre , Robert Nelson X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: dgilbert@interlog.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Some members of the at91 SoCs use the Real Time Timer (RTT) and the General Purpose Backup Registers (GPBR) to implement a real time clock (RTC). The AT91SAM9G20 is one example. Attached is a patch to add DT support to rtc-at91sam9.c . The patch is against lk 3.9.0-rc5 . Below is a snippet of DT code for the 'G20 that was observed to work with this patch: ahb { apb { rtc { compatible = "atmel,at91sam9-rtc"; /* RTTC followed by GPBR (backup registers) */ reg = <0xfffffd20 0x10>, <0xfffffd50 0x10>; interrupts = <1 4 7>; status = "okay"; }; } }; Signed-off-by: Douglas Gilbert diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index 39cfd2e..69e9389 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include #include @@ -71,6 +73,17 @@ struct sam9_rtc { #define gpbr_writel(rtc, val) \ __raw_writel((val), (rtc)->gpbr) +#ifdef CONFIG_OF +static const struct of_device_id at91sam9_rtc_dt_ids[] = { + { .compatible = "atmel,at91sam9-rtc" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, at91sam9_rtc_dt_ids); +#else +#define at91sam9_rtc_dt_ids NULL +#endif /* CONFIG_OF */ + + /* * Read current time and date in RTC */ @@ -470,6 +483,7 @@ static struct platform_driver at91_rtc_driver = { .driver = { .name = "rtc-at91sam9", .owner = THIS_MODULE, + .of_match_table = of_match_ptr(at91sam9_rtc_dt_ids), }, };