From patchwork Tue Aug 27 04:01:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rashmica Gupta X-Patchwork-Id: 11115997 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AD59D14D5 for ; Tue, 27 Aug 2019 04:04:40 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 83025206E0 for ; Tue, 27 Aug 2019 04:04:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="u2urdrjA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 83025206E0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2Sil-00068V-Hk for patchwork-qemu-devel@patchwork.kernel.org; Tue, 27 Aug 2019 00:04:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59037) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2Sfp-0002v7-5Z for qemu-devel@nongnu.org; Tue, 27 Aug 2019 00:01:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i2Sfn-0005Br-NV for qemu-devel@nongnu.org; Tue, 27 Aug 2019 00:01:37 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:33142) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i2Sfk-0005B7-MY; Tue, 27 Aug 2019 00:01:32 -0400 Received: by mail-pg1-x541.google.com with SMTP id n190so11866887pgn.0; Mon, 26 Aug 2019 21:01:32 -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=GJqcqRpxwf/KXzpRUCuBPWefogmRRREDYuiipZvtjSs=; b=u2urdrjABPeGXxgyAJY42jPdHfNlRegSfHsvzfbCv9cM1UJv2WXd4wPw5j9QG5meHy FGuTe3TS1WG7d+jLHf0wojmd/2adZJOIMz4HRrF9W3A2kc4PC4Pu2BQ9vT8EB0UIPWg+ KZcGr/A+VHIsR5+XDnfEnGz+XdR8CmeuaVh205t2LrP/3Amplm8Uz1I4ZdeuMiXrDeJv gUPyefD6EqqqbXHNSBP6CIFs9sRS/tP5jBi1vEvtoVyZy/1OlFRBR/w/9EH4d6kcGx9d /VFw/8cODBbYmSdQtxlCY7p7ZuJKUF1OzesijeXLpQ7ipg7n/dcgO2Wd2KfmOjuf5nKO 4jVw== 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=GJqcqRpxwf/KXzpRUCuBPWefogmRRREDYuiipZvtjSs=; b=N14+hKHmaTZZQXYNwDtG32+EctpxHXE0vek+9TCLPJiyl3rCkvWQ9CQVaCsP8ame0l CG9rtZiNT576Msho3kIZ9NjI3HtLE+2g63fT+xJWjGe7GYxxPl1Dyn+2wJxaswRyuPtk v+Mt3STCMOdiAQjiwaTEtwGAZkGMXYuVga3K+BNEmN0TnEgAn71QWhJOrX1aD4Rz/iM4 bsQThc4+f+LVgE0VzefF2Ax8+pTx6+dmo/s1JSfjiVCiuUkaiCAXxo2TKIaNIttwvvx3 oUV4mynU6b7fVMmkwT9Sv787XYFFcDfAMsrsp+93d6B/y2h0cyB2zYt+KyBpVBik7isQ 0MgQ== X-Gm-Message-State: APjAAAVX5tVuHBKL8PoJ38rutF/kIzdFVVYyNgJhhtEeecvicMNU65SS CB9yRj3lDNwxQr3XVeavYkBPF2s5F8o= X-Google-Smtp-Source: APXvYqyEKw4wkDm/xjCE/c4Sw3lZEJPcfoXFYR1fIQFbaG98pcl0mGDTGhD5r98KJbSK+qBEvbaT9g== X-Received: by 2002:a63:5648:: with SMTP id g8mr19059014pgm.81.1566878491778; Mon, 26 Aug 2019 21:01:31 -0700 (PDT) Received: from rashmica.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id s11sm12004814pgv.13.2019.08.26.21.01.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2019 21:01:31 -0700 (PDT) From: Rashmica Gupta To: peter.maydell@linaro.org, qemu-arm@nongnu.org Date: Tue, 27 Aug 2019 14:01:13 +1000 Message-Id: <20190827040114.23390-3-rashmica.g@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190827040114.23390-1-rashmica.g@gmail.com> References: <20190827040114.23390-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::541 Subject: [Qemu-devel] [PATCH v6 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+patchwork-qemu-devel=patchwork.kernel.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),