summaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/renesas/hs7751rvoip/setup.c
blob: 7ce577822dc09fb68b8a9bd8512a4a248c8d0e75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
 * linux/arch/sh/kernel/setup_hs7751rvoip.c
 *
 * Copyright (C) 2000  Kazumoto Kojima
 *
 * Renesas Technology Sales HS7751RVoIP Support.
 *
 * Modified for HS7751RVoIP by
 * Atom Create Engineering Co., Ltd. 2002.
 * Lineo uSolutions, Inc. 2003.
 */

#include <linux/init.h>
#include <linux/irq.h>
#include <linux/mm.h>
#include <linux/vmalloc.h>
#include <linux/hdreg.h>
#include <linux/ide.h>
#include <linux/pm.h>
#include <asm/io.h>
#include <asm/hs7751rvoip/hs7751rvoip.h>

/* defined in mm/ioremap.c */
extern void * p3_ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags);

unsigned int debug_counter;

const char *get_system_type(void)
{
	return "HS7751RVoIP";
}

static void hs7751rvoip_power_off(void)
{
	ctrl_outw(ctrl_inw(PA_OUTPORTR) & 0xffdf, PA_OUTPORTR);
}

/*
 * Initialize the board
 */
void __init platform_setup(void)
{
	printk(KERN_INFO "Renesas Technology Sales HS7751RVoIP-2 support.\n");
	ctrl_outb(0xf0, PA_OUTPORTR);
	pm_power_off = hs7751rvoip_power_off;
	debug_counter = 0;
}

void *area5_io8_base;
void *area6_io8_base;
void *area5_io16_base;
void *area6_io16_base;

int __init cf_init(void)
{
	pgprot_t prot;
	unsigned long paddrbase, psize;

	/* open I/O area window */
	paddrbase = virt_to_phys((void *)(PA_AREA5_IO+0x00000800));
	psize = PAGE_SIZE;
	prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_COM16);
	area5_io16_base = p3_ioremap(paddrbase, psize, prot.pgprot);
	if (!area5_io16_base) {
		printk("allocate_cf_area : can't open CF I/O window!\n");
		return -ENOMEM;
	}

	/* XXX : do we need attribute and common-memory area also? */

	paddrbase = virt_to_phys((void *)PA_AREA6_IO);
	psize = PAGE_SIZE;
#if defined(CONFIG_HS7751RVOIP_CODEC)
	prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_COM8);
#else
	prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO8);
#endif
	area6_io8_base = p3_ioremap(paddrbase, psize, prot.pgprot);
	if (!area6_io8_base) {
		printk("allocate_cf_area : can't open CODEC I/O 8bit window!\n");
		return -ENOMEM;
	}
	prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO16);
	area6_io16_base = p3_ioremap(paddrbase, psize, prot.pgprot);
	if (!area6_io16_base) {
		printk("allocate_cf_area : can't open CODEC I/O 16bit window!\n");
		return -ENOMEM;
	}

	return 0;
}

__initcall (cf_init);