qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
Cc: "Francisco Eduardo Iglesias" <figlesia@xilinx.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Vikram Garhwal" <fnuv@xilinx.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Sai Pavan Boddu" <saipava@xilinx.com>,
	"Edgar Iglesias" <edgari@xilinx.com>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Ying Fang" <fangying1@huawei.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Paul Zimmerman" <pauldzim@gmail.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: Re: [PATCH v12 3/3] Versal: Connect DWC3 controller with virt-versal
Date: Mon, 26 Oct 2020 16:05:21 +0000	[thread overview]
Message-ID: <CAFEAcA8QdJQqkLO47+Z=N6aTX70HNaDVXjw6UTS15_qnMAyxtA@mail.gmail.com> (raw)
In-Reply-To: <1603369056-4168-4-git-send-email-sai.pavan.boddu@xilinx.com>

On Thu, 22 Oct 2020 at 13:11, Sai Pavan Boddu
<sai.pavan.boddu@xilinx.com> wrote:
>
> From: Vikram Garhwal <fnu.vikram@xilinx.com>
>
> Connect dwc3 controller and usb2-reg module to xlnx-versal SOC, its placed
> in iou of lpd domain and configure it as dual port host controller. Add the
> respective guest dts nodes for "xlnx-versal-virt" machine.
>
> Signed-off-by: Vikram Garhwal <fnu.vikram@xilinx.com>
> Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>


> +static void versal_create_usbs(Versal *s, qemu_irq *pic)
> +{
> +    DeviceState *dev, *xhci_dev;
> +    MemoryRegion *mr;
> +
> +    object_initialize_child(OBJECT(s), "dwc3-0", &s->lpd.iou.usb.dwc3,
> +                            TYPE_USB_DWC3);
> +    dev = DEVICE(&s->lpd.iou.usb.dwc3);
> +    xhci_dev = DEVICE(&s->lpd.iou.usb.dwc3.sysbus_xhci);

If you find yourself fishing around in the internals of
another device, especially to this depth, then something's
probably not right in the structure of that device.

> +
> +    object_property_set_link(OBJECT(xhci_dev), "dma", OBJECT(&s->mr_ps),
> +                             &error_abort);
> +    qdev_prop_set_uint32(xhci_dev, "intrs", 1);
> +    qdev_prop_set_uint32(xhci_dev, "slots", 2);
> +
> +    sysbus_realize(SYS_BUS_DEVICE(dev), &error_fatal);
> +
> +    mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
> +    memory_region_add_subregion(&s->mr_ps, MM_USB_XHCI_0_DWC3_GLOBAL, mr);
> +    mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(xhci_dev), 0);
> +    memory_region_add_subregion(&s->mr_ps, MM_USB_XHCI_0, mr);

For instance, rather than having to find the xhci device and
map its memory regions and connect its IRQs directly, the
usb-dwc3 device could provide and pass through those MRs and
IRQs, so that board code is only wiring up what the usb-dwc3
provides and doesn't need to know about its internals.


thanks
-- PMM


  reply	other threads:[~2020-10-26 16:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-22 12:17 [PATCH v12 0/3] Add Versal usb model Sai Pavan Boddu
2020-10-22 12:17 ` [PATCH v12 1/3] misc: Add versal-usb2-ctrl-regs module Sai Pavan Boddu
2020-10-26 16:02   ` Peter Maydell
2020-10-26 17:28     ` Sai Pavan Boddu
2020-10-28 12:58       ` Sai Pavan Boddu
2020-10-28 13:14         ` Peter Maydell
2020-10-28 13:50           ` Sai Pavan Boddu
2020-10-22 12:17 ` [PATCH v12 2/3] usb: Add DWC3 model Sai Pavan Boddu
2020-10-22 12:17 ` [PATCH v12 3/3] Versal: Connect DWC3 controller with virt-versal Sai Pavan Boddu
2020-10-26 16:05   ` Peter Maydell [this message]
2020-10-26 19:28     ` Sai Pavan Boddu
2020-10-23  9:27 ` [PATCH v12 0/3] Add Versal usb model Edgar E. Iglesias

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='CAFEAcA8QdJQqkLO47+Z=N6aTX70HNaDVXjw6UTS15_qnMAyxtA@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=armbru@redhat.com \
    --cc=edgari@xilinx.com \
    --cc=ehabkost@redhat.com \
    --cc=fangying1@huawei.com \
    --cc=figlesia@xilinx.com \
    --cc=fnuv@xilinx.com \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pauldzim@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sai.pavan.boddu@xilinx.com \
    --cc=saipava@xilinx.com \
    /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).