qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: patches@linaro.org
Subject: [Qemu-devel] [PATCH 14/14] hw/arm/musca: Wire up PL011 UARTs
Date: Thu, 14 Feb 2019 12:51:07 +0000	[thread overview]
Message-ID: <20190214125107.22178-15-peter.maydell@linaro.org> (raw)
In-Reply-To: <20190214125107.22178-1-peter.maydell@linaro.org>

Wire up the two PL011 UARTs in the Musca board.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/arm/musca.c | 34 +++++++++++++++++++++++++++++-----
 1 file changed, 29 insertions(+), 5 deletions(-)

diff --git a/hw/arm/musca.c b/hw/arm/musca.c
index ec8dfee1964..e9701533d20 100644
--- a/hw/arm/musca.c
+++ b/hw/arm/musca.c
@@ -23,9 +23,11 @@
 #include "qemu/error-report.h"
 #include "qapi/error.h"
 #include "exec/address-spaces.h"
+#include "sysemu/sysemu.h"
 #include "hw/arm/arm.h"
 #include "hw/arm/armsse.h"
 #include "hw/boards.h"
+#include "hw/char/pl011.h"
 #include "hw/core/split-irq.h"
 #include "hw/misc/tz-mpc.h"
 #include "hw/misc/tz-ppc.h"
