Re: [U-Boot] [PATCH 1/4] spi_nor: add m25p32 spi nor driver

2012-08-15 Thread Lv Terry-R65388
Sorry for that I don't know m25p32 spi nor supported in stmicro.
I've thought that this might be a new driver for new chips.

That's ok. Then I'll summit mx53smd spi nor patches with stmicro.

-Original Message-
From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On 
Behalf Of Mike Frysinger
Sent: 2012?8?14? 23:53
To: u-boot@lists.denx.de; r65...@shlinux3.net
Subject: Re: [U-Boot] [PATCH 1/4] spi_nor: add m25p32 spi nor driver

On Tuesday 14 August 2012 06:58:31 Terry Lv wrote:
 This driver is ported from kernel and can handle a series of spi nor 
 flash including m25pxx, m45pxx, w25xxx, cat25xxx, sst25vf0xxx, 
 sst25wfxxx, s25xxx, mx25xxx, at25xxx, at26xxx, en25xxx, xxxs33b.

it doesn't make much sense to add a driver which duplicates all the existing 
ones.  long term, we should look at migrating to the linux driver i think (if 
we can make it work), but i don't think this port is exactly the way.
-mike

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/4] spi_nor: add m25p32 spi nor driver

2012-08-14 Thread Terry Lv
This driver is ported from kernel and can handle a series of spi nor
flash including m25pxx, m45pxx, w25xxx, cat25xxx, sst25vf0xxx,
sst25wfxxx, s25xxx, mx25xxx, at25xxx, at26xxx, en25xxx, xxxs33b.

Signed-off-by: Terry Lv r65...@freescale.com
---
 drivers/mtd/spi/Makefile |1 +
 drivers/mtd/spi/m25p80.c |  896 ++
 drivers/mtd/spi/spi_flash.c  |   10 +
 drivers/mtd/spi/spi_flash_internal.h |1 +
 4 files changed, 908 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/spi/m25p80.c

diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
index 57112af..1621a61 100644
--- a/drivers/mtd/spi/Makefile
+++ b/drivers/mtd/spi/Makefile
@@ -28,6 +28,7 @@ LIB   := $(obj)libspi_flash.o
 COBJS-$(CONFIG_SPI_FLASH)  += spi_flash.o
 COBJS-$(CONFIG_SPI_FLASH_ATMEL)+= atmel.o
 COBJS-$(CONFIG_SPI_FLASH_EON)  += eon.o
+COBJS-$(CONFIG_SPI_FLASH_M25P80)   += m25p80.o
 COBJS-$(CONFIG_SPI_FLASH_MACRONIX) += macronix.o
 COBJS-$(CONFIG_SPI_FLASH_SPANSION) += spansion.o
 COBJS-$(CONFIG_SPI_FLASH_SST)  += sst.o
diff --git a/drivers/mtd/spi/m25p80.c b/drivers/mtd/spi/m25p80.c
new file mode 100644
index 000..1d87793
--- /dev/null
+++ b/drivers/mtd/spi/m25p80.c
@@ -0,0 +1,896 @@
+/*
+ * Copyright (C) 2012 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+/*
+ * MTD SPI driver for ST M25Pxx (and similar) serial flash chips
+ *
+ * Author: Mike Lavender, m...@steroidmicros.com
+ *
+ * Copyright (c) 2005, Intec Automation Inc.
+ *
+ * Some parts are based on lart.c by Abraham Van Der Merwe
+ *
+ * Cleaned up and generalized based on mtd_dataflash.c
+ *
+ * This code is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include common.h
+#include spi.h
+#include spi_flash.h
+#include asm/errno.h
+#include linux/types.h
+#include malloc.h
+
+#include spi_flash_internal.h
+
+/* CFI */
+#define CFI_MFR_ANY 0x
+#define CFI_ID_ANY  0x
+#define CFI_MFR_CONTINUATION0x007F
+
+#define CFI_MFR_AMD 0x0001
+#define CFI_MFR_AMIC0x0037
+#define CFI_MFR_ATMEL   0x001F
+#define CFI_MFR_EON 0x001C
+#define CFI_MFR_FUJITSU 0x0004
+#define CFI_MFR_HYUNDAI 0x00AD
+#define CFI_MFR_INTEL   0x0089
+#define CFI_MFR_MACRONIX0x00C2
+#define CFI_MFR_NEC 0x0010
+#define CFI_MFR_PMC 0x009D
+#define CFI_MFR_SAMSUNG 0x00EC
+#define CFI_MFR_SHARP   0x00B0
+#define CFI_MFR_SST 0x00BF
+#define CFI_MFR_ST  0x0020 /* STMicroelectronics */
+#define CFI_MFR_TOSHIBA 0x0098
+#define CFI_MFR_WINBOND 0x00DA
+
+/* Flash opcodes. */
+#defineOPCODE_WREN 0x06/* Write enable */
+#defineOPCODE_RDSR 0x05/* Read status register */
+#defineOPCODE_WRSR 0x01/* Write status register 1 byte 
*/
+#defineOPCODE_NORM_READ0x03/* Read data bytes (low 
frequency) */
+#defineOPCODE_FAST_READ0x0b/* Read data bytes (high 
frequency) */
+#defineOPCODE_PP   0x02/* Page program (up to 256 
bytes) */
+#defineOPCODE_BE_4K0x20/* Erase 4KiB block */
+#defineOPCODE_BE_32K   0x52/* Erase 32KiB block */
+#defineOPCODE_CHIP_ERASE   0xc7/* Erase whole flash chip */
+#defineOPCODE_SE   0xd8/* Sector erase (usually 64KiB) 
*/
+#defineOPCODE_RDID 0x9f/* Read JEDEC ID */
+
+/* Used for SST flashes only. */
+#defineOPCODE_BP   0x02/* Byte program */
+#defineOPCODE_WRDI 0x04/* Write disable */
+#defineOPCODE_AAI_WP   0xad/* Auto address increment word 
program */
+
+/* Used for Macronix flashes only. */
+#defineOPCODE_EN4B 0xb7/* Enter 4-byte mode */
+#defineOPCODE_EX4B 0xe9/* Exit 4-byte mode */
+
+/* Used for Spansion flashes only. */
+#define

Re: [U-Boot] [PATCH 1/4] spi_nor: add m25p32 spi nor driver

2012-08-14 Thread Mike Frysinger
On Tuesday 14 August 2012 06:58:31 Terry Lv wrote:
 This driver is ported from kernel and can handle a series of spi nor
 flash including m25pxx, m45pxx, w25xxx, cat25xxx, sst25vf0xxx,
 sst25wfxxx, s25xxx, mx25xxx, at25xxx, at26xxx, en25xxx, xxxs33b.

it doesn't make much sense to add a driver which duplicates all the existing 
ones.  long term, we should look at migrating to the linux driver i think (if 
we can make it work), but i don't think this port is exactly the way.
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot