"Das U-Boot" Source Tree
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2019 Intel Corporation <www.intel.com>
4 */
5
6#ifndef __CACHE_H
7#define __CACHE_H
8
9#include <linux/types.h>
10
11struct udevice;
12
13/*
14 * Structure for the cache controller
15 */
16struct cache_info {
17 phys_addr_t base; /* Base physical address of cache device. */
18};
19
20struct cache_ops {
21 /**
22 * get_info() - Get basic cache info
23 *
24 * @dev: Device to check (UCLASS_CACHE)
25 * @info: Place to put info
26 * @return 0 if OK, -ve on error
27 */
28 int (*get_info)(struct udevice *dev, struct cache_info *info);
29
30 /**
31 * enable() - Enable cache
32 *
33 * @dev: Device to check (UCLASS_CACHE)
34 * @return 0 if OK, -ve on error
35 */
36 int (*enable)(struct udevice *dev);
37
38 /**
39 * disable() - Flush and disable cache
40 *
41 * @dev: Device to check (UCLASS_CACHE)
42 * @return 0 if OK, -ve on error
43 */
44 int (*disable)(struct udevice *dev);
45};
46
47#define cache_get_ops(dev) ((struct cache_ops *)(dev)->driver->ops)
48
49/**
50 * cache_get_info() - Get information about a cache controller
51 *
52 * @dev: Device to check (UCLASS_CACHE)
53 * @info: Returns cache info
54 * Return: 0 if OK, -ve on error
55 */
56int cache_get_info(struct udevice *dev, struct cache_info *info);
57
58/**
59 * cache_enable() - Enable cache
60 *
61 * @dev: Device to check (UCLASS_CACHE)
62 * Return: 0 if OK, -ve on error
63 */
64int cache_enable(struct udevice *dev);
65
66/**
67 * cache_disable() - Flush and disable cache
68 *
69 * @dev: Device to check (UCLASS_CACHE)
70 * Return: 0 if OK, -ve on error
71 */
72int cache_disable(struct udevice *dev);
73#endif