summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/recipes-extended/flashrom/flashrom/0001-Fix-compilation-on-aarch64.patch62
-rw-r--r--meta-oe/recipes-extended/flashrom/flashrom/0001-ichspi.c-Fix-build-with-clang.patch29
-rw-r--r--meta-oe/recipes-extended/flashrom/flashrom/0001-spi-Define-_XOPEN_SOURCE-to-enable-ffs-libc-API.patch28
-rw-r--r--meta-oe/recipes-extended/flashrom/flashrom/0002-Disable-Wtautological-pointer-compare-when-using-cla.patch35
-rw-r--r--meta-oe/recipes-extended/flashrom/flashrom/0003-remove-duplicate-const-qualifiers.patch71
-rw-r--r--meta-oe/recipes-extended/flashrom/flashrom/sst26.patch198
-rw-r--r--meta-oe/recipes-extended/flashrom/flashrom_0.9.6.1.bb22
-rw-r--r--meta-oe/recipes-extended/flashrom/flashrom_0.9.9.bb19
8 files changed, 245 insertions, 219 deletions
diff --git a/meta-oe/recipes-extended/flashrom/flashrom/0001-Fix-compilation-on-aarch64.patch b/meta-oe/recipes-extended/flashrom/flashrom/0001-Fix-compilation-on-aarch64.patch
deleted file mode 100644
index 6c2f64ed97..0000000000
--- a/meta-oe/recipes-extended/flashrom/flashrom/0001-Fix-compilation-on-aarch64.patch
+++ /dev/null
@@ -1,62 +0,0 @@
1From d9e4dc750dc45e42b482d744829254a3672c11b3 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 19 Oct 2016 00:24:08 +0000
4Subject: [PATCH 1/3] Fix compilation on aarch64
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 arch.h | 2 +-
9 hwaccess.c | 2 +-
10 hwaccess.h | 6 +++---
11 3 files changed, 5 insertions(+), 5 deletions(-)
12
13Index: flashrom-0.9.6.1/arch.h
14===================================================================
15--- flashrom-0.9.6.1.orig/arch.h
16+++ flashrom-0.9.6.1/arch.h
17@@ -27,7 +27,7 @@
18 #define __FLASHROM_ARCH__ "mips"
19 #elif defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || defined(__ppc64__)
20 #define __FLASHROM_ARCH__ "ppc"
21-#elif defined(__arm__)
22+#elif defined(__arm__) || defined(__aarch64__)
23 #define __FLASHROM_ARCH__ "arm"
24 #endif
25 __FLASHROM_ARCH__
26Index: flashrom-0.9.6.1/hwaccess.c
27===================================================================
28--- flashrom-0.9.6.1.orig/hwaccess.c
29+++ flashrom-0.9.6.1/hwaccess.c
30@@ -121,7 +121,7 @@ int rget_io_perms(void)
31 return 0;
32 }
33
34-#elif defined (__arm__)
35+#elif defined (__arm__) || defined (__aarch64__)
36
37 static inline void sync_primitive(void)
38 {
39Index: flashrom-0.9.6.1/hwaccess.h
40===================================================================
41--- flashrom-0.9.6.1.orig/hwaccess.h
42+++ flashrom-0.9.6.1/hwaccess.h
43@@ -68,8 +68,8 @@
44 #error Little-endian PowerPC #defines are unknown
45 #endif
46
47-#elif defined (__arm__)
48-#if defined (__ARMEL__)
49+#elif defined (__arm__) || defined (__aarch64__)
50+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
51 #define __FLASHROM_LITTLE_ENDIAN__ 1
52 #else
53 #error Big-endian ARM #defines are unknown
54@@ -337,7 +337,7 @@ int libpayload_wrmsr(int addr, msr_t msr
55
56 /* PCI port I/O is not yet implemented on MIPS. */
57
58-#elif defined(__arm__)
59+#elif defined(__arm__) || defined (__aarch64__)
60
61 /* Non memory mapped I/O is not supported on ARM. */
62
diff --git a/meta-oe/recipes-extended/flashrom/flashrom/0001-ichspi.c-Fix-build-with-clang.patch b/meta-oe/recipes-extended/flashrom/flashrom/0001-ichspi.c-Fix-build-with-clang.patch
deleted file mode 100644
index ff16f0b113..0000000000
--- a/meta-oe/recipes-extended/flashrom/flashrom/0001-ichspi.c-Fix-build-with-clang.patch
+++ /dev/null
@@ -1,29 +0,0 @@
1From a2f603c54013cd0b04bb0103dc615644f315d5e8 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 15 Nov 2016 17:39:24 +0000
4Subject: [PATCH] ichspi.c: Fix build with clang
5
6ichspi.c:1130:24: error: duplicate 'const' declaration specifier [-Werror,-Wduplicate-decl-specifier]
7 static const uint32_t const dec_berase[4] = {
8 ^
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 ichspi.c | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14diff --git a/ichspi.c b/ichspi.c
15index 0223ae3..e47aebd 100644
16--- a/ichspi.c
17+++ b/ichspi.c
18@@ -1127,7 +1127,7 @@ static void ich_hwseq_set_addr(uint32_t addr)
19 static uint32_t ich_hwseq_get_erase_block_size(unsigned int addr)
20 {
21 uint8_t enc_berase;
22- static const uint32_t const dec_berase[4] = {
23+ static const uint32_t dec_berase[4] = {
24 256,
25 4 * 1024,
26 8 * 1024,
27--
281.9.1
29
diff --git a/meta-oe/recipes-extended/flashrom/flashrom/0001-spi-Define-_XOPEN_SOURCE-to-enable-ffs-libc-API.patch b/meta-oe/recipes-extended/flashrom/flashrom/0001-spi-Define-_XOPEN_SOURCE-to-enable-ffs-libc-API.patch
new file mode 100644
index 0000000000..4170fefd2a
--- /dev/null
+++ b/meta-oe/recipes-extended/flashrom/flashrom/0001-spi-Define-_XOPEN_SOURCE-to-enable-ffs-libc-API.patch
@@ -0,0 +1,28 @@
1From 7c65a465a3ddeb7afb9a7c49d010ae7e5d5b1ad1 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 18 Jul 2017 20:25:49 -0700
4Subject: [PATCH] spi: Define _XOPEN_SOURCE to enable ffs() libc API
5
6musl exposes this issue
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 spi.c | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/spi.c b/spi.c
14index 894f73f..aeb6518 100644
15--- a/spi.c
16+++ b/spi.c
17@@ -21,7 +21,7 @@
18 /*
19 * Contains the generic SPI framework
20 */
21-
22+#define _XOPEN_SOURCE
23 #include <strings.h>
24 #include <string.h>
25 #include "flash.h"
26--
272.13.3
28
diff --git a/meta-oe/recipes-extended/flashrom/flashrom/0002-Disable-Wtautological-pointer-compare-when-using-cla.patch b/meta-oe/recipes-extended/flashrom/flashrom/0002-Disable-Wtautological-pointer-compare-when-using-cla.patch
deleted file mode 100644
index aec11bffae..0000000000
--- a/meta-oe/recipes-extended/flashrom/flashrom/0002-Disable-Wtautological-pointer-compare-when-using-cla.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1From 9be0d152dfe8ac0f9b665d61aeb3f99dae533e0f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 19 Oct 2016 00:25:09 +0000
4Subject: [PATCH 2/3] Disable Wtautological-pointer-compare when using clang
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 flashrom.c | 4 ++++
9 1 file changed, 4 insertions(+)
10
11diff --git a/flashrom.c b/flashrom.c
12index 04e9934..bf49104 100644
13--- a/flashrom.c
14+++ b/flashrom.c
15@@ -1569,6 +1569,9 @@ int selfcheck(void)
16 * For 'flashchips' we check the first element to be non-null. In the
17 * other cases there exist use cases where the first element can be
18 * null. */
19+#pragma clang diagnostic push
20+#pragma clang diagnostic ignored "-Wtautological-pointer-compare"
21+
22 if (flashchips == NULL || flashchips[0].vendor == NULL) {
23 msg_gerr("Flashchips table miscompilation!\n");
24 ret = 1;
25@@ -1602,6 +1605,7 @@ int selfcheck(void)
26 msg_gerr("Known laptops table does not exist!\n");
27 ret = 1;
28 }
29+#pragma clang diagnostic pop
30 #endif
31 return ret;
32 }
33--
341.9.1
35
diff --git a/meta-oe/recipes-extended/flashrom/flashrom/0003-remove-duplicate-const-qualifiers.patch b/meta-oe/recipes-extended/flashrom/flashrom/0003-remove-duplicate-const-qualifiers.patch
deleted file mode 100644
index 99283d37fd..0000000000
--- a/meta-oe/recipes-extended/flashrom/flashrom/0003-remove-duplicate-const-qualifiers.patch
+++ /dev/null
@@ -1,71 +0,0 @@
1From 42ec9bd51e60aa38fe6e78f644e742d6989b6683 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 19 Oct 2016 00:25:23 +0000
4Subject: [PATCH 3/3] remove duplicate const qualifiers
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 bitbang_spi.c | 12 ++++++------
9 dummyflasher.c | 2 +-
10 2 files changed, 7 insertions(+), 7 deletions(-)
11
12diff --git a/bitbang_spi.c b/bitbang_spi.c
13index 11d2de1..508cf45 100644
14--- a/bitbang_spi.c
15+++ b/bitbang_spi.c
16@@ -26,33 +26,33 @@
17 #include "spi.h"
18
19 /* Note that CS# is active low, so val=0 means the chip is active. */
20-static void bitbang_spi_set_cs(const const struct bitbang_spi_master *master, int val)
21+static void bitbang_spi_set_cs(const struct bitbang_spi_master *master, int val)
22 {
23 master->set_cs(val);
24 }
25
26-static void bitbang_spi_set_sck(const const struct bitbang_spi_master *master, int val)
27+static void bitbang_spi_set_sck(const struct bitbang_spi_master *master, int val)
28 {
29 master->set_sck(val);
30 }
31
32-static void bitbang_spi_set_mosi(const const struct bitbang_spi_master *master, int val)
33+static void bitbang_spi_set_mosi(const struct bitbang_spi_master *master, int val)
34 {
35 master->set_mosi(val);
36 }
37
38-static int bitbang_spi_get_miso(const const struct bitbang_spi_master *master)
39+static int bitbang_spi_get_miso(const struct bitbang_spi_master *master)
40 {
41 return master->get_miso();
42 }
43
44-static void bitbang_spi_request_bus(const const struct bitbang_spi_master *master)
45+static void bitbang_spi_request_bus(const struct bitbang_spi_master *master)
46 {
47 if (master->request_bus)
48 master->request_bus();
49 }
50
51-static void bitbang_spi_release_bus(const const struct bitbang_spi_master *master)
52+static void bitbang_spi_release_bus(const struct bitbang_spi_master *master)
53 {
54 if (master->release_bus)
55 master->release_bus();
56diff --git a/dummyflasher.c b/dummyflasher.c
57index 66d0df0..d0de41c 100644
58--- a/dummyflasher.c
59+++ b/dummyflasher.c
60@@ -66,7 +66,7 @@ int spi_ignorelist_size = 0;
61 static uint8_t emu_status = 0;
62
63 /* A legit complete SFDP table based on the MX25L6436E (rev. 1.8) datasheet. */
64-static const uint8_t const sfdp_table[] = {
65+static const uint8_t sfdp_table[] = {
66 0x53, 0x46, 0x44, 0x50, // @0x00: SFDP signature
67 0x00, 0x01, 0x01, 0xFF, // @0x04: revision 1.0, 2 headers
68 0x00, 0x00, 0x01, 0x09, // @0x08: JEDEC SFDP header rev. 1.0, 9 DW long
69--
701.9.1
71
diff --git a/meta-oe/recipes-extended/flashrom/flashrom/sst26.patch b/meta-oe/recipes-extended/flashrom/flashrom/sst26.patch
new file mode 100644
index 0000000000..46a01529f7
--- /dev/null
+++ b/meta-oe/recipes-extended/flashrom/flashrom/sst26.patch
@@ -0,0 +1,198 @@
1--- flashrom-0.9.9.orig/chipdrivers.h
2+++ flashrom-0.9.9/chipdrivers.h
3@@ -103,6 +103,7 @@
4 int spi_prettyprint_status_register_sst25(struct flashctx *flash);
5 int spi_prettyprint_status_register_sst25vf016(struct flashctx *flash);
6 int spi_prettyprint_status_register_sst25vf040b(struct flashctx *flash);
7+int spi_disable_blockprotect_sst26_global_unprotect(struct flashctx *flash);
8
9 /* sfdp.c */
10 int probe_spi_sfdp(struct flashctx *flash);
11--- flashrom-0.9.9.orig/flashchips.c
12+++ flashrom-0.9.9/flashchips.c
13@@ -12564,6 +12564,120 @@
14
15 {
16 .vendor = "SST",
17+ .name = "SST26VF016B(A)",
18+ .bustype = BUS_SPI,
19+ .manufacture_id = SST_ID,
20+ .model_id = SST_SST26VF016B,
21+ .total_size = 2048,
22+ .page_size = 256,
23+ .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP,
24+ .tested = TEST_OK_PREW,
25+ .probe = probe_spi_rdid,
26+ .probe_timing = TIMING_ZERO,
27+ .block_erasers =
28+ {
29+ {
30+ .eraseblocks = { {4 * 1024, 512} },
31+ .block_erase = spi_block_erase_20,
32+ }, {
33+ .eraseblocks = {
34+ {8 * 1024, 4},
35+ {32 * 1024, 1},
36+ {64 * 1024, 30},
37+ {32 * 1024, 1},
38+ {8 * 1024, 4},
39+ },
40+ .block_erase = spi_block_erase_d8,
41+ }, {
42+ .eraseblocks = { {2 * 1024 * 1024, 1} },
43+ .block_erase = spi_block_erase_c7,
44+ },
45+ },
46+ .printlock = spi_prettyprint_status_register_plain, /* TODO: improve */
47+ .unlock = spi_disable_blockprotect_sst26_global_unprotect,
48+ .write = spi_chip_write_256, /* Multi I/O supported */
49+ .read = spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
50+ .voltage = {2700, 3600},
51+ },
52+ {
53+ .vendor = "SST",
54+ .name = "SST26VF032B(A)",
55+ .bustype = BUS_SPI,
56+ .manufacture_id = SST_ID,
57+ .model_id = SST_SST26VF032B,
58+ .total_size = 4096,
59+ .page_size = 256,
60+ .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP,
61+ .tested = TEST_UNTESTED,
62+ .probe = probe_spi_rdid,
63+ .probe_timing = TIMING_ZERO,
64+ .block_erasers =
65+ {
66+ {
67+ .eraseblocks = { {4 * 1024, 1024} },
68+ .block_erase = spi_block_erase_20,
69+ }, {
70+ .eraseblocks = {
71+ {8 * 1024, 4},
72+ {32 * 1024, 1},
73+ {64 * 1024, 62},
74+ {32 * 1024, 1},
75+ {8 * 1024, 4},
76+ },
77+ .block_erase = spi_block_erase_d8,
78+ }, {
79+ .eraseblocks = { {4 * 1024 * 1024, 1} },
80+ .block_erase = spi_block_erase_c7,
81+ },
82+ },
83+ .printlock = spi_prettyprint_status_register_plain, /* TODO: improve */
84+ .unlock = spi_disable_blockprotect_sst26_global_unprotect,
85+ .write = spi_chip_write_256, /* Multi I/O supported */
86+ .read = spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
87+ .voltage = {2700, 3600},
88+ },
89+
90+
91+ {
92+ .vendor = "SST",
93+ .name = "SST26VF064B(A)",
94+ .bustype = BUS_SPI,
95+ .manufacture_id = SST_ID,
96+ .model_id = SST_SST26VF064B,
97+ .total_size = 8192,
98+ .page_size = 256,
99+ .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP,
100+ .tested = TEST_OK_PREW,
101+ .probe = probe_spi_rdid,
102+ .probe_timing = TIMING_ZERO,
103+ .block_erasers =
104+ {
105+ {
106+ .eraseblocks = { {4 * 1024, 2048} },
107+ .block_erase = spi_block_erase_20,
108+ }, {
109+ .eraseblocks = {
110+ {8 * 1024, 4},
111+ {32 * 1024, 1},
112+ {64 * 1024, 126},
113+ {32 * 1024, 1},
114+ {8 * 1024, 4},
115+ },
116+ .block_erase = spi_block_erase_d8,
117+ }, {
118+ .eraseblocks = { {8 * 1024 * 1024, 1} },
119+ .block_erase = spi_block_erase_c7,
120+ },
121+ },
122+ .printlock = spi_prettyprint_status_register_plain, /* TODO: improve */
123+ .unlock = spi_disable_blockprotect_sst26_global_unprotect,
124+ .write = spi_chip_write_256, /* Multi I/O supported */
125+ .read = spi_chip_read, /* Fast read (0x0B) and multi I/O supported */
126+ .voltage = {2700, 3600},
127+ },
128+
129+ {
130+ .vendor = "SST",
131 .name = "SST25WF512",
132 .bustype = BUS_SPI,
133 .manufacture_id = SST_ID,
134--- flashrom-0.9.9.orig/flashchips.h
135+++ flashrom-0.9.9/flashchips.h
136@@ -697,6 +697,8 @@
137 #define SST_SST25VF064C 0x254B
138 #define SST_SST26VF016 0x2601
139 #define SST_SST26VF032 0x2602
140+#define SST_SST26VF016B 0x2641
141+#define SST_SST26VF032B 0x2642
142 #define SST_SST26VF064B 0x2643
143 #define SST_SST27SF512 0xA4
144 #define SST_SST27SF010 0xA5
145--- flashrom-0.9.9.orig/linux_spi.c
146+++ flashrom-0.9.9/linux_spi.c
147@@ -141,6 +141,16 @@
148 return 0;
149 }
150
151+static void print_hex(const char *msg, const void *buf, size_t len)
152+{
153+ size_t i;
154+ msg_pspew("%s:\n", msg);
155+ for (i = 0; i < len; i++) {
156+ msg_pspew(" %02x", ((uint8_t *)buf)[i]);
157+ }
158+ msg_pspew("\n");
159+}
160+
161 static int linux_spi_send_command(struct flashctx *flash, unsigned int writecnt,
162 unsigned int readcnt,
163 const unsigned char *txbuf,
164@@ -172,10 +182,12 @@
165 else
166 iocontrol_code = SPI_IOC_MESSAGE(2);
167
168+ print_hex("Write", txbuf, writecnt);
169 if (ioctl(fd, iocontrol_code, msg) == -1) {
170 msg_cerr("%s: ioctl: %s\n", __func__, strerror(errno));
171 return -1;
172 }
173+ if (readcnt) print_hex("Got", rxbuf, readcnt);
174 return 0;
175 }
176
177--- flashrom-0.9.9.orig/spi25_statusreg.c
178+++ flashrom-0.9.9/spi25_statusreg.c
179@@ -196,6 +196,19 @@
180 return spi_disable_blockprotect_generic(flash, 0x3C, 0, 0, 0xFF);
181 }
182
183+int spi_disable_blockprotect_sst26_global_unprotect(struct flashctx *flash)
184+{
185+ int result = spi_write_enable(flash);
186+ if (result)
187+ return result;
188+
189+ static const unsigned char cmd[] = { 0x98 }; /* ULBPR */
190+ result = spi_send_command(flash, sizeof(cmd), 0, cmd, NULL);
191+ if (result)
192+ msg_cerr("ULBPR failed\n");
193+ return result;
194+}
195+
196 /* A common block protection disable that tries to unset the status register bits masked by 0x0C (BP0-1) and
197 * protected/locked by bit #7. Useful when bits 4-5 may be non-0). */
198 int spi_disable_blockprotect_bp1_srwd(struct flashctx *flash)
diff --git a/meta-oe/recipes-extended/flashrom/flashrom_0.9.6.1.bb b/meta-oe/recipes-extended/flashrom/flashrom_0.9.6.1.bb
deleted file mode 100644
index 0edc68820c..0000000000
--- a/meta-oe/recipes-extended/flashrom/flashrom_0.9.6.1.bb
+++ /dev/null
@@ -1,22 +0,0 @@
1DESCRIPTION = "flashrom is a utility for identifying, reading, writing, verifying and erasing flash chips"
2LICENSE = "GPLv2"
3HOMEPAGE = "http://flashrom.org"
4
5LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
6DEPENDS = "pciutils"
7
8SRC_URI = "http://download.flashrom.org/releases/flashrom-${PV}.tar.bz2 \
9 file://0001-Fix-compilation-on-aarch64.patch \
10 file://0002-Disable-Wtautological-pointer-compare-when-using-cla.patch \
11 file://0003-remove-duplicate-const-qualifiers.patch \
12 file://0001-ichspi.c-Fix-build-with-clang.patch \
13 "
14
15SRC_URI[md5sum] = "407e836c0a2b17ec76583cb6809f65e5"
16SRC_URI[sha256sum] = "6f7b588cce74c90b4fe9c9c794de105de76e0323442fb5770b1aeab81e9d560a"
17
18CFLAGS += "-Wno-error=unknown-pragmas"
19
20do_install() {
21 oe_runmake PREFIX=${prefix} DESTDIR=${D} install
22}
diff --git a/meta-oe/recipes-extended/flashrom/flashrom_0.9.9.bb b/meta-oe/recipes-extended/flashrom/flashrom_0.9.9.bb
new file mode 100644
index 0000000000..1bd97929c7
--- /dev/null
+++ b/meta-oe/recipes-extended/flashrom/flashrom_0.9.9.bb
@@ -0,0 +1,19 @@
1DESCRIPTION = "flashrom is a utility for identifying, reading, writing, verifying and erasing flash chips"
2LICENSE = "GPLv2"
3HOMEPAGE = "http://flashrom.org"
4
5LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
6DEPENDS = "pciutils libusb"
7
8SRC_URI = "http://download.flashrom.org/releases/flashrom-${PV}.tar.bz2 \
9 file://0001-spi-Define-_XOPEN_SOURCE-to-enable-ffs-libc-API.patch \
10 file://sst26.patch \
11 "
12SRC_URI[md5sum] = "aab9c98925d9cfb5ffb28b67a6112530"
13SRC_URI[sha256sum] = "cb3156b0f63eb192024b76c0814135930297aac41f80761a5d293de769783c45"
14
15inherit pkgconfig
16
17do_install() {
18 oe_runmake PREFIX=${prefix} DESTDIR=${D} install
19}