1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2019 Intel Corporation <www.intel.com>
4  */
5 
6 #include <common.h>
7 #include <cache.h>
8 #include <dm.h>
9 
cache_get_info(struct udevice * dev,struct cache_info * info)10 int cache_get_info(struct udevice *dev, struct cache_info *info)
11 {
12 	struct cache_ops *ops = cache_get_ops(dev);
13 
14 	if (!ops->get_info)
15 		return -ENOSYS;
16 
17 	return ops->get_info(dev, info);
18 }
19 
cache_enable(struct udevice * dev)20 int cache_enable(struct udevice *dev)
21 {
22 	struct cache_ops *ops = cache_get_ops(dev);
23 
24 	if (!ops->enable)
25 		return -ENOSYS;
26 
27 	return ops->enable(dev);
28 }
29 
cache_disable(struct udevice * dev)30 int cache_disable(struct udevice *dev)
31 {
32 	struct cache_ops *ops = cache_get_ops(dev);
33 
34 	if (!ops->disable)
35 		return -ENOSYS;
36 
37 	return ops->disable(dev);
38 }
39 
40 UCLASS_DRIVER(cache) = {
41 	.id		= UCLASS_CACHE,
42 	.name		= "cache",
43 	.post_bind	= dm_scan_fdt_dev,
44 };
45