mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-07-05 05:42:51 +00:00
cache: add flush_range interface in cache_ops struct
Signed-off-by: Wei Fu <wefu@redhat.com>
This commit is contained in:
parent
8d75a9b1f2
commit
1aea567a29
2 changed files with 32 additions and 0 deletions
11
drivers/cache/cache-uclass.c
vendored
11
drivers/cache/cache-uclass.c
vendored
|
@ -39,6 +39,17 @@ int cache_disable(struct udevice *dev)
|
||||||
return ops->disable(dev);
|
return ops->disable(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int flush_range(struct udevice *dev, unsigned long start, unsigned long end)
|
||||||
|
{
|
||||||
|
struct cache_ops *ops = cache_get_ops(dev);
|
||||||
|
|
||||||
|
if (!ops->flush_range)
|
||||||
|
return -ENOSYS;
|
||||||
|
|
||||||
|
return ops->flush_range(dev, start, end);
|
||||||
|
}
|
||||||
|
|
||||||
UCLASS_DRIVER(cache) = {
|
UCLASS_DRIVER(cache) = {
|
||||||
.id = UCLASS_CACHE,
|
.id = UCLASS_CACHE,
|
||||||
.name = "cache",
|
.name = "cache",
|
||||||
|
|
|
@ -40,6 +40,17 @@ struct cache_ops {
|
||||||
* @return 0 if OK, -ve on error
|
* @return 0 if OK, -ve on error
|
||||||
*/
|
*/
|
||||||
int (*disable)(struct udevice *dev);
|
int (*disable)(struct udevice *dev);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* flush_range() - Flush cache in a range
|
||||||
|
*
|
||||||
|
* @dev: Device to check (UCLASS_CACHE)
|
||||||
|
* @start: start address of the range
|
||||||
|
* @end: end address of the range
|
||||||
|
* @return 0 if OK, -ve on error
|
||||||
|
*/
|
||||||
|
int (*flush_range)(struct udevice *dev,
|
||||||
|
unsigned long start, unsigned long end);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define cache_get_ops(dev) ((struct cache_ops *)(dev)->driver->ops)
|
#define cache_get_ops(dev) ((struct cache_ops *)(dev)->driver->ops)
|
||||||
|
@ -68,4 +79,14 @@ int cache_enable(struct udevice *dev);
|
||||||
* @return 0 if OK, -ve on error
|
* @return 0 if OK, -ve on error
|
||||||
*/
|
*/
|
||||||
int cache_disable(struct udevice *dev);
|
int cache_disable(struct udevice *dev);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* flush_range() - Flush cache
|
||||||
|
*
|
||||||
|
* @dev: Device to check (UCLASS_CACHE)
|
||||||
|
* @start: start address of the range
|
||||||
|
* @end: end address of the range
|
||||||
|
* @return 0 if OK, -ve on error
|
||||||
|
*/
|
||||||
|
int flush_range(struct udevice *dev, unsigned long start, unsigned long end);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue