aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini2018-08-11 19:48:13 -0400
committerTom Rini2018-08-11 19:48:13 -0400
commit282ce6454c45409805e2c470bbec170d21a4bd35 (patch)
treeb10634fb8f5d0e8ef3b772d6059f66138d8bbc5a /include
parenta032e0a6aed208977f48e78d2cc497b91543beaf (diff)
parent25a9f9747a84b36f61f575d592eddc96bce5dabb (diff)
Merge branch 'master' of git://git.denx.de/u-boot-video
Diffstat (limited to 'include')
-rw-r--r--include/axi.h118
-rw-r--r--include/dm/uclass-id.h2
2 files changed, 120 insertions, 0 deletions
diff --git a/include/axi.h b/include/axi.h
new file mode 100644
index 00000000000..3e40692cdfd
--- /dev/null
+++ b/include/axi.h
@@ -0,0 +1,118 @@
+/* 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_
+
+/**
+ * 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
diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
index a39643ec5ee..7027ea076db 100644
--- a/include/dm/uclass-id.h
+++ b/include/dm/uclass-id.h
@@ -23,6 +23,7 @@ enum uclass_id {
UCLASS_I2C_EMUL, /* sandbox I2C device emulator */
UCLASS_PCI_EMUL, /* sandbox PCI device emulator */
UCLASS_USB_EMUL, /* sandbox USB bus device emulator */
+ UCLASS_AXI_EMUL, /* sandbox AXI bus device emulator */
UCLASS_SIMPLE_BUS, /* bus with child devices */
/* U-Boot uclasses start here - in alphabetical order */
@@ -43,6 +44,7 @@ enum uclass_id {
UCLASS_I2C_GENERIC, /* Generic I2C device */
UCLASS_I2C_MUX, /* I2C multiplexer */
UCLASS_IDE, /* IDE device */
+ UCLASS_AXI, /* AXI bus */
UCLASS_IRQ, /* Interrupt controller */
UCLASS_KEYBOARD, /* Keyboard input device */
UCLASS_LED, /* Light-emitting diode (LED) */