diff options
Diffstat (limited to 'drivers/pch')
-rw-r--r-- | drivers/pch/pch-uclass.c | 10 | ||||
-rw-r--r-- | drivers/pch/sandbox_pch.c | 17 |
2 files changed, 27 insertions, 0 deletions
diff --git a/drivers/pch/pch-uclass.c b/drivers/pch/pch-uclass.c index 831b283d7b..caf8b72803 100644 --- a/drivers/pch/pch-uclass.c +++ b/drivers/pch/pch-uclass.c @@ -51,6 +51,16 @@ int pch_get_io_base(struct udevice *dev, u32 *iobasep) return ops->get_io_base(dev, iobasep); } +int pch_ioctl(struct udevice *dev, ulong req, void *data, int size) +{ + struct pch_ops *ops = pch_get_ops(dev); + + if (!ops->ioctl) + return -ENOSYS; + + return ops->ioctl(dev, req, data, size); +} + UCLASS_DRIVER(pch) = { .id = UCLASS_PCH, .name = "pch", 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[] = { |