Dinh Nguyen | d94e18e | 2019-04-23 16:55:03 -0500 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright (C) 2019 Intel Corporation <www.intel.com> |
| 4 | */ |
| 5 | |
Patrick Delaunay | 8131335 | 2021-04-27 11:02:19 +0200 | [diff] [blame^] | 6 | #define LOG_CATEGORY UCLASS_CACHE |
| 7 | |
Dinh Nguyen | d94e18e | 2019-04-23 16:55:03 -0500 | [diff] [blame] | 8 | #include <common.h> |
| 9 | #include <cache.h> |
| 10 | #include <dm.h> |
| 11 | |
| 12 | int cache_get_info(struct udevice *dev, struct cache_info *info) |
| 13 | { |
| 14 | struct cache_ops *ops = cache_get_ops(dev); |
| 15 | |
| 16 | if (!ops->get_info) |
| 17 | return -ENOSYS; |
| 18 | |
| 19 | return ops->get_info(dev, info); |
| 20 | } |
| 21 | |
Rick Chen | 0e6cfa4 | 2019-08-28 18:46:04 +0800 | [diff] [blame] | 22 | int cache_enable(struct udevice *dev) |
| 23 | { |
| 24 | struct cache_ops *ops = cache_get_ops(dev); |
| 25 | |
| 26 | if (!ops->enable) |
| 27 | return -ENOSYS; |
| 28 | |
| 29 | return ops->enable(dev); |
| 30 | } |
| 31 | |
| 32 | int cache_disable(struct udevice *dev) |
| 33 | { |
| 34 | struct cache_ops *ops = cache_get_ops(dev); |
| 35 | |
| 36 | if (!ops->disable) |
| 37 | return -ENOSYS; |
| 38 | |
| 39 | return ops->disable(dev); |
| 40 | } |
| 41 | |
Dinh Nguyen | d94e18e | 2019-04-23 16:55:03 -0500 | [diff] [blame] | 42 | UCLASS_DRIVER(cache) = { |
| 43 | .id = UCLASS_CACHE, |
| 44 | .name = "cache", |
| 45 | .post_bind = dm_scan_fdt_dev, |
| 46 | }; |