From patchwork Tue Jun 18 14:03:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 1117936 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MgTfYh3s"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45Sqbk62Ddz9sNq for ; Wed, 19 Jun 2019 00:05:22 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729356AbfFROEj (ORCPT ); Tue, 18 Jun 2019 10:04:39 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:40675 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728881AbfFROEi (ORCPT ); Tue, 18 Jun 2019 10:04:38 -0400 Received: by mail-lf1-f65.google.com with SMTP id a9so9381971lff.7; Tue, 18 Jun 2019 07:04:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yGzib6MseACehIYRzaxs9YRxFXUiKKW6eF2jOufVeio=; b=MgTfYh3stqNxgZlQmWUAd5MtiRvA8vV9zxm5ODNoW81j6wPb+fsJCp5dUYyKv9bP8E yuX/o0r/TKpul8P9pj1rWOUZHLZfWHh+jgnWqUbWj29oaf1ieCatmN/NcDFzRWyQq2Hq ueRvYqsWfCtVRTrodxA0ha4A13zhAmb1c3m834EGq03J7v595rcjclCfwwO7xTohMRec yyZVtTCzzWrIxFBe2lBx/Li73KC0TV72MWFdVOltErm+B1yDy3g6ndbEyHPPUSe2APpl LRilz50ilPnuUwJUy8ve6CUHjJ2jkzaExnJ9PuwV6oTieMxTyxi8P5vSVP8R7uti/ohc u45g== 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=yGzib6MseACehIYRzaxs9YRxFXUiKKW6eF2jOufVeio=; b=gQF9b4gjNIZeTAIpdiWob2ph9Rom9iaFpHg1z49x9eU5zpNT9OnEiR3AmCbmKxvCK1 5A5PcKNjuxmz+v6PfQb4DS9b8Lgm2PCs7hTcVirlwYkbpM28GyyZTgUSuCnrajsFMHcx X/NayYDGkEM0VVsgRoxNc4990m7M0Z7tkk8+Fb2U5lyEH9KQSw5uBNKEmfJ4i7jOqRmT OYDQNyGYETpApVzR8OdM3GVgRXuA5GtAs7+noK6AhewS35+geycGhUFrtJ6C9c26umP2 FVSrQr62iNbm58lfCmN/tAE0Y+V1lAy6xCHj2mzAbRLyMBP1NSpXvOgzi7omlD0WC6vg RYdw== X-Gm-Message-State: APjAAAUjdjy1SbjBOiCd5g1zC6PN1sUi9DgIMr/PVjox0+d+2WZl25dm R4L1aFytNQlJ0uHqISUqJXUxTvai X-Google-Smtp-Source: APXvYqyzCxDjGqJ4TwXFRFbmGVmL+naY4sTKxFD7FCosi9P7Ush/adZz52ViR+l73kD+nBZed1Px5Q== X-Received: by 2002:a19:c14f:: with SMTP id r76mr11251171lff.70.1560866676585; Tue, 18 Jun 2019 07:04:36 -0700 (PDT) Received: from localhost.localdomain (ppp91-79-162-197.pppoe.mtu-net.ru. [91.79.162.197]) by smtp.gmail.com with ESMTPSA id q6sm2650538lji.70.2019.06.18.07.04.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Jun 2019 07:04:36 -0700 (PDT) From: Dmitry Osipenko To: Daniel Lezcano , Thierry Reding , Jonathan Hunter , Peter De Schrijver Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/8] clocksource/drivers/tegra: Restore timer rate on Tegra210 Date: Tue, 18 Jun 2019 17:03:51 +0300 Message-Id: <20190618140358.13148-2-digetx@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190618140358.13148-1-digetx@gmail.com> References: <20190618140358.13148-1-digetx@gmail.com> MIME-Version: 1.0 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org The clocksource rate is initialized only for the first per-CPU clocksource and then that rate shall be replicated for the rest of clocksource's because they are initialized manually in the code. Fixes: 3be2a85a0b61 ("clocksource/drivers/tegra: Support per-CPU timers on all Tegra's") Acked-by: Jon Hunter Tested-by: Jon Hunter Signed-off-by: Dmitry Osipenko Acked-by: Thierry Reding --- drivers/clocksource/timer-tegra.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clocksource/timer-tegra.c b/drivers/clocksource/timer-tegra.c index 1cc5847a1030..501071f09fa8 100644 --- a/drivers/clocksource/timer-tegra.c +++ b/drivers/clocksource/timer-tegra.c @@ -277,6 +277,8 @@ static int __init tegra_init_timer(struct device_node *np, bool tegra20, */ if (tegra20) cpu_to->of_clk.rate = 1000000; + else + cpu_to->of_clk.rate = timer_of_rate(to); cpu_to = per_cpu_ptr(&tegra_to, cpu); cpu_to->of_base.base = timer_reg_base + base; From patchwork Tue Jun 18 14:03:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 1117933 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="RPxmMbTO"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45SqbS4nCZz9sBp for ; Wed, 19 Jun 2019 00:05:08 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729389AbfFROEk (ORCPT ); Tue, 18 Jun 2019 10:04:40 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:43623 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726047AbfFROEj (ORCPT ); Tue, 18 Jun 2019 10:04:39 -0400 Received: by mail-lf1-f68.google.com with SMTP id j29so9371640lfk.10; Tue, 18 Jun 2019 07:04:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UStQDGBIbRw+o+Dqy3P0eYDxpcISKuZis1Sl1FbafX8=; b=RPxmMbTOPcLqQg1Hr+WSf0nwKlYtrefWWyKMevAQUHGSTiUn7rz9hmMaoAjajXpyVt TGwlrw0hT5bDPsghDSOMs2zfEzMDk0YpPBAJ9znP/XBXObCxCz/vlRbWgetMcqlL3aac 18itnZwLMGBS3VL8eJl6fPR0rLD+1IfH0/Uv/TiHYxeM65vzv1C5jhcgOAb+Twio1u4u 7FLUZJq58PO4NtG4WSPkCqDYd+ksUtF8x1syiipODUjAPPgIFNzGmTWBcOBjT8SZhTFU 0N8UHGmEwHaGCUfDaV4IzbtokxL7yl7H7mZbyjbnAqtyVoVf9hRfOcj+LvYHNIXQv3EA 6z+Q== 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=UStQDGBIbRw+o+Dqy3P0eYDxpcISKuZis1Sl1FbafX8=; b=UUeKjDeDcMWzGTHfpaqsFoKWnpVKYZdu7PlVqirE08/IKV0wSn8UO1Nx/TrwPtoYKj ItORhcklNIWtANSf+Qhh9N3Tlb6Ip/xUU1benjdob7wg7NlyKzAag3do/1IhTLPZRiQi REFbmCKtDkt/Fm/4qCHY5P5jAiXeFdrz8E+DgZedW3dB2UVTfaI17W8tfjqdPXVY9jbl uUnlLeSOAcHbJip7BnoYvXNLNHaHR/EzrPps2m1lYDix9vJ7+Y6wSen2UhOsx35RYWhu GcNGoCKzzQ+LEymYdw4WuegVJwW+IAjjrsw2KaJIqNxAF3XsKrkIxGJFA/Ao2mplFasV xU9A== X-Gm-Message-State: APjAAAXVDfUq2UygfiwIePrvW+JPUD6baZJZAr7NQo87wLm/85nSvQVZ bIhL2Bjs63ouWlxCpDUOsUM= X-Google-Smtp-Source: APXvYqyrR8/B20wPjKesgsV525ItCFwgjVA7KeHqnnw38W69svkMVZ2/sZYP0xJLuJUxIyij+bgfcQ== X-Received: by 2002:a19:c301:: with SMTP id t1mr60468781lff.137.1560866677530; Tue, 18 Jun 2019 07:04:37 -0700 (PDT) Received: from localhost.localdomain (ppp91-79-162-197.pppoe.mtu-net.ru. [91.79.162.197]) by smtp.gmail.com with ESMTPSA id q6sm2650538lji.70.2019.06.18.07.04.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Jun 2019 07:04:37 -0700 (PDT) From: Dmitry Osipenko To: Daniel Lezcano , Thierry Reding , Jonathan Hunter , Peter De Schrijver Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/8] clocksource/drivers/tegra: Remove duplicated use of per_cpu_ptr Date: Tue, 18 Jun 2019 17:03:52 +0300 Message-Id: <20190618140358.13148-3-digetx@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190618140358.13148-1-digetx@gmail.com> References: <20190618140358.13148-1-digetx@gmail.com> MIME-Version: 1.0 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org It was left unnoticed by accident, which means that the code could be cleaned up a tad more. Acked-by: Jon Hunter Signed-off-by: Dmitry Osipenko Acked-by: Thierry Reding --- drivers/clocksource/timer-tegra.c | 42 ++++++++++++++++++------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/drivers/clocksource/timer-tegra.c b/drivers/clocksource/timer-tegra.c index 501071f09fa8..ff5a4ccb5d52 100644 --- a/drivers/clocksource/timer-tegra.c +++ b/drivers/clocksource/timer-tegra.c @@ -216,6 +216,19 @@ static inline unsigned int tegra_irq_idx_for_cpu(int cpu, bool tegra20) return TIMER10_IRQ_IDX + cpu; } +static inline unsigned long tegra_rate_for_timer(struct timer_of *to, + bool tegra20) +{ + /* + * TIMER1-9 are fixed to 1MHz, TIMER10-13 are running off the + * parent clock. + */ + if (tegra20) + return 1000000; + + return timer_of_rate(to); +} + static int __init tegra_init_timer(struct device_node *np, bool tegra20, int rating) { @@ -268,32 +281,27 @@ static int __init tegra_init_timer(struct device_node *np, bool tegra20, for_each_possible_cpu(cpu) { struct timer_of *cpu_to = per_cpu_ptr(&tegra_to, cpu); + unsigned long flags = IRQF_TIMER | IRQF_NOBALANCING; + unsigned long rate = tegra_rate_for_timer(to, tegra20); unsigned int base = tegra_base_for_cpu(cpu, tegra20); unsigned int idx = tegra_irq_idx_for_cpu(cpu, tegra20); + unsigned int irq = irq_of_parse_and_map(np, idx); - /* - * TIMER1-9 are fixed to 1MHz, TIMER10-13 are running off the - * parent clock. - */ - if (tegra20) - cpu_to->of_clk.rate = 1000000; - else - cpu_to->of_clk.rate = timer_of_rate(to); - - cpu_to = per_cpu_ptr(&tegra_to, cpu); - cpu_to->of_base.base = timer_reg_base + base; - cpu_to->clkevt.rating = rating; - cpu_to->clkevt.cpumask = cpumask_of(cpu); - cpu_to->clkevt.irq = irq_of_parse_and_map(np, idx); - if (!cpu_to->clkevt.irq) { + if (!irq) { pr_err("failed to map irq for cpu%d\n", cpu); ret = -EINVAL; goto out_irq; } + cpu_to->clkevt.irq = irq; + cpu_to->clkevt.rating = rating; + cpu_to->clkevt.cpumask = cpumask_of(cpu); + cpu_to->of_base.base = timer_reg_base + base; + cpu_to->of_clk.rate = rate; + irq_set_status_flags(cpu_to->clkevt.irq, IRQ_NOAUTOEN); - ret = request_irq(cpu_to->clkevt.irq, tegra_timer_isr, - IRQF_TIMER | IRQF_NOBALANCING, + + ret = request_irq(cpu_to->clkevt.irq, tegra_timer_isr, flags, cpu_to->clkevt.name, &cpu_to->clkevt); if (ret) { pr_err("failed to set up irq for cpu%d: %d\n", From patchwork Tue Jun 18 14:03:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 1117935 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="u73BmwL+"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45Sqbf0CR7z9sBp for ; Wed, 19 Jun 2019 00:05:18 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729386AbfFROFH (ORCPT ); Tue, 18 Jun 2019 10:05:07 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:46994 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729308AbfFROEk (ORCPT ); Tue, 18 Jun 2019 10:04:40 -0400 Received: by mail-lf1-f67.google.com with SMTP id z15so9354290lfh.13; Tue, 18 Jun 2019 07:04:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5sDx0TIkIdgU++tFYOdzDBd1TkEZ4EvtendbdVPaP5I=; b=u73BmwL+yUCKRQVATtRS0baorED7GOtey9tCPMU6dZouIB8hVA/pD6WTJOaTwmZ20W jwLiQJzU3nTFDvKB53i7a22JaBK9mWpC6tXLY4AIkwg7Cs144yBoMzHvJJB4SDoJdxgE 7EaekPQFikicPtV0SzLJc4zRUATVJ6KEhvRH53/cgECUPOjcxmJtUJ0FeDy1S5V8RQXO Gn1KxSY2ByrSLCQ2bSXi4271HL6LBg41PXtprxJw993pfk+nqIh0B1NrVI2kShI8sEM0 CJCHN2lD3/HTZL2l0Fv9v6j5NsSIcz7t8u22SJZ31VKSSrws6xJS/vI0i5HdXE6AzboI Jl2w== 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=5sDx0TIkIdgU++tFYOdzDBd1TkEZ4EvtendbdVPaP5I=; b=SgvEcjvmMH8QKb0ru/to4v3rM0SqDPlm2ClGp/f5XHd5kLIXjPz3N7FP4XzI4pSqGN rcGwJsQsHla1EyV3U0LtQTc5KXuoaApv87k+pwzA2zulInclfIJxppI9xrgf7zDV8M/c oFNBL50Q88+5UtnJ3giF7NFF3yblFnMg7MjR6bXS2UCatMlkW3XWSSdKpzCCOcqcdI0o T6IOh4rnE1J7CebyTAY5B2cJklitAA8CJJFvPNvaddySnMEnSWgdqSsL6gSta+h7g4Ac 8pwSfGrhBIpRcWUr+kBkk5cJONinXmTuF2Br6jM7y1mGgMNLeTpuur7stGfHK28r3QrH 8wGw== X-Gm-Message-State: APjAAAWJaX4j5PV/1S3c98LgzzR0+SVaNVudjtHu5jFIb79gO/D+MGAz wTaq2yi1Cn9gJedO8/mriL6RVGJo X-Google-Smtp-Source: APXvYqx6BOKM1JAtSIUSdX0uTODX3quVH0Dn332OewG+w7hTe67Tufum+pgUTKfqL6kcAZ1jaqf5nQ== X-Received: by 2002:ac2:41d3:: with SMTP id d19mr30401737lfi.127.1560866678578; Tue, 18 Jun 2019 07:04:38 -0700 (PDT) Received: from localhost.localdomain (ppp91-79-162-197.pppoe.mtu-net.ru. [91.79.162.197]) by smtp.gmail.com with ESMTPSA id q6sm2650538lji.70.2019.06.18.07.04.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Jun 2019 07:04:38 -0700 (PDT) From: Dmitry Osipenko To: Daniel Lezcano , Thierry Reding , Jonathan Hunter , Peter De Schrijver Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/8] clocksource/drivers/tegra: Set and use timer's period Date: Tue, 18 Jun 2019 17:03:53 +0300 Message-Id: <20190618140358.13148-4-digetx@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190618140358.13148-1-digetx@gmail.com> References: <20190618140358.13148-1-digetx@gmail.com> MIME-Version: 1.0 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org The of_clk structure has a period field that is set up initially by timer_of_clk_init(), that period value need to be adjusted for a case of TIMER1-9 that are running at a fixed rate that doesn't match the clock's rate. Note that the period value is currently used only by some of the clocksource drivers internally and hence this is just a minor cleanup change that doesn't fix anything. Signed-off-by: Dmitry Osipenko Acked-by: Jon Hunter Acked-by: Thierry Reding --- drivers/clocksource/timer-tegra.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/clocksource/timer-tegra.c b/drivers/clocksource/timer-tegra.c index ff5a4ccb5d52..e6221e070499 100644 --- a/drivers/clocksource/timer-tegra.c +++ b/drivers/clocksource/timer-tegra.c @@ -71,9 +71,9 @@ static int tegra_timer_shutdown(struct clock_event_device *evt) static int tegra_timer_set_periodic(struct clock_event_device *evt) { void __iomem *reg_base = timer_of_base(to_timer_of(evt)); + unsigned long period = timer_of_period(to_timer_of(evt)); - writel_relaxed(TIMER_PTV_EN | TIMER_PTV_PER | - ((timer_of_rate(to_timer_of(evt)) / HZ) - 1), + writel_relaxed(TIMER_PTV_EN | TIMER_PTV_PER | (period - 1), reg_base + TIMER_PTV); return 0; @@ -297,6 +297,7 @@ static int __init tegra_init_timer(struct device_node *np, bool tegra20, cpu_to->clkevt.rating = rating; cpu_to->clkevt.cpumask = cpumask_of(cpu); cpu_to->of_base.base = timer_reg_base + base; + cpu_to->of_clk.period = rate / HZ; cpu_to->of_clk.rate = rate; irq_set_status_flags(cpu_to->clkevt.irq, IRQ_NOAUTOEN); From patchwork Tue Jun 18 14:03:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 1117932 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="vDSke2QR"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45SqbN56jHz9sP8 for ; Wed, 19 Jun 2019 00:05:04 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726047AbfFROFD (ORCPT ); Tue, 18 Jun 2019 10:05:03 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:37089 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729386AbfFROEl (ORCPT ); Tue, 18 Jun 2019 10:04:41 -0400 Received: by mail-lf1-f65.google.com with SMTP id d11so9392801lfb.4; Tue, 18 Jun 2019 07:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=STWc3nI1OlTc3dFrniXVfFPRqTFFuZX+HKw8/Q09fIA=; b=vDSke2QRbhtMXs05UDb/nxnqYCxd4VOMz647GTOO4ubNTi3kV35+/sLM59QfnrH/XH 7+8Nv1P9THVsFB0QUv2e63iMJunOOL2afVXe70UOSDf2JFnvW0TjXjsK5bDlFdUaKGOk 6hL7sxLnv8h+8HJAsQi/2RsxUvRHvDIzvCPShdwFbb4m0VST8buJWp4VadF1Opstn3jl xkN3uRIb/ocCtt/BuDo2YXQOjkNkkE6JnyFnvamFz47sojgvU/qlVZsynaNR0XtyBvEE cxhv9MdXa4vlV6/H39TRRvRNJiiPmrqAoOkH+faAZhA5LxjKWcMKFDEvylYpHgF46lcQ LZEA== 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=STWc3nI1OlTc3dFrniXVfFPRqTFFuZX+HKw8/Q09fIA=; b=CCxEaDNyV+HvEaYzylPCEyi+90X5SnVolloOxk1LESa/BkNKUDav+j65txvHyG6F+4 AWIbPd2hyYrjpBSfjEaceWO3uDveZC7lGz5nJzw4ee1cn6rvtNg0R1pdTfPpp3t/JADS oaF1dN5rlCrt3catCSBMgySkfbi3P7acJKT1Nm/EO7bolL/l7h+Cz5a9AjVFRzjXzHq5 1iwUJZpP3ZCNptYw0cmPACX7a7xXOFCeC0/8bAMl2K83g1FdEOLnmwO80WFBoziy3b6o 4HlNEdrYOZhcQ7UNDTZTgEE4scVyiqgl2W2ZAJg0hcsLKCJw42XaufAQEczFfsXERtr4 vpDg== X-Gm-Message-State: APjAAAVPJGEPkr7QSdG/Zjs9lf+BV+PV8qk7eCbqXyPHpMGdvKqp90eC l4rEWh4E5lxvfdOwm+XFOvE= X-Google-Smtp-Source: APXvYqxLXfG1WtyAoAek2wUWi2UZqqHqRtliSqne7M0zvkSifWGoyXJXTWcZRS2XztwKkOG/JOkwUg== X-Received: by 2002:ac2:4466:: with SMTP id y6mr17929686lfl.0.1560866679556; Tue, 18 Jun 2019 07:04:39 -0700 (PDT) Received: from localhost.localdomain (ppp91-79-162-197.pppoe.mtu-net.ru. [91.79.162.197]) by smtp.gmail.com with ESMTPSA id q6sm2650538lji.70.2019.06.18.07.04.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Jun 2019 07:04:39 -0700 (PDT) From: Dmitry Osipenko To: Daniel Lezcano , Thierry Reding , Jonathan Hunter , Peter De Schrijver Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/8] clocksource/drivers/tegra: Drop unneeded typecasting in one place Date: Tue, 18 Jun 2019 17:03:54 +0300 Message-Id: <20190618140358.13148-5-digetx@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190618140358.13148-1-digetx@gmail.com> References: <20190618140358.13148-1-digetx@gmail.com> MIME-Version: 1.0 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org There is no need to cast void because kernel allows to do that without a warning message from a compiler. Acked-by: Jon Hunter Signed-off-by: Dmitry Osipenko Acked-by: Thierry Reding --- drivers/clocksource/timer-tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clocksource/timer-tegra.c b/drivers/clocksource/timer-tegra.c index e6221e070499..3afa66c6730b 100644 --- a/drivers/clocksource/timer-tegra.c +++ b/drivers/clocksource/timer-tegra.c @@ -81,7 +81,7 @@ static int tegra_timer_set_periodic(struct clock_event_device *evt) static irqreturn_t tegra_timer_isr(int irq, void *dev_id) { - struct clock_event_device *evt = (struct clock_event_device *)dev_id; + struct clock_event_device *evt = dev_id; void __iomem *reg_base = timer_of_base(to_timer_of(evt)); writel_relaxed(TIMER_PCR_INTR_CLR, reg_base + TIMER_PCR); From patchwork Tue Jun 18 14:03:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 1117930 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="jpqi7QOh"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45SqbF2QDXz9sBp for ; Wed, 19 Jun 2019 00:04:57 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729501AbfFROEo (ORCPT ); Tue, 18 Jun 2019 10:04:44 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:39822 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729412AbfFROEm (ORCPT ); Tue, 18 Jun 2019 10:04:42 -0400 Received: by mail-lf1-f65.google.com with SMTP id p24so9391658lfo.6; Tue, 18 Jun 2019 07:04:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jbSwj9tUYUHF48lpxbApn6xo6/PnzEwRmK2D71mFg54=; b=jpqi7QOh3MeuEJ43NFXnswv0GgO4DpujFqguQy7sKDOALjc49PLGlKrghoM+KZQtaR CnoZSOa5cBcT+5x6mIdDiGr74pPXaQB1hhXO+X1V5uOFrREJpEjitv1mICyq0KmyiurX CVjMcELcvsgwmwmH13glCy8yL8H5LtqdQpS0bdirsadj+48nZUsChcW1KfpoSdOlJ2qE 1RrAczWpSYp58EHj9eGcqdIUfPCRMfYDPkHWXAl+4nQFrKbJThLtGPtv50mjjzvnLGTk pl3mZjCu6gkR/I6vpAeR9jgkxUk6xz5E73wL5E8CFFxoYLMGJnBFQMN2wqTiEGBS3XwG 4afA== 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=jbSwj9tUYUHF48lpxbApn6xo6/PnzEwRmK2D71mFg54=; b=LP3cCwjlI0NVPMpCCuxj+AX0LY98vqlblVFmrJxGqnHJObF/N+D1JI8WeA4gODzmnp YnWGpYg1ABJoyakoZWRUyWbn5f5th1QQWYTpQuDTtqPza3OxHBm7gpQydq33qa1O1FOQ cVE+1fkYfrJw3a0ImCC4CkYAdyLbxKqCG2PpL7k7b69iuJAgw2nJGD1zP5DMuSu8HSYu RyLTVuhvnTA4sq4hkGjhCnAlsuCpI5rQO7/ziBKk9Itf5Y65gpJP1+XVRuBZE3faFb36 Nt9egUaGBnqs7TDh4dSLU0+05gN3R4HLTbS9JOKnmwyk+PCYdzhZdLvY0+4DZVZztc/E OmGw== X-Gm-Message-State: APjAAAX5HoTZbN++enrMERvR4g+t6/0Qt+nUxDQ8/fQQ6eaUBWZwgdgi fHOX+YN8+MOrZBPvbr5l6Kk2KaG8 X-Google-Smtp-Source: APXvYqwAfHaV5/YPnj9tSQVq+uqrTgr3R5Kl/tYaSgQZA4pTCu3nAW7MeK0ZO8ZAqIhDeFNX2p/B2g== X-Received: by 2002:ac2:5310:: with SMTP id c16mr58074870lfh.119.1560866680518; Tue, 18 Jun 2019 07:04:40 -0700 (PDT) Received: from localhost.localdomain (ppp91-79-162-197.pppoe.mtu-net.ru. [91.79.162.197]) by smtp.gmail.com with ESMTPSA id q6sm2650538lji.70.2019.06.18.07.04.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Jun 2019 07:04:40 -0700 (PDT) From: Dmitry Osipenko To: Daniel Lezcano , Thierry Reding , Jonathan Hunter , Peter De Schrijver Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 5/8] clocksource/drivers/tegra: Add verbose definition for 1MHz constant Date: Tue, 18 Jun 2019 17:03:55 +0300 Message-Id: <20190618140358.13148-6-digetx@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190618140358.13148-1-digetx@gmail.com> References: <20190618140358.13148-1-digetx@gmail.com> MIME-Version: 1.0 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org Convert all 1MHz literals to a verbose constant for better readability. Suggested-by: Daniel Lezcano Acked-by: Jon Hunter Signed-off-by: Dmitry Osipenko Acked-by: Thierry Reding --- drivers/clocksource/timer-tegra.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/clocksource/timer-tegra.c b/drivers/clocksource/timer-tegra.c index 3afa66c6730b..ddf5531c48a9 100644 --- a/drivers/clocksource/timer-tegra.c +++ b/drivers/clocksource/timer-tegra.c @@ -44,6 +44,8 @@ #define TIMER1_IRQ_IDX 0 #define TIMER10_IRQ_IDX 10 +#define TIMER_1MHz 1000000 + static u32 usec_config; static void __iomem *timer_reg_base; @@ -158,7 +160,7 @@ static unsigned long tegra_delay_timer_read_counter_long(void) static struct delay_timer tegra_delay_timer = { .read_current_timer = tegra_delay_timer_read_counter_long, - .freq = 1000000, + .freq = TIMER_1MHz, }; #endif @@ -224,7 +226,7 @@ static inline unsigned long tegra_rate_for_timer(struct timer_of *to, * parent clock. */ if (tegra20) - return 1000000; + return TIMER_1MHz; return timer_of_rate(to); } @@ -313,11 +315,11 @@ static int __init tegra_init_timer(struct device_node *np, bool tegra20, } } - sched_clock_register(tegra_read_sched_clock, 32, 1000000); + sched_clock_register(tegra_read_sched_clock, 32, TIMER_1MHz); ret = clocksource_mmio_init(timer_reg_base + TIMERUS_CNTR_1US, - "timer_us", 1000000, - 300, 32, clocksource_mmio_readl_up); + "timer_us", TIMER_1MHz, 300, 32, + clocksource_mmio_readl_up); if (ret) pr_err("failed to register clocksource: %d\n", ret); From patchwork Tue Jun 18 14:03:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 1117931 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GkMI4tum"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45SqbL49gMz9sNy for ; Wed, 19 Jun 2019 00:05:02 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728991AbfFROE5 (ORCPT ); Tue, 18 Jun 2019 10:04:57 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:35891 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726047AbfFROEn (ORCPT ); Tue, 18 Jun 2019 10:04:43 -0400 Received: by mail-lf1-f67.google.com with SMTP id q26so9405399lfc.3; Tue, 18 Jun 2019 07:04:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jcA8/cz5L6PoM8H80xIFBBbunOj0r0rzlcwFIbOLiRc=; b=GkMI4tumktLC1zzO1j6ZRbXYLYRitiIaDLM/QWoBd1ofz2W0gi7nON6r7G4DouE5aM SbKM/CsvfhyzpTr+H7vZLncxBWxjZ5BoX3RkCDMu05xLo5mZ5mXYh/LoSaZKK5VKZ810 J2CV33Fc4RfDomEbt+FMZYh3ibNRzSsv7sn3lHu6liQKvChz8gcHBJ/kzDFZgAwUD3O/ sri/ap2EjN+6QWBu42EURstC6M9b+NU8F33x6SCN07E9TMYBrX1txDLpn6QUvwJ34Wj7 LzT4tyOBJnWIUoKLGHBuzZgvn+qSK21DEcLd0qHHxmvPGVJl9ILKmuANbVl+5knpupqK zBYA== 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=jcA8/cz5L6PoM8H80xIFBBbunOj0r0rzlcwFIbOLiRc=; b=QnKdjE/lJH1QJQRKaNUFXCbqhxTgU4IZgI9cJue6Prl4JwoLE30BXc5zPKZGc4F8hg pDC/xTgNKLtBHlz2LRa7psecUnzuix6Shfb9uWdWRGpdirRTJup8isbIVZSQjff5/TPv Vgm6Gwwf2SacCCWnyazWsmInEpDGGliAOzl1zU74K98dw6z5Lrjzlwi2DnPE+WovIuA/ gASj23/FYw6fxMcjUtc/24JR2wDoIdWaRUYoUZa0VyKGbcfjLXrckDUJf4Ukh6sdvsES 4Gn2USGgrVOcLlBaElBaqG1tdU3LRVpiVfcdekvWsQDArT65TLj8OIurCKZkYzlW9ZS1 YLcw== X-Gm-Message-State: APjAAAXQf0C+kTG2VgCkt2pO6Jsjh2FVQO6rr05CHXt36wns0/uRAI1q QK8Tu1Bnu6Wwf7Y5bthk4mjB0s5O X-Google-Smtp-Source: APXvYqznh+Oz8fxlgaMVqW2/FKT8cD+/fupVT1JfH4+B1zugchRbpRK6XESty7rUw/uEBpffPyjF+w== X-Received: by 2002:a19:428b:: with SMTP id p133mr18499679lfa.179.1560866681608; Tue, 18 Jun 2019 07:04:41 -0700 (PDT) Received: from localhost.localdomain (ppp91-79-162-197.pppoe.mtu-net.ru. [91.79.162.197]) by smtp.gmail.com with ESMTPSA id q6sm2650538lji.70.2019.06.18.07.04.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Jun 2019 07:04:40 -0700 (PDT) From: Dmitry Osipenko To: Daniel Lezcano , Thierry Reding , Jonathan Hunter , Peter De Schrijver Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 6/8] clocksource/drivers/tegra: Restore base address before cleanup Date: Tue, 18 Jun 2019 17:03:56 +0300 Message-Id: <20190618140358.13148-7-digetx@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190618140358.13148-1-digetx@gmail.com> References: <20190618140358.13148-1-digetx@gmail.com> MIME-Version: 1.0 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org We're adjusting the timer's base for each per-CPU timer to point to the actual start of the timer since device-tree defines a compound registers range that includes all of the timers. In this case the original base need to be restore before calling iounmap to unmap the proper address. Signed-off-by: Dmitry Osipenko Acked-by: Jon Hunter Acked-by: Thierry Reding --- drivers/clocksource/timer-tegra.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clocksource/timer-tegra.c b/drivers/clocksource/timer-tegra.c index ddf5531c48a9..2673b6e0caa8 100644 --- a/drivers/clocksource/timer-tegra.c +++ b/drivers/clocksource/timer-tegra.c @@ -345,6 +345,8 @@ static int __init tegra_init_timer(struct device_node *np, bool tegra20, irq_dispose_mapping(cpu_to->clkevt.irq); } } + + to->of_base.base = timer_reg_base; out: timer_of_cleanup(to); From patchwork Tue Jun 18 14:03:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 1117929 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Oev9jiOT"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45SqbB63hcz9sBp for ; Wed, 19 Jun 2019 00:04:54 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729588AbfFROEp (ORCPT ); Tue, 18 Jun 2019 10:04:45 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:33237 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729496AbfFROEo (ORCPT ); Tue, 18 Jun 2019 10:04:44 -0400 Received: by mail-lj1-f194.google.com with SMTP id h10so13281877ljg.0; Tue, 18 Jun 2019 07:04:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=up9rfJN2yTf53TU5ASdE2UZxjubVaBIyfo3rdkQL5fQ=; b=Oev9jiOTJ9iv4s5dh7zAiRV6UezxI2Nb5SFR8aeYakZe1OPEZ9UVfva2dkgwiiINnA KRFxHLuv/OUhHthdOgVoW7NNJcF3RDeyuYDWf+uOyfYz8Q/g706Ne+Tc2vPunJzTmv5h uwBblDUswVf01U0YzhR7FkAmD0+NAWjUzy/QRNWnpij+eIu3KsqlB9jTlidC9EWVvVyD B2cBWQ00VWd3PWGZUE+7J/gyHHUDF2enkpH+fauh8Qy0mLbobnTy6t2CYVd0IobZTHRi R34GHjG7VvbzXy9siVwNhmpa9LRFBukbJREl/sVSuCb+MxuMmQC2GW/y3tX0clR06a+U UkGA== 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=up9rfJN2yTf53TU5ASdE2UZxjubVaBIyfo3rdkQL5fQ=; b=XUSx5dzPxz4eNS7SigX4Nh+qK+yAWinpvbH4VJROB+y6kop5N8mOFG63ObIIpJzUyI 8Plvv0oNHX6/vJwZ5TtESBZr/e+LVYqQeonH70nUKp86JPSNhmullM0BvjDVUphr3XtC eFEOC4PTFRlCS2uvbOZM0G+oWmJ0fTsGzrHFtBz7wkxIQ1DiWzpIvXPU2lzc+fTR3v9D 4Dve0ILhb2wzMuodu4ECuifvUlM2MqE3NIA9U7U+wbidN8DEMSZOuKmlf6YTNjvRZp7m jbahbjR+sjE9DYiWi7dKiiTTu28qbxA7RdDbgdS0SP/i1GD3w1hvGKTIGLLcLhZ9mheE 8OEA== X-Gm-Message-State: APjAAAWpcLBjnUJTlyq4ztpusaHk12rjGwqqzOc/ttp1PfLazQ/SB5my vMqgQFzwzYGfSEj9aYc5jLQiqXgj X-Google-Smtp-Source: APXvYqzvtcWHxdI4ySb5pNRYa8AAfy9FenvmNtDMcrDwM7AKThvvoGDKCBKPSRy7a6jvDewlTDDN/g== X-Received: by 2002:a2e:980e:: with SMTP id a14mr53670259ljj.60.1560866682561; Tue, 18 Jun 2019 07:04:42 -0700 (PDT) Received: from localhost.localdomain (ppp91-79-162-197.pppoe.mtu-net.ru. [91.79.162.197]) by smtp.gmail.com with ESMTPSA id q6sm2650538lji.70.2019.06.18.07.04.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Jun 2019 07:04:42 -0700 (PDT) From: Dmitry Osipenko To: Daniel Lezcano , Thierry Reding , Jonathan Hunter , Peter De Schrijver Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 7/8] clocksource/drivers/tegra: Cycles can't be 0 Date: Tue, 18 Jun 2019 17:03:57 +0300 Message-Id: <20190618140358.13148-8-digetx@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190618140358.13148-1-digetx@gmail.com> References: <20190618140358.13148-1-digetx@gmail.com> MIME-Version: 1.0 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org Tegra's timer uses n+1 scheme for the counter, i.e. timer will fire after one tick if 0 is loaded. The minimum and maximum numbers of oneshot ticks are defined by clockevents_config_and_register(min, max) invocation and the min value is set to 1 tick. Hence "cycles" value can't ever be 0, unless it's a bug in clocksource core. Signed-off-by: Dmitry Osipenko Acked-by: Jon Hunter Acked-by: Thierry Reding --- drivers/clocksource/timer-tegra.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/clocksource/timer-tegra.c b/drivers/clocksource/timer-tegra.c index 2673b6e0caa8..b84324288749 100644 --- a/drivers/clocksource/timer-tegra.c +++ b/drivers/clocksource/timer-tegra.c @@ -54,9 +54,16 @@ static int tegra_timer_set_next_event(unsigned long cycles, { void __iomem *reg_base = timer_of_base(to_timer_of(evt)); - writel_relaxed(TIMER_PTV_EN | - ((cycles > 1) ? (cycles - 1) : 0), /* n+1 scheme */ - reg_base + TIMER_PTV); + /* + * Tegra's timer uses n+1 scheme for the counter, i.e. timer will + * fire after one tick if 0 is loaded. + * + * The minimum and maximum numbers of oneshot ticks are defined + * by clockevents_config_and_register(1, 0x1fffffff + 1) invocation + * below in the code. Hence the cycles (ticks) can't be outside of + * a range supportable by hardware. + */ + writel_relaxed(TIMER_PTV_EN | (cycles - 1), reg_base + TIMER_PTV); return 0; } From patchwork Tue Jun 18 14:03:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 1117928 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="JRFUU+v5"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45Sqb93QsQz9sDX for ; Wed, 19 Jun 2019 00:04:53 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729336AbfFROEs (ORCPT ); Tue, 18 Jun 2019 10:04:48 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:37094 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729497AbfFROEp (ORCPT ); Tue, 18 Jun 2019 10:04:45 -0400 Received: by mail-lf1-f65.google.com with SMTP id d11so9392992lfb.4; Tue, 18 Jun 2019 07:04:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NGtYvpn4I0jJbqxAf7ldvCplrBd2VH6MuMjptajnNUk=; b=JRFUU+v5WIoi99mY2jb0ZfXWXd6tGt848YpxJzJho3JpJKNNU6G2k9s+PuTFUoaGTr pPAAIupVitqL4XWBLNe1wiHqayP6C7i20a6bBK3fVi3XBgd2Ss+5RGR9DzA3FN3+iNm0 6G/8KB+eeeWvTb21Z/J3FoQnd2Q+LVSOdckNWSenjE/Sbtqxm9HbbZZttqnL5ncb6MVM 9BuMZVOlphORSpa7o1h7BKxFShMaZy9B+nxgX2U0+4jl2QyCJEmMjST0zNe1vEs/GDx6 MD2SMk20EnpMGfIaw5E61jPur3gk7Z5XzguA7lVPCBV8l9bLpY978zrvXBO+D1Ih9Gk0 VtZQ== 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=NGtYvpn4I0jJbqxAf7ldvCplrBd2VH6MuMjptajnNUk=; b=TzMXrt6AoHSxi6pQhuIKMAjQO8jo8IpeMD4MXLFhducINGszGO0WdTAKPSmtPy5H/H +Akhk7aOwcq7fp687BSiBkDyPtVgOIpAZ61YPEmntq4h40cr7iH06BhlHb6pY4i1lZsI +wf0xOgfXLj1q1ywTftG8EgrCy/csQp7byDr/Ed/QOP5KFApAPeNOcTh08kT7agdqODd FxbwsU2Zf8+N2XJ/Hkxl9nBQWr8aAjcrLhiqDLenbaYf+yY9cwA4wQ6WlpAeZ4jHPRrp 5PYzY+0enJ/xfsWS4OgRM1f7iB7oKvgr2icWuk84ZX/nW7Ol+VX3E90uIx2PKT+F/xNB JAoA== X-Gm-Message-State: APjAAAW2yZzTHpvqgM2RQ/bRGhBkOEacVW3GBG2mgcRjOMGeZDnXc85n jammS+ndAkCXzsfUkzt4OLs= X-Google-Smtp-Source: APXvYqy4wwqSdOKSc8aHYzMQqM/TTQCx8pj5NWfBNRQECvYckaVREVOiHKUf3bCe6bURZ0SyfbZd2w== X-Received: by 2002:ac2:4312:: with SMTP id l18mr51123390lfh.139.1560866683466; Tue, 18 Jun 2019 07:04:43 -0700 (PDT) Received: from localhost.localdomain (ppp91-79-162-197.pppoe.mtu-net.ru. [91.79.162.197]) by smtp.gmail.com with ESMTPSA id q6sm2650538lji.70.2019.06.18.07.04.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Jun 2019 07:04:42 -0700 (PDT) From: Dmitry Osipenko To: Daniel Lezcano , Thierry Reding , Jonathan Hunter , Peter De Schrijver Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 8/8] clocksource/drivers/tegra: Set up maximum-ticks limit properly Date: Tue, 18 Jun 2019 17:03:58 +0300 Message-Id: <20190618140358.13148-9-digetx@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190618140358.13148-1-digetx@gmail.com> References: <20190618140358.13148-1-digetx@gmail.com> MIME-Version: 1.0 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org Tegra's timer has 29 bits for the counter and for the "load" register which sets counter to a load-value. The counter's value is lower than the actual value by 1 because it starts to decrement after one tick, hence the maximum number of ticks that hardware can handle equals to 29 bits + 1. Signed-off-by: Dmitry Osipenko Acked-by: Jon Hunter Acked-by: Thierry Reding --- drivers/clocksource/timer-tegra.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/clocksource/timer-tegra.c b/drivers/clocksource/timer-tegra.c index b84324288749..355b29ff6362 100644 --- a/drivers/clocksource/timer-tegra.c +++ b/drivers/clocksource/timer-tegra.c @@ -137,9 +137,17 @@ static int tegra_timer_setup(unsigned int cpu) irq_force_affinity(to->clkevt.irq, cpumask_of(cpu)); enable_irq(to->clkevt.irq); + /* + * Tegra's timer uses n+1 scheme for the counter, i.e. timer will + * fire after one tick if 0 is loaded and thus minimum number of + * ticks is 1. In result both of the clocksource's tick limits are + * higher than a minimum and maximum that hardware register can + * take by 1, this is then taken into account by set_next_event + * callback. + */ clockevents_config_and_register(&to->clkevt, timer_of_rate(to), 1, /* min */ - 0x1fffffff); /* 29 bits */ + 0x1fffffff + 1); /* max 29 bits + 1 */ return 0; }