1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
12 * Implement a miscellaneous uclass for those do not fit other more
13 * general classes. A set of generic read, write and ioctl methods may
14 * be used to access the device.
17 int misc_read(struct udevice *dev, int offset, void *buf, int size)
19 const struct misc_ops *ops = device_get_ops(dev);
24 return ops->read(dev, offset, buf, size);
27 int misc_write(struct udevice *dev, int offset, void *buf, int size)
29 const struct misc_ops *ops = device_get_ops(dev);
34 return ops->write(dev, offset, buf, size);
37 int misc_ioctl(struct udevice *dev, unsigned long request, void *buf)
39 const struct misc_ops *ops = device_get_ops(dev);
44 return ops->ioctl(dev, request, buf);
47 int misc_call(struct udevice *dev, int msgid, void *tx_msg, int tx_size,
48 void *rx_msg, int rx_size)
50 const struct misc_ops *ops = device_get_ops(dev);
55 return ops->call(dev, msgid, tx_msg, tx_size, rx_msg, rx_size);
58 int misc_set_enabled(struct udevice *dev, bool val)
60 const struct misc_ops *ops = device_get_ops(dev);
62 if (!ops->set_enabled)
65 return ops->set_enabled(dev, val);
68 UCLASS_DRIVER(misc) = {