From patchwork Thu Sep 19 05:50:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 174035 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp596730ill; Wed, 18 Sep 2019 23:12:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqw4J5zJRN+HbhekmMK7hcbDwpNufoGUu4pXSYCNqVjruR17kRHMO4kmCWg0vOjSPPn9HWUC X-Received: by 2002:ac8:3871:: with SMTP id r46mr1550818qtb.267.1568873563730; Wed, 18 Sep 2019 23:12:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568873563; cv=none; d=google.com; s=arc-20160816; b=niFW8ycf0564gzhSPhGFq6E4T5f/r6xjENkytc8nYBI1y7Ks7u316tE6vkjv3y0HWj sc+KImwJjTjBk3OW4SJAyVuV+9Sp6fHOvcrL86XxjuQom/5zAnNqEuKqaonv7xlCKEiF OnNpFO5VWuY42BQr+3P+ZEOiOmexgX8IxrzGwkq82m3PtlfYBjcdbujDN/EqpjQzTf96 f4O+qk/YBXHekMkizOCigRu/omhrelLGGbTrFShxoDW/vTeAvRjxoxFxO2uJWguv5ud1 4PD7hexq7ETV/qSbZK62HEq2r8mdL69EXGoPzi814LYhxqV1cJyuBlPBGdSBHnKtgoMG +ZQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=DcYkjLOWGBZmrchboQD9IBxnptPjPEIX3LinY58gO3w=; b=fxrHbUp4+4yATZukDyXWMVE/F9S5gssi2DkgKJWEhHaSrS+wmtQe0HVsJzDVQopoFe iXEoyEcx6ik4u9SP5l6NazBtKbbIR4bngrZ30XY/slOD8WQvGJEeEbTPLRBhNPoLzntu uEdBOXEoUaR9Yq1d25DIRjRtW7VGbhkEGfsYXTaOZ3HtVcw7jGWODElEHku4wGe0GHe9 QgGFQwqH9SGCwp9agjZ7qGa//bTmKQSxsP5udjfXP/n7DM+VuOWYng1firN3OsLwtFj7 fcCZekzzabcQET7SQXee9MEktGtVTwPi+vL+S0V96GckcE7ql+3/VN2rtzp87UrpDpbz +eSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i18si5405468qvg.159.2019.09.18.23.12.43 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Sep 2019 23:12:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:38034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iApgI-0007Uu-Rf for patch@linaro.org; Thu, 19 Sep 2019 02:12:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42989) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iApMe-0002iW-0L for qemu-devel@nongnu.org; Thu, 19 Sep 2019 01:52:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iApMc-0000RX-LQ for qemu-devel@nongnu.org; Thu, 19 Sep 2019 01:52:23 -0400 Received: from 4.mo2.mail-out.ovh.net ([87.98.172.75]:48659) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iApMc-0000QN-Dx for qemu-devel@nongnu.org; Thu, 19 Sep 2019 01:52:22 -0400 Received: from player788.ha.ovh.net (unknown [10.109.143.146]) by mo2.mail-out.ovh.net (Postfix) with ESMTP id 86A7C1AD4BE for ; Thu, 19 Sep 2019 07:52:20 +0200 (CEST) Received: from kaod.org (lfbn-1-2240-157.w90-76.abo.wanadoo.fr [90.76.60.157]) (Authenticated sender: clg@kaod.org) by player788.ha.ovh.net (Postfix) with ESMTPSA id A7FDD9F17680; Thu, 19 Sep 2019 05:52:13 +0000 (UTC) From: =?utf-8?q?C=C3=A9dric_Le_Goater?= To: Peter Maydell Date: Thu, 19 Sep 2019 07:50:00 +0200 Message-Id: <20190919055002.6729-20-clg@kaod.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190919055002.6729-1-clg@kaod.org> References: <20190919055002.6729-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 1698982963550718737 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrudelgdelhecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 87.98.172.75 Subject: [Qemu-devel] [PATCH 19/21] aspeed: Parameterise number of MACs 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 Jeffery , =?utf-8?q?C=C3=A9dric_Le_Goater?= , qemu-arm@nongnu.org, qemu-devel@nongnu.org, Joel Stanley Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Joel Stanley To support the ast2600's four MACs allow SoCs to specify the number they have, and create that many. Signed-off-by: Joel Stanley [clg: included a check on sc->macs_num when realizing the macs ] Signed-off-by: Cédric Le Goater --- include/hw/arm/aspeed_soc.h | 5 ++++- hw/arm/aspeed_ast2600.c | 7 +++++-- hw/arm/aspeed_soc.c | 6 ++++-- 3 files changed, 13 insertions(+), 5 deletions(-) -- 2.21.0 diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h index 67c59956f835..088a5d108185 100644 --- a/include/hw/arm/aspeed_soc.h +++ b/include/hw/arm/aspeed_soc.h @@ -30,7 +30,7 @@ #define ASPEED_SPIS_NUM 2 #define ASPEED_WDTS_NUM 4 #define ASPEED_CPUS_NUM 2 -#define ASPEED_MACS_NUM 2 +#define ASPEED_MACS_NUM 4 typedef struct AspeedSoCState { /*< private >*/ @@ -69,6 +69,7 @@ typedef struct AspeedSoCClass { uint64_t sram_size; int spis_num; int wdts_num; + int macs_num; const int *irqmap; const hwaddr *memmap; uint32_t num_cpus; @@ -114,6 +115,8 @@ enum { ASPEED_I2C, ASPEED_ETH1, ASPEED_ETH2, + ASPEED_ETH3, + ASPEED_ETH4, ASPEED_SDRAM, ASPEED_XDMA, }; diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c index cc50e52c24ca..ec51f9b6e617 100644 --- a/hw/arm/aspeed_ast2600.c +++ b/hw/arm/aspeed_ast2600.c @@ -32,7 +32,9 @@ static const hwaddr aspeed_soc_ast2600_memmap[] = { [ASPEED_SPI1] = 0x1E630000, [ASPEED_SPI2] = 0x1E641000, [ASPEED_ETH1] = 0x1E660000, + [ASPEED_ETH3] = 0x1E670000, [ASPEED_ETH2] = 0x1E680000, + [ASPEED_ETH4] = 0x1E690000, [ASPEED_VIC] = 0x1E6C0000, [ASPEED_SDMC] = 0x1E6E0000, [ASPEED_SCU] = 0x1E6E2000, @@ -175,7 +177,7 @@ static void aspeed_soc_ast2600_init(Object *obj) OBJECT(&s->scu), &error_abort); } - for (i = 0; i < ASPEED_MACS_NUM; i++) { + for (i = 0; i < sc->macs_num; i++) { sysbus_init_child_obj(obj, "ftgmac100[*]", OBJECT(&s->ftgmac100[i]), sizeof(s->ftgmac100[i]), TYPE_FTGMAC100); } @@ -399,7 +401,7 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) } /* Net */ - for (i = 0; i < nb_nics; i++) { + for (i = 0; i < nb_nics && i < sc->macs_num; i++) { qdev_set_nic_properties(DEVICE(&s->ftgmac100[i]), &nd_table[i]); object_property_set_bool(OBJECT(&s->ftgmac100[i]), true, "aspeed", &err); @@ -472,6 +474,7 @@ static void aspeed_soc_ast2600_class_init(ObjectClass *oc, void *data) sc->sram_size = 0x10000; sc->spis_num = 2; sc->wdts_num = 4; + sc->macs_num = 4; sc->irqmap = aspeed_soc_ast2600_irqmap; sc->memmap = aspeed_soc_ast2600_memmap; sc->num_cpus = 2; diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c index a063be9fd795..6defb143acde 100644 --- a/hw/arm/aspeed_soc.c +++ b/hw/arm/aspeed_soc.c @@ -198,7 +198,7 @@ static void aspeed_soc_init(Object *obj) OBJECT(&s->scu), &error_abort); } - for (i = 0; i < ASPEED_MACS_NUM; i++) { + for (i = 0; i < sc->macs_num; i++) { sysbus_init_child_obj(obj, "ftgmac100[*]", OBJECT(&s->ftgmac100[i]), sizeof(s->ftgmac100[i]), TYPE_FTGMAC100); } @@ -372,7 +372,7 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp) } /* Net */ - for (i = 0; i < nb_nics; i++) { + for (i = 0; i < nb_nics && i < sc->macs_num; i++) { qdev_set_nic_properties(DEVICE(&s->ftgmac100[i]), &nd_table[i]); object_property_set_bool(OBJECT(&s->ftgmac100[i]), true, "aspeed", &err); @@ -455,6 +455,7 @@ static void aspeed_soc_ast2400_class_init(ObjectClass *oc, void *data) sc->sram_size = 0x8000; sc->spis_num = 1; sc->wdts_num = 2; + sc->macs_num = 2; sc->irqmap = aspeed_soc_ast2400_irqmap; sc->memmap = aspeed_soc_ast2400_memmap; sc->num_cpus = 1; @@ -478,6 +479,7 @@ static void aspeed_soc_ast2500_class_init(ObjectClass *oc, void *data) sc->sram_size = 0x9000; sc->spis_num = 2; sc->wdts_num = 3; + sc->macs_num = 2; sc->irqmap = aspeed_soc_ast2500_irqmap; sc->memmap = aspeed_soc_ast2500_memmap; sc->num_cpus = 1;