Просмотр исходного кода

[realtek] Ensure EEPROM writes reach chip before starting udelay()

On some systems, it appears to be possible for writes to the EEPROM
registers to be delayed for long enough that the EEPROM's setup and
hold times are violated, resulting in invalid data being read from the
EEPROM.

Fix by inserting a PCI read cycle immediately after writes to
RTL_9346CR, to ensure that the write has completed before starting the
udelay() used to time the SPI bus transitions.

Reported-by: Gelip <mrgelip@gmail.com>
Tested-by: Gelip <mrgelip@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 12 лет назад
Родитель
Сommit
9b1ec3132f
1 измененных файлов: 3 добавлений и 0 удалений
  1. 3
    0
      src/drivers/net/realtek.c

+ 3
- 0
src/drivers/net/realtek.c Просмотреть файл

74
 
74
 
75
 	/* Enable EEPROM access */
75
 	/* Enable EEPROM access */
76
 	writeb ( RTL_9346CR_EEM_EEPROM, rtl->regs + RTL_9346CR );
76
 	writeb ( RTL_9346CR_EEM_EEPROM, rtl->regs + RTL_9346CR );
77
+	readb ( rtl->regs + RTL_9346CR ); /* Ensure write reaches chip */
77
 }
78
 }
78
 
79
 
79
 /**
80
 /**
87
 
88
 
88
 	/* Disable EEPROM access */
89
 	/* Disable EEPROM access */
89
 	writeb ( RTL_9346CR_EEM_NORMAL, rtl->regs + RTL_9346CR );
90
 	writeb ( RTL_9346CR_EEM_NORMAL, rtl->regs + RTL_9346CR );
91
+	readb ( rtl->regs + RTL_9346CR ); /* Ensure write reaches chip */
90
 }
92
 }
91
 
93
 
92
 /**
94
 /**
129
 	reg &= ~mask;
131
 	reg &= ~mask;
130
 	reg |= ( data & mask );
132
 	reg |= ( data & mask );
131
 	writeb ( reg, rtl->regs + RTL_9346CR );
133
 	writeb ( reg, rtl->regs + RTL_9346CR );
134
+	readb ( rtl->regs + RTL_9346CR ); /* Ensure write reaches chip */
132
 	DBG_ENABLE ( DBGLVL_IO );
135
 	DBG_ENABLE ( DBGLVL_IO );
133
 }
136
 }
134
 
137
 

Загрузка…
Отмена
Сохранить