From patchwork Thu May 23 08:38:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 2606141 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 0844E40077 for ; Thu, 23 May 2013 10:34:31 +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 1UfR6K-00070v-Ae; Thu, 23 May 2013 08:42:24 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UfR4D-0004qK-TC; Thu, 23 May 2013 08:40:09 +0000 Received: from mail-la0-x22a.google.com ([2a00:1450:4010:c03::22a]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UfR3u-0004n4-MV for linux-arm-kernel@lists.infradead.org; Thu, 23 May 2013 08:39:52 +0000 Received: by mail-la0-f42.google.com with SMTP id fg20so2960457lab.1 for ; Thu, 23 May 2013 01:39:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=KLwiaq2Pv0Em1Vka+1Nusq+rKPhrMl5sPbW5XySi1pk=; b=P3gV6AH2pfJEAswKRO77SrBR1Meiyb8MfqzALr1tN6J8ZxDxldiu1/NWLV0nGOb3Fs 7fpIKWgDgTgdz/eYT7wWLraGDcOz/4eE9IN2Ajc+llyICz2+t7q9UfxO589BBh4RYAwr ZtDpxoznWchSd/E6ckvgI5R6S3LMBqEQ+46QHxAoV5LlRqd6Ks/VILTSRdbIICt/gMcj eMJILUhzFwlMQPcbfUx8/AM6khntbd7hT39pnUec0WyCFxyREECSyPGiNoU52ryfYIJf j3L7gz8L6ClwRLeMHJEinGWDz34kQtLU1g1MwgvQu3PVs7GkZr6vTRLU+Gf4XCARaLTE 9rpA== X-Received: by 10.112.131.232 with SMTP id op8mr5826698lbb.2.1369298368640; Thu, 23 May 2013 01:39:28 -0700 (PDT) Received: from omicron.terra (s83-180-236-44.cust.tele2.se. [83.180.236.44]) by mx.google.com with ESMTPSA id y7sm4391939lad.5.2013.05.23.01.39.25 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 23 May 2013 01:39:26 -0700 (PDT) Received: from johan by omicron.terra with local (Exim 4.80.1) (envelope-from ) id 1UfR3R-0006Pp-2Q; Thu, 23 May 2013 10:39:21 +0200 From: Johan Hovold To: Nicolas Ferre Subject: [PATCH v3 2/5] rtc-at91rm9200: add configuration support Date: Thu, 23 May 2013 10:38:52 +0200 Message-Id: <1369298335-24597-3-git-send-email-jhovold@gmail.com> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1369298335-24597-1-git-send-email-jhovold@gmail.com> References: <1364983415-20298-1-git-send-email-jhovold@gmail.com> <1369298335-24597-1-git-send-email-jhovold@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130523_043950_915171_17E54DDE X-CRM114-Status: GOOD ( 15.49 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (jhovold[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Johan Hovold , Douglas Gilbert , linux-kernel@vger.kernel.org, Ludovic Desroches , Robert Nelson , Jean-Christophe PLAGNIOL-VILLARD , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add configuration support which can be used to implement SoC-specific workarounds for broken hardware. Signed-off-by: Johan Hovold --- drivers/rtc/rtc-at91rm9200.c | 46 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c index eeeb73f..ab2024b 100644 --- a/drivers/rtc/rtc-at91rm9200.c +++ b/drivers/rtc/rtc-at91rm9200.c @@ -42,6 +42,10 @@ #define AT91_RTC_EPOCH 1900UL /* just like arch/arm/common/rtctime.c */ +struct at91_rtc_config { +}; + +static const struct at91_rtc_config *at91_rtc_config; static DECLARE_COMPLETION(at91_rtc_updated); static unsigned int at91_alarm_year = AT91_RTC_EPOCH; static void __iomem *at91_rtc_regs; @@ -250,6 +254,36 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *dev_id) return IRQ_NONE; /* not handled */ } +static const struct at91_rtc_config at91rm9200_config = { +}; + +#ifdef CONFIG_OF +static const struct of_device_id at91_rtc_dt_ids[] = { + { + .compatible = "atmel,at91rm9200-rtc", + .data = &at91rm9200_config, + }, { + /* sentinel */ + } +}; +MODULE_DEVICE_TABLE(of, at91_rtc_dt_ids); +#endif + +static const struct at91_rtc_config * +at91_rtc_get_config(struct platform_device *pdev) +{ + const struct of_device_id *match; + + if (pdev->dev.of_node) { + match = of_match_node(at91_rtc_dt_ids, pdev->dev.of_node); + if (!match) + return NULL; + return (const struct at91_rtc_config *)match->data; + } + + return &at91rm9200_config; +} + static const struct rtc_class_ops at91_rtc_ops = { .read_time = at91_rtc_readtime, .set_time = at91_rtc_settime, @@ -268,6 +302,10 @@ static int __init at91_rtc_probe(struct platform_device *pdev) struct resource *regs; int ret = 0; + at91_rtc_config = at91_rtc_get_config(pdev); + if (!at91_rtc_config) + return -ENODEV; + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!regs) { dev_err(&pdev->dev, "no mmio resource defined\n"); @@ -383,14 +421,6 @@ static int at91_rtc_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(at91_rtc_pm_ops, at91_rtc_suspend, at91_rtc_resume); -#ifdef CONFIG_OF -static const struct of_device_id at91_rtc_dt_ids[] = { - { .compatible = "atmel,at91rm9200-rtc" }, - { /* sentinel */ } -}; -MODULE_DEVICE_TABLE(of, at91_rtc_dt_ids); -#endif - static struct platform_driver at91_rtc_driver = { .remove = __exit_p(at91_rtc_remove), .driver = {