summaryrefslogtreecommitdiff
path: root/include/pch.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-02-16 20:24:51 -0700
committerBin Meng <bmeng.cn@gmail.com>2019-02-20 15:27:08 +0800
commit1260f8c0efe126cf952c1bc19d975af34908a79d (patch)
tree38d5606156196d3d8a1ced890bd54578a506f15c /include/pch.h
parentb45c833c71f1ce26e0db6c30f96dc3228051cd15 (diff)
downloadu-boot-1260f8c0efe126cf952c1bc19d975af34908a79d.tar.gz
u-boot-1260f8c0efe126cf952c1bc19d975af34908a79d.tar.bz2
u-boot-1260f8c0efe126cf952c1bc19d975af34908a79d.zip
pch: Add ioctl support
At present the PCH has 4 operations and these are reasonably widely used in the drivers. But sometimes we want to add rarely used operations, and each of these currently adds to the size of the PCH operations table. Add an ioctl() method which can be easily expanded without any more impact on the operations table. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'include/pch.h')
-rw-r--r--include/pch.h48
1 files changed, 47 insertions, 1 deletions
diff --git a/include/pch.h b/include/pch.h
index 73994b8343..b8b62d74ac 100644
--- a/include/pch.h
+++ b/include/pch.h
@@ -11,7 +11,20 @@
#define BIOS_CTRL_BIOSWE BIT(0)
-/* Operations for the Platform Controller Hub */
+/* All the supported PCH ioctls */
+enum pch_req_t {
+ PCH_REQ_TEST1, /* Test requests for sandbox driver */
+ PCH_REQ_TEST2,
+ PCH_REQ_TEST3,
+
+ PCH_REQ_COUNT, /* Number of ioctrls supported */
+};
+
+/**
+ * struct pch_ops - Operations for the Platform Controller Hub
+ *
+ * Consider using ioctl() to add rarely used or driver-specific operations.
+ */
struct pch_ops {
/**
* get_spi_base() - get the address of SPI base
@@ -49,6 +62,23 @@ struct pch_ops {
* @return 0 if OK, -ve on error (e.g. there is no IO base)
*/
int (*get_io_base)(struct udevice *dev, u32 *iobasep);
+
+ /**
+ * ioctl() - perform misc read/write operations
+ *
+ * This is a catch-all operation intended to avoid adding lots of
+ * methods to this uclass, of which few are commonly used. Uncommon
+ * operations that pertain only to a few devices in this uclass should
+ * use this method instead of adding new methods.
+ *
+ * @dev: PCH device to check
+ * @req: PCH request ID
+ * @data: Input/output data
+ * @size: Size of input data (and maximum size of output data)
+ * @return size of output data on sucesss, -ve on error
+ */
+ int (*ioctl)(struct udevice *dev, enum pch_req_t req, void *data,
+ int size);
};
#define pch_get_ops(dev) ((struct pch_ops *)(dev)->driver->ops)
@@ -90,4 +120,20 @@ int pch_get_gpio_base(struct udevice *dev, u32 *gbasep);
*/
int pch_get_io_base(struct udevice *dev, u32 *iobasep);
+/**
+ * pch_ioctl() - perform misc read/write operations
+ *
+ * This is a catch-all operation intended to avoid adding lots of
+ * methods to this uclass, of which few are commonly used. Uncommon
+ * operations that pertain only to a few devices in this uclass should
+ * use this method instead of adding new methods.
+ *
+ * @dev: PCH device to check
+ * @req: PCH request ID
+ * @data: Input/output data
+ * @size: Size of input data (and maximum size of output data)
+ * @return size of output data on sucesss, -ve on error
+ */
+int pch_ioctl(struct udevice *dev, ulong req, void *data, int size);
+
#endif