From mboxrd@z Thu Jan 1 00:00:00 1970 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 7B9DDC53210 for ; Wed, 4 Jan 2023 21:31:10 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 674A485423; Wed, 4 Jan 2023 22:31:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="nLucYzmY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9750485301; Wed, 4 Jan 2023 22:31:04 +0100 (CET) Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) (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 2347581A10 for ; Wed, 4 Jan 2023 22:31:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jernej.skrabec@gmail.com Received: by mail-ej1-x629.google.com with SMTP id fc4so85698598ejc.12 for ; Wed, 04 Jan 2023 13:31:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=gaoPcOJDVgzmrUyyhxsb/akrCanK8kBJN6APhV/DPSk=; b=nLucYzmYUoZLaTSwIH/QRdkVWOBiroNBY3/duKggIPd+vAh5GCja502x++AMXBlz/5 745gqkLbSOePXUB9ltM9W2aKU5LUcBvnHpv7OidqjFAL29m40mI9ipFdFQgPtDRHpzXS xPdIWRHL0jdkmOc0HnhP4/2cle2vA6h+ZVsb/K6Q2+f8weGHkT3oyWSViNR+pfsYsN5G ChiyTG3rnAPUVrQzludCTPg2RPAjGdaiESE6Kj1jMFAUlJ50b+K+wuX4xz/PMbuY+Zrh 8wfrxAxISlJWuYpY8OC6cqFnhMXAaiV3svIy204i+Mo2tOmHGC6lNdLLpm/HLOeuzObv wh6Q== 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=gaoPcOJDVgzmrUyyhxsb/akrCanK8kBJN6APhV/DPSk=; b=v9iAHH7xpuSu+GwhBrxLHtyAraOCeUcAUyYvD+2wAuNLjjYIWq4+LDuovpaYsfBgsF GpwZhOYqZe0ZI4a5kgHeL3s5I2cwIBpir/SBNL3s6zWLXbcS/f/VhTI06v+Ge/Emju0h QceLD3ABI/m36X1+uIyCuUsticlQi/GkCkBNBIZDQuJauvWGVL/kMtB6+C/pq5wJVggi niFK9qBHFPOA4Qqe2kZOFC9cg9dMsz5G3D4ZlYBvpNZ5nCZ06WKNAzQsstZAxtM1wSBR nhIujrRwrecUsxjjmDxrFDOxIU/RWdWeUU5Rd5ubuSgzI38jKpnPQUSYPcMwGsv+ADe3 g08g== X-Gm-Message-State: AFqh2kqEW0n9okR7dWjRevzEtt1ENGx24ealpL4kLdt42Mn8UQ8MXKrk 7Qmj3t1GCmIUOlV8Ddy4C5w= X-Google-Smtp-Source: AMrXdXuHvFv/wf4TdlGmuyoZd6Q97Td6xq3CetM9YKO8amOh2iskJZF7hUEtIMcnz6INlKwwNfPLBg== X-Received: by 2002:a17:906:2813:b0:7c0:f9ef:23a2 with SMTP id r19-20020a170906281300b007c0f9ef23a2mr53541487ejc.30.1672867860737; Wed, 04 Jan 2023 13:31:00 -0800 (PST) Received: from jernej-laptop.localnet (82-149-19-102.dynamic.telemach.net. [82.149.19.102]) by smtp.gmail.com with ESMTPSA id g17-20020a17090604d100b007c16fdc93ddsm15670224eja.81.2023.01.04.13.30.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:31:00 -0800 (PST) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: Andre Przywara Cc: jagan@amarulasolutions.com, u-boot@lists.denx.de Subject: Re: [PATCH 8/8] sunxi: Parameterize H616 DRAM code some more Date: Wed, 04 Jan 2023 22:30:59 +0100 Message-ID: <3139771.5fSG56mABF@jernej-laptop> In-Reply-To: <20230104003812.3c35cb9c@slackpad.lan> References: <20221211163213.98540-1-jernej.skrabec@gmail.com> <20221211163213.98540-9-jernej.skrabec@gmail.com> <20230104003812.3c35cb9c@slackpad.lan> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 Dne sreda, 04. januar 2023 ob 01:38:12 CET je Andre Przywara napisal(a): > On Sun, 11 Dec 2022 17:32:13 +0100 > > Jernej Skrabec wrote: > > Part of the code, previously known as "unknown feature" also doesn't > > have constant values. They are derived from TPR0 parameter in vendor > > DRAM code. Introduce that parameter here too, to ease adding new boards. > > That seems to also miss the value for the OPi Zero2 defconfig. Again, Zero2 doesn't use all features. > > > Signed-off-by: Jernej Skrabec > > --- > > > > .../include/asm/arch-sunxi/dram_sun50i_h616.h | 1 + > > arch/arm/mach-sunxi/Kconfig | 6 ++++ > > arch/arm/mach-sunxi/dram_sun50i_h616.c | 35 +++++++++++++++---- > > 3 files changed, 35 insertions(+), 7 deletions(-) > > > > diff --git a/arch/arm/include/asm/arch-sunxi/dram_sun50i_h616.h > > b/arch/arm/include/asm/arch-sunxi/dram_sun50i_h616.h index > > c7890c83391f..ff736bd88d10 100644 > > --- a/arch/arm/include/asm/arch-sunxi/dram_sun50i_h616.h > > +++ b/arch/arm/include/asm/arch-sunxi/dram_sun50i_h616.h > > @@ -158,6 +158,7 @@ struct dram_para { > > > > u32 dx_dri; > > u32 ca_dri; > > u32 odt_en; > > > > + u32 tpr0; > > > > u32 tpr10; > > u32 tpr11; > > u32 tpr12; > > > > diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig > > index b050f0a56971..7858a7045f7e 100644 > > --- a/arch/arm/mach-sunxi/Kconfig > > +++ b/arch/arm/mach-sunxi/Kconfig > > @@ -73,6 +73,12 @@ config DRAM_SUN50I_H616_ODT_EN > > > > help > > > > ODT EN value from vendor DRAM settings. > > > > +config DRAM_SUN50I_H616_TPR0 > > + hex "H616 DRAM TPR0 parameter" > > + default 0x0 > > Is 0x0 really a feasible default value? I'd suggest we don't provide a > default, so force people to be prompted for a value, if nothing is in > (a new board's) defconfig. This is not used on all boards, so imo is ok to have it as default. Best regards, Jernej > > The rest looks OK, though I can't really comment on the actual bits - > but who can anyway ;-) > > Cheers, > Andre > > > + help > > + TPR0 value from vendor DRAM settings. > > + > > > > config DRAM_SUN50I_H616_TPR10 > > > > hex "H616 DRAM TPR10 parameter" > > help > > > > diff --git a/arch/arm/mach-sunxi/dram_sun50i_h616.c > > b/arch/arm/mach-sunxi/dram_sun50i_h616.c index df06cea42464..6d8f8d371bfe > > 100644 > > --- a/arch/arm/mach-sunxi/dram_sun50i_h616.c > > +++ b/arch/arm/mach-sunxi/dram_sun50i_h616.c > > @@ -808,15 +808,35 @@ static bool mctl_phy_init(struct dram_para *para) > > > > writel(phy_init[i], &ptr[i]); > > > > if (para->tpr10 & TPR10_UNKNOWN_FEAT0) { > > > > + if (para->tpr0 & BIT(30)) > > + val = (para->tpr0 >> 7) & 0x3e; > > + else > > + val = (para->tpr10 >> 3) & 0x1e; > > + > > > > ptr = (u32 *)(SUNXI_DRAM_PHY0_BASE + 0x780); > > for (i = 0; i < 32; i++) > > > > - writel(0x16, &ptr[i]); > > - writel(0xe, SUNXI_DRAM_PHY0_BASE + 0x78c); > > - writel(0xe, SUNXI_DRAM_PHY0_BASE + 0x7a4); > > - writel(0xe, SUNXI_DRAM_PHY0_BASE + 0x7b8); > > - writel(0x8, SUNXI_DRAM_PHY0_BASE + 0x7d4); > > - writel(0xe, SUNXI_DRAM_PHY0_BASE + 0x7dc); > > - writel(0xe, SUNXI_DRAM_PHY0_BASE + 0x7e0); > > + writel(val, &ptr[i]); > > + > > + val = (para->tpr10 << 1) & 0x1e; > > + writel(val, SUNXI_DRAM_PHY0_BASE + 0x7dc); > > + writel(val, SUNXI_DRAM_PHY0_BASE + 0x7e0); > > + > > + /* following configuration is DDR3 specific */ > > + val = (para->tpr10 >> 7) & 0x1e; > > + writel(val, SUNXI_DRAM_PHY0_BASE + 0x7d4); > > + /* > > + * TODO: Offsets 0x79c, 0x794 and 0x7e4 may need > > + * to be set here. However, this doesn't seem to > > + * be needed by any board seen in the wild for now. > > + * It's not implemented because it would unnecessarily > > + * introduce PARA2 and TPR2 options. > > + */ > > + if (para->tpr0 & BIT(31)) { > > + val = (para->tpr0 << 1) & 0x3e; > > + writel(val, SUNXI_DRAM_PHY0_BASE + 0x78c); > > + writel(val, SUNXI_DRAM_PHY0_BASE + 0x7a4); > > + writel(val, SUNXI_DRAM_PHY0_BASE + 0x7b8); > > + } > > > > } > > > > writel(0x80, SUNXI_DRAM_PHY0_BASE + 0x3dc); > > > > @@ -1110,6 +1130,7 @@ unsigned long sunxi_dram_init(void) > > > > .dx_dri = CONFIG_DRAM_SUN50I_H616_DX_DRI, > > .ca_dri = CONFIG_DRAM_SUN50I_H616_CA_DRI, > > .odt_en = CONFIG_DRAM_SUN50I_H616_ODT_EN, > > > > + .tpr0 = CONFIG_DRAM_SUN50I_H616_TPR0, > > > > .tpr10 = CONFIG_DRAM_SUN50I_H616_TPR10, > > .tpr11 = CONFIG_DRAM_SUN50I_H616_TPR11, > > .tpr12 = CONFIG_DRAM_SUN50I_H616_TPR12,