Zong Li | 213ed17 | 2021-09-01 15:01:41 +0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright (C) 2021 SiFive, Inc |
| 4 | */ |
| 5 | |
Zong Li | 213ed17 | 2021-09-01 15:01:41 +0800 | [diff] [blame] | 6 | #include <cache.h> |
| 7 | #include <cpu_func.h> |
Tom Rini | 0b9441a | 2023-10-12 19:03:59 -0400 | [diff] [blame] | 8 | #include <log.h> |
Zong Li | 213ed17 | 2021-09-01 15:01:41 +0800 | [diff] [blame] | 9 | #include <dm.h> |
| 10 | |
| 11 | void 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 | } |