From patchwork Thu Oct 20 02:33:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Liu X-Patchwork-Id: 616705 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp695334pvb; Wed, 19 Oct 2022 19:34:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ggGiRzE+TJl9LCIuPr3D+ZYjBwFE43AXNbUu5KaRHktjHKwa+n5eSV9+0X+b3bpAd+V8V X-Received: by 2002:a17:90b:4a8d:b0:20d:402d:6153 with SMTP id lp13-20020a17090b4a8d00b0020d402d6153mr13642199pjb.44.1666233244005; Wed, 19 Oct 2022 19:34:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666233244; cv=none; d=google.com; s=arc-20160816; b=qgNXsuFzGnGj4v8ECZYLwjIgBI3C4K4PFwEwMJ+ay1MwyfgFEMnrcw+bZq18jYUMIS LaI3cZHEHPzGtKm09PTZC1I2IsAjQj5Txk8gDKtrcCH67w2WjzQ2EF3HIzwvB94bA3Bp MQFlYFokrnwkTFr0gJ0U8oMpxZNrg1LVcPAMtID/NRq0clBs12L8SArlvvZcy/QDdZ8S QbA7R1imHIGnaFYrAP+hMpL53yvaWsD9GKdf5LPXZigbw69y6AlWbPrulrPcYe+5Ur1V k9Ogl3xsBTydId9Idew/hvrAALD+GDWHJm8K0Ryo67S9MuawpegvLD+R1oDdEM9EU3zS QtmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wZdk3bBEjWfQVAsjSo9QAp6/j7me0efKTB3nlduZ454=; b=Cmu1fCd0bhHx5s0M2upYwzE165ahwevDqpEsBDMS4szxqRVv7oKKKIbLVdL51V8lRJ 6N2S6UpRMrtiThXc67Pa7Y5uohssS7BGQzxBbj8PLXxpCwiStklcCaqF5k8FF+fQ9p9j vLPZIhIP7SFSlVzQcxwn6SZy4SQxo137jW4TyvrCJs5Y2pDy1GOnOKiSSb36bTWIlBaD s5ygYaYMaoCO9uzBX7sU3B4QvK2QB9tBqKpE0bKKaFcyqCmob5sfNiJHJysTnMr63bSC qLvB6Kay9lQF/9iczQq2Apjxt2gPeG43T7qn+E4WRaX2JRR5AKcaeNO91vZ//qOERZC+ 91MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CsnUCrM+; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id nn2-20020a17090b38c200b00200934a5a53si1958724pjb.29.2022.10.19.19.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 19:34:03 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CsnUCrM+; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 30AAC84D85; Thu, 20 Oct 2022 04:33:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="CsnUCrM+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CB72684DE6; Thu, 20 Oct 2022 04:33:40 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) (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 BD8FE84D58 for ; Thu, 20 Oct 2022 04:33:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=paul.liu@linaro.org Received: by mail-pl1-x62c.google.com with SMTP id c24so19006001pls.9 for ; Wed, 19 Oct 2022 19:33:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wZdk3bBEjWfQVAsjSo9QAp6/j7me0efKTB3nlduZ454=; b=CsnUCrM+E2xWOYOQlJNzKB3Yybz3Z/raTGufGcLO1AApCukNzGpOU995ADdLKUQtSI yw2yVA+FmJyD7iiETbVhSaZuRXW7tYRuSItEfKE0B+wqhnzwZqZJjmODRkQM2+1cx89p YbDEfbkWV1wZuMzZnt2aqdtejVpGASrNpXy9OPRw+hK5gkmez3PgW0GwCiiNUKXSYQuk PVS2ZgjwZlItAn7TzJ9w6uwx/Z7VkTnUd4UC9JoB6tbF/AekB/UHM+KB/3+vpDVlJN4l tFwhzZImuXKRF1b2gvKIFshpM30eFTaLvmA4p//vNRV77B1umC2E3AKy8K0ONiucm/h+ 17ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wZdk3bBEjWfQVAsjSo9QAp6/j7me0efKTB3nlduZ454=; b=QuZggwcstQtnxFiuBp/hQh5QmQdT24YOspRxdLTwXmy1Ma+X7Q5Yr9+FeQIu295KUp YJMiOQU7+kSGJGczYhW20eLW2Kq4V3xn6q1Ieg89jdPuWbzc8b1zSudqLar4DiIzgwQy Ql3GJfWbc1GcapAg0Z2zAGGirwHBVwWVUGwyB5Me6zvDLRaij8iwnwtfsPIAdwmFRdWy NtyarM2pEJenu5rou5IVImut7sBUNqHwLWoaKD9QxOY7v6G5jwZch0J42NlPxF6ELI4S HY8hlyqvT5872IXBxzxGnY6ZLV4ooenjaa7T8a3WV9z2wjRxnk5CAJ5Wiy/85CbfVi9A i9iQ== X-Gm-Message-State: ACrzQf2bDEtndi/QxzTRQTbV2kmfR9Zx2PG+PT1AeiOy0MfjMEPeITrx xg+zvBhJVr6RVQ6Mch+RXcK4bGvlDnXe4UhS X-Received: by 2002:a17:902:d4c6:b0:184:6926:abbd with SMTP id o6-20020a170902d4c600b001846926abbdmr11760657plg.33.1666233215932; Wed, 19 Oct 2022 19:33:35 -0700 (PDT) Received: from localhost ([111.184.129.17]) by smtp.gmail.com with ESMTPSA id y69-20020a62ce48000000b0054124008c14sm12047178pfg.154.2022.10.19.19.33.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 19:33:35 -0700 (PDT) From: "Ying-Chun Liu (PaulLiu)" To: u-boot@lists.denx.de Cc: "Ying-Chun Liu (PaulLiu)" , Fabio Estevam , Marek Vasut , Peng Fan , Rasmus Villemoes , Stefano Babic , "NXP i . MX U-Boot Team" Subject: [PATCH 1/1] imx8m: ddr_init: fix reading of DDR4 MR registers Date: Thu, 20 Oct 2022 10:33:21 +0800 Message-Id: <20221020023321.476550-2-paul.liu@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221020023321.476550-1-paul.liu@linaro.org> References: <20221020023321.476550-1-paul.liu@linaro.org> MIME-Version: 1.0 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.6 at phobos.denx.de X-Virus-Status: Clean Accorting to commit 290ffe57886271a6 we need to read more significant bytes to get a non-zero value. However commit 7e9bd84883aeb1e2 removes it by accident. Thus we add the changes back. This is needed to let imx8mm-cl-iot-gate to boot correctly. Signed-off-by: Ying-Chun Liu (PaulLiu) Cc: Fabio Estevam Cc: Marek Vasut Cc: Peng Fan Cc: Rasmus Villemoes Cc: Stefano Babic Cc: NXP i.MX U-Boot Team --- drivers/ddr/imx/imx8m/ddr_init.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/ddr/imx/imx8m/ddr_init.c b/drivers/ddr/imx/imx8m/ddr_init.c index d964184ddc..7a683b1d36 100644 --- a/drivers/ddr/imx/imx8m/ddr_init.c +++ b/drivers/ddr/imx/imx8m/ddr_init.c @@ -134,8 +134,14 @@ unsigned int lpddr4_mr_read(unsigned int mr_rank, unsigned int mr_addr) tmp = reg32_read(DRC_PERF_MON_MRR0_DAT(0)); } while ((tmp & 0x8) == 0); tmp = reg32_read(DRC_PERF_MON_MRR1_DAT(0)); - tmp = tmp & 0xff; reg32_write(DRC_PERF_MON_MRR0_DAT(0), 0x4); + while (tmp) { // try to find a significant byte in the word + if (tmp & 0xff) { + tmp &= 0xff; + break; + } + tmp >>= 8; + } return tmp; }