From patchwork Wed Feb 26 00:02:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 1244584 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=a9tMvzfi; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48RwxT2WcFz9sNg for ; Wed, 26 Feb 2020 11:03:22 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 95D4880257; Wed, 26 Feb 2020 01:03:08 +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="a9tMvzfi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3B8F38025D; Wed, 26 Feb 2020 01:03:06 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) (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 0A881801F1 for ; Wed, 26 Feb 2020 01:03: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=judge.packham@gmail.com Received: by mail-pl1-x644.google.com with SMTP id y8so482513pll.13 for ; Tue, 25 Feb 2020 16:03:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=FgSQV9qKVKmiAeyjzCRHRGVDuNQlGrXo8pY8DK9QK9I=; b=a9tMvzfi1AaeTGk/WjdOSbgxsmsAEYCYsHukZbDGNPr38I9WoGz+kVI67SJ0ZklVC3 wJmGxWQSYfUhd0GuGsGPiGTfUW5NRN7yI710iCxbzdi/vIxabYjMFxmbscuCFvdyZ8cN VyjRw71Eb0dIHYMF3bkm4BAqF5RnTxeJYflKI7xNSdUN3E+CBvBJBGPhvXpySD4ucrdD YksDbYQj5K/dFjcz4Ya8wtG9rFz29eNxZjwrCqwcOAM1aO3Fhnjj2q1nzQ6gVhyTJG1p 1RE7AqDkEpS66bm3ocxJtL3O4KE7Mqus8fqJHUyJIFlKE5VeKCJ+I4PhnfEfRDFIuWuH aZNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=FgSQV9qKVKmiAeyjzCRHRGVDuNQlGrXo8pY8DK9QK9I=; b=UMF7x3rt+Fb1a/Iw21KbYvDv2gr42aKSLjpL415a0EWj2BHd1W8kcXjJ8OpJiqNDbb mWMJTbfQj8mtEOlrMIAcTCSxVfWkWvJzX4BNXflReHn35VcabRi+YprZp6v6aLzh47Iw NMU4NBEEpXw+F0fzmNMyKn+49amtIwBPWmGbngGY4oopg1zPr14Nm4f2N5oXvfvdD/gA Hf1w5uEDlAP7y04B0FECLWMNTlg2HdWao5ZiO6HRlUVKHpxXHbZ7cpjWxcAFgfAJwjhk mrhAjyZ/KiVPxkkpI67BmlY7tXhdcBXvjSVrRAG4wFt9Y/XvLAN9mvsktCyyRFIKINdT nTHQ== X-Gm-Message-State: APjAAAXOl3vJ4CeICKL5VU8MfyW407kUoMs00E7E13rZoCwezj6FBXqS OU6xtLu6dQmhlcjgqwEIEUa+PcX9 X-Google-Smtp-Source: APXvYqzMt3AfvctZ37u8FDqV8L5GQ/7MWb5wmIFGE1zTv1GL4oWEUGKX84e1khXP+v0fxH4tlj/Wlw== X-Received: by 2002:a17:90a:bd89:: with SMTP id z9mr1753917pjr.13.1582675379107; Tue, 25 Feb 2020 16:02:59 -0800 (PST) Received: from chrisp-dl.atlnz.lc ([2001:df5:b000:22:7442:d04a:557:a011]) by smtp.gmail.com with ESMTPSA id z13sm147097pge.29.2020.02.25.16.02.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2020 16:02:58 -0800 (PST) From: Chris Packham To: u-boot@lists.denx.de Cc: Erez Alfiya , Benzi Elyashar , Chris Packham , Chris Packham , Baruch Siach , Pierre Bourdon , Stefan Roese , Tom Rini Subject: [PATCH] arm: mvebu: update RTC values for PCIe memory wrappers Date: Wed, 26 Feb 2020 13:02:48 +1300 Message-Id: <20200226000249.20480-1-judge.packham@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.102.2 at phobos.denx.de X-Virus-Status: Clean From: Chris Packham Update the RTC (Read Timing Control) values for PCIe memory wrappers following an ERRATA (ERRATA# TDB). This means the PCIe accesses will used slower memory Read Timing, to allow more efficient energy consumption, in order to lower the minimum VDD of the memory. Will lead to more robust memory when voltage drop occurs (VDDSEG) The code is based on changes from Marvell's U-Boot, specifically: https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/commit/20cd2704072512de176e048970f2883db901674b https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/commit/eb608a7c8dd0d42b87601a61b9c0cc5615ab94b2 https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/commit/c4af19ae2bf08cf6e450e741ce4f04d402a5cb6b https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/commit/c4af19ae2bf08cf6e450e741ce4f04d402a5cb6b Signed-off-by: Chris Packham Signed-off-by: Chris Packham --- I've signed-off using both my email addresses. I normally do u-boot stuff via gmail for convenience but this is definitely a work thing. arch/arm/mach-mvebu/include/mach/cpu.h | 2 ++ arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.c | 17 +++++++++++++++++ arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h | 13 +++++++++++++ arch/arm/mach-mvebu/spl.c | 3 +++ 4 files changed, 35 insertions(+) diff --git a/arch/arm/mach-mvebu/include/mach/cpu.h b/arch/arm/mach-mvebu/include/mach/cpu.h index 2e2d72aac892..fa7c81754b8f 100644 --- a/arch/arm/mach-mvebu/include/mach/cpu.h +++ b/arch/arm/mach-mvebu/include/mach/cpu.h @@ -166,8 +166,10 @@ int ddr3_init(void); /* Auto Voltage Scaling */ #if defined(CONFIG_ARMADA_38X) || defined(CONFIG_ARMADA_39X) void mv_avs_init(void); +void mv_rtc_config(void); #else static inline void mv_avs_init(void) {} +static inline void mv_rtc_config(void) {} #endif /* diff --git a/arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.c b/arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.c index e9dd096ad0f5..3c4c7e01a1cd 100644 --- a/arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.c +++ b/arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.c @@ -257,6 +257,23 @@ u8 sys_env_device_rev_get(void) return (value & (REVISON_ID_MASK)) >> REVISON_ID_OFFS; } +void mv_rtc_config(void) +{ + u32 i, val; + + if (!(IS_ENABLED(CONFIG_ARMADA_38X) || IS_ENABLED(CONFIG_ARMADA_39X))) + return; + + /* Activate pipe0 for read/write transaction, and set XBAR client number #1 */ + val = 0x1 << DFX_PIPE_SELECT_PIPE0_ACTIVE_OFFS | + 0x1 << DFX_PIPE_SELECT_XBAR_CLIENT_SEL_OFFS; + writel(val, MVEBU_DFX_BASE); + + /* Set new RTC value for all memory wrappers */ + for (i = 0; i < RTC_MEMORY_WRAPPER_COUNT; i++) + reg_write(RTC_MEMORY_WRAPPER_REG(i), RTC_MEMORY_WRAPPER_CTRL_VAL); +} + void mv_avs_init(void) { u32 sar_freq; diff --git a/arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h b/arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h index 1774a5b780ca..17cd811331d2 100644 --- a/arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h +++ b/arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h @@ -150,6 +150,19 @@ #define MPP_UART1_SET_MASK (~(0xff000)) #define MPP_UART1_SET_DATA (0x66000) +#define DFX_PIPE_SELECT_PIPE0_ACTIVE_OFFS 0 +/* DFX_PIPE_SELECT_XBAR_CLIENT_SEL_OFFS: Since address completion in 14bit + * address mode, and given that [14:8] => [19:13], the 2 lower bits [9:8] => + * [14:13] are dismissed. hence field offset is also shifted to 10 + */ +#define DFX_PIPE_SELECT_XBAR_CLIENT_SEL_OFFS 10 + +#define RTC_MEMORY_CTRL_REG_BASE 0xE6000 +#define RTC_MEMORY_WRAPPER_COUNT 8 +#define RTC_MEMORY_WRAPPER_REG(i) (RTC_MEMORY_CTRL_REG_BASE + ((i) * 0x40)) +#define RTC_MEMORY_CTRL_PDLVMC_FIELD_OFFS 6 +#define RTC_MEMORY_WRAPPER_CTRL_VAL (0x1 << RTC_MEMORY_CTRL_PDLVMC_FIELD_OFFS) + #define AVS_DEBUG_CNTR_REG 0xe4124 #define AVS_DEBUG_CNTR_DEFAULT_VALUE 0x08008073 diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index a99bf166fd85..70fef3b573d9 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -130,6 +130,9 @@ void board_init_f(ulong dummy) /* Initialize Auto Voltage Scaling */ mv_avs_init(); + /* Update read timing control for PCIe */ + mv_rtc_config(); + /* * Return to the BootROM to continue the Marvell xmodem * UART boot protocol. As initiated by the kwboot tool.