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 <cache.h> |
| 9 | #include <dm.h> |
| 10 | |
| 11 | int cache_get_info(struct udevice *dev, struct cache_info *info) |
| 12 | { |
| 13 | struct cache_ops *ops = cache_get_ops(dev); |
| 14 | |
| 15 | if (!ops->get_info) |
| 16 | return -ENOSYS; |
| 17 | |
| 18 | return ops->get_info(dev, info); |
| 19 | } |
| 20 | |
Rick Chen | 0e6cfa4 | 2019-08-28 18:46:04 +0800 | [diff] [blame] | 21 | int cache_enable(struct udevice *dev) |
| 22 | { |
| 23 | struct cache_ops *ops = cache_get_ops(dev); |
| 24 | |
| 25 | if (!ops->enable) |
| 26 | return -ENOSYS; |
| 27 | |
| 28 | return ops->enable(dev); |
| 29 | } |
| 30 | |
| 31 | int cache_disable(struct udevice *dev) |
| 32 | { |
| 33 | struct cache_ops *ops = cache_get_ops(dev); |
| 34 | |
| 35 | if (!ops->disable) |
| 36 | return -ENOSYS; |
| 37 | |
| 38 | return ops->disable(dev); |
| 39 | } |
| 40 | |
Dinh Nguyen | d94e18e | 2019-04-23 16:55:03 -0500 | [diff] [blame] | 41 | UCLASS_DRIVER(cache) = { |
| 42 | .id = UCLASS_CACHE, |
| 43 | .name = "cache", |
| 44 | .post_bind = dm_scan_fdt_dev, |
| 45 | }; |