From patchwork Thu Aug 11 07:58:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 596644 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp667466maz; Thu, 11 Aug 2022 04:48:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR5eyjPbefE7AdqEBLv4EZGKFcdCyK7jdBui/JXsM0BLaVx87I7utgtFKYsyEYoWTNPcFuAj X-Received: by 2002:a02:c801:0:b0:343:4578:8a0 with SMTP id p1-20020a02c801000000b00343457808a0mr2986047jao.97.1660218481339; Thu, 11 Aug 2022 04:48:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660218481; cv=none; d=google.com; s=arc-20160816; b=ebM6OBzVHMNRHJQZp5NgAmws96v84+Elv/LfxPKrPP7qQbK5ytDfyCMlaPKld/QgOp 7ItKLGGirigxqOS7xRH+KS+QaU5QWtADkiwsDn5bPjFSX2J1O5W/LEAma/RdUiaShLZ2 mx/8hRPLbzKZwWBMCBosaXNkG/X5BxfD0RCrCIXuAjw+6mog/eXDbtl/wDUN0UgN7QpT 74B0LZQpQOmqZWg3EWUJ6amfJx3V3sdlT0HgNxhypg8GbUTFDoI2ySVQQAn2q7S40ieb Fyj9XEQYKyfaR4VhMZAZFlPgMKmWXWBEG2V8FWg8GDpyFZS5q+hyrTYV0ZtqaFNuCF1I db9Q== 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=9FNaeLXd2hvaVirVZVwrcyvdhUgSsTwoIV49KdfNmpw=; b=K2jraJHsl8sU9LDdmoRiS2UAS8hJnZooFaK656VLllQ2vrSw1TaHMIA8/jI7euoGOi HK7CCNFZ2d6Pbl9NughDx0MJVgZGfjlojw3qfqzmiHI26skSuFCUr5jY8pjwA37lOkpO O6ZrctfWLbomtUjYp91NmXmaEyoxKGyDqKc0uW/rOuSOe+1iDZ5CJIJEyrtbrErt4n+8 K44ELlJoMHoaNqwLF7YVbxKwPZhn2cwD9rf3RbKqjtIE5wgw8sp/UyhsPb6/5mYhpgwr 5/foY0V+PegRS2tg5yVYcPKn24rpEMOnoxFTmnkYwhGA4GYOp/56NKZzerz9KA25/ueJ uESQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AKoDxDzJ; 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=kernel.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a12-20020a056e02180c00b002de032e001esi7426718ilv.117.2022.08.11.04.48.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 04:48:01 -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=@kernel.org header.s=k20201202 header.b=AKoDxDzJ; 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=kernel.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A54DE84926; Thu, 11 Aug 2022 13:47:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.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=kernel.org header.i=@kernel.org header.b="AKoDxDzJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 79240845A5; Thu, 11 Aug 2022 09:59:01 +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.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B8C06841D2 for ; Thu, 11 Aug 2022 09:58:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=lee@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5EB0E614EE; Thu, 11 Aug 2022 07:58:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59A2AC433B5; Thu, 11 Aug 2022 07:58:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660204736; bh=Hke2cx2Ssl5DwKxwy5eLjpGyQ6C6uKBM9rNYQst8cxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AKoDxDzJl5+kEv5lrjevRiPv4qHUPOylB82IhhzlyIEqVCUVih/x3Kl2qD1ZYZYQN iqP14OneMOB2ItHSRKrHFLTucuJ+fmkBy7efZ2YyY3tE3ZXctMPsHt5ukf+J1ZrQaW 1q7tnufs+gsElmZ8ZtkXqGUEk6wTCzDHVXzqAv8OU/t5wzoXrv2ybCKtFOYXx83/zn CZOg2bA4w3CDUYwLiQTzRXfpXVlfvbqJaQRG3FTcitqnK5sjusNOo/7CFihbWgBmN/ k0HP/ozX43t9UPaloa1RJmx1kyvayEx01Ay4VEim3KmMO7SGt56eL87if9V/YIJuLE 40p35OU1Bqdkg== From: Lee Jones To: u-boot@lists.denx.de, sjg@chromium.org, philipp.tomsich@vrull.eu, kever.yang@rock-chips.com Cc: Lee Jones , Xavier Drudis Ferran Subject: [PATCH 1/3] ram: rk3399: Fix .set_rate_index() error handling Date: Thu, 11 Aug 2022 08:58:46 +0100 Message-Id: <20220811075848.1791050-2-lee@kernel.org> X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog In-Reply-To: <20220811075848.1791050-1-lee@kernel.org> References: <20220811075848.1791050-1-lee@kernel.org> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 11 Aug 2022 13:47:22 +0200 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 Functions pointed to by this op pointer can return non-zero values indicating an error. Ensure any error value is propagated back up the call-chain. Signed-off-by: Lee Jones Tested-by: Xavier Drudis Ferran Reviewed-by: Kever Yang --- drivers/ram/rockchip/sdram_rk3399.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index c0a06dcaed..0af0fa9e7b 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -3005,7 +3005,9 @@ static int sdram_init(struct dram_info *dram, params->base.stride = calculate_stride(params); dram_all_config(dram, params); - dram->ops->set_rate_index(dram, params); + ret = dram->ops->set_rate_index(dram, params); + if (ret) + return ret; debug("Finish SDRAM initialization...\n"); return 0; From patchwork Thu Aug 11 07:58:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 596645 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp667609maz; Thu, 11 Aug 2022 04:48:15 -0700 (PDT) X-Google-Smtp-Source: AA6agR77OJSlOXm4wIlC/DRjXbJUFlgp8nzzSHol0GDcVnXK4azQDZR9YcSH904yZZ0H6wtEToD8 X-Received: by 2002:a05:6638:bd5:b0:343:4b89:a5a1 with SMTP id g21-20020a0566380bd500b003434b89a5a1mr2338171jad.297.1660218495321; Thu, 11 Aug 2022 04:48:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660218495; cv=none; d=google.com; s=arc-20160816; b=mPjuqyUjJeXagZNryrbTUMn9rlnIqusV9LChWHPDrOC92jz9iEVDGghLulv9VVdjeR peG4hGEr3u3IGa4DGl+NiRxjbPfguREQsr9vh1RoJo/pln333WHAAjQgvt8JBduMwO/+ +H3gixF5Fj5enwfYAZd34Aq7MJ5vNMBnprKFRQ8sVFJaz8USzRMib+XujfTyHhf1sbdc GtTdzkoJq3bYfaIh3PwWE7kafbfvkRqdrrFHzFDRPd63NfdMYNGb+Z2/hXPu7aAF8mXf hABlCD3Jbhhen6E0ljkJ+dHG0t4mq4xD5BWgYUtJ7A7SqMYlbihmxEdYjQ8h9LxZE6an Q/dA== 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=De5WgU5aJQYHE2Njd0rDLx91j68N7zWAZQzAo/Q3X9Q=; b=vNCKo2WB9uZm7piJOVeBbhGk31zdPCrWHuce2kpqBJFf53on+JzTojb8Z/0OVj5gD7 0iPfoXC6+OFOvxqdMVzhiGdB95V7QqcO2yXTnaAxuJ/HkXzUqxFt2YbwEooOvz9Rfais cPOi4rpjlAN8AFAbSGJEJh5Xn/Jxo7C+lsp2zHedfwESM5yScOj1mEPacsVnFoiOKb36 chibr9AAVX1FIjajY+2zLRS6kSW3z4y6DT8IjE888BM+/F9UuFLPjCJpd8RFuX9oov7r O/2NOABkNZeoEod+Z2HAaD5Oxri79NYGWcmZZvpKSOyYNJZyhVIadjlowF1YuANpew1E WsTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=j+VSddM5; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id b9-20020a023809000000b003413e4b1b32si15557766jaa.101.2022.08.11.04.48.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 04:48:15 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=j+VSddM5; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A4B8B84936; Thu, 11 Aug 2022 13:47:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.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=kernel.org header.i=@kernel.org header.b="j+VSddM5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DFC89848EF; Thu, 11 Aug 2022 09:59:04 +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.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8CF61814BD for ; Thu, 11 Aug 2022 09:59:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=lee@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 348BD61531; Thu, 11 Aug 2022 07:58:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35E14C433D7; Thu, 11 Aug 2022 07:58:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660204738; bh=VQHc4obXkFebMiF4EAolIqRkYTY+y3hKFK59s4wAUUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j+VSddM55uxzBllC8AdHZi3b+A8TDWJD0p5taGnTUkrPC8wmSjsN1IB46HAccTFD3 cBPPNji4AOfl/KQo753MYD3iRL3v5VnqDWdADYa2IFKCWX8c16NJL42s1ZpY54O8FD DfRfT+wKNcnTC8F9+bDtJG51uJe2rRpZYXH4xwrQtI/YYYjNMQBQPOoEVYAmjaGm9b oRzse04adxqOQWy/kruUHUfthvtgfDQKhGWb11VcXbVZk6vZ+BFWiUCxaCderi1Pp9 j48IiXPZcEtua53Heaxh2ITrhKZTy5pAjDdED7Dwc31jcziaigdtJ68ZsaAK2MPAV7 gJHCeRooh6Ayg== From: Lee Jones To: u-boot@lists.denx.de, sjg@chromium.org, philipp.tomsich@vrull.eu, kever.yang@rock-chips.com Cc: Lee Jones , Xavier Drudis Ferran Subject: [PATCH 2/3] ram: rk3399: Fix faulty frequency change reports Date: Thu, 11 Aug 2022 08:58:47 +0100 Message-Id: <20220811075848.1791050-3-lee@kernel.org> X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog In-Reply-To: <20220811075848.1791050-1-lee@kernel.org> References: <20220811075848.1791050-1-lee@kernel.org> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 11 Aug 2022 13:47:22 +0200 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 Frequency changes to 400MHz are presently reported as: lpddr4_set_rate_0: change freq to 400000000 mhz 0, 1 This is obviously wrong by 6 orders of magnitude. Ensure frequency changes are reported accurately. Signed-off-by: Lee Jones Tested-by: Xavier Drudis Ferran Reviewed-by: Kever Yang --- drivers/ram/rockchip/sdram_rk3399.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index 0af0fa9e7b..34d6c93f95 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -2552,8 +2552,8 @@ static int lpddr4_set_rate(struct dram_info *dram, dfs_cfgs_lpddr4[ctl_fn].base.ddr_freq); if (IS_ENABLED(CONFIG_RAM_ROCKCHIP_DEBUG)) - printf("%s: change freq to %d mhz %d, %d\n", __func__, - dfs_cfgs_lpddr4[ctl_fn].base.ddr_freq, + printf("%s: change freq to %dMHz %d, %d\n", __func__, + dfs_cfgs_lpddr4[ctl_fn].base.ddr_freq / MHz, ctl_fn, phy_fn); } From patchwork Thu Aug 11 07:58:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 596646 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp667714maz; Thu, 11 Aug 2022 04:48:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR4PWE+noALkqL7OUrB6dUP9dzk6IzpDz+530FrC13WQfeDVMIBfJ8XU3UrvE4/ICVjHqC7F X-Received: by 2002:a05:6638:328d:b0:342:ec2f:4960 with SMTP id f13-20020a056638328d00b00342ec2f4960mr9804425jav.19.1660218507706; Thu, 11 Aug 2022 04:48:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660218507; cv=none; d=google.com; s=arc-20160816; b=M/fnoo4yV94gzmG6V94t+CJ8ETTpdHR9EpmNnpVwCFOXRwPb92bf2BhoPdl4A1SW/t mvDl89xqU92U5x+lA69HG83POzp29vYogozYVi0/i34f86Rq0Nv9uAgo0FUe722YXnQU KUdRyDNQ5CYvkpF5KXiUUwqn6Vf+V0UhKrVKLNWOqdnxdOatRdpwqkhLvCINp/TtjzNW TcCuhn6Z9g4DBEeULvPMsUSPi87pfzvJAXip69hrb+Ig08RUZx8no5csjz8L8GKNjqas +UTJoAeQc1kRtjOK1xHynuDI3jhabTLNqeBtznkjEkyiBfregy3nX3i4mnCF8254Kxzl 5MHQ== 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=onEE0EOcGjtS0GpZORXKOmcojH0HiMspGsBQVC02tfE=; b=hrK+J7RR0ByKO9Ts3SqIVhD+Z3umfa14PyPljXEtSGEet2lRGhCxPL/+nbb+7ldLSR gg+JBP7niNC57avFw3VTDowfqKak1+PDWfZF282PRMFNxmXqG3PcRT+25ccnZ3NT2roB 0xPlKQtRdZ8QjsQqpFeq0QXCaTvecOzg862QwHEQgQ68cFXLaDuNDgKkL6HQKrH3yQC1 w2WsvxUihVA/epQJapLC3o4FDgxWobiejDPgv8YSky6/QpeFzoRuJ4ieReLv0XhxbIm/ P5N+HhbvKtGJQmfNQna0Z3nWCN4nSj0zZGesDhaZq/MBH3gxrEPuPq+GsjDDfa3dyNp4 QVhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tQNVxoh9; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id ct3-20020a056638488300b003434b7de75bsi2883007jab.158.2022.08.11.04.48.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 04:48:27 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tQNVxoh9; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3C71084943; Thu, 11 Aug 2022 13:47:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.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=kernel.org header.i=@kernel.org header.b="tQNVxoh9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9209C841D2; Thu, 11 Aug 2022 09:59:08 +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.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3FEE3841D2 for ; Thu, 11 Aug 2022 09:59:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=lee@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3131761275; Thu, 11 Aug 2022 07:59:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E573C43470; Thu, 11 Aug 2022 07:58:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660204740; bh=H6R3SsuugGKQEqBMSwPhNSzMjYlbm/a1Qbe4xHaO4Mw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tQNVxoh9Awpjq1eavSLjPNNFfQl1Okv1RDmbp7u2F07dgZ/WlSQrTQCwTArdKdSu8 GeNAxe5pAr8ukK+88mLfsgslISA+O5t00va18tVPsDfRtoMZ1dxtyxkGCdb/98y3A0 X/5tzuzGXQ0VvHZ23QNeqWJCXLfk7I5jx0bJFd0ukz/ylslzqPNbA/Z6vFjLPDiAY8 yGSTaCABGHqwPCWQvrF/l0XKa4OkOrFcXcE3MLiVZYUkaGn47B21uPon91SsyZ5gj2 CU1BHvrDvaJF/rvoAgCYucKsmj0Cm+qY3kEheid/xgfhvFLSP8lrMCoblNGNs60kKk tkhLT1u5ectYA== From: Lee Jones To: u-boot@lists.denx.de, sjg@chromium.org, philipp.tomsich@vrull.eu, kever.yang@rock-chips.com Cc: Lee Jones , YouMin Chen , Xavier Drudis Ferran Subject: [PATCH 3/3] ram: rk3399: Conduct memory training at 400MHz Date: Thu, 11 Aug 2022 08:58:48 +0100 Message-Id: <20220811075848.1791050-4-lee@kernel.org> X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog In-Reply-To: <20220811075848.1791050-1-lee@kernel.org> References: <20220811075848.1791050-1-lee@kernel.org> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 11 Aug 2022 13:47:22 +0200 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 Currently the default initialisation frequency is 50MHz. Although this does appear to be suitable for some LPDDR4 RAM chips, training at this low frequency has been seen to cause Column errors, leading to Capacity check errors on others. Here we force RAM initialisation to happen at 400MHz before ramping up to the final value running value of 800MHz after everything has been successfully configured. Link: https://lore.kernel.org/u-boot/Yo4v3jUeHXTovjOH@google.com/ Suggested-by: YouMin Chen Signed-off-by: Lee Jones Tested-by: Xavier Drudis Ferran Reviewed-by: Kever Yang Tested-by: Michal Suchánek --- drivers/ram/rockchip/sdram_rk3399.c | 36 +++++++++++++++++------------ 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index 34d6c93f95..b05c5925d5 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -85,7 +85,7 @@ struct sdram_rk3399_ops { int (*data_training_first)(struct dram_info *dram, u32 channel, u8 rank, struct rk3399_sdram_params *sdram); int (*set_rate_index)(struct dram_info *dram, - struct rk3399_sdram_params *params); + struct rk3399_sdram_params *params, u32 ctl_fn); void (*modify_param)(const struct chan_info *chan, struct rk3399_sdram_params *params); struct rk3399_sdram_params * @@ -1644,7 +1644,8 @@ static int data_training_first(struct dram_info *dram, u32 channel, u8 rank, } static int switch_to_phy_index1(struct dram_info *dram, - struct rk3399_sdram_params *params) + struct rk3399_sdram_params *params, + u32 unused) { u32 channel; u32 *denali_phy; @@ -2539,26 +2540,25 @@ static int lpddr4_set_ctl(struct dram_info *dram, } static int lpddr4_set_rate(struct dram_info *dram, - struct rk3399_sdram_params *params) + struct rk3399_sdram_params *params, + u32 ctl_fn) { - u32 ctl_fn; u32 phy_fn; - for (ctl_fn = 0; ctl_fn < 2; ctl_fn++) { - phy_fn = lpddr4_get_phy_fn(params, ctl_fn); + phy_fn = lpddr4_get_phy_fn(params, ctl_fn); - lpddr4_set_phy(dram, params, phy_fn, &dfs_cfgs_lpddr4[ctl_fn]); - lpddr4_set_ctl(dram, params, ctl_fn, - dfs_cfgs_lpddr4[ctl_fn].base.ddr_freq); + lpddr4_set_phy(dram, params, phy_fn, &dfs_cfgs_lpddr4[ctl_fn]); + lpddr4_set_ctl(dram, params, ctl_fn, + dfs_cfgs_lpddr4[ctl_fn].base.ddr_freq); - if (IS_ENABLED(CONFIG_RAM_ROCKCHIP_DEBUG)) - printf("%s: change freq to %dMHz %d, %d\n", __func__, - dfs_cfgs_lpddr4[ctl_fn].base.ddr_freq / MHz, - ctl_fn, phy_fn); - } + if (IS_ENABLED(CONFIG_RAM_ROCKCHIP_DEBUG)) + printf("%s: change freq to %dMHz %d, %d\n", __func__, + dfs_cfgs_lpddr4[ctl_fn].base.ddr_freq / MHz, + ctl_fn, phy_fn); return 0; } + #endif /* CONFIG_RAM_RK3399_LPDDR4 */ /* CS0,n=1 @@ -2955,6 +2955,12 @@ static int sdram_init(struct dram_info *dram, params->ch[ch].cap_info.rank = rank; } +#if defined(CONFIG_RAM_RK3399_LPDDR4) + /* LPDDR4 needs to be trained at 400MHz */ + lpddr4_set_rate(dram, params, 0); + params->base.ddr_freq = dfs_cfgs_lpddr4[0].base.ddr_freq / MHz; +#endif + params->base.num_channels = 0; for (channel = 0; channel < 2; channel++) { const struct chan_info *chan = &dram->chan[channel]; @@ -3005,7 +3011,7 @@ static int sdram_init(struct dram_info *dram, params->base.stride = calculate_stride(params); dram_all_config(dram, params); - ret = dram->ops->set_rate_index(dram, params); + ret = dram->ops->set_rate_index(dram, params, 1); if (ret) return ret;