1 // SPDX-License-Identifier: GPL-2.0+
4 * Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
10 #include <dm/device-internal.h>
13 int axi_sandbox_get_emul(struct udevice *bus, ulong address,
14 enum axi_size_t size, struct udevice **emulp)
31 debug("%s: Unknown AXI transfer size '%d'", bus->name, size);
36 * Note: device_find_* don't activate the devices; they're activated
39 for (device_find_first_child(bus, &dev);
41 device_find_next_child(&dev)) {
44 ret = dev_read_u32_array(dev, "reg", reg, ARRAY_SIZE(reg));
46 debug("%s: Could not read 'reg' property of %s\n",
47 bus->name, dev->name);
52 * Does the transfer's address fall into this device's address
55 if (address >= reg[0] && address <= reg[0] + reg[1] - offset) {
56 /* If yes, activate it... */
57 if (device_probe(dev)) {
58 debug("%s: Could not activate %s\n",
59 bus->name, dev->name);
63 /* ...and return it */
72 int axi_get_store(struct udevice *dev, u8 **storep)
74 struct axi_emul_ops *ops = axi_emul_get_ops(dev);
79 return ops->get_store(dev, storep);
82 UCLASS_DRIVER(axi_emul) = {
83 .id = UCLASS_AXI_EMUL,