Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: renesas-xhci: Fix External ROM access timeouts

Increase the External ROM access timeouts to prevent failures during
programming of External SPI EEPROM chips. The current timeouts are
too short for some SPI EEPROMs used with uPD720201 controllers.

The current timeout for Chip Erase in renesas_rom_erase() is 100 ms ,
the current timeout for Sector Erase issued by the controller before
Page Program in renesas_fw_download_image() is also 100 ms. Neither
timeout is sufficient for e.g. the Macronix MX25L5121E or MX25V5126F.

MX25L5121E reference manual [1] page 35 section "ERASE AND PROGRAMMING
PERFORMANCE" and page 23 section "Table 8. AC CHARACTERISTICS (Temperature
= 0°C to 70°C for Commercial grade, VCC = 2.7V ~ 3.6V)" row "tCE" indicate
that the maximum time required for Chip Erase opcode to complete is 2 s,
and for Sector Erase it is 300 ms .

MX25V5126F reference manual [2] page 47 section "13. ERASE AND PROGRAMMING
PERFORMANCE (2.3V - 3.6V)" and page 42 section "Table 8. AC CHARACTERISTICS
(Temperature = -40°C to 85°C for Industrial grade, VCC = 2.3V - 3.6V)" row
"tCE" indicate that the maximum time required for Chip Erase opcode to
complete is 3.2 s, and for Sector Erase it is 400 ms .

Update the timeouts such, that Chip Erase timeout is set to 5 seconds,
and Sector Erase timeout is set to 500 ms. Such lengthy timeouts ought
to be sufficient for majority of SPI EEPROM chips.

[1] https://www.macronix.com/Lists/Datasheet/Attachments/8634/MX25L5121E,%203V,%20512Kb,%20v1.3.pdf
[2] https://www.macronix.com/Lists/Datasheet/Attachments/8750/MX25V5126F,%202.5V,%20512Kb,%20v1.1.pdf

Fixes: 2478be82de44 ("usb: renesas-xhci: Add ROM loader for uPD720201")
Cc: stable <stable@kernel.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Link: https://lore.kernel.org/r/20250802225526.25431-1-marek.vasut+renesas@mailbox.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Marek Vasut and committed by
Greg Kroah-Hartman
f9420f47 202ad1aa

+4 -3
+4 -3
drivers/usb/host/xhci-pci-renesas.c
··· 47 47 #define RENESAS_ROM_ERASE_MAGIC 0x5A65726F 48 48 #define RENESAS_ROM_WRITE_MAGIC 0x53524F4D 49 49 50 - #define RENESAS_RETRY 10000 51 - #define RENESAS_DELAY 10 50 + #define RENESAS_RETRY 50000 /* 50000 * RENESAS_DELAY ~= 500ms */ 51 + #define RENESAS_CHIP_ERASE_RETRY 500000 /* 500000 * RENESAS_DELAY ~= 5s */ 52 + #define RENESAS_DELAY 10 52 53 53 54 #define RENESAS_FW_NAME "renesas_usb_fw.mem" 54 55 ··· 408 407 /* sleep a bit while ROM is erased */ 409 408 msleep(20); 410 409 411 - for (i = 0; i < RENESAS_RETRY; i++) { 410 + for (i = 0; i < RENESAS_CHIP_ERASE_RETRY; i++) { 412 411 retval = pci_read_config_byte(pdev, RENESAS_ROM_STATUS, 413 412 &status); 414 413 status &= RENESAS_ROM_STATUS_ERASE;