From patchwork Fri Aug 16 07:32:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rashmica Gupta X-Patchwork-Id: 1148019 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iSIXGw/G"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 468wDR6sRxz9sN1 for ; Fri, 16 Aug 2019 17:38:47 +1000 (AEST) Received: from localhost ([::1]:50586 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyWov-0003Z0-LO for incoming@patchwork.ozlabs.org; Fri, 16 Aug 2019 03:38:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39183) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyWk7-00079Q-7c for qemu-devel@nongnu.org; Fri, 16 Aug 2019 03:33:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hyWk5-0000W8-W1 for qemu-devel@nongnu.org; Fri, 16 Aug 2019 03:33:47 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:43961) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hyWk3-0000UP-90; Fri, 16 Aug 2019 03:33:43 -0400 Received: by mail-pf1-x441.google.com with SMTP id v12so2691419pfn.10; Fri, 16 Aug 2019 00:33:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ljyF81NU6v4HO2LcgP50Xe8zeu9wLdfrnocnlpiypN4=; b=iSIXGw/GzXvi4uZPSjFDpJ1pYAQNOR/21h8SL8KG/Qcmj/2gYbJVL6dscnDOBlY3wA cE4y39LwPhdSvAktqq2ZPtkKV9cI6kXYDK2s+NofQL2zRekL+hgCnZVmdNUQwlIAMwjP CWtKuC3QBHFK/BhOMZePY0reaO9JJ9YhnNHQQ7OsDkdz1XcsLLDlNKn9Y0filHEb3vcv fmsX9q+xeF5vDPdtm5GtETqW8VwuUkXMQJycbQn3gur3GflipuKn00xqUilUR6ZYSBLP KHivZhRRN6v4szwpIQynPdjFneBFOnjrrtqdFqbOJilB6cRnN/ueCAoFGgL1dkRcqPqb BkmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ljyF81NU6v4HO2LcgP50Xe8zeu9wLdfrnocnlpiypN4=; b=V4UsrfNKpDLKXwqCnigveiOWKmF9IwY3GAyfsN7qWaVlf6N/hDPAvA1Yl0YcLIeU4j 2Zu1iPpIZjFDjabYD0pXVrRe41QHQO+kVHXmIpcQ3CGcoagIJkV0LjypetmPjmjrf+40 XgreJc2jwaU3bywaByQzhI370AibDdrJ7VO4+cbjtk81wV7098Psyw6UiJ5pBpa0qAT7 FRM365sJBvBjpjjSic2fBAgAYpFfhYITiQuA9Dk2DvHidoHO+CzM7xoJ1F62FX+fan9C J23AhcFbKoe8BSsSYmwlieg8cBKZBYDm9OAr2GtySmUJwXoaYPGUzw6K/dQyVDt7YC0+ ZwIA== X-Gm-Message-State: APjAAAX2m2eQTnpe0Mi00D0J+kHd70FRW7iBu7ZoXYa5J4qX5e3AOM/K diu7HKFQQpd/yJ1GqZUazTg= X-Google-Smtp-Source: APXvYqwc9Z/f1eoVGsGsLTnGvxTq4rbgg7xC/NgvICiHbjdSVwGsM9JXrkQ16bsXgxbfDBnKepHCMA== X-Received: by 2002:a65:6284:: with SMTP id f4mr6785723pgv.416.1565940822057; Fri, 16 Aug 2019 00:33:42 -0700 (PDT) Received: from rashmica.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id w129sm5638589pfd.89.2019.08.16.00.33.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2019 00:33:41 -0700 (PDT) From: Rashmica Gupta To: peter.maydell@linaro.org, qemu-arm@nongnu.org Date: Fri, 16 Aug 2019 17:32:28 +1000 Message-Id: <20190816073229.22787-3-rashmica.g@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190816073229.22787-1-rashmica.g@gmail.com> References: <20190816073229.22787-1-rashmica.g@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::441 Subject: [Qemu-devel] [PATCH v5 2/3] aspeed: add a GPIO controller to the SoC X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andrew@aj.id.au, qemu-devel@nongnu.org, aik@ozlabs.ru, joel@jms.id.au, Rashmica Gupta , clg@kaod.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Rashmica Gupta Reviewed-by: Cédric Le Goater --- include/hw/arm/aspeed_soc.h | 3 +++ hw/arm/aspeed_soc.c | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h index cef605ad6b..fa04abddd8 100644 --- a/include/hw/arm/aspeed_soc.h +++ b/include/hw/arm/aspeed_soc.h @@ -22,6 +22,7 @@ #include "hw/ssi/aspeed_smc.h" #include "hw/watchdog/wdt_aspeed.h" #include "hw/net/ftgmac100.h" +#include "hw/gpio/aspeed_gpio.h" #define ASPEED_SPIS_NUM 2 #define ASPEED_WDTS_NUM 3 @@ -47,6 +48,7 @@ typedef struct AspeedSoCState { AspeedSDMCState sdmc; AspeedWDTState wdt[ASPEED_WDTS_NUM]; FTGMAC100State ftgmac100[ASPEED_MACS_NUM]; + AspeedGPIOState gpio; } AspeedSoCState; #define TYPE_ASPEED_SOC "aspeed-soc" @@ -60,6 +62,7 @@ typedef struct AspeedSoCInfo { int spis_num; const char *fmc_typename; const char **spi_typename; + const char *gpio_typename; int wdts_num; const int *irqmap; const hwaddr *memmap; diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c index c6fb3700f2..ff422c8ad1 100644 --- a/hw/arm/aspeed_soc.c +++ b/hw/arm/aspeed_soc.c @@ -124,6 +124,7 @@ static const AspeedSoCInfo aspeed_socs[] = { .spis_num = 1, .fmc_typename = "aspeed.smc.fmc", .spi_typename = aspeed_soc_ast2400_typenames, + .gpio_typename = "aspeed.gpio-ast2400", .wdts_num = 2, .irqmap = aspeed_soc_ast2400_irqmap, .memmap = aspeed_soc_ast2400_memmap, @@ -136,6 +137,7 @@ static const AspeedSoCInfo aspeed_socs[] = { .spis_num = 1, .fmc_typename = "aspeed.smc.fmc", .spi_typename = aspeed_soc_ast2400_typenames, + .gpio_typename = "aspeed.gpio-ast2400", .wdts_num = 2, .irqmap = aspeed_soc_ast2400_irqmap, .memmap = aspeed_soc_ast2400_memmap, @@ -148,6 +150,7 @@ static const AspeedSoCInfo aspeed_socs[] = { .spis_num = 1, .fmc_typename = "aspeed.smc.fmc", .spi_typename = aspeed_soc_ast2400_typenames, + .gpio_typename = "aspeed.gpio-ast2400", .wdts_num = 2, .irqmap = aspeed_soc_ast2400_irqmap, .memmap = aspeed_soc_ast2400_memmap, @@ -160,6 +163,7 @@ static const AspeedSoCInfo aspeed_socs[] = { .spis_num = 2, .fmc_typename = "aspeed.smc.ast2500-fmc", .spi_typename = aspeed_soc_ast2500_typenames, + .gpio_typename = "aspeed.gpio-ast2500", .wdts_num = 3, .irqmap = aspeed_soc_ast2500_irqmap, .memmap = aspeed_soc_ast2500_memmap, @@ -246,6 +250,9 @@ static void aspeed_soc_init(Object *obj) sysbus_init_child_obj(obj, "xdma", OBJECT(&s->xdma), sizeof(s->xdma), TYPE_ASPEED_XDMA); + + sysbus_init_child_obj(obj, "gpio", OBJECT(&s->gpio), sizeof(s->gpio), + sc->info->gpio_typename); } static void aspeed_soc_realize(DeviceState *dev, Error **errp) @@ -425,6 +432,16 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp) sc->info->memmap[ASPEED_XDMA]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->xdma), 0, aspeed_soc_get_irq(s, ASPEED_XDMA)); + + /* GPIO */ + object_property_set_bool(OBJECT(&s->gpio), true, "realized", &err); + if (err) { + error_propagate(errp, err); + return; + } + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio), 0, sc->info->memmap[ASPEED_GPIO]); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio), 0, + aspeed_soc_get_irq(s, ASPEED_GPIO)); } static Property aspeed_soc_properties[] = { DEFINE_PROP_UINT32("num-cpus", AspeedSoCState, num_cpus, 0),