mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-09-20 05:11:30 +02:00
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
78 lines
1.9 KiB
C
78 lines
1.9 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* (C) Copyright 2018
|
|
* Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <axi.h>
|
|
#include <dm.h>
|
|
#include <asm/axi.h>
|
|
|
|
/*
|
|
* This driver implements a AXI bus for the sandbox architecture for testing
|
|
* purposes.
|
|
*
|
|
* The bus forwards every access to it to a special AXI emulation device (which
|
|
* it gets via the axi_emul_get_ops function) that implements a simple
|
|
* read/write storage.
|
|
*
|
|
* The emulator device must still be contained in the device tree in the usual
|
|
* way, since configuration data for the storage is read from the DT.
|
|
*/
|
|
|
|
static int axi_sandbox_read(struct udevice *bus, ulong address, void *data,
|
|
enum axi_size_t size)
|
|
{
|
|
struct axi_emul_ops *ops;
|
|
struct udevice *emul;
|
|
int ret;
|
|
|
|
/* Get emulator device */
|
|
ret = axi_sandbox_get_emul(bus, address, size, &emul);
|
|
if (ret)
|
|
return ret == -ENODEV ? 0 : ret;
|
|
/* Forward all reads to the AXI emulator */
|
|
ops = axi_emul_get_ops(emul);
|
|
if (!ops || !ops->read)
|
|
return -ENOSYS;
|
|
|
|
return ops->read(emul, address, data, size);
|
|
}
|
|
|
|
static int axi_sandbox_write(struct udevice *bus, ulong address, void *data,
|
|
enum axi_size_t size)
|
|
{
|
|
struct axi_emul_ops *ops;
|
|
struct udevice *emul;
|
|
int ret;
|
|
|
|
/* Get emulator device */
|
|
ret = axi_sandbox_get_emul(bus, address, size, &emul);
|
|
if (ret)
|
|
return ret == -ENODEV ? 0 : ret;
|
|
/* Forward all writes to the AXI emulator */
|
|
ops = axi_emul_get_ops(emul);
|
|
if (!ops || !ops->write)
|
|
return -ENOSYS;
|
|
|
|
return ops->write(emul, address, data, size);
|
|
}
|
|
|
|
static const struct udevice_id axi_sandbox_ids[] = {
|
|
{ .compatible = "sandbox,axi" },
|
|
{ /* sentinel */ }
|
|
};
|
|
|
|
static const struct axi_ops axi_sandbox_ops = {
|
|
.read = axi_sandbox_read,
|
|
.write = axi_sandbox_write,
|
|
};
|
|
|
|
U_BOOT_DRIVER(axi_sandbox_bus) = {
|
|
.name = "axi_sandbox_bus",
|
|
.id = UCLASS_AXI,
|
|
.of_match = axi_sandbox_ids,
|
|
.ops = &axi_sandbox_ops,
|
|
};
|