瀏覽代碼

[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>
tags/v1.20.1
Michael Brown 14 年之前
父節點
當前提交
530a01eff0
共有 1 個檔案被更改,包括 3 行新增0 行删除
  1. 3
    0
      src/drivers/bitbash/spi_bit.c

+ 3
- 0
src/drivers/bitbash/spi_bit.c 查看文件

162
 	uint32_t tmp_address;
162
 	uint32_t tmp_address;
163
 	uint32_t tmp_address_detect;
163
 	uint32_t tmp_address_detect;
164
 
164
 
165
+	/* Deassert chip select to reset specified slave */
166
+	spi_bit_set_slave_select ( spibit, device->slave, DESELECT_SLAVE );
167
+
165
 	/* Set clock line to idle state */
168
 	/* Set clock line to idle state */
166
 	write_bit ( &spibit->basher, SPI_BIT_SCLK, 
169
 	write_bit ( &spibit->basher, SPI_BIT_SCLK, 
167
 		    ( bus->mode & SPI_MODE_CPOL ) );
170
 		    ( bus->mode & SPI_MODE_CPOL ) );

Loading…
取消
儲存