From patchwork Thu Feb 4 12:23:26 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: 578906 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 8E977140783 for ; Thu, 4 Feb 2016 23:32:04 +1100 (AEDT) Received: from localhost ([::1]:41354 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRJ4s-00029L-La for incoming@patchwork.ozlabs.org; Thu, 04 Feb 2016 07:32:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRIws-00060R-21 for qemu-devel@nongnu.org; Thu, 04 Feb 2016 07:23:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRIwp-0008PB-WE for qemu-devel@nongnu.org; Thu, 04 Feb 2016 07:23:45 -0500 Received: from demumfd001.nsn-inter.net ([93.183.12.32]:59365) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRIwp-0008OR-MJ for qemu-devel@nongnu.org; Thu, 04 Feb 2016 07:23:43 -0500 Received: from demuprx017.emea.nsn-intra.net ([10.150.129.56]) by demumfd001.nsn-inter.net (8.15.2/8.15.2) with ESMTPS id u14CNdsx004041 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 4 Feb 2016 12:23:39 GMT Received: from CNU418C7XK.nsn-intra.net ([10.154.155.152]) by demuprx017.emea.nsn-intra.net (8.12.11.20060308/8.12.11) with ESMTP id u14CNXOH022276; Thu, 4 Feb 2016 13:23:38 +0100 From: marcin.krzeminski@nokia.com To: qemu-devel@nongnu.org Date: Thu, 4 Feb 2016 13:23:26 +0100 Message-Id: <1454588606-14094-12-git-send-email-marcin.krzeminski@nokia.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1454588606-14094-1-git-send-email-marcin.krzeminski@nokia.com> References: <1454588606-14094-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: 1245 X-purgate-ID: 151667::1454588619-00001C0B-1618FF52/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 v2 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 --- hw/block/m25p80.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index ec1013d..3ff418f 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_cmd_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: