From: Alistair Francis <alistair23@gmail.com>
To: Francisco Iglesias <frasse.iglesias@gmail.com>
Cc: "qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
Peter Maydell <peter.maydell@linaro.org>,
Edgar Iglesias <edgar.iglesias@gmail.com>,
Alistair Francis <alistair@alistair23.me>,
fkonrad@amd.com, sai.pavan.boddu@amd.com,
francisco.iglesias@amd.com
Subject: Re: [PATCH v1 1/1] hw/arm/xlnx-zynqmp: Connect ZynqMP's USB controllers
Date: Thu, 29 Sep 2022 11:28:02 +1000 [thread overview]
Message-ID: <CAKmqyKMX-UdspdDkRsF+e3cMHHW5=_79_AEngeniH=M1LxMseA@mail.gmail.com> (raw)
In-Reply-To: <20220920081517.25401-1-frasse.iglesias@gmail.com>
On Tue, Sep 20, 2022 at 6:23 PM Francisco Iglesias
<frasse.iglesias@gmail.com> wrote:
>
> From: Francisco Iglesias <francisco.iglesias@amd.com>
>
> Connect ZynqMP's USB controllers.
>
> Signed-off-by: Francisco Iglesias <francisco.iglesias@amd.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> hw/arm/xlnx-zynqmp.c | 36 ++++++++++++++++++++++++++++++++++++
> include/hw/arm/xlnx-zynqmp.h | 3 +++
> 2 files changed, 39 insertions(+)
>
> diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
> index 383e177a00..335cfc417d 100644
> --- a/hw/arm/xlnx-zynqmp.c
> +++ b/hw/arm/xlnx-zynqmp.c
> @@ -143,6 +143,14 @@ static const int adma_ch_intr[XLNX_ZYNQMP_NUM_ADMA_CH] = {
> 77, 78, 79, 80, 81, 82, 83, 84
> };
>
> +static const uint64_t usb_addr[XLNX_ZYNQMP_NUM_USB] = {
> + 0xFE200000, 0xFE300000
> +};
> +
> +static const int usb_intr[XLNX_ZYNQMP_NUM_USB] = {
> + 65, 70
> +};
> +
> typedef struct XlnxZynqMPGICRegion {
> int region_index;
> uint32_t address;
> @@ -428,6 +436,10 @@ static void xlnx_zynqmp_init(Object *obj)
> object_initialize_child(obj, "qspi-dma", &s->qspi_dma, TYPE_XLNX_CSU_DMA);
> object_initialize_child(obj, "qspi-irq-orgate",
> &s->qspi_irq_orgate, TYPE_OR_IRQ);
> +
> + for (i = 0; i < XLNX_ZYNQMP_NUM_USB; i++) {
> + object_initialize_child(obj, "usb[*]", &s->usb[i], TYPE_USB_DWC3);
> + }
> }
>
> static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
> @@ -814,6 +826,30 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
> object_property_add_alias(OBJECT(s), bus_name,
> OBJECT(&s->qspi), target_bus);
> }
> +
> + for (i = 0; i < XLNX_ZYNQMP_NUM_USB; i++) {
> + if (!object_property_set_link(OBJECT(&s->usb[i].sysbus_xhci), "dma",
> + OBJECT(system_memory), errp)) {
> + return;
> + }
> +
> + qdev_prop_set_uint32(DEVICE(&s->usb[i].sysbus_xhci), "intrs", 4);
> + qdev_prop_set_uint32(DEVICE(&s->usb[i].sysbus_xhci), "slots", 2);
> +
> + if (!sysbus_realize(SYS_BUS_DEVICE(&s->usb[i]), errp)) {
> + return;
> + }
> +
> + sysbus_mmio_map(SYS_BUS_DEVICE(&s->usb[i]), 0, usb_addr[i]);
> + sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i].sysbus_xhci), 0,
> + gic_spi[usb_intr[i]]);
> + sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i].sysbus_xhci), 1,
> + gic_spi[usb_intr[i] + 1]);
> + sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i].sysbus_xhci), 2,
> + gic_spi[usb_intr[i] + 2]);
> + sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i].sysbus_xhci), 3,
> + gic_spi[usb_intr[i] + 3]);
> + }
> }
>
> static Property xlnx_zynqmp_props[] = {
> diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h
> index 85fd9f53da..20bdf894aa 100644
> --- a/include/hw/arm/xlnx-zynqmp.h
> +++ b/include/hw/arm/xlnx-zynqmp.h
> @@ -42,6 +42,7 @@
> #include "hw/misc/xlnx-zynqmp-apu-ctrl.h"
> #include "hw/misc/xlnx-zynqmp-crf.h"
> #include "hw/timer/cadence_ttc.h"
> +#include "hw/usb/hcd-dwc3.h"
>
> #define TYPE_XLNX_ZYNQMP "xlnx-zynqmp"
> OBJECT_DECLARE_SIMPLE_TYPE(XlnxZynqMPState, XLNX_ZYNQMP)
> @@ -56,6 +57,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(XlnxZynqMPState, XLNX_ZYNQMP)
> #define XLNX_ZYNQMP_NUM_SPIS 2
> #define XLNX_ZYNQMP_NUM_GDMA_CH 8
> #define XLNX_ZYNQMP_NUM_ADMA_CH 8
> +#define XLNX_ZYNQMP_NUM_USB 2
>
> #define XLNX_ZYNQMP_NUM_QSPI_BUS 2
> #define XLNX_ZYNQMP_NUM_QSPI_BUS_CS 2
> @@ -132,6 +134,7 @@ struct XlnxZynqMPState {
> XlnxZynqMPAPUCtrl apu_ctrl;
> XlnxZynqMPCRF crf;
> CadenceTTCState ttc[XLNX_ZYNQMP_NUM_TTC];
> + USBDWC3 usb[XLNX_ZYNQMP_NUM_USB];
>
> char *boot_cpu;
> ARMCPU *boot_cpu_ptr;
> --
> 2.20.1
>
>
next prev parent reply other threads:[~2022-09-29 1:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-20 8:15 [PATCH v1 1/1] hw/arm/xlnx-zynqmp: Connect ZynqMP's USB controllers Francisco Iglesias
2022-09-29 1:28 ` Alistair Francis [this message]
2022-09-29 16:50 ` Peter Maydell
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='CAKmqyKMX-UdspdDkRsF+e3cMHHW5=_79_AEngeniH=M1LxMseA@mail.gmail.com' \
--to=alistair23@gmail.com \
--cc=alistair@alistair23.me \
--cc=edgar.iglesias@gmail.com \
--cc=fkonrad@amd.com \
--cc=francisco.iglesias@amd.com \
--cc=frasse.iglesias@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=sai.pavan.boddu@amd.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).