]> git.baikalelectronics.ru Git - uboot.git/commit
board: ti: common: board_detect: Fix EEPROM read quirk
authorMatwey V. Kornilov <matwey.kornilov@gmail.com>
Tue, 23 Aug 2022 16:05:34 +0000 (19:05 +0300)
committerTom Rini <trini@konsulko.com>
Wed, 31 Aug 2022 16:16:01 +0000 (12:16 -0400)
commit90fde2a3094de896a80a12b497b5de6f32a533e0
treef7e631c4df5e82c6f14616ade660a28737af46d5
parentd9b5b5463fcfe3972ded617b1116e43ceb20c7ae
board: ti: common: board_detect: Fix EEPROM read quirk

There are three different kinds of EEPROM possibly present on boards.
  1. 1byte address. For those we should avoid 2byte address in order
     not to rewrite the data. Second byte of the address can potentially
     be interpreted as the data to write.
  2. 2byte address with defined behaviour. When we try to use 1byte
     address they just return "FF FF FF FF ... FF"
  3. 2byte address with undefined behaviour (for instance, 24LC32AI).
     When we try to use 1byte address, then their internal read
     pointer is changed to some value. Subsequential reads may be
     broken.

To gracefully handle both case #1 and case #3 we read all required
data from EEPROM at once (about 80 bytes). So either all the data is
valid or we fallback to 2byte address.

Cc: Nishanth Menon <nm@ti.com>
Fixes: 15bf93e1bec6 ("board: ti: common: board_detect: Do 1byte address checks first.")
Reference: https://lore.kernel.org/all/CAJs94Ebdd4foOjhGFu9Bop0v=B1US9neDLxfhgcY23ukgLzFOQ@mail.gmail.com/
Signed-off-by: Matwey V. Kornilov <matwey.kornilov@gmail.com>
Acked-by: Nishanth Menon <nm@ti.com>
board/ti/common/board_detect.c