From patchwork Mon Feb 22 08:03:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Krzeminski, Marcin (Nokia - PL/Wroclaw)" X-Patchwork-Id: 586053 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id CA33E1402D8 for ; Mon, 22 Feb 2016 19:07:19 +1100 (AEDT) Received: from localhost ([::1]:47582 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXlWX-0003uG-Qi for incoming@patchwork.ozlabs.org; Mon, 22 Feb 2016 03:07:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36006) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXlT3-00062w-6W for qemu-devel@nongnu.org; Mon, 22 Feb 2016 03:03:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXlT2-0007jB-Bq for qemu-devel@nongnu.org; Mon, 22 Feb 2016 03:03:41 -0500 Received: from demumfd001.nsn-inter.net ([93.183.12.32]:54401) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXlT2-0007j6-34 for qemu-devel@nongnu.org; Mon, 22 Feb 2016 03:03:40 -0500 Received: from demuprx016.emea.nsn-intra.net ([10.150.129.55]) by demumfd001.nsn-inter.net (8.15.2/8.15.2) with ESMTPS id u1M83VWP027210 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 22 Feb 2016 08:03:31 GMT Received: from CNU418C7XK.nsn-intra.net ([10.154.154.82]) by demuprx016.emea.nsn-intra.net (8.12.11.20060308/8.12.11) with ESMTP id u1M83QUo028432; Mon, 22 Feb 2016 09:03:30 +0100 From: marcin.krzeminski@nokia.com To: qemu-devel@nongnu.org Date: Mon, 22 Feb 2016 09:03:25 +0100 Message-Id: <1456128205-5092-12-git-send-email-marcin.krzeminski@nokia.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456128205-5092-1-git-send-email-marcin.krzeminski@nokia.com> References: <1456128205-5092-1-git-send-email-marcin.krzeminski@nokia.com> X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-size: 1249 X-purgate-ID: 151667::1456128211-000006B0-3491CA53/0/0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 93.183.12.32 Cc: crosthwaitepeter@gmail.com, clg@fr.ibm.com, pawel.lenkow@itlen.com, marcin.krzeminski@nokia.com Subject: [Qemu-devel] [PATCH v4 11/11] block: m25p80: at25128a/at25256a models X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Marcin Krzeminski Signed-off-by: Marcin Krzeminski Reviewed-by: Peter Crosthwaite --- hw/block/m25p80.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index 2b7d19f..987fe07 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -99,6 +99,12 @@ static const FlashPartInfo known_devices[] = { { INFO("at45db081d", 0x1f2500, 0, 64 << 10, 16, ER_4K) }, + /* Atmel EEPROMS - it is assumed, that don't care bit in command + * is set to 0. Block protection is not supported. + */ + { INFO("at25128a-nonjedec", 0x0, 0, 1, 131072, WR_1) }, + { INFO("at25256a-nonjedec", 0x0, 0, 1, 262144, WR_1) }, + /* EON -- en25xxx */ { INFO("en25f32", 0x1c3116, 0, 64 << 10, 64, ER_4K) }, { INFO("en25p32", 0x1c2016, 0, 64 << 10, 64, 0) }, @@ -438,6 +444,11 @@ void flash_write8(Flash *s, uint64_t addr, uint8_t data) static inline int get_addr_length(Flash *s) { + /* check if eeprom is in use */ + if (s->pi->flags == WR_1) { + return 2; + } + switch (s->cmd_in_progress) { case PP4: case READ4: