From patchwork Tue Mar 30 22:59:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Salvaterra X-Patchwork-Id: 1460276 X-Patchwork-Delegate: daniel@makrotopia.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=rZ3BMWqf; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=FabPKqUo; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F94k36Zvkz9sWK for ; Wed, 31 Mar 2021 10:03:23 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=oEfU0N565RxgsKxQS2hW2pb3UyLNngy26IDvVGnDhiA=; b=rZ3BMWqf/8dKZwYPaP6816K27 h485zqlQs6N/W7ftT8dmNbr6Kwf7zLHCAE7byutcxrqU4PGsMpG8cky1TGUjReXL2kdgUpkAXKqrD Y42JGzHx/jCrvORk9hoM/I0pXvzqA05S/3WYAW8ygFdqpmn7pn74apWQxrrTxKtso3rHtn7vujU/J tU+dLqP6hhyrIIQRFhNW8zTWFvaUfaSfUnapoe9d0C7j5yIr2FZVGSDuA54G1kqr/9VjhgNH5oNkH QRjwUQl44abwDO17bI+XO+cU119uOqoFBkxdE/L1KltQrLXjF8rJ1vY0RErOZpQUHkA2oEapTNKS5 icyPSK5vw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lRNLa-0053bA-AC; Tue, 30 Mar 2021 23:00:30 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lRNL2-0053Vx-Bg for openwrt-devel@lists.openwrt.org; Tue, 30 Mar 2021 22:59:58 +0000 Received: by mail-wm1-x32d.google.com with SMTP id r10-20020a05600c35cab029010c946c95easo199093wmq.4 for ; Tue, 30 Mar 2021 15:59:56 -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=hAhKL/Votf/72OIb8EQvw1i0k5ixsjj21skSXmFP5L8=; b=FabPKqUo96hTb8Hv8v3uMi4bofjj4bm0dUzJ8jfpAOEJcw/YnyDrT/+FVMdjKHnCtg aep4RWgM+t4ol0/6mwypy7W/stv3VJqGJynkBy3xIne3DYUzFEDyWgxe7R4B+50YNAPa ThZLt2hLEG+ioq/YAhFLB/J9YSd3wy3U7qS1kkfNq4oZ9eDuVmtiPH+AEJeVxZNn5/Ix Y2NLCosl12B6IRv7u9ih1iBaeDUtAFGLqLC/ddsBsL8Zq8Kjny6XBta12kg7fD/f4asI p6viLL2Tlj61CkYsP+jjDiaxRiy9pObcVBWhwFbMcwP0EDPFdv0j9DD7ZXY1P/Vr/Sq3 adXQ== 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=hAhKL/Votf/72OIb8EQvw1i0k5ixsjj21skSXmFP5L8=; b=XLIqEpUmYv91YyYIHOrZrQ2c1wHIPnedklJwZ39e6bXhb/TdMCx3hnqeqmKv1IY/mR +T1mL5F4PYBLm/e/ewBd1SzqC1o2XnvkUDoXKdIKCG621UhnOc/0GwOcGTbojQnkhgIk qLTDiZ6OtguHoUpGnts4B9T171tBuZfbYa3gCbyNF4MNy5iNrCuln8EileL9vCmt2g6c HTFy41cBOiZx7C2jwK/fVwzAeaZdf7VwHzoz9DRZFc61C9x8dyYUzMXMJJocXXJdMHkE 7LCRml08RKBTsk2veX5gx2rR34kkS88sAClXKAyzywQMgmKEWXeoMQFWu8qMK+rxSQVK wSiw== X-Gm-Message-State: AOAM531oEGrv9Makg9HyyfAZvc8OYpFXRQPa0pp7Fk3ibh09LxJk3kPz zhxhVhk44eO23ZIMjsQsDgvD7wRAgqRM X-Google-Smtp-Source: ABdhPJyd1nTNAG2XjM8NaBV4xpBwkOeoSY7CsqTL2469Ymei8m00+G0BgBonBBefDXKeg7pp4ET4Ww== X-Received: by 2002:a1c:9d96:: with SMTP id g144mr300357wme.46.1617145195802; Tue, 30 Mar 2021 15:59:55 -0700 (PDT) Received: from mallard.lan (a95-94-147-174.cpe.netcabo.pt. [95.94.147.174]) by smtp.gmail.com with ESMTPSA id n7sm559463wrv.71.2021.03.30.15.59.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Mar 2021 15:59:55 -0700 (PDT) From: Rui Salvaterra To: openwrt-devel@lists.openwrt.org Cc: john@phrozen.org, daniel@makrotopia.org, ilya.lipnitskiy@gmail.com, grommish@gmail.com, henrique@nic.br, Rui Salvaterra Subject: [PATCH v2 2/3] ramips/mt7621: drop the timer recalibration patch Date: Tue, 30 Mar 2021 23:59:49 +0100 Message-Id: <20210330225950.838688-3-rsalvaterra@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210330225950.838688-1-rsalvaterra@gmail.com> References: <20210330225950.838688-1-rsalvaterra@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210330_235957_076091_10F7C1A6 X-CRM114-Status: GOOD ( 14.86 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: We've been carrying this patch for many years [1], in order to fix a timer calibration issue on MT7621. Turns out, after retesting with a recent kernel (Linux 5.10), the system works perfectly fine wi [...] Content analysis details: (-0.2 points, 5.0 required) 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:32d listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [rsalvaterra[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org We've been carrying this patch for many years [1], in order to fix a timer calibration issue on MT7621. Turns out, after retesting with a recent kernel (Linux 5.10), the system works perfectly fine without it (no rcu_sched stalls or inconsistent BogoMIPS values across CPUs). Manually refreshed: 322-mt7621-fix-cpu-clk-add-clkdev.patch 323-mt7621-memory-detect.patch [1] https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=6f4a903533361a2906a4d94ac6f597cd9c6c47bc Suggested-by: Ilya Lipnitskiy Tested-by: Donald Hoskins Signed-off-by: Rui Salvaterra --- .../patches-5.10/321-mt7621-timer.patch | 87 ------------------- .../322-mt7621-fix-cpu-clk-add-clkdev.patch | 10 +-- .../323-mt7621-memory-detect.patch | 10 +-- 3 files changed, 10 insertions(+), 97 deletions(-) delete mode 100644 target/linux/ramips/patches-5.10/321-mt7621-timer.patch diff --git a/target/linux/ramips/patches-5.10/321-mt7621-timer.patch b/target/linux/ramips/patches-5.10/321-mt7621-timer.patch deleted file mode 100644 index 08d5935eb0..0000000000 --- a/target/linux/ramips/patches-5.10/321-mt7621-timer.patch +++ /dev/null @@ -1,87 +0,0 @@ ---- a/arch/mips/ralink/mt7621.c -+++ b/arch/mips/ralink/mt7621.c -@@ -9,6 +9,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -16,6 +17,7 @@ - #include - #include - #include -+#include - - #include - -@@ -161,6 +163,58 @@ bool plat_cpu_core_present(int core) - return true; - } - -+#define LPS_PREC 8 -+/* -+* Re-calibration lpj(loop-per-jiffy). -+* (derived from kernel/calibrate.c) -+*/ -+static int udelay_recal(void) -+{ -+ unsigned int i, lpj = 0; -+ unsigned long ticks, loopbit; -+ int lps_precision = LPS_PREC; -+ -+ lpj = (1<<12); -+ -+ while ((lpj <<= 1) != 0) { -+ /* wait for "start of" clock tick */ -+ ticks = jiffies; -+ while (ticks == jiffies) -+ /* nothing */; -+ -+ /* Go .. */ -+ ticks = jiffies; -+ __delay(lpj); -+ ticks = jiffies - ticks; -+ if (ticks) -+ break; -+ } -+ -+ /* -+ * Do a binary approximation to get lpj set to -+ * equal one clock (up to lps_precision bits) -+ */ -+ lpj >>= 1; -+ loopbit = lpj; -+ while (lps_precision-- && (loopbit >>= 1)) { -+ lpj |= loopbit; -+ ticks = jiffies; -+ while (ticks == jiffies) -+ /* nothing */; -+ ticks = jiffies; -+ __delay(lpj); -+ if (jiffies != ticks) /* longer than 1 tick */ -+ lpj &= ~loopbit; -+ } -+ printk(KERN_INFO "%d CPUs re-calibrate udelay(lpj = %d)\n", NR_CPUS, lpj); -+ -+ for(i=0; i< NR_CPUS; i++) -+ cpu_data[i].udelay_val = lpj; -+ -+ return 0; -+} -+device_initcall(udelay_recal); -+ - void prom_soc_init(struct ralink_soc_info *soc_info) - { - void __iomem *sysc = (void __iomem *) KSEG1ADDR(MT7621_SYSC_BASE); ---- a/arch/mips/ralink/Kconfig -+++ b/arch/mips/ralink/Kconfig -@@ -62,6 +62,7 @@ choice - select CLKSRC_MIPS_GIC - select HAVE_PCI if PCI_MT7621 - select SOC_BUS -+ select GENERIC_CLOCKEVENTS_BROADCAST - endchoice - - choice diff --git a/target/linux/ramips/patches-5.10/322-mt7621-fix-cpu-clk-add-clkdev.patch b/target/linux/ramips/patches-5.10/322-mt7621-fix-cpu-clk-add-clkdev.patch index 723c628790..be5fee54b2 100644 --- a/target/linux/ramips/patches-5.10/322-mt7621-fix-cpu-clk-add-clkdev.patch +++ b/target/linux/ramips/patches-5.10/322-mt7621-fix-cpu-clk-add-clkdev.patch @@ -36,10 +36,10 @@ #define MT7621_DDR2_SIZE_MAX 256 --- a/arch/mips/ralink/mt7621.c +++ b/arch/mips/ralink/mt7621.c -@@ -10,6 +10,10 @@ +@@ -9,6 +9,10 @@ + #include #include #include - #include +#include +#include +#include @@ -47,15 +47,15 @@ #include #include -@@ -18,6 +22,7 @@ +@@ -16,6 +20,7 @@ + #include #include #include - #include +#include #include -@@ -108,11 +113,89 @@ static struct rt2880_pmx_group mt7621_pi +@@ -106,11 +111,89 @@ static struct rt2880_pmx_group mt7621_pi { 0 } }; diff --git a/target/linux/ramips/patches-5.10/323-mt7621-memory-detect.patch b/target/linux/ramips/patches-5.10/323-mt7621-memory-detect.patch index 07c7588661..9f80d02638 100644 --- a/target/linux/ramips/patches-5.10/323-mt7621-memory-detect.patch +++ b/target/linux/ramips/patches-5.10/323-mt7621-memory-detect.patch @@ -44,10 +44,10 @@ Signed-off-by: Chuanhong Guo #define MT7621_CHIP_NAME1 0x20203132 --- a/arch/mips/ralink/mt7621.c +++ b/arch/mips/ralink/mt7621.c -@@ -10,11 +10,13 @@ +@@ -9,11 +9,13 @@ + #include #include #include - #include +#include #include #include @@ -58,7 +58,7 @@ Signed-off-by: Chuanhong Guo #include #include #include -@@ -57,6 +59,8 @@ +@@ -55,6 +57,8 @@ #define MT7621_GPIO_MODE_SDHCI_SHIFT 18 #define MT7621_GPIO_MODE_SDHCI_GPIO 1 @@ -67,7 +67,7 @@ Signed-off-by: Chuanhong Guo static struct rt2880_pmx_func uart1_grp[] = { FUNC("uart1", 0, 1, 2) }; static struct rt2880_pmx_func i2c_grp[] = { FUNC("i2c", 0, 3, 2) }; static struct rt2880_pmx_func uart3_grp[] = { -@@ -141,6 +145,26 @@ static struct clk *__init mt7621_add_sys +@@ -139,6 +143,26 @@ static struct clk *__init mt7621_add_sys return clk; } @@ -94,7 +94,7 @@ Signed-off-by: Chuanhong Guo void __init ralink_clk_init(void) { u32 syscfg, xtal_sel, clkcfg, clk_sel, curclk, ffiv, ffrac; -@@ -346,10 +370,7 @@ void prom_soc_init(struct ralink_soc_inf +@@ -292,10 +316,7 @@ void prom_soc_init(struct ralink_soc_inf (rev >> CHIP_REV_VER_SHIFT) & CHIP_REV_VER_MASK, (rev & CHIP_REV_ECO_MASK));