Keith Hui has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/82655?usp=email )
Change subject: sb/intel/bd82x6x: Allow actual USBIRx values in devicetree ......................................................................
sb/intel/bd82x6x: Allow actual USBIRx values in devicetree
The need to update the USB current mapping in early_usb.c, whenever we see a previously unaccounted for value, is getting out of hand.
Instead this patch will allow specifying those values, presumably taken from an inteltool dump while running vendor firmware, directly in the devicetree.
Runtime code caps these values to 12 bits and turn them into the 0x20000yyy format the USBIRx registers want. We have more than enough space in the USB port config structure for this.
This also opens the future possibility of using the map for a simpler mapping for boards also using MRC.
Change-Id: I3d79b33bac742faa9bd4fc9852aff73fe326de4e Signed-off-by: Keith Hui buurin@gmail.com --- M src/southbridge/intel/bd82x6x/early_usb.c 1 file changed, 10 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/55/82655/1
diff --git a/src/southbridge/intel/bd82x6x/early_usb.c b/src/southbridge/intel/bd82x6x/early_usb.c index 7776994..3bf9ab2 100644 --- a/src/southbridge/intel/bd82x6x/early_usb.c +++ b/src/southbridge/intel/bd82x6x/early_usb.c @@ -17,6 +17,8 @@ /* 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, @@ -33,6 +35,14 @@ 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) { /*