Prepare v2025.01
[u-boot.git] / include / axi.h
blob133a06ee27198ec1897fe832796751d25a88ff95
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3 * (C) Copyright 2017, 2018
4 * Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
5 */
7 #ifndef _AXI_H_
8 #define _AXI_H_
10 #include <linux/types.h>
12 struct udevice;
14 /**
15 * enum axi_size_t - Determine size of AXI transfer
16 * @AXI_SIZE_8: AXI sransfer is 8-bit wide
17 * @AXI_SIZE_16: AXI sransfer is 16-bit wide
18 * @AXI_SIZE_32: AXI sransfer is 32-bit wide
20 enum axi_size_t {
21 AXI_SIZE_8,
22 AXI_SIZE_16,
23 AXI_SIZE_32,
26 struct axi_ops {
27 /**
28 * read() - Read a single value from a specified address on a AXI bus
29 * @dev: AXI bus to read from.
30 * @address: The address to read from.
31 * @data: Pointer to a variable that takes the data value read
32 * from the address on the AXI bus.
33 * @size: The size of the data to be read.
35 * Return: 0 if OK, -ve on error.
37 int (*read)(struct udevice *dev, ulong address, void *data,
38 enum axi_size_t size);
40 /**
41 * write() - Write a single value to a specified address on a AXI bus
42 * @dev: AXI bus to write to.
43 * @address: The address to write to.
44 * @data: Pointer to the data value to be written to the address
45 * on the AXI bus.
46 * @size: The size of the data to write.
48 * Return 0 if OK, -ve on error.
50 int (*write)(struct udevice *dev, ulong address, void *data,
51 enum axi_size_t size);
54 #define axi_get_ops(dev) ((struct axi_ops *)(dev)->driver->ops)
56 /**
57 * axi_read() - Read a single value from a specified address on a AXI bus
58 * @dev: AXI bus to read from.
59 * @address: The address to read from.
60 * @data: Pointer to a variable that takes the data value read from the
61 * address on the AXI bus.
62 * @size: The size of the data to write.
64 * Return: 0 if OK, -ve on error.
66 int axi_read(struct udevice *dev, ulong address, void *data,
67 enum axi_size_t size);
69 /**
70 * axi_write() - Write a single value to a specified address on a AXI bus
71 * @dev: AXI bus to write to.
72 * @address: The address to write to.
73 * @data: Pointer to the data value to be written to the address on the
74 * AXI bus.
75 * @size: The size of the data to write.
77 * Return: 0 if OK, -ve on error.
79 int axi_write(struct udevice *dev, ulong address, void *data,
80 enum axi_size_t size);
82 struct axi_emul_ops {
83 /**
84 * read() - Read a single value from a specified address on a AXI bus
85 * @dev: AXI bus to read from.
86 * @address: The address to read from.
87 * @data: Pointer to a variable that takes the data value read
88 * from the address on the AXI bus.
89 * @size: The size of the data to be read.
91 * Return: 0 if OK, -ve on error.
93 int (*read)(struct udevice *dev, ulong address, void *data,
94 enum axi_size_t size);
96 /**
97 * write() - Write a single value to a specified address on a AXI bus
98 * @dev: AXI bus to write to.
99 * @address: The address to write to.
100 * @data: Pointer to the data value to be written to the address
101 * on the AXI bus.
102 * @size: The size of the data to write.
104 * Return: 0 if OK, -ve on error.
106 int (*write)(struct udevice *dev, ulong address, void *data,
107 enum axi_size_t size);
110 * get_store() - Get address of internal storage of a emulated AXI
111 * device
112 * @dev: Emulated AXI device to get the pointer of the internal
113 * storage for.
114 * @storep: Pointer to the internal storage of the emulated AXI
115 * device.
117 * Return: 0 if OK, -ve on error.
119 int (*get_store)(struct udevice *dev, u8 **storep);
122 #endif