Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp335068iol; Thu, 9 Jun 2022 04:59:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxi2Knw5rwpcVlLpoAdvfOai4lDf9TSufGgc6tZtwSuFCwsQn1ei36kcNrVon27WuyeqopE X-Received: by 2002:a17:903:187:b0:166:4360:a4fa with SMTP id z7-20020a170903018700b001664360a4famr37111503plg.87.1654775981220; Thu, 09 Jun 2022 04:59:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654775981; cv=none; d=google.com; s=arc-20160816; b=hQCgeekUTYrifKN/pqseGuP9tAu3oDrT95AmlZTsQB1FJUA6HpyJlOHE6SDsft2pMH iRlIrgxlVy720SnUHf6gSw9o79BW9XSvWPfC4s4UN/0ycD8tsSmYeDT+WYMgdsJp9boa dUmJLEkoH2MfCF/V1R13WwXaOBP2vAwxfmYgxukuVSiO38pQ+9u3pacivtHjDoUB7hsF GocPCE2J7C8l6PlshGgZ0n4znmHMxPnc4j/j5VOkuh0wDpl61gshZCTvs8Lew2OzyqTA mKkBXPyyfh0alII2MInD6q1RGOfs23UWNdtvejLuUrPg6X7so1hwQyXCIxXJKxTwKlOi xiZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=H+8MIR1OuQsaVNfsbihNB9tS+9/wynO4WohspQZNd1M=; b=jiJDtmIW7S0F9io1LVbi7HbkLuPtpS6OdXcLhVsk7hAzX5EPnJAe66L79iEEmTIYG8 t/vMus/hmmBoK3Er4fpMwLN2Qx8bSepYx9nBWNnHrOZPzKdUbU/nhfsvl/bvwm0AkaQz zUwi7CfLbifcOphQ2SHh7PFoEGNyDXF6DD3x2/7w0u3YrhshFhB46nlcFDjim8u/AZdw lMNBmuEaVnYJ3wpC2w8i55Le4mjug1RQp6AGtD2DuSgaKxEF13wzC1Dn9wSoElhRnp4r NuExO0bsESK4E+bDWqginSTpdTn65n8TEhJl7XcOFM7BM1EJHqt3bbCdbdwqL14Cduda rdvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=TQv2zrl7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j69-20020a638048000000b00401a213a5f7si962794pgd.231.2022.06.09.04.59.28; Thu, 09 Jun 2022 04:59:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=TQv2zrl7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243798AbiFIL2C (ORCPT + 99 others); Thu, 9 Jun 2022 07:28:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243694AbiFIL1r (ORCPT ); Thu, 9 Jun 2022 07:27:47 -0400 Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B98016A53E; Thu, 9 Jun 2022 04:27:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1654774066; x=1686310066; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=H+8MIR1OuQsaVNfsbihNB9tS+9/wynO4WohspQZNd1M=; b=TQv2zrl7+pSMh/Rq0arQ6pQbgTCWIgYIXG/RO8NVuPCq9WuCIIXYEuns sv9275G2um0dMO4febVH3LBbgF8RF04sZofN2dgWdfUi0uFAopgVm7MJC sLxLHEUYy7oU8FELxnFdO0lrd4oxQKk05vSGh8AFrtYeMYwN1lAKBKtpR HyaSERHvGBtQwyajTfKhD0GSJnIobOzPeZhywa3atfRrIVSa+eLfyxKnd 9zar1OKhHjiKiKW4UDCa2cNOYQFKK5nXMxF8tQFXM26YWd2uXmnnoafXY Pk+hB82hLiGQ3evmRKDhxJXeksx9bDyZlC2wcy/mGkRVuz4cDPlHv2AO/ Q==; From: Vincent Whitchurch To: , , CC: , Vincent Whitchurch , , , , , , Subject: [PATCH v4 2/4] clocksource/drivers/exynos_mct: Support frc-shared property Date: Thu, 9 Jun 2022 13:27:36 +0200 Message-ID: <20220609112738.359385-3-vincent.whitchurch@axis.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609112738.359385-1-vincent.whitchurch@axis.com> References: <20220609112738.359385-1-vincent.whitchurch@axis.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the FRC is shared with another main processor, the other processor is assumed to have started it and this processor should not write to the global registers. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Vincent Whitchurch --- Notes: v4: - Add Krzysztof's Reviewed-by. v3: - Split FRC sharing handling from local timer indices handling - Remove addition of global variable. drivers/clocksource/exynos_mct.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c index f29c812b70c9..12023831dedf 100644 --- a/drivers/clocksource/exynos_mct.c +++ b/drivers/clocksource/exynos_mct.c @@ -233,9 +233,16 @@ static cycles_t exynos4_read_current_timer(void) } #endif -static int __init exynos4_clocksource_init(void) +static int __init exynos4_clocksource_init(bool frc_shared) { - exynos4_mct_frc_start(); + /* + * When the frc is shared, the main processer should have already + * turned it on and we shouldn't be writing to TCON. + */ + if (frc_shared) + mct_frc.resume = NULL; + else + exynos4_mct_frc_start(); #if defined(CONFIG_ARM) exynos4_delay_timer.read_current_timer = &exynos4_read_current_timer; @@ -605,6 +612,7 @@ static int __init exynos4_timer_interrupts(struct device_node *np, static int __init mct_init_dt(struct device_node *np, unsigned int int_type) { + bool frc_shared = of_property_read_bool(np, "samsung,frc-shared"); int ret; ret = exynos4_timer_resources(np); @@ -615,10 +623,17 @@ static int __init mct_init_dt(struct device_node *np, unsigned int int_type) if (ret) return ret; - ret = exynos4_clocksource_init(); + ret = exynos4_clocksource_init(frc_shared); if (ret) return ret; + /* + * When the FRC is shared with a main processor, this secondary + * processor cannot use the global comparator. + */ + if (frc_shared) + return ret; + return exynos4_clockevent_init(); } -- 2.34.1