Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp2486596ybx; Fri, 8 Nov 2019 05:07:00 -0800 (PST) X-Google-Smtp-Source: APXvYqykElhg6CVG49Lbou+R6OFxG5Y0epRAGGvzyML4PdHA0xSjjCIRAczgO9qCbkvbkhRaKXaQ X-Received: by 2002:a17:906:6a8e:: with SMTP id p14mr8573239ejr.137.1573218420394; Fri, 08 Nov 2019 05:07:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573218420; cv=none; d=google.com; s=arc-20160816; b=gnP3zR1aIkgWwLCOgxnb6By5R93no9d3iDobigA8YVvBpWUCk4junIRwwDnQCnqiWF FoWibgKw/iEzMeib2ylKjo4Hvf+HPSB2OOKBQMN2NSDIzc/sXr2BC9X6pVxnIk1wBLbu N4sfhNVOnMSZDKC5xTuE8tjK8jeFe0Z5mbgBNOLyPAnBY7JeS5WAcHFGsycB9z8jX8/M BDrJc68Ks2hjcipHiAtjZam2ZhoNI5NO13zMf5LW+Sp+yDHd3hKxE8mXi77kF8Tyfu06 XpJn/INSJ0HpaegFG6slAWB/EwK/RPSJtnFa23COVPoyxbud/KnqLLNBOkxXcRNzftid g4PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KU/n1Q/VNXJbWwIQys/qt9rGcT4PXz5RLqrj6x2UwvM=; b=TwLmG5FjSG/MoC/h5jncrUS7cmY+0QfQCGvNLZGLVWO8KZJhZYchIBF+QuVoJYqUJp zxYk/unP22oneunoc2cPeGsSbjNJvRre0+n+Orl7RHH2sEqMWCWDgTOuZkMNRZbmk7FL 86i9jnBEc9omLVHVZIkX4xUS3dAKyv+N+7gwz3pv12qi8JaoIjFsnO9RB28mP0Olevk0 mgxUmV4Rxf+Cm8cxXkRodZ6i9zXfHzWKpaCsi0F3g7ui1Fc5J7eYQ9VrF1WXnF7vs3sW FbaC+FQqvlzRZGWXhkFwupIxMu5R+2djOyHBleNAxabayyaCpG+Gvk3R7hby2P55UgeM tBcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=HJOJZkxw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pw16si3575791ejb.119.2019.11.08.05.06.36; Fri, 08 Nov 2019 05:07:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=HJOJZkxw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728488AbfKHNEd (ORCPT + 99 others); Fri, 8 Nov 2019 08:04:33 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:39982 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727528AbfKHNBk (ORCPT ); Fri, 8 Nov 2019 08:01:40 -0500 Received: by mail-lf1-f65.google.com with SMTP id f4so4412002lfk.7 for ; Fri, 08 Nov 2019 05:01:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KU/n1Q/VNXJbWwIQys/qt9rGcT4PXz5RLqrj6x2UwvM=; b=HJOJZkxwDS0medOsmpThvkVAMPgReePyoCZfeE53ipRTRMDB0W6c5pAuf6ddW16YzH bTOd+bBAagLh5RkQgulpK6Rx2eot8KegFwHr4WplwoCtgkFmTv4Kl1wWcO7q9ySV5I6z pMMrXUWvpVqVoyCYDeiFszP4vKVSXYmeRZehM= 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=KU/n1Q/VNXJbWwIQys/qt9rGcT4PXz5RLqrj6x2UwvM=; b=SOkcPCszbXFAxpkqxXFGPwzKC90hC5IIF6xLXVBTHil7dLW9MRiBY7GBhW748kvw+t 6vr9fKD1QHRhXn6Yiku0rrmSVUr0OO9IbqqEJ0jLnJzDgU44bwdiA1FexjQsZnosaDA2 RvFISUD7PF5BwOu3fOGtwbB5KzBYnUV0k5Wd864oAHS8f91ALYq75gFc85V+J4rJA3aY PAvHb/NtbR7Zi/2bqKOwSaEdjrRmtimYVaYB4CKoIQordkPoYJTkdK3x8UgH/Md/RIET YLoDsmlwZK5UcjXNY9SvwSRX/wk7P3FiJtCaDQrY6eADDsqg191PpchLb+HFhuMC61PZ xplA== X-Gm-Message-State: APjAAAUZK8X2Wfx9H/sgpJVnwCWTUaKy/kIS/85FGG8ni4njZ7EYiC3Q RKDqeURzaS86KoyshT1ULvTnhmhPYwTx0km9 X-Received: by 2002:a19:5e53:: with SMTP id z19mr6167585lfi.111.1573218096769; Fri, 08 Nov 2019 05:01:36 -0800 (PST) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id d28sm2454725lfn.33.2019.11.08.05.01.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2019 05:01:36 -0800 (PST) From: Rasmus Villemoes To: Qiang Zhao , Li Yang , Christophe Leroy Cc: linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Scott Wood , Rasmus Villemoes Subject: [PATCH v4 07/47] soc: fsl: qe: qe.c: guard use of pvr_version_is() with CONFIG_PPC32 Date: Fri, 8 Nov 2019 14:00:43 +0100 Message-Id: <20191108130123.6839-8-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191108130123.6839-1-linux@rasmusvillemoes.dk> References: <20191108130123.6839-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit e5c5c8d23fef (soc/fsl/qe: only apply QE_General4 workaround on affected SoCs) introduced use of pvr_version_is(), saying The QE_General4 workaround is only valid for the MPC832x and MPC836x SoCs. The other SoCs that embed a QUICC engine are not affected by this hardware bug and thus can use the computed divisors (this was successfully tested on the T1040). I'm reading the above as saying that the errata does not apply to the ARM-based SOCs with QUICC engine. In any case, use of pvr_version_is() must be guarded by CONFIG_PPC32 before we can remove the PPC32 dependency from CONFIG_QUICC_ENGINE, so introduce qe_general4_errata() to keep the necessary #ifdeffery localized to a trivial helper. Signed-off-by: Rasmus Villemoes --- drivers/soc/fsl/qe/qe.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/soc/fsl/qe/qe.c b/drivers/soc/fsl/qe/qe.c index 85737e6f5b62..1d8aa62c7ddf 100644 --- a/drivers/soc/fsl/qe/qe.c +++ b/drivers/soc/fsl/qe/qe.c @@ -197,6 +197,14 @@ EXPORT_SYMBOL(qe_get_brg_clk); #define PVR_VER_836x 0x8083 #define PVR_VER_832x 0x8084 +static bool qe_general4_errata(void) +{ +#ifdef CONFIG_PPC32 + return pvr_version_is(PVR_VER_836x) || pvr_version_is(PVR_VER_832x); +#endif + return false; +} + /* Program the BRG to the given sampling rate and multiplier * * @brg: the BRG, QE_BRG1 - QE_BRG16 @@ -223,7 +231,7 @@ int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier) /* Errata QE_General4, which affects some MPC832x and MPC836x SOCs, says that the BRG divisor must be even if you're not using divide-by-16 mode. */ - if (pvr_version_is(PVR_VER_836x) || pvr_version_is(PVR_VER_832x)) + if (qe_general4_errata()) if (!div16 && (divisor & 1) && (divisor > 3)) divisor++; -- 2.23.0