diff options
5 files changed, 19 insertions, 294 deletions
diff --git a/meta-oe/recipes-bsp/flashrom/flashrom/0001-ch341a_spi-Avoid-deprecated-libusb-functions.patch b/meta-oe/recipes-bsp/flashrom/flashrom/0001-ch341a_spi-Avoid-deprecated-libusb-functions.patch deleted file mode 100644 index df8028627a..0000000000 --- a/meta-oe/recipes-bsp/flashrom/flashrom/0001-ch341a_spi-Avoid-deprecated-libusb-functions.patch +++ /dev/null | |||
| @@ -1,39 +0,0 @@ | |||
| 1 | From e5f68189ab3602b1042cc8423fd6a3a23abd5455 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Alex James <theracermaster@gmail.com> | ||
| 3 | Date: Sat, 14 Apr 2018 22:59:57 -0500 | ||
| 4 | Subject: [PATCH] ch341a_spi: Avoid deprecated libusb functions | ||
| 5 | |||
| 6 | libusb 1.0.22 marked libusb_set_debug as deprecated. For such versions | ||
| 7 | of libusb, use libusb_set_option instead. | ||
| 8 | |||
| 9 | Change-Id: Ib71ebe812316eaf49136979a942a946ef9e4d487 | ||
| 10 | Signed-off-by: Alex James <theracermaster@gmail.com> | ||
| 11 | Reviewed-on: https://review.coreboot.org/25681 | ||
| 12 | Tested-by: Nico Huber <nico.h@gmx.de> | ||
| 13 | Reviewed-by: David Hendricks <david.hendricks@gmail.com> | ||
| 14 | --- | ||
| 15 | Upstream-Status: Backport | ||
| 16 | ch341a_spi.c | 7 ++++++- | ||
| 17 | 1 file changed, 6 insertions(+), 1 deletion(-) | ||
| 18 | |||
| 19 | diff --git a/ch341a_spi.c b/ch341a_spi.c | ||
| 20 | index 6eb2804..d880510 100644 | ||
| 21 | --- a/ch341a_spi.c | ||
| 22 | +++ b/ch341a_spi.c | ||
| 23 | @@ -444,7 +444,12 @@ int ch341a_spi_init(void) | ||
| 24 | return -1; | ||
| 25 | } | ||
| 26 | |||
| 27 | - libusb_set_debug(NULL, 3); // Enable information, warning and error messages (only). | ||
| 28 | + /* Enable information, warning, and error messages (only). */ | ||
| 29 | +#if LIBUSB_API_VERSION < 0x01000106 | ||
| 30 | + libusb_set_debug(NULL, 3); | ||
| 31 | +#else | ||
| 32 | + libusb_set_option(NULL, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_INFO); | ||
| 33 | +#endif | ||
| 34 | |||
| 35 | uint16_t vid = devs_ch341a_spi[0].vendor_id; | ||
| 36 | uint16_t pid = devs_ch341a_spi[0].device_id; | ||
| 37 | -- | ||
| 38 | 2.17.0 | ||
| 39 | |||
diff --git a/meta-oe/recipes-bsp/flashrom/flashrom/0001-platform-Add-riscv-to-known-platforms.patch b/meta-oe/recipes-bsp/flashrom/flashrom/0001-platform-Add-riscv-to-known-platforms.patch deleted file mode 100644 index 7ba69a9176..0000000000 --- a/meta-oe/recipes-bsp/flashrom/flashrom/0001-platform-Add-riscv-to-known-platforms.patch +++ /dev/null | |||
| @@ -1,37 +0,0 @@ | |||
| 1 | From d2a28dcdbd1051d2f48320e2eda3393581fe0519 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 17 Mar 2018 23:08:29 -0700 | ||
| 4 | Subject: [PATCH] platform: Add riscv to known platforms | ||
| 5 | |||
| 6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 7 | --- | ||
| 8 | Upstream-Status: Submitted [https://review.coreboot.org/#/c/flashrom/+/25260/] | ||
| 9 | platform.h | 5 ++++- | ||
| 10 | 1 file changed, 4 insertions(+), 1 deletion(-) | ||
| 11 | |||
| 12 | diff --git a/platform.h b/platform.h | ||
| 13 | index b2fdcd0..2cadbb3 100644 | ||
| 14 | --- a/platform.h | ||
| 15 | +++ b/platform.h | ||
| 16 | @@ -69,6 +69,9 @@ | ||
| 17 | #elif defined (__m68k__) | ||
| 18 | #define __FLASHROM_ARCH__ "m68k" | ||
| 19 | #define IS_M68K 1 | ||
| 20 | +#elif defined (__riscv) | ||
| 21 | + #define __FLASHROM_ARCH__ "riscv" | ||
| 22 | + #define IS_RISCV 1 | ||
| 23 | #elif defined (__sh__) | ||
| 24 | #define __FLASHROM_ARCH__ "sh" | ||
| 25 | #define IS_SH 1 | ||
| 26 | @@ -77,7 +80,7 @@ | ||
| 27 | #define IS_S390 1 | ||
| 28 | #endif | ||
| 29 | |||
| 30 | -#if !(IS_X86 || IS_MIPS || IS_PPC || IS_ARM || IS_SPARC || IS_ALPHA || IS_HPPA || IS_M68K || IS_SH || IS_S390) | ||
| 31 | +#if !(IS_X86 || IS_MIPS || IS_PPC || IS_ARM || IS_SPARC || IS_ALPHA || IS_HPPA || IS_M68K || IS_RISCV || IS_SH || IS_S390) | ||
| 32 | #error Unknown architecture | ||
| 33 | #endif | ||
| 34 | |||
| 35 | -- | ||
| 36 | 2.16.2 | ||
| 37 | |||
diff --git a/meta-oe/recipes-bsp/flashrom/flashrom/sst26.patch b/meta-oe/recipes-bsp/flashrom/flashrom/sst26.patch deleted file mode 100644 index 46a01529f7..0000000000 --- a/meta-oe/recipes-bsp/flashrom/flashrom/sst26.patch +++ /dev/null | |||
| @@ -1,198 +0,0 @@ | |||
| 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-bsp/flashrom/flashrom_1.0.bb b/meta-oe/recipes-bsp/flashrom/flashrom_1.0.bb deleted file mode 100644 index 1c17246681..0000000000 --- a/meta-oe/recipes-bsp/flashrom/flashrom_1.0.bb +++ /dev/null | |||
| @@ -1,20 +0,0 @@ | |||
| 1 | DESCRIPTION = "flashrom is a utility for identifying, reading, writing, verifying and erasing flash chips" | ||
| 2 | LICENSE = "GPLv2" | ||
| 3 | HOMEPAGE = "http://flashrom.org" | ||
| 4 | |||
| 5 | LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" | ||
| 6 | DEPENDS = "pciutils libusb libusb-compat" | ||
| 7 | |||
| 8 | SRC_URI = "https://download.flashrom.org/releases/flashrom-${PV}.tar.bz2 \ | ||
| 9 | file://sst26.patch \ | ||
| 10 | file://0001-platform-Add-riscv-to-known-platforms.patch \ | ||
| 11 | file://0001-ch341a_spi-Avoid-deprecated-libusb-functions.patch \ | ||
| 12 | " | ||
| 13 | SRC_URI[md5sum] = "42d999990c735d88653627cefcc13b9a" | ||
| 14 | SRC_URI[sha256sum] = "3702fa215ba5fb5af8e54c852d239899cfa1389194c1e51cb2a170c4dc9dee64" | ||
| 15 | |||
| 16 | inherit pkgconfig | ||
| 17 | |||
| 18 | do_install() { | ||
| 19 | oe_runmake PREFIX=${prefix} DESTDIR=${D} install | ||
| 20 | } | ||
diff --git a/meta-oe/recipes-bsp/flashrom/flashrom_1.1.bb b/meta-oe/recipes-bsp/flashrom/flashrom_1.1.bb new file mode 100644 index 0000000000..074a1a5f69 --- /dev/null +++ b/meta-oe/recipes-bsp/flashrom/flashrom_1.1.bb | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | DESCRIPTION = "flashrom is a utility for identifying, reading, writing, verifying and erasing flash chips" | ||
| 2 | LICENSE = "GPLv2" | ||
| 3 | HOMEPAGE = "http://flashrom.org" | ||
| 4 | |||
| 5 | LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" | ||
| 6 | DEPENDS = "pciutils libusb libusb-compat" | ||
| 7 | |||
| 8 | SRC_URI = "https://download.flashrom.org/releases/flashrom-v${PV}.tar.bz2 \ | ||
| 9 | " | ||
| 10 | SRC_URI[md5sum] = "91bab6c072e38a493bb4eb673e4fe0d6" | ||
| 11 | SRC_URI[sha256sum] = "aeada9c70c22421217c669356180c0deddd0b60876e63d2224e3260b90c14e19" | ||
| 12 | |||
| 13 | S = "${WORKDIR}/flashrom-v${PV}" | ||
| 14 | |||
| 15 | inherit pkgconfig | ||
| 16 | |||
| 17 | do_install() { | ||
| 18 | oe_runmake PREFIX=${prefix} DESTDIR=${D} install | ||
| 19 | } | ||
