xref: /openbmc/u-boot/drivers/axi/axi-uclass.c (revision 3ba98ed8)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (C) Copyright 2017
4  * Mario Six,  Guntermann & Drunck GmbH, mario.six@gdsys.cc
5  */
6 
7 #include <common.h>
8 #include <dm.h>
9 #include <axi.h>
10 
11 int axi_read(struct udevice *dev, ulong address, void *data,
12 	     enum axi_size_t size)
13 {
14 	struct axi_ops *ops = axi_get_ops(dev);
15 
16 	if (!ops->read)
17 		return -ENOSYS;
18 
19 	return ops->read(dev, address, data, size);
20 }
21 
22 int axi_write(struct udevice *dev, ulong address, void *data,
23 	      enum axi_size_t size)
24 {
25 	struct axi_ops *ops = axi_get_ops(dev);
26 
27 	if (!ops->write)
28 		return -ENOSYS;
29 
30 	return ops->write(dev, address, data, size);
31 }
32 
33 UCLASS_DRIVER(axi) = {
34 	.id		= UCLASS_AXI,
35 	.name		= "axi",
36 	.post_bind	= dm_scan_fdt_dev,
37 	.flags		= DM_UC_FLAG_SEQ_ALIAS,
38 };
39 
40