2019-04-23 21:55:03 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2019 Intel Corporation <www.intel.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __CACHE_H
|
|
|
|
#define __CACHE_H
|
|
|
|
|
2023-10-12 23:03:54 +00:00
|
|
|
#include <linux/types.h>
|
|
|
|
|
2020-10-31 03:38:53 +00:00
|
|
|
struct udevice;
|
|
|
|
|
2019-04-23 21:55:03 +00:00
|
|
|
/*
|
|
|
|
* Structure for the cache controller
|
|
|
|
*/
|
|
|
|
struct cache_info {
|
|
|
|
phys_addr_t base; /* Base physical address of cache device. */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cache_ops {
|
|
|
|
/**
|
|
|
|
* get_info() - Get basic cache info
|
|
|
|
*
|
|
|
|
* @dev: Device to check (UCLASS_CACHE)
|
|
|
|
* @info: Place to put info
|
|
|
|
* @return 0 if OK, -ve on error
|
|
|
|
*/
|
|
|
|
int (*get_info)(struct udevice *dev, struct cache_info *info);
|
2019-08-28 10:46:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* enable() - Enable cache
|
|
|
|
*
|
|
|
|
* @dev: Device to check (UCLASS_CACHE)
|
|
|
|
* @return 0 if OK, -ve on error
|
|
|
|
*/
|
|
|
|
int (*enable)(struct udevice *dev);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* disable() - Flush and disable cache
|
|
|
|
*
|
|
|
|
* @dev: Device to check (UCLASS_CACHE)
|
|
|
|
* @return 0 if OK, -ve on error
|
|
|
|
*/
|
|
|
|
int (*disable)(struct udevice *dev);
|
2019-04-23 21:55:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define cache_get_ops(dev) ((struct cache_ops *)(dev)->driver->ops)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* cache_get_info() - Get information about a cache controller
|
|
|
|
*
|
|
|
|
* @dev: Device to check (UCLASS_CACHE)
|
|
|
|
* @info: Returns cache info
|
2022-01-19 17:05:50 +00:00
|
|
|
* Return: 0 if OK, -ve on error
|
2019-04-23 21:55:03 +00:00
|
|
|
*/
|
|
|
|
int cache_get_info(struct udevice *dev, struct cache_info *info);
|
|
|
|
|
2019-08-28 10:46:04 +00:00
|
|
|
/**
|
|
|
|
* cache_enable() - Enable cache
|
|
|
|
*
|
|
|
|
* @dev: Device to check (UCLASS_CACHE)
|
2022-01-19 17:05:50 +00:00
|
|
|
* Return: 0 if OK, -ve on error
|
2019-08-28 10:46:04 +00:00
|
|
|
*/
|
|
|
|
int cache_enable(struct udevice *dev);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* cache_disable() - Flush and disable cache
|
|
|
|
*
|
|
|
|
* @dev: Device to check (UCLASS_CACHE)
|
2022-01-19 17:05:50 +00:00
|
|
|
* Return: 0 if OK, -ve on error
|
2019-08-28 10:46:04 +00:00
|
|
|
*/
|
|
|
|
int cache_disable(struct udevice *dev);
|
2019-04-23 21:55:03 +00:00
|
|
|
#endif
|