Ronald G. Minnich | 182615d | 2004-08-24 16:20:46 +0000 | [diff] [blame] | 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> |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame^] | 6 | #include "i82801dx.h" |
Ronald G. Minnich | 182615d | 2004-08-24 16:20:46 +0000 | [diff] [blame] | 7 | |
| 8 | |
| 9 | static 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. Magnani | b140d56 | 2005-09-21 13:51:30 +0000 | [diff] [blame] | 29 | if (enable_b) { |
Ronald G. Minnich | 182615d | 2004-08-24 16:20:46 +0000 | [diff] [blame] | 30 | /* 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 | |
| 39 | static 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 Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame^] | 45 | .enable = i82801dx_enable, |
Ronald G. Minnich | 182615d | 2004-08-24 16:20:46 +0000 | [diff] [blame] | 46 | }; |
| 47 | |
Stefan Reinauer | f1cf1f7 | 2007-10-24 09:08:58 +0000 | [diff] [blame] | 48 | static const struct pci_driver ide_driver __pci_driver = { |
Ronald G. Minnich | 182615d | 2004-08-24 16:20:46 +0000 | [diff] [blame] | 49 | .ops = &ide_ops, |
| 50 | .vendor = PCI_VENDOR_ID_INTEL, |
Uwe Hermann | a29ec06 | 2007-11-04 03:21:37 +0000 | [diff] [blame] | 51 | .device = PCI_DEVICE_ID_INTEL_82801DBM_IDE, |
Ronald G. Minnich | 182615d | 2004-08-24 16:20:46 +0000 | [diff] [blame] | 52 | }; |
| 53 | |