summaryrefslogtreecommitdiff
path: root/drivers/pch/sandbox_pch.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-02-17 06:24:51 +0300
committerBin Meng <bmeng.cn@gmail.com>2019-02-20 10:27:08 +0300
commit1260f8c0efe126cf952c1bc19d975af34908a79d (patch)
tree38d5606156196d3d8a1ced890bd54578a506f15c /drivers/pch/sandbox_pch.c
parentb45c833c71f1ce26e0db6c30f96dc3228051cd15 (diff)
downloadu-boot-1260f8c0efe126cf952c1bc19d975af34908a79d.tar.xz
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 'drivers/pch/sandbox_pch.c')
-rw-r--r--drivers/pch/sandbox_pch.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/pch/sandbox_pch.c b/drivers/pch/sandbox_pch.c
index 81f8156c2e..76f552527e 100644
--- a/drivers/pch/sandbox_pch.c
+++ b/drivers/pch/sandbox_pch.c
@@ -48,11 +48,28 @@ static int sandbox_pch_get_io_base(struct udevice *dev, u32 *iobasep)
return 0;
}
+int sandbox_pch_ioctl(struct udevice *dev, enum pch_req_t req, void *data,
+ int size)
+{
+ switch (req) {
+ case PCH_REQ_TEST1:
+ return -ENOSYS;
+ case PCH_REQ_TEST2:
+ return *(char *)data;
+ case PCH_REQ_TEST3:
+ *(char *)data = 'x';
+ return 1;
+ default:
+ return -ENOSYS;
+ }
+}
+
static const struct pch_ops sandbox_pch_ops = {
.get_spi_base = sandbox_pch_get_spi_base,
.set_spi_protect = sandbox_pch_set_spi_protect,
.get_gpio_base = sandbox_pch_get_gpio_base,
.get_io_base = sandbox_pch_get_io_base,
+ .ioctl = sandbox_pch_ioctl,
};
static const struct udevice_id sandbox_pch_ids[] = {