| 1 |
|
| 2 |
|
| 3 |
#include <console/console.h> |
| 4 |
#include <device/azalia_device.h> |
| 5 |
#include <device/device.h> |
| 6 |
#include <device/pci.h> |
| 7 |
#include <device/pci_ids.h> |
| 8 |
#include <device/pci_ops.h> |
| 9 |
#include <device/mmio.h> |
| 10 |
#include <southbridge/intel/lynxpoint/hda_verb.h> |
| 11 |
|
| 12 |
static const u32 minihd_verb_table[] = { |
| 13 |
|
| 14 |
0x80862807, |
| 15 |
0x80860101, |
| 16 |
4, |
| 17 |
|
| 18 |
|
| 19 |
0x00878101, |
| 20 |
|
| 21 |
|
| 22 |
0x00571c10, |
| 23 |
0x00571d00, |
| 24 |
0x00571e56, |
| 25 |
0x00571f18, |
| 26 |
|
| 27 |
|
| 28 |
0x00671c20, |
| 29 |
0x00671d00, |
| 30 |
0x00671e56, |
| 31 |
0x00671f18, |
| 32 |
|
| 33 |
|
| 34 |
0x00771c30, |
| 35 |
0x00771d00, |
| 36 |
0x00771e56, |
| 37 |
0x00771f18, |
| 38 |
|
| 39 |
|
| 40 |
0x00878100, |
| 41 |
|
| 42 |
|
| 43 |
0x00878100, |
| 44 |
0x00878100, |
| 45 |
}; |
| 46 |
|
| 47 |
static void minihd_init(struct device *dev) |
| 48 |
{ |
| 49 |
struct resource *res; |
| 50 |
u32 reg32; |
| 51 |
u8 *base; |
| 52 |
int codec_mask, i; |
| 53 |
|
| 54 |
|
| 55 |
res = probe_resource(dev, PCI_BASE_ADDRESS_0); |
| 56 |
if (!res) |
| 57 |
return; |
| 58 |
|
| 59 |
base = res2mmio(res, 0, 0); |
| 60 |
printk(BIOS_DEBUG, "Mini-HD: base = %p\n", base); |
| 61 |
|
| 62 |
|
| 63 |
pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER); |
| 64 |
|
| 65 |
|
| 66 |
reg32 = read32(base + 0x100c); |
| 67 |
reg32 &= 0xfffc0000; |
| 68 |
reg32 |= 0x4; |
| 69 |
write32(base + 0x100c, reg32); |
| 70 |
|
| 71 |
reg32 = read32(base + 0x1010); |
| 72 |
reg32 &= 0xfffc0000; |
| 73 |
reg32 |= 0x4b; |
| 74 |
write32(base + 0x1010, reg32); |
| 75 |
|
| 76 |
|
| 77 |
codec_mask = hda_codec_detect(base); |
| 78 |
|
| 79 |
if (codec_mask) { |
| 80 |
for (i = 3; i >= 0; i--) { |
| 81 |
if (codec_mask & (1 << i)) |
| 82 |
azalia_codec_init(base, i, minihd_verb_table, |
| 83 |
sizeof(minihd_verb_table)); |
| 84 |
} |
| 85 |
} |
| 86 |
} |
| 87 |
|
| 88 |
static struct device_operations minihd_ops = { |
| 89 |
.read_resources = pci_dev_read_resources, |
| 90 |
.set_resources = pci_dev_set_resources, |
| 91 |
.enable_resources = pci_dev_enable_resources, |
| 92 |
.init = minihd_init, |
| 93 |
.ops_pci = &pci_dev_ops_pci, |
| 94 |
}; |
| 95 |
|
| 96 |
static const unsigned short pci_device_ids[] = { 0x0a0c, 0x0c0c, 0x0d0c, 0 }; |
| 97 |
|
| 98 |
static const struct pci_driver haswell_minihd __pci_driver = { |
| 99 |
.ops = &minihd_ops, |
| 100 |
.vendor = PCI_VID_INTEL, |
| 101 |
.devices = pci_device_ids, |
| 102 |
}; |