File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -324,6 +324,7 @@ static inline u8 exar_ee_read_bit(struct exar8250 *priv)
324
324
* @ee_addr: Offset of EEPROM to read word from
325
325
*
326
326
* Read a single 16bit word from an Exar UART's EEPROM.
327
+ * The type of the EEPROM is AT93C46D.
327
328
*
328
329
* Return: EEPROM word
329
330
*/
@@ -340,13 +341,13 @@ static u16 exar_ee_read(struct exar8250 *priv, u8 ee_addr)
340
341
exar_ee_write_bit (priv , 0 );
341
342
342
343
// Send address to read from
343
- for (i = 1 << ( UART_EXAR_REGB_EE_ADDR_SIZE - 1 ) ; i ; i >>= 1 )
344
- exar_ee_write_bit (priv , ( ee_addr & i ));
344
+ for (i = UART_EXAR_REGB_EE_ADDR_SIZE - 1 ; i >= 0 ; i -- )
345
+ exar_ee_write_bit (priv , ee_addr & BIT ( i ));
345
346
346
- // Read data 1 bit at a time
347
- for (i = 0 ; i <= UART_EXAR_REGB_EE_DATA_SIZE ; i ++ ) {
348
- data <<= 1 ;
349
- data |= exar_ee_read_bit ( priv );
347
+ // Read data 1 bit at a time starting with a dummy bit
348
+ for (i = UART_EXAR_REGB_EE_DATA_SIZE ; i >= 0 ; i -- ) {
349
+ if ( exar_ee_read_bit ( priv ))
350
+ data |= BIT ( i );
350
351
}
351
352
352
353
exar_ee_deselect (priv );
You can’t perform that action at this time.
0 commit comments