setup.c 2.6 KB
Newer Older
K
kogiidena 已提交
1 2 3 4 5
/*
 * arch/sh/boards/landisk/setup.c
 *
 * I-O DATA Device, Inc. LANDISK Support.
 *
K
kogiidena 已提交
6 7 8 9
 * Copyright (C) 2000 Kazumoto Kojima
 * Copyright (C) 2002 Paul Mundt
 * Copylight (C) 2002 Atom Create Engineering Co., Ltd.
 * Copyright (C) 2005-2007 kogiidena
P
Paul Mundt 已提交
10 11 12 13
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
K
kogiidena 已提交
14 15
 */
#include <linux/init.h>
K
kogiidena 已提交
16
#include <linux/platform_device.h>
17
#include <linux/ata_platform.h>
K
kogiidena 已提交
18
#include <linux/pm.h>
P
Paul Mundt 已提交
19
#include <linux/mm.h>
K
kogiidena 已提交
20 21
#include <asm/machvec.h>
#include <asm/landisk/iodata_landisk.h>
P
Paul Mundt 已提交
22
#include <asm/io.h>
K
kogiidena 已提交
23

P
Paul Mundt 已提交
24
void init_landisk_IRQ(void);
K
kogiidena 已提交
25

P
Paul Mundt 已提交
26 27 28 29 30
static void landisk_power_off(void)
{
        ctrl_outb(0x01, PA_SHUTDOWN);
}

K
kogiidena 已提交
31
static struct resource cf_ide_resources[3];
P
Paul Mundt 已提交
32

K
kogiidena 已提交
33 34 35
static struct pata_platform_info pata_info = {
	.ioport_shift	= 1,
};
P
Paul Mundt 已提交
36

K
kogiidena 已提交
37 38 39 40 41 42 43 44 45
static struct platform_device cf_ide_device = {
	.name		= "pata_platform",
	.id		= -1,
	.num_resources	= ARRAY_SIZE(cf_ide_resources),
	.resource	= cf_ide_resources,
	.dev		= {
		.platform_data = &pata_info,
	},
};
P
Paul Mundt 已提交
46

K
kogiidena 已提交
47 48 49 50 51
static struct platform_device rtc_device = {
	.name		= "rs5c313",
	.id		= -1,
};

K
kogiidena 已提交
52 53
static struct platform_device *landisk_devices[] __initdata = {
	&cf_ide_device,
K
kogiidena 已提交
54
	&rtc_device,
K
kogiidena 已提交
55
};
P
Paul Mundt 已提交
56

K
kogiidena 已提交
57
static int __init landisk_devices_setup(void)
P
Paul Mundt 已提交
58 59
{
	pgprot_t prot;
K
kogiidena 已提交
60 61
	unsigned long paddrbase;
	void *cf_ide_base;
P
Paul Mundt 已提交
62 63 64 65

	/* open I/O area window */
	paddrbase = virt_to_phys((void *)PA_AREA5_IO);
	prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
K
kogiidena 已提交
66 67
	cf_ide_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot);
	if (!cf_ide_base) {
P
Paul Mundt 已提交
68 69 70 71
		printk("allocate_cf_area : can't open CF I/O window!\n");
		return -ENOMEM;
	}

K
kogiidena 已提交
72 73 74 75 76 77 78 79 80 81 82 83
	/* IDE cmd address : 0x1f0-0x1f7 and 0x3f6 */
	cf_ide_resources[0].start = (unsigned long)cf_ide_base + 0x40;
	cf_ide_resources[0].end   = (unsigned long)cf_ide_base + 0x40 + 0x0f;
	cf_ide_resources[0].flags = IORESOURCE_IO;
	cf_ide_resources[1].start = (unsigned long)cf_ide_base + 0x2c;
	cf_ide_resources[1].end   = (unsigned long)cf_ide_base + 0x2c + 0x03;
	cf_ide_resources[1].flags = IORESOURCE_IO;
	cf_ide_resources[2].start = IRQ_FATA;
	cf_ide_resources[2].flags = IORESOURCE_IRQ;

	return platform_add_devices(landisk_devices,
				    ARRAY_SIZE(landisk_devices));
P
Paul Mundt 已提交
84 85
}

K
kogiidena 已提交
86 87
__initcall(landisk_devices_setup);

P
Paul Mundt 已提交
88 89
static void __init landisk_setup(char **cmdline_p)
{
K
kogiidena 已提交
90 91
        /* LED ON */
	ctrl_outb(ctrl_inb(PA_LED) | 0x03, PA_LED);
P
Paul Mundt 已提交
92 93 94 95 96 97 98 99

	printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");
	pm_power_off = landisk_power_off;
}

/*
 * The Machine Vector
 */
P
Paul Mundt 已提交
100
static struct sh_machine_vector mv_landisk __initmv = {
P
Paul Mundt 已提交
101
	.mv_name = "LANDISK",
K
kogiidena 已提交
102
	.mv_nr_irqs = 72,
P
Paul Mundt 已提交
103 104 105
	.mv_setup = landisk_setup,
	.mv_init_irq = init_landisk_IRQ,
};