summaryrefslogtreecommitdiff
path: root/drivers/i3c/i3c-uclass.c
blob: 72944424c1d2f36e7d52c29887b4e9fc77cbd668 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2025 Altera Corporation <www.altera.com>
 */

#include <dm.h>
#include <i3c.h>
#include <errno.h>
#include <log.h>
#include <dm/device-internal.h>
#include <linux/ctype.h>

int dm_i3c_read(struct udevice *dev, u32 dev_number,
		u8 *buf, u32 num_bytes)
{
	struct dm_i3c_ops *ops = i3c_get_ops(dev);

	if (!ops->read)
		return -ENOSYS;

	return ops->read(dev, dev_number, buf, num_bytes);
}

int dm_i3c_write(struct udevice *dev, u32 dev_number,
		 u8 *buf, u32 num_bytes)
{
	struct dm_i3c_ops *ops = i3c_get_ops(dev);

	if (!ops->write)
		return -ENOSYS;

	return ops->write(dev, dev_number, buf, num_bytes);
}

UCLASS_DRIVER(i3c) = {
	.id		= UCLASS_I3C,
	.name		= "i3c",
};