Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32D99C4338F for ; Tue, 3 Aug 2021 04:45:50 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 78C3160F92 for ; Tue, 3 Aug 2021 04:45:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 78C3160F92 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 78E9A82DF4; Tue, 3 Aug 2021 06:45:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sifive.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=sifive.com header.i=@sifive.com header.b="I6xgrYue"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C48CA82DE9; Tue, 3 Aug 2021 06:45:10 +0200 (CEST) Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) (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 1823682DC5 for ; Tue, 3 Aug 2021 06:45:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=zong.li@sifive.com Received: by mail-pj1-x1031.google.com with SMTP id nh14so16377600pjb.2 for ; Mon, 02 Aug 2021 21:44:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zRR9ccDVNSZ0VlPH5PGeOWvd+q7I8XEofZCeP9L+t3U=; b=I6xgrYueKAi8hbxCCrpEdw4KyVZyX8g3Irb1FCLQzw1cHNY97QFJetW55ov7yconkt 4/RlveZVYVgEwCNt23yUF0eKnGUljsHPmxSklaJrF/rQzknRX5q3ZvuDVkg2vbevnuRY 8elqyXEsYLylnbKOue61jNZXMggpPXXbtUalLsKAOSSi2hiIRdIC3dbwdskVpahn3Dtg /2TyDVnzn0FcOQA7YH6pzRdKsXQLtZFoKLURqtanvpf5NzKfqdzIDF6fBdDDnrEiF1ZO xwy8c0n8u/9V+U59ltlJ7Umq+4/lER9mDiMyVj3q3ClLfq0lXrjuFwgq636mACtXualn cNMw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=zRR9ccDVNSZ0VlPH5PGeOWvd+q7I8XEofZCeP9L+t3U=; b=esZOuZxboPB1Zm/TV5Qs/PieoiVbWNphahWTJWJmwQ57m34XnDZ7zebV9KPVq8bQyf uHtR1SQ1RNgeoM7RIYkcYI77hhD/URQxyHBzBGajwP34aP1ol2CJiLcCczOK7V1uoIOt RN7c29pJdaF2Mr0PHxwjZxEsuHghntulLsak53iODVI7mfjuGZvU0pamrxWhwtIsDiof RqKhRlERBhrb10qklsHC+bdpdwuRtqEFMzcdpjtb2XqcSgtKhd6z2kCUJkh9wbBkhxW+ /vN7co4BObJxFZ/4eO+g2yPT1OUrBkJRLg7QbrADrNnVe1ic2Ii6W43Z+5y6sYBaETF8 TbkA== X-Gm-Message-State: AOAM531DCJu9M7+MBRx7CNfxXMz6Nzn9jshJNi3NegYGpY9wPsSgPPnN JX/V0zZQudtepTNFWXp/MU2H6w== X-Google-Smtp-Source: ABdhPJwNCHRewv4+XLasjLBGHyHSouyONc9mJAeY8cqwzV8FPv5WArJPh8dHky8MCaeXGGDhORr+FQ== X-Received: by 2002:a17:90a:4cc4:: with SMTP id k62mr2478351pjh.110.1627965898497; Mon, 02 Aug 2021 21:44:58 -0700 (PDT) Received: from hsinchu15.internal.sifive.com (59-124-168-89.HINET-IP.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id d2sm15327998pgv.87.2021.08.02.21.44.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Aug 2021 21:44:58 -0700 (PDT) From: Zong Li To: rick@andestech.com, ycliang@andestech.com, bmeng.cn@gmail.com, seanga2@gmail.com, green.wan@sifive.com, paul.walmsley@sifive.com, sjg@chromium.org, u-boot@lists.denx.de Cc: Zong Li Subject: [PATCH v2 4/6] riscv: sifive: use common cache_init instead of duplicated implementation Date: Tue, 3 Aug 2021 12:44:42 +0800 Message-Id: <20210803044444.14032-5-zong.li@sifive.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210803044444.14032-1-zong.li@sifive.com> References: <20210803044444.14032-1-zong.li@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean We already extracted the duplicated implementation to common code, so change to use that and drop the original implementation. Signed-off-by: Zong Li --- arch/riscv/cpu/fu540/Kconfig | 1 + arch/riscv/cpu/fu540/Makefile | 1 - arch/riscv/cpu/fu540/cache.c | 29 ----------------------- arch/riscv/cpu/fu740/Kconfig | 1 + arch/riscv/cpu/fu740/Makefile | 1 - arch/riscv/cpu/fu740/cache.c | 29 ----------------------- arch/riscv/include/asm/arch-fu540/cache.h | 14 ----------- arch/riscv/include/asm/arch-fu740/cache.h | 14 ----------- board/sifive/unleashed/unleashed.c | 4 ++-- board/sifive/unmatched/unmatched.c | 4 ++-- 10 files changed, 6 insertions(+), 92 deletions(-) delete mode 100644 arch/riscv/cpu/fu540/cache.c delete mode 100644 arch/riscv/cpu/fu740/cache.c delete mode 100644 arch/riscv/include/asm/arch-fu540/cache.h delete mode 100644 arch/riscv/include/asm/arch-fu740/cache.h diff --git a/arch/riscv/cpu/fu540/Kconfig b/arch/riscv/cpu/fu540/Kconfig index 8608741779..1604b412b4 100644 --- a/arch/riscv/cpu/fu540/Kconfig +++ b/arch/riscv/cpu/fu540/Kconfig @@ -19,6 +19,7 @@ config SIFIVE_FU540 imply SMP imply CLK_SIFIVE imply CLK_SIFIVE_PRCI + imply SIFIVE_CACHE imply SIFIVE_CCACHE imply SIFIVE_SERIAL imply MACB diff --git a/arch/riscv/cpu/fu540/Makefile b/arch/riscv/cpu/fu540/Makefile index 088205ef57..043fb961a5 100644 --- a/arch/riscv/cpu/fu540/Makefile +++ b/arch/riscv/cpu/fu540/Makefile @@ -8,5 +8,4 @@ obj-y += spl.o else obj-y += dram.o obj-y += cpu.o -obj-y += cache.o endif diff --git a/arch/riscv/cpu/fu540/cache.c b/arch/riscv/cpu/fu540/cache.c deleted file mode 100644 index bc31f664b8..0000000000 --- a/arch/riscv/cpu/fu540/cache.c +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (C) 2020 - 2021 SiFive, Inc - * - * Authors: - * Pragnesh Patel - */ - -#include -#include -#include - -int sifive_ccache_enable_ways(void) -{ - struct udevice *dev; - int ret; - - ret = uclass_get_device_by_driver(UCLASS_CACHE, - DM_DRIVER_GET(sifive_ccache), - &dev); - if (ret) - return log_msg_ret("Cannot enable cache ways", ret); - - ret = cache_enable(dev); - if (ret) - return log_msg_ret("ccache enable failed", ret); - - return 0; -} diff --git a/arch/riscv/cpu/fu740/Kconfig b/arch/riscv/cpu/fu740/Kconfig index b4cada0ea9..049a0a0584 100644 --- a/arch/riscv/cpu/fu740/Kconfig +++ b/arch/riscv/cpu/fu740/Kconfig @@ -19,6 +19,7 @@ config SIFIVE_FU740 imply SMP imply CLK_SIFIVE imply CLK_SIFIVE_PRCI + imply SIFIVE_CACHE imply SIFIVE_CCACHE imply SIFIVE_SERIAL imply MACB diff --git a/arch/riscv/cpu/fu740/Makefile b/arch/riscv/cpu/fu740/Makefile index 5ef8ac18a7..1d1ad98ba7 100644 --- a/arch/riscv/cpu/fu740/Makefile +++ b/arch/riscv/cpu/fu740/Makefile @@ -8,5 +8,4 @@ obj-y += spl.o else obj-y += dram.o obj-y += cpu.o -obj-y += cache.o endif diff --git a/arch/riscv/cpu/fu740/cache.c b/arch/riscv/cpu/fu740/cache.c deleted file mode 100644 index e2782d76c0..0000000000 --- a/arch/riscv/cpu/fu740/cache.c +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (C) 2020-2021 SiFive, Inc - * - * Authors: - * Pragnesh Patel - */ - -#include -#include -#include - -int sifive_ccache_enable_ways(void) -{ - struct udevice *dev; - int ret; - - ret = uclass_get_device_by_driver(UCLASS_CACHE, - DM_DRIVER_GET(sifive_ccache), - &dev); - if (ret) - return log_msg_ret("Cannot enable cache ways", ret); - - ret = cache_enable(dev); - if (ret) - return log_msg_ret("ccache enable failed", ret); - - return 0; -} diff --git a/arch/riscv/include/asm/arch-fu540/cache.h b/arch/riscv/include/asm/arch-fu540/cache.h deleted file mode 100644 index c252eb64d1..0000000000 --- a/arch/riscv/include/asm/arch-fu540/cache.h +++ /dev/null @@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * Copyright (C) 2020 SiFive, Inc. - * - * Authors: - * Pragnesh Patel - */ - -#ifndef _CACHE_SIFIVE_H -#define _CACHE_SIFIVE_H - -int sifive_ccache_enable_ways(void); - -#endif /* _CACHE_SIFIVE_H */ diff --git a/arch/riscv/include/asm/arch-fu740/cache.h b/arch/riscv/include/asm/arch-fu740/cache.h deleted file mode 100644 index 8c456e3658..0000000000 --- a/arch/riscv/include/asm/arch-fu740/cache.h +++ /dev/null @@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * Copyright (C) 2020-2021 SiFive, Inc. - * - * Authors: - * Pragnesh Patel - */ - -#ifndef _CACHE_SIFIVE_H -#define _CACHE_SIFIVE_H - -int sifive_ccache_enable_ways(void); - -#endif /* _CACHE_SIFIVE_H */ diff --git a/board/sifive/unleashed/unleashed.c b/board/sifive/unleashed/unleashed.c index 12e61ec85f..6d697d797d 100644 --- a/board/sifive/unleashed/unleashed.c +++ b/board/sifive/unleashed/unleashed.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include /* @@ -127,5 +127,5 @@ void *board_fdt_blob_setup(void) int board_init(void) { /* enable all cache ways */ - return sifive_ccache_enable_ways(); + return cache_init(); } diff --git a/board/sifive/unmatched/unmatched.c b/board/sifive/unmatched/unmatched.c index d27c4d3e88..f4fc2a793d 100644 --- a/board/sifive/unmatched/unmatched.c +++ b/board/sifive/unmatched/unmatched.c @@ -8,7 +8,7 @@ #include #include -#include +#include #include #if defined(CONFIG_OF_SEPARATE) @@ -24,5 +24,5 @@ void *board_fdt_blob_setup(void) int board_init(void) { /* enable all cache ways */ - return sifive_ccache_enable_ways(); + return cache_init(); } -- 2.32.0