From patchwork Fri Jan 9 13:02:50 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfgang Grandegger X-Patchwork-Id: 17507 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9E6EDDE75E for ; Sat, 10 Jan 2009 00:05:24 +1100 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.68 #1 (Red Hat Linux)) id 1LLH0v-0004FB-IC; Fri, 09 Jan 2009 13:03:03 +0000 Received: from mail-out.m-online.net ([212.18.0.9]) by bombadil.infradead.org with esmtp (Exim 4.68 #1 (Red Hat Linux)) id 1LLH0n-0004B4-Uw for linux-mtd@lists.infradead.org; Fri, 09 Jan 2009 13:02:54 +0000 Received: from mail01.m-online.net (mail.m-online.net [192.168.3.149]) by mail-out.m-online.net (Postfix) with ESMTP id B3B081C15377; Fri, 9 Jan 2009 14:02:52 +0100 (CET) X-Auth-Info: hL2lIMWamaBFrGBE0tSwzU7RQEaRlDCWHF2HaAXZMU0= Received: from lancy.denx.de (p4FF05609.dip.t-dialin.net [79.240.86.9]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mnet-online.de (Postfix) with ESMTP id 8F74990680; Fri, 9 Jan 2009 14:02:52 +0100 (CET) Message-ID: <49674AFA.6090109@grandegger.com> Date: Fri, 09 Jan 2009 14:02:50 +0100 From: Wolfgang Grandegger User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: linux-mtd@lists.infradead.org Subject: [PATCH] CFI: major version fixup for Samsung K8P2815UQB NOR Flash X-Enigmail-Version: 0.95.7 X-Spam-Score: 0.0 (/) Cc: Nicolas Pitre , David Woodhouse X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The NOR Flash memory K8P2815UQB from Samsung uses an incorrect major version number '0'. This patch introduces the cfi_fixup_major_minor() function to set the major version to '1' for this chip. A normal quirk (fixup) cannot be used, because cfi_fixup() is called after the major/minor version check. Signed-off-by: Wolfgang Grandegger Acked-by: Nicolas Pitre --- drivers/mtd/chips/cfi_cmdset_0002.c | 10 ++++++++++ include/linux/mtd/cfi.h | 1 + 2 files changed, 11 insertions(+) Index: linux-2.6/drivers/mtd/chips/cfi_cmdset_0002.c =================================================================== --- linux-2.6.orig/drivers/mtd/chips/cfi_cmdset_0002.c +++ linux-2.6/drivers/mtd/chips/cfi_cmdset_0002.c @@ -322,6 +322,14 @@ static struct cfi_fixup fixup_table[] = }; +static void cfi_fixup_major_minor(struct cfi_private *cfi, + struct cfi_pri_amdstd *extp) +{ + if (cfi->mfr == CFI_MFR_SAMSUNG && cfi->id == 0x257e && + extp->MajorVersion == '0') + extp->MajorVersion = '1'; +} + struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary) { struct cfi_private *cfi = map->fldrv_priv; @@ -363,6 +371,8 @@ struct mtd_info *cfi_cmdset_0002(struct return NULL; } + cfi_fixup_major_minor(cfi, extp); + if (extp->MajorVersion != '1' || (extp->MinorVersion < '0' || extp->MinorVersion > '4')) { printk(KERN_ERR " Unknown Amd/Fujitsu Extended Query " Index: linux-2.6/include/linux/mtd/cfi.h =================================================================== --- linux-2.6.orig/include/linux/mtd/cfi.h +++ linux-2.6/include/linux/mtd/cfi.h @@ -520,6 +520,7 @@ struct cfi_fixup { #define CFI_MFR_AMD 0x0001 #define CFI_MFR_ATMEL 0x001F +#define CFI_MFR_SAMSUNG 0x00EC #define CFI_MFR_ST 0x0020 /* STMicroelectronics */ void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups);