From patchwork Tue Aug 7 07:57:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 10558299 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 56019157B for ; Tue, 7 Aug 2018 07:59:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4458C297D9 for ; Tue, 7 Aug 2018 07:59:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38C5A2984B; Tue, 7 Aug 2018 07:59:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D033629819 for ; Tue, 7 Aug 2018 07:59:40 +0000 (UTC) Received: from localhost ([::1]:37808 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmwu4-0003ah-2d for patchwork-qemu-devel@patchwork.kernel.org; Tue, 07 Aug 2018 03:59:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60641) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmwsh-0002UX-PJ for qemu-devel@nongnu.org; Tue, 07 Aug 2018 03:58:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fmwsh-0005Th-4y for qemu-devel@nongnu.org; Tue, 07 Aug 2018 03:58:15 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:45112) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fmwsf-0005Sh-4r; Tue, 07 Aug 2018 03:58:13 -0400 Received: by mail-pf1-x444.google.com with SMTP id i26-v6so8152420pfo.12; Tue, 07 Aug 2018 00:58:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=pM0KI2p90mEy8ReropfVQoaeacLNStOyD/+HuoyhGWs=; b=EwIORujbUy9WtEYETd877sURJNukH9wz3KYbihICBhQVgIfjZy//JT+D3dnlhDqhjR mKozZHWa5Nl/O6fNFFLGkFd4x6pgzfHS8SvAbuHquLO4nf29pLMxtzXkOu/My4ohCyvQ 6Qm1dXnQMWJMGu2of9bCHfDa/RzQlbw+0cvH+DUkI1fo9TEx+roiEHZSUTGbS18rxvX+ HWbOp7J/mWLeJBxPIoFRDHy+MtNb6tLU9gHVRCoTsj8hwMZfpUb0+SmmCf/5154GMNM3 PPPXSqqz27oECw5/DFAAFZa6tBgymNDEMY2yfc+9fW4Bgt/GCeIsQu62EKwhbdN2S8FK rL4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=pM0KI2p90mEy8ReropfVQoaeacLNStOyD/+HuoyhGWs=; b=EL+0d7RuajF/8rODFDikS2J6/DSqJuOyIlBVqIyf6JL2Zi2w1XpGyolcO/GT0mz2N7 hJ0aGIsPbLVSS3NIUIKhMC2h6jYjSYtWY7hzVv7MtLMOOU7bRWPTr2PYjBo2SwLZaPVV GlzlYVDYKWqOipioR8tP5HjDiKKUcbwplO9vSD7YUUitZyd9FwtyGRsE4ucTx36NEs7E birKCDYmrbaliMoH/WlYMAso23c/YgPgDhvblgzJdn22i0pN//MTnZQSbVPtfC/OyIhK BQHhxvBr2Qqa1HvQrGSNJxXykT5uc9uChBOZDpYkv/uOTxbM6Gyab+yrhqR9Zx5MY3VV tRYQ== X-Gm-Message-State: AOUpUlH8K9SSpTzT4En4MAov0/Uw5GlQ9vqvcADW/vzPGpZXu3tcFwX6 AV9pVmbYG4xuaZs4UWtUT0I= X-Google-Smtp-Source: AAOMgpdIyzFKf9VlRJK8wqEpyo7ltniTyKUapKO2re9HWp8xxpHbWfbIM0XlnqMK3TaPBD33aTeJhw== X-Received: by 2002:a63:5350:: with SMTP id t16-v6mr17341411pgl.196.1533628692103; Tue, 07 Aug 2018 00:58:12 -0700 (PDT) Received: from aurora.jms.id.au ([45.124.203.18]) by smtp.gmail.com with ESMTPSA id p73-v6sm1466263pfk.186.2018.08.07.00.58.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Aug 2018 00:58:11 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Tue, 07 Aug 2018 17:28:05 +0930 From: Joel Stanley To: Peter Maydell , =?utf-8?q?C=C3=A9dric_Le_Goate?= =?utf-8?q?r?= Date: Tue, 7 Aug 2018 17:27:51 +0930 Message-Id: <20180807075757.7242-2-joel@jms.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180807075757.7242-1-joel@jms.id.au> References: <20180807075757.7242-1-joel@jms.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 Subject: [Qemu-devel] [PATCH 1/7] aspeed_sdmc: Extend number of valid registers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The SDMC on the ast2500 has 170 registers. Signed-off-by: Joel Stanley Reviewed-by: Cédric Le Goater --- include/hw/misc/aspeed_sdmc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/misc/aspeed_sdmc.h b/include/hw/misc/aspeed_sdmc.h index 551c8afdf4be..682f0f5d56dc 100644 --- a/include/hw/misc/aspeed_sdmc.h +++ b/include/hw/misc/aspeed_sdmc.h @@ -14,7 +14,7 @@ #define TYPE_ASPEED_SDMC "aspeed.sdmc" #define ASPEED_SDMC(obj) OBJECT_CHECK(AspeedSDMCState, (obj), TYPE_ASPEED_SDMC) -#define ASPEED_SDMC_NR_REGS (0x8 >> 2) +#define ASPEED_SDMC_NR_REGS (0x174 >> 2) typedef struct AspeedSDMCState { /*< private >*/ From patchwork Tue Aug 7 07:57:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 10558305 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 23F2813B4 for ; Tue, 7 Aug 2018 08:02:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1699F2983D for ; Tue, 7 Aug 2018 08:02:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08DEE29B37; Tue, 7 Aug 2018 08:02:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9E2DB2983D for ; Tue, 7 Aug 2018 08:02:33 +0000 (UTC) Received: from localhost ([::1]:37829 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmwwq-00061Q-PR for patchwork-qemu-devel@patchwork.kernel.org; Tue, 07 Aug 2018 04:02:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60678) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmwst-0002f8-Gi for qemu-devel@nongnu.org; Tue, 07 Aug 2018 03:58:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fmwss-0005XK-N9 for qemu-devel@nongnu.org; Tue, 07 Aug 2018 03:58:27 -0400 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]:36392) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fmwsm-0005W6-Bz; Tue, 07 Aug 2018 03:58:20 -0400 Received: by mail-pl0-x242.google.com with SMTP id e11-v6so6783317plb.3; Tue, 07 Aug 2018 00:58:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=u8DAb17wNI/xayU+USr02m8Zx4LCPxglib3dKDzYGdw=; b=pdAUsIzpd/NthsyolVXQY3oTMo/9S+AcPZHBzyvU11MNU3fvU5JDHjimjiiiMDMbIt eSOotaAWt/bSR1ZCzp5TwVbSbqUeo8uq0CXtHI3/DE1ev1bVgCiTu9yUobnldLsFbgGi H0lkW4hxqMidVOIbaHfY/zgylHU4PAl9hr8gNi+IFSTifO5MYnFoADp/1LvBv+LmP7fN hNuiNKRhJp808ybyg6GPhuXCjmo591LhY/J/UCUMYB+Q7OdHsHTAGZnPobb4Z4QF6xrS KfG3uIPr+B1UNQrCA53F63KQsODIbvJLLBObC1iGkkU+goHZF69v6RLBw1O1rmr45ukg eJqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=u8DAb17wNI/xayU+USr02m8Zx4LCPxglib3dKDzYGdw=; b=iPEdZDtd2hpcwvoWp0Z06zboS/PHvfemagq6NdOaJ6lKCZ7eAjsloBOSYdhqJ5YQOh /3rt53Icl5mJTtA3TEm9evbvXxmVT1HiZptLkI6vIp8Tn5EVTH+Q0gkxW8ZfstsPIAnP 1Tl5HIenjcJUPd1Sv4nD1zqNuS+Nzs2fyh/ezZK7EWf4wBIG1LXM4u1S31XcfPMWrsng 4hThTgdgb6Wz5ZL/dJ8p9N4NWNLQa8K9Txib4z9BUhJie6XexQ1ZYOSL4ptaMvsca8p7 5XsV3RezpIHuAj5HocJq1bbEGaNwkwXhGWxs4F79RjfPcOMgk/aEDjtTOGRDDKqQq5Qq R+6g== X-Gm-Message-State: AOUpUlFJBVJ3OAfYFb5bmDd1FxCaRmDc78OsDLKS3QF7FPgQCVFbXov3 wOg1GzCl+lKw/grFFSg48HY= X-Google-Smtp-Source: AAOMgpdIuwQX5fBQ9dL9E92E5YqUvgpZxU4NxCarLolsKQg5ZNToIE8FPRuGEMLBr3iSxJzvRB8ZOQ== X-Received: by 2002:a17:902:b08a:: with SMTP id p10-v6mr16608034plr.217.1533628699315; Tue, 07 Aug 2018 00:58:19 -0700 (PDT) Received: from aurora.jms.id.au ([45.124.203.18]) by smtp.gmail.com with ESMTPSA id l85-v6sm1726016pfk.34.2018.08.07.00.58.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Aug 2018 00:58:18 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Tue, 07 Aug 2018 17:28:12 +0930 From: Joel Stanley To: Peter Maydell , =?utf-8?q?C=C3=A9dric_Le_Goate?= =?utf-8?q?r?= Date: Tue, 7 Aug 2018 17:27:52 +0930 Message-Id: <20180807075757.7242-3-joel@jms.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180807075757.7242-1-joel@jms.id.au> References: <20180807075757.7242-1-joel@jms.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::242 Subject: [Qemu-devel] [PATCH 2/7] aspeed_sdmc: Fix saved values X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This fixes the intended protection of read-only values in the configuration register. They were being always set to zero by mistake. The read-only fields depend on the configured memory size of the system, so they cannot be fixed at compile time. The most straight forward option was to store them in the state structure. Signed-off-by: Joel Stanley Reviewed-by: Cédric Le Goater --- hw/misc/aspeed_sdmc.c | 27 ++++++++------------------- include/hw/misc/aspeed_sdmc.h | 1 + 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c index 0df008e52a18..24fd4aee2d82 100644 --- a/hw/misc/aspeed_sdmc.c +++ b/hw/misc/aspeed_sdmc.c @@ -126,10 +126,12 @@ static void aspeed_sdmc_write(void *opaque, hwaddr addr, uint64_t data, case AST2400_A0_SILICON_REV: case AST2400_A1_SILICON_REV: data &= ~ASPEED_SDMC_READONLY_MASK; + data |= s->fixed_conf; break; case AST2500_A0_SILICON_REV: case AST2500_A1_SILICON_REV: data &= ~ASPEED_SDMC_AST2500_READONLY_MASK; + data |= s->fixed_conf; break; default: g_assert_not_reached(); @@ -198,25 +200,7 @@ static void aspeed_sdmc_reset(DeviceState *dev) memset(s->regs, 0, sizeof(s->regs)); /* Set ram size bit and defaults values */ - switch (s->silicon_rev) { - case AST2400_A0_SILICON_REV: - case AST2400_A1_SILICON_REV: - s->regs[R_CONF] |= - ASPEED_SDMC_VGA_COMPAT | - ASPEED_SDMC_DRAM_SIZE(s->ram_bits); - break; - - case AST2500_A0_SILICON_REV: - case AST2500_A1_SILICON_REV: - s->regs[R_CONF] |= - ASPEED_SDMC_HW_VERSION(1) | - ASPEED_SDMC_VGA_APERTURE(ASPEED_SDMC_VGA_64MB) | - ASPEED_SDMC_DRAM_SIZE(s->ram_bits); - break; - - default: - g_assert_not_reached(); - } + s->regs[R_CONF] = s->fixed_conf; } static void aspeed_sdmc_realize(DeviceState *dev, Error **errp) @@ -234,10 +218,15 @@ static void aspeed_sdmc_realize(DeviceState *dev, Error **errp) case AST2400_A0_SILICON_REV: case AST2400_A1_SILICON_REV: s->ram_bits = ast2400_rambits(s); + s->fixed_conf = ASPEED_SDMC_VGA_COMPAT | + ASPEED_SDMC_DRAM_SIZE(s->ram_bits); break; case AST2500_A0_SILICON_REV: case AST2500_A1_SILICON_REV: s->ram_bits = ast2500_rambits(s); + s->fixed_conf = ASPEED_SDMC_HW_VERSION(1) | + ASPEED_SDMC_VGA_APERTURE(ASPEED_SDMC_VGA_64MB) | + ASPEED_SDMC_DRAM_SIZE(s->ram_bits); break; default: g_assert_not_reached(); diff --git a/include/hw/misc/aspeed_sdmc.h b/include/hw/misc/aspeed_sdmc.h index 682f0f5d56dc..e079c66a7d73 100644 --- a/include/hw/misc/aspeed_sdmc.h +++ b/include/hw/misc/aspeed_sdmc.h @@ -27,6 +27,7 @@ typedef struct AspeedSDMCState { uint32_t silicon_rev; uint32_t ram_bits; uint64_t ram_size; + uint32_t fixed_conf; } AspeedSDMCState; From patchwork Tue Aug 7 07:57:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 10558303 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5B044157D for ; Tue, 7 Aug 2018 08:02:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C91A2983D for ; Tue, 7 Aug 2018 08:02:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4042D29B3B; Tue, 7 Aug 2018 08:02:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B8E712983D for ; Tue, 7 Aug 2018 08:02:23 +0000 (UTC) Received: from localhost ([::1]:37828 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmwwg-0005t8-VN for patchwork-qemu-devel@patchwork.kernel.org; Tue, 07 Aug 2018 04:02:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmwt3-0002m8-30 for qemu-devel@nongnu.org; Tue, 07 Aug 2018 03:58:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fmwsy-0005ZN-85 for qemu-devel@nongnu.org; Tue, 07 Aug 2018 03:58:37 -0400 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]:38402) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fmwst-0005Xa-TT; Tue, 07 Aug 2018 03:58:28 -0400 Received: by mail-pl0-x242.google.com with SMTP id u11-v6so6777552plq.5; Tue, 07 Aug 2018 00:58:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=IwxgDWYwXXaZerE0XDTDwsloGi00V2OC1UcWga4a5gM=; b=lhkKUzoNTYy+pvdb/wqFZzoHgaNzpvjeBhP912q+kEd79EDjdpRxRaWp9AWPAJtnFK a5hKXzpZTdprf8ZoSozMrzTWge1c9zmXoNIncJ9V2OlXVPpT3zTu8+PSJ+4GNg8DvM4A sxYWj5iH5YduCNRI+G3IV3ctV6rA8EW1+hcTiPbj74RVD94BBd0QTWwKei7w4iWNt68E i0E26Wkx9LpBKb3O3btnI4ctfXHK6hr6B6n0kjp/TWSGGF03B2AKRKISzznNxDUgX/Gn m0Xzvd4ipI5vbEpl3xxfJIAZZyavNFJoDfQ99OKZsxzRDO1BcR3Wsq1YZaYj9oQFNFsm lICA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=IwxgDWYwXXaZerE0XDTDwsloGi00V2OC1UcWga4a5gM=; b=s1oq+qdGMNDO1izsOPQpp1C2F9oCnzVGUzIWRsGGGfBfVOe8w0oNdWnVT69eU0p0uD NVZReK+8+Mk8rZHRUfmPbjfBJg5e4fOuiOiib4dfF34YA/JJaVUcOuGzR0XCXXySPz5N asR6OVbe6lH9tyfQZOlbnpbI93DIr1u6QG9JqbaLmIvjTLRRbSc3QmPYL3M6GOVskRFp vMfUxNa9vlUpi+IDp0Nk8GfX4VGqsJHJ+N1BeZMJHC7HjAMZFWtJ/KT3vjJHuLsLRtAx 56NgDtapF4RssppisC+TtmqM+FRjxEEje9qrTU8zVm49FzSQVn7iH/xZzwgpiJUWRa7X aXDA== X-Gm-Message-State: AOUpUlE+B7vgBqzDE7Bfuyr3SuTTB/cx7iAaDFVaM8J+qVBP7OIyWlGO q/LU2BN7iJTf3AzZutDwtIg= X-Google-Smtp-Source: AAOMgpc7uNvFdzvJdNbSugL+c52wklJoGu4tqdMyMeOaXi9kxUgZl44/iOtWOF6sQXPnUuJmmkpwNA== X-Received: by 2002:a17:902:d706:: with SMTP id w6-v6mr16747940ply.158.1533628706942; Tue, 07 Aug 2018 00:58:26 -0700 (PDT) Received: from aurora.jms.id.au ([45.124.203.18]) by smtp.gmail.com with ESMTPSA id a191-v6sm991550pge.45.2018.08.07.00.58.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Aug 2018 00:58:26 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Tue, 07 Aug 2018 17:28:19 +0930 From: Joel Stanley To: Peter Maydell , =?utf-8?q?C=C3=A9dric_Le_Goate?= =?utf-8?q?r?= Date: Tue, 7 Aug 2018 17:27:53 +0930 Message-Id: <20180807075757.7242-4-joel@jms.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180807075757.7242-1-joel@jms.id.au> References: <20180807075757.7242-1-joel@jms.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::242 Subject: [Qemu-devel] [PATCH 3/7] aspeed_sdmc: Set 'cache initial sequence' always true X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The SDRAM training routine sets the 'Enable cache initial' bit, and then waits for the 'cache initial sequence' to be done. Have it always return done, as there is no other side effects that the model needs to implement. This allows the upstream u-boot training to proceed on the ast2500-evb board. Signed-off-by: Joel Stanley Reviewed-by: Cédric Le Goater --- hw/misc/aspeed_sdmc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c index 24fd4aee2d82..9ece545c4ffa 100644 --- a/hw/misc/aspeed_sdmc.c +++ b/hw/misc/aspeed_sdmc.c @@ -226,6 +226,7 @@ static void aspeed_sdmc_realize(DeviceState *dev, Error **errp) s->ram_bits = ast2500_rambits(s); s->fixed_conf = ASPEED_SDMC_HW_VERSION(1) | ASPEED_SDMC_VGA_APERTURE(ASPEED_SDMC_VGA_64MB) | + ASPEED_SDMC_CACHE_INITIAL_DONE | ASPEED_SDMC_DRAM_SIZE(s->ram_bits); break; default: From patchwork Tue Aug 7 07:57:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 10558301 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 51C0F13B4 for ; Tue, 7 Aug 2018 08:00:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 443E229B26 for ; Tue, 7 Aug 2018 08:00:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4244D29B79; Tue, 7 Aug 2018 08:00:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B0CDE29B7E for ; Tue, 7 Aug 2018 08:00:18 +0000 (UTC) Received: from localhost ([::1]:37806 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmwuf-00035k-U9 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 07 Aug 2018 04:00:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmwt5-0002nE-RT for qemu-devel@nongnu.org; Tue, 07 Aug 2018 03:58:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fmwt4-0005ba-Tg for qemu-devel@nongnu.org; Tue, 07 Aug 2018 03:58:39 -0400 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]:37619) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fmwt1-0005aC-50; Tue, 07 Aug 2018 03:58:35 -0400 Received: by mail-pl0-x243.google.com with SMTP id d5-v6so6783996pll.4; Tue, 07 Aug 2018 00:58:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=SBBr+2QFo4lDT8xlNJTzO+Id2utX2pJW4S/v1I9pHbU=; b=THNI6DW+E2zggu0rxmhQ5+KS61Aoyvujj7lkMguUKtDQTc+Y/nki92f4U4d5rp558U qqVysxUqoQv72z4k2KsVcJ2v8LWwy+CP/UEssn7GwxiSpvHqx775TZWDBWf0FWBz2EKC KqRodvSCwhCNlP0hzWXfZgaMEwVzwcdHWQAZtHXwUASJtY4Angxt5929n1uXmh+DNfxT B80FtZqDkHY/UMg71JWkNq5X65rkyE7jSmwHBZE4L2oB6WAJvU7C82EyCwOuZKPhCw2C ZTF08nICFAauQVGLXfvtFLzSSN6tBc+n5ud7mB4nGs+QwrMoK0CHERCzrfn0tDDqrbx9 Xvsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=SBBr+2QFo4lDT8xlNJTzO+Id2utX2pJW4S/v1I9pHbU=; b=Uf1heWzT6P5rux13DWVbXer+VNx6hSCDg8urf+HFJCZJGFLqX9FvmPy6mLOFZH+J36 Q0ifq3y+kqKj3+yTYUEYxdlYPsw40dY48Sl36HXA0rHs0oXX4OW8QxooBdombrr+b8GZ 3RrXokBN9Vuo0pjqrJpX5tntaXJhrDz1jkqFQyg9DmUANaLbG46jhR22Qjx/h6gQ18HN fVGDDfHLKP9RCMckOhw12Xl1ycXFH2/FxaoP//vjvcuGrUNb3/SvQLFXvOIQ8u3F163V +Kb7mP5MkNRK0fFT9hMXXpZQkAzBSd9FNpiJDtZ6zW8ubdTtO5uXnbFPBSDqyd8WvzVQ HcqA== X-Gm-Message-State: AOUpUlHMh5FTaPdh41l/ECM8WGS2Vh5F4kiXTKmwoosQ8fa0795K+6sQ BvQEiRwsZDK7KpsHL2Npg4UkKptd X-Google-Smtp-Source: AAOMgpeivoal9HQAdQfzCXyUhQIs4L3V/iPSLLDJKuGCn6S4YXA52E6+GwaS4EKbEJ1PJiDQBRSZgg== X-Received: by 2002:a17:902:e005:: with SMTP id ca5-v6mr16848285plb.224.1533628714139; Tue, 07 Aug 2018 00:58:34 -0700 (PDT) Received: from aurora.jms.id.au ([45.124.203.18]) by smtp.gmail.com with ESMTPSA id d191-v6sm1458902pfg.172.2018.08.07.00.58.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Aug 2018 00:58:33 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Tue, 07 Aug 2018 17:28:27 +0930 From: Joel Stanley To: Peter Maydell , =?utf-8?q?C=C3=A9dric_Le_Goate?= =?utf-8?q?r?= Date: Tue, 7 Aug 2018 17:27:54 +0930 Message-Id: <20180807075757.7242-5-joel@jms.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180807075757.7242-1-joel@jms.id.au> References: <20180807075757.7242-1-joel@jms.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::243 Subject: [Qemu-devel] [PATCH 4/7] aspeed_sdmc: Init status alwlays idle X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The ast2500 SDRAM training routine busy waits on the 'init cycle busy state' bit in DDR PHY Control/Status register #1 (MCR60). This ensures the bit always reads zero, and allows training to complete with upstream u-boot on the ast2500-evb. Signed-off-by: Joel Stanley Reviewed-by: Cédric Le Goater --- hw/misc/aspeed_sdmc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c index 9ece545c4ffa..522e01ef8c0d 100644 --- a/hw/misc/aspeed_sdmc.c +++ b/hw/misc/aspeed_sdmc.c @@ -23,6 +23,10 @@ /* Configuration Register */ #define R_CONF (0x04 / 4) +/* Control/Status Register #1 (ast2500) */ +#define R_STATUS1 (0x60 / 4) +#define PHY_BUSY_STATE BIT(0) + /* * Configuration register Ox4 (for Aspeed AST2400 SOC) * @@ -137,6 +141,17 @@ static void aspeed_sdmc_write(void *opaque, hwaddr addr, uint64_t data, g_assert_not_reached(); } } + if (s->silicon_rev == AST2500_A0_SILICON_REV || + s->silicon_rev == AST2500_A1_SILICON_REV) { + switch (addr) { + case R_STATUS1: + /* Will never return 'busy' */ + data &= ~PHY_BUSY_STATE; + break; + default: + break; + } + } s->regs[addr] = data; } From patchwork Tue Aug 7 07:57:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 10558319 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A6CE13B4 for ; Tue, 7 Aug 2018 08:05:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D4B72970C for ; Tue, 7 Aug 2018 08:05:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 816A42973C; Tue, 7 Aug 2018 08:05:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 087452970C for ; Tue, 7 Aug 2018 08:05:02 +0000 (UTC) Received: from localhost ([::1]:37839 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmwzF-0007q0-Pe for patchwork-qemu-devel@patchwork.kernel.org; Tue, 07 Aug 2018 04:05:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60817) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmwtI-0002xl-58 for qemu-devel@nongnu.org; Tue, 07 Aug 2018 03:58:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fmwtH-0005fG-Fz for qemu-devel@nongnu.org; Tue, 07 Aug 2018 03:58:52 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:41901) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fmwt8-0005cC-Fg; Tue, 07 Aug 2018 03:58:42 -0400 Received: by mail-pg1-x541.google.com with SMTP id z8-v6so7449794pgu.8; Tue, 07 Aug 2018 00:58:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=EllvPOZEw1edECiX0N9er7aLKQoz9Nd8QHRRtVYO/4I=; b=PBgjlK9tEXncFLetaov1pBs837YkSAhe6YcyF6pG/SDh07cuRtsu8tEdyn7HFYvvJJ FDCc+AHzHRS9/mm0JLn2eiD3wbTgTbZQ4bIUuQAHZbADnv4sBsgFajyPbq+0AArKCzIH 5xXJYDbydHZljKfZfhXyNwoGdRL5w3RkqvaWNgLVtjde8WA86riBcFRkrFLXQ26XKXxe wuWRgG1PzW24jxtVO2gkl98eFJipUe7G2AILvo6zcejjfZkDSexjDrEtcN1oMjx10YvU 4WRTsmEVy3Hh90NHHRuxrXNvYGZ7nSJTctmGsw5WWB04Bklsvspulan/7Ie9NnCGkiEp ImIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=EllvPOZEw1edECiX0N9er7aLKQoz9Nd8QHRRtVYO/4I=; b=tIWL/+9F81WtUfzg+zOpr0jwPgAhOnTJuhUWorB3XyImayGqRTOb9/EeAYjUAj54SZ +wZaPoFfN1ciTnkoJnfrAnYhumyh4c80qrG1R4qkHm4Y91nZUbKg4oBfFjxjWRFupK69 IrAZ9sCmLttNwR+C18lcVEB4dYFVi9XBNJ1TaKpxGjHO1zOUf2lJgABDHKWvJ5+tt7VS Zn2d8iLmjjrZuAX7a6DZ0oSzsY0gyPDM+/7VGQb+QBuJ6kOXPdfnSCi29uNOBN4qgpj8 7odZ6Cm8r6mEDQmcP+ZgmoCcH/WzMrfp9z5+RZ/p2CtL2lNK8p5M22+Z9uF2qvg5dl6Z rycg== X-Gm-Message-State: AOUpUlGDfT3TILd4er5Re7lXFfUHABjSGfOEGaJUvZJ5kyEz60gNxvwh kz20yjGMU13SNGEEDf5DEF0Az9RM X-Google-Smtp-Source: AAOMgpe2UPXTHw5Nnds+N1esCKnFyY8Eb8YG/pVSmGoFtDiiSvYEx8OayGRs/R/+i/+/w1Ux/NEcPw== X-Received: by 2002:a62:225d:: with SMTP id i90-v6mr20373221pfi.246.1533628721376; Tue, 07 Aug 2018 00:58:41 -0700 (PDT) Received: from aurora.jms.id.au ([45.124.203.18]) by smtp.gmail.com with ESMTPSA id d191-v6sm1459491pfg.172.2018.08.07.00.58.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Aug 2018 00:58:40 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Tue, 07 Aug 2018 17:28:34 +0930 From: Joel Stanley To: Peter Maydell , =?utf-8?q?C=C3=A9dric_Le_Goate?= =?utf-8?q?r?= Date: Tue, 7 Aug 2018 17:27:55 +0930 Message-Id: <20180807075757.7242-6-joel@jms.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180807075757.7242-1-joel@jms.id.au> References: <20180807075757.7242-1-joel@jms.id.au> 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 5/7] aspeed_sdmc: Handle ECC training X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This is required to ensure u-boot SDRAM training completes. Signed-off-by: Joel Stanley Reviewed-by: Cédric Le Goater --- hw/misc/aspeed_sdmc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c index 522e01ef8c0d..89de3138aff0 100644 --- a/hw/misc/aspeed_sdmc.c +++ b/hw/misc/aspeed_sdmc.c @@ -27,6 +27,10 @@ #define R_STATUS1 (0x60 / 4) #define PHY_BUSY_STATE BIT(0) +#define R_ECC_TEST_CTRL (0x70 / 4) +#define ECC_TEST_FINISHED BIT(12) +#define ECC_TEST_FAIL BIT(13) + /* * Configuration register Ox4 (for Aspeed AST2400 SOC) * @@ -148,6 +152,11 @@ static void aspeed_sdmc_write(void *opaque, hwaddr addr, uint64_t data, /* Will never return 'busy' */ data &= ~PHY_BUSY_STATE; break; + case R_ECC_TEST_CTRL: + /* Always done, always happy */ + data |= ECC_TEST_FINISHED; + data &= ~ECC_TEST_FAIL; + break; default: break; } From patchwork Tue Aug 7 07:57:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 10558321 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C5240157D for ; Tue, 7 Aug 2018 08:05:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B74332970C for ; Tue, 7 Aug 2018 08:05:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB8BF29722; Tue, 7 Aug 2018 08:05:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1F3C62975C for ; Tue, 7 Aug 2018 08:05:03 +0000 (UTC) Received: from localhost ([::1]:37837 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmwzG-0006k9-CT for patchwork-qemu-devel@patchwork.kernel.org; Tue, 07 Aug 2018 04:05:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60830) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmwtJ-0002zC-KA for qemu-devel@nongnu.org; Tue, 07 Aug 2018 03:58:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fmwtI-0005fZ-HQ for qemu-devel@nongnu.org; Tue, 07 Aug 2018 03:58:53 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:36318) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fmwtF-0005dP-OS; Tue, 07 Aug 2018 03:58:49 -0400 Received: by mail-pf1-x42e.google.com with SMTP id b11-v6so8178244pfo.3; Tue, 07 Aug 2018 00:58:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LVUzio99dOgvDQkTMW0Kz3gBweM4FRQz7uPSMwwQ3js=; b=CaSHPtwtaGGEAp0BSGGPBJaX2m1kZzKnJcv2pUDVcX7bT5Ax/YkclkU881jmW1hwrV jig3Jg0DOkR5YxYiAmA8Cl3tomiBCVLhEEdM/WLIzzjcCelJ/yDGdrCylSDTP6+dSAu7 L4bOkdm/SNfUoMzBVoAHxX6gFDsHunSSHDne4w8psO3SKuj5oaglc+rIvFeQj3veyuQw 5722slHCV+d7oJIJQ4Wj6zk48Mlk0ZunvXGaK+1yO1prDFjUJNphETCZyLu9BtPV5DVI r9VLcPq5e9PAEpFT1+/ecdPBd5Y4Pe+2FLYpHQPPuoTwEzNFNstpJfFQ7dxB+uCRHCl7 RQ+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=LVUzio99dOgvDQkTMW0Kz3gBweM4FRQz7uPSMwwQ3js=; b=AqFqOytGKLrIEHE0++sip++MLGog2BeV0woc1qLprU7qihdDPAoK2FP3vQO1fAUBiG I1iOET9xPYRWWoTdO5N/ZIEplLg9DjkYg7P7hGuh+TwMseNVnzIKj0JmYxMwvKOEJtyW MwseiZYL9Ts1Zs61xWF3Ld+64fNBDrn5SLpGWaobKLn2XKnuc1i+p3zuiL2ojNcRqgUH vkXvcNY85QhkK47ozwCtNMDgL+wy1j3nwIDRxBgXA7870KLx3gNlkpUkFPBgr4U/1VXd X3Jt6Pfdi4U5+NDH6xaFcHFBeFEJZTwgguoL/h1uMar2IrNJIP+ATb+YeAAn7D1w+vqi fUwA== X-Gm-Message-State: AOUpUlE33qwocp8tXTEgHtH+NQ4oZpDVhb68suz3I+N28NmOXghAfVIh PmkEj3ZC06rKK4iMmJEKLHw= X-Google-Smtp-Source: AAOMgpchqaZki8bsEnL4cwhIEUSAaBrR1rnih+km6a6zIN6WS0kCsoMT8M8wqGhkpeVVqkA0QYYKOA== X-Received: by 2002:a63:e255:: with SMTP id y21-v6mr17549346pgj.160.1533628728684; Tue, 07 Aug 2018 00:58:48 -0700 (PDT) Received: from aurora.jms.id.au ([45.124.203.18]) by smtp.gmail.com with ESMTPSA id 16-v6sm1550863pfo.164.2018.08.07.00.58.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Aug 2018 00:58:47 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Tue, 07 Aug 2018 17:28:41 +0930 From: Joel Stanley To: Peter Maydell , =?utf-8?q?C=C3=A9dric_Le_Goate?= =?utf-8?q?r?= Date: Tue, 7 Aug 2018 17:27:56 +0930 Message-Id: <20180807075757.7242-7-joel@jms.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180807075757.7242-1-joel@jms.id.au> References: <20180807075757.7242-1-joel@jms.id.au> 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::42e Subject: [Qemu-devel] [PATCH 6/7] aspeed: add a max_ram_size property to the memory controller X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Cédric Le Goater This will be used to construct a memory region beyond the RAM region to let firmwares scan the address space with load/store to guess how much RAM the SoC has. Signed-off-by: Cédric Le Goater Signed-off-by: Joel Stanley --- hw/arm/aspeed.c | 31 +++++++++++++++++++++++++++++++ hw/arm/aspeed_soc.c | 2 ++ hw/misc/aspeed_sdmc.c | 3 +++ include/hw/misc/aspeed_sdmc.h | 1 + 4 files changed, 37 insertions(+) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index bb9d33848d3f..e078269266bc 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -31,6 +31,7 @@ static struct arm_boot_info aspeed_board_binfo = { typedef struct AspeedBoardState { AspeedSoCState soc; MemoryRegion ram; + MemoryRegion max_ram; } AspeedBoardState; typedef struct AspeedBoardConfig { @@ -127,6 +128,27 @@ static const AspeedBoardConfig aspeed_boards[] = { }, }; +/* + * The max ram region is for firmwares that scan the address space + * with load/store to guess how much RAM the SoC has. + */ +static uint64_t max_ram_read(void *opaque, hwaddr offset, unsigned size) +{ + return 0; +} + +static void max_ram_write(void *opaque, hwaddr offset, uint64_t value, + unsigned size) +{ + /* Disacard writes */ +} + +static const MemoryRegionOps max_ram_ops = { + .read = max_ram_read, + .write = max_ram_write, + .endianness = DEVICE_NATIVE_ENDIAN, +}; + #define FIRMWARE_ADDR 0x0 static void write_boot_rom(DriveInfo *dinfo, hwaddr addr, size_t rom_size, @@ -187,6 +209,7 @@ static void aspeed_board_init(MachineState *machine, AspeedBoardState *bmc; AspeedSoCClass *sc; DriveInfo *drive0 = drive_get(IF_MTD, 0, 0); + ram_addr_t max_ram_size; bmc = g_new0(AspeedBoardState, 1); object_initialize(&bmc->soc, (sizeof(bmc->soc)), cfg->soc_name); @@ -226,6 +249,14 @@ static void aspeed_board_init(MachineState *machine, object_property_add_const_link(OBJECT(&bmc->soc), "ram", OBJECT(&bmc->ram), &error_abort); + max_ram_size = object_property_get_uint(OBJECT(&bmc->soc), "max-ram-size", + &error_abort); + memory_region_init_io(&bmc->max_ram, NULL, &max_ram_ops, NULL, + "max_ram", max_ram_size - ram_size); + memory_region_add_subregion(get_system_memory(), + sc->info->sdram_base + ram_size, + &bmc->max_ram); + aspeed_board_init_flashes(&bmc->soc.fmc, cfg->fmc_model, &error_abort); aspeed_board_init_flashes(&bmc->soc.spi[0], cfg->spi_model, &error_abort); diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c index e68911af0f90..a27233d4876b 100644 --- a/hw/arm/aspeed_soc.c +++ b/hw/arm/aspeed_soc.c @@ -155,6 +155,8 @@ static void aspeed_soc_init(Object *obj) sc->info->silicon_rev); object_property_add_alias(obj, "ram-size", OBJECT(&s->sdmc), "ram-size", &error_abort); + object_property_add_alias(obj, "max-ram-size", OBJECT(&s->sdmc), + "max-ram-size", &error_abort); for (i = 0; i < sc->info->wdts_num; i++) { object_initialize(&s->wdt[i], sizeof(s->wdt[i]), TYPE_ASPEED_WDT); diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c index 89de3138aff0..eec77f243508 100644 --- a/hw/misc/aspeed_sdmc.c +++ b/hw/misc/aspeed_sdmc.c @@ -242,12 +242,14 @@ static void aspeed_sdmc_realize(DeviceState *dev, Error **errp) case AST2400_A0_SILICON_REV: case AST2400_A1_SILICON_REV: s->ram_bits = ast2400_rambits(s); + s->max_ram_size = 512 << 20; s->fixed_conf = ASPEED_SDMC_VGA_COMPAT | ASPEED_SDMC_DRAM_SIZE(s->ram_bits); break; case AST2500_A0_SILICON_REV: case AST2500_A1_SILICON_REV: s->ram_bits = ast2500_rambits(s); + s->max_ram_size = 1024 << 20; s->fixed_conf = ASPEED_SDMC_HW_VERSION(1) | ASPEED_SDMC_VGA_APERTURE(ASPEED_SDMC_VGA_64MB) | ASPEED_SDMC_CACHE_INITIAL_DONE | @@ -275,6 +277,7 @@ static const VMStateDescription vmstate_aspeed_sdmc = { static Property aspeed_sdmc_properties[] = { DEFINE_PROP_UINT32("silicon-rev", AspeedSDMCState, silicon_rev, 0), DEFINE_PROP_UINT64("ram-size", AspeedSDMCState, ram_size, 0), + DEFINE_PROP_UINT64("max-ram-size", AspeedSDMCState, max_ram_size, 0), DEFINE_PROP_END_OF_LIST(), }; diff --git a/include/hw/misc/aspeed_sdmc.h b/include/hw/misc/aspeed_sdmc.h index e079c66a7d73..b3c926acae90 100644 --- a/include/hw/misc/aspeed_sdmc.h +++ b/include/hw/misc/aspeed_sdmc.h @@ -27,6 +27,7 @@ typedef struct AspeedSDMCState { uint32_t silicon_rev; uint32_t ram_bits; uint64_t ram_size; + uint64_t max_ram_size; uint32_t fixed_conf; } AspeedSDMCState; From patchwork Tue Aug 7 07:57:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 10558343 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 56E85157D for ; Tue, 7 Aug 2018 08:07:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 485E429098 for ; Tue, 7 Aug 2018 08:07:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BE4A2973C; Tue, 7 Aug 2018 08:07:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CEF6129098 for ; Tue, 7 Aug 2018 08:07:09 +0000 (UTC) Received: from localhost ([::1]:37855 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmx1J-0001EP-3k for patchwork-qemu-devel@patchwork.kernel.org; Tue, 07 Aug 2018 04:07:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60881) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmwtU-00037W-6R for qemu-devel@nongnu.org; Tue, 07 Aug 2018 03:59:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fmwtT-0005iM-97 for qemu-devel@nongnu.org; Tue, 07 Aug 2018 03:59:04 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:38680) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fmwtM-0005gZ-Rg; Tue, 07 Aug 2018 03:58:56 -0400 Received: by mail-pf1-x441.google.com with SMTP id x17-v6so8177215pfh.5; Tue, 07 Aug 2018 00:58:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=3RtZ/h1iBSZFLfoCfLXbdQ+HU5csM0CuyQNEFOBPc6o=; b=thV71t9bcbv9TbqM3oF2alcsBU5GRiVmj+M4pFZEt5DUCuI2rn5/cV49rBOnsOlSZU 1X8PQnhGwgVB9/93LouJBcx9DztKiWIs0dZtqDBedHrT63bQ4ifL2508hD/pat8oO5Dl HF1Kzco+kRhZDdtzTJO5do2hXz0n61ZU6Q3sQqXaBWnp4nT/jotEX830KW9/YM+klbL0 1HM+AICJ+ChuSIqnL13ODFlc7mkl4cG2MQ6GcK8VRosy9vy/cJELXMXTUnLJxhBP3+pa jSiC1w2BBrrEZwA30qoqYXY7ht20hnZhVeu90zOzuW9Bsqb+RT2Vu1y/KAK4PPtKBjOw m3Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=3RtZ/h1iBSZFLfoCfLXbdQ+HU5csM0CuyQNEFOBPc6o=; b=gPqlwCZfTS6fFDgL0A+ONBfX3ctbsTs/gV37dJytrjJl2JwhnDnWq0udLRFWZTg+Ob O+Fc9Ub73H9NtTAHbg0996eJf1ir1ltzvQstHNlbA+C+KMXNy3MtDqn0qBeaGksF3cQY y5yYCKGyP4uCLfZ+qGgDNRPkXTBtKRu2Dzr9p+0E8nE8TAyjWySeba2zlP2fwDk7yxx2 KYrbDn4esDCdakE0Ct4ow0LyU6Wx/hQMp4/5tUk0AQgVjVe0MGEiUVDZQypZi0csJNCh TxXHZwffXoQZDlaSMUtUUhOcHrPICFKFg14Ny1n3tOAGYapdxu/nenqsJ31v0L4KAkOl Wgzg== X-Gm-Message-State: AOUpUlEwWDuBZ8GJQVMggZaT90k59ZUXb+2gNCedl0YvLxY2ushwFOsA xUDgp/hrL5LUUhqjNwBVEJE= X-Google-Smtp-Source: AAOMgpfmTgMg/wcDYx4LMW/62bllf/CjimGwyGefXe618W6+I7jfmJ1rNZATNkL6Mseu/CX6xk1zsg== X-Received: by 2002:a62:93d4:: with SMTP id r81-v6mr20486890pfk.55.1533628735770; Tue, 07 Aug 2018 00:58:55 -0700 (PDT) Received: from aurora.jms.id.au ([45.124.203.18]) by smtp.gmail.com with ESMTPSA id p64-v6sm1421808pfa.47.2018.08.07.00.58.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Aug 2018 00:58:55 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Tue, 07 Aug 2018 17:28:49 +0930 From: Joel Stanley To: Peter Maydell , =?utf-8?q?C=C3=A9dric_Le_Goate?= =?utf-8?q?r?= Date: Tue, 7 Aug 2018 17:27:57 +0930 Message-Id: <20180807075757.7242-8-joel@jms.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180807075757.7242-1-joel@jms.id.au> References: <20180807075757.7242-1-joel@jms.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::441 Subject: [Qemu-devel] [PATCH 7/7] aspeed: Link SCU to the watchdog X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The ast2500 uses the watchdog to reset the SDRAM controller. This operation is usually performed by u-boot's memory training procedure, and it is enabled by setting a bit in the SCU and then causing the watchdog to expire. Therefore, we need the watchdog to be able to acess the SCU's register space. This does not cause a system reset, but only resets the SDRAM controller. Signed-off-by: Joel Stanley --- hw/arm/aspeed_soc.c | 2 ++ hw/watchdog/wdt_aspeed.c | 20 ++++++++++++++++++++ include/hw/watchdog/wdt_aspeed.h | 1 + 3 files changed, 23 insertions(+) diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c index a27233d4876b..2cbacb4430bb 100644 --- a/hw/arm/aspeed_soc.c +++ b/hw/arm/aspeed_soc.c @@ -164,6 +164,8 @@ static void aspeed_soc_init(Object *obj) qdev_set_parent_bus(DEVICE(&s->wdt[i]), sysbus_get_default()); qdev_prop_set_uint32(DEVICE(&s->wdt[i]), "silicon-rev", sc->info->silicon_rev); + object_property_add_const_link(OBJECT(&s->wdt[i]), "scu", + OBJECT(&s->scu), &error_abort); } object_initialize(&s->ftgmac100, sizeof(s->ftgmac100), TYPE_FTGMAC100); diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c index 95f6ad186d72..f5cb30c0b584 100644 --- a/hw/watchdog/wdt_aspeed.c +++ b/hw/watchdog/wdt_aspeed.c @@ -43,6 +43,9 @@ #define WDT_RESTART_MAGIC 0x4755 +#define SCU_RESET_CONTROL1 (0x04 / 4) +#define SCU_RESET_SDRAM BIT(0) + static bool aspeed_wdt_is_enabled(const AspeedWDTState *s) { return s->regs[WDT_CTRL] & WDT_CTRL_ENABLE; @@ -221,6 +224,13 @@ static void aspeed_wdt_timer_expired(void *dev) { AspeedWDTState *s = ASPEED_WDT(dev); + /* Do not reset on SDRAM controller reset */ + if (s->scu->regs[SCU_RESET_CONTROL1] & SCU_RESET_SDRAM) { + timer_del(s->timer); + s->regs[WDT_CTRL] = 0; + return; + } + qemu_log_mask(CPU_LOG_RESET, "Watchdog timer expired.\n"); watchdog_perform_action(); timer_del(s->timer); @@ -232,6 +242,16 @@ static void aspeed_wdt_realize(DeviceState *dev, Error **errp) { SysBusDevice *sbd = SYS_BUS_DEVICE(dev); AspeedWDTState *s = ASPEED_WDT(dev); + Error *err = NULL; + Object *obj; + + obj = object_property_get_link(OBJECT(dev), "scu", &err); + if (!obj) { + error_propagate(errp, err); + error_prepend(errp, "required link 'scu' not found: "); + return; + } + s->scu = ASPEED_SCU(obj); if (!is_supported_silicon_rev(s->silicon_rev)) { error_setg(errp, "Unknown silicon revision: 0x%" PRIx32, diff --git a/include/hw/watchdog/wdt_aspeed.h b/include/hw/watchdog/wdt_aspeed.h index 7de3e5c224fb..cc734bd7ae7b 100644 --- a/include/hw/watchdog/wdt_aspeed.h +++ b/include/hw/watchdog/wdt_aspeed.h @@ -26,6 +26,7 @@ typedef struct AspeedWDTState { MemoryRegion iomem; uint32_t regs[ASPEED_WDT_REGS_MAX]; + AspeedSCUState *scu; uint32_t pclk_freq; uint32_t silicon_rev; uint32_t ext_pulse_width_mask;