diff options
Diffstat (limited to 'src/southbridge/intel/bd82x6x/early_usb.c')
-rw-r--r-- | src/southbridge/intel/bd82x6x/early_usb.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/southbridge/intel/bd82x6x/early_usb.c b/src/southbridge/intel/bd82x6x/early_usb.c index 6d3d096f0b..6667d4742b 100644 --- a/src/southbridge/intel/bd82x6x/early_usb.c +++ b/src/southbridge/intel/bd82x6x/early_usb.c @@ -16,6 +16,8 @@ void early_usb_init(const struct southbridge_usb_port *portmap) /* 3560 */ 0x024c8001, 0x000024a3, 0x00040002, 0x01000050, /* 3570 */ 0x02000772, 0x16000f9f, 0x1800ff4f, 0x0001d630, }; + /* Care should be taken to limit this array to not more than 80 (0x50) entries. + * See below. */ const u32 currents[] = { USBIR_TXRX_GAIN_MOBILE_LOW, USBIR_TXRX_GAIN_DEFAULT, USBIR_TXRX_GAIN_HIGH, 0x20000f51, 0x2000094a, 0x2000035f, USBIR_TXRX_GAIN_DESKTOP_LOW, 0x20000357, 0x20000353, @@ -26,6 +28,14 @@ void early_usb_init(const struct southbridge_usb_port *portmap) write_pmbase16(UPRWC, read_pmbase16(UPRWC) | UPRWC_WR_EN); for (i = 0; i < 14; i++) { + /* + * If the value from devicetree is beyond the highest possible current map + * index, it is meant to go directly into (bottom 12 bits of) USBIRx. + */ + if (portmap[i].current >= ARRAY_SIZE(currents)) { + RCBA32(USBIR0 + 4 * i) = 0x20000000 | (portmap[i].current & 0xfff); + continue; + } if (portmap[i].enabled && !pch_is_mobile() && currents[portmap[i].current] == USBIR_TXRX_GAIN_MOBILE_LOW) { /* |