mirror of
https://github.com/im-tomu/foboot.git
synced 2024-09-20 02:40:09 +00:00
foboot: spi: fix spiId and remove dead code
Remove code that doesn't get called. Also, remove the `spi_id` global. It conflicted with one from the linker, which was causing contention. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
5a587c5752
commit
fb08d194ca
@ -6,10 +6,6 @@
|
||||
#define SPI_ERASE_SECTOR_SIZE 4096
|
||||
#define SPI_PROGRAM_PAGE_SIZE 256
|
||||
|
||||
void spiBegin(void);
|
||||
void spiEnd(void);
|
||||
void spiPause(void);
|
||||
void spiCommand(uint8_t cmd);
|
||||
uint8_t spiCommandRx(void);
|
||||
uint8_t spiReadStatus(void);
|
||||
void spiBeginErase4(uint32_t erase_addr);
|
||||
@ -18,5 +14,6 @@ void spiBeginErase64(uint32_t erase_addr);
|
||||
int spiIsBusy(void);
|
||||
void spiBeginWrite(uint32_t addr, const void *v_data, unsigned int count);
|
||||
uint32_t spiId(void);
|
||||
void spiReset(void);
|
||||
|
||||
#endif /* _FOBOOST_SPI_H */
|
||||
#endif /* _FOBOOST_SPI_H */
|
||||
|
@ -72,12 +72,9 @@ int spiIsBusy(void) {
|
||||
return spi_read_status() & (1 << 0);
|
||||
}
|
||||
|
||||
__attribute__((used))
|
||||
uint32_t spi_id;
|
||||
|
||||
__attribute__((used))
|
||||
uint32_t spiId(void) {
|
||||
spi_id = 0;
|
||||
uint32_t spi_id = 0;
|
||||
|
||||
spiBegin();
|
||||
spi_single_tx(0x90); // Read manufacturer ID
|
||||
@ -160,7 +157,7 @@ void spiBeginWrite(uint32_t addr, const void *v_data, unsigned int count) {
|
||||
spiEnd();
|
||||
}
|
||||
|
||||
uint8_t spiReset(void) {
|
||||
void spiReset(void) {
|
||||
// Writing 0xff eight times is equivalent to exiting QPI mode,
|
||||
// or if CFM mode is enabled it will terminate CFM and return
|
||||
// to idle.
|
||||
@ -174,25 +171,6 @@ uint8_t spiReset(void) {
|
||||
spiBegin();
|
||||
spi_single_tx(0xab); // Read electronic signature
|
||||
spiEnd();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int spiInit(void) {
|
||||
|
||||
// Ensure CS is deasserted and the clock is high
|
||||
lxspi_bitbang_write((0 << PIN_CLK) | (1 << PIN_CS));
|
||||
|
||||
// Disable memory-mapped mode and enable bit-bang mode
|
||||
lxspi_bitbang_en_write(1);
|
||||
|
||||
// Reset the SPI flash, which will return it to SPI mode even
|
||||
// if it's in QPI mode, and ensure the chip is accepting commands.
|
||||
spiReset();
|
||||
|
||||
spiId();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void spiHold(void) {
|
||||
@ -206,8 +184,3 @@ void spiUnhold(void) {
|
||||
spi_single_tx(0xab);
|
||||
spiEnd();
|
||||
}
|
||||
|
||||
void spiFree(void) {
|
||||
// Re-enable memory-mapped mode
|
||||
lxspi_bitbang_en_write(0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user