Can't seem to hook up omap3 uarts

Bug #1000536 reported by Peter Chubb
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro QEMU
New
Undecided
Unassigned

Bug Description

I've tried:

qemu-system-arm-M beagle \
        -chardev socket,ipv4,host=localhost,port=4444,server,id=sock3 \
        -chardev socket,ipv4,host=localhost,port=4445,server,nowait,id=sock2 \
         -device omap_uart,chardev=sock3,id=uart3 \
         -device omap_uart,chardev=sock2,id=uart2 \
         -nographic \
         -mtdblock images/wombat-image-arm-omap3-nand

but uart3 ends up connected to stdio, and uart2 to nothing at all.

info qtree shows more than one uart3:

(qemu) info qtree
bus: main-system-bus
  type System
  dev: omap_uart, id "uart2"
    dev-prop: chardev = sock2
    irq 3
    mmio ffffffff/00000400
  dev: omap_uart, id "uart3"
    dev-prop: chardev = sock3
    irq 3
    mmio ffffffff/00000400

 ...
  dev: omap_uart, id "uart3"
    dev-prop: chardev = serial0
    irq 3
    mmio 49020000/00001000
  dev: omap_uart, id "uart2"
    dev-prop: chardev = uart2
    irq 3
    mmio 4806c000/00001000
  dev: omap_uart, id "uart1"
    dev-prop: chardev = uart1
    irq 3
    mmio 4806a000/00001000
  dev: omap2-intc, id ""
    gpio-in 96
    irq 2
    mmio 48200000/00001000

Revision history for this message
Peter Maydell (pmaydell) wrote :

You can't use '-device' to try to change the properties for an existing device on the board. '-device' always creates a new device, so it only really makes sense for pluggable buses like USB/PCI. You might try playing with the '-global' option which lets you set properties on existing devices.

Revision history for this message
Peter Chubb (peter-chubb-1) wrote : Re: [Bug 1000536] Re: Can't seem to hook up omap3 uarts

>>>>> "Peter" == Peter Maydell <email address hidden> writes:

Peter> You can't use '-device' to try to change the properties for an
Peter> existing device on the board. '-device' always creates a new
Peter> device, so it only really makes sense for pluggable buses like
Peter> USB/PCI. You might try playing with the '-global' option which
Peter> lets you set properties on existing devices.

Hmmm. According to docs/qdev-device-use.txt the old, relatively
simple,

   -serial tcp:127.0.0.1:4444,server

(which works for uart3, but not for any of the other uarts) should be
replaced with the more clumsy-to-type:

  -chardev socket,host=127.0.0.1,port=4444,server,id=sock3
  -device omap_uart,id=uart3,chardev=sock3

If this is wrong, then it should be updated.

I can't see how to use -global to achieve this. It adds global
properties, not per-instance properties.

So for instance
  qemu-system -arm -M beagle -nographic \
      -chardev socket,host=127.0.0.1,port=4444,server,id=sock3 \
      -global uart3.chardev=sock3 \
      -mtdblock images/wombat-image-arm-omap3-nand

still leaves uart3 hooked up to stdio.

You could patch beagle.c which would at least enable multiple -serial
options.

diff --git a/hw/beagle.c b/hw/beagle.c
index 01d665a..b0d2cd6 100644
--- a/hw/beagle.c
+++ b/hw/beagle.c
@@ -71,7 +71,7 @@ static void beagle_common_init(ram_addr_t ram_size,
 #error MAX_SERIAL_PORTS must be at least 1!
 #endif
     s->cpu = omap3_mpu_init(sysmem, cpu_model, ram_size,
- NULL, NULL, serial_hds[0], NULL);
+ serial_hds[2], serial_hds[1], serial_hds[0], NULL);

     s->nand = nand_init(dmtd ? dmtd->bdrv : NULL, NAND_MFR_MICRON, 0xba);
     nand_setpins(s->nand, 0, 0, 0, 1, 0); /* no write-protect */

Revision history for this message
Peter Maydell (pmaydell) wrote :

On 18 May 2012 00:58, Peter Chubb <email address hidden> wrote:
>>>>>> "Peter" == Peter Maydell <email address hidden> writes:
>
> Peter> You can't use '-device' to try to change the properties for an
> Peter> existing device on the board. '-device' always creates a new
> Peter> device, so it only really makes sense for pluggable buses like
> Peter> USB/PCI. You might try playing with the '-global' option which
> Peter> lets you set properties on existing devices.
>
> Hmmm.  According to docs/qdev-device-use.txt the old, relatively
> simple,
>
>   -serial tcp:127.0.0.1:4444,server
>
> (which works for uart3, but not for any of the other uarts) should be
> replaced with the more clumsy-to-type:
>
>  -chardev socket,host=127.0.0.1,port=4444,server,id=sock3
>  -device omap_uart,id=uart3,chardev=sock3
>
> If this is wrong, then it should be updated.

The qdev documentation tends to assume pluggable devices,
like isa-serial. Trying to fiddle with the builtin devices
is not so well tested and documented, I'm afraid.

> I can't see how to use -global to achieve this.  It adds global
> properties, not per-instance properties.

In that case I'm out of ideas; I suggest you find an equivalent
case that uses one of the standard models in qemu upstream as
an example, and ask on qemu-devel...

> You could patch beagle.c which would at least enable multiple -serial
> options.
>
> diff --git a/hw/beagle.c b/hw/beagle.c
> index 01d665a..b0d2cd6 100644
> --- a/hw/beagle.c
> +++ b/hw/beagle.c
> @@ -71,7 +71,7 @@ static void beagle_common_init(ram_addr_t ram_size,
>  #error MAX_SERIAL_PORTS must be at least 1!
>  #endif
>     s->cpu = omap3_mpu_init(sysmem, cpu_model, ram_size,
> -                            NULL, NULL, serial_hds[0], NULL);
> +                            serial_hds[2], serial_hds[1], serial_hds[0], NULL);
>
>     s->nand = nand_init(dmtd ? dmtd->bdrv : NULL, NAND_MFR_MICRON, 0xba);
>     nand_setpins(s->nand, 0, 0, 0, 1, 0); /* no write-protect */

Does a beagle actually physically have more than one serial port?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.