Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / arch / sh / boards / bigsur / setup.c
1 /*
2  *
3  * By Dustin McIntire (dustin@sensoria.com) (c)2001
4  * 
5  * Setup and IRQ handling code for the HD64465 companion chip.
6  * by Greg Banks <gbanks@pocketpenguins.com>
7  * Copyright (c) 2000 PocketPenguins Inc
8  *
9  * Derived from setup_hd64465.c which bore the message:
10  * Greg Banks <gbanks@pocketpenguins.com>
11  * Copyright (c) 2000 PocketPenguins Inc and
12  * Copyright (C) 2000 YAEGASHI Takeshi
13  * and setup_cqreek.c which bore message:
14  * Copyright (C) 2000  Niibe Yutaka
15  * 
16  * May be copied or modified under the terms of the GNU General Public
17  * License.  See linux/COPYING for more information.
18  *
19  * Setup functions for a Hitachi Big Sur Evaluation Board.
20  * 
21  */
22
23 #include <linux/sched.h>
24 #include <linux/module.h>
25 #include <linux/kernel.h>
26 #include <linux/param.h>
27 #include <linux/ioport.h>
28 #include <linux/interrupt.h>
29 #include <linux/init.h>
30 #include <linux/irq.h>
31 #include <linux/bitops.h>
32
33 #include <asm/io.h>
34 #include <asm/irq.h>
35 #include <asm/machvec.h>
36 #include <asm/bigsur/io.h>
37 #include <asm/hd64465/hd64465.h>
38 #include <asm/bigsur/bigsur.h>
39
40 /*===========================================================*/
41 //              Big Sur Init Routines   
42 /*===========================================================*/
43
44 const char *get_system_type(void)
45 {
46         return "Big Sur";
47 }
48
49 /*
50  * The Machine Vector
51  */
52 extern void heartbeat_bigsur(void);
53 extern void init_bigsur_IRQ(void);
54
55 struct sh_machine_vector mv_bigsur __initmv = {
56         .mv_nr_irqs             = NR_IRQS,     // Defined in <asm/irq.h>
57
58         .mv_isa_port2addr       = bigsur_isa_port2addr,
59         .mv_irq_demux           = bigsur_irq_demux,
60
61         .mv_init_irq            = init_bigsur_IRQ,
62 #ifdef CONFIG_HEARTBEAT
63         .mv_heartbeat           = heartbeat_bigsur,
64 #endif
65 };
66 ALIAS_MV(bigsur)
67
68 int __init platform_setup(void)
69 {
70         /* Mask all 2nd level IRQ's */
71         outb(-1,BIGSUR_IMR0);
72         outb(-1,BIGSUR_IMR1);
73         outb(-1,BIGSUR_IMR2);
74         outb(-1,BIGSUR_IMR3);
75
76         /* Mask 1st level interrupts */
77         outb(-1,BIGSUR_IRLMR0);
78         outb(-1,BIGSUR_IRLMR1);
79
80 #if defined (CONFIG_HD64465) && defined (CONFIG_SERIAL) 
81         /* remap IO ports for first ISA serial port to HD64465 UART */
82         bigsur_port_map(0x3f8, 8, CONFIG_HD64465_IOBASE + 0x8000, 1);
83 #endif /* CONFIG_HD64465 && CONFIG_SERIAL */
84         /* TODO: setup IDE registers */
85         bigsur_port_map(BIGSUR_IDECTL_IOPORT, 2, BIGSUR_ICTL, 8);
86         /* Setup the Ethernet port to BIGSUR_ETHER_IOPORT */
87         bigsur_port_map(BIGSUR_ETHER_IOPORT, 16, BIGSUR_ETHR+BIGSUR_ETHER_IOPORT, 0);
88         /* set page to 1 */
89         outw(1, BIGSUR_ETHR+0xe);
90         /* set the IO port to BIGSUR_ETHER_IOPORT */
91         outw(BIGSUR_ETHER_IOPORT<<3, BIGSUR_ETHR+0x2);
92
93         return 0;
94 }
95