From patchwork Mon Jul 23 13:42:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Afzal Mohammed X-Patchwork-Id: 1228031 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by patchwork2.kernel.org (Postfix) with ESMTP id 15866E0079 for ; Mon, 23 Jul 2012 14:52:52 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id q6NElPfp017381; Mon, 23 Jul 2012 09:47:37 -0500 Received: from DLEE74.ent.ti.com (dlee74.ent.ti.com [157.170.170.8]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q6NElPjx014492; Mon, 23 Jul 2012 09:47:25 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DLEE74.ent.ti.com (157.170.170.8) with Microsoft SMTP Server id 14.1.323.3; Mon, 23 Jul 2012 09:47:24 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id q6NElOGQ013642; Mon, 23 Jul 2012 09:47:24 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id C1D3E8062B; Mon, 23 Jul 2012 09:47:24 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dbdp20.itg.ti.com (dbdp20.itg.ti.com [172.24.170.38]) by linux.omap.com (Postfix) with ESMTP id 2D15680626 for ; Mon, 23 Jul 2012 08:42:48 -0500 (CDT) Received: from DBDE71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id q6NDglk3005372; Mon, 23 Jul 2012 19:12:47 +0530 (IST) Received: from dbdp33.itg.ti.com (172.24.170.252) by DBDE71.ent.ti.com (172.24.170.149) with Microsoft SMTP Server id 14.1.323.3; Mon, 23 Jul 2012 19:12:46 +0530 Received: from udx0156546 (smtpvbd.itg.ti.com [172.24.170.250]) by dbdp33.itg.ti.com (8.13.8/8.13.8) with ESMTP id q6NDgbft029631; Mon, 23 Jul 2012 19:12:38 +0530 Received: from ubnuser by udx0156546 with local (Exim 4.72) (envelope-from ) id 1StIuC-0006eO-U2; Mon, 23 Jul 2012 19:12:36 +0530 From: Afzal Mohammed To: , , , , , , , , , , , , , Subject: [PATCH 3/6] rtc: omap: dt support Date: Mon, 23 Jul 2012 19:12:36 +0530 Message-ID: X-Mailer: git-send-email 1.7.1 In-Reply-To: References: MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 23 Jul 2012 09:46:16 -0500 CC: Afzal Mohammed X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com Enhance rtc-omap driver with DT capability Signed-off-by: Afzal Mohammed --- Documentation/devicetree/bindings/rtc/rtc-omap.txt | 20 ++++++++++++++++++++ drivers/rtc/rtc-omap.c | 18 ++++++++++++++++++ 2 files changed, 38 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/rtc/rtc-omap.txt diff --git a/Documentation/devicetree/bindings/rtc/rtc-omap.txt b/Documentation/devicetree/bindings/rtc/rtc-omap.txt new file mode 100644 index 0000000..858c4b0 --- /dev/null +++ b/Documentation/devicetree/bindings/rtc/rtc-omap.txt @@ -0,0 +1,20 @@ +TI Real Time Clock + +Required properties: +- compatible: "ti,am1808-rtc" +- reg: Address range of rtc register set +- interrupts: rtc timer, alarm interrupts in order +- interrupt-parent: phandle for the interrupt controller + +Alternative for reg and interrupt properties on OMAP: +- ti,hwmods: Name of the hwmod associated to the RTC + +Example: + +rtc@1c23000 { + compatible = "ti,am1808-rtc"; + reg = <0x23000 0x1000>; + interrupts = <19 + 19>; + interrupt-parent = <&intc>; +}; diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index 65eda29..f7cc4b0 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include @@ -308,12 +310,27 @@ static struct platform_device_id omap_rtc_devtype[] = { }; MODULE_DEVICE_TABLE(platform, omap_rtc_devtype); +#define OMAP_RTC_DATA_AM1808_IDX 1 + +static const struct of_device_id omap_rtc_of_match[] = { + { .compatible = "ti,am1808-rtc", + .data = &omap_rtc_devtype[OMAP_RTC_DATA_AM1808_IDX], + }, + {}, +}; +MODULE_DEVICE_TABLE(of, omap_rtc_of_match); + static int __init omap_rtc_probe(struct platform_device *pdev) { struct resource *res, *mem; struct rtc_device *rtc; u8 reg, new_ctrl; const struct platform_device_id *id_entry; + const struct of_device_id *of_id; + + of_id = of_match_device(omap_rtc_of_match, &pdev->dev); + if (of_id) + pdev->id_entry = of_id->data; omap_rtc_timer = platform_get_irq(pdev, 0); if (omap_rtc_timer <= 0) { @@ -509,6 +526,7 @@ static struct platform_driver omap_rtc_driver = { .driver = { .name = DRIVER_NAME, .owner = THIS_MODULE, + .of_match_table = of_match_ptr(omap_rtc_of_match), }, .id_table = omap_rtc_devtype, };