Skip to contentSkip to conversation

spiflash: at25: using common spi flash operation

PATCH New Bo Shen 3 participants 15 messages Aug 20, 2012 – Sep 17, 2012

Subsystems (4)
lore
Share & tools
lore

Bo Shen

author
#0 lore raw

PATCH 1/4 spiflash: at25: using common spi flash operation

Using common spi flash operation function to replace private operation funtion

This patch is based on http://patchwork.ozlabs.org/patch/177896/
which has been merged by Mike frysinger

---
 drivers/mtd/spi/atmel.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/mtd/spi/atmel.c +8 -3
index 89ebe9d..006f6d5 100644
@@ -518,13 +518,19 @@ struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode)
 			asf->flash.erase = dataflash_erase_p2;
 		}
 
+		asf->flash.page_size = page_size;
+		asf->flash.sector_size = page_size;
 		break;
 
 	case DF_FAMILY_AT26F:
 	case DF_FAMILY_AT26DF:
 		asf->flash.read = spi_flash_cmd_read_fast;
-		asf->flash.write = dataflash_write_p2;
-		asf->flash.erase = dataflash_erase_p2;
+		asf->flash.write = spi_flash_cmd_write_multi;
+		asf->flash.erase = spi_flash_cmd_erase;
+		asf->flash.page_size = page_size;
+		asf->flash.sector_size = 4096;
+		/* clear SPRL# bit for locked flash */
+		spi_flash_cmd_write_status(&asf->flash, 0);
 		break;
 
 	default:
@@ -532,7 +538,6 @@ struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode)
 		goto err;
 	}
 
-	asf->flash.sector_size = page_size;
 	asf->flash.size = page_size * params->pages_per_block
 				* params->blocks_per_sector
 				* params->nr_sectors;
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 2/4 spi: atmel: add WDRBT bit to avoid receive overrun

The atmel at91sam9x5 series spi has feature to avoid receive overren

Using the patch to enable it

---
 drivers/spi/atmel_spi.c |    3 +++
 drivers/spi/atmel_spi.h |    1 +
 2 files changed, 4 insertions(+)
drivers/spi/atmel_spi.c +3 -0
index 83ef8e8..c7a51f7 100644
@@ -92,6 +92,9 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 	as->slave.cs = cs;
 	as->regs = regs;
 	as->mr = ATMEL_SPI_MR_MSTR | ATMEL_SPI_MR_MODFDIS
+#if defined(CONFIG_AT91SAM9X5)
+			| ATMEL_SPI_MR_WDRBT
+#endif
 			| ATMEL_SPI_MR_PCS(~(1 << cs) & 0xf);
 	spi_writel(as, CSR(cs), csrx);
 
drivers/spi/atmel_spi.h +1 -0
index 8b69a6d..057de9a 100644
@@ -26,6 +26,7 @@
 #define ATMEL_SPI_MR_PCSDEC		(1 << 2)
 #define ATMEL_SPI_MR_FDIV		(1 << 3)
 #define ATMEL_SPI_MR_MODFDIS		(1 << 4)
+#define ATMEL_SPI_MR_WDRBT		(1 << 5)
 #define ATMEL_SPI_MR_LLB		(1 << 7)
 #define ATMEL_SPI_MR_PCS(x)		(((x) & 15) << 16)
 #define ATMEL_SPI_MR_DLYBCS(x)		((x) << 24)
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/4 spi: atmel: add WDRBT bit to avoid receive overrun

Dear Bo Shen,

Quoted 5 lines · Bo Shen

The atmel at91sam9x5 series spi has feature to avoid receive overren

Using the patch to enable it

Mike, will you take this patch?

Best regards

Andreas Bie?mann

Quoted 32 lines
---
 drivers/spi/atmel_spi.c |    3 +++
 drivers/spi/atmel_spi.h |    1 +
 2 files changed, 4 insertions(+)
drivers/spi/atmel_spi.c +3 -0
index 83ef8e8..c7a51f7 100644
@@ -92,6 +92,9 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 	as->slave.cs = cs;
 	as->regs = regs;
 	as->mr = ATMEL_SPI_MR_MSTR | ATMEL_SPI_MR_MODFDIS
+#if defined(CONFIG_AT91SAM9X5)
+			| ATMEL_SPI_MR_WDRBT
+#endif
 			| ATMEL_SPI_MR_PCS(~(1 << cs) & 0xf);
 	spi_writel(as, CSR(cs), csrx);
 
drivers/spi/atmel_spi.h +1 -0
index 8b69a6d..057de9a 100644
@@ -26,6 +26,7 @@
 #define ATMEL_SPI_MR_PCSDEC		(1 << 2)
 #define ATMEL_SPI_MR_FDIV		(1 << 3)
 #define ATMEL_SPI_MR_MODFDIS		(1 << 4)
+#define ATMEL_SPI_MR_WDRBT		(1 << 5)
 #define ATMEL_SPI_MR_LLB		(1 << 7)
 #define ATMEL_SPI_MR_PCS(x)		(((x) & 15) << 16)
 #define ATMEL_SPI_MR_DLYBCS(x)		((x) << 24)
#3 lore raw

PATCH 2/4 spi: atmel: add WDRBT bit to avoid receive overrun

Quoted 10 lines · On Tuesday 21 August 2012 07:11:18 Andreas Bie?mann wrote:
Quoted 5 lines · Bo Shen

The atmel at91sam9x5 series spi has feature to avoid receive overren

Using the patch to enable it

Mike, will you take this patch?

for SoC drivers, sometimes i'll help review, but i'd expect it to be merged through the respective architecture tree. i've only been sheriffing the spi core changes.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120821/cdaa8a4b/attachment.pgp>

author
#4 lore raw

PATCH 2/4 spi: atmel: add WDRBT bit to avoid receive overrun

Hi Andreas,

Quoted 8 lines · Mike Frysinger
Quoted 7 lines · On Tuesday 21 August 2012 07:11:18 Andreas Bie?mann wrote:
Quoted 5 lines · Bo Shen

The atmel at91sam9x5 series spi has feature to avoid receive overren

Using the patch to enable it

Quoted 7 lines
Quoted 3 lines

Mike, will you take this patch?

for SoC drivers, sometimes i'll help review, but i'd expect it to be merged through the respective architecture tree. i've only been sheriffing the spi core changes.

If no problem, please take this patch?

Quoted 2 lines

-mike

#5 lore raw

PATCH 2/4 spi: atmel: add WDRBT bit to avoid receive overrun

In reply to Mike Frysinger

Dear Mike Frysinger,

Quoted 8 lines · Mike Frysinger
Quoted 7 lines · On Tuesday 21 August 2012 07:11:18 Andreas Bie?mann wrote:
Quoted 5 lines · Bo Shen

The atmel at91sam9x5 series spi has feature to avoid receive overren

Using the patch to enable it

Quoted 7 lines
Quoted 3 lines

Mike, will you take this patch?

for SoC drivers, sometimes i'll help review, but i'd expect it to be merged through the respective architecture tree. i've only been sheriffing the spi core changes.

Ah, OK. So I'll take this one. I think this is a fix for a change provided before MW close so this should go into this release.

Best regards

Andreas Bie?mann

author
#6 lore raw

PATCH 3/4 atmel: at91sam9x5: fix name error for spi

In reply to Bo Shen

Fix the name error

---
 arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c +2 -2
