[PATCH] SPI FLASH naming conflicts solving

From: akorolev
Date: Fri Jun 01 2007 - 10:20:50 EST


Hi Dawid

I tried to enable SPI flash device in our development platform (Mainstone).
Since the platform driver uses NOR flash device - it includes "include/asm-arm/mach/flash.h" file where the structure "flhash_platform _data" is defined.
The structure with the same name "flhash_platform _data" is also defined in "include/linux/spi/flash.h".
These structures are different - so they cause compile errors.

I attached the fix for this issue. IMHO it's more preferable to resolve issue by minor modification of SPI driver than touching all arm platform drivers.

=============================
diff -aur orig/drivers/mtd/devices/m25p80.c new/drivers/mtd/devices/m25p80.c
--- orig/drivers/mtd/devices/m25p80.c 2007-06-01 19:06:52.000000000 +0400
+++ new/drivers/mtd/devices/m25p80.c 2007-05-10 16:56:15.000000000 +0400
@@ -423,7 +449,7 @@
*/
static int __devinit m25p_probe(struct spi_device *spi)
{
- struct flash_platform_data *data;
+ struct spi_flash_platform_data *data;
struct m25p *flash;
struct flash_info *info;
unsigned i;
diff -aur orig/drivers/mtd/devices/mtd_dataflash.c new/drivers/mtd/devices/mtd_dataflash.c
--- orig/drivers/mtd/devices/mtd_dataflash.c 2007-06-01 19:06:48.000000000 +0400
+++ new/drivers/mtd/devices/mtd_dataflash.c 2007-05-10 14:41:39.000000000 +0400
@@ -457,7 +457,7 @@
{
struct dataflash *priv;
struct mtd_info *device;
- struct flash_platform_data *pdata = spi->dev.platform_data;
+ struct spi_flash_platform_data *pdata = spi->dev.platform_data;

priv = kzalloc(sizeof *priv, GFP_KERNEL);
=============================
Could you please take a look at this. The fix is simple. If you don't complain could you please include it.

Thanks,
Alexey

P/S Also I have a question:
I faced rather strange problem with sending read and write commands to SPI flash. It works Ok if I reverse 32bit SPI FLASH command
I mean - read/write/erase works if to substitute
flash->command[0] = OPCODE_SE;
flash->command[1] = offset >> 16;
flash->command[2] = offset >> 8;
flash->command[3] = offset;
for
flash->command[3] = OPCODE_SE;
flash->command[2] = offset >> 16;
flash->command[1] = offset >> 8;
flash->command[0] = offset;
in file drivers/mtd/devices/m25p80.c

It seems pretty strange and may require more investigation.
I wonder If you have any ideas why it could happen? If anybody tested m25p80.c driver on LittleEndian platforms?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/