aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorYoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>2007-05-11 08:43:09 -0400
committerRalf Baechle <ralf@linux-mips.org>2007-05-11 09:28:34 -0400
commit3f2d560e9029ec0b7edf8be0c32425f4bb57d582 (patch)
treec1eec72f06c535cd18e2e53efd01e3403572056b /arch
parentb0cc114c04c114b933661eba329d9776c0eab74c (diff)
[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>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/cobalt/setup.c12
-rw-r--r--arch/mips/pci/fixup-cobalt.c21
2 files changed, 21 insertions, 12 deletions
diff --git a/arch/mips/cobalt/setup.c b/arch/mips/cobalt/setup.c
index e2f53abfb440..7abe45e78425 100644
--- a/arch/mips/cobalt/setup.c
+++ b/arch/mips/cobalt/setup.c
@@ -10,7 +10,6 @@
10 * 10 *
11 */ 11 */
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <linux/pci.h>
14#include <linux/init.h> 13#include <linux/init.h>
15#include <linux/pm.h> 14#include <linux/pm.h>
16 15
@@ -26,8 +25,6 @@ extern void cobalt_machine_restart(char *command);
26extern void cobalt_machine_halt(void); 25extern void cobalt_machine_halt(void);
27extern void cobalt_machine_power_off(void); 26extern void cobalt_machine_power_off(void);
28 27
29int cobalt_board_id;
30
31const char *get_system_type(void) 28const char *get_system_type(void)
32{ 29{
33 switch (cobalt_board_id) { 30 switch (cobalt_board_id) {
@@ -92,7 +89,6 @@ static struct resource cobalt_reserved_resources[] = {
92 89
93void __init plat_mem_setup(void) 90void __init plat_mem_setup(void)
94{ 91{
95 unsigned int devfn = PCI_DEVFN(COBALT_PCICONF_VIA, 0);
96 int i; 92 int i;
97 93
98 _machine_restart = cobalt_machine_restart; 94 _machine_restart = cobalt_machine_restart;
@@ -107,14 +103,6 @@ void __init plat_mem_setup(void)
107 /* These resources have been reserved by VIA SuperI/O chip. */ 103 /* These resources have been reserved by VIA SuperI/O chip. */
108 for (i = 0; i < ARRAY_SIZE(cobalt_reserved_resources); i++) 104 for (i = 0; i < ARRAY_SIZE(cobalt_reserved_resources); i++)
109 request_resource(&ioport_resource, cobalt_reserved_resources + i); 105 request_resource(&ioport_resource, cobalt_reserved_resources + i);
110
111 /* Read the cobalt id register out of the PCI config space */
112 PCI_CFG_SET(devfn, (VIA_COBALT_BRD_ID_REG & ~0x3));
113 cobalt_board_id = GT_READ(GT_PCI0_CFGDATA_OFS);
114 cobalt_board_id >>= ((VIA_COBALT_BRD_ID_REG & 3) * 8);
115 cobalt_board_id = VIA_COBALT_BRD_REG_to_ID(cobalt_board_id);
116
117 printk("Cobalt board ID: %d\n", cobalt_board_id);
118} 106}
119 107
120/* 108/*
diff --git a/arch/mips/pci/fixup-cobalt.c b/arch/mips/pci/fixup-cobalt.c
index f4acae694a5a..d57ffd7242ca 100644
--- a/arch/mips/pci/fixup-cobalt.c
+++ b/arch/mips/pci/fixup-cobalt.c
@@ -113,6 +113,27 @@ static void qube_raq_galileo_fixup(struct pci_dev *dev)
113DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_GT64111, 113DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_GT64111,
114 qube_raq_galileo_fixup); 114 qube_raq_galileo_fixup);
115 115
116int cobalt_board_id;
117
118static 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
134DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_0,
135 qube_raq_via_board_id_fixup);
136
116static char irq_tab_qube1[] __initdata = { 137static char irq_tab_qube1[] __initdata = {
117 [COBALT_PCICONF_CPU] = 0, 138 [COBALT_PCICONF_CPU] = 0,
118 [COBALT_PCICONF_ETH0] = COBALT_QUBE1_ETH0_IRQ, 139 [COBALT_PCICONF_ETH0] = COBALT_QUBE1_ETH0_IRQ,