]> git.ipfire.org Git - thirdparty/u-boot.git/blame - include/cache.h
configs: at91: sama7g54_curiosity: Add initial default configs
[thirdparty/u-boot.git] / include / cache.h
CommitLineData
84b124db
DN
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
12c00f9e
TR
9#include <linux/types.h>
10
401d1c4f
SG
11struct udevice;
12
84b124db
DN
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);
4d0140ee
RC
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);
84b124db
DN
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
185f812c 54 * Return: 0 if OK, -ve on error
84b124db
DN
55 */
56int cache_get_info(struct udevice *dev, struct cache_info *info);
57
4d0140ee
RC
58/**
59 * cache_enable() - Enable cache
60 *
61 * @dev: Device to check (UCLASS_CACHE)
185f812c 62 * Return: 0 if OK, -ve on error
4d0140ee
RC
63 */
64int cache_enable(struct udevice *dev);
65
66/**
67 * cache_disable() - Flush and disable cache
68 *
69 * @dev: Device to check (UCLASS_CACHE)
185f812c 70 * Return: 0 if OK, -ve on error
4d0140ee
RC
71 */
72int cache_disable(struct udevice *dev);
84b124db 73#endif