blob: bb3510783d1e7e0e92b0f11595d17734e83c68a8 [file] [log] [blame]
Ronald G. Minnich182615d2004-08-24 16:20:46 +00001#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>
Stefan Reinauer138be832010-02-27 01:50:21 +00006#include "i82801dx.h"
Ronald G. Minnich182615d2004-08-24 16:20:46 +00007
8
9static void ide_init(struct device *dev)
10{
11#if ICH5_SATA_ADDRESS_MAP<=1
12 /* Enable ide devices so the linux ide driver will work */
13 uint16_t word;
14 uint8_t byte;
15 int enable_a=1, enable_b=1;
16
17
18 word = pci_read_config16(dev, 0x40);
19 word &= ~((1 << 15));
20 if (enable_a) {
21 /* Enable first ide interface */
22 word |= (1<<15);
23 printk_debug("IDE0 ");
24 }
25 pci_write_config16(dev, 0x40, word);
26
27 word = pci_read_config16(dev, 0x42);
28 word &= ~((1 << 15));
Steven J. Magnanib140d562005-09-21 13:51:30 +000029 if (enable_b) {
Ronald G. Minnich182615d2004-08-24 16:20:46 +000030 /* Enable secondary ide interface */
31 word |= (1<<15);
32 printk_debug("IDE1 ");
33 }
34 pci_write_config16(dev, 0x42, word);
35#endif
36
37}
38
39static struct device_operations ide_ops = {
40 .read_resources = pci_dev_read_resources,
41 .set_resources = pci_dev_set_resources,
42 .enable_resources = pci_dev_enable_resources,
43 .init = ide_init,
44 .scan_bus = 0,
Stefan Reinauer138be832010-02-27 01:50:21 +000045 .enable = i82801dx_enable,
Ronald G. Minnich182615d2004-08-24 16:20:46 +000046};
47
Stefan Reinauerf1cf1f72007-10-24 09:08:58 +000048static const struct pci_driver ide_driver __pci_driver = {
Ronald G. Minnich182615d2004-08-24 16:20:46 +000049 .ops = &ide_ops,
50 .vendor = PCI_VENDOR_ID_INTEL,
Uwe Hermanna29ec062007-11-04 03:21:37 +000051 .device = PCI_DEVICE_ID_INTEL_82801DBM_IDE,
Ronald G. Minnich182615d2004-08-24 16:20:46 +000052};
53