From patchwork Thu Dec 5 21:35:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 22097 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f69.google.com (mail-qe0-f69.google.com [209.85.128.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 075CE202E0 for ; Thu, 5 Dec 2013 21:36:17 +0000 (UTC) Received: by mail-qe0-f69.google.com with SMTP id 1sf34794909qec.4 for ; Thu, 05 Dec 2013 13:36:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=Do3UOec0unASUIRoL/cG4mVqWT0GhjKJciwejm28ndQ=; b=U5Itp1YOiIDlyXbHV4y7siG4MM1jAxM5qd6RcjC0xt3gbOdJIpbV3jSSgz3Rrpc6EU bSrW5vWZU1AvGX7z5xHa8FB/LtZQbXN4jrXM7mk7Qgd7EHD0ICBNciVer6AFSGsAwbVG K+1RlutVUJkbEVNtSUbvSbkCDer0l5dxp1UONqjx+HrFOjBX8u8/xZU9CKsTSMPNHGyL znc8Q3rVLA1gIa1Ws2ZU+JaOpgnwNTK87lf4R5adSH+ygPO8oQMdJRXK7QOCYKLw9rCi MTvzvIyMknFUaTLhwZQL2yas2+W4mDJi2RVN2SY4p1T36m6PRn7KVx4Emeo1pgNQe1mM 707A== X-Gm-Message-State: ALoCoQlKrcXGlxOARCqTf81IHyINHH1Y8xuBUy+zt2qUqNcrnGsf0g+ckbHeE70Ahh+KDyImlKfJ X-Received: by 10.236.111.73 with SMTP id v49mr14208yhg.46.1386279376846; Thu, 05 Dec 2013 13:36:16 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.127.175 with SMTP id nh15ls428612qeb.9.gmail; Thu, 05 Dec 2013 13:36:16 -0800 (PST) X-Received: by 10.52.72.49 with SMTP id a17mr79292vdv.20.1386279376723; Thu, 05 Dec 2013 13:36:16 -0800 (PST) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id bj1si35399233ved.78.2013.12.05.13.36.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Dec 2013 13:36:16 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id hv10so13563436vcb.36 for ; Thu, 05 Dec 2013 13:36:16 -0800 (PST) X-Received: by 10.220.74.69 with SMTP id t5mr88418vcj.18.1386279376464; Thu, 05 Dec 2013 13:36:16 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp49276vcz; Thu, 5 Dec 2013 13:36:16 -0800 (PST) X-Received: by 10.66.118.71 with SMTP id kk7mr249914pab.14.1386279375051; Thu, 05 Dec 2013 13:36:15 -0800 (PST) Received: from mail-pb0-f44.google.com (mail-pb0-f44.google.com [209.85.160.44]) by mx.google.com with ESMTPS id do3si53481236pbc.292.2013.12.05.13.36.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Dec 2013 13:36:15 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.44 is neither permitted nor denied by best guess record for domain of roy.franz@linaro.org) client-ip=209.85.160.44; Received: by mail-pb0-f44.google.com with SMTP id rq2so26854544pbb.3 for ; Thu, 05 Dec 2013 13:36:13 -0800 (PST) X-Received: by 10.68.170.225 with SMTP id ap1mr25089pbc.117.1386279373218; Thu, 05 Dec 2013 13:36:13 -0800 (PST) Received: from rfranz-i7.local (c-24-10-97-91.hsd1.ca.comcast.net. [24.10.97.91]) by mx.google.com with ESMTPSA id xv2sm146889377pbb.39.2013.12.05.13.36.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Dec 2013 13:36:12 -0800 (PST) From: Roy Franz To: qemu-devel@nongnu.org, peter.maydell@linaro.org, kwolf@redhat.com, stefanha@redhat.com Cc: patches@linaro.org, Roy Franz Subject: [PATCH V5 5/7] Add max device width parameter for NOR devices Date: Thu, 5 Dec 2013 13:35:57 -0800 Message-Id: <1386279359-32286-6-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386279359-32286-1-git-send-email-roy.franz@linaro.org> References: <1386279359-32286-1-git-send-email-roy.franz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: roy.franz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , For handling CFI and device ID reads, we need to not only know the width that a NOR flash device is configured for, but also its maximum width. The maximum width addressing mode is used for multi-width parts no matter which width they are configured for. The most common case is x16 parts that also support x8 mode. When configured for x8 operation these devices respond to CFI and device ID requests differently than native x8 NOR parts. Signed-off-by: Roy Franz --- hw/block/pflash_cfi01.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c index 82a2519..8f81341 100644 --- a/hw/block/pflash_cfi01.c +++ b/hw/block/pflash_cfi01.c @@ -74,6 +74,7 @@ struct pflash_t { uint64_t sector_len; uint8_t bank_width; uint8_t device_width; /* If 0, device width not specified. */ + uint8_t max_device_width; /* max device width in bytes */ uint8_t be; uint8_t wcycle; /* if 0, the flash is read normally */ int ro; @@ -635,6 +636,13 @@ static void pflash_cfi01_realize(DeviceState *dev, Error **errp) pfl->ro = 0; } + /* Default to devices being used at their maximum device width. This was + * assumed before the device_width support was added. + */ + if (!pfl->max_device_width) { + pfl->max_device_width = pfl->device_width; + } + pfl->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, pflash_timer, pfl); pfl->wcycle = 0; pfl->cmd = 0; @@ -730,6 +738,7 @@ static Property pflash_cfi01_properties[] = { DEFINE_PROP_UINT64("sector-length", struct pflash_t, sector_len, 0), DEFINE_PROP_UINT8("width", struct pflash_t, bank_width, 0), DEFINE_PROP_UINT8("device-width", struct pflash_t, device_width, 0), + DEFINE_PROP_UINT8("max-device-width", struct pflash_t, max_device_width, 0), DEFINE_PROP_UINT8("big-endian", struct pflash_t, be, 0), DEFINE_PROP_UINT16("id0", struct pflash_t, ident0, 0), DEFINE_PROP_UINT16("id1", struct pflash_t, ident1, 0),