setup.c 2.6 KB
Newer Older
L
Linus Torvalds 已提交
1
/*
P
Paul Mundt 已提交
2
 * Renesas Technology Sales HS7751RVoIP Support.
L
Linus Torvalds 已提交
3 4 5 6 7 8 9 10 11
 *
 * Copyright (C) 2000  Kazumoto Kojima
 *
 * Modified for HS7751RVoIP by
 * Atom Create Engineering Co., Ltd. 2002.
 * Lineo uSolutions, Inc. 2003.
 */
#include <linux/init.h>
#include <linux/irq.h>
12 13
#include <linux/mm.h>
#include <linux/pm.h>
P
Paul Mundt 已提交
14
#include <asm/hs7751rvoip.h>
P
Paul Mundt 已提交
15 16
#include <asm/io.h>
#include <asm/machvec.h>
L
Linus Torvalds 已提交
17

18 19 20 21 22
static void hs7751rvoip_power_off(void)
{
	ctrl_outw(ctrl_inw(PA_OUTPORTR) & 0xffdf, PA_OUTPORTR);
}

L
Linus Torvalds 已提交
23 24 25 26 27
void *area5_io8_base;
void *area6_io8_base;
void *area5_io16_base;
void *area6_io16_base;

P
Paul Mundt 已提交
28
static int __init hs7751rvoip_cf_init(void)
L
Linus Torvalds 已提交
29 30
{
	pgprot_t prot;
P
Paul Mundt 已提交
31
	unsigned long paddrbase;
L
Linus Torvalds 已提交
32 33 34 35

	/* open I/O area window */
	paddrbase = virt_to_phys((void *)(PA_AREA5_IO+0x00000800));
	prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_COM16);
P
Paul Mundt 已提交
36
	area5_io16_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot);
L
Linus Torvalds 已提交
37 38 39 40 41 42 43 44 45 46 47 48 49
	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);
#if defined(CONFIG_HS7751RVOIP_CODEC)
	prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_COM8);
#else
	prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO8);
#endif
P
Paul Mundt 已提交
50
	area6_io8_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot);
L
Linus Torvalds 已提交
51 52 53 54 55
	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);
P
Paul Mundt 已提交
56
	area6_io16_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot);
L
Linus Torvalds 已提交
57 58 59 60 61 62 63
	if (!area6_io16_base) {
		printk("allocate_cf_area : can't open CODEC I/O 16bit window!\n");
		return -ENOMEM;
	}

	return 0;
}
64
device_initcall(hs7751rvoip_cf_init);
L
Linus Torvalds 已提交
65

P
Paul Mundt 已提交
66 67 68 69 70 71 72 73 74 75 76
/*
 * Initialize the board
 */
static void __init hs7751rvoip_setup(char **cmdline_p)
{
	ctrl_outb(0xf0, PA_OUTPORTR);
	pm_power_off = hs7751rvoip_power_off;

	printk(KERN_INFO "Renesas Technology Sales HS7751RVoIP-2 support.\n");
}

P
Paul Mundt 已提交
77
static struct sh_machine_vector mv_hs7751rvoip __initmv = {
P
Paul Mundt 已提交
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
	.mv_name		= "HS7751RVoIP",
	.mv_setup		= hs7751rvoip_setup,
	.mv_nr_irqs		= 72,

	.mv_inb			= hs7751rvoip_inb,
	.mv_inw			= hs7751rvoip_inw,
	.mv_inl			= hs7751rvoip_inl,
	.mv_outb		= hs7751rvoip_outb,
	.mv_outw		= hs7751rvoip_outw,
	.mv_outl		= hs7751rvoip_outl,

	.mv_inb_p		= hs7751rvoip_inb_p,
	.mv_inw_p		= hs7751rvoip_inw,
	.mv_inl_p		= hs7751rvoip_inl,
	.mv_outb_p		= hs7751rvoip_outb_p,
	.mv_outw_p		= hs7751rvoip_outw,
	.mv_outl_p		= hs7751rvoip_outl,

	.mv_insb		= hs7751rvoip_insb,
	.mv_insw		= hs7751rvoip_insw,
	.mv_insl		= hs7751rvoip_insl,
	.mv_outsb		= hs7751rvoip_outsb,
	.mv_outsw		= hs7751rvoip_outsw,
	.mv_outsl		= hs7751rvoip_outsl,

103
	.mv_init_irq		= init_hs7751rvoip_IRQ,
P
Paul Mundt 已提交
104 105
	.mv_ioport_map		= hs7751rvoip_ioport_map,
};