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 161C2C433F5 for ; Wed, 30 Mar 2022 10:12:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 51FBA84136; Wed, 30 Mar 2022 12:10:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1648635053; bh=LoqX4hyQlcobtx3Ff+1ij7rIP72MExyiJ7kETmzDGl4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=dTxa1h1IquMru2G/GiPozKhOmTXTjLru0A6v14aj1uSThXuiPb6OFj5xHUNuLpwdw +3r3UnACKyw+ZVp9jjnLsq5VQWbcnOGOWkpel1LwyMJgbuUefQS9p4AHv7x2qwqW5O gGCvrjv0jyr1RzTYjmTw9m1OGhz9IRvUC4Zu/MGHjGuhRa9yj0xDedRpWJHsh9zFM5 mhfB74yaSwsJDmwYJgnb14e9NJ3HnNj6q86BcjGaPv5D62NSvidd7r5nHgsYVwm979 PcK3yfjuDHU6aEk3kjSgO/aFDvvhbYvOa9n8T9E4wZzesqUMf0NJYm2wCS/dx3ukln ky0ml9b2HqoZQ== Received: by phobos.denx.de (Postfix, from userid 109) id 8DCDD84130; Wed, 30 Mar 2022 12:08:54 +0200 (CEST) Received: from mout-u-107.mailbox.org (mout-u-107.mailbox.org [91.198.250.252]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0792E840DA for ; Wed, 30 Mar 2022 12:08:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:105:465:1:3:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4KT2F92sk9z9sRG; Wed, 30 Mar 2022 12:08:13 +0200 (CEST) From: Stefan Roese To: u-boot@lists.denx.de Cc: awilliams@marvell.com, cchavva@marvell.com Subject: [PATCH 45/52] mips: octeon: cpu.c: Implement configure_lmtdma_window() Date: Wed, 30 Mar 2022 12:07:21 +0200 Message-Id: <20220330100728.871561-46-sr@denx.de> In-Reply-To: <20220330100728.871561-1-sr@denx.de> References: <20220330100728.871561-1-sr@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.5 at phobos.denx.de X-Virus-Status: Clean Import configure_lmtdma_window from Marvell 2013 U-Boot as it's needed for network functionality. Signed-off-by: Stefan Roese --- arch/mips/mach-octeon/cpu.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/arch/mips/mach-octeon/cpu.c b/arch/mips/mach-octeon/cpu.c index fffd9dfb8580..1bdc6cd72903 100644 --- a/arch/mips/mach-octeon/cpu.c +++ b/arch/mips/mach-octeon/cpu.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Copyright (C) 2020 Marvell International Ltd. + * Copyright (C) 2020-2022 Marvell International Ltd. */ #include @@ -17,6 +17,8 @@ #include #include #include +#include +#include DECLARE_GLOBAL_DATA_PTR; @@ -393,6 +395,33 @@ static int init_bootcmd_console(void) return ret; } +static void configure_lmtdma_window(void) +{ + u64 tmp; + u64 addr; + u64 end_addr; + + CVMX_MF_CVM_MEM_CTL(tmp); + tmp &= ~0x1ffull; + tmp |= 0x104ull; + + /* enable LMTDMA */ + tmp |= (1ull << 51); + /* configure scratch line 2 for LMT */ + /* TODO: reserve this scratch line, so that others will not use it */ + /* TODO: store LMTLINE in global var */ + tmp |= (CVMX_PKO_LMTLINE << 45); + /* clear LMTLINE in scratch */ + addr = CVMX_PKO_LMTLINE * CVMX_CACHE_LINE_SIZE; + end_addr = addr + CVMX_CACHE_LINE_SIZE; + + while (addr < end_addr) { + *CASTPTR(volatile u64, addr + CVMX_SCRATCH_BASE) = (u64)0; + addr += 8; + } + CVMX_MT_CVM_MEM_CTL(tmp); +} + int arch_early_init_r(void) { int ret; @@ -405,6 +434,9 @@ int arch_early_init_r(void) if (ret) return ret; + if (octeon_has_feature(OCTEON_FEATURE_PKO3)) + configure_lmtdma_window(); + return 0; } -- 2.35.1