wifipineapple-openwrt/package/boot/uboot-lantiq/patches/0008-sf-eon-add-support-for...

44 lines
1.1 KiB
Diff

From 37254e3284f61ea495f73a78b7c8efae983781e2 Mon Sep 17 00:00:00 2001
From: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Date: Wed, 7 Nov 2012 14:10:07 +0100
Subject: sf: eon: add support for 4-byte address mode
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
--- a/drivers/mtd/spi/eon.c
+++ b/drivers/mtd/spi/eon.c
@@ -10,6 +10,8 @@
#include "spi_flash_internal.h"
+#define EN25XX_EN4B 0xb7 /* Enter 4-byte mode */
+
struct eon_spi_flash_params {
u16 idcode;
u16 nr_sectors;
@@ -29,6 +31,13 @@ static const struct eon_spi_flash_params
},
};
+static __maybe_unused int eon_set_4byte_mode(struct spi_flash *flash)
+{
+ struct spi_slave *spi = flash->spi;
+
+ return spi_flash_cmd(spi, EN25XX_EN4B, NULL, 0);
+}
+
int spi_flash_probe_eon(struct spi_flash *flash, u8 *idcode)
{
const struct eon_spi_flash_params *params;
@@ -57,5 +66,10 @@ int spi_flash_probe_eon(struct spi_flash
flash->size = 256 * 16
* params->nr_sectors;
+#ifdef CONFIG_SPI_FLASH_4BYTE_MODE
+ if (flash->size > (1 << 24))
+ flash->set_4byte_mode = eon_set_4byte_mode;
+#endif
+
return 1;
}