From patchwork Fri Feb 17 10:29:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Longchamp X-Patchwork-Id: 729142 X-Patchwork-Delegate: scottwood@freescale.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vPq8T133Cz9s7r for ; Fri, 17 Feb 2017 21:32:09 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3vPq8T0GdvzDqJp for ; Fri, 17 Feb 2017 21:32:09 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-de.keymile.com (mail-de.keymile.com [195.8.104.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3vPq660CH7zDq5x for ; Fri, 17 Feb 2017 21:30:05 +1100 (AEDT) Received: from secmail.keymile.com ([195.8.104.201]:34394 helo=totemomail) by mail-de.keymile.com with smtp (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1cefnV-0005dD-2r; Fri, 17 Feb 2017 11:29:53 +0100 Received: from 10.9.1.54 ([10.9.1.54]) by secmail.keymile.com (Totemo SMTP Server) with SMTP ID 65; Fri, 17 Feb 2017 11:30:48 +0100 (CET) Received: from ch10650.keymile.net (ch10650.keymile.net [172.31.40.247]) by mailrelay.keymile.net (8.12.2/8.12.2) with ESMTP id v1HAToMq026502; Fri, 17 Feb 2017 11:29:52 +0100 (MET) From: Valentin Longchamp To: linuxppc-dev@lists.ozlabs.org, qiang.zhao@nxp.com Subject: [PATCH 2/3] soc/fsl/qe: only apply QE_General4 workaround on affected SoCs Date: Fri, 17 Feb 2017 11:29:46 +0100 Message-Id: <1487327387-26370-3-git-send-email-valentin.longchamp@keymile.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487327387-26370-1-git-send-email-valentin.longchamp@keymile.com> References: <1487327387-26370-1-git-send-email-valentin.longchamp@keymile.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: oss@buserror.net, Valentin Longchamp Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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). Similalry to what was done in commit 8ce795cb0c6b ("i2c: mpc: assign the correct prescaler from SVR") in order to avoid changes in the device tree nodes of the QE (with maybe a variant of the compatible property), the PVR reg is read out to find out if the workaround must be applied or not. Signed-off-by: Valentin Longchamp --- drivers/soc/fsl/qe/qe.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/soc/fsl/qe/qe.c b/drivers/soc/fsl/qe/qe.c index 03874df..b66157fc 100644 --- a/drivers/soc/fsl/qe/qe.c +++ b/drivers/soc/fsl/qe/qe.c @@ -202,6 +202,9 @@ unsigned int qe_get_brg_clk(void) } EXPORT_SYMBOL(qe_get_brg_clk); +#define PVR_VER_836x 0x8083 +#define PVR_VER_832x 0x8084 + /* Program the BRG to the given sampling rate and multiplier * * @brg: the BRG, QE_BRG1 - QE_BRG16 @@ -228,8 +231,9 @@ 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 (!div16 && (divisor & 1) && (divisor > 3)) - divisor++; + if (pvr_version_is(PVR_VER_836x) || pvr_version_is(PVR_VER_832x)) + if (!div16 && (divisor & 1) && (divisor > 3)) + divisor++; tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) | QE_BRGC_ENABLE | div16;