Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E5DF1C433F5 for ; Fri, 14 Jan 2022 03:38:42 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 12B0683325; Fri, 14 Jan 2022 04:38:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="RrKRiXqz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 718EB832EA; Thu, 13 Jan 2022 22:57:27 +0100 (CET) Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 25ACA832CF for ; Thu, 13 Jan 2022 22:57:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=dario.binacchi@amarulasolutions.com Received: by mail-ed1-x530.google.com with SMTP id m4so28010310edb.10 for ; Thu, 13 Jan 2022 13:57:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=CJlN5wZYTgMnPsotdef0PLAZbV79AJhxlP+R2o0wIDM=; b=RrKRiXqzg9tdU58+OWBrOLTdndkjDEWCi5Hbvf7U1Rq9s6Yn0exi6J6NHf2W4zufiM 7tzFyJ+oqIkF+7JkJ1w/oeqh1zH5UfFgB6YPtOlXyUtzsS3q1PnWwQ5QikDmTcUIoYZ9 0yjyyJUyVJ6jKiXnwrkkRnCXxVXsvAovWRbgk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=CJlN5wZYTgMnPsotdef0PLAZbV79AJhxlP+R2o0wIDM=; b=S0MCilL2NZMaS+TQVprMKwH9PZWcbVzjrGb37T44Bb4aFo8pfhovcUa8xVtsUIFKLs qHRGu3ArMqlzPNNddmWp3sXZRrjrp7ywYYmYBU6rRmk6V0zTUuI1GqP94Fp8dDZwDlJm 3oKotphCajTRQz41Vx/DlHREqG94NXKjdkjIjMknxwkTP5JkatskUjnuC285Olj28IxA //ikVl3Dn+AFrT1u2shrChsZBdoHkKlOdyhujQQvQeLeLQwe97hzH53UEKKewxtdLsTh UUWKPjWb52Dg1MRZVVKQan6/o6l5M+2wOu9E2F/g23QPuwe3lDdXt13Re2Zs4UtwmX5m IZGQ== X-Gm-Message-State: AOAM532uylAD8BiVk8x1g9P989j6NFNf4V2FG0NN7elV6g2r/Mb/Nl9D rKXbbKtI3ObdqWsOimUc/OQL9J1YzSqcKA== X-Google-Smtp-Source: ABdhPJz3DJommwqzu98Hv/ZIljSC/JRRg/2XjpGNdIfUKAx+wC32y4vN7VFm4TLkJBTPsXh9bqRaCw== X-Received: by 2002:a05:6402:22a1:: with SMTP id cx1mr1178739edb.282.1642111040482; Thu, 13 Jan 2022 13:57:20 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-82-52-8-210.retail.telecomitalia.it. [82.52.8.210]) by smtp.gmail.com with ESMTPSA id lb10sm1272032ejc.148.2022.01.13.13.57.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jan 2022 13:57:20 -0800 (PST) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Michael Trimarchi , Dario Binacchi , Bai Ping , Fabio Estevam , "NXP i.MX U-Boot Team" , Peng Fan , Sean Anderson , Stefano Babic Subject: [PATCH 1/2] imx: mx6ull: fix REFTOP_VBGADJ setting Date: Thu, 13 Jan 2022 22:57:03 +0100 Message-Id: <20220113215704.121003-1-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Fri, 14 Jan 2022 04:38:29 +0100 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean The previous code wrote the contents of the fuse as is in the REFTOP_VBGADJ[2:0], but this was wrong if you consider the contents of the table in the code comment. This table is also different from the table in the commit description. But then, which of the two is correct? If it is assumed that an unprogrammed fuse has a value of 0 then for backward compatibility of the code REFTOP_VBGADJ[2:0] must be set to 6 (b'110). Therefore, the table in the code comment can be considered correct as well as this patch. Fixes: 97c16dc8bf098 ("imx: mx6ull: update the REFTOP_VBGADJ setting") Signed-off-by: Dario Binacchi --- arch/arm/mach-imx/mx6/soc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c index aacfc854a2f8..099cb5b12d77 100644 --- a/arch/arm/mach-imx/mx6/soc.c +++ b/arch/arm/mach-imx/mx6/soc.c @@ -366,11 +366,13 @@ static void init_bandgap(void) * 111 - set REFTOP_VBGADJ[2:0] to 3b'111, */ if (is_mx6ull()) { + static const u32 map[] = {6, 1, 2, 3, 4, 5, 0, 7}; + val = readl(&fuse->mem0); val >>= OCOTP_MEM0_REFTOP_TRIM_SHIFT; val &= 0x7; - writel(val << BM_ANADIG_ANA_MISC0_REFTOP_VBGADJ_SHIFT, + writel(map[val] << BM_ANADIG_ANA_MISC0_REFTOP_VBGADJ_SHIFT, &anatop->ana_misc0_set); } } -- 2.32.0