diff options
Diffstat (limited to 'drivers/eeprom/eeprom_spi.c')
-rw-r--r-- | drivers/eeprom/eeprom_spi.c | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/drivers/eeprom/eeprom_spi.c b/drivers/eeprom/eeprom_spi.c index 7b6416eaf..182731d82 100644 --- a/drivers/eeprom/eeprom_spi.c +++ b/drivers/eeprom/eeprom_spi.c | |||
@@ -55,14 +55,6 @@ | |||
55 | # include "debug.h" | 55 | # include "debug.h" |
56 | #endif // CONSOLE_ENABLE | 56 | #endif // CONSOLE_ENABLE |
57 | 57 | ||
58 | static void init_spi_if_required(void) { | ||
59 | static int done = 0; | ||
60 | if (!done) { | ||
61 | spi_init(); | ||
62 | done = 1; | ||
63 | } | ||
64 | } | ||
65 | |||
66 | static bool spi_eeprom_start(void) { return spi_start(EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN, EXTERNAL_EEPROM_SPI_LSBFIRST, EXTERNAL_EEPROM_SPI_MODE, EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR); } | 58 | static bool spi_eeprom_start(void) { return spi_start(EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN, EXTERNAL_EEPROM_SPI_LSBFIRST, EXTERNAL_EEPROM_SPI_MODE, EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR); } |
67 | 59 | ||
68 | static spi_status_t spi_eeprom_wait_while_busy(int timeout) { | 60 | static spi_status_t spi_eeprom_wait_while_busy(int timeout) { |
@@ -91,7 +83,7 @@ static void spi_eeprom_transmit_address(uintptr_t addr) { | |||
91 | 83 | ||
92 | //---------------------------------------------------------------------------------------------------------------------- | 84 | //---------------------------------------------------------------------------------------------------------------------- |
93 | 85 | ||
94 | void eeprom_driver_init(void) {} | 86 | void eeprom_driver_init(void) { spi_init(); } |
95 | 87 | ||
96 | void eeprom_driver_erase(void) { | 88 | void eeprom_driver_erase(void) { |
97 | #if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT) | 89 | #if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT) |
@@ -110,8 +102,6 @@ void eeprom_driver_erase(void) { | |||
110 | } | 102 | } |
111 | 103 | ||
112 | void eeprom_read_block(void *buf, const void *addr, size_t len) { | 104 | void eeprom_read_block(void *buf, const void *addr, size_t len) { |
113 | init_spi_if_required(); | ||
114 | |||
115 | //------------------------------------------------- | 105 | //------------------------------------------------- |
116 | // Wait for the write-in-progress bit to be cleared | 106 | // Wait for the write-in-progress bit to be cleared |
117 | bool res = spi_eeprom_start(); | 107 | bool res = spi_eeprom_start(); |
@@ -154,8 +144,6 @@ void eeprom_read_block(void *buf, const void *addr, size_t len) { | |||
154 | } | 144 | } |
155 | 145 | ||
156 | void eeprom_write_block(const void *buf, void *addr, size_t len) { | 146 | void eeprom_write_block(const void *buf, void *addr, size_t len) { |
157 | init_spi_if_required(); | ||
158 | |||
159 | bool res; | 147 | bool res; |
160 | uint8_t * read_buf = (uint8_t *)buf; | 148 | uint8_t * read_buf = (uint8_t *)buf; |
161 | uintptr_t target_addr = (uintptr_t)addr; | 149 | uintptr_t target_addr = (uintptr_t)addr; |