From patchwork Fri May 24 09:59:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Torgue X-Patchwork-Id: 246120 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-fa0-x23b.google.com (mail-fa0-x23b.google.com [IPv6:2a00:1450:4001:c02::23b]) (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 7C2512C0174 for ; Fri, 24 May 2013 20:00:21 +1000 (EST) Received: by mail-fa0-f59.google.com with SMTP id a11sf519921fad.4 for ; Fri, 24 May 2013 03:00:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=mime-version:x-beenthere:from:to:cc:subject:date:message-id :x-mailer:in-reply-to:references: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=0CxzZotJ7uZ/5i0FSjxbnSyg2b+DBVoaP/s6RSvM2so=; b=IIWM+I5KwTDcCoCCMHLZ9Ll8/9AmocKw+ZPfv5JIu5X24/A0xmdE9Cl1XDgvhC7yLP B0PJwEGPTtKizC1MG7zMEJYxQ937EMaDtMsrGPvOC00xOho9QJeg2XR8KfSvCu8ukUZj QWL2xQB7Kl7uGDEvr0c6G8udIfZcJglodpWvYy11D2zy8RAboMkyliJ+yG9tQz30es+k RjsrXpl0gbD4J89zrHPlAySSbjaVZOmnappukvCOZszIvgu2OP7a1tb8ZpMiam2Pjtrv n73nCC4nj02pA0yEnug7tdsViLZTA2v+DtHYvCyXScbUe12qxcokzzNAE/H4nfDb5jZn +UDQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-beenthere:from:to:cc:subject:date:message-id :x-mailer:in-reply-to:references: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=0CxzZotJ7uZ/5i0FSjxbnSyg2b+DBVoaP/s6RSvM2so=; b=uJOxXvjI7vPjb4zrAnnwWRk/TL0cPDK9XDZF7fIN+Y47GWrRCp49LEzo5mvtofJlC2 OtHXheKhojSlCXnRhblvmRjtUX/NCqYuWHBey6sJ+JM2WvAH5VxDWwgj4JaPw7OBQKoM sF/ZWKouRp2dGPp190H7Vvr6vHX7TKGZwABTg60hkNKeonmsT8CYsVBN/ZJhoPjX7sby VJR1RA2L36ZjaMar/WqlzwmmYNK8GuMAMTlk1BDVMN38ksVot+kUu2EhNDauhaGmgTDk bD3hyvmTLmwdzdadZsVo2CxJdfwEUpb+eqEEitWNNBUGg2MnULvN7HI66Hu96d+M2DWG isBw== X-Received: by 10.180.88.232 with SMTP id bj8mr1447912wib.15.1369389616226; Fri, 24 May 2013 03:00:16 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.180.88.229 with SMTP id bj5ls169663wib.53.gmail; Fri, 24 May 2013 03:00:15 -0700 (PDT) X-Received: by 10.180.105.161 with SMTP id gn1mr7378386wib.6.1369389615259; Fri, 24 May 2013 03:00:15 -0700 (PDT) Received: from mail-wi0-x242.google.com (mail-wi0-x242.google.com [2a00:1450:400c:c05::242]) by gmr-mx.google.com with ESMTPS id q15si138540wij.0.2013.05.24.03.00.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 24 May 2013 03:00:15 -0700 (PDT) Received-SPF: pass (google.com: domain of alexandre.torgue.st@gmail.com designates 2a00:1450:400c:c05::242 as permitted sender) client-ip=2a00:1450:400c:c05::242; Received: by mail-wi0-f194.google.com with SMTP id hi5so885948wib.1 for ; Fri, 24 May 2013 03:00:15 -0700 (PDT) X-Received: by 10.180.160.167 with SMTP id xl7mr566101wib.62.1369389615176; Fri, 24 May 2013 03:00:15 -0700 (PDT) Received: from localhost.localdomain (LPuteaux-156-14-44-212.w82-127.abo.wanadoo.fr. [82.127.83.212]) by mx.google.com with ESMTPSA id w8sm3649513wiz.0.2013.05.24.03.00.13 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 24 May 2013 03:00:14 -0700 (PDT) From: Alexandre Torgue To: Alessandro Zummo , , Cc: Lee Jones , Samuel Ortiz , Alexandre Torgue , Julien Delacou Subject: [rtc-linux] [PATCH 1/2] mfd: ab8540: add device for new rtc version on ab8540 cut2 Date: Fri, 24 May 2013 11:59:47 +0200 Message-Id: <1369389588-27568-2-git-send-email-alexandre.torgue.st@gmail.com> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1369389588-27568-1-git-send-email-alexandre.torgue.st@gmail.com> References: <1369389588-27568-1-git-send-email-alexandre.torgue.st@gmail.com> X-Original-Sender: alexandre.torgue.st@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of alexandre.torgue.st@gmail.com designates 2a00:1450:400c:c05::242 as permitted sender) smtp.mail=alexandre.torgue.st@gmail.com; dkim=pass header.i=@gmail.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: , From: Alexandre Torgue AB8540 rtc have changed between AB8540_cut1 and AB8540_cut2.Different ressources to define for those two version. Signed-off-by: Julien Delacou Signed-off-by: Alexandre Torgue Acked-by: Lee Jones Acked-by: Linus Walleij diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index 42abd3a..6f22527 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c @@ -650,6 +650,21 @@ static struct resource ab8500_rtc_resources[] = { }, }; +static struct resource ab8540_rtc_resources[] = { + { + .name = "1S", + .start = AB8540_INT_RTC_1S, + .end = AB8540_INT_RTC_1S, + .flags = IORESOURCE_IRQ, + }, + { + .name = "ALARM", + .start = AB8500_INT_RTC_ALARM, + .end = AB8500_INT_RTC_ALARM, + .flags = IORESOURCE_IRQ, + }, +}; + static struct resource ab8500_poweronkey_db_resources[] = { { .name = "ONKEY_DBF", @@ -1284,11 +1299,6 @@ static struct mfd_cell ab8540_devs[] = { .resources = ab8505_gpadc_resources, }, { - .name = "ab8500-rtc", - .num_resources = ARRAY_SIZE(ab8500_rtc_resources), - .resources = ab8500_rtc_resources, - }, - { .name = "ab8500-acc-det", .num_resources = ARRAY_SIZE(ab8500_av_acc_detect_resources), .resources = ab8500_av_acc_detect_resources, @@ -1328,6 +1338,24 @@ static struct mfd_cell ab8540_devs[] = { }, }; +static struct mfd_cell ab8540_cut1_devs[] = { + { + .name = "ab8500-rtc", + .of_compatible = "stericsson,ab8500-rtc", + .num_resources = ARRAY_SIZE(ab8500_rtc_resources), + .resources = ab8500_rtc_resources, + }, +}; + +static struct mfd_cell ab8540_cut2_devs[] = { + { + .name = "ab8540-rtc", + .of_compatible = "stericsson,ab8540-rtc", + .num_resources = ARRAY_SIZE(ab8540_rtc_resources), + .resources = ab8540_rtc_resources, + }, +}; + static ssize_t show_chip_id(struct device *dev, struct device_attribute *attr, char *buf) { @@ -1731,11 +1759,22 @@ static int ab8500_probe(struct platform_device *pdev) ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs, ARRAY_SIZE(ab9540_devs), NULL, ab8500->irq_base, ab8500->domain); - else if (is_ab8540(ab8500)) + else if (is_ab8540(ab8500)) { ret = mfd_add_devices(ab8500->dev, 0, ab8540_devs, ARRAY_SIZE(ab8540_devs), NULL, - ab8500->irq_base, ab8500->domain); - else if (is_ab8505(ab8500)) + ab8500->irq_base, NULL); + if (ret) + return ret; + + if (is_ab8540_1p2_or_earlier(ab8500)) + ret = mfd_add_devices(ab8500->dev, 0, ab8540_cut1_devs, + ARRAY_SIZE(ab8540_cut1_devs), NULL, + ab8500->irq_base, NULL); + else /* ab8540 >= cut2 */ + ret = mfd_add_devices(ab8500->dev, 0, ab8540_cut2_devs, + ARRAY_SIZE(ab8540_cut2_devs), NULL, + ab8500->irq_base, NULL); + } else if (is_ab8505(ab8500)) ret = mfd_add_devices(ab8500->dev, 0, ab8505_devs, ARRAY_SIZE(ab8505_devs), NULL, ab8500->irq_base, ab8500->domain); diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h index fb1bf7d..e330ad3 100644 --- a/include/linux/mfd/abx500/ab8500.h +++ b/include/linux/mfd/abx500/ab8500.h @@ -291,6 +291,8 @@ enum ab8500_version { #define AB8540_INT_FSYNC2R 213 #define AB8540_INT_BITCLK2F 214 #define AB8540_INT_BITCLK2R 215 +/* ab8540_irq_regoffset[27] -> IT[Source|Latch|Mask]33 */ +#define AB8540_INT_RTC_1S 216 /* * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the