7ce577822dc09fb68b8a9bd8512a4a248c8d0e75
[safe/jmp/linux-2.6] / 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
23 /* defined in mm/ioremap.c */
24 extern void * p3_ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags);
25
26 unsigned int debug_counter;
27
28 const char *get_system_type(void)
29 {
30         return "HS7751RVoIP";
31 }
32
33 static void hs7751rvoip_power_off(void)
34 {
35         ctrl_outw(ctrl_inw(PA_OUTPORTR) & 0xffdf, PA_OUTPORTR);
36 }
37
38 /*
39  * Initialize the board
40  */
41 void __init platform_setup(void)
42 {
43         printk(KERN_INFO "Renesas Technology Sales HS7751RVoIP-2 support.\n");
44         ctrl_outb(0xf0, PA_OUTPORTR);
45         pm_power_off = hs7751rvoip_power_off;
46         debug_counter = 0;
47 }
48
49 void *area5_io8_base;
50 void *area6_io8_base;
51 void *area5_io16_base;
52 void *area6_io16_base;
53
54 int __init cf_init(void)
55 {
56         pgprot_t prot;
57         unsigned long paddrbase, psize;
58
59         /* open I/O area window */
60         paddrbase = virt_to_phys((void *)(PA_AREA5_IO+0x00000800));
61         psize = PAGE_SIZE;
62         prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_COM16);
63         area5_io16_base = p3_ioremap(paddrbase, psize, prot.pgprot);
64         if (!area5_io16_base) {
65                 printk("allocate_cf_area : can't open CF I/O window!\n");
66                 return -ENOMEM;
67         }
68
69         /* XXX : do we need attribute and common-memory area also? */
70
71         paddrbase = virt_to_phys((void *)PA_AREA6_IO);
72         psize = PAGE_SIZE;
73 #if defined(CONFIG_HS7751RVOIP_CODEC)
74         prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_COM8);
75 #else
76         prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO8);
77 #endif
78         area6_io8_base = p3_ioremap(paddrbase, psize, prot.pgprot);
79         if (!area6_io8_base) {
80                 printk("allocate_cf_area : can't open CODEC I/O 8bit window!\n");
81                 return -ENOMEM;
82         }
83         prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO16);
84         area6_io16_base = p3_ioremap(paddrbase, psize, prot.pgprot);
85         if (!area6_io16_base) {
86                 printk("allocate_cf_area : can't open CODEC I/O 16bit window!\n");
87                 return -ENOMEM;
88         }
89
90         return 0;
91 }
92
93 __initcall (cf_init);