PoC: testfw: Check that SPI flash is available in firmware mode

This commit is contained in:
Mikael Ågren 2025-02-03 09:38:53 +01:00
parent 52694b5c4f
commit 3665c3e245
No known key found for this signature in database
GPG Key ID: E02DA3D397792C46
3 changed files with 15 additions and 3 deletions

View File

@ -147,7 +147,9 @@ TESTFW_OBJS = \
$(P)/fw/testfw/main.o \ $(P)/fw/testfw/main.o \
$(P)/fw/testfw/start.o \ $(P)/fw/testfw/start.o \
$(P)/fw/tk1/proto.o \ $(P)/fw/tk1/proto.o \
$(P)/fw/tk1/lib.o $(P)/fw/tk1/lib.o \
$(P)/fw/tk1/spi.o \
$(P)/fw/tk1/flash.o
IRQPOC_OBJS = \ IRQPOC_OBJS = \
$(P)/fw/irqpoc/main.o \ $(P)/fw/irqpoc/main.o \

View File

@ -3,6 +3,7 @@
* SPDX-License-Identifier: GPL-2.0-only * SPDX-License-Identifier: GPL-2.0-only
*/ */
#include "../tk1/flash.h"
#include "../tk1/lib.h" #include "../tk1/lib.h"
#include "../tk1/proto.h" #include "../tk1/proto.h"
#include "../tk1/types.h" #include "../tk1/types.h"
@ -239,6 +240,16 @@ int main(void)
anyfailed = 1; anyfailed = 1;
} }
uint8_t jedec_id[3];
puts("\r\nReading SPI flash capacity...\r\n");
flash_release_powerdown();
flash_read_jedec_id(jedec_id);
if (jedec_id[2] != 0x14) {
failmsg("Expected SPI flash capacity: 0x14 (1 MByte)");
anyfailed = 1;
}
// Test FW_RAM. // Test FW_RAM.
puts("\r\nTesting FW_RAM (takes 15s on hw)...\r\n"); puts("\r\nTesting FW_RAM (takes 15s on hw)...\r\n");
for (unsigned int i = 0; i < TK1_MMIO_FW_RAM_SIZE; i++) { for (unsigned int i = 0; i < TK1_MMIO_FW_RAM_SIZE; i++) {

View File

@ -4,9 +4,8 @@
#ifndef TKEY_FLASH_H #ifndef TKEY_FLASH_H
#define TKEY_FLASH_H #define TKEY_FLASH_H
#include "types.h"
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#define WRITE_ENABLE 0x06 #define WRITE_ENABLE 0x06
#define WRITE_DISABLE 0x04 #define WRITE_DISABLE 0x04