From patchwork Tue Nov 2 18:25:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516695 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp4867423iml; Tue, 2 Nov 2021 11:32:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrgLQ/NfAp2vHH4F1ieVhlMfZMoR0TQoXYPtEq3V9IS8Li+6IuaWorEgAAbDM/8p86caJH X-Received: by 2002:a9d:6a4d:: with SMTP id h13mr13373335otn.293.1635877937418; Tue, 02 Nov 2021 11:32:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635877937; cv=none; d=google.com; s=arc-20160816; b=iTOXsjfmYn4LYFETMH0tuvChpAcsw1SNRx04oWVDvu/8ytLVK3lNb4Vuh93hv7bxKL nRn+MggJzgyhY9nEzu17PQ8ktHPwUTVoopX+T0QXIdbYJKJ/sLxGY9X2KSwAjAqlqjXU Rea9AlzwgYkCD5RqxxtZ+Zplqu+B4fEFNsER9z6CWYRunBKtL6NmHBSNt3ZEMF0cBfBT Vb72OwT+NA8cyLtJWgKODTOmGBgR0lC2Q/Y9N0N5LBycsJN+YRRCJoFhWeuJIwuDXrfK 0qU95n83g55JlUahEZuvpm5PjUcaSgk4JO9Ja/u9aReQHxwW1j59LotLQUb4RGg+xNwF Xrig== 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; bh=CLouTaodPxEP08iPvDZkl4yjeSN0JJ+7RsZ1lYxtnnA=; b=PlRNqv9TCNE+rw423X3vBj70a+FVEEZGwiBMeRgMt9o4o1FoanJSYK1t5+hj+ADxst x4bUNrBJYKFwCp6xWNWYKrha1PpU1Bvfc366z5FkRiMe5zaNzIgSZ6D5AtAyc9SL6kK5 BjO0cbyvQlJiHWqbws7IK/ge9ur1hHxeB9maBJgFkMcpv2pN2xzHUq12GGtx5esKzwqe ZOhHDiMeOmLFyzREEe7D8fJ8IYX/oA/w12UNsHY25C811UE9U6fAfFAT8iw9SNWD1W0P fB6SaEVV5sfKdNvII/4hyvXSSDLVwVGYjp0f/QPfzQCmf+WJCgZkLZtUK4k8j7HIiggs likw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=EkrysGit; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c21si19901582oiw.10.2021.11.02.11.32.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Nov 2021 11:32:17 -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; dkim=fail header.i=@linaro.org header.s=google header.b=EkrysGit; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhya0-00031o-Ns for patch@linaro.org; Tue, 02 Nov 2021 14:32:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhyTQ-0005i9-0e for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:28 -0400 Received: from mail-qv1-xf2f.google.com ([2607:f8b0:4864:20::f2f]:45009) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhyTN-0004DT-Hq for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:27 -0400 Received: by mail-qv1-xf2f.google.com with SMTP id v2so13840029qve.11 for ; Tue, 02 Nov 2021 11:25:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CLouTaodPxEP08iPvDZkl4yjeSN0JJ+7RsZ1lYxtnnA=; b=EkrysGitq5Dc6xFTL4fB0OTrYzN2Zf33Ax0D9kw4awVpYf2vx24e7bDzrAnwPOycj2 oSzyPtgET6S0J+K0+MdOdp1snjhn7LApP/XQydez8bA4gJQlTVeD5pUPn9vjSdjruPbo WYRBgUH6RG/riK1jURXouorBvULfwYmOaHqtzpsUwFBCsiN2DU8DVLyR3+npBc1w+YmK founxa93htvWgg4m6rameSPb+fO+peM0VGKQr+Yg6guMJWgOJM1ByaYwVCp/L5l7K5mV EdefqWhgTI3x3YnEKOrAw4A7nJE7rfA3wEFjC5ZRW5l/Hj8KJgFybPHaE4xGxE7UPwHk jpSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CLouTaodPxEP08iPvDZkl4yjeSN0JJ+7RsZ1lYxtnnA=; b=zMgnet9DQed4KnD+yqWSZbXxH085PIorPZklCp/aWeeGgEFyy6THWXVPL3HwOW7OEL fx3DvmXaRinKRTEnQ0fxeRdmx6rllKV+wI+FAMCoFT928oDtrJiFhE6lnsv3kUdpgJ/t oS2VcbD5k533faoA6xmeb0gUEo22C1/GT7BfCpBNA2joSFIficJ3YK2DPY9p2Bc/+5zI MomZRN33E8N2HsXvpvgDenDYfGR8jTTCyACNavwX2Pgr0snYko2BT7schDJgbVcA8GoC rGUOyCu9ZabtBkQU11BRulOdYz6TQOuiItzp5Ia1rRzIDJ5xszI3Dpr77a13ogxL06pi 4wBw== X-Gm-Message-State: AOAM531FPDktr1FhPR8Oj7hO2Fuvp2JL3bAFeEfR+PzVo1hybhho31D9 gIeDIguLYSmkehYD3PQyV4R3hKYnNM7vWw== X-Received: by 2002:a05:6214:e41:: with SMTP id o1mr37483193qvc.0.1635877522649; Tue, 02 Nov 2021 11:25:22 -0700 (PDT) Received: from localhost.localdomain (rrcs-172-254-253-57.nyc.biz.rr.com. [172.254.253.57]) by smtp.gmail.com with ESMTPSA id y9sm13701081qko.74.2021.11.02.11.25.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 11:25:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v2 03/12] hw/arm: Attach MMC to quanta-gbs-bmc Date: Tue, 2 Nov 2021 14:25:10 -0400 Message-Id: <20211102182519.320319-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211102182519.320319-1-richard.henderson@linaro.org> References: <20211102182519.320319-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f2f; envelope-from=richard.henderson@linaro.org; helo=mail-qv1-xf2f.google.com 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hao Wu , Tyrone Ting , Shengtan Mao , Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Shengtan Mao Signed-off-by: Shengtan Mao Signed-off-by: Hao Wu Reviewed-by: Hao Wu Reviewed-by: Tyrone Ting Reviewed-by: Peter Maydell Message-Id: <20211008002628.1958285-4-wuhaotsh@google.com> Signed-off-by: Richard Henderson --- hw/arm/npcm7xx_boards.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 2.25.1 diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c index a656169f61..dec7d16ae5 100644 --- a/hw/arm/npcm7xx_boards.c +++ b/hw/arm/npcm7xx_boards.c @@ -27,6 +27,9 @@ #include "qemu-common.h" #include "qemu/datadir.h" #include "qemu/units.h" +#include "sysemu/blockdev.h" +#include "sysemu/sysemu.h" +#include "sysemu/block-backend.h" #define NPCM750_EVB_POWER_ON_STRAPS 0x00001ff7 #define QUANTA_GSJ_POWER_ON_STRAPS 0x00001fff @@ -81,6 +84,22 @@ static void npcm7xx_connect_dram(NPCM7xxState *soc, MemoryRegion *dram) &error_abort); } +static void sdhci_attach_drive(SDHCIState *sdhci) +{ + DriveInfo *di = drive_get_next(IF_SD); + BlockBackend *blk = di ? blk_by_legacy_dinfo(di) : NULL; + + BusState *bus = qdev_get_child_bus(DEVICE(sdhci), "sd-bus"); + if (bus == NULL) { + error_report("No SD bus found in SOC object"); + exit(1); + } + + DeviceState *carddev = qdev_new(TYPE_SD_CARD); + qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal); + qdev_realize_and_unref(carddev, bus, &error_fatal); +} + static NPCM7xxState *npcm7xx_create_soc(MachineState *machine, uint32_t hw_straps) { @@ -355,6 +374,7 @@ static void quanta_gbs_init(MachineState *machine) drive_get(IF_MTD, 0, 0)); quanta_gbs_i2c_init(soc); + sdhci_attach_drive(&soc->mmc.sdhci); npcm7xx_load_kernel(machine, soc); }