aboutsummaryrefslogtreecommitdiff
path: root/hw/usb/tusb6010.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-05-04 18:05:50 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-05-04 18:05:50 +0100
commita22cadbefd2b2ff57f5c06688f7ed06c52d6929a (patch)
tree2b241bc6f888b787e75da51a4058d69db56a6488 /hw/usb/tusb6010.c
parent0c6a108ec1efd8498b281086d44604204196a9d5 (diff)
downloadqemu-a22cadbefd2b2ff57f5c06688f7ed06c52d6929a.zip
qemu-a22cadbefd2b2ff57f5c06688f7ed06c52d6929a.tar.gz
qemu-a22cadbefd2b2ff57f5c06688f7ed06c52d6929a.tar.bz2
hw/usb/tusb6010: Convert away from old_mmio
Convert the tusb6010 device away from using the old_mmio field of MemoryRegionOps. This device is used only in the n800 and n810 boards. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20180427173611.10281-2-peter.maydell@linaro.org
Diffstat (limited to 'hw/usb/tusb6010.c')
-rw-r--r--hw/usb/tusb6010.c40
1 files changed, 36 insertions, 4 deletions
diff --git a/hw/usb/tusb6010.c b/hw/usb/tusb6010.c
index 2662c06..a212802 100644
--- a/hw/usb/tusb6010.c
+++ b/hw/usb/tusb6010.c
@@ -641,11 +641,43 @@ static void tusb_async_writew(void *opaque, hwaddr addr,
}
}
+static uint64_t tusb_async_readfn(void *opaque, hwaddr addr, unsigned size)
+{
+ switch (size) {
+ case 1:
+ return tusb_async_readb(opaque, addr);
+ case 2:
+ return tusb_async_readh(opaque, addr);
+ case 4:
+ return tusb_async_readw(opaque, addr);
+ default:
+ g_assert_not_reached();
+ }
+}
+
+static void tusb_async_writefn(void *opaque, hwaddr addr,
+ uint64_t value, unsigned size)
+{
+ switch (size) {
+ case 1:
+ tusb_async_writeb(opaque, addr, value);
+ break;
+ case 2:
+ tusb_async_writeh(opaque, addr, value);
+ break;
+ case 4:
+ tusb_async_writew(opaque, addr, value);
+ break;
+ default:
+ g_assert_not_reached();
+ }
+}
+
static const MemoryRegionOps tusb_async_ops = {
- .old_mmio = {
- .read = { tusb_async_readb, tusb_async_readh, tusb_async_readw, },
- .write = { tusb_async_writeb, tusb_async_writeh, tusb_async_writew, },
- },
+ .read = tusb_async_readfn,
+ .write = tusb_async_writefn,
+ .valid.min_access_size = 1,
+ .valid.max_access_size = 4,
.endianness = DEVICE_NATIVE_ENDIAN,
};