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 D0355C433EF for ; Mon, 31 Jan 2022 12:55:30 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 11E5C8366A; Mon, 31 Jan 2022 13:55:20 +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="H/k2DV48"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A55078091B; Mon, 31 Jan 2022 08:50:14 +0100 (CET) Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) (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 028D2820AE for ; Mon, 31 Jan 2022 08:50:12 +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-ej1-x62f.google.com with SMTP id a8so40043699ejc.8 for ; Sun, 30 Jan 2022 23:50:11 -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=H/k2DV48anH8CXmuUoC2jnyK9M50pI5rfywwc4Ap00/h5wu1JnaNRN9tUcCIN7oJFA ugRNk2SwnLmnyatvFgQeHEqu5icjklUWPF7ZGy8cuTVmWBTar9kxxOMptEbxSp4S7k3B TIuwlZHGQi9i4guF2Zzzgr+8ESh72w0ec4qnM= 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=kxxpPpCFPsVeU5Jf3ZDO/3c+5vo8U45PCRFI8epN5jJ3jMco19afvWbt2nVrvXZEWg 9Y9LOH35gtf+kSkw1VKzs9NLIVqS0NyVTgLByXJCNcwLnO6bST8ZEDD5v7bp6IFgot6X s7zXGWJhX824VJ+RtXOJtZRHkDcDwrj2mRHhs3Rslbe7zhz+HMJhPH4MWR3pLDVVRj2Y H2wMxgabrO4QrrGKYwKG4MIwhMJ9IPe+FUyPNUejdGG+vZ/D70cK3vDiX4ire2vcIez+ ys1eqz3dxUzF85ZV1GqjBOf+KMOXGRNauomwuLFfOx4s8Q2t44SAzwUx2QmRkXg7yJzV mD8g== X-Gm-Message-State: AOAM533zmceiHxWqNL3eriDvA5Jt4IaawQ1fLUc/hmH7fLNAossZr0LH /c9RGhdOtN2onOjofBuXFShkDhjDuwQFZw== X-Google-Smtp-Source: ABdhPJy6DiD7ZpqVrkaviQiJ7T0j3resTl5VT0UYWzl9HU4Q68o+Jj/lzVUG8zhJDM0HHPB2nTxVVA== X-Received: by 2002:a17:906:364f:: with SMTP id r15mr16456633ejb.473.1643615411366; Sun, 30 Jan 2022 23:50:11 -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 u3sm13259413ejz.99.2022.01.30.23.50.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 23:50:10 -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: [RESEND PATCH 1/2] imx: mx6ull: fix REFTOP_VBGADJ setting Date: Mon, 31 Jan 2022 08:50:05 +0100 Message-Id: <20220131075006.729221-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: Mon, 31 Jan 2022 13:55:18 +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.5 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