From patchwork Thu Jun 25 21:43:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 11627279 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98C876C1 for ; Fri, 26 Jun 2020 11:50:58 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4FB4420791 for ; Fri, 26 Jun 2020 11:50:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="0I5LjRoa"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="PzMZ5npl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FB4420791 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=NZTVzNazNW6lRK0I9arlom4QTUyHWkpbZq9bHNg0y4A=; b=0I5LjRoaIghc7rC8/oZYImLhO D5sIdz67nh0c98dn5ARzvGfqQQyp9ewaCOl6yCsdTAiWyDDi1fy5YB7QkyaAqNlYHOJK2UlbOlCzZ anXaH8Xcmo925LZAKJMDYljRO65y25nIjLy8ZxA+ZIv9Yue5kukmD68qDmOCwF642u1j89TI8tkbe uvO1KMbfj6GeTE3driOZMmlbA5+pVoR828VqtmTB0J5B9A+F+8sH+LcXcWuL0IaiwXZ4eb5bmcCbX 4YWQsvQvWxlCHenUUi6v6yAJDyCvYZ8cAzxN9w8FOVYq7l5BlF/3Lq5D3HADzGPiixDwS3hnZ2zGT JLJ/0dTWw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jomqx-0004oI-5r; Fri, 26 Jun 2020 11:49:07 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jolNO-0004OP-B7 for linux-arm-kernel@merlin.infradead.org; Fri, 26 Jun 2020 10:14:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=23qQxUf4r7VmXILsS3X4NzMkta6sgAqJRY5OF1MqR7I=; b=PzMZ5nplud8YWK5tWjRl3wfgVW A9xxR9ET0aUPBzkLuvgJHRCBkLsAzpOh6tUwDfPVaezV3anSgwbL0DLC7+bD13Y1qNRglWbckNCT5 9LP1B8hSjcdB8fI87fsmXOVQkDa1TgYzPhSRJyDgcXxCWdFsC7mmqdJIUKoi3Kg4zZ6rV1w1kraDT pCS0AvJ7jCa9RCa5j6B0VGFPv0irvy0YEutWprGFyw25y7SRnWYYyRhdHx1Cd9369plTHjsthfsRJ qH9Vx23Wlp1fyhLWuTzC7HdWiaUh5uUiEyr1he8s36GcpfHFq3qhrB7fPSVscXiozwhixwpiG+fj1 dfM4c5oA==; Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1joZew-0000c9-LH for linux-arm-kernel@lists.infradead.org; Thu, 25 Jun 2020 21:43:57 +0000 X-Originating-IP: 86.202.110.81 Received: from localhost (lfbn-lyo-1-15-81.w86-202.abo.wanadoo.fr [86.202.110.81]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id AAE4DC0005; Thu, 25 Jun 2020 21:43:28 +0000 (UTC) From: Alexandre Belloni To: Daniel Lezcano Subject: [PATCH v5 9/9] clocksource/drivers/timer-atmel-tcb: add sama5d2 support Date: Thu, 25 Jun 2020 23:43:12 +0200 Message-Id: <20200625214312.1382063-10-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200625214312.1382063-1-alexandre.belloni@bootlin.com> References: <20200625214312.1382063-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200625_224351_083878_A6C392FD X-CRM114-Status: GOOD ( 14.18 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-2.6 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [217.70.183.198 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [217.70.183.198 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kamel.bouhara@bootlin.com, Alexandre Belloni , Sebastian Andrzej Siewior , linux-kernel@vger.kernel.org, Thomas Gleixner , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The first divisor for the sama5d2 is actually the gclk selector. Because the currently remaining divisors are fitting the use case, currently ensure it is skipped. Signed-off-by: Alexandre Belloni --- drivers/clocksource/timer-atmel-tcb.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/clocksource/timer-atmel-tcb.c b/drivers/clocksource/timer-atmel-tcb.c index ccb77b9cb489..e373b02d509a 100644 --- a/drivers/clocksource/timer-atmel-tcb.c +++ b/drivers/clocksource/timer-atmel-tcb.c @@ -359,9 +359,15 @@ static struct atmel_tcb_config tcb_sam9x5_config = { .counter_width = 32, }; +static struct atmel_tcb_config tcb_sama5d2_config = { + .counter_width = 32, + .has_gclk = 1, +}; + static const struct of_device_id atmel_tcb_of_match[] = { { .compatible = "atmel,at91rm9200-tcb", .data = &tcb_rm9200_config, }, { .compatible = "atmel,at91sam9x5-tcb", .data = &tcb_sam9x5_config, }, + { .compatible = "atmel,sama5d2-tcb", .data = &tcb_sama5d2_config, }, { /* sentinel */ } }; @@ -426,7 +432,10 @@ static int __init tcb_clksrc_init(struct device_node *node) /* How fast will we be counting? Pick something over 5 MHz. */ rate = (u32) clk_get_rate(t0_clk); - for (i = 0; i < ARRAY_SIZE(atmel_tcb_divisors); i++) { + i = 0; + if (tc.tcb_config->has_gclk) + i = 1; + for (; i < ARRAY_SIZE(atmel_tcb_divisors); i++) { unsigned divisor = atmel_tcb_divisors[i]; unsigned tmp;