Linux-2.6.12-rc2
[linux-flexiantxendom0-natty.git] / arch / sh / boards / harp / setup.c
1 /*
2  * arch/sh/stboard/setup.c
3  *
4  * Copyright (C) 2001 Stuart Menefy (stuart.menefy@st.com)
5  *
6  * May be copied or modified under the terms of the GNU General Public
7  * License.  See linux/COPYING for more information.
8  *
9  * STMicroelectronics ST40STB1 HARP and compatible support.
10  */
11
12 #include <linux/config.h>
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <asm/io.h>
16 #include <asm/harp/harp.h>
17
18 const char *get_system_type(void)
19 {
20         return "STB1 Harp";
21 }
22
23 /*
24  * Initialize the board
25  */
26 int __init platform_setup(void)
27 {
28 #ifdef CONFIG_SH_STB1_HARP
29         unsigned long ic8_version, ic36_version;
30
31         ic8_version = ctrl_inl(EPLD_REVID2);
32         ic36_version = ctrl_inl(EPLD_REVID1);
33
34         printk("STMicroelectronics STB1 HARP initialisaton\n");
35         printk("EPLD versions: IC8: %d.%02d, IC36: %d.%02d\n",
36                (ic8_version >> 4) & 0xf, ic8_version & 0xf,
37                (ic36_version >> 4) & 0xf, ic36_version & 0xf);
38 #elif defined(CONFIG_SH_STB1_OVERDRIVE)
39         unsigned long version;
40
41         version = ctrl_inl(EPLD_REVID);
42
43         printk("STMicroelectronics STB1 Overdrive initialisaton\n");
44         printk("EPLD version: %d.%02d\n",
45                (version >> 4) & 0xf, version & 0xf);
46 #else
47 #error Undefined machine
48 #endif
49  
50         /* Currently all STB1 chips have problems with the sleep instruction,
51          * so disable it here.
52          */
53         disable_hlt();
54
55         return 0;
56 }
57
58 /*
59  * pcibios_map_platform_irq
60  *
61  * This is board specific and returns the IRQ for a given PCI device.
62  * It is used by the PCI code (arch/sh/kernel/st40_pci*)
63  *
64  */
65
66 #define HARP_PCI_IRQ    1
67 #define HARP_BRIDGE_IRQ 2
68 #define OVERDRIVE_SLOT0_IRQ 0
69
70
71 int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin)
72 {
73         switch (slot) {
74 #ifdef CONFIG_SH_STB1_HARP
75         case 2:         /*This is the PCI slot on the */
76                 return HARP_PCI_IRQ;
77         case 1:         /* this is the bridge */
78                 return HARP_BRIDGE_IRQ;
79 #elif defined(CONFIG_SH_STB1_OVERDRIVE)
80         case 1:
81         case 2:
82         case 3:
83                 return slot - 1;
84 #else
85 #error Unknown board
86 #endif
87         default:
88                 return -1;
89         }
90 }
91