qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Gaurav Sharma <gaurav.sharma_7@nxp.com>, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, peter.maydell@linaro.org
Subject: Re: [PATCH 06/13] hw/arm/fsl-imx8mm: Add GPIO controllers
Date: Mon, 10 Nov 2025 16:02:26 +0100	[thread overview]
Message-ID: <86f568ff-edb8-4920-bd51-fc86e0637094@linaro.org> (raw)
In-Reply-To: <20251110112257.184578-7-gaurav.sharma_7@nxp.com>

On 10/11/25 12:22, Gaurav Sharma wrote:
> Enabled GPIO controller emulation
> Also updated the GPIO IRQ lines of iMX8MM
> 
> Signed-off-by: Gaurav Sharma <gaurav.sharma_7@nxp.com>
> ---
>   docs/system/arm/imx8mm-evk.rst |  1 +
>   hw/arm/fsl-imx8mm.c            | 54 ++++++++++++++++++++++++++++++++++
>   include/hw/arm/fsl-imx8mm.h    | 14 +++++++++
>   3 files changed, 69 insertions(+)


> diff --git a/hw/arm/fsl-imx8mm.c b/hw/arm/fsl-imx8mm.c
> index ea5799b2cc..222d3bac1c 100644
> --- a/hw/arm/fsl-imx8mm.c
> +++ b/hw/arm/fsl-imx8mm.c
> @@ -177,6 +177,11 @@ static void fsl_imx8mm_init(Object *obj)
>           object_initialize_child(obj, name, &s->uart[i], TYPE_IMX_SERIAL);
>       }
>   
> +    for (i = 0; i < FSL_IMX8MM_NUM_GPIOS; i++) {
> +        g_autofree char *name = g_strdup_printf("gpio%d", i + 1);
> +        object_initialize_child(obj, name, &s->gpio[i], TYPE_IMX_GPIO);
> +    }
> +
>       for (i = 0; i < FSL_IMX8MM_NUM_USDHCS; i++) {
>           g_autofree char *name = g_strdup_printf("usdhc%d", i + 1);
>           object_initialize_child(obj, name, &s->usdhc[i], TYPE_IMX_USDHC);
> @@ -350,6 +355,54 @@ static void fsl_imx8mm_realize(DeviceState *dev, Error **errp)
>                              qdev_get_gpio_in(gicdev, serial_table[i].irq));
>       }
>   
> +    /* GPIOs */
> +    for (i = 0; i < FSL_IMX8MM_NUM_GPIOS; i++) {

static const?

> +        struct {
> +            hwaddr addr;
> +            unsigned int irq_low;
> +            unsigned int irq_high;
> +        } gpio_table[FSL_IMX8MM_NUM_GPIOS] = {
> +            {
> +                fsl_imx8mm_memmap[FSL_IMX8MM_GPIO1].addr,
> +                FSL_IMX8MM_GPIO1_LOW_IRQ,
> +                FSL_IMX8MM_GPIO1_HIGH_IRQ
> +            },
> +            {
> +                fsl_imx8mm_memmap[FSL_IMX8MM_GPIO2].addr,
> +                FSL_IMX8MM_GPIO2_LOW_IRQ,
> +                FSL_IMX8MM_GPIO2_HIGH_IRQ
> +            },
> +            {
> +                fsl_imx8mm_memmap[FSL_IMX8MM_GPIO3].addr,
> +                FSL_IMX8MM_GPIO3_LOW_IRQ,
> +                FSL_IMX8MM_GPIO3_HIGH_IRQ
> +            },
> +            {
> +                fsl_imx8mm_memmap[FSL_IMX8MM_GPIO4].addr,
> +                FSL_IMX8MM_GPIO4_LOW_IRQ,
> +                FSL_IMX8MM_GPIO4_HIGH_IRQ
> +            },
> +            {
> +                fsl_imx8mm_memmap[FSL_IMX8MM_GPIO5].addr,
> +                FSL_IMX8MM_GPIO5_LOW_IRQ,
> +                FSL_IMX8MM_GPIO5_HIGH_IRQ
> +            },
> +        };
> +        object_property_set_bool(OBJECT(&s->gpio[i]), "has-edge-sel", true,
> +                                 &error_abort);
> +        object_property_set_bool(OBJECT(&s->gpio[i]), "has-upper-pin-irq",
> +                                 true, &error_abort);
> +        if (!sysbus_realize(SYS_BUS_DEVICE(&s->gpio[i]), errp)) {
> +            return;
> +        }
> +
> +        sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio[i]), 0, gpio_table[i].addr);
> +        sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 0,
> +                           qdev_get_gpio_in(gicdev, gpio_table[i].irq_low));
> +        sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 1,
> +                           qdev_get_gpio_in(gicdev, gpio_table[i].irq_high));
> +    }

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



  reply	other threads:[~2025-11-10 15:04 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10 11:22 [PATCH 00/13] Adding comprehensive support for i.MX8MM EVK board Gaurav Sharma
2025-11-10 11:22 ` [PATCH 01/13] hw/arm: Add the i.MX 8MM EVK(Evaluation Kit) board Gaurav Sharma
2025-11-11 23:44   ` Bernhard Beschow
2025-11-13 10:52     ` [EXT] " Gaurav Sharma
2025-11-17 13:14       ` Bernhard Beschow
2025-11-18  5:26         ` Gaurav Sharma
2025-11-18  9:46           ` Bernhard Beschow
2025-11-10 11:22 ` [PATCH 02/13] hw/arm/fsl-imx8mm: Implemented CCM(Clock Control Module) and Analog IP Gaurav Sharma
2025-11-10 11:22 ` [PATCH 03/13] hw/arm/fsl-imx8mm: Implemented support for SNVS Gaurav Sharma
2025-11-10 11:22 ` [PATCH 04/13] hw/arm/fsl-imx8mm: Adding support for USDHC storage controllers Gaurav Sharma
2025-11-10 15:05   ` Philippe Mathieu-Daudé
2025-11-11  6:09     ` [EXT] " Gaurav Sharma
2025-11-10 11:22 ` [PATCH 05/13] hw/arm/fsl-imx8mm: Add PCIe support Gaurav Sharma
2025-11-10 15:00   ` Philippe Mathieu-Daudé
2025-11-10 11:22 ` [PATCH 06/13] hw/arm/fsl-imx8mm: Add GPIO controllers Gaurav Sharma
2025-11-10 15:02   ` Philippe Mathieu-Daudé [this message]
2025-11-10 11:22 ` [PATCH 07/13] hw/arm/fsl-imx8mm: Adding support for I2C emulation Gaurav Sharma
2025-11-10 15:07   ` Philippe Mathieu-Daudé
2025-11-10 11:22 ` [PATCH 08/13] hw/arm/fsl-imx8mm: Adding support for SPI controller Gaurav Sharma
2025-11-10 15:08   ` Philippe Mathieu-Daudé
2025-11-10 11:22 ` [PATCH 09/13] hw/arm/fsl-imx8mm: Adding support for Watchdog Timers Gaurav Sharma
2025-11-10 15:12   ` Philippe Mathieu-Daudé
2025-11-10 11:22 ` [PATCH 10/13] hw/arm/fsl-imx8mm: Adding support for General Purpose Timers Gaurav Sharma
2025-11-10 11:22 ` [PATCH 11/13] hw/arm/fsl-imx8mm: Adding support for ENET ethernet controller Gaurav Sharma
2025-11-10 11:22 ` [PATCH 12/13] hw/arm/fsl-imx8mm: Adding support for USB controller Gaurav Sharma
2025-11-10 15:10   ` Philippe Mathieu-Daudé
2025-11-10 11:22 ` [PATCH 13/13] hw/arm/fsl-imx8mm: Adding functional testing of iMX8MM emulation Gaurav Sharma
2025-11-11 23:21   ` Bernhard Beschow
2025-11-12  6:58     ` [EXT] " Gaurav Sharma
2025-11-12  7:05       ` Gaurav Sharma
2025-11-12 11:02         ` Gaurav Sharma
2025-11-12 21:46           ` Bernhard Beschow
2025-11-13  3:03             ` Gaurav Sharma
2025-11-10 14:38 ` [PATCH v2 00/13] Adding comprehensive support for i.MX8MM EVK board Philippe Mathieu-Daudé

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=86f568ff-edb8-4920-bd51-fc86e0637094@linaro.org \
    --to=philmd@linaro.org \
    --cc=gaurav.sharma_7@nxp.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.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).