From patchwork Tue Feb 28 06:35:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 733306 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vXTS21g4xz9sN5 for ; Tue, 28 Feb 2017 17:38:42 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FgU76q+U"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9eTvuk4aIFF5Ebpn50FN+xl3fm2XTzl6Qgf3rmtlerc=; b=FgU76q+U3FLv0k wccVS+s494ClUE0wAKHaA0RtNA4VUu+flBF/HYOFfWnIJK6vhmElm4f0VQf9g+oK5st8yNNUZd+/f JDpPa/a16MnTln4sE9MeHHWfqMV9uiYU/EGuNAXUacJnKJbffGBP5Zf3sP/d6QL9U2YoUXJNrOk/W l9s1vEyBeI0VJl6wMvHCSsawNjmhbSJlxfLWOMu3K8eTzYZDmyHspS0GnZlVDYJtUdSzSm269kalA 5CaU1PlyXgTie0RZs0y5LgchK/aA7MepkGHyvy6pn78u77pzdAOdnscg0W7lek1A04fDPcbg0Ud7z 9syZYbtMNWkEPGBQywnw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cibQk-0000bT-WD; Tue, 28 Feb 2017 06:38:39 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cibOT-00080w-Kb for linux-arm-kernel@lists.infradead.org; Tue, 28 Feb 2017 06:36:22 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 799F7ADBB; Tue, 28 Feb 2017 06:35:52 +0000 (UTC) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: arm@kernel.org Subject: [PATCH v3 05/25] clocksource: owl: Add S900 support Date: Tue, 28 Feb 2017 07:35:15 +0100 Message-Id: <20170228063535.32069-6-afaerber@suse.de> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170228063535.32069-1-afaerber@suse.de> References: <20170228063535.32069-1-afaerber@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170227_223618_038944_C8A088AC X-CRM114-Status: GOOD ( 12.19 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [195.135.220.15 listed in list.dnswl.org] -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: support@lemaker.org, Daniel Lezcano , linux-kernel@vger.kernel.org, mp-cs@actions-semi.com, 96boards@ucrobotics.com, Thomas Gleixner , =?UTF-8?q?Andreas=20F=C3=A4rber?= , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org The Actions Semi S900 SoC provides four 32-bit timers, TIMER0/1/2/3, but no 2Hz timers. Deal with the S500 having less timers. An S900 datasheet can be found in 96Boards documentation: https://github.com/96boards/documentation/blob/master/ConsumerEdition/Bubblegum-96/HardwareDocs/SoC_bubblegum96.pdf Signed-off-by: Andreas Färber --- v3: new drivers/clocksource/owl-timer.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/clocksource/owl-timer.c b/drivers/clocksource/owl-timer.c index 1b1e26d..babbfd5 100644 --- a/drivers/clocksource/owl-timer.c +++ b/drivers/clocksource/owl-timer.c @@ -31,7 +31,7 @@ #define OWL_Tx_CTL_INTEN BIT(1) #define OWL_Tx_CTL_EN BIT(2) -#define OWL_MAX_Tx 2 +#define OWL_MAX_Tx 4 struct owl_timer_info { int timer_offset[OWL_MAX_Tx]; @@ -43,7 +43,8 @@ static void __iomem *owl_timer_base; static inline void __iomem *owl_timer_get_base(unsigned timer_nr) { - if (timer_nr >= OWL_MAX_Tx) + if (timer_nr >= OWL_MAX_Tx || + owl_timer_info->timer_offset[timer_nr] == -1) return NULL; return owl_timer_base + owl_timer_info->timer_offset[timer_nr]; @@ -126,10 +127,20 @@ static irqreturn_t owl_timer1_interrupt(int irq, void *dev_id) static const struct owl_timer_info s500_timer_info = { .timer_offset[0] = 0x08, .timer_offset[1] = 0x14, + .timer_offset[2] = -1, + .timer_offset[3] = -1, +}; + +static const struct owl_timer_info s900_timer_info = { + .timer_offset[0] = 0x08, + .timer_offset[1] = 0x14, + .timer_offset[2] = 0x30, + .timer_offset[3] = 0x3c, }; static const struct of_device_id owl_timer_of_matches[] = { { .compatible = "actions,s500-timer", .data = &s500_timer_info }, + { .compatible = "actions,s900-timer", .data = &s900_timer_info }, { } }; @@ -191,3 +202,4 @@ static int __init owl_timer_init(struct device_node *node) return 0; } CLOCKSOURCE_OF_DECLARE(owl_s500, "actions,s500-timer", owl_timer_init); +CLOCKSOURCE_OF_DECLARE(owl_s900, "actions,s900-timer", owl_timer_init);