index 7558ca2..6d77219 100644
@@ -121,7 +121,7 @@ void at91_serial2_hw_init(void)
 #ifdef CONFIG_ATMEL_SPI
 void at91_spi0_hw_init(unsigned long cs_mask)
 {
-	at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_PMC_BASE;
+	at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	at91_set_a_periph(AT91_PIO_PORTA, 11, 0);	/* SPI0_MISO */
 	at91_set_a_periph(AT91_PIO_PORTA, 12, 0);	/* SPI0_MOSI */
@@ -150,7 +150,7 @@ void at91_spi0_hw_init(unsigned long cs_mask)
 
 void at91_spi1_hw_init(unsigned long cs_mask)
 {
-	at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_PMC_BASE;
+	at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	at91_set_b_periph(AT91_PIO_PORTA, 21, 0);	/* SPI1_MISO */
 	at91_set_b_periph(AT91_PIO_PORTA, 22, 0);	/* SPI1_MOSI */
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH 3/4 atmel: at91sam9x5: fix name error for spi

Dear Bo Shen,

Quoted 4 lines · Bo Shen

Fix the name error

---

applied to u-boot-atmel/master, thanks!

Best regards

Andreas Bie?mann

author
#8 lore raw

PATCH 4/4 atmel: at91sam9x5: add spi flash boot support

In reply to Bo Shen

Add at91sam9x5 series spi flash boot support

Using at91sam9x5ek_spiflash to configure, then it can boot from at25df321 serial flash

SPI mater work in 30Mhz speed, while not 1Mhz speed. This will base on atmel_spi patch, or else, it will occur receive overrun

---
 boards.cfg                     |    1 +
 include/configs/at91sam9x5ek.h |   20 ++++++++++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)
boards.cfg +1 -0
index edd750c..343ff0c 100644
@@ -91,6 +91,7 @@ at91sam9m10g45ek_nandflash   arm         arm926ejs   at91sam9m10g45ek    atmel
 at91sam9rlek_dataflash       arm         arm926ejs   at91sam9rlek        atmel          at91        at91sam9rlek:AT91SAM9RL,SYS_USE_DATAFLASH
 at91sam9rlek_nandflash       arm         arm926ejs   at91sam9rlek        atmel          at91        at91sam9rlek:AT91SAM9RL,SYS_USE_NANDFLASH
 at91sam9x5ek_nandflash       arm         arm926ejs   at91sam9x5ek        atmel          at91        at91sam9x5ek:AT91SAM9X5,SYS_USE_NANDFLASH
+at91sam9x5ek_spiflash        arm         arm926ejs   at91sam9x5ek        atmel          at91        at91sam9x5ek:AT91SAM9X5,SYS_USE_SPIFLASH
 at91sam9xeek_dataflash_cs0   arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9XE,SYS_USE_DATAFLASH_CS0
 at91sam9xeek_dataflash_cs1   arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9XE,SYS_USE_DATAFLASH_CS1
 at91sam9xeek_nandflash       arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9XE,SYS_USE_NANDFLASH
include/configs/at91sam9x5ek.h +16 -4
index 82f6b48..5cae6bd 100644
@@ -86,6 +86,7 @@
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DHCP
 #define CONFIG_CMD_NAND
+#define CONFIG_CMD_SF
 
 /* SDRAM */
 #define CONFIG_NR_DRAM_BANKS		1
@@ -96,12 +97,11 @@
 	(CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE)
 
 /* DataFlash */
-#ifdef CONFIG_ATMEL_SPI
-#define CONFIG_CMD_SF
-#define CONFIG_CMD_SPI
+#ifdef CONFIG_CMD_SF
+#define CONFIG_ATMEL_SPI
 #define CONFIG_SPI_FLASH
 #define CONFIG_SPI_FLASH_ATMEL
-#define CONFIG_SYS_MAX_DATAFLASH_BANKS
+#define CONFIG_SF_DEFAULT_SPEED		30000000
 #endif
 
 /* no NOR flash */
@@ -149,6 +149,18 @@
 #define CONFIG_BOOTCOMMAND	"nand read " \
 				"0x22000000 0x200000 0x300000; " \
 				"bootm 0x22000000"
+#else
+#ifdef CONFIG_SYS_USE_SPIFLASH
+/* bootstrap + u-boot + env + linux in spi flash */
+#define CONFIG_ENV_IS_IN_SPI_FLASH
+#define CONFIG_ENV_OFFSET	0x5000
+#define CONFIG_ENV_SIZE		0x3000
+#define CONFIG_ENV_SECT_SIZE	0x1000
+#define CONFIG_ENV_SPI_MAX_HZ	30000000
+#define CONFIG_BOOTCOMMAND	"sf probe 0; " \
+				"sf read 0x22000000 0x100000 0x300000; " \
+				"bootm 0x22000000"
+#endif
 #endif
 
 #define CONFIG_BOOTARGS		"mem=128M console=ttyS0,115200 " \
Signature · 1 line
1.7.9.5
#9 lore raw

PATCH 1/4 spiflash: at25: using common spi flash operation

In reply to Bo Shen

Dear Bo Shen,

Quoted 5 lines · Bo Shen

Using common spi flash operation function to replace private operation funtion

This patch is based on http://patchwork.ozlabs.org/patch/177896/
which has been merged by Mike frysinger

Mike, do you think this is a fix? Should it go into 2012.10? Will you take it?

Quoted 16 lines
---
 drivers/mtd/spi/atmel.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/mtd/spi/atmel.c +2 -0
index 89ebe9d..006f6d5 100644
@@ -518,13 +518,19 @@ struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode)
 			asf->flash.erase = dataflash_erase_p2;
 		}
 
