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