@@ -69,7 +71,7 @@ typedef struct {
     UnimplementedDeviceState mhu[2];
     UnimplementedDeviceState pwm[3];
     UnimplementedDeviceState i2s;
-    UnimplementedDeviceState uart[2];
+    PL011State uart[2];
     UnimplementedDeviceState i2c[2];
     UnimplementedDeviceState spi;
     UnimplementedDeviceState scc;
@@ -285,6 +287,28 @@ static MemoryRegion *make_rtc(MuscaMachineState *mms, void *opaque,
     return sysbus_mmio_get_region(SYS_BUS_DEVICE(rtc), 0);
 }
 
+static MemoryRegion *make_uart(MuscaMachineState *mms, void *opaque,
+                               const char *name, hwaddr size)
+{
+    PL011State *uart = opaque;
+    int i = uart - &mms->uart[0];
+    int irqbase = 7 + i * 6;
+    SysBusDevice *s;
+
+    sysbus_init_child_obj(OBJECT(mms), name, uart, sizeof(mms->uart[0]),
+                          TYPE_PL011);
+    qdev_prop_set_chr(DEVICE(uart), "chardev", serial_hd(i));
+    object_property_set_bool(OBJECT(uart), true, "realized", &error_fatal);
+    s = SYS_BUS_DEVICE(uart);
+    sysbus_connect_irq(s, 0, get_sse_irq_in(mms, irqbase + 5)); /* combined */
+    sysbus_connect_irq(s, 1, get_sse_irq_in(mms, irqbase + 0)); /* RX */
+    sysbus_connect_irq(s, 2, get_sse_irq_in(mms, irqbase + 1)); /* TX */
+    sysbus_connect_irq(s, 3, get_sse_irq_in(mms, irqbase + 2)); /* RT */
+    sysbus_connect_irq(s, 4, get_sse_irq_in(mms, irqbase + 3)); /* MS */
+    sysbus_connect_irq(s, 5, get_sse_irq_in(mms, irqbase + 4)); /* E */
+    return sysbus_mmio_get_region(SYS_BUS_DEVICE(uart), 0);
+}
+
 static MemoryRegion *make_musca_a_devs(MuscaMachineState *mms, void *opaque,
                                        const char *name, hwaddr size)
 {
@@ -300,8 +324,8 @@ static MemoryRegion *make_musca_a_devs(MuscaMachineState *mms, void *opaque,
     MemoryRegion *container = &mms->container;
 
     const PPCPortInfo devices[] = {
-        { "uart0", make_unimp_dev, &mms->uart[0], 0x1000, 0x1000 },
-        { "uart1", make_unimp_dev, &mms->uart[1], 0x2000, 0x1000 },
+        { "uart0", make_uart, &mms->uart[0], 0x1000, 0x1000 },
+        { "uart1", make_uart, &mms->uart[1], 0x2000, 0x1000 },
         { "spi", make_unimp_dev, &mms->spi, 0x3000, 0x1000 },
         { "i2c0", make_unimp_dev, &mms->i2c[0], 0x4000, 0x1000 },
         { "i2c1", make_unimp_dev, &mms->i2c[1], 0x5000, 0x1000 },
@@ -460,8 +484,8 @@ static void musca_init(MachineState *machine)
                 { "pwm1", make_unimp_dev, &mms->pwm[1], 0x40102000, 0x1000 },
                 { "pwm2", make_unimp_dev, &mms->pwm[2], 0x40103000, 0x1000 },
                 { "i2s", make_unimp_dev, &mms->i2s, 0x40104000, 0x1000 },
-                { "uart0", make_unimp_dev, &mms->uart[0], 0x40105000, 0x1000 },
-                { "uart1", make_unimp_dev, &mms->uart[1], 0x40106000, 0x1000 },
+                { "uart0", make_uart, &mms->uart[0], 0x40105000, 0x1000 },
+                { "uart1", make_uart, &mms->uart[1], 0x40106000, 0x1000 },
                 { "i2c0", make_unimp_dev, &mms->i2c[0], 0x40108000, 0x1000 },
                 { "i2c1", make_unimp_dev, &mms->i2c[1], 0x40109000, 0x1000 },
                 { "spi", make_unimp_dev, &mms->spi, 0x4010a000, 0x1000 },
-- 
2.20.1

  parent reply	other threads:[~2019-02-14 13:02 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-14 12:50 [Qemu-devel] [PATCH 00/14] Add model of the Arm Musca devboards Peter Maydell
2019-02-14 12:50 ` [Qemu-devel] [PATCH 01/14] hw/arm/armsse: Fix miswiring of expansion IRQs Peter Maydell
2019-02-17 17:49   ` Richard Henderson
2019-02-14 12:50 ` [Qemu-devel] [PATCH 02/14] hw/misc/tz-ppc: Support having unused ports in the middle of the range Peter Maydell
2019-02-17 17:51   ` Richard Henderson
2019-02-14 12:50 ` [Qemu-devel] [PATCH 03/14] hw/timer/pl031: Allow use as an embedded-struct device Peter Maydell
2019-02-17 17:55   ` Richard Henderson
2019-02-18 21:54   ` Philippe Mathieu-Daudé
2019-02-14 12:50 ` [Qemu-devel] [PATCH 04/14] hw/timer/pl031: Convert to using trace events Peter Maydell
2019-02-17 17:56   ` Richard Henderson
2019-02-18 21:58   ` Philippe Mathieu-Daudé
2019-02-14 12:50 ` [Qemu-devel] [PATCH 05/14] hw/char/pl011: Allow use as an embedded-struct device Peter Maydell
2019-02-17 17:57   ` Richard Henderson
2019-02-18 21:59   ` Philippe Mathieu-Daudé
2019-02-14 12:50 ` [Qemu-devel] [PATCH 06/14] hw/char/pl011: Support all interrupt lines Peter Maydell
2019-02-17 18:00   ` Richard Henderson
2019-02-14 12:51 ` [Qemu-devel] [PATCH 07/14] hw/char/pl011: Use '0x' prefix when logging hex numbers Peter Maydell
2019-02-17 18:00   ` Richard Henderson
2019-02-18 22:00   ` Philippe Mathieu-Daudé
2019-02-14 12:51 ` [Qemu-devel] [PATCH 08/14] hw/arm/armsse: Document SRAM_ADDR_WIDTH property in header comment Peter Maydell
2019-02-17 18:01   ` Richard Henderson
2019-02-14 12:51 ` [Qemu-devel] [PATCH 09/14] hw/arm/armsse: Allow boards to specify init-svtor Peter Maydell
2019-02-17 18:03   ` Richard Henderson
2019-02-18 22:01   ` Philippe Mathieu-Daudé
2019-02-14 12:51 ` [Qemu-devel] [PATCH 10/14] hw/arm/musca.c: Implement models of the Musca-A and -B1 boards Peter Maydell
2019-02-17 18:09   ` Richard Henderson
2019-02-14 12:51 ` [Qemu-devel] [PATCH 11/14] hw/arm/musca: Add PPCs Peter Maydell
2019-02-17 18:14   ` Richard Henderson
2019-02-17 18:19     ` Richard Henderson
2019-02-14 12:51 ` [Qemu-devel] [PATCH 12/14] hw/arm/musca: Add MPCs Peter Maydell
2019-02-17 18:17   ` Richard Henderson
2019-02-19 12:29   ` Peter Maydell
2019-02-14 12:51 ` [Qemu-devel] [PATCH 13/14] hw/arm/musca: Wire up PL031 RTC Peter Maydell
2019-02-17 18:20   ` Richard Henderson
2019-02-14 12:51 ` Peter Maydell [this message]
2019-02-17 18:20   ` [Qemu-devel] [PATCH 14/14] hw/arm/musca: Wire up PL011 UARTs Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190214125107.22178-15-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=patches@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).