mirror of
https://github.com/u-boot/u-boot.git
synced 2024-12-15 15:53:26 +08:00
401d1c4f5d
Move this out of the common header and include it only where needed. In a number of cases this requires adding "struct udevice;" to avoid adding another large header or in other cases replacing / adding missing header files that had been pulled in, very indirectly. Finally, we have a few cases where we did not need to include <asm/global_data.h> at all, so remove that include. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
121 lines
3.3 KiB
C
121 lines
3.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
/*
|
|
* (C) Copyright 2017, 2018
|
|
* Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
|
|
*/
|
|
|
|
#ifndef _AXI_H_
|
|
#define _AXI_H_
|
|
|
|
struct udevice;
|
|
|
|
/**
|
|
* enum axi_size_t - Determine size of AXI transfer
|
|
* @AXI_SIZE_8: AXI sransfer is 8-bit wide
|
|
* @AXI_SIZE_16: AXI sransfer is 16-bit wide
|
|
* @AXI_SIZE_32: AXI sransfer is 32-bit wide
|
|
*/
|
|
enum axi_size_t {
|
|
AXI_SIZE_8,
|
|
AXI_SIZE_16,
|
|
AXI_SIZE_32,
|
|
};
|
|
|
|
struct axi_ops {
|
|
/**
|
|
* read() - Read a single value from a specified address on a AXI bus
|
|
* @dev: AXI bus to read from.
|
|
* @address: The address to read from.
|
|
* @data: Pointer to a variable that takes the data value read
|
|
* from the address on the AXI bus.
|
|
* @size: The size of the data to be read.
|
|
*
|
|
* Return: 0 if OK, -ve on error.
|
|
*/
|
|
int (*read)(struct udevice *dev, ulong address, void *data,
|
|
enum axi_size_t size);
|
|
|
|
/**
|
|
* write() - Write a single value to a specified address on a AXI bus
|
|
* @dev: AXI bus to write to.
|
|
* @address: The address to write to.
|
|
* @data: Pointer to the data value to be written to the address
|
|
* on the AXI bus.
|
|
* @size: The size of the data to write.
|
|
*
|
|
* Return 0 if OK, -ve on error.
|
|
*/
|
|
int (*write)(struct udevice *dev, ulong address, void *data,
|
|
enum axi_size_t size);
|
|
};
|
|
|
|
#define axi_get_ops(dev) ((struct axi_ops *)(dev)->driver->ops)
|
|
|
|
/**
|
|
* axi_read() - Read a single value from a specified address on a AXI bus
|
|
* @dev: AXI bus to read from.
|
|
* @address: The address to read from.
|
|
* @data: Pointer to a variable that takes the data value read from the
|
|
* address on the AXI bus.
|
|
* @size: The size of the data to write.
|
|
*
|
|
* Return: 0 if OK, -ve on error.
|
|
*/
|
|
int axi_read(struct udevice *dev, ulong address, void *data,
|
|
enum axi_size_t size);
|
|
|
|
/**
|
|
* axi_write() - Write a single value to a specified address on a AXI bus
|
|
* @dev: AXI bus to write to.
|
|
* @address: The address to write to.
|
|
* @data: Pointer to the data value to be written to the address on the
|
|
* AXI bus.
|
|
* @size: The size of the data to write.
|
|
*
|
|
* Return: 0 if OK, -ve on error.
|
|
*/
|
|
int axi_write(struct udevice *dev, ulong address, void *data,
|
|
enum axi_size_t size);
|
|
|
|
struct axi_emul_ops {
|
|
/**
|
|
* read() - Read a single value from a specified address on a AXI bus
|
|
* @dev: AXI bus to read from.
|
|
* @address: The address to read from.
|
|
* @data: Pointer to a variable that takes the data value read
|
|
* from the address on the AXI bus.
|
|
* @size: The size of the data to be read.
|
|
*
|
|
* Return: 0 if OK, -ve on error.
|
|
*/
|
|
int (*read)(struct udevice *dev, ulong address, void *data,
|
|
enum axi_size_t size);
|
|
|
|
/**
|
|
* write() - Write a single value to a specified address on a AXI bus
|
|
* @dev: AXI bus to write to.
|
|
* @address: The address to write to.
|
|
* @data: Pointer to the data value to be written to the address
|
|
* on the AXI bus.
|
|
* @size: The size of the data to write.
|
|
*
|
|
* Return: 0 if OK, -ve on error.
|
|
*/
|
|
int (*write)(struct udevice *dev, ulong address, void *data,
|
|
enum axi_size_t size);
|
|
|
|
/**
|
|
* get_store() - Get address of internal storage of a emulated AXI
|
|
* device
|
|
* @dev: Emulated AXI device to get the pointer of the internal
|
|
* storage for.
|
|
* @storep: Pointer to the internal storage of the emulated AXI
|
|
* device.
|
|
*
|
|
* Return: 0 if OK, -ve on error.
|
|
*/
|
|
int (*get_store)(struct udevice *dev, u8 **storep);
|
|
};
|
|
|
|
#endif
|