sh: HS7751RVoIP board updates.
[linux-2.6.git] / arch / sh / boards / renesas / hs7751rvoip / setup.c
1 /*
2  * linux/arch/sh/kernel/setup_hs7751rvoip.c
3  *
4  * Copyright (C) 2000  Kazumoto Kojima
5  *
6  * Renesas Technology Sales HS7751RVoIP Support.
7  *
8  * Modified for HS7751RVoIP by
9  * Atom Create Engineering Co., Ltd. 2002.
10  * Lineo uSolutions, Inc. 2003.
11  */
12
13 #include <linux/init.h>
14 #include <linux/irq.h>
15 #include <linux/mm.h>
16 #include <linux/vmalloc.h>
17 #include <linux/hdreg.h>
18 #include <linux/ide.h>
19 #include <linux/pm.h>
20 #include <asm/hs7751rvoip/hs7751rvoip.h>
21 #include <asm/hs7751rvoip/io.h>
22 #include <asm/io.h>
23 #include <asm/machvec.h>
24 #include <asm/rtc.h>
25 #include <asm/irq.h>
26
27 unsigned int debug_counter;
28
29 static void __init hs7751rvoip_init_irq(void)
30 {
31 #if defined(CONFIG_HS7751RVOIP_CODEC)
32         make_ipr_irq(DMTE0_IRQ, DMA_IPR_ADDR, DMA_IPR_POS, DMA_PRIORITY);
33         make_ipr_irq(DMTE1_IRQ, DMA_IPR_ADDR, DMA_IPR_POS, DMA_PRIORITY);
34 #endif
35
36         init_hs7751rvoip_IRQ();
37 }
38
39 struct sh_machine_vector mv_hs7751rvoip __initmv = {
40         .mv_nr_irqs             = 72,
41
42         .mv_inb                 = hs7751rvoip_inb,
43         .mv_inw                 = hs7751rvoip_inw,
44         .mv_inl                 = hs7751rvoip_inl,
45         .mv_outb                = hs7751rvoip_outb,
46         .mv_outw                = hs7751rvoip_outw,
47         .mv_outl                = hs7751rvoip_outl,
48
49         .mv_inb_p               = hs7751rvoip_inb_p,
50         .mv_inw_p               = hs7751rvoip_inw,
51         .mv_inl_p               = hs7751rvoip_inl,
52         .mv_outb_p              = hs7751rvoip_outb_p,
53         .mv_outw_p              = hs7751rvoip_outw,
54         .mv_outl_p              = hs7751rvoip_outl,
55
56         .mv_insb                = hs7751rvoip_insb,
57         .mv_insw                = hs7751rvoip_insw,
58         .mv_insl                = hs7751rvoip_insl,
59         .mv_outsb               = hs7751rvoip_outsb,
60         .mv_outsw               = hs7751rvoip_outsw,
61         .mv_outsl               = hs7751rvoip_outsl,
62
63         .mv_ioremap             = hs7751rvoip_ioremap,
64         .mv_isa_port2addr       = hs7751rvoip_isa_port2addr,
65         .mv_init_irq            = hs7751rvoip_init_irq,
66 };
67 ALIAS_MV(hs7751rvoip)
68
69 const char *get_system_type(void)
70 {
71         return "HS7751RVoIP";
72 }
73
74 static void hs7751rvoip_power_off(void)
75 {
76         ctrl_outw(ctrl_inw(PA_OUTPORTR) & 0xffdf, PA_OUTPORTR);
77 }
78
79 /*
80  * Initialize the board
81  */
82 void __init platform_setup(void)
83 {
84         printk(KERN_INFO "Renesas Technology Sales HS7751RVoIP-2 support.\n");
85         ctrl_outb(0xf0, PA_OUTPORTR);
86         pm_power_off = hs7751rvoip_power_off;
87         debug_counter = 0;
88 }
89
90 void *area5_io8_base;
91 void *area6_io8_base;
92 void *area5_io16_base;
93 void *area6_io16_base;
94
95 static int __init hs7751rvoip_cf_init(void)
96 {
97         pgprot_t prot;
98         unsigned long paddrbase;
99
100         /* open I/O area window */
101         paddrbase = virt_to_phys((void *)(PA_AREA5_IO+0x00000800));
102         prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_COM16);
103         area5_io16_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot);
104         if (!area5_io16_base) {
105                 printk("allocate_cf_area : can't open CF I/O window!\n");
106                 return -ENOMEM;
107         }
108
109         /* XXX : do we need attribute and common-memory area also? */
110
111         paddrbase = virt_to_phys((void *)PA_AREA6_IO);
112 #if defined(CONFIG_HS7751RVOIP_CODEC)
113         prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_COM8);
114 #else
115         prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO8);
116 #endif
117         area6_io8_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot);
118         if (!area6_io8_base) {
119                 printk("allocate_cf_area : can't open CODEC I/O 8bit window!\n");
120                 return -ENOMEM;
121         }
122         prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO16);
123         area6_io16_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot);
124         if (!area6_io16_base) {
125                 printk("allocate_cf_area : can't open CODEC I/O 16bit window!\n");
126                 return -ENOMEM;
127         }
128
129         return 0;
130 }
131
132 __initcall(hs7751rvoip_cf_init);