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 #define LOG_CATEGORY UCLASS_AXI
8 
9 #include <common.h>
10 #include <dm.h>
11 #include <axi.h>
12 
axi_read(struct udevice * dev,ulong address,void * data,enum axi_size_t size)13 int axi_read(struct udevice *dev, ulong address, void *data,
14 	     enum axi_size_t size)
15 {
16 	struct axi_ops *ops = axi_get_ops(dev);
17 
18 	if (!ops->read)
19 		return -ENOSYS;
20 
21 	return ops->read(dev, address, data, size);
22 }
23 
axi_write(struct udevice * dev,ulong address,void * data,enum axi_size_t size)24 int axi_write(struct udevice *dev, ulong address, void *data,
25 	      enum axi_size_t size)
26 {
27 	struct axi_ops *ops = axi_get_ops(dev);
28 
29 	if (!ops->write)
30 		return -ENOSYS;
31 
32 	return ops->write(dev, address, data, size);
33 }
34 
35 UCLASS_DRIVER(axi) = {
36 	.id		= UCLASS_AXI,
37 	.name		= "axi",
38 	.post_bind	= dm_scan_fdt_dev,
39 	.flags		= DM_UC_FLAG_SEQ_ALIAS,
40 };
41