Since some people disapprove of white space cleanups mixed in regular commits
[coreboot.git] / src / southbridge / intel / i82801ex / i82801ex_sata.c
1 #include <console/console.h>
2 #include <device/device.h>
3 #include <device/pci.h>
4 #include <device/pci_ids.h>
5 #include <device/pci_ops.h>
6 #include "i82801ex.h"
7
8 static void sata_init(struct device *dev)
9 {
10         printk(BIOS_DEBUG, "SATA init\n");
11         /* SATA configuration */
12         pci_write_config8(dev, 0x04, 0x07);
13         pci_write_config8(dev, 0x09, 0x8f);
14
15         /* Set timmings */
16         pci_write_config16(dev, 0x40, 0x0a307);
17         pci_write_config16(dev, 0x42, 0x0a307);
18
19         /* Sync DMA */
20         pci_write_config16(dev, 0x48, 0x000f);
21         pci_write_config16(dev, 0x4a, 0x1111);
22
23         /* 66 mhz */
24         pci_write_config16(dev, 0x54, 0xf00f);
25
26         /* Combine ide - sata configuration */
27         pci_write_config8(dev, 0x90, 0x0);
28
29         /* port 0 & 1 enable */
30         pci_write_config8(dev, 0x92, 0x33);
31
32         /* initialize SATA  */
33         pci_write_config16(dev, 0xa0, 0x0018);
34         pci_write_config32(dev, 0xa4, 0x00000264);
35         pci_write_config16(dev, 0xa0, 0x0040);
36         pci_write_config32(dev, 0xa4, 0x00220043);
37
38 }
39
40 static struct device_operations sata_ops  = {
41         .read_resources   = pci_dev_read_resources,
42         .set_resources    = pci_dev_set_resources,
43         .enable_resources = pci_dev_enable_resources,
44         .init             = sata_init,
45         .scan_bus         = 0,
46         .ops_pci          = 0,
47 };
48
49 static const struct pci_driver sata_driver __pci_driver = {
50         .ops    = &sata_ops,
51         .vendor = PCI_VENDOR_ID_INTEL,
52         .device = PCI_DEVICE_ID_INTEL_82801ER_SATA,
53 };
54
55 static const struct pci_driver sata_driver_nr __pci_driver = {
56         .ops    = &sata_ops,
57         .vendor = PCI_VENDOR_ID_INTEL,
58         .device = PCI_DEVICE_ID_INTEL_82801EB_SATA,
59 };
60