From patchwork Thu Dec 22 14:02:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Engraf X-Patchwork-Id: 88868 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp2822012qgi; Thu, 22 Dec 2016 06:04:21 -0800 (PST) X-Received: by 10.55.91.193 with SMTP id p184mr10033313qkb.301.1482415461704; Thu, 22 Dec 2016 06:04:21 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id r70si7545570qka.93.2016.12.22.06.04.21 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Dec 2016 06:04:21 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:34396 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cK3yn-0000wR-Cl for patch@linaro.org; Thu, 22 Dec 2016 09:04:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cK3xY-0000Wm-V4 for qemu-devel@nongnu.org; Thu, 22 Dec 2016 09:03:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cK3xY-0005LJ-70 for qemu-devel@nongnu.org; Thu, 22 Dec 2016 09:03:04 -0500 Received: from mail.sysgo.com ([176.9.12.79]:44114) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cK3xR-0005Ff-26; Thu, 22 Dec 2016 09:02:57 -0500 From: David Engraf To: peter.maydell@linaro.org, qemu-arm@nongnu.org Message-ID: Date: Thu, 22 Dec 2016 15:02:54 +0100 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 176.9.12.79 Subject: [Qemu-devel] [PATCH] vexpress fix flash device-width 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: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The current implementation uses width = 4 and device-width = 2 for the flash configuration. When using u-boot or Linux, the flash is detected as 32 x 16 bit, thus the sector size is doubled to 512 KB. When u-boot sends a sector erase, only the first 256 KB are erased because the QEMU flash implementation uses the configured sector size of 256 KB and ignores the width and device-width ratio. This patch will change device-width to 4, thus the width and device-width are equal and u-boot detects the flash as 32 x 32 bit with the correct sector size of 256 KB. - David Signed-off-by: line to say that you're happy to contribute the diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 58760f4..85ec347 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -526,7 +526,7 @@ static pflash_t *ve_pflash_cfi01_register(hwaddr base, const char *name, VEXPRESS_FLASH_SIZE / VEXPRESS_FLASH_SECT_SIZE); qdev_prop_set_uint64(dev, "sector-length", VEXPRESS_FLASH_SECT_SIZE); qdev_prop_set_uint8(dev, "width", 4); - qdev_prop_set_uint8(dev, "device-width", 2); + qdev_prop_set_uint8(dev, "device-width", 4); qdev_prop_set_bit(dev, "big-endian", false); qdev_prop_set_uint16(dev, "id0", 0x89); qdev_prop_set_uint16(dev, "id1", 0x18);