x86, olpc: Use pci subarch init for OLPC

Replace the #ifdef'ed OLPC-specific init functions by a conditional
x86_init function. If the function returns 0 we leave pci_arch_init,
otherwise we continue.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Andres Salomon <dilinger@collabora.co.uk>
LKML-Reference: <43F901BD926A4E43B106BF17856F0755A318CE89@orsmsx508.amr.corp.intel.com>
Signed-off-by: Jacob Pan <jacob.jun.pan@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>

authored by Thomas Gleixner and committed by H. Peter Anvin d5d0e88c 4fb6088a

+13 -29
+2 -18
arch/x86/include/asm/olpc.h
··· 13 13 14 14 #define OLPC_F_PRESENT 0x01 15 15 #define OLPC_F_DCON 0x02 16 - #define OLPC_F_VSA 0x04 17 16 18 17 #ifdef CONFIG_OLPC 19 18 ··· 50 51 } 51 52 52 53 /* 53 - * The VSA is software from AMD that typical Geode bioses will include. 54 - * It is used to emulate the PCI bus, VGA, etc. OLPC's Open Firmware does 55 - * not include the VSA; instead, PCI is emulated by the kernel. 56 - * 57 - * The VSA is described further in arch/x86/pci/olpc.c. 58 - */ 59 - static inline int olpc_has_vsa(void) 60 - { 61 - return (olpc_platform_info.flags & OLPC_F_VSA) ? 1 : 0; 62 - } 63 - 64 - /* 65 54 * The "Mass Production" version of OLPC's XO is identified as being model 66 55 * C2. During the prototype phase, the following models (in chronological 67 56 * order) were created: A1, B1, B2, B3, B4, C1. The A1 through B2 models ··· 74 87 return 0; 75 88 } 76 89 77 - static inline int olpc_has_vsa(void) 78 - { 79 - return 0; 80 - } 81 - 82 90 #endif 91 + 92 + extern int pci_olpc_init(void); 83 93 84 94 /* EC related functions */ 85 95
-1
arch/x86/include/asm/pci_x86.h
··· 104 104 extern int pci_direct_probe(void); 105 105 extern void pci_direct_init(int type); 106 106 extern void pci_pcbios_init(void); 107 - extern int pci_olpc_init(void); 108 107 extern void __init dmi_check_pciprobe(void); 109 108 extern void __init dmi_check_skip_isa_align(void); 110 109
+7 -3
arch/x86/kernel/olpc.c
··· 17 17 #include <linux/spinlock.h> 18 18 #include <linux/io.h> 19 19 #include <linux/string.h> 20 + 20 21 #include <asm/geode.h> 22 + #include <asm/setup.h> 21 23 #include <asm/olpc.h> 22 24 23 25 #ifdef CONFIG_OPEN_FIRMWARE ··· 245 243 olpc_ec_cmd(EC_FIRMWARE_REV, NULL, 0, 246 244 (unsigned char *) &olpc_platform_info.ecver, 1); 247 245 248 - /* check to see if the VSA exists */ 249 - if (cs5535_has_vsa2()) 250 - olpc_platform_info.flags |= OLPC_F_VSA; 246 + #ifdef CONFIG_PCI_OLPC 247 + /* If the VSA exists let it emulate PCI, if not emulate in kernel */ 248 + if (!cs5535_has_vsa2()) 249 + x86_init.pci.arch_init = pci_olpc_init; 250 + #endif 251 251 252 252 printk(KERN_INFO "OLPC board revision %s%X (EC=%x)\n", 253 253 ((olpc_platform_info.boardrev & 0xf) < 8) ? "pre" : "",
+4 -4
arch/x86/pci/init.c
··· 1 1 #include <linux/pci.h> 2 2 #include <linux/init.h> 3 3 #include <asm/pci_x86.h> 4 + #include <asm/x86_init.h> 4 5 5 6 /* arch_initcall has too random ordering, so call the initializers 6 7 in the right sequence from here. */ ··· 16 15 if (!(pci_probe & PCI_PROBE_NOEARLY)) 17 16 pci_mmcfg_early_init(); 18 17 19 - #ifdef CONFIG_PCI_OLPC 20 - if (!pci_olpc_init()) 21 - return 0; /* skip additional checks if it's an XO */ 22 - #endif 18 + if (x86_init.pci.arch_init && !x86_init.pci.arch_init()) 19 + return 0; 20 + 23 21 #ifdef CONFIG_PCI_BIOS 24 22 pci_pcbios_init(); 25 23 #endif
-3
arch/x86/pci/olpc.c
··· 304 304 305 305 int __init pci_olpc_init(void) 306 306 { 307 - if (!machine_is_olpc() || olpc_has_vsa()) 308 - return -ENODEV; 309 - 310 307 printk(KERN_INFO "PCI: Using configuration type OLPC\n"); 311 308 raw_pci_ops = &pci_olpc_conf; 312 309 is_lx = is_geode_lx();