2 * Copyright 2004 Tyan Computer
6 #include <console/console.h>
7 #include <device/device.h>
8 #include <device/pci.h>
9 #include <device/pci_ids.h>
10 #include <device/pci_ops.h>
13 static void ide_init(struct device *dev)
15 struct southbridge_nvidia_ck804_config *conf;
20 conf = dev->chip_info;
22 word = pci_read_config16(dev, 0x50);
23 /* Ensure prefetch is disabled. */
24 word &= ~((1 << 15) | (1 << 13));
25 if (conf->ide1_enable) {
26 /* Enable secondary IDE interface. */
28 printk(BIOS_DEBUG, "IDE1 \t");
30 if (conf->ide0_enable) {
31 /* Enable primary IDE interface. */
33 printk(BIOS_DEBUG, "IDE0\n");
39 pci_write_config16(dev, 0x50, word);
41 byte = 0x20; /* Latency: 64 --> 32 */
42 pci_write_config8(dev, 0xd, byte);
44 dword = pci_read_config32(dev, 0xf8);
46 pci_write_config32(dev, 0xf8, dword);
48 #if CONFIG_PCI_ROM_RUN == 1
53 static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
55 pci_write_config32(dev, 0x40,
56 ((device & 0xffff) << 16) | (vendor & 0xffff));
59 static struct pci_operations lops_pci = {
60 .set_subsystem = lpci_set_subsystem,
63 static struct device_operations ide_ops = {
64 .read_resources = pci_dev_read_resources,
65 .set_resources = pci_dev_set_resources,
66 .enable_resources = pci_dev_enable_resources,
69 // .enable = ck804_enable,
73 static const struct pci_driver ide_driver __pci_driver = {
75 .vendor = PCI_VENDOR_ID_NVIDIA,
76 .device = PCI_DEVICE_ID_NVIDIA_CK804_IDE,