From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: Vikram Garhwal <fnu.vikram@xilinx.com>
Cc: francisco.iglesias@xilinx.com,
Alistair Francis <alistair@alistair23.me>,
qemu-devel@nongnu.org,
"open list:Xilinx ZynqMP" <qemu-arm@nongnu.org>,
Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [PATCH v7 2/4] xlnx-zynqmp: Connect Xilinx ZynqMP CAN controllers
Date: Tue, 7 Jul 2020 14:28:49 +0200 [thread overview]
Message-ID: <20200707122849.GA4114@toto> (raw)
In-Reply-To: <1593113607-321118-3-git-send-email-fnu.vikram@xilinx.com>
On Thu, Jun 25, 2020 at 12:33:25PM -0700, Vikram Garhwal wrote:
> Connect CAN0 and CAN1 on the ZynqMP.
>
> Acked-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> Signed-off-by: Vikram Garhwal <fnu.vikram@xilinx.com>
> ---
> hw/arm/xlnx-zynqmp.c | 28 ++++++++++++++++++++++++++++
> include/hw/arm/xlnx-zynqmp.h | 4 ++++
> 2 files changed, 32 insertions(+)
>
> diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
> index 1de9d4a..3f93524 100644
> --- a/hw/arm/xlnx-zynqmp.c
> +++ b/hw/arm/xlnx-zynqmp.c
> @@ -81,6 +81,14 @@ static const int uart_intr[XLNX_ZYNQMP_NUM_UARTS] = {
> 21, 22,
> };
>
> +static const uint64_t can_addr[XLNX_ZYNQMP_NUM_CAN] = {
> + 0xFF060000, 0xFF070000,
> +};
> +
> +static const int can_intr[XLNX_ZYNQMP_NUM_CAN] = {
> + 23, 24,
> +};
> +
> static const uint64_t sdhci_addr[XLNX_ZYNQMP_NUM_SDHCI] = {
> 0xFF160000, 0xFF170000,
> };
> @@ -247,6 +255,11 @@ static void xlnx_zynqmp_init(Object *obj)
> TYPE_CADENCE_UART);
> }
>
> + for (i = 0; i < XLNX_ZYNQMP_NUM_CAN; i++) {
> + object_initialize_child(obj, "can[*]", &s->can[i],
> + TYPE_XLNX_ZYNQMP_CAN);
> + }
> +
> object_initialize_child(obj, "sata", &s->sata, TYPE_SYSBUS_AHCI);
>
> for (i = 0; i < XLNX_ZYNQMP_NUM_SDHCI; i++) {
> @@ -492,6 +505,21 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
> gic_spi[uart_intr[i]]);
> }
>
> + for (i = 0; i < XLNX_ZYNQMP_NUM_CAN; i++) {
> + object_property_set_int(OBJECT(&s->can[i]), i, "ctrl-idx",
> + &error_abort);
> + object_property_set_int(OBJECT(&s->can[i]), XLNX_ZYNQMP_CAN_REF_CLK,
> + "ext_clk_freq", &error_abort);
> + sysbus_realize(SYS_BUS_DEVICE(&s->can[i]), &err);
> + if (err) {
> + error_propagate(errp, err);
> + return;
> + }
> + sysbus_mmio_map(SYS_BUS_DEVICE(&s->can[i]), 0, can_addr[i]);
> + sysbus_connect_irq(SYS_BUS_DEVICE(&s->can[i]), 0,
> + gic_spi[can_intr[i]]);
> + }
> +
> object_property_set_int(OBJECT(&s->sata), SATA_NUM_PORTS, "num-ports",
> &error_abort);
> sysbus_realize(SYS_BUS_DEVICE(&s->sata), &err);
> diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h
> index 53076fa..dcb88e0 100644
> --- a/include/hw/arm/xlnx-zynqmp.h
> +++ b/include/hw/arm/xlnx-zynqmp.h
> @@ -22,6 +22,7 @@
> #include "hw/intc/arm_gic.h"
> #include "hw/net/cadence_gem.h"
> #include "hw/char/cadence_uart.h"
> +#include "hw/net/xlnx-zynqmp-can.h"
> #include "hw/ide/ahci.h"
> #include "hw/sd/sdhci.h"
> #include "hw/ssi/xilinx_spips.h"
> @@ -41,6 +42,8 @@
> #define XLNX_ZYNQMP_NUM_RPU_CPUS 2
> #define XLNX_ZYNQMP_NUM_GEMS 4
> #define XLNX_ZYNQMP_NUM_UARTS 2
> +#define XLNX_ZYNQMP_NUM_CAN 2
> +#define XLNX_ZYNQMP_CAN_REF_CLK (24 * 1000 * 1000)
> #define XLNX_ZYNQMP_NUM_SDHCI 2
> #define XLNX_ZYNQMP_NUM_SPIS 2
> #define XLNX_ZYNQMP_NUM_GDMA_CH 8
> @@ -92,6 +95,7 @@ typedef struct XlnxZynqMPState {
>
> CadenceGEMState gem[XLNX_ZYNQMP_NUM_GEMS];
> CadenceUARTState uart[XLNX_ZYNQMP_NUM_UARTS];
> + XlnxZynqMPCANState can[XLNX_ZYNQMP_NUM_CAN];
> SysbusAHCIState sata;
> SDHCIState sdhci[XLNX_ZYNQMP_NUM_SDHCI];
> XilinxSPIPS spi[XLNX_ZYNQMP_NUM_SPIS];
> --
> 2.7.4
>
next prev parent reply other threads:[~2020-07-07 12:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-25 19:33 [PATCH v7 0/4] Introduce Xilinx ZynqMP CAN controller Vikram Garhwal
2020-06-25 19:33 ` [PATCH v7 1/4] hw/net/can: " Vikram Garhwal
2020-07-07 12:48 ` Edgar E. Iglesias
2020-07-08 21:23 ` Vikram Garhwal
2020-07-08 22:56 ` Edgar E. Iglesias
2020-06-25 19:33 ` [PATCH v7 2/4] xlnx-zynqmp: Connect Xilinx ZynqMP CAN controllers Vikram Garhwal
2020-06-29 12:49 ` Francisco Iglesias
2020-07-07 12:28 ` Edgar E. Iglesias [this message]
2020-06-25 19:33 ` [PATCH v7 3/4] tests/qtest: Introduce tests for Xilinx ZynqMP CAN controller Vikram Garhwal
2020-06-29 14:14 ` Francisco Iglesias
2020-06-25 19:33 ` [PATCH v7 4/4] MAINTAINERS: Add maintainer entry " Vikram Garhwal
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=20200707122849.GA4114@toto \
--to=edgar.iglesias@gmail.com \
--cc=alistair@alistair23.me \
--cc=fnu.vikram@xilinx.com \
--cc=francisco.iglesias@xilinx.com \
--cc=peter.maydell@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).