i386: Misc PCI fixups
authorGraeme Russ <graeme.russ@gmail.com>
Sun, 23 Aug 2009 02:59:50 +0000 (12:59 +1000)
committerWolfgang Denk <wd@denx.de>
Fri, 4 Sep 2009 19:52:52 +0000 (21:52 +0200)
Change PCI_REGION_MEMORY to PCI_REGION_SYS_MEMORY (Originally done in
commit ff4e66e93c1a, regressed by commit 6d7f610b09f8)

Cast PCI_ROM_ADDRESS_MASK to u32

Wrap probe_pci_video() call inside #ifdef CONFIG_VIDEO

Change call to pci_find_class() to pci_find_devices(). This is based on a
patch submitted on 1st March 2007 (Patch that fixes the compilation errors
for sc520_cdp board) by mushtaq_k

This patch requires that PCI_VIDEO_VENDOR_ID and PCI_VIDEO_DEVICE_ID be
specified in the board config file.  Dummy values have been added for the
SC520 CDP board to enable compilation, but since I do not have one of these,
I do know what the values should be

Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
board/sc520_cdp/sc520_cdp.c
cpu/i386/sc520/sc520_pci.c
include/configs/sc520_cdp.h
lib_i386/pci.c
lib_i386/video_bios.c

index 830ec37dd76f01e949ddd7b99e131b27a35f119a..9cbe63efbc603f3c5f08282cc95457c16a724c4c 100644 (file)
@@ -27,6 +27,7 @@
 #include <asm/io.h>
 #include <asm/pci.h>
 #include <asm/ic/sc520.h>
+#include <asm/ic/pci.h>
 #include <ali512x.h>
 #include <spi.h>
 #include <netdev.h>
index 38b837e81ce907f87a38d4987f2b85fd32b2e219..871ad0a7361cee0a99d2fd9a09ee0b2ed9b1d85d 100644 (file)
@@ -124,7 +124,7 @@ void pci_sc520_init(struct pci_controller *hose)
                       SC520_PCI_MEMORY_BUS,
                       SC520_PCI_MEMORY_PHYS,
                       SC520_PCI_MEMORY_SIZE,
-                      PCI_REGION_MEM | PCI_REGION_MEMORY);
+                      PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
 
        /* PCI memory space */
        pci_set_region(hose->regions + 1,
index 3e2bb02a46226c3567fe5792c14380e31470b1bc..36e1224e57addc75726a390dd044cb79a56e643d 100644 (file)
  ************************************************************/
 #ifndef GRUSS_TESTING
 #define CONFIG_VIDEO                   /* To enable video controller support */
+#define PCI_VIDEO_VENDOR_ID 0          /*Use the appropriate vendor ID*/
+#define PCI_VIDEO_DEVICE_ID 0          /*Use the appropriate Device ID*/
 #else
 #undef CONFIG_VIDEO
 #endif
index 4331b04418c153fe7e6516dd667171b676f6667d..f366bdc6724af356b2c8a27662bb51fbd653d92d 100644 (file)
@@ -60,7 +60,7 @@ int pci_shadow_rom(pci_dev_t dev, unsigned char *dest)
               vendor, device, class_code);
 #endif
        /* Enable the rom addess decoder */
-       pci_write_config_dword(dev, PCI_ROM_ADDRESS, PCI_ROM_ADDRESS_MASK);
+       pci_write_config_dword(dev, PCI_ROM_ADDRESS, (u32)PCI_ROM_ADDRESS_MASK);
        pci_read_config_dword(dev, PCI_ROM_ADDRESS, &addr_reg);
 
        if (!addr_reg) {
index ce96a3e058f77e7d36353117c523ec22d70c2dcf..c8060e60a7766e50b272d206afea7bbd7b418174 100644 (file)
@@ -76,18 +76,22 @@ void print_bios_bios_stat(void)
 }
 #endif
 
+#ifdef CONFIG_VIDEO
+
 #define PCI_CLASS_VIDEO             3
 #define PCI_CLASS_VIDEO_STD         0
 #define PCI_CLASS_VIDEO_PROG_IF_VGA 0
 
+static struct pci_device_id supported[] = {
+       {PCI_VIDEO_VENDOR_ID, PCI_VIDEO_DEVICE_ID},
+       {}
+};
 
 static u32 probe_pci_video(void)
 {
        pci_dev_t devbusfn;
 
-       if ((devbusfn = pci_find_class(PCI_CLASS_VIDEO,
-                                      PCI_CLASS_VIDEO_STD,
-                                      PCI_CLASS_VIDEO_PROG_IF_VGA, 0)) != -1) {
+       if ((devbusfn = pci_find_devices(supported, 0) != -1)) {
                u32 old;
                u32 addr;
 
@@ -103,7 +107,7 @@ static u32 probe_pci_video(void)
 
                /* Test the ROM decoder, do the device support a rom? */
                pci_read_config_dword(devbusfn, PCI_ROM_ADDRESS, &old);
-               pci_write_config_dword(devbusfn, PCI_ROM_ADDRESS, PCI_ROM_ADDRESS_MASK);
+               pci_write_config_dword(devbusfn, PCI_ROM_ADDRESS, (u32)PCI_ROM_ADDRESS_MASK);
                pci_read_config_dword(devbusfn, PCI_ROM_ADDRESS, &addr);
                pci_write_config_dword(devbusfn, PCI_ROM_ADDRESS, old);
 
@@ -133,11 +137,6 @@ static u32 probe_pci_video(void)
        return 0;
 }
 
-
-#endif
-
-#ifdef CONFIG_VIDEO
-
 static int probe_isa_video(void)
 {
        u32 ptr;
@@ -220,3 +219,4 @@ int video_bios_init(void)
 
 }
 #endif
+#endif