From patchwork Wed Feb 17 11:07:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrea Merello X-Patchwork-Id: 12091287 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43F3DC433DB for ; Wed, 17 Feb 2021 11:09:04 +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 D1A8B64D73 for ; Wed, 17 Feb 2021 11:09:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D1A8B64D73 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.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=A2aH8uV33ZkBqmnzZwsJPor61bUHJDeXEuAc+vosb8Q=; b=qZIFwFrQLUAAw909j5R60pnoF 4aKgsrpIFd/R7jbzXRlDB41GjNBahn9UX/gq0qslgRWFEfLdCv4/n/0UVHJoHdWCH2ACDM8TFd8jV w4WeFQgEIGvKZj90KO0h11DxTyHRbiWJtywzCOITjKZJOSNmiwAa0sW49Z7hxnaS27iZAeC85Jgvu OUBiczFnvevPS6C8bfDl9qSqkNE4vRbV7lRWqLD4iblvcH+JXYXbqrZzh/BiunFkKt+iQxTpHaJ4U apN82La0gZfwFCoHCDZtd9azBVlm7qYELRFsS51AqxiHl/cYP1yVUdfk3d6TbCQ3zTgJZsmx2qqPx 7ENFSHkLg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lCKg5-0007wM-2C; Wed, 17 Feb 2021 11:07:29 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lCKft-0007si-Ee for linux-arm-kernel@lists.infradead.org; Wed, 17 Feb 2021 11:07:18 +0000 Received: by mail-wm1-x333.google.com with SMTP id o24so3237361wmh.5 for ; Wed, 17 Feb 2021 03:07:15 -0800 (PST) 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=cVPq1afpL+Nx1c4ld2fK0O1zMPM373avRcTwFbh6f9A=; b=DLpwgcPJvpyXjVOz5J2+lCjBNHYb8JiW6WMSzqH1F0mfxmC41rBToK9eH8FskVdACa 2izvgeyuyYLtM0trv4A/gFBCFYyPBGjeUYro56HaMm0Djo1dOcIttyJTUdEA+gz4CNQ/ 7qroTVKHptgk89iULLx2mgXkoKABixQupgUu3jgpiBiAM4h4TNT9zzUDOeP6LathOr/D wbQJ9h4mQFzYJ+nXTJmBfYjL/gugeHSj2ysGp8+ri7OrlxLnQxEDqqeXGRMJz7oKhsu+ TwOI3JMlVu2USZI4b7eMamp9wmlW+bhBwbBIo2pbmdi3URehUWaa7t/4ZtG7i7Hu9o9Y 1qjQ== 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=cVPq1afpL+Nx1c4ld2fK0O1zMPM373avRcTwFbh6f9A=; b=DWbNuBA4vlTIWm2fHDMwy0P6ejdk13vxqbNR0eAS168juNUJ7ymA8OpA3xVvMSydZR Xbu0v5GVCN8ZfBRkQo0gqdS1u9yJxqs1tQierZ7OPZRKdZd0gBZvU3jc5jEss1J9QBpZ BMvVQlwZrnoS48rjP/7mm/HftJW2P1wLVhBnWEfgJETaH36WXtE5q6dGvVtYWmvnhrLI 9Gg0/plWUFZxmEZD2CJGJH87ePsCpHfExKD68VclHA4hDsbxIZKdWUxSCp1Bgt88AEWp SLiIDdv8B02guPdILiX745QfJsIZaDAehWkhaiEi8TMUz0pLX0G+BXWWL1kVLW37fYEX CcZg== X-Gm-Message-State: AOAM530Ms8s1wUHP+hhRalGsqYB0LktpLaMWYzjq574Lf3ClLDVP3+7Z C7QzgjI5Aq4GcMuAyGTEsQc= X-Google-Smtp-Source: ABdhPJxaFGN9NIiQNq09M/wNJHpqcdsYBQzvntl9MFrwItO+uQTHYkbdV9zUbcc7HTmWK9QMjFLw7Q== X-Received: by 2002:a1c:6308:: with SMTP id x8mr6765384wmb.78.1613560034767; Wed, 17 Feb 2021 03:07:14 -0800 (PST) Received: from poker.lan (static.2-229-210-222.ip198.fastwebnet.it. [2.229.210.222]) by smtp.gmail.com with ESMTPSA id y1sm3594073wrr.41.2021.02.17.03.07.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Feb 2021 03:07:14 -0800 (PST) From: Andrea Merello To: tglx@linutronix.de, daniel.lezcano@linaro.org Subject: [PATCH 1/2] clocksource: arm_global_timer: implement rate compensation whenever source clock changes Date: Wed, 17 Feb 2021 12:07:08 +0100 Message-Id: <20210217110709.17250-2-andrea.merello@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210217110709.17250-1-andrea.merello@gmail.com> References: <20210217110709.17250-1-andrea.merello@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210217_060717_575654_95785A45 X-CRM114-Status: GOOD ( 30.52 ) 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: Andrea Merello , linux-kernel@vger.kernel.org, Michal Simek , Patrice Chotard , linux-arm-kernel@lists.infradead.org, =?utf-8?q?S=C3=B6ren_Brinkmann?= Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patch adds rate change notification support for the parent clock; should that clock change, then we try to adjust the our prescaler in order to compensate (i.e. we adjust to still get the same timer frequency). This is loosely based on what it's done in timer-cadence-ttc. timer-sun51, mips-gic-timer and smp_twd.c also seem to look at their parent clock rate and to perform some kind of adjustment whenever needed. In this particular case we have only one single counter and prescaler for all clocksource, clockevent and timer_delay, and we just update it for all (i.e. we don't let it go and call clockevents_update_freq() to notify to the kernel that our rate has changed). Note that, there is apparently no other way to fixup things, because once we call register_current_timer_delay(), specifying the timer rate, it seems that that rate is not supposed to change ever. In order for this mechanism to work, we have to make assumptions about how much the initial clock is supposed to eventually decrease from the initial one, and set our initial prescaler to a value that we can eventually decrease enough to compensate. We provide an option in KConfig for this. In case we end up in a situation in which we are not able to compensate the parent clock change, we fail returning NOTIFY_BAD. This fixes a real-world problem with Zynq arch not being able to use this driver and CPU_FREQ at the same time (because ARM global timer is fed by the CPU clock, which may keep changing when CPU_FREQ is enabled). Signed-off-by: Andrea Merello Cc: Patrice Chotard Cc: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: Michal Simek Cc: Sören Brinkmann --- drivers/clocksource/Kconfig | 13 +++ drivers/clocksource/arm_global_timer.c | 122 +++++++++++++++++++++++-- 2 files changed, 125 insertions(+), 10 deletions(-) diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index 14c7c4712478..0f1c625275a0 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -385,6 +385,19 @@ config ARM_GLOBAL_TIMER help This option enables support for the ARM global timer unit. +config ARM_GT_INITIAL_PRESCALER_VAL + int "ARM global timer initial prescaler value" + default 1 + depends on ARM_GLOBAL_TIMER + help + When the ARM global timer initializes, its current rate is declared + to the kernel and maintained forever. Should it's parent clock + change, the driver tries to fix the timer's internal prescaler. + On some machs (i.e. Zynq) the initial prescaler value thus poses + bounds about how much the parent clock is allowed to decrease or + increase wrt the initial clock value. + This affects CPU_FREQ max delta from the initial frequency. + config ARM_TIMER_SP804 bool "Support for Dual Timer SP804 module" if COMPILE_TEST depends on GENERIC_SCHED_CLOCK && CLKDEV_LOOKUP diff --git a/drivers/clocksource/arm_global_timer.c b/drivers/clocksource/arm_global_timer.c index 88b2d38a7a61..60a8047fd32e 100644 --- a/drivers/clocksource/arm_global_timer.c +++ b/drivers/clocksource/arm_global_timer.c @@ -31,6 +31,10 @@ #define GT_CONTROL_COMP_ENABLE BIT(1) /* banked */ #define GT_CONTROL_IRQ_ENABLE BIT(2) /* banked */ #define GT_CONTROL_AUTO_INC BIT(3) /* banked */ +#define GT_CONTROL_PRESCALER_SHIFT 8 +#define GT_CONTROL_PRESCALER_MAX 0xF +#define GT_CONTROL_PRESCALER_MASK (GT_CONTROL_PRESCALER_MAX << \ + GT_CONTROL_PRESCALER_SHIFT) #define GT_INT_STATUS 0x0c #define GT_INT_STATUS_EVENT_FLAG BIT(0) @@ -39,6 +43,7 @@ #define GT_COMP1 0x14 #define GT_AUTO_INC 0x18 +#define MAX_F_ERR 50 /* * We are expecting to be clocked by the ARM peripheral clock. * @@ -46,7 +51,8 @@ * the units for all operations. */ static void __iomem *gt_base; -static unsigned long gt_clk_rate; +struct notifier_block gt_clk_rate_change_nb; +static u32 gt_psv_new, gt_psv_bck, gt_target_rate; static int gt_ppi; static struct clock_event_device __percpu *gt_evt; @@ -96,7 +102,10 @@ static void gt_compare_set(unsigned long delta, int periodic) unsigned long ctrl; counter += delta; - ctrl = GT_CONTROL_TIMER_ENABLE; + ctrl = readl(gt_base + GT_CONTROL); + ctrl &= ~(GT_CONTROL_COMP_ENABLE | GT_CONTROL_IRQ_ENABLE | + GT_CONTROL_AUTO_INC | GT_CONTROL_AUTO_INC); + ctrl |= GT_CONTROL_TIMER_ENABLE; writel_relaxed(ctrl, gt_base + GT_CONTROL); writel_relaxed(lower_32_bits(counter), gt_base + GT_COMP0); writel_relaxed(upper_32_bits(counter), gt_base + GT_COMP1); @@ -123,7 +132,7 @@ static int gt_clockevent_shutdown(struct clock_event_device *evt) static int gt_clockevent_set_periodic(struct clock_event_device *evt) { - gt_compare_set(DIV_ROUND_CLOSEST(gt_clk_rate, HZ), 1); + gt_compare_set(DIV_ROUND_CLOSEST(gt_target_rate, HZ), 1); return 0; } @@ -177,7 +186,7 @@ static int gt_starting_cpu(unsigned int cpu) clk->cpumask = cpumask_of(cpu); clk->rating = 300; clk->irq = gt_ppi; - clockevents_config_and_register(clk, gt_clk_rate, + clockevents_config_and_register(clk, gt_target_rate, 1, 0xffffffff); enable_percpu_irq(clk->irq, IRQ_TYPE_NONE); return 0; @@ -232,9 +241,28 @@ static struct delay_timer gt_delay_timer = { .read_current_timer = gt_read_long, }; +static void gt_write_presc(u32 psv) +{ + u32 reg; + + reg = readl(gt_base + GT_CONTROL); + reg &= ~GT_CONTROL_PRESCALER_MASK; + reg |= psv << GT_CONTROL_PRESCALER_SHIFT; + writel(reg, gt_base + GT_CONTROL); +} + +static u32 gt_read_presc(void) +{ + u32 reg; + + reg = readl(gt_base + GT_CONTROL); + reg &= GT_CONTROL_PRESCALER_MASK; + return reg >> GT_CONTROL_PRESCALER_SHIFT; +} + static void __init gt_delay_timer_init(void) { - gt_delay_timer.freq = gt_clk_rate; + gt_delay_timer.freq = gt_target_rate; register_current_timer_delay(>_delay_timer); } @@ -243,18 +271,81 @@ static int __init gt_clocksource_init(void) writel(0, gt_base + GT_CONTROL); writel(0, gt_base + GT_COUNTER0); writel(0, gt_base + GT_COUNTER1); - /* enables timer on all the cores */ - writel(GT_CONTROL_TIMER_ENABLE, gt_base + GT_CONTROL); + /* set prescaler and enable timer on all the cores */ + writel(((CONFIG_ARM_GT_INITIAL_PRESCALER_VAL - 1) << + GT_CONTROL_PRESCALER_SHIFT) + | GT_CONTROL_TIMER_ENABLE, gt_base + GT_CONTROL); #ifdef CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK - sched_clock_register(gt_sched_clock_read, 64, gt_clk_rate); + sched_clock_register(gt_sched_clock_read, 64, gt_target_rate); #endif - return clocksource_register_hz(>_clocksource, gt_clk_rate); + return clocksource_register_hz(>_clocksource, gt_target_rate); +} + +static int gt_clk_rate_change_cb(struct notifier_block *nb, + unsigned long event, void *data) +{ + struct clk_notifier_data *ndata = data; + + switch (event) { + case PRE_RATE_CHANGE: + { + int psv; + + psv = DIV_ROUND_CLOSEST(ndata->new_rate, + gt_target_rate); + + if (abs(gt_target_rate - (ndata->new_rate / psv)) > MAX_F_ERR) + return NOTIFY_BAD; + + psv--; + + /* prescaler within legal range? */ + if (psv < 0 || psv > GT_CONTROL_PRESCALER_MAX) + return NOTIFY_BAD; + + /* + * store timer clock ctrl register so we can restore it in case + * of an abort. + */ + gt_psv_bck = gt_read_presc(); + gt_psv_new = psv; + /* scale down: adjust divider in post-change notification */ + if (ndata->new_rate < ndata->old_rate) + return NOTIFY_DONE; + + /* scale up: adjust divider now - before frequency change */ + gt_write_presc(psv); + break; + } + case POST_RATE_CHANGE: + /* scale up: pre-change notification did the adjustment */ + if (ndata->new_rate > ndata->old_rate) + return NOTIFY_OK; + + /* scale down: adjust divider now - after frequency change */ + gt_write_presc(gt_psv_new); + break; + + case ABORT_RATE_CHANGE: + /* we have to undo the adjustment in case we scale up */ + if (ndata->new_rate < ndata->old_rate) + return NOTIFY_OK; + + /* restore original register value */ + gt_write_presc(gt_psv_bck); + break; + default: + return NOTIFY_DONE; + } + + return NOTIFY_DONE; } static int __init global_timer_of_register(struct device_node *np) { struct clk *gt_clk; + static unsigned long gt_clk_rate; int err = 0; /* @@ -292,11 +383,20 @@ static int __init global_timer_of_register(struct device_node *np) } gt_clk_rate = clk_get_rate(gt_clk); + gt_target_rate = gt_clk_rate / CONFIG_ARM_GT_INITIAL_PRESCALER_VAL; + gt_clk_rate_change_nb.notifier_call = + gt_clk_rate_change_cb; + err = clk_notifier_register(gt_clk, >_clk_rate_change_nb); + if (err) { + pr_warn("Unable to register clock notifier\n"); + goto out_clk; + } + gt_evt = alloc_percpu(struct clock_event_device); if (!gt_evt) { pr_warn("global-timer: can't allocate memory\n"); err = -ENOMEM; - goto out_clk; + goto out_clk_nb; } err = request_percpu_irq(gt_ppi, gt_clockevent_interrupt, @@ -326,6 +426,8 @@ static int __init global_timer_of_register(struct device_node *np) free_percpu_irq(gt_ppi, gt_evt); out_free: free_percpu(gt_evt); +out_clk_nb: + clk_notifier_unregister(gt_clk, >_clk_rate_change_nb); out_clk: clk_disable_unprepare(gt_clk); out_unmap: From patchwork Wed Feb 17 11:07:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrea Merello X-Patchwork-Id: 12091283 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 542D6C433E0 for ; Wed, 17 Feb 2021 11:08:40 +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 0460264E85 for ; Wed, 17 Feb 2021 11:08:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0460264E85 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.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=TPFM6M6udiGQ5NiIHLB0KAn6Cbn4nTCCyPV8Wanc8Xw=; b=DJUAo5KEQjbxRGt5L2IZXFPVf AxCluWalSmRo92GOIyiE8qC/UWsxgmQXxlk9Rs1cbBjwl24RYToLYJXaaxPIl/gaumdzZ2nprC73+ rXhSC1KBh4GbskaMFLsMWb/GVNVOT0x51S5y4hYOYrP6IbvKGc2YoAmO+C+/4WfurhCYIiORW+3fj H4yWXOj5nv4xJrLeg72Y5/aUTk1p8NHcX/mdYjmKmuRs+xusUZD/xnBvUgiDcUufh+oMZMcR8px5s xSKBzDs6CwolP6tydq+Gdu7KpNWU05H8aOj6Nz+nLQjIyAVztBAUvZW+tH0NXQuOzYJRrgSjcXK+N bjCkMzVMA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lCKfy-0007uh-Rc; Wed, 17 Feb 2021 11:07:22 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lCKfs-0007sq-Sr for linux-arm-kernel@lists.infradead.org; Wed, 17 Feb 2021 11:07:17 +0000 Received: by mail-wr1-x42c.google.com with SMTP id v1so16932260wrd.6 for ; Wed, 17 Feb 2021 03:07:16 -0800 (PST) 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=gB4/TxEWTY3nu4o41IxwOjPhWGPTj1512uvoivaNJ8M=; b=r5RbM/zCP3sSrFvaWvZBWDnjIJHatlFIwYLVnzrEFILcnamhYKFGsYWw8yaxIT6i2w MTsaj9VQMxpf3usK6RMQ4nCZPj7iKUjaCM9yfDT0cSg0kFmv0MvuXunMPHN72RNqpwH7 C8XuCrPP8RFVsCz+i9gKcwAdXqn2bAS0fBatPHCIfS7ifuuMPRoVF2/zELu4VCQzYIRz 0/FfNTMFjrYic/pCQGrj1J/Tc5PW4frwox7tsZmrZ7MV0NF90lqCzfZyi6BfE/nA4Y/b dw9ik5kFpjBwN4uxP8bKwCLe/nquHsYsv1eRdeBwyIpwpQRMViCFBdyQIEiNxBhPIWrv 10/w== 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=gB4/TxEWTY3nu4o41IxwOjPhWGPTj1512uvoivaNJ8M=; b=NFR/++ujd0vFpUOkGLNichPUgMdknlAC0nB3hvGwj4MrQ2YYvk309iCpJPC2NQJvL9 1tWuD8OVEVpqFhQU+kKMAF2+0hSxtOeMwrTS4xm3jRS4orVkbT7+Jmq0i2ekmeZMkFMd fJDRpdlz+tJqYz7e/rqUGywCLYXYaD4u4dw0MqDGmmgDa5oi/lD7Rer/Xaqm4iUUIdU5 MOciZ1u+gi/0o2C7gsKAR4k1ncPu2vaUbd25ztYySbbRlgN1lROBOER04fso+d/Qq9AI 9kahfkhm5MPnU99BxgACaAzbPbqSd70G1L44DUb62ba/UIruENz4KANtdxwKsP8Dwg6/ qhOQ== X-Gm-Message-State: AOAM5319jhKqa83YrlDP4feWmZUO4SRsb8h+0HrfYnEu8ucOwK8Y26wM SAQ2qNc7HKgpUGWgYyK7VOE= X-Google-Smtp-Source: ABdhPJw2Vuked6HhTFSq6EZVKhhzWn26rtNOhP+mvfOsfFXikaFfVFdnVlSBLZBZI7rfeDzXoN4e2Q== X-Received: by 2002:adf:f7c5:: with SMTP id a5mr29125950wrq.243.1613560035701; Wed, 17 Feb 2021 03:07:15 -0800 (PST) Received: from poker.lan (static.2-229-210-222.ip198.fastwebnet.it. [2.229.210.222]) by smtp.gmail.com with ESMTPSA id y1sm3594073wrr.41.2021.02.17.03.07.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Feb 2021 03:07:15 -0800 (PST) From: Andrea Merello To: tglx@linutronix.de, daniel.lezcano@linaro.org Subject: [PATCH 2/2] arm: zynq: don't disable CONFIG_ARM_GLOBAL_TIMER due to CONFIG_CPU_FREQ anymore Date: Wed, 17 Feb 2021 12:07:09 +0100 Message-Id: <20210217110709.17250-3-andrea.merello@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210217110709.17250-1-andrea.merello@gmail.com> References: <20210217110709.17250-1-andrea.merello@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210217_060716_944688_D2A941CB X-CRM114-Status: GOOD ( 14.21 ) 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: Andrea Merello , linux-kernel@vger.kernel.org, Michal Simek , Patrice Chotard , linux-arm-kernel@lists.infradead.org, =?utf-8?q?S=C3=B6ren_Brinkmann?= Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now ARM global timer driver could work even if it's source clock rate changes, so we don't need to disable that driver when cpu frequency scaling is in use. This cause Zynq arch to get support for timer delay and get_cycles(). Signed-off-by: Andrea Merello Cc: Patrice Chotard Cc: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: Michal Simek Cc: Sören Brinkmann --- arch/arm/mach-zynq/Kconfig | 2 +- drivers/clocksource/Kconfig | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig index 43fb941dcd07..a56748d671c4 100644 --- a/arch/arm/mach-zynq/Kconfig +++ b/arch/arm/mach-zynq/Kconfig @@ -6,7 +6,7 @@ config ARCH_ZYNQ select ARCH_SUPPORTS_BIG_ENDIAN select ARM_AMBA select ARM_GIC - select ARM_GLOBAL_TIMER if !CPU_FREQ + select ARM_GLOBAL_TIMER select CADENCE_TTC_TIMER select HAVE_ARM_SCU if SMP select HAVE_ARM_TWD if SMP diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index 0f1c625275a0..421cd763bdb2 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -387,6 +387,7 @@ config ARM_GLOBAL_TIMER config ARM_GT_INITIAL_PRESCALER_VAL int "ARM global timer initial prescaler value" + default 2 if ARCH_ZYNQ default 1 depends on ARM_GLOBAL_TIMER help