summaryrefslogtreecommitdiffstats
path: root/src/drivers/bitbash
diff options
context:
space:
mode:
authorMichael Brown2011-03-04 20:17:53 +0100
committerMichael Brown2011-03-04 20:32:56 +0100
commit530a01eff0351d177d95e021249ec65ec631108c (patch)
tree193aaa927a5e82b9e7e769801ea8824cae8ad7b5 /src/drivers/bitbash
parent[parseopt] Refer to online documentation for command help (diff)
downloadipxe-530a01eff0351d177d95e021249ec65ec631108c.tar.gz
ipxe-530a01eff0351d177d95e021249ec65ec631108c.tar.xz
ipxe-530a01eff0351d177d95e021249ec65ec631108c.zip
[spi] Reset device on each access
When chainloading rtl8139.pxe from an old Etherboot rtl8139.zrom, iPXE can end up misreading the first word of the MAC address from the EEPROM as being all zeroes. This is presumably because Etherboot has left the serial EEPROM in an unexpected state. Fix by using the chip select line to reset the SPI device before we start accessing it. Reported-by: Mandar U Jog <mandarjog@gmail.com> Tested-by: Mandar U Jog <mandarjog@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/bitbash')
-rw-r--r--src/drivers/bitbash/spi_bit.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/drivers/bitbash/spi_bit.c b/src/drivers/bitbash/spi_bit.c
index f165e01b..b64ffb82 100644
--- a/src/drivers/bitbash/spi_bit.c
+++ b/src/drivers/bitbash/spi_bit.c
@@ -162,6 +162,9 @@ static int spi_bit_rw ( struct spi_bus *bus, struct spi_device *device,
uint32_t tmp_address;
uint32_t tmp_address_detect;
+ /* Deassert chip select to reset specified slave */
+ spi_bit_set_slave_select ( spibit, device->slave, DESELECT_SLAVE );
+
/* Set clock line to idle state */
write_bit ( &spibit->basher, SPI_BIT_SCLK,
( bus->mode & SPI_MODE_CPOL ) );