+		asf->flash.page_size = page_size;
+		asf->flash.sector_size = page_size;
 		break;

drivers/mtd/spi/atmel.c struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode) · line 531

Quoted 10 lines
drivers/mtd/spi/atmel.c +4 -2
 
 	case DF_FAMILY_AT26F:
 	case DF_FAMILY_AT26DF:
 		asf->flash.read = spi_flash_cmd_read_fast;
-		asf->flash.write = dataflash_write_p2;
-		asf->flash.erase = dataflash_erase_p2;
+		asf->flash.write = spi_flash_cmd_write_multi;
+		asf->flash.erase = spi_flash_cmd_erase;
+		asf->flash.page_size = page_size;
+		asf->flash.sector_size = 4096;

why do you take fixed value for sector size here?

drivers/mtd/spi/atmel.c struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode) · line 543

Quoted 13 lines
drivers/mtd/spi/atmel.c +2 -1
+		/* clear SPRL# bit for locked flash */
+		spi_flash_cmd_write_status(&asf->flash, 0);
 		break;
 
 	default:
@@ -532,7 +538,6 @@ struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode)
 		goto err;
 	}
 
-	asf->flash.sector_size = page_size;
 	asf->flash.size = page_size * params->pages_per_block
 				* params->blocks_per_sector
 				* params->nr_sectors;

And here you correlate number of sectors with page size ... but we may have page_size != sector_size for some at26 devices, aren't we?

Best regards

Andreas Bie?mann

#10 lore raw

PATCH 1/4 spiflash: at25: using common spi flash operation

Quoted 9 lines · On Tuesday 21 August 2012 07:26:27 Andreas Bie?mann wrote:
Quoted 5 lines · Bo Shen

Using common spi flash operation function to replace private operation funtion

This patch is based on http://patchwork.ozlabs.org/patch/177896/
which has been merged by Mike frysinger

Mike, do you think this is a fix? Should it go into 2012.10? Will you take it?

i'll take care of merging the changes to drivers/mtd/spi/*, but always happy to see people help to review the changes :).

