Received: by 2002:a05:6512:204:0:0:0:0 with SMTP id a4csp133157lfo; Fri, 4 Mar 2022 16:07:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJz0jnx5sPghkxkn0XairosCYKzmuBLJkZDk5GlNV7c/SRDA1txkCxG8oTIoNBurZPueAflV X-Received: by 2002:a25:c7c4:0:b0:628:96a9:7451 with SMTP id w187-20020a25c7c4000000b0062896a97451mr960025ybe.83.1646438853367; Fri, 04 Mar 2022 16:07:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646438853; cv=none; d=google.com; s=arc-20160816; b=tZqwRScv/pIoPI9S0Ru9O3ASZDeAei7N5oK0oDdVvLsugwy8DmSUartUzEWN1au5p4 Pa52AxpzSqPlNun3lXPFja5XplCa1IDYlCG15CYRO+dQjV/Lh90oh0Bbtefu8sMAFTB5 rexYmK2mmwXTQ0eh5A7ySRJj+/QRprjzMxXY2GyTkO8ze+wxL7EndBXkilnHsTGpuBYk SQppagzZV+YPJGPUEYuWEfMtJl0pv6b6e5WdJcXT9EUJ/vqsgsvqBzKkv9d5zREKL0Te k+X52EwY9YSVNPivx0RDf3oI3QgaxoI3ToU+NmMych9gM3JkyHEl7+HWe+Ht4dRnnqSz W/Gw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:dkim-signature; bh=8OwIuxp/tOnAPABR7tGIS5NMsw5NrCQqmaDjhe5cBP4=; b=gGInoRvrNBcGvMCsYuCHtSbPoOAsxOIQPfy0R5dgADatsjUIhlby56d5gVTw5vzfq6 9gFUK+bMD4AV5zq6sZowjSiecZtqbM5ScsYE5bK0ESdmhyQiWk5n0afpjlsj1yAyUtKu gwYzZ9YzNVzVdSfRE5irMi2lhNbYJZ66dCBBGFh8Nkup5k2y8+YiqCqoGgAEX2San7Pt kUEQyYwvSxJ4BcgctMlF+4O0W1VC741N6p54oiCScETHS4kN5vXOe++eRteioVEyMJKz b/EyaWVUlBDZUkSr5zBhUVCylQclZ1GzI0xDcje4WaGM63eMs9UTNZXde9KwS7A2V8l+ BOsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@stwcx.xyz header.s=fm1 header.b=nZ0phIp0; dkim=fail header.i=@messagingengine.com header.s=fm2 header.b=HpuQuV0z; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=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 c18-20020a5b0bd2000000b00628a6f4c54fsi5554006ybr.552.2022.03.04.16.07.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Mar 2022 16:07:33 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@stwcx.xyz header.s=fm1 header.b=nZ0phIp0; dkim=fail header.i=@messagingengine.com header.s=fm2 header.b=HpuQuV0z; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org" Received: from localhost ([::1]:40892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nQHxM-0003Ym-Oe for alex.bennee@linaro.org; Fri, 04 Mar 2022 19:07:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nQHwx-0003Vx-8N; Fri, 04 Mar 2022 19:07:08 -0500 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:57161) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nQHwv-0004id-Gj; Fri, 04 Mar 2022 19:07:06 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id A05A95802D4; Fri, 4 Mar 2022 19:07:04 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 04 Mar 2022 19:07:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stwcx.xyz; h=cc :cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; bh=8OwIuxp/tOnAPABR7tGIS5NMsw5NrC QqmaDjhe5cBP4=; b=nZ0phIp0MbQBPT1+z5QxOWi0OExj9UJ8sGl9FgZr0Esx5x 3SCbs9HfmVEhEuLlOa2PmQuVOPMLK9uh6brF9ErxRbBJyy8Mbf2gg/+ciaD7SdWL 1GT7+peYhCn52IYX/Sn8xCAKiGQAMBdlAcGKo41RQmqAjsoiOcg1L6HzQZBF2mTR DwjiLmFA84ccr6qRL8FF6Z0FOXd6/Mm9AeSMW+y9RsvlJkJZeJanJtt4o3l2HiOX o1Pmp3BqDshf8zqyWkqZSXqmTtiRcx2LZeyVKwXAV/wYsplAt5xseKZKfQa0VwSS zVNu2hNzgeR5QCcpGzeZNmPh8mppdv/Ajh+YhjVw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=8OwIux p/tOnAPABR7tGIS5NMsw5NrCQqmaDjhe5cBP4=; b=HpuQuV0zPpUUJlHa0dhQFF ISv9ppkTHgaQ1uE9/NeI1FIO4hsK4mPnb068emyQe8WbRkHq95nmdZW+1n4Qofvz rb9cY3Xqbxq2o0d8vdS77WrAj5cyY78hsKcL0TzK5EjApWs8v7PFD1JOCHt1Eyrg +b0qvgJXxa9T1NFKo21Y6qOh1lyesOdqjA/ePPXDa9ME0IIHt4mG998S1ZUbfVDW Xg0aiG0vAuLwMoRhy4rPckmRUjb8U7Poi69P2Fm3eNhkZc/Wg3qiEb440gsP9b8r vDKXwfFxUnLlJ8s+eWS3lV3Sy0+ai5phRzaXrepLEyPITeZMrGKUsrdqppCH3aNg == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddruddtledgudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne hmihhsshhinhhgucfvqfcufhhivghlugculdeftddmnegfrhhlucfvnfffucdlvdefmden ogetfedtuddqtdduucdludehmdenogevohgrshhtrghlqdfhgeduvddqtddvucdludehtd dmnecujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefrrght rhhitghkucghihhllhhirghmshcuoehprghtrhhitghksehsthiftgigrdighiiiqeenuc ggtffrrghtthgvrhhnpeduvdekueejfffhtddufeejjefhueeuueefhedthfduleevtddt keeivedvgefgieenucffohhmrghinhepkhgvrhhnvghlrdhorhhgpdhgihhthhhusgdrtg homhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehp rghtrhhitghksehsthiftgigrdighiii X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Mar 2022 19:07:03 -0500 (EST) From: Patrick Williams To: Subject: [PATCH 2/2] hw/arm/aspeed: add Bletchley machine type Date: Fri, 4 Mar 2022 18:06:56 -0600 Message-Id: <20220305000656.1944589-2-patrick@stwcx.xyz> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220305000656.1944589-1-patrick@stwcx.xyz> References: <20220305000656.1944589-1-patrick@stwcx.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=66.111.4.229; envelope-from=patrick@stwcx.xyz; helo=new3-smtp.messagingengine.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.997, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jeffery , "open list:All patches CC here" , Patrick Williams , "open list:ASPEED BMCs" , Joel Stanley , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: 21352i7QlTG/ Add the 'bletchley-bmc' machine type based on the kernel DTS[1] and hardware schematics available to me. The i2c model is as complete as the current QEMU models support, but in some cases I substituted devices that are close enough for present functionality. Strap registers are kept the same as the AST2600-EVB until I'm able to confirm correct values with physical hardware. This has been tested with an openbmc image built from [2] plus a kernel patch[3] for the SPI flash module. 1. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/arm/boot/dts/aspeed-bmc-facebook-bletchley.dts?id=a8c729e966c4e9d033242d948b0e53c2a62d32e2 2. https://github.com/openbmc/openbmc/commit/b9432b980d7f63f7512ffbcc7124386ba896dfc6 3. https://github.com/openbmc/linux/commit/25b566b9a9d7f5d4f10c1b7304007bdb286eefd7 Signed-off-by: Patrick Williams --- hw/arm/aspeed.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 617a1ecbdc..3dc2ede823 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -167,6 +167,11 @@ struct AspeedMachineState { #define FUJI_BMC_HW_STRAP1 0x00000000 #define FUJI_BMC_HW_STRAP2 0x00000000 +/* Bletchley hardware value */ +/* TODO: Leave same as EVB for now. */ +#define BLETCHLEY_BMC_HW_STRAP1 AST2600_EVB_HW_STRAP1 +#define BLETCHLEY_BMC_HW_STRAP2 AST2600_EVB_HW_STRAP2 + /* * The max ram region is for firmwares that scan the address space * with load/store to guess how much RAM the SoC has. @@ -901,6 +906,54 @@ static void fuji_bmc_i2c_init(AspeedMachineState *bmc) } } +#define TYPE_TMP421 "tmp421" + +static void bletchley_bmc_i2c_init(AspeedMachineState *bmc) +{ + AspeedSoCState *soc = &bmc->soc; + I2CBus *i2c[13] = {}; + for (int i = 0; i < 13; i++) { + if ((i == 8) || (i == 11)) { + continue; + } + i2c[i] = aspeed_i2c_get_bus(&soc->i2c, i); + } + + /* Bus 0 - 5 all have the same config. */ + for (int i = 0; i < 6; i++) { + /* Missing model: ti,ina230 @ 0x45 */ + /* Missing model: mps,mp5023 @ 0x40 */ + i2c_slave_create_simple(i2c[i], TYPE_TMP421, 0x4f); + /* Missing model: nxp,pca9539 @ 0x76, but PCA9552 works enough */ + i2c_slave_create_simple(i2c[i], TYPE_PCA9552, 0x76); + i2c_slave_create_simple(i2c[i], TYPE_PCA9552, 0x67); + /* Missing model: fsc,fusb302 @ 0x22 */ + } + + /* Bus 6 */ + at24c_eeprom_init(i2c[6], 0x56, 65536); + /* Missing model: nxp,pcf85263 @ 0x51 , but ds1338 works enough */ + i2c_slave_create_simple(i2c[6], "ds1338", 0x51); + + + /* Bus 7 */ + at24c_eeprom_init(i2c[7], 0x54, 65536); + + /* Bus 9 */ + i2c_slave_create_simple(i2c[9], TYPE_TMP421, 0x4f); + + /* Bus 10 */ + i2c_slave_create_simple(i2c[10], TYPE_TMP421, 0x4f); + /* Missing model: ti,hdc1080 @ 0x40 */ + i2c_slave_create_simple(i2c[10], TYPE_PCA9552, 0x67); + + /* Bus 12 */ + /* Missing model: adi,adm1278 @ 0x11 */ + i2c_slave_create_simple(i2c[12], TYPE_TMP421, 0x4c); + i2c_slave_create_simple(i2c[12], TYPE_TMP421, 0x4d); + i2c_slave_create_simple(i2c[12], TYPE_PCA9552, 0x67); +} + static bool aspeed_get_mmio_exec(Object *obj, Error **errp) { return ASPEED_MACHINE(obj)->mmio_exec; @@ -1224,6 +1277,26 @@ static void aspeed_machine_fuji_class_init(ObjectClass *oc, void *data) aspeed_soc_num_cpus(amc->soc_name); }; + +static void aspeed_machine_bletchley_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc = MACHINE_CLASS(oc); + AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc); + + mc->desc = "Facebook Bletchley BMC (Cortex-A7)"; + amc->soc_name = "ast2600-a3"; + amc->hw_strap1 = BLETCHLEY_BMC_HW_STRAP1; + amc->hw_strap2 = BLETCHLEY_BMC_HW_STRAP2; + amc->fmc_model = "w25q01jvq"; + amc->spi_model = NULL; + amc->num_cs = 1; + amc->macs_mask = ASPEED_MAC2_ON; + amc->i2c_init = bletchley_bmc_i2c_init; + mc->default_ram_size = 512 * MiB; + mc->default_cpus = mc->min_cpus = mc->max_cpus = + aspeed_soc_num_cpus(amc->soc_name); +} + static const TypeInfo aspeed_machine_types[] = { { .name = MACHINE_TYPE_NAME("palmetto-bmc"), @@ -1277,6 +1350,10 @@ static const TypeInfo aspeed_machine_types[] = { .name = MACHINE_TYPE_NAME("fuji-bmc"), .parent = TYPE_ASPEED_MACHINE, .class_init = aspeed_machine_fuji_class_init, + }, { + .name = MACHINE_TYPE_NAME("bletchley-bmc"), + .parent = TYPE_ASPEED_MACHINE, + .class_init = aspeed_machine_bletchley_class_init, }, { .name = TYPE_ASPEED_MACHINE, .parent = TYPE_MACHINE, -- 2.34.1