blob: 39b0248c32342d93071b99a127e37b61453cf40f [file] [log] [blame]
Zong Li213ed172021-09-01 15:01:41 +08001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2021 SiFive, Inc
4 */
5
Zong Li213ed172021-09-01 15:01:41 +08006#include <cache.h>
7#include <cpu_func.h>
Tom Rini0b9441a2023-10-12 19:03:59 -04008#include <log.h>
Zong Li213ed172021-09-01 15:01:41 +08009#include <dm.h>
10
11void enable_caches(void)
12{
13 struct udevice *dev;
14 int ret;
15
16 /* Enable ways of ccache */
17 ret = uclass_get_device_by_driver(UCLASS_CACHE,
18 DM_DRIVER_GET(sifive_ccache),
19 &dev);
20 if (ret) {
21 log_debug("Cannot enable cache ways");
22 } else {
23 ret = cache_enable(dev);
24 if (ret)
25 log_debug("ccache enable failed");
26 }
27}