1 // SPDX-License-Identifier: GPL-2.0+
4 * Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
7 #define LOG_CATEGORY UCLASS_AXI_EMUL
12 #include <dm/device-internal.h>
15 int axi_sandbox_get_emul(struct udevice *bus, ulong address,
16 const enum axi_size_t size, struct udevice **emulp)
33 debug("%s: Unknown AXI transfer size '%d'", bus->name, size);
38 * Note: device_find_* don't activate the devices; they're activated
41 for (device_find_first_child(bus, &dev);
43 device_find_next_child(&dev)) {
46 ret = dev_read_u32_array(dev, "reg", reg, ARRAY_SIZE(reg));
48 debug("%s: Could not read 'reg' property of %s\n",
49 bus->name, dev->name);
54 * Does the transfer's address fall into this device's address
57 if (address >= reg[0] && address <= reg[0] + reg[1] - offset) {
58 /* If yes, activate it... */
59 if (device_probe(dev)) {
60 debug("%s: Could not activate %s\n",
61 bus->name, dev->name);
65 /* ...and return it */
74 int axi_get_store(struct udevice *dev, u8 **storep)
76 struct axi_emul_ops *ops = axi_emul_get_ops(dev);
81 return ops->get_store(dev, storep);
84 UCLASS_DRIVER(axi_emul) = {
85 .id = UCLASS_AXI_EMUL,