* [PATCH 0/3] [MTD] BF5xx_nand driver and m25p80 driver patches
@ 2008-04-25 4:07 Bryan Wu
2008-04-25 4:07 ` [PATCH 1/3] [mtd] bf5xx_nand driver: Fix BUG - nand driver on bf527 ezkit board crashes if bfin_mac installed Bryan Wu
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Bryan Wu @ 2008-04-25 4:07 UTC (permalink / raw)
To: linux-mtd, dwmw2, linux-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] [mtd] bf5xx_nand driver: Fix BUG - nand driver on bf527 ezkit board crashes if bfin_mac installed
2008-04-25 4:07 [PATCH 0/3] [MTD] BF5xx_nand driver and m25p80 driver patches Bryan Wu
@ 2008-04-25 4:07 ` Bryan Wu
2008-04-25 4:07 ` [PATCH 2/3] [MTD] m25p80: add FAST_READ access support to M25Pxx Bryan Wu
2008-04-25 4:07 ` [PATCH 3/3] [MTD] m25p80: Add Support for ATMEL AT25DF641 64-Megabit SPI Flash Bryan Wu
2 siblings, 0 replies; 4+ messages in thread
From: Bryan Wu @ 2008-04-25 4:07 UTC (permalink / raw)
To: linux-mtd, dwmw2, linux-kernel; +Cc: Bryan Wu, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
http://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=4053
Singed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
drivers/mtd/nand/bf5xx_nand.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c
index 747042a..a7afe35 100644
--- a/drivers/mtd/nand/bf5xx_nand.c
+++ b/drivers/mtd/nand/bf5xx_nand.c
@@ -1,6 +1,6 @@
/* linux/drivers/mtd/nand/bf5xx_nand.c
*
- * Copyright 2006-2007 Analog Devices Inc.
+ * Copyright 2006-2008 Analog Devices Inc.
* http://blackfin.uclinux.org/
* Bryan Wu <bryan.wu@analog.com>
*
@@ -74,7 +74,7 @@ static int hardware_ecc = 1;
static int hardware_ecc;
#endif
-static unsigned short bfin_nfc_pin_req[] =
+static const unsigned short bfin_nfc_pin_req[] =
{P_NAND_CE,
P_NAND_RB,
P_NAND_D0,
@@ -581,12 +581,6 @@ static int bf5xx_nand_hw_init(struct bf5xx_nand_info *info)
bfin_write_NFC_IRQSTAT(val);
SSYNC();
- if (peripheral_request_list(bfin_nfc_pin_req, DRV_NAME)) {
- printk(KERN_ERR DRV_NAME
- ": Requesting Peripherals failed\n");
- return -EFAULT;
- }
-
/* DMA initialization */
if (bf5xx_nand_dma_init(info))
err = -ENXIO;
@@ -654,6 +648,12 @@ static int bf5xx_nand_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "(%p)\n", pdev);
+ if (peripheral_request_list(bfin_nfc_pin_req, DRV_NAME)) {
+ printk(KERN_ERR DRV_NAME
+ ": Requesting Peripherals failed\n");
+ return -EFAULT;
+ }
+
if (!plat) {
dev_err(&pdev->dev, "no platform specific information\n");
goto exit_error;
--
1.5.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] [MTD] m25p80: add FAST_READ access support to M25Pxx
2008-04-25 4:07 [PATCH 0/3] [MTD] BF5xx_nand driver and m25p80 driver patches Bryan Wu
2008-04-25 4:07 ` [PATCH 1/3] [mtd] bf5xx_nand driver: Fix BUG - nand driver on bf527 ezkit board crashes if bfin_mac installed Bryan Wu
@ 2008-04-25 4:07 ` Bryan Wu
2008-04-25 4:07 ` [PATCH 3/3] [MTD] m25p80: Add Support for ATMEL AT25DF641 64-Megabit SPI Flash Bryan Wu
2 siblings, 0 replies; 4+ messages in thread
From: Bryan Wu @ 2008-04-25 4:07 UTC (permalink / raw)
To: linux-mtd, dwmw2, linux-kernel; +Cc: Bryan Wu
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
drivers/mtd/devices/Kconfig | 7 +++++++
drivers/mtd/devices/m25p80.c | 31 +++++++++++++++++++++----------
2 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig
index 811d56f..35ed110 100644
--- a/drivers/mtd/devices/Kconfig
+++ b/drivers/mtd/devices/Kconfig
@@ -77,6 +77,13 @@ config MTD_M25P80
if you want to specify device partitioning or to use a device which
doesn't support the JEDEC ID instruction.
+config M25PXX_USE_FAST_READ
+ bool "Use FAST_READ OPCode allowing SPI CLK <= 50MHz"
+ depends on MTD_M25P80
+ default y
+ help
+ This option enables FAST_READ access supported by ST M25Pxx.
+
config MTD_SLRAM
tristate "Uncached system RAM"
help
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 98df5bc..14dd88d 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -33,7 +33,7 @@
/* Flash opcodes. */
#define OPCODE_WREN 0x06 /* Write enable */
#define OPCODE_RDSR 0x05 /* Read status register */
-#define OPCODE_READ 0x03 /* Read data bytes (low frequency) */
+#define OPCODE_NORM_READ 0x03 /* Read data bytes (low frequency) */
#define OPCODE_FAST_READ 0x0b /* Read data bytes (high frequency) */
#define OPCODE_PP 0x02 /* Page program (up to 256 bytes) */
#define OPCODE_BE_4K 0x20 /* Erase 4KiB block */
@@ -52,7 +52,15 @@
/* Define max times to check status register before we give up. */
#define MAX_READY_WAIT_COUNT 100000
+#define CMD_SIZE 4
+#ifdef CONFIG_M25PXX_USE_FAST_READ
+#define OPCODE_READ OPCODE_FAST_READ
+#define FAST_READ_DUMMY_BYTE 1
+#else
+#define OPCODE_READ OPCODE_NORM_READ
+#define FAST_READ_DUMMY_BYTE 0
+#endif
#ifdef CONFIG_MTD_PARTITIONS
#define mtd_has_partitions() (1)
@@ -68,7 +76,7 @@ struct m25p {
struct mtd_info mtd;
unsigned partitioned:1;
u8 erase_opcode;
- u8 command[4];
+ u8 command[CMD_SIZE + FAST_READ_DUMMY_BYTE];
};
static inline struct m25p *mtd_to_m25p(struct mtd_info *mtd)
@@ -167,7 +175,7 @@ static int erase_sector(struct m25p *flash, u32 offset)
flash->command[2] = offset >> 8;
flash->command[3] = offset;
- spi_write(flash->spi, flash->command, sizeof(flash->command));
+ spi_write(flash->spi, flash->command, CMD_SIZE);
return 0;
}
@@ -253,8 +261,12 @@ static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len,
spi_message_init(&m);
memset(t, 0, (sizeof t));
+ /* NOTE:
+ * OPCODE_FAST_READ (if available) is faster.
+ * Should add 1 byte DUMMY_BYTE.
+ */
t[0].tx_buf = flash->command;
- t[0].len = sizeof(flash->command);
+ t[0].len = CMD_SIZE + FAST_READ_DUMMY_BYTE;
spi_message_add_tail(&t[0], &m);
t[1].rx_buf = buf;
@@ -287,7 +299,7 @@ static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len,
spi_sync(flash->spi, &m);
- *retlen = m.actual_length - sizeof(flash->command);
+ *retlen = m.actual_length - CMD_SIZE - FAST_READ_DUMMY_BYTE;
mutex_unlock(&flash->lock);
@@ -325,7 +337,7 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
memset(t, 0, (sizeof t));
t[0].tx_buf = flash->command;
- t[0].len = sizeof(flash->command);
+ t[0].len = CMD_SIZE;
spi_message_add_tail(&t[0], &m);
t[1].tx_buf = buf;
@@ -354,7 +366,7 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
spi_sync(flash->spi, &m);
- *retlen = m.actual_length - sizeof(flash->command);
+ *retlen = m.actual_length - CMD_SIZE;
} else {
u32 i;
@@ -364,7 +376,7 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
t[1].len = page_size;
spi_sync(flash->spi, &m);
- *retlen = m.actual_length - sizeof(flash->command);
+ *retlen = m.actual_length - CMD_SIZE;
/* write everything in PAGESIZE chunks */
for (i = page_size; i < len; i += page_size) {
@@ -387,8 +399,7 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
spi_sync(flash->spi, &m);
if (retlen)
- *retlen += m.actual_length
- - sizeof(flash->command);
+ *retlen += m.actual_length - CMD_SIZE;
}
}
--
1.5.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] [MTD] m25p80: Add Support for ATMEL AT25DF641 64-Megabit SPI Flash
2008-04-25 4:07 [PATCH 0/3] [MTD] BF5xx_nand driver and m25p80 driver patches Bryan Wu
2008-04-25 4:07 ` [PATCH 1/3] [mtd] bf5xx_nand driver: Fix BUG - nand driver on bf527 ezkit board crashes if bfin_mac installed Bryan Wu
2008-04-25 4:07 ` [PATCH 2/3] [MTD] m25p80: add FAST_READ access support to M25Pxx Bryan Wu
@ 2008-04-25 4:07 ` Bryan Wu
2 siblings, 0 replies; 4+ messages in thread
From: Bryan Wu @ 2008-04-25 4:07 UTC (permalink / raw)
To: linux-mtd, dwmw2, linux-kernel; +Cc: Bryan Wu, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
drivers/mtd/devices/m25p80.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 14dd88d..e6f9cc9 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -446,6 +446,7 @@ static struct flash_info __devinitdata m25p_data [] = {
{ "at25fs040", 0x1f6604, 64 * 1024, 8, SECT_4K, },
{ "at25df041a", 0x1f4401, 64 * 1024, 8, SECT_4K, },
+ { "at25df641", 0x1f4800, 64 * 1024, 128, SECT_4K, },
{ "at26f004", 0x1f0400, 64 * 1024, 8, SECT_4K, },
{ "at26df081a", 0x1f4501, 64 * 1024, 16, SECT_4K, },
--
1.5.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-04-25 4:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-25 4:07 [PATCH 0/3] [MTD] BF5xx_nand driver and m25p80 driver patches Bryan Wu
2008-04-25 4:07 ` [PATCH 1/3] [mtd] bf5xx_nand driver: Fix BUG - nand driver on bf527 ezkit board crashes if bfin_mac installed Bryan Wu
2008-04-25 4:07 ` [PATCH 2/3] [MTD] m25p80: add FAST_READ access support to M25Pxx Bryan Wu
2008-04-25 4:07 ` [PATCH 3/3] [MTD] m25p80: Add Support for ATMEL AT25DF641 64-Megabit SPI Flash Bryan Wu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox