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

Revert "usb: early: convert to readl_poll_timeout_atomic()"

This reverts commit 796eed4b2342c9d6b26c958e92af91253a2390e1.

This change causes boot lockups when using "arlyprintk=xdbc" because
ktime can not be used at this point in time in the boot process. Also,
it is not needed for very small delays like this.

Reported-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Reported-by: Peter Zijlstra <peterz@infradead.org>
Cc: Jann Horn <jannh@google.com>
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>
Fixes: 796eed4b2342 ("usb: early: convert to readl_poll_timeout_atomic()")
Link: https://lore.kernel.org/r/c2b5c9bb-1b75-bf56-3754-b5b18812d65e@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+11 -4
+11 -4
drivers/usb/early/xhci-dbc.c
··· 14 14 #include <linux/pci_ids.h> 15 15 #include <linux/memblock.h> 16 16 #include <linux/io.h> 17 - #include <linux/iopoll.h> 18 17 #include <asm/pci-direct.h> 19 18 #include <asm/fixmap.h> 20 19 #include <linux/bcd.h> ··· 135 136 { 136 137 u32 result; 137 138 138 - return readl_poll_timeout_atomic(ptr, result, 139 - ((result & mask) == done), 140 - delay, wait); 139 + /* Can not use readl_poll_timeout_atomic() for early boot things */ 140 + do { 141 + result = readl(ptr); 142 + result &= mask; 143 + if (result == done) 144 + return 0; 145 + udelay(delay); 146 + wait -= delay; 147 + } while (wait > 0); 148 + 149 + return -ETIMEDOUT; 141 150 } 142 151 143 152 static void __init xdbc_bios_handoff(void)