| 1 |
|
| 2 |
|
| 3 |
#include <device/pci_ops.h> |
| 4 |
#include <device/pci_def.h> |
| 5 |
#include "pch.h" |
| 6 |
#include "chip.h" |
| 7 |
#include <northbridge/intel/sandybridge/pei_data.h> |
| 8 |
|
| 9 |
#define PCH_EHCI1_TEMP_BAR0 0xe8000000 |
| 10 |
#define PCH_EHCI2_TEMP_BAR0 0xe8000400 |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
void enable_usb_bar(void) |
| 20 |
{ |
| 21 |
pci_devfn_t usb0 = PCH_EHCI1_DEV; |
| 22 |
pci_devfn_t usb1 = PCH_EHCI2_DEV; |
| 23 |
|
| 24 |
|
| 25 |
pci_write_config32(usb0, PCI_BASE_ADDRESS_0, |
| 26 |
PCH_EHCI1_TEMP_BAR0); |
| 27 |
pci_or_config16(usb0, PCI_COMMAND, PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY); |
| 28 |
|
| 29 |
|
| 30 |
pci_write_config32(usb1, PCI_BASE_ADDRESS_0, |
| 31 |
PCH_EHCI2_TEMP_BAR0); |
| 32 |
pci_or_config16(usb1, PCI_COMMAND, PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY); |
| 33 |
} |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
void southbridge_fill_pei_data(struct pei_data *pei_data) |
| 60 |
{ |
| 61 |
const struct device *dev = pcidev_on_root(0x1d, 0); |
| 62 |
const struct southbridge_intel_bd82x6x_config *config = dev->chip_info; |
| 63 |
|
| 64 |
const uint16_t currents[] = { 0x40, 0x80, 0x130, |
| 65 |
0, 0, 0, |
| 66 |
0x40, 0x130, 0x40, 0x80}; |
| 67 |
for (unsigned int port = 0; port < ARRAY_SIZE(config->usb_port_config); port++) { |
| 68 |
uint16_t current = 0; |
| 69 |
int ocp = config->usb_port_config[port].oc_pin; |
| 70 |
if (ocp == -1) |
| 71 |
ocp = (port < 8) ? 0 : 4; |
| 72 |
|
| 73 |
if (config->usb_port_config[port].current < ARRAY_SIZE(currents)) |
| 74 |
current = currents[config->usb_port_config[port].current]; |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
if (current == 0) { |
| 82 |
printk(BIOS_NOTICE, |
| 83 |
"%s: USB%02d: %d is an invalid setting for MRC.bin!\n", |
| 84 |
__func__, port, config->usb_port_config[port].current); |
| 85 |
} |
| 86 |
|
| 87 |
pei_data->usb_port_config[port][0] = config->usb_port_config[port].enabled; |
| 88 |
pei_data->usb_port_config[port][1] = ocp; |
| 89 |
pei_data->usb_port_config[port][2] = current; |
| 90 |
} |
| 91 |
|
| 92 |
pei_data->usb3.hs_port_switch_mask = config->xhci_switchable_ports; |
| 93 |
} |