From patchwork Wed Feb 26 06:53:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 1244719 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=85.214.62.61; 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=uw3mhIZM; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 48S63S1f8qz9sPK for ; Wed, 26 Feb 2020 17:54:12 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B3E2E8101A; Wed, 26 Feb 2020 07:54: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="uw3mhIZM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BAACC81183; Wed, 26 Feb 2020 07:54:05 +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-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) (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 4DED38100F for ; Wed, 26 Feb 2020 07:54:02 +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-pg1-x541.google.com with SMTP id u12so818760pgb.10 for ; Tue, 25 Feb 2020 22:54:02 -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=E/hv+qSja71kylgsfCtO0k06IaKVvawzDblVYVFkRCU=; b=uw3mhIZM35CPdK0v/DeAiUoJF/GTVGtRH+f7qtXqIfNTpRRK8A4+MfBmmMI3c91ZX2 e5w4RMk0D6d+mDFncprvi8pBgYuj0dFBqaRFWj0zWwH6dfnL6xG+9dAB3BM2Xz5vtSDQ c+dZKijZnQPBwDFcK4ntGSL7akLWuFwq7K5CfgTmzjXy6ie58NTydJpJ2pAbG7nu32OL O7mIz5OrhUxh38XRq6+zC+sAL30Vypf3BLtrTibKyx+8fjUsBnsWm/jx046sOLlV0jCZ BdcICf34ZXMTqNBYCF+2g8Xvb5wzNRoHbRp030rJVzGtLwLUfnZdes0jVnbCzt7lkerF o0Fw== 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=E/hv+qSja71kylgsfCtO0k06IaKVvawzDblVYVFkRCU=; b=LONT4uy6jbbMZwiO6u3tFdf7zZSrQzdN3iTx2TDrdBS8Ji+wD+NacmrcdI0hmiUe46 Jwh5TTpg594d/aqGEm7Xt9K0GyAC7byOj+zvSQV+eyZYdFgjOJd/aFGebYXpOnViZ4kf c+v4/+4GRHdYQgHzkP/CTmGHj/FXz9pc6SN7/l5e/E3AFRpH9dA1oT0Yd5JbF4kIqm2i 1EFb5IGhfh4dfYlyLgfCRpfXB7p3XZYLmMdk/cYkuDu2uGnnwsHhDl8e71VnImSV5heJ w5qXoHwNifc5hVmOJHSrY3tGCQHHebKD1xbXnKh/PO0o5WDA3aX+9WSEw/tYxKQOPmEB P5YA== X-Gm-Message-State: APjAAAXntvw/+W/DN6FLoJtaZ0/L0TS7yJpqZP7Nr8++wawJmj1OPPzh Y0yy03WwOTntrgeWZy+JS7EzpQBi X-Google-Smtp-Source: APXvYqyNfmYCfs7EtKWzQ2N7SXEs01eAhiHkumWKkKjzIMZyr5Rb3bEm1JXa6SbFOLuxPRIVjPbyyA== X-Received: by 2002:a62:be0a:: with SMTP id l10mr2943839pff.110.1582700040444; Tue, 25 Feb 2020 22:54:00 -0800 (PST) Received: from chrisp-dl.atlnz.lc ([2001:df5:b000:22:4042:f6df:52de:d3d4]) by smtp.gmail.com with ESMTPSA id w25sm1384464pfi.106.2020.02.25.22.53.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2020 22:53:59 -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 v2] arm: mvebu: update RTC values for PCIe memory wrappers Date: Wed, 26 Feb 2020 19:53:50 +1300 Message-Id: <20200226065350.4524-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 Signed-off-by: Chris Packham Signed-off-by: Chris Packham Reviewed-by: Stefan Roese --- 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. Changes in v2: - drop duplicated link in commit message 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.