Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[MIPS] Rework cobalt_board_id

This patch has reworked cobalt_board_id.
The cobalt_board_id is read from PCI config register.
It should be in PCI routine.

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Yoichi Yuasa and committed by
Ralf Baechle
3f2d560e b0cc114c

+21 -12
-12
arch/mips/cobalt/setup.c
··· 10 10 * 11 11 */ 12 12 #include <linux/interrupt.h> 13 - #include <linux/pci.h> 14 13 #include <linux/init.h> 15 14 #include <linux/pm.h> 16 15 ··· 24 25 extern void cobalt_machine_restart(char *command); 25 26 extern void cobalt_machine_halt(void); 26 27 extern void cobalt_machine_power_off(void); 27 - 28 - int cobalt_board_id; 29 28 30 29 const char *get_system_type(void) 31 30 { ··· 89 92 90 93 void __init plat_mem_setup(void) 91 94 { 92 - unsigned int devfn = PCI_DEVFN(COBALT_PCICONF_VIA, 0); 93 95 int i; 94 96 95 97 _machine_restart = cobalt_machine_restart; ··· 103 107 /* These resources have been reserved by VIA SuperI/O chip. */ 104 108 for (i = 0; i < ARRAY_SIZE(cobalt_reserved_resources); i++) 105 109 request_resource(&ioport_resource, cobalt_reserved_resources + i); 106 - 107 - /* Read the cobalt id register out of the PCI config space */ 108 - PCI_CFG_SET(devfn, (VIA_COBALT_BRD_ID_REG & ~0x3)); 109 - cobalt_board_id = GT_READ(GT_PCI0_CFGDATA_OFS); 110 - cobalt_board_id >>= ((VIA_COBALT_BRD_ID_REG & 3) * 8); 111 - cobalt_board_id = VIA_COBALT_BRD_REG_to_ID(cobalt_board_id); 112 - 113 - printk("Cobalt board ID: %d\n", cobalt_board_id); 114 110 } 115 111 116 112 /*
+21
arch/mips/pci/fixup-cobalt.c
··· 113 113 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_GT64111, 114 114 qube_raq_galileo_fixup); 115 115 116 + int cobalt_board_id; 117 + 118 + static void qube_raq_via_board_id_fixup(struct pci_dev *dev) 119 + { 120 + u8 id; 121 + int retval; 122 + 123 + retval = pci_read_config_byte(dev, VIA_COBALT_BRD_ID_REG, &id); 124 + if (retval) { 125 + panic("Cannot read board ID"); 126 + return; 127 + } 128 + 129 + cobalt_board_id = VIA_COBALT_BRD_REG_to_ID(id); 130 + 131 + printk(KERN_INFO "Cobalt board ID: %d\n", cobalt_board_id); 132 + } 133 + 134 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_0, 135 + qube_raq_via_board_id_fixup); 136 + 116 137 static char irq_tab_qube1[] __initdata = { 117 138 [COBALT_PCICONF_CPU] = 0, 118 139 [COBALT_PCICONF_ETH0] = COBALT_QUBE1_ETH0_IRQ,