especially with the atmel driver as their dataflashes have the unique command set :(.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120821/aa857c4d/attachment.pgp>

author
#11 lore raw

PATCH 1/4 spiflash: at25: using common spi flash operation

Hi Mike,

Quoted 8 lines · Mike Frysinger
Quoted 7 lines · On Tuesday 21 August 2012 07:26:27 Andreas Bie?mann wrote:
Quoted 5 lines · Bo Shen

Using common spi flash operation function to replace private operation funtion

This patch is based on http://patchwork.ozlabs.org/patch/177896/
which has been merged by Mike frysinger

Quoted 8 lines
Quoted 2 lines

Mike, do you think this is a fix? Should it go into 2012.10? Will you take it?

i'll take care of merging the changes to drivers/mtd/spi/*, but always happy to see people help to review the changes :).

especially with the atmel driver as their dataflashes have the unique command set :(.

For atmel at25 and at26 series spi flash, they can support standard spi flash operation. So, this patch intent to use common spi flash operation.

Will this patch be took?

Quoted 2 lines

-mike

author
#12 lore raw

PATCH 1/4 spiflash: at25: using common spi flash operation

In reply to Andreas Bießmann

Hi Andreas,

Quoted 29 lines · Andreas Bie?mann

Dear Bo Shen,

Quoted 5 lines · Bo Shen

Using common spi flash operation function to replace private operation funtion

This patch is based on http://patchwork.ozlabs.org/patch/177896/
which has been merged by Mike frysinger

Mike, do you think this is a fix? Should it go into 2012.10? Will you take it?

Quoted 17 lines
---
  drivers/mtd/spi/atmel.c |   11 ++++++++---
  1 file changed, 8 insertions(+), 3 deletions(-)
drivers/mtd/spi/atmel.c +2 -0
index 89ebe9d..006f6d5 100644
@@ -518,13 +518,19 @@ struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode)
  			asf->flash.erase = dataflash_erase_p2;
  		}
 
+		asf->flash.page_size = page_size;
+		asf->flash.sector_size = page_size;
  		break;
 
Quoted 11 lines

drivers/mtd/spi/atmel.c struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode) · line 531

Quoted 9 lines
drivers/mtd/spi/atmel.c +4 -2
  	case DF_FAMILY_AT26F:
  	case DF_FAMILY_AT26DF:
  		asf->flash.read = spi_flash_cmd_read_fast;
-		asf->flash.write = dataflash_write_p2;
-		asf->flash.erase = dataflash_erase_p2;
+		asf->flash.write = spi_flash_cmd_write_multi;
+		asf->flash.erase = spi_flash_cmd_erase;
+		asf->flash.page_size = page_size;
+		asf->flash.sector_size = 4096;

why do you take fixed value for sector size here?

The fixed number fit for both AT25 and AT26 serials. So, I take it.

Actually, we can calculate it as:
asf->flash.sector_size = page_size * params->pages_per_block * params->blocks_per_sector

So, may I need to change it?

Quoted 10 lines
Quoted 10 lines
drivers/mtd/spi/atmel.c +2 -0
+		/* clear SPRL# bit for locked flash */
+		spi_flash_cmd_write_status(&asf->flash, 0);
  		break;
 
  	default:
@@ -532,7 +538,6 @@ struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode)
  		goto err;
  	}
 
Quoted 7 lines

drivers/mtd/spi/atmel.c struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode) · line 543

Quoted 4 lines
drivers/mtd/spi/atmel.c +0 -1
-	asf->flash.sector_size = page_size;
  	asf->flash.size = page_size * params->pages_per_block
  				* params->blocks_per_sector
  				* params->nr_sectors;

And here you correlate number of sectors with page size ... but we may have page_size != sector_size for some at26 devices, aren't we?

This is from old driver and this line is moved away.
For at26 devices, it is used the fixed number 4096 for sector size. Please take following as a reference.
---------------------------------------------

    	case DF_FAMILY_AT26F:
	case DF_FAMILY_AT26DF:
    		asf->flash.read = spi_flash_cmd_read_fast;

- asf->flash.write = dataflash_write_p2;
- asf->flash.erase = dataflash_erase_p2;
+ asf->flash.write = spi_flash_cmd_write_multi;
+ asf->flash.erase = spi_flash_cmd_erase;
+ asf->flash.page_size = page_size;
+ asf->flash.sector_size = 4096;
---------------------------------------------

Quoted 5 lines

Best regards

Andreas Bie?mann

#13 lore raw

PATCH 1/4 spiflash: at25: using common spi flash operation

Dear Bo Shen,

Quoted 45 lines · Bo Shen

Hi Andreas,

Quoted 30 lines · Andreas Bie?mann

Dear Bo Shen,

Quoted 5 lines · Bo Shen

Using common spi flash operation function to replace private operation funtion

This patch is based on http://patchwork.ozlabs.org/patch/177896/
which has been merged by Mike frysinger

Mike, do you think this is a fix? Should it go into 2012.10? Will you take it?

Quoted 18 lines
---
  drivers/mtd/spi/atmel.c |   11 ++++++++---
  1 file changed, 8 insertions(+), 3 deletions(-)
drivers/mtd/spi/atmel.c +2 -0
index 89ebe9d..006f6d5 100644
@@ -518,13 +518,19 @@ struct spi_flash *spi_flash_probe_atmel(struct
 spi_slave *spi, u8 *idcode)
              asf->flash.erase = dataflash_erase_p2;
          }
 
+        asf->flash.page_size = page_size;
+        asf->flash.sector_size = page_size;
          break;
 
Quoted 11 lines

drivers/mtd/spi/atmel.c struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode) · line 531

Quoted 9 lines
drivers/mtd/spi/atmel.c +4 -2
      case DF_FAMILY_AT26F:
      case DF_FAMILY_AT26DF:
          asf->flash.read = spi_flash_cmd_read_fast;
-        asf->flash.write = dataflash_write_p2;
-        asf->flash.erase = dataflash_erase_p2;
+        asf->flash.write = spi_flash_cmd_write_multi;
+        asf->flash.erase = spi_flash_cmd_erase;
+        asf->flash.page_size = page_size;
+        asf->flash.sector_size = 4096;

why do you take fixed value for sector size here?

Quoted 3 lines

The fixed number fit for both AT25 and AT26 serials. So, I take it.

Actually, we can calculate it as:

q> asf->flash.sector_size = page_size * params->pages_per_block *

Quoted 2 lines

params->blocks_per_sector
So, may I need to change it?

I got it. The current driver for AT45 is written to only support page erase, therefore the page_size == sector_size.
The AT26 on the other hand will now use the generic API which uses sector erase instead. Therefore we have different values at all, am I right?

The only supported DF of at26 type is currently [1] which in fact has 4KiB erase size. Unfortunately others (at least [2]) have another layout. But this could be adopted if such a chip is supported in the future.

Quoted 32 lines
Quoted 11 lines
Quoted 11 lines
drivers/mtd/spi/atmel.c +2 -0
+        /* clear SPRL# bit for locked flash */
+        spi_flash_cmd_write_status(&asf->flash, 0);
          break;
 

default:

drivers/mtd/spi/atmel.c +0 -0
@@ -532,7 +538,6 @@ struct spi_flash *spi_flash_probe_atmel(struct
 spi_slave *spi, u8 *idcode)
          goto err;
      }
 
Quoted 7 lines
Quoted 4 lines
drivers/mtd/spi/atmel.c +0 -1
-    asf->flash.sector_size = page_size;
      asf->flash.size = page_size * params->pages_per_block
                  * params->blocks_per_sector

* params->nr_sectors;

And here you correlate number of sectors with page size ... but we may have page_size != sector_size for some at26 devices, aren't we?

This is from old driver and this line is moved away.
For at26 devices, it is used the fixed number 4096 for sector size. Please take following as a reference.
---------------------------------------------

       case DF_FAMILY_AT26F:
    case DF_FAMILY_AT26DF:
           asf->flash.read = spi_flash_cmd_read_fast;
 -        asf->flash.write = dataflash_write_p2;
 -        asf->flash.erase = dataflash_erase_p2;
 +        asf->flash.write = spi_flash_cmd_write_multi;
 +        asf->flash.erase = spi_flash_cmd_erase;
 +        asf->flash.page_size = page_size;
 +        asf->flash.sector_size = 4096;
Quoted 1 line

---------------------------------------------

Yea, I got that already. The only thing I asked why you correlate these sector related parameters (blocks_per_sector and nr_sectors) with the page_size.

I think this change is Ok.

@Mike: As I understand you I should take patch #2 to #4 while you will take this one, am I right?

[1] http://www.atmel.com/Images/doc3633.pdf
[2] http://www.atmel.com/Images/doc3495.pdf