From patchwork Thu Jun 25 21:43:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 11627451 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 496B660D for ; Fri, 26 Jun 2020 12:41:23 +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 205412078D for ; Fri, 26 Jun 2020 12:41:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ju3IDKCu"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="iS1J9urb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 205412078D 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=uah0b8iaI5XJ+e/7AfRR6ihXXlnn3xh4+0n3ZU7R9d4=; b=ju3IDKCuvrXoCN3NSqLNCjtCt Z6vE+tdcYNadyDYmqd9HCFh5eujPGbDlKHm+RK9N+ZMMrrmYF9q7H/cEmt9tU0qJhvV6TLUr8c1YX 4bRAWwpl/Cux3SJY7Rotrn3ZqnvnYWafyPn1UF0cmF+ksGKJsTSPIN2VqNOwLO6y8nvY6RN4oQAKo iFLeChC5W8fzask1QFRpuUwigemgCzdxoWcM/QQ+1ar9Etdxsyr0wr/nWABzCCOqwidaL9HNw/AE0 /MkUakPkG2eIfYFvFm8HDGpvUMXOIzrWuY7KP+fO1pMZEI+k//RygIw3qTNxV4iFbim2+g2ivzlOC MahX7tLDA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jondr-0002tl-Pu; Fri, 26 Jun 2020 12:39:39 +0000 Received: from casper.infradead.org ([90.155.50.34]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jolOb-0000YK-Bh for linux-arm-kernel@merlin.infradead.org; Fri, 26 Jun 2020 10:15:45 +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=kzn4QcgdyueAWfpd8V8Vl3SNkQNUJkBmFsfs/I9mZdM=; b=iS1J9urbSioJtVXXnB02UirhXg yMpeNMC/eSyRrHRyjFOBEUzRrjKjc5J4YDBKTOQmdCwnySoiGj0kHDLRxopPtgh6QJsqJOTlGeXAB IodojNPKZjRJrXdM4jeCzfhpeGWhhMVf8NpR5MDRuxHLXKsLKB2xmJ25J6bLZ8tNFgT+zwFLBCxIk 68cmEqem+dHr475PkdwVoIAxgCC2qUecodp758HTkiaGMLbLH4oQ2eYn9pMEz5QnkEW8KUIgM0/B1 EUuai0P51Y4ads2K0l5AVIAHIpHTZRhNjsG6+qK9bB6N/82G53Y6CW1URPh7Ei2vw1fCQI/mw1Z6o OG+R6MTQ==; Received: from relay7-d.mail.gandi.net ([217.70.183.200]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1joZet-0000aY-UW for linux-arm-kernel@lists.infradead.org; Thu, 25 Jun 2020 21:43:53 +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 relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 0C70A20005; Thu, 25 Jun 2020 21:43:25 +0000 (UTC) From: Alexandre Belloni To: Daniel Lezcano Subject: [PATCH v5 6/9] clocksource/drivers/timer-atmel-tcb: fill tcb_config Date: Thu, 25 Jun 2020 23:43:09 +0200 Message-Id: <20200625214312.1382063-7-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_224348_409484_1A1C2653 X-CRM114-Status: GOOD ( 13.68 ) 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.200 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [217.70.183.200 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 Use the tcb_config and struct atmel_tcb_config to get the timer counter width. This is necessary because atmel_tcb_config will be extended later on. Signed-off-by: Alexandre Belloni --- drivers/clocksource/timer-atmel-tcb.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/clocksource/timer-atmel-tcb.c b/drivers/clocksource/timer-atmel-tcb.c index b255a4a1a36b..423af2f9835f 100644 --- a/drivers/clocksource/timer-atmel-tcb.c +++ b/drivers/clocksource/timer-atmel-tcb.c @@ -348,9 +348,17 @@ static void __init tcb_setup_single_chan(struct atmel_tc *tc, int mck_divisor_id static const u8 atmel_tcb_divisors[] = { 2, 8, 32, 128 }; +static struct atmel_tcb_config tcb_rm9200_config = { + .counter_width = 16, +}; + +static struct atmel_tcb_config tcb_sam9x5_config = { + .counter_width = 32, +}; + static const struct of_device_id atmel_tcb_of_match[] = { - { .compatible = "atmel,at91rm9200-tcb", .data = (void *)16, }, - { .compatible = "atmel,at91sam9x5-tcb", .data = (void *)32, }, + { .compatible = "atmel,at91rm9200-tcb", .data = &tcb_rm9200_config, }, + { .compatible = "atmel,at91sam9x5-tcb", .data = &tcb_sam9x5_config, }, { /* sentinel */ } }; @@ -398,7 +406,11 @@ static int __init tcb_clksrc_init(struct device_node *node) } match = of_match_node(atmel_tcb_of_match, node->parent); - bits = (uintptr_t)match->data; + if (!match) + return -ENODEV; + + tc.tcb_config = match->data; + bits = tc.tcb_config->counter_width; for (i = 0; i < ARRAY_SIZE(tc.irq); i++) writel(ATMEL_TC_ALL_IRQ, tc.regs + ATMEL_TC_REG(i, IDR));