]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - board/linkstation/ide.c
Merge remote-tracking branch 'u-boot-imx/master'
[people/ms/u-boot.git] / board / linkstation / ide.c
index 2c89d62f61498323ad6f3e4af234ca28c00ae0bc..541c958fca20aa51a9d4acd83e0ce0d127cb43f6 100644 (file)
@@ -37,7 +37,6 @@
 #define IT8212_PCI_IdeBusSkewCONTROL   0x4c
 #define IT8212_PCI_IdeDrivingCURRENT   0x42
 
-extern ulong ide_bus_offset[CONFIG_SYS_IDE_MAXBUS];
 extern struct pci_controller hose;
 
 int ide_preinit (void)
@@ -54,20 +53,24 @@ int ide_preinit (void)
        if (devbusfn == -1)
                devbusfn = pci_find_device(PCI_VENDOR_ID_ITE,PCI_DEVICE_ID_ITE_8212,0);
        if (devbusfn != -1) {
+               u32 ide_bus_offset32;
+
                status = 0;
 
                pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_0,
-                                                          (u32 *) &ide_bus_offset[0]);
-               ide_bus_offset[0] &= 0xfffffffe;
+                                                          &ide_bus_offset32);
+               ide_bus_offset[0] = ide_bus_offset32 & 0xfffffffe;
                ide_bus_offset[0] = pci_hose_bus_to_phys(&hose,
-                                                        ide_bus_offset[0] & 0xfffffffe,
-                                                        PCI_REGION_IO);
-               pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_2,
-                                     (u32 *) &ide_bus_offset[1]);
-               ide_bus_offset[1] &= 0xfffffffe;
-               ide_bus_offset[1] = pci_hose_bus_to_phys(&hose,
-                                                        ide_bus_offset[1] & 0xfffffffe,
-                                                        PCI_REGION_IO);
+                                               ide_bus_offset[0] & 0xfffffffe,
+                                               PCI_REGION_IO);
+               if (CONFIG_SYS_IDE_MAXBUS > 1) {
+                       pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_2,
+                                             (u32 *) &ide_bus_offset[1]);
+                       ide_bus_offset[1] &= 0xfffffffe;
+                       ide_bus_offset[1] = pci_hose_bus_to_phys(&hose,
+                                               ide_bus_offset[1] & 0xfffffffe,
+                                               PCI_REGION_IO);
+               }
        }
 
        if (pci_find_device (PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8212, 0) != -1) {