aa51bda931f65dac6edde1176f0517824ae745a2
[sfrench/cifs-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_isa_port2addr       = hs7751rvoip_isa_port2addr,
64         .mv_init_irq            = hs7751rvoip_init_irq,
65 };
66 ALIAS_MV(hs7751rvoip)
67
68 const char *get_system_type(void)
69 {
70         return "HS7751RVoIP";
71 }
72
73 static void hs7751rvoip_power_off(void)
74 {
75         ctrl_outw(ctrl_inw(PA_OUTPORTR) & 0xffdf, PA_OUTPORTR);
76 }
77
78 /*
79  * Initialize the board
80  */
81 void __init platform_setup(void)
82 {
83         printk(KERN_INFO "Renesas Technology Sales HS7751RVoIP-2 support.\n");
84         ctrl_outb(0xf0, PA_OUTPORTR);
85         pm_power_off = hs7751rvoip_power_off;
86         debug_counter = 0;
87 }
88
89 void *area5_io8_base;
90 void *area6_io8_base;
91 void *area5_io16_base;
92 void *area6_io16_base;
93
94 static int __init hs7751rvoip_cf_init(void)
95 {
96         pgprot_t prot;
97         unsigned long paddrbase;
98
99         /* open I/O area window */
100         paddrbase = virt_to_phys((void *)(PA_AREA5_IO+0x00000800));
101         prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_COM16);
102         area5_io16_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot);
103         if (!area5_io16_base) {
104                 printk("allocate_cf_area : can't open CF I/O window!\n");
105                 return -ENOMEM;
106         }
107
108         /* XXX : do we need attribute and common-memory area also? */
109
110         paddrbase = virt_to_phys((void *)PA_AREA6_IO);
111 #if defined(CONFIG_HS7751RVOIP_CODEC)
112         prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_COM8);
113 #else
114         prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO8);
115 #endif
116         area6_io8_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot);
117         if (!area6_io8_base) {
118                 printk("allocate_cf_area : can't open CODEC I/O 8bit window!\n");
119                 return -ENOMEM;
120         }
121         prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO16);
122         area6_io16_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot);
123         if (!area6_io16_base) {
124                 printk("allocate_cf_area : can't open CODEC I/O 16bit window!\n");
125                 return -ENOMEM;
126         }
127
128         return 0;
129 }
130
131 __initcall(hs7751rvoip_cf_init);