Skip to contentSkip to conversation

ohci: Add missing cache-flush for hcca area

PATCH New Hans de Goede 2 participants 2 messages Oct 20, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ohci: Add missing cache-flush for hcca area

We need to cache-flush the hcca area after the initial memset, otherwise on the first hc_interrupt we might see an old $random value as done_head and try to interpret that as the address for a completed td (followed by chaos).

---
 drivers/usb/host/ohci-hcd.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/host/ohci-hcd.c +1 -0
index 9bde2b2..ccbfc02 100644
@@ -2205,6 +2205,7 @@ int ohci_register(struct udevice *dev, struct ohci_regs *regs)
 	if (!ohci->hcca)
 		return -ENOMEM;
 	memset(ohci->hcca, 0, sizeof(struct ohci_hcca));
+	flush_dcache_hcca(ohci->hcca);
 
 	if (hc_reset(ohci) < 0)
 		return -EIO;
Signature · 1 line
2.5.0
#1 lore raw

PATCH 1/1 ohci: Add missing cache-flush for hcca area

Quoted 6 lines · Hans de Goede

We need to cache-flush the hcca area after the initial memset, otherwise on the first hc_interrupt we might see an old $random value as done_head and try to interpret that as the address for a completed td (followed by chaos).

Dang, this came three hours after the release of 2015.10 ;-)

Oh well. Applied, thanks!

Quoted 9 lines
---
 drivers/usb/host/ohci-hcd.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/host/ohci-hcd.c +0 -0
index 9bde2b2..ccbfc02 100644

drivers/usb/host/ohci-hcd.c int ohci_register(struct udevice *dev, struct · line 2211

Quoted 7 lines
drivers/usb/host/ohci-hcd.c +1 -0
@@ -2205,6 +2205,7 @@ int ohci_register(struct udevice *dev, struct
 ohci_regs *regs) if (!ohci->hcca)
 		return -ENOMEM;
 	memset(ohci->hcca, 0, sizeof(struct ohci_hcca));
+	flush_dcache_hcca(ohci->hcca);
 
 	if (hc_reset(ohci) < 0)
 		return -EIO;

Best regards,
Marek Vasut