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 74124C77B6E for ; Wed, 12 Apr 2023 05:05:30 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5725285F08; Wed, 12 Apr 2023 07:05:27 +0200 (CEST) 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="O8B2sKtW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 104BA85EDD; Wed, 12 Apr 2023 07:05:25 +0200 (CEST) Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) (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 EDB8685EDD for ; Wed, 12 Apr 2023 07:05:20 +0200 (CEST) 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-wr1-x432.google.com with SMTP id s2so6329020wra.7 for ; Tue, 11 Apr 2023 22:05:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681275920; 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=aeEnWZIdM8PQD1Z5FFjjsMDfCCFhzMtlYIWHC0Ye40Q=; b=O8B2sKtWbPQJR/75dzwpRdKlJfZ2osEiljaMdEextBKGuAYGalp8pWRKeJdYQrwZwv g5J9GBdIFQGybDPgpV6bCGKxpaEKBmitM3LzlhLKPhRJDrgCjskFXtcIU4JxWQ1KOOwP vXSmE0iiHDX7RWYMgKGOFKAXiQz+pwwhT5VllK2lKsWvJl+sGznyl1FYrVEkTqvXBKrD i+9AypCH9SdT78R8FBabDHJQgJCuycBHUFuwt55vC8NRZLl16DpKP3Da6gYHdUYz2tNL +CxegId/O3rbU444inl6qTBtfd3XwF3X1UlT+PrDRfoHYMwQ0oNADRvtH1APK4BiXLV4 pJgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681275920; 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=aeEnWZIdM8PQD1Z5FFjjsMDfCCFhzMtlYIWHC0Ye40Q=; b=2RvsJ8s+AJdsJvO0nrEnr+XOCaUHckTWJvwfKreDwNfwwQ8/Wkn6M6mRkPqwJIreCc ms4DCsfiTbTnIe32gfzSLm0gmEUxjYDx2jb3MmQvjkW3gHstKXOJtmiJNMwUJsioe8oE OnvCWwPG+zpAk1yPTcmsHTB7Rdu6kvZkB3Ki4B2A67t7zVFSJ5aoYEdLvjCOwBptAygS CjwOS7Bd+tIHBfSttTN3bvLwOZeJWd1k2PmvrzqJa9jiXEK7mPYuME+Lk1NSl66gA+NL X4qzCl1Js/Ve+44XVrL7tWL8AtISNVHhX8vkbRe7nuwROYDvqDB2KiPWlpYoimd1JjQx 7z8Q== X-Gm-Message-State: AAQBX9eHubzaezqdYFu3nO50Hiv9Bo42ge3+MVi7G4jQ14g5aslFdTB1 Z6DKvtctC0G+sGIt8TnlxWU= X-Google-Smtp-Source: AKy350a/EWdmFPH24H3o/ZSr2mhh+UT0UdYE4s2yHprEtXmrfrjWaw+zZRAS5Kx93cYnECfeWysI+w== X-Received: by 2002:adf:e391:0:b0:2c7:fc61:12d4 with SMTP id e17-20020adfe391000000b002c7fc6112d4mr12862158wrm.47.1681275920116; Tue, 11 Apr 2023 22:05:20 -0700 (PDT) Received: from jernej-laptop.localnet (82-149-1-233.dynamic.telemach.net. [82.149.1.233]) by smtp.gmail.com with ESMTPSA id e18-20020adfe392000000b002c56013c07fsm16036989wrm.109.2023.04.11.22.05.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Apr 2023 22:05:19 -0700 (PDT) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: Andre Przywara Cc: jagan@amarulasolutions.com, u-boot@lists.denx.de, linux-sunxi@lists.linux.dev Subject: Re: [PATCH v2 04/10] sunxi: Convert H616 DRAM options to single setting Date: Wed, 12 Apr 2023 07:05:18 +0200 Message-ID: <5662672.DvuYhMxLoT@jernej-laptop> In-Reply-To: <20230411111304.4ba7ba2d@donnerap.cambridge.arm.com> References: <20230410082119.24616-1-jernej.skrabec@gmail.com> <20230410082119.24616-5-jernej.skrabec@gmail.com> <20230411111304.4ba7ba2d@donnerap.cambridge.arm.com> 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.8 at phobos.denx.de X-Virus-Status: Clean Dne torek, 11. april 2023 ob 12:13:04 CEST je Andre Przywara napisal(a): > On Mon, 10 Apr 2023 10:21:13 +0200 > > Jernej Skrabec wrote: > > Vendor DRAM settings use TPR10 parameter to enable various features. > > There are many mores features that just those that are currently > > mentioned. Since new will be added later and most are not known, let's > > reuse value from vendor DRAM driver as-is. This will also help adding > > support for new boards. > > > > Signed-off-by: Jernej Skrabec > > Thanks, based on my previous review, and the changes to the bit names: > > Reviewed-by: Andre Przywara > > Just one note here, mostly for the reference when people stumble upon > this patch: this enables the CA bit delay compensation code for the X96, > which was not enabled before, because C > was not set. I don't know if the fixed values written by this > code here were meant for the OrangePi Zero2 (which though never > runs this code), but for the X96 Mate the values written by this patch > will be changed in a later patch. DRAM_SUN50I_H616_UNKNOWN_FEATURE was tested with T95 box, but there is no upstream support for it (yet). I think this series was tested with enough (mostly not supported in mainline) devices that it's safe to say it works. Note that there are several versions of vendor DRAM driver which naturally differ slightly. This series is based on V0.651. Thanks for merging! Best regards, Jernej > > Cheers, > Andre > > > --- > > > > .../include/asm/arch-sunxi/dram_sun50i_h616.h | 9 + > > arch/arm/mach-sunxi/Kconfig | 38 +--- > > arch/arm/mach-sunxi/dram_sun50i_h616.c | 197 +++++++++--------- > > configs/orangepi_zero2_defconfig | 5 +- > > configs/x96_mate_defconfig | 1 + > > 5 files changed, 117 insertions(+), 133 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 > > c9e1f84bfcdd..dbdc6b694ec1 100644 > > --- a/arch/arm/include/asm/arch-sunxi/dram_sun50i_h616.h > > +++ b/arch/arm/include/asm/arch-sunxi/dram_sun50i_h616.h > > @@ -137,6 +137,14 @@ check_member(sunxi_mctl_ctl_reg, unk_0x4240, 0x4240); > > > > #define MSTR_ACTIVE_RANKS(x) (((x == 2) ? 3 : 1) << 24) > > #define MSTR_BURST_LENGTH(x) (((x) >> 1) << 16) > > > > +#define TPR10_CA_BIT_DELAY BIT(16) > > +#define TPR10_DX_BIT_DELAY0 BIT(17) > > +#define TPR10_DX_BIT_DELAY1 BIT(18) > > +#define TPR10_WRITE_LEVELING BIT(20) > > +#define TPR10_READ_CALIBRATION BIT(21) > > +#define TPR10_READ_TRAINING BIT(22) > > +#define TPR10_WRITE_TRAINING BIT(23) > > + > > > > struct dram_para { > > > > u32 clk; > > enum sunxi_dram_type type; > > > > @@ -147,6 +155,7 @@ struct dram_para { > > > > u32 dx_odt; > > u32 dx_dri; > > u32 ca_dri; > > > > + u32 tpr10; > > > > }; > > > > diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig > > index 14fb9a95905a..1b47a49f938c 100644 > > --- a/arch/arm/mach-sunxi/Kconfig > > +++ b/arch/arm/mach-sunxi/Kconfig > > @@ -52,38 +52,6 @@ config DRAM_SUN50I_H616 > > > > like H616. > > > > if DRAM_SUN50I_H616 > > > > -config DRAM_SUN50I_H616_WRITE_LEVELING > > - bool "H616 DRAM write leveling" > > - ---help--- > > - Select this when DRAM on your H616 board needs write leveling. > > - > > -config DRAM_SUN50I_H616_READ_CALIBRATION > > - bool "H616 DRAM read calibration" > > - ---help--- > > - Select this when DRAM on your H616 board needs read calibration. > > - > > -config DRAM_SUN50I_H616_READ_TRAINING > > - bool "H616 DRAM read training" > > - ---help--- > > - Select this when DRAM on your H616 board needs read training. > > - > > -config DRAM_SUN50I_H616_WRITE_TRAINING > > - bool "H616 DRAM write training" > > - ---help--- > > - Select this when DRAM on your H616 board needs write training. > > - > > -config DRAM_SUN50I_H616_BIT_DELAY_COMPENSATION > > - bool "H616 DRAM bit delay compensation" > > - ---help--- > > - Select this when DRAM on your H616 board needs bit delay > > - compensation. > > - > > -config DRAM_SUN50I_H616_UNKNOWN_FEATURE > > - bool "H616 DRAM unknown feature" > > - ---help--- > > - Select this when DRAM on your H616 board needs this unknown > > - feature. > > - > > > > config DRAM_SUN50I_H616_DX_ODT > > > > hex "H616 DRAM DX ODT parameter" > > help > > > > @@ -98,6 +66,12 @@ config DRAM_SUN50I_H616_CA_DRI > > > > hex "H616 DRAM CA DRI parameter" > > help > > > > CA DRI value from vendor DRAM settings. > > > > + > > +config DRAM_SUN50I_H616_TPR10 > > + hex "H616 DRAM TPR10 parameter" > > + help > > + TPR10 value from vendor DRAM settings. It tells which features > > + should be configured, like write leveling, read calibration, etc. > > > > endif > > > > config SUN6I_PRCM > > > > diff --git a/arch/arm/mach-sunxi/dram_sun50i_h616.c > > b/arch/arm/mach-sunxi/dram_sun50i_h616.c index 06a07dfbf9cc..630c7c3be882 > > 100644 > > --- a/arch/arm/mach-sunxi/dram_sun50i_h616.c > > +++ b/arch/arm/mach-sunxi/dram_sun50i_h616.c > > @@ -577,109 +577,112 @@ static bool mctl_phy_bit_delay_compensation(struct > > dram_para *para)> > > u32 *ptr; > > int i; > > > > - clrbits_le32(SUNXI_DRAM_PHY0_BASE + 0x60, 1); > > - setbits_le32(SUNXI_DRAM_PHY0_BASE + 8, 8); > > - clrbits_le32(SUNXI_DRAM_PHY0_BASE + 0x190, 0x10); > > + if (para->tpr10 & TPR10_DX_BIT_DELAY1) { > > + clrbits_le32(SUNXI_DRAM_PHY0_BASE + 0x60, 1); > > + setbits_le32(SUNXI_DRAM_PHY0_BASE + 8, 8); > > + clrbits_le32(SUNXI_DRAM_PHY0_BASE + 0x190, 0x10); > > > > - ptr = (u32 *)(SUNXI_DRAM_PHY0_BASE + 0x484); > > - for (i = 0; i < 9; i++) { > > - writel_relaxed(0x16, ptr); > > - writel_relaxed(0x16, ptr + 0x30); > > - ptr += 2; > > - } > > - writel_relaxed(0x1c, SUNXI_DRAM_PHY0_BASE + 0x4d0); > > - writel_relaxed(0x1c, SUNXI_DRAM_PHY0_BASE + 0x590); > > - writel_relaxed(0x1c, SUNXI_DRAM_PHY0_BASE + 0x4cc); > > - writel_relaxed(0x1c, SUNXI_DRAM_PHY0_BASE + 0x58c); > > + ptr = (u32 *)(SUNXI_DRAM_PHY0_BASE + 0x484); > > + for (i = 0; i < 9; i++) { > > + writel_relaxed(0x16, ptr); > > + writel_relaxed(0x16, ptr + 0x30); > > + ptr += 2; > > + } > > + writel_relaxed(0x1c, SUNXI_DRAM_PHY0_BASE + 0x4d0); > > + writel_relaxed(0x1c, SUNXI_DRAM_PHY0_BASE + 0x590); > > + writel_relaxed(0x1c, SUNXI_DRAM_PHY0_BASE + 0x4cc); > > + writel_relaxed(0x1c, SUNXI_DRAM_PHY0_BASE + 0x58c); > > > > - ptr = (u32 *)(SUNXI_DRAM_PHY0_BASE + 0x4d8); > > - for (i = 0; i < 9; i++) { > > - writel_relaxed(0x1a, ptr); > > - writel_relaxed(0x1a, ptr + 0x30); > > - ptr += 2; > > - } > > - writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x524); > > - writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x5e4); > > - writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x520); > > - writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x5e0); > > + ptr = (u32 *)(SUNXI_DRAM_PHY0_BASE + 0x4d8); > > + for (i = 0; i < 9; i++) { > > + writel_relaxed(0x1a, ptr); > > + writel_relaxed(0x1a, ptr + 0x30); > > + ptr += 2; > > + } > > + writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x524); > > + writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x5e4); > > + writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x520); > > + writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x5e0); > > > > - ptr = (u32 *)(SUNXI_DRAM_PHY0_BASE + 0x604); > > - for (i = 0; i < 9; i++) { > > - writel_relaxed(0x1a, ptr); > > - writel_relaxed(0x1a, ptr + 0x30); > > - ptr += 2; > > - } > > - writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x650); > > - writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x710); > > - writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x64c); > > - writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x70c); > > + ptr = (u32 *)(SUNXI_DRAM_PHY0_BASE + 0x604); > > + for (i = 0; i < 9; i++) { > > + writel_relaxed(0x1a, ptr); > > + writel_relaxed(0x1a, ptr + 0x30); > > + ptr += 2; > > + } > > + writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x650); > > + writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x710); > > + writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x64c); > > + writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x70c); > > > > - ptr = (u32 *)(SUNXI_DRAM_PHY0_BASE + 0x658); > > - for (i = 0; i < 9; i++) { > > - writel_relaxed(0x1a, ptr); > > - writel_relaxed(0x1a, ptr + 0x30); > > - ptr += 2; > > - } > > - writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x6a4); > > - writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x764); > > - writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x6a0); > > - writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x760); > > + ptr = (u32 *)(SUNXI_DRAM_PHY0_BASE + 0x658); > > + for (i = 0; i < 9; i++) { > > + writel_relaxed(0x1a, ptr); > > + writel_relaxed(0x1a, ptr + 0x30); > > + ptr += 2; > > + } > > + writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x6a4); > > + writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x764); > > + writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x6a0); > > + writel_relaxed(0x1e, SUNXI_DRAM_PHY0_BASE + 0x760); > > > > - dmb(); > > + dmb(); > > > > - setbits_le32(SUNXI_DRAM_PHY0_BASE + 0x60, 1); > > + setbits_le32(SUNXI_DRAM_PHY0_BASE + 0x60, 1); > > + } > > > > - /* second part */ > > - clrbits_le32(SUNXI_DRAM_PHY0_BASE + 0x54, 0x80); > > - clrbits_le32(SUNXI_DRAM_PHY0_BASE + 0x190, 4); > > + if (para->tpr10 & TPR10_DX_BIT_DELAY0) { > > + clrbits_le32(SUNXI_DRAM_PHY0_BASE + 0x54, 0x80); > > + clrbits_le32(SUNXI_DRAM_PHY0_BASE + 0x190, 4); > > > > - ptr = (u32 *)(SUNXI_DRAM_PHY0_BASE + 0x480); > > - for (i = 0; i < 9; i++) { > > - writel_relaxed(0x10, ptr); > > - writel_relaxed(0x10, ptr + 0x30); > > - ptr += 2; > > - } > > - writel_relaxed(0x18, SUNXI_DRAM_PHY0_BASE + 0x528); > > - writel_relaxed(0x18, SUNXI_DRAM_PHY0_BASE + 0x5e8); > > - writel_relaxed(0x18, SUNXI_DRAM_PHY0_BASE + 0x4c8); > > - writel_relaxed(0x18, SUNXI_DRAM_PHY0_BASE + 0x588); > > + ptr = (u32 *)(SUNXI_DRAM_PHY0_BASE + 0x480); > > + for (i = 0; i < 9; i++) { > > + writel_relaxed(0x10, ptr); > > + writel_relaxed(0x10, ptr + 0x30); > > + ptr += 2; > > + } > > + writel_relaxed(0x18, SUNXI_DRAM_PHY0_BASE + 0x528); > > + writel_relaxed(0x18, SUNXI_DRAM_PHY0_BASE + 0x5e8); > > + writel_relaxed(0x18, SUNXI_DRAM_PHY0_BASE + 0x4c8); > > + writel_relaxed(0x18, SUNXI_DRAM_PHY0_BASE + 0x588); > > > > - ptr = (u32 *)(SUNXI_DRAM_PHY0_BASE + 0x4d4); > > - for (i = 0; i < 9; i++) { > > - writel_relaxed(0x12, ptr); > > - writel_relaxed(0x12, ptr + 0x30); > > - ptr += 2; > > - } > > - writel_relaxed(0x1a, SUNXI_DRAM_PHY0_BASE + 0x52c); > > - writel_relaxed(0x1a, SUNXI_DRAM_PHY0_BASE + 0x5ec); > > - writel_relaxed(0x1a, SUNXI_DRAM_PHY0_BASE + 0x51c); > > - writel_relaxed(0x1a, SUNXI_DRAM_PHY0_BASE + 0x5dc); > > + ptr = (u32 *)(SUNXI_DRAM_PHY0_BASE + 0x4d4); > > + for (i = 0; i < 9; i++) { > > + writel_relaxed(0x12, ptr); > > + writel_relaxed(0x12, ptr + 0x30); > > + ptr += 2; > > + } > > + writel_relaxed(0x1a, SUNXI_DRAM_PHY0_BASE + 0x52c); > > + writel_relaxed(0x1a, SUNXI_DRAM_PHY0_BASE + 0x5ec); > > + writel_relaxed(0x1a, SUNXI_DRAM_PHY0_BASE + 0x51c); > > + writel_relaxed(0x1a, SUNXI_DRAM_PHY0_BASE + 0x5dc); > > > > - ptr = (u32 *)(SUNXI_DRAM_PHY0_BASE + 0x600); > > - for (i = 0; i < 9; i++) { > > - writel_relaxed(0x12, ptr); > > - writel_relaxed(0x12, ptr + 0x30); > > - ptr += 2; > > - } > > - writel_relaxed(0x1a, SUNXI_DRAM_PHY0_BASE + 0x6a8); > > - writel_relaxed(0x1a, SUNXI_DRAM_PHY0_BASE + 0x768); > > - writel_relaxed(0x1a, SUNXI_DRAM_PHY0_BASE + 0x648); > > - writel_relaxed(0x1a, SUNXI_DRAM_PHY0_BASE + 0x708); > > + ptr = (u32 *)(SUNXI_DRAM_PHY0_BASE + 0x600); > > + for (i = 0; i < 9; i++) { > > + writel_relaxed(0x12, ptr); > > + writel_relaxed(0x12, ptr + 0x30); > > + ptr += 2; > > + } > > + writel_relaxed(0x1a, SUNXI_DRAM_PHY0_BASE + 0x6a8); > > + writel_relaxed(0x1a, SUNXI_DRAM_PHY0_BASE + 0x768); > > + writel_relaxed(0x1a, SUNXI_DRAM_PHY0_BASE + 0x648); > > + writel_relaxed(0x1a, SUNXI_DRAM_PHY0_BASE + 0x708); > > > > - ptr = (u32 *)(SUNXI_DRAM_PHY0_BASE + 0x654); > > - for (i = 0; i < 9; i++) { > > - writel_relaxed(0x14, ptr); > > - writel_relaxed(0x14, ptr + 0x30); > > - ptr += 2; > > - } > > - writel_relaxed(0x1c, SUNXI_DRAM_PHY0_BASE + 0x6ac); > > - writel_relaxed(0x1c, SUNXI_DRAM_PHY0_BASE + 0x76c); > > - writel_relaxed(0x1c, SUNXI_DRAM_PHY0_BASE + 0x69c); > > - writel_relaxed(0x1c, SUNXI_DRAM_PHY0_BASE + 0x75c); > > + ptr = (u32 *)(SUNXI_DRAM_PHY0_BASE + 0x654); > > + for (i = 0; i < 9; i++) { > > + writel_relaxed(0x14, ptr); > > + writel_relaxed(0x14, ptr + 0x30); > > + ptr += 2; > > + } > > + writel_relaxed(0x1c, SUNXI_DRAM_PHY0_BASE + 0x6ac); > > + writel_relaxed(0x1c, SUNXI_DRAM_PHY0_BASE + 0x76c); > > + writel_relaxed(0x1c, SUNXI_DRAM_PHY0_BASE + 0x69c); > > + writel_relaxed(0x1c, SUNXI_DRAM_PHY0_BASE + 0x75c); > > > > - dmb(); > > + dmb(); > > > > - setbits_le32(SUNXI_DRAM_PHY0_BASE + 0x54, 0x80); > > + setbits_le32(SUNXI_DRAM_PHY0_BASE + 0x54, 0x80); > > + } > > > > return true; > > > > } > > > > @@ -718,7 +721,7 @@ static bool mctl_phy_init(struct dram_para *para) > > > > for (i = 0; i < ARRAY_SIZE(phy_init); i++) > > > > writel(phy_init[i], &ptr[i]); > > > > - if (IS_ENABLED(CONFIG_DRAM_SUN50I_H616_UNKNOWN_FEATURE)) { > > + if (para->tpr10 & TPR10_CA_BIT_DELAY) { > > > > ptr = (u32 *)(SUNXI_DRAM_PHY0_BASE + 0x780); > > for (i = 0; i < 32; i++) > > > > writel(0x16, &ptr[i]); > > > > @@ -800,7 +803,7 @@ static bool mctl_phy_init(struct dram_para *para) > > > > clrbits_le32(&mctl_ctl->rfshctl3, 1); > > writel(1, &mctl_ctl->swctl); > > > > - if (IS_ENABLED(CONFIG_DRAM_SUN50I_H616_WRITE_LEVELING)) { > > + if (para->tpr10 & TPR10_WRITE_LEVELING) { > > > > for (i = 0; i < 5; i++) > > > > if (mctl_phy_write_leveling(para)) > > > > break; > > > > @@ -810,7 +813,7 @@ static bool mctl_phy_init(struct dram_para *para) > > > > } > > > > } > > > > - if (IS_ENABLED(CONFIG_DRAM_SUN50I_H616_READ_CALIBRATION)) { > > + if (para->tpr10 & TPR10_READ_CALIBRATION) { > > > > for (i = 0; i < 5; i++) > > > > if (mctl_phy_read_calibration(para)) > > > > break; > > > > @@ -820,7 +823,7 @@ static bool mctl_phy_init(struct dram_para *para) > > > > } > > > > } > > > > - if (IS_ENABLED(CONFIG_DRAM_SUN50I_H616_READ_TRAINING)) { > > + if (para->tpr10 & TPR10_READ_TRAINING) { > > > > for (i = 0; i < 5; i++) > > > > if (mctl_phy_read_training(para)) > > > > break; > > > > @@ -830,7 +833,7 @@ static bool mctl_phy_init(struct dram_para *para) > > > > } > > > > } > > > > - if (IS_ENABLED(CONFIG_DRAM_SUN50I_H616_WRITE_TRAINING)) { > > + if (para->tpr10 & TPR10_WRITE_TRAINING) { > > > > for (i = 0; i < 5; i++) > > > > if (mctl_phy_write_training(para)) > > > > break; > > > > @@ -840,8 +843,7 @@ static bool mctl_phy_init(struct dram_para *para) > > > > } > > > > } > > > > - if (IS_ENABLED(CONFIG_DRAM_SUN50I_H616_BIT_DELAY_COMPENSATION)) > > - mctl_phy_bit_delay_compensation(para); > > + mctl_phy_bit_delay_compensation(para); > > > > clrbits_le32(SUNXI_DRAM_PHY0_BASE + 0x60, 4); > > > > @@ -1022,6 +1024,7 @@ unsigned long sunxi_dram_init(void) > > > > .dx_odt = CONFIG_DRAM_SUN50I_H616_DX_ODT, > > .dx_dri = CONFIG_DRAM_SUN50I_H616_DX_DRI, > > .ca_dri = CONFIG_DRAM_SUN50I_H616_CA_DRI, > > > > + .tpr10 = CONFIG_DRAM_SUN50I_H616_TPR10, > > > > }; > > unsigned long size; > > > > diff --git a/configs/orangepi_zero2_defconfig > > b/configs/orangepi_zero2_defconfig index d70b15a07705..6cb942f511a1 > > 100644 > > --- a/configs/orangepi_zero2_defconfig > > +++ b/configs/orangepi_zero2_defconfig > > @@ -2,13 +2,10 @@ CONFIG_ARM=y > > > > CONFIG_ARCH_SUNXI=y > > CONFIG_DEFAULT_DEVICE_TREE="sun50i-h616-orangepi-zero2" > > CONFIG_SPL=y > > > > -CONFIG_DRAM_SUN50I_H616_WRITE_LEVELING=y > > -CONFIG_DRAM_SUN50I_H616_READ_CALIBRATION=y > > -CONFIG_DRAM_SUN50I_H616_READ_TRAINING=y > > -CONFIG_DRAM_SUN50I_H616_WRITE_TRAINING=y > > > > CONFIG_DRAM_SUN50I_H616_DX_ODT=0x08080808 > > CONFIG_DRAM_SUN50I_H616_DX_DRI=0x0e0e0e0e > > CONFIG_DRAM_SUN50I_H616_CA_DRI=0x0e0e > > > > +CONFIG_DRAM_SUN50I_H616_TPR10=0xf83438 > > > > CONFIG_MACH_SUN50I_H616=y > > CONFIG_R_I2C_ENABLE=y > > CONFIG_SPL_SPI_SUNXI=y > > > > diff --git a/configs/x96_mate_defconfig b/configs/x96_mate_defconfig > > index 60cc8fbe751c..b00daa458b28 100644 > > --- a/configs/x96_mate_defconfig > > +++ b/configs/x96_mate_defconfig > > @@ -6,6 +6,7 @@ CONFIG_DRAM_SUN50I_H616_READ_CALIBRATION=y > > > > CONFIG_DRAM_SUN50I_H616_DX_ODT=0x03030303 > > CONFIG_DRAM_SUN50I_H616_DX_DRI=0x0e0e0e0e > > CONFIG_DRAM_SUN50I_H616_CA_DRI=0x1c12 > > > > +CONFIG_DRAM_SUN50I_H616_TPR10=0x2f0007 > > > > CONFIG_MACH_SUN50I_H616=y > > CONFIG_R_I2C_ENABLE=y > > # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set