From nobody Thu Dec 18 22:24:45 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1600093973; cv=none; d=zohomail.com; s=zohoarc; b=BndRI55qQpKx+7rF8ZbDwtGyjv2ryWUQ/1zdET77vWDlMeOW6BoZv5qWX3wP87rn9okcQZVQu3z+sTq8vjX7nAG2g5VPR/ygpLSWbg7u0V8CRVbkCzSPSzNbvbjEIdxPnlOFqmat37zvMX9QgbBkvNpZfUXorAZLLV5H8V58U00= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600093973; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yZ2vEdJlPjbyI8ww8U5qoJzqvDc0/HAFhSNTRittaEw=; b=FGL/fF/LL8wyR+/dMTx0kcIaCW0TuUbJmEiSIHj+Olmph7TycbGY82ath3afZHrnb4GuddpSjzOQ0T4K4tiT04Ow/LivvuKmUzZM2q+yh6awVwOhexfu6KYxz5ao8tlwAFTBPp6lxhNVTy+o6UcOtVFvKmRqZHj3Bn7Bv0NYVFk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600093973869621.0022622243529; Mon, 14 Sep 2020 07:32:53 -0700 (PDT) Received: from localhost ([::1]:39626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kHpVY-00085t-P8 for importer@patchew.org; Mon, 14 Sep 2020 10:31:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kHp8Z-0003Gq-I4 for qemu-devel@nongnu.org; Mon, 14 Sep 2020 10:07:19 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:35984) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kHp8X-0007dG-Ih for qemu-devel@nongnu.org; Mon, 14 Sep 2020 10:07:19 -0400 Received: by mail-wr1-x434.google.com with SMTP id z1so18906150wrt.3 for ; Mon, 14 Sep 2020 07:07:17 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id x16sm20834041wrq.62.2020.09.14.07.07.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2020 07:07:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=yZ2vEdJlPjbyI8ww8U5qoJzqvDc0/HAFhSNTRittaEw=; b=iT4Oc585nLTP5yjyKnHF2qX5XOr076vBm5yx6xeJajd+OGP2DYKfvo+COC3N8fCorH xtTuMBGlcohhTDpOqJliSxqsL761Vpq+fT8V4gq/Q/ykgB+eM1WDgF1SOs/FeaZoo30L NzAJX9/oUKWWLf350FLz59/RC2Y44fNUEx0t/psSr20JhFMwylVAVLJ2CVPXJ9zYc9/H B6XBuVYWc2XyMqEDxD5e+Cuixol9ko0bXWTpTXq+9/OuIwczkCGmRH2vXZj+oCuiz8m9 /M91LciLW91hoG6aZGx3wpARD67XC9DuHQCY1kcKy1aaxRsQRGTDupk7lbpvN/ZzSYat epHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yZ2vEdJlPjbyI8ww8U5qoJzqvDc0/HAFhSNTRittaEw=; b=aTujUke7K8DAoHqoaDsL4GqUtk00LkfLiweAvrJdCyj68W3MHaKE7P3rE2rdx39jKq 8j4fn16rl6KS330WQHhWKA8JGZxsZ8naTLygi+y3Vanh7PojGCzcfRPq0q2j4tSuvgUj TyLb9EfvpUa0/IjWtGtbAyxanf3A6RRUYUCqA2olsuG+8Zd33q4k1hxTEr2Xgo1SevlC Z6SDc9VExKuhnBMbHC3nCvNnb4BihVyoH1C6gGHvoXxMXN6DL8z1CIjfEm8G1S/KD+Kn ykAepUGiPFn1e9VsyIIzCMqYhCE7VC83FQPeFRJ6d8N2ruP/ruPk3UuSs9B7dw3D+OeQ SYpQ== X-Gm-Message-State: AOAM531/i+W7t8ordqrp3XzrlkQNuI3JEseODDDBblzqSBNOikekuza4 fzJuFjLO/nw6eauhxw7XSSM+KypG77vZ46UN X-Google-Smtp-Source: ABdhPJxgRyw8i6ktQA6bZJRLBpOlmYTs106Uj2JFF3+3Eu753DmjYm/XjQpb8lArmJ8jxy1Wfo60kQ== X-Received: by 2002:a5d:6404:: with SMTP id z4mr16900327wru.423.1600092435913; Mon, 14 Sep 2020 07:07:15 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 29/36] hw/arm: Wire up BMC boot flash for npcm750-evb and quanta-gsj Date: Mon, 14 Sep 2020 15:06:34 +0100 Message-Id: <20200914140641.21369-30-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200914140641.21369-1-peter.maydell@linaro.org> References: <20200914140641.21369-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Havard Skinnemoen This allows these NPCM7xx-based boards to boot from a flash image, e.g. one built with OpenBMC. For example like this: IMAGE=3D${OPENBMC}/build/tmp/deploy/images/gsj/image-bmc qemu-system-arm -machine quanta-gsj -nographic \ -drive file=3D${IMAGE},if=3Dmtd,bus=3D0,unit=3D0,format=3Draw,snapshot=3Don Reviewed-by: Tyrone Ting Reviewed-by: C=C3=A9dric Le Goater Tested-by: C=C3=A9dric Le Goater Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Havard Skinnemoen Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20200911052101.2602693-12-hskinnemoen@google.com Signed-off-by: Peter Maydell --- hw/arm/npcm7xx_boards.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c index b4c772d6b52..79e2e2744ca 100644 --- a/hw/arm/npcm7xx_boards.c +++ b/hw/arm/npcm7xx_boards.c @@ -20,6 +20,7 @@ #include "hw/arm/npcm7xx.h" #include "hw/core/cpu.h" #include "hw/loader.h" +#include "hw/qdev-properties.h" #include "qapi/error.h" #include "qemu-common.h" #include "qemu/units.h" @@ -55,6 +56,22 @@ static void npcm7xx_load_bootrom(MachineState *machine, = NPCM7xxState *soc) } } =20 +static void npcm7xx_connect_flash(NPCM7xxFIUState *fiu, int cs_no, + const char *flash_type, DriveInfo *dinfo) +{ + DeviceState *flash; + qemu_irq flash_cs; + + flash =3D qdev_new(flash_type); + if (dinfo) { + qdev_prop_set_drive(flash, "drive", blk_by_legacy_dinfo(dinfo)); + } + qdev_realize_and_unref(flash, BUS(fiu->spi), &error_fatal); + + flash_cs =3D qdev_get_gpio_in_named(flash, SSI_GPIO_CS, 0); + qdev_connect_gpio_out_named(DEVICE(fiu), "cs", cs_no, flash_cs); +} + static void npcm7xx_connect_dram(NPCM7xxState *soc, MemoryRegion *dram) { memory_region_add_subregion(get_system_memory(), NPCM7XX_DRAM_BA, dram= ); @@ -92,6 +109,7 @@ static void npcm750_evb_init(MachineState *machine) qdev_realize(DEVICE(soc), NULL, &error_fatal); =20 npcm7xx_load_bootrom(machine, soc); + npcm7xx_connect_flash(&soc->fiu[0], 0, "w25q256", drive_get(IF_MTD, 0,= 0)); npcm7xx_load_kernel(machine, soc); } =20 @@ -104,6 +122,8 @@ static void quanta_gsj_init(MachineState *machine) qdev_realize(DEVICE(soc), NULL, &error_fatal); =20 npcm7xx_load_bootrom(machine, soc); + npcm7xx_connect_flash(&soc->fiu[0], 0, "mx25l25635e", + drive_get(IF_MTD, 0, 0)); npcm7xx_load_kernel(machine, soc); } =20 --=20 2.20.1