From patchwork Thu Jul 23 15:26:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 11681231 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 1141213A4 for ; Thu, 23 Jul 2020 15:30:46 +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 D8C44206E3 for ; Thu, 23 Jul 2020 15:30:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KBKq1Viw"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="aEUGtAZI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D8C44206E3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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=c+i7uEYRAiY6XFsJlgFpKc+xtT+HThtIhPXITC8A6fk=; b=KBKq1ViwM/SnbwdRo+bZzGMFw SZ2/tubIfcf5ddf/N26cPg74/Pux7BzvNSIQsO03pnSjSg0Ve/qyA23ZFtJsf0E460a2HafDKkdAl HlqgJwSsbA/lHcLl35cib8nz0G6ChVHcfOXeWWxKGo7DYrbrthJUPEyvyH8LL2YSkdh+xHiTKeBcB zQL21y2d9+ddH+YmXCXh3baKmGB5FMBlEH/jO1F8f2U2Lm+1/jBMwiDa2oYI/G2DsV61ox2oaTyPM M4fAEyzH/GyDvZ4RCTu/cgGWfsAk/edt+EP35uJO/JTSMx/Dculz7JCCDte0+CJLGP7Ozx2YVgkOU AAMf76nUA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd9H-0008Am-Oa; Thu, 23 Jul 2020 15:28:43 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd7d-0007VS-Tx for linux-arm-kernel@lists.infradead.org; Thu, 23 Jul 2020 15:27:04 +0000 Received: by mail-wm1-x341.google.com with SMTP id p14so4965493wmg.1 for ; Thu, 23 Jul 2020 08:27:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3NpN6vwpNGFrmKHXZA+xE9YNl04TWY4QjIajSNvVcqI=; b=aEUGtAZIDshRVd/hX89wGAPq91RQ9Vmz+YYHCiHcETrwy/C9kpFks+YYrXAir08n4t X3eEg9kZlVw092N2gK4pezjLzdchra1jmWsGjaAMrywEmF0Ar2WbfjoUm5MN0bI0c0pD GeW8aYmxtYppycdoE4VB0rtAa04zFi35bpxTWbh7nVYc62x/MAr6MUmcuzMM7A6ZSswl LgGN29YP6NDBf4P6G+y81UzA8r7GgJKWWj7jimo0aA+0eHeVG6cpVWFz8rhBblZTVZ7n D3Jjev8QWmSyeoudsXisjVcQ4sN4KyX/yCf+BglJgeUO5KR1lx3rGCx/SdcagPalkEol ucFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3NpN6vwpNGFrmKHXZA+xE9YNl04TWY4QjIajSNvVcqI=; b=LK5YI3OgshJmhTIJbfJHlsOKUPN+360G9zF3Uzi+qB2vOV796P9Xh2HKzQv5mOA53B yeDjlCwalAVdgjxi5Vp0Pl0PP8VKrcVlR8CoW58LgNFQIim3tXbkh0wuyyD2ZRg74iDD TcEDGHDF0oi1mE9ZgmpN8CQKigdIRQz+Eq7BnRvqNG/vJ2xgps3lbmqnbbTCeUDpO9Nh alB7V2pSmSVHF+QnA7Ro8WyLdA6DilKUWbFceW2Y8fk0j4ILTwrUILWLAseoRBsB5MxX OMBawzJaZj2XbeLpx9Hnmdj0tcJWC2RyjB8c0wh91VEzK1owstzTQA2vD9FCzmKnJoQE QMTg== X-Gm-Message-State: AOAM530z/hjdEN/AxWE7MdSIY/i3eoCsiVv5CavtnplM3Jf2jYdUK40w y4GiVBETO6qVJ1ANfPbJkSTc/g== X-Google-Smtp-Source: ABdhPJykbgZiz9e8tZr4TtwFzSuPsYlppku/LsYQx6m//wEDLxa446XX63F4bocUiIVM9Xwgj0P2Yg== X-Received: by 2002:a1c:ab84:: with SMTP id u126mr4467525wme.43.1595518020709; Thu, 23 Jul 2020 08:27:00 -0700 (PDT) Received: from mai.imgcgcw.net ([2a01:e34:ed2f:f020:dca7:8d30:33fa:daac]) by smtp.gmail.com with ESMTPSA id g145sm5963491wmg.23.2020.07.23.08.26.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 08:27:00 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Subject: [PATCH 06/16] clocksource/drivers/timer-atmel-tcb: Fill tcb_config Date: Thu, 23 Jul 2020 17:26:26 +0200 Message-Id: <20200723152639.639771-6-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723152639.639771-1-daniel.lezcano@linaro.org> References: <1b1122f4-bce9-f349-e602-ed8e14cbb501@linaro.org> <20200723152639.639771-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200723_112702_182888_257C0174 X-CRM114-Status: GOOD ( 13.69 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:341 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 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: Alexandre Belloni , Ludovic Desroches , "moderated list:ARM/Microchip AT91 SoC support" , "open list:CLOCKSOURCE, CLOCKEVENT DRIVERS" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Alexandre Belloni 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 Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20200710230813.1005150-7-alexandre.belloni@bootlin.com --- 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));