From patchwork Sun Feb 5 18:24:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Christophe PLAGNIOL-VILLARD X-Patchwork-Id: 139656 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-wi0-f184.google.com (mail-wi0-f184.google.com [209.85.212.184]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id EF665B7234 for ; Mon, 6 Feb 2012 05:28:59 +1100 (EST) Received: by wibhm2 with SMTP id hm2sf10152089wib.11 for ; Sun, 05 Feb 2012 10:28:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=mime-version:x-beenthere:received-spf:from:to:cc:x-ovh-mailout :subject:date:message-id:x-mailer:x-ovh-tracer-id:x-ovh-remote :x-ovh-local:x-ovh-spamstate:x-ovh-spamscore:x-ovh-spamcause :x-spam-check:x-vr-spamstate:x-vr-spamscore:x-vr-spamcause :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:x-google-group-id:list-post :list-help:list-archive:sender:list-subscribe:list-unsubscribe :content-type; bh=nso9/OFFzM4rTafNxB02Ie3pZ3MrakVeVHYXH+Vnnl8=; b=R8WFFY6dYdDqbaqrH7W7HyoKASImrVGIhRIdEQZ/uQofNmr3MTPHOi8P8xR9X8BPxP x7uNZfT7alqrlrZEjub47d1RuDxbi9UjdxCWoGWnWP93sByIJ7CDtGGrGOWCSF0d0LQM mcZ6AhbzhjuTisNW0FjThcJBH4vLCRO6ytYfY= Received: by 10.180.97.41 with SMTP id dx9mr2984172wib.0.1328466535067; Sun, 05 Feb 2012 10:28:55 -0800 (PST) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.216.150.147 with SMTP id z19ls20499185wej.0.gmail; Sun, 05 Feb 2012 10:28:54 -0800 (PST) Received: by 10.180.103.104 with SMTP id fv8mr1755039wib.0.1328466534372; Sun, 05 Feb 2012 10:28:54 -0800 (PST) Received: by 10.180.103.104 with SMTP id fv8mr1755038wib.0.1328466534362; Sun, 05 Feb 2012 10:28:54 -0800 (PST) Received: from mo3.mail-out.ovh.net (15.mo3.mail-out.ovh.net. [87.98.150.177]) by gmr-mx.google.com with ESMTP id u8si1772827wiy.3.2012.02.05.10.28.53; Sun, 05 Feb 2012 10:28:53 -0800 (PST) Received-SPF: pass (google.com: domain of plagnioj@jcrosoft.com designates 87.98.150.177 as permitted sender) client-ip=87.98.150.177; Received: from mail617.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo3.mail-out.ovh.net (Postfix) with SMTP id 03DF4FFCA73 for ; Sun, 5 Feb 2012 19:31:04 +0100 (CET) Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 5 Feb 2012 20:28:53 +0200 Received: from ns32433.ovh.net (HELO localhost) (plagnioj%jcrosoft.com@213.251.161.87) by ns0.ovh.net with SMTP; 5 Feb 2012 20:28:51 +0200 From: Jean-Christophe PLAGNIOL-VILLARD To: rtc-linux@googlegroups.com Cc: Jean-Christophe PLAGNIOL-VILLARD X-Ovh-Mailout: 178.32.228.3 (mo3.mail-out.ovh.net) Subject: [rtc-linux] [PATCH v2] rtc/at91sam9: use ioremap and iounmap Date: Sun, 5 Feb 2012 19:24:10 +0100 Message-Id: <1328466250-28413-1-git-send-email-plagnioj@jcrosoft.com> X-Mailer: git-send-email 1.7.2.3 X-Ovh-Tracer-Id: 14583500018399816625 X-Ovh-Remote: 213.251.161.87 (ns32433.ovh.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-OVH-SPAMSTATE: OK X-OVH-SPAMSCORE: 0 X-OVH-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeegtddrgedtucetggdotefuucfrrhhofhhilhgvmecuqfggjfenuceurghilhhouhhtmecufedttdenucenucfhrhhomheplfgvrghnqdevhhhrihhsthhophhhvgcurffntefipffkqffnqdggkffnnfettfffuceophhlrghgnhhiohhjsehjtghrohhsohhfthdrtghomheqnecujfgurhephffvufffkffosedttdertdertddt X-Spam-Check: DONE|U 0.5/N X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeegtddrgedtucetggdotefuucfrrhhofhhilhgvmecuqfggjfenuceurghilhhouhhtmecufedttdenucenucfhrhhomheplfgvrghnqdevhhhrihhsthhophhhvgcurffntefipffkqffnqdggkffnnfettfffuceophhlrghgnhhiohhjsehjtghrohhsohhfthdrtghomheqnecujfgurhephffvufffkffosedttdertdertddt X-Original-Sender: plagnioj@jcrosoft.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of plagnioj@jcrosoft.com designates 87.98.150.177 as permitted sender) smtp.mail=plagnioj@jcrosoft.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , this will allow to have multiple AT91 soc in the same kernel Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- Hi, I'll apply this via at91 tree as this is a patch a current work to drop at91_sys_read/write and alloc the at91 to have multiple AT91 soc in the same kernel Best Regards, J. drivers/rtc/rtc-at91sam9.c | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index a3ad957..ee3c122 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c @@ -307,8 +307,12 @@ static int __init at91_rtc_probe(struct platform_device *pdev) device_init_wakeup(&pdev->dev, 1); platform_set_drvdata(pdev, rtc); - rtc->rtt = (void __force __iomem *) (AT91_VA_BASE_SYS - AT91_BASE_SYS); - rtc->rtt += r->start; + rtc->rtt = ioremap(r->start, resource_size(r)); + if (!rtc->rtt) { + dev_err(&pdev->dev, "failed to map registers, aborting.\n"); + ret = -ENOMEM; + goto fail; + } mr = rtt_readl(rtc, MR); @@ -326,7 +330,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev) &at91_rtc_ops, THIS_MODULE); if (IS_ERR(rtc->rtcdev)) { ret = PTR_ERR(rtc->rtcdev); - goto fail; + goto fail_register; } /* register irq handler after we know what name we'll use */ @@ -351,6 +355,8 @@ static int __init at91_rtc_probe(struct platform_device *pdev) return 0; +fail_register: + iounmap(rtc->rtt); fail: platform_set_drvdata(pdev, NULL); kfree(rtc); @@ -371,6 +377,7 @@ static int __exit at91_rtc_remove(struct platform_device *pdev) rtc_device_unregister(rtc->rtcdev); + iounmap(rtc->rtt); platform_set_drvdata(pdev, NULL); kfree(rtc); return 0;