From 530a01eff0351d177d95e021249ec65ec631108c Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 4 Mar 2011 19:17:53 +0000 Subject: [PATCH] [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 Tested-by: Mandar U Jog Signed-off-by: Michael Brown --- src/drivers/bitbash/spi_bit.c | 3 +++ 1 file changed, 3 insertions(+) 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 ) );