From patchwork Fri Jun 24 08:07:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: marcin.krzeminski@nokia.com X-Patchwork-Id: 9196901 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F3B3860871 for ; Fri, 24 Jun 2016 08:14:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E080C28485 for ; Fri, 24 Jun 2016 08:14:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D3DD128499; Fri, 24 Jun 2016 08:14:04 +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=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, 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 8C83528485 for ; Fri, 24 Jun 2016 08:14:03 +0000 (UTC) Received: from localhost ([::1]:41771 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGMFW-0004qz-CQ for patchwork-qemu-devel@patchwork.kernel.org; Fri, 24 Jun 2016 04:14:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGMAX-0007jm-5r for qemu-devel@nongnu.org; Fri, 24 Jun 2016 04:09:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGMAD-00085n-Oz for qemu-devel@nongnu.org; Fri, 24 Jun 2016 04:08:51 -0400 Received: from mail-db3on0101.outbound.protection.outlook.com ([157.55.234.101]:63656 helo=emea01-db3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGMAD-000853-74 for qemu-devel@nongnu.org; Fri, 24 Jun 2016 04:08:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=M+0/HiUJeSRPq7pJjf1+FEm/g4t8Dnhhj755ESO0/S0=; b=VqA4pMWzIFd0vL9IKdUd0NXQ/ZY+2ofKIP7qW9KRdlPEWMFkkpgXoBucIOR70U99Vnj2fTaR3gYLlFlkIrZ1rBwy1fLXyOnd75NyEJUp0tlzzknGzUTzMk9l1O7yTsHTFjy4tMwgt/b8y75Q2jRdSlGJTJZgmvIzsab1K+ro7NY= Received: from AMXPR07CA0016.eurprd07.prod.outlook.com (10.242.64.16) by AM4PR0701MB2113.eurprd07.prod.outlook.com (10.167.132.134) with Microsoft SMTP Server (TLS) id 15.1.523.12; Fri, 24 Jun 2016 08:08:31 +0000 Received: from DB3FFO11FD043.protection.gbl (2a01:111:f400:7e04::109) by AMXPR07CA0016.outlook.office365.com (2a01:111:e400:1000::16) with Microsoft SMTP Server (TLS) id 15.1.523.12 via Frontend Transport; Fri, 24 Jun 2016 08:08:31 +0000 Authentication-Results: spf=pass (sender IP is 131.228.2.241) smtp.mailfrom=nokia.com; nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=pass action=none header.from=nokia.com; Received-SPF: Pass (protection.outlook.com: domain of nokia.com designates 131.228.2.241 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.2.241; helo=fihe3nok0735.emea.nsn-net.net; Received: from fihe3nok0735.emea.nsn-net.net (131.228.2.241) by DB3FFO11FD043.mail.protection.outlook.com (10.47.217.74) with Microsoft SMTP Server (TLS) id 15.1.517.7 via Frontend Transport; Fri, 24 Jun 2016 08:08:31 +0000 Received: from fihe3nok0735.emea.nsn-net.net (localhost [127.0.0.1]) by fihe3nok0735.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id u5O87vuY008506 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Jun 2016 11:07:57 +0300 Received: from CNU418C7XK.nsn-intra.net ([10.154.155.220]) by fihe3nok0735.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id u5O87u72008453; Fri, 24 Jun 2016 11:07:57 +0300 X-HPESVCS-Source-Ip: 10.154.155.220 From: To: Date: Fri, 24 Jun 2016 10:07:02 +0200 Message-ID: <1466755631-25201-2-git-send-email-marcin.krzeminski@nokia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1466755631-25201-1-git-send-email-marcin.krzeminski@nokia.com> References: <1466755631-25201-1-git-send-email-marcin.krzeminski@nokia.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:131.228.2.241; IPV:NLI; CTRY:FI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(7916002)(2980300002)(438002)(199003)(189002)(86362001)(7846002)(86152002)(36756003)(11100500001)(356003)(50466002)(50986999)(2950100001)(76176999)(92566002)(6806005)(47776003)(87936001)(19580395003)(19580405001)(97736004)(8676002)(81156014)(77096005)(81166006)(48376002)(53416004)(68736007)(106466001)(8936002)(50226002)(229853001)(586003)(189998001)(5003940100001)(2351001)(305945005)(33646002)(110136002)(16796002)(2876002)(4326007)(2906002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM4PR0701MB2113; H:fihe3nok0735.emea.nsn-net.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DB3FFO11FD043; 1:7/2Uxz9YUK8UTnXBPpNvfFJg0pVBJBNcxuYBf0flvHOMyasWDVcpLFTxYtxEd8mRWsJIAzZMdIB9wgXvZUjnf/pnMdRLYL2Ok7VZWNA8myAl3xkebKVD46Fj3i252lVowYUhbS/TDNtB0trkDa9ylCJ13XPiM83+J5g+uzZ5KHJ/+slr7HcO8bKQVk+qNDQk+KTMLoitiHawh1EtkQduOUsgE+371e80RAEf7YBADi0zpCqSFSm+qWNkwRy0L/EU/4XnCNSXVYrl92+JMTj7RXlhzu+FUVpWgXMaHT1VcEe0ofm6Yn8N0b1rP/cwX/qIMNn6TuVc8zZTgKQSm6T+k8quq4MCHXBn25pMnR94vFp1Wf7mJCfV+fgiZtUZWx3jw9YwZaC8fjKLZP8TVy9c1pektb4u4iwaWLx93k7QN+Q0KaiICRfy56LY2yCRDfC1 MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: caf40103-4a49-4472-b65f-08d39c06bb4a X-Microsoft-Exchange-Diagnostics: 1; AM4PR0701MB2113; 2:WJUwOaJ3vh1CVsv3mnhJ/zaqOg3Retn7BPcSOsLcoGfXSxNpJqFsq7yF5s7F1iH2fnJWw/3AadXTs66jlTh6knmrFpp2zU8sdrtFdjSRs/2G4+KkGmmYjxVfqBW8LBEW1QvmGoRTPUFSRUlvLbZOduAoWuCOztfDat4JDpSM6FXUkKUlYYydUFbjjxEKx6EW; 3:XSGfCzF77tq9ZCfjBmpnUnpun7jiJHRV4UVBBmNqSiz9PqWemHNpAoWEaUHVFn+WONANogqqqYeFzTV8DIau9N2jwNXWGzt5kGWkgxg0T21t/N3C6HKOpF8lwjYSFFJLD3alp4vyDEKh9dSMZcfpcZtxrAMKfLsRzAsS+2eU5GhUqS4+Y85G4MyDHDbIbjFNQHazmWHeyG8vtNQsFjdCzLTbdtYtc1/41R3C2VFTrZZAG2sWhW31ECFSz3+bo5ygNZ0OOQag7sInMYxbhE1zpg== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:AM4PR0701MB2113; X-Microsoft-Exchange-Diagnostics: 1; AM4PR0701MB2113; 25:f5dO8icjeqxwJ9Fc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pSHk7Aph+B9V1edEKcSgS/A7rx4+zQJ2dT7rLG6eVe0yvp78wTjIyLoDhZ3Ub8zi745W3gwM/Kh7iY40ecTn33t7em1R48sP/TK7ZkczlMFMdQd7fqCmMfY3TTHS0sOXxGOHyAebUYIeGIp4KvTWqk+6uSU+cBX3CONhFsqn/S8VAjl4IgcHwZRBFO9QpBpYDwWF7Sl5+JQ4oAAJQ0g1i9RGhH5+0AVkSe7g42b5oqUksrN/VA/Ifrd3+MIbQlttgl8YQqdqoAU6aXtnpvCf8AwNrSZB4voUMtABPwhUn6Ts= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(35073007944872)(82608151540597)(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(13018025)(13016025)(3002001)(10201501046); SRVR:AM4PR0701MB2113; BCL:0; PCL:0; RULEID:; SRVR:AM4PR0701MB2113; X-Microsoft-Exchange-Diagnostics: 1; AM4PR0701MB2113; 4:IcuJKeo2rkcbyhwimsnASLxI04OpOnfhKpb1Ifsv+cwCQ42m0qbTw20nv9cgbhT2Dab9bwjMzPWRHVvAqO21fE/u4jf3Z6tYB9xinN1ZeN85w19a+rOPqhO9esUmMmYwqQ4KG0y54irG4sxjCbV4vBht5vC4MiHAg0Qgua6AWMMHPDuz/9KXdcUoukhFu0ryMl6yoO0aEYWduHsNrJBJUzb7XGbclDuEJ/iZzU1i+T8ONwkvkSWhYJhZyZvvUZxkfrFQ/2LsdDwR7QwC0NwVUOJGbsfpS4JsY7RuUA0CgCzmPCtQkIAMaGn4o/Zpz1YjQ9lasu5AX6FO1TMpS9YG5HVk4yu2wq8eGmmjDiWyJAwis0hUIhA6pAZLwEwZDAzwt+UbiXqtlXYTe0YE8RDDqUpztkzrcNurcRXBV5rFjtlWtPymtVt2lVWjV9+Urwhc8tOCPJhqowKPrf3xLKbiocf8yKG0mC0Tkb5ihDTZL87Zwa1At5mR5wEw+IqhQ59i X-Forefront-PRVS: 0983EAD6B2 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM4PR0701MB2113; 23:HYWrVgvsqmLoLmlorHCtJCFu0jP/LgFEPF/GVPg?= =?us-ascii?Q?9ptqPJ7gzbnMpuudCoOXIGc02nv4u6EBiwxlXi2ZKNAbshiruEc263pH75mF?= =?us-ascii?Q?jl+jD14T3yKB8mmeS8T1HadsicBcMny4PBP2uQX5HKPApuZ/uFELRl9Q+22D?= =?us-ascii?Q?q4czLtEzuTyTDNa4/zp3OcnWET7Qkg73HiKrWZi7uor/dePoLa41vPZ2HlL8?= =?us-ascii?Q?tROjjFBvNRy0i+6IPrCPzoTyXUmNjdkQG8Gzedd8NyR6Rz5MREBCcx18dlT5?= =?us-ascii?Q?f5jnesqKtPUJZYdRThULIjzCxjthW/tsdZadfZ+tDS9SxY/MQxS0ZH8E6ch+?= =?us-ascii?Q?fV+UqhF+hcqADbXG0cTit0WiZhJRM/Cgxup2jPL2sMvNWrmftA0jLo3VYKV3?= =?us-ascii?Q?AGmT/s2aqSL7qXOV9NAH2Lf+ULYfnhIjLvw3QuygIEhFOskQPcYBH3Go2UkD?= =?us-ascii?Q?UBSZGDXMCOdrbjD1qknsS+JxjnPe15P15T7OXs2TdpjJzf/d7PaMBGSczWok?= =?us-ascii?Q?zTHmjo+IkKyKbfy57D2HuXphlyUQUOeMUwncTn0pMRYoZS5ZuOcbM2DNHGdB?= =?us-ascii?Q?Dsly0flv73OcRuj+caVBqtWc/AynmqYYB46BG/vyr68C8glPBW1c6qffRsxM?= =?us-ascii?Q?yOo++WArJHWg57AzVOffv279XiU7/auvASnpRX7gA/KieupXWVzK+Nwj/UaB?= =?us-ascii?Q?yG6PbOEkccbcHq3UlCzuwVkeGCQ2PGe3dKl2HVBh7c2lMKhbWZ4YYUCsTk57?= =?us-ascii?Q?HJr/gWcBJ8feK4LyUOulUQrN5+Rjiy0j/+VSW8DoKP0T0q8iJPlMbPNtRA3i?= =?us-ascii?Q?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KWYixx6FdzTaS8acUGFeDt2i3vRLNd6+k/DzB322SG61oQMNUJLNnPpBiTgrrUWdfdh1SOSUuWuDJlI73lYmi5YJqQunhD1k3NKvzyqLs6dYbpN4svVzD4rOD8l7MxYViJuuNuFlIO4Pd3yFEvgff6yNnTJX0EsbNSR7jvOiheCcExJsFuNTFGktCdsGnt/EoKTDVCvSV23oNjZVxEFL97u2A8rakqaFew== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2016 08:08:31.3316 (UTC) X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0; Ip=[131.228.2.241]; Helo=[fihe3nok0735.emea.nsn-net.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0701MB2113 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 X-Received-From: 157.55.234.101 Subject: [Qemu-devel] [PATCH v3 01/10] m25p80: Replace JEDEC ID masking with function. 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: peter.maydell@linaro.org, crosthwaitepeter@gmail.com, clg@fr.ibm.com, clg@kaod.org, pawel.lenkow@itlen.com, rfsw-patches@mlist.emea.nsn-intra.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Marcin Krzeminski Instead of always reading and comparing jededc ID, replace it by function. Signed-off-by: Marcin Krzeminski Reviewed-by: Peter Maydell --- hw/block/m25p80.c | 49 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index 4c856f5..15765f5 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -307,6 +307,14 @@ typedef enum { STATE_READING_DATA, } CMDState; +typedef enum { + MAN_SPANSION, + MAN_MACRONIX, + MAN_NUMONYX, + MAN_WINBOND, + MAN_GENERIC, +} Manufacturer; + typedef struct Flash { SSISlave parent_obj; @@ -350,6 +358,22 @@ typedef struct M25P80Class { #define M25P80_GET_CLASS(obj) \ OBJECT_GET_CLASS(M25P80Class, (obj), TYPE_M25P80) +static inline Manufacturer get_man(Flash *s) +{ + switch (((s->pi->jedec >> 16) & 0xFF)) { + case 0x20: + return MAN_NUMONYX; + case 0xEF: + return MAN_WINBOND; + case 0x01: + return MAN_SPANSION; + case 0xC2: + return MAN_MACRONIX; + default: + return MAN_GENERIC; + } +} + static void blk_sync_complete(void *opaque, int ret) { /* do nothing. Masters do not directly interact with the backing store, @@ -562,7 +586,8 @@ static void reset_memory(Flash *s) s->write_enable = false; s->reset_enable = false; - if (((s->pi->jedec >> 16) & 0xFF) == JEDEC_NUMONYX) { + switch (get_man(s)) { + case MAN_NUMONYX: s->volatile_cfg = 0; s->volatile_cfg |= VCFG_DUMMY; s->volatile_cfg |= VCFG_WRAP_SEQUENTIAL; @@ -594,6 +619,9 @@ static void reset_memory(Flash *s) if (!(s->nonvolatile_cfg & NVCFG_LOWER_SEGMENT_MASK)) { s->ear = CFG_UPPER_128MB_SEG_ENABLED; } + break; + default: + break; } DB_PRINT_L(0, "Reset done.\n"); @@ -634,9 +662,12 @@ static void decode_new_cmd(Flash *s, uint32_t value) case QOR: case QOR4: s->needed_bytes = get_addr_length(s); - if (((s->pi->jedec >> 16) & 0xFF) == JEDEC_NUMONYX) { - /* Dummy cycles modeled with bytes writes instead of bits */ + switch (get_man(s)) { + case MAN_NUMONYX: s->needed_bytes += extract32(s->volatile_cfg, 4, 4); + break; + default: + break; } s->pos = 0; s->len = 0; @@ -645,9 +676,9 @@ static void decode_new_cmd(Flash *s, uint32_t value) case DIOR: case DIOR4: - switch ((s->pi->jedec >> 16) & 0xFF) { - case JEDEC_WINBOND: - case JEDEC_SPANSION: + switch (get_man(s)) { + case MAN_WINBOND: + case MAN_SPANSION: s->needed_bytes = 4; break; default: @@ -662,9 +693,9 @@ static void decode_new_cmd(Flash *s, uint32_t value) case QIOR: case QIOR4: - switch ((s->pi->jedec >> 16) & 0xFF) { - case JEDEC_WINBOND: - case JEDEC_SPANSION: + switch (get_man(s)) { + case MAN_WINBOND: + case MAN_SPANSION: s->needed_bytes = 6; break; default: