summaryrefslogtreecommitdiff
path: root/package/boot/uboot-lantiq/patches/0008-sf-eon-add-support-for-4-byte-address-mode.patch
blob: c037a866dd298d0bd0b7167326d1fc3c6b730fa4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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;
 }