{"id":291,"url":"http://patchwork.ozlabs.org/api/1.0/patches/291/?format=json","project":{"id":3,"url":"http://patchwork.ozlabs.org/api/1.0/projects/3/?format=json","name":"Linux MTD development","link_name":"linux-mtd","list_id":"linux-mtd.lists.infradead.org","list_email":"linux-mtd@lists.infradead.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<1221545652-2280-1-git-send-email-g.chen@freescale.com>","date":"2008-09-16T06:14:12","name":"m25p80.c extended jedec support","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"c8850995b693d96b87c4f78327de380105d51bab","submitter":{"id":152,"url":"http://patchwork.ozlabs.org/api/1.0/people/152/?format=json","name":"Chen Gong","email":"g.chen@freescale.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-mtd/patch/1221545652-2280-1-git-send-email-g.chen@freescale.com/mbox/","series":[],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/291/checks/","tags":{},"headers":{"Return-Path":"<linux-mtd-bounces+patchwork=ozlabs.org@lists.infradead.org>","X-Original-To":"patchwork@ozlabs.org","Delivered-To":"patchwork@ozlabs.org","Received":["from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34])\n\t(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\n\t(Client did not present a certificate)\n\tby ozlabs.org (Postfix) with ESMTPS id 9F483DDE23\n\tfor <patchwork@ozlabs.org>; Tue, 16 Sep 2008 16:30:47 +1000 (EST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.68 #1 (Red Hat Linux))\n\tid 1KfU4u-00004v-Q4; Tue, 16 Sep 2008 06:30:24 +0000","from de01egw02.freescale.net ([192.88.165.103])\n\tby bombadil.infradead.org with esmtps (Exim 4.68 #1 (Red Hat Linux))\n\tid 1KfU4s-0008WK-JZ\n\tfor linux-mtd@lists.infradead.org; Tue, 16 Sep 2008 06:30:22 +0000","from de01smr02.am.mot.com (de01smr02.freescale.net [10.208.0.151])\n\tby de01egw02.freescale.net (8.12.11/de01egw02) with ESMTP id\n\tm8G6U6XE008646 for <linux-mtd@lists.infradead.org>;\n\tMon, 15 Sep 2008 23:30:06 -0700 (MST)","from zch01exm21.fsl.freescale.net (zch01exm21.ap.freescale.net\n\t[10.192.129.205])\n\tby de01smr02.am.mot.com (8.13.1/8.13.0) with ESMTP id m8G6U3Gp014196\n\tfor <linux-mtd@lists.infradead.org>;\n\tTue, 16 Sep 2008 01:30:05 -0500 (CDT)","from localhost ([10.193.20.106]) by zch01exm21.fsl.freescale.net\n\twith Microsoft SMTPSVC(6.0.3790.3959); \n\tTue, 16 Sep 2008 14:30:03 +0800"],"From":"Chen Gong <g.chen@freescale.com>","To":"linux-mtd@lists.infradead.org","Subject":"[PATCH V2] [MTD] m25p80.c extended jedec support","Date":"Tue, 16 Sep 2008 14:14:12 +0800","Message-Id":"<1221545652-2280-1-git-send-email-g.chen@freescale.com>","X-Mailer":"git-send-email 1.5.4","X-OriginalArrivalTime":"16 Sep 2008 06:30:03.0362 (UTC)\n\tFILETIME=[A6F1A420:01C917C5]","X-Spam-Score":"0.0 (/)","Cc":"Chen Gong <g.chen@freescale.com>, dwmw2@infradead.org","X-BeenThere":"linux-mtd@lists.infradead.org","X-Mailman-Version":"2.1.9","Precedence":"list","List-Id":"Linux MTD discussion mailing list <linux-mtd.lists.infradead.org>","List-Unsubscribe":"<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-mtd>","List-Post":"<mailto:linux-mtd@lists.infradead.org>","List-Help":"<mailto:linux-mtd-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"linux-mtd-bounces@lists.infradead.org","Errors-To":"linux-mtd-bounces+patchwork=ozlabs.org@lists.infradead.org"},"content":"- add extended device information support\n- add s25sl128 device support\n\nSigned-off-by: Chen Gong <g.chen@freescale.com>","diff":"diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c\nindex b35c333..7e0254c 100644\n--- a/drivers/mtd/devices/m25p80.c\n+++ b/drivers/mtd/devices/m25p80.c\n@@ -437,6 +437,7 @@ struct flash_info {\n \t * then a two byte device id.\n \t */\n \tu32\t\tjedec_id;\n+\tu16             ext_id;\n \n \t/* The size listed here is what works with OPCODE_SE, which isn't\n \t * necessarily called a \"sector\" by the vendor.\n@@ -456,72 +457,75 @@ struct flash_info {\n static struct flash_info __devinitdata m25p_data [] = {\n \n \t/* Atmel -- some are (confusingly) marketed as \"DataFlash\" */\n-\t{ \"at25fs010\",  0x1f6601, 32 * 1024, 4, SECT_4K, },\n-\t{ \"at25fs040\",  0x1f6604, 64 * 1024, 8, SECT_4K, },\n+\t{ \"at25fs010\",  0x1f6601, 0, 32 * 1024, 4, SECT_4K, },\n+\t{ \"at25fs040\",  0x1f6604, 0, 64 * 1024, 8, SECT_4K, },\n \n-\t{ \"at25df041a\", 0x1f4401, 64 * 1024, 8, SECT_4K, },\n-\t{ \"at25df641\",  0x1f4800, 64 * 1024, 128, SECT_4K, },\n+\t{ \"at25df041a\", 0x1f4401, 0, 64 * 1024, 8, SECT_4K, },\n+\t{ \"at25df641\",  0x1f4800, 0, 64 * 1024, 128, SECT_4K, },\n \n-\t{ \"at26f004\",   0x1f0400, 64 * 1024, 8, SECT_4K, },\n-\t{ \"at26df081a\", 0x1f4501, 64 * 1024, 16, SECT_4K, },\n-\t{ \"at26df161a\", 0x1f4601, 64 * 1024, 32, SECT_4K, },\n-\t{ \"at26df321\",  0x1f4701, 64 * 1024, 64, SECT_4K, },\n+\t{ \"at26f004\",   0x1f0400, 0, 64 * 1024, 8, SECT_4K, },\n+\t{ \"at26df081a\", 0x1f4501, 0, 64 * 1024, 16, SECT_4K, },\n+\t{ \"at26df161a\", 0x1f4601, 0, 64 * 1024, 32, SECT_4K, },\n+\t{ \"at26df321\",  0x1f4701, 0, 64 * 1024, 64, SECT_4K, },\n \n \t/* Spansion -- single (large) sector size only, at least\n \t * for the chips listed here (without boot sectors).\n \t */\n-\t{ \"s25sl004a\", 0x010212, 64 * 1024, 8, },\n-\t{ \"s25sl008a\", 0x010213, 64 * 1024, 16, },\n-\t{ \"s25sl016a\", 0x010214, 64 * 1024, 32, },\n-\t{ \"s25sl032a\", 0x010215, 64 * 1024, 64, },\n-\t{ \"s25sl064a\", 0x010216, 64 * 1024, 128, },\n+\t{ \"s25sl004a\", 0x010212, 0, 64 * 1024, 8, },\n+\t{ \"s25sl008a\", 0x010213, 0, 64 * 1024, 16, },\n+\t{ \"s25sl016a\", 0x010214, 0, 64 * 1024, 32, },\n+\t{ \"s25sl032a\", 0x010215, 0, 64 * 1024, 64, },\n+\t{ \"s25sl064a\", 0x010216, 0, 64 * 1024, 128, },\n+        { \"s25sl12800\", 0x012018, 0x0300, 256 * 1024, 64, },\n+\t{ \"s25sl12801\", 0x012018, 0x0301, 64 * 1024, 256, },\n \n \t/* SST -- large erase sizes are \"overlays\", \"sectors\" are 4K */\n-\t{ \"sst25vf040b\", 0xbf258d, 64 * 1024, 8, SECT_4K, },\n-\t{ \"sst25vf080b\", 0xbf258e, 64 * 1024, 16, SECT_4K, },\n-\t{ \"sst25vf016b\", 0xbf2541, 64 * 1024, 32, SECT_4K, },\n-\t{ \"sst25vf032b\", 0xbf254a, 64 * 1024, 64, SECT_4K, },\n+\t{ \"sst25vf040b\", 0xbf258d, 0, 64 * 1024, 8, SECT_4K, },\n+\t{ \"sst25vf080b\", 0xbf258e, 0, 64 * 1024, 16, SECT_4K, },\n+\t{ \"sst25vf016b\", 0xbf2541, 0, 64 * 1024, 32, SECT_4K, },\n+\t{ \"sst25vf032b\", 0xbf254a, 0, 64 * 1024, 64, SECT_4K, },\n \n \t/* ST Microelectronics -- newer production may have feature updates */\n-\t{ \"m25p05\",  0x202010,  32 * 1024, 2, },\n-\t{ \"m25p10\",  0x202011,  32 * 1024, 4, },\n-\t{ \"m25p20\",  0x202012,  64 * 1024, 4, },\n-\t{ \"m25p40\",  0x202013,  64 * 1024, 8, },\n-\t{ \"m25p80\",         0,  64 * 1024, 16, },\n-\t{ \"m25p16\",  0x202015,  64 * 1024, 32, },\n-\t{ \"m25p32\",  0x202016,  64 * 1024, 64, },\n-\t{ \"m25p64\",  0x202017,  64 * 1024, 128, },\n-\t{ \"m25p128\", 0x202018, 256 * 1024, 64, },\n-\n-\t{ \"m45pe80\", 0x204014,  64 * 1024, 16, },\n-\t{ \"m45pe16\", 0x204015,  64 * 1024, 32, },\n-\n-\t{ \"m25pe80\", 0x208014,  64 * 1024, 16, },\n-\t{ \"m25pe16\", 0x208015,  64 * 1024, 32, SECT_4K, },\n+\t{ \"m25p05\",  0x202010,  0, 32 * 1024, 2, },\n+\t{ \"m25p10\",  0x202011,  0, 32 * 1024, 4, },\n+\t{ \"m25p20\",  0x202012,  0, 64 * 1024, 4, },\n+\t{ \"m25p40\",  0x202013,  0, 64 * 1024, 8, },\n+\t{ \"m25p80\",         0,  0, 64 * 1024, 16, },\n+\t{ \"m25p16\",  0x202015,  0, 64 * 1024, 32, },\n+\t{ \"m25p32\",  0x202016,  0, 64 * 1024, 64, },\n+\t{ \"m25p64\",  0x202017,  0, 64 * 1024, 128, },\n+\t{ \"m25p128\", 0x202018, 0, 256 * 1024, 64, },\n+\n+\t{ \"m45pe80\", 0x204014,  0, 64 * 1024, 16, },\n+\t{ \"m45pe16\", 0x204015,  0, 64 * 1024, 32, },\n+\n+\t{ \"m25pe80\", 0x208014,  0, 64 * 1024, 16, },\n+\t{ \"m25pe16\", 0x208015,  0, 64 * 1024, 32, SECT_4K, },\n \n \t/* Winbond -- w25x \"blocks\" are 64K, \"sectors\" are 4KiB */\n-\t{ \"w25x10\", 0xef3011, 64 * 1024, 2, SECT_4K, },\n-\t{ \"w25x20\", 0xef3012, 64 * 1024, 4, SECT_4K, },\n-\t{ \"w25x40\", 0xef3013, 64 * 1024, 8, SECT_4K, },\n-\t{ \"w25x80\", 0xef3014, 64 * 1024, 16, SECT_4K, },\n-\t{ \"w25x16\", 0xef3015, 64 * 1024, 32, SECT_4K, },\n-\t{ \"w25x32\", 0xef3016, 64 * 1024, 64, SECT_4K, },\n-\t{ \"w25x64\", 0xef3017, 64 * 1024, 128, SECT_4K, },\n+\t{ \"w25x10\", 0xef3011, 0, 64 * 1024, 2, SECT_4K, },\n+\t{ \"w25x20\", 0xef3012, 0, 64 * 1024, 4, SECT_4K, },\n+\t{ \"w25x40\", 0xef3013, 0, 64 * 1024, 8, SECT_4K, },\n+\t{ \"w25x80\", 0xef3014, 0, 64 * 1024, 16, SECT_4K, },\n+\t{ \"w25x16\", 0xef3015, 0, 64 * 1024, 32, SECT_4K, },\n+\t{ \"w25x32\", 0xef3016, 0, 64 * 1024, 64, SECT_4K, },\n+\t{ \"w25x64\", 0xef3017, 0, 64 * 1024, 128, SECT_4K, },\n };\n \n static struct flash_info *__devinit jedec_probe(struct spi_device *spi)\n {\n \tint\t\t\ttmp;\n \tu8\t\t\tcode = OPCODE_RDID;\n-\tu8\t\t\tid[3];\n+\tu8\t\t\tid[5];\n \tu32\t\t\tjedec;\n+\tu16                     ext_jedec;\n \tstruct flash_info\t*info;\n \n \t/* JEDEC also defines an optional \"extended device information\"\n \t * string for after vendor-specific data, after the three bytes\n \t * we use here.  Supporting some chips might require using it.\n \t */\n-\ttmp = spi_write_then_read(spi, &code, 1, id, 3);\n+\ttmp = spi_write_then_read(spi, &code, 1, id, 5);\n \tif (tmp < 0) {\n \t\tDEBUG(MTD_DEBUG_LEVEL0, \"%s: error %d reading JEDEC ID\\n\",\n \t\t\tspi->dev.bus_id, tmp);\n@@ -533,10 +537,14 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)\n \tjedec = jedec << 8;\n \tjedec |= id[2];\n \n+\text_jedec = id[3] << 8 | id[4];\n+\n \tfor (tmp = 0, info = m25p_data;\n \t\t\ttmp < ARRAY_SIZE(m25p_data);\n \t\t\ttmp++, info++) {\n \t\tif (info->jedec_id == jedec)\n+\t\t\tif (ext_jedec != 0 && info->ext_id != ext_jedec)\n+\t\t\t\tcontinue;\n \t\t\treturn info;\n \t}\n \tdev_err(&spi->dev, \"unrecognized JEDEC id %06x\\n\", jedec);\n","prefixes":[]}