2006-09-27 13:53:35 +08:00
|
|
|
/*
|
|
|
|
* arch/sh/boards/landisk/setup.c
|
|
|
|
*
|
|
|
|
* I-O DATA Device, Inc. LANDISK Support.
|
|
|
|
*
|
2007-03-19 15:24:12 +08:00
|
|
|
* Copyright (C) 2000 Kazumoto Kojima
|
|
|
|
* Copyright (C) 2002 Paul Mundt
|
|
|
|
* Copylight (C) 2002 Atom Create Engineering Co., Ltd.
|
|
|
|
* Copyright (C) 2005-2007 kogiidena
|
2006-09-27 14:16:42 +08:00
|
|
|
*
|
|
|
|
* 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.
|
2006-09-27 13:53:35 +08:00
|
|
|
*/
|
|
|
|
#include <linux/init.h>
|
2007-03-19 15:24:12 +08:00
|
|
|
#include <linux/platform_device.h>
|
2008-02-02 07:02:30 +08:00
|
|
|
#include <linux/ata_platform.h>
|
2006-09-27 13:53:35 +08:00
|
|
|
#include <linux/pm.h>
|
2006-09-27 14:16:42 +08:00
|
|
|
#include <linux/mm.h>
|
2006-09-27 13:53:35 +08:00
|
|
|
#include <asm/machvec.h>
|
2008-07-29 21:10:01 +08:00
|
|
|
#include <mach-landisk/mach/iodata_landisk.h>
|
2006-09-27 14:16:42 +08:00
|
|
|
#include <asm/io.h>
|
2006-09-27 13:53:35 +08:00
|
|
|
|
2006-09-27 14:16:42 +08:00
|
|
|
static void landisk_power_off(void)
|
|
|
|
{
|
2010-01-26 11:58:40 +08:00
|
|
|
__raw_writeb(0x01, PA_SHUTDOWN);
|
2006-09-27 14:16:42 +08:00
|
|
|
}
|
|
|
|
|
2007-03-19 15:24:12 +08:00
|
|
|
static struct resource cf_ide_resources[3];
|
2006-09-27 14:16:42 +08:00
|
|
|
|
2007-03-19 15:24:12 +08:00
|
|
|
static struct pata_platform_info pata_info = {
|
|
|
|
.ioport_shift = 1,
|
|
|
|
};
|
2006-09-27 14:16:42 +08:00
|
|
|
|
2007-03-19 15:24:12 +08:00
|
|
|
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,
|
|
|
|
},
|
|
|
|
};
|
2006-09-27 14:16:42 +08:00
|
|
|
|
2007-05-12 19:24:15 +08:00
|
|
|
static struct platform_device rtc_device = {
|
|
|
|
.name = "rs5c313",
|
|
|
|
.id = -1,
|
|
|
|
};
|
|
|
|
|
2007-03-19 15:24:12 +08:00
|
|
|
static struct platform_device *landisk_devices[] __initdata = {
|
|
|
|
&cf_ide_device,
|
2007-05-12 19:24:15 +08:00
|
|
|
&rtc_device,
|
2007-03-19 15:24:12 +08:00
|
|
|
};
|
2006-09-27 14:16:42 +08:00
|
|
|
|
2007-03-19 15:24:12 +08:00
|
|
|
static int __init landisk_devices_setup(void)
|
2006-09-27 14:16:42 +08:00
|
|
|
{
|
|
|
|
pgprot_t prot;
|
2007-03-19 15:24:12 +08:00
|
|
|
unsigned long paddrbase;
|
|
|
|
void *cf_ide_base;
|
2006-09-27 14:16:42 +08:00
|
|
|
|
|
|
|
/* open I/O area window */
|
|
|
|
paddrbase = virt_to_phys((void *)PA_AREA5_IO);
|
|
|
|
prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
|
2010-01-19 12:55:41 +08:00
|
|
|
cf_ide_base = ioremap_prot(paddrbase, PAGE_SIZE, pgprot_val(prot));
|
2007-03-19 15:24:12 +08:00
|
|
|
if (!cf_ide_base) {
|
2006-09-27 14:16:42 +08:00
|
|
|
printk("allocate_cf_area : can't open CF I/O window!\n");
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
2007-03-19 15:24:12 +08:00
|
|
|
/* 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));
|
2006-09-27 14:16:42 +08:00
|
|
|
}
|
|
|
|
|
2011-01-07 11:02:15 +08:00
|
|
|
device_initcall(landisk_devices_setup);
|
2007-03-19 15:24:12 +08:00
|
|
|
|
2006-09-27 17:17:31 +08:00
|
|
|
static void __init landisk_setup(char **cmdline_p)
|
|
|
|
{
|
2007-03-19 15:24:12 +08:00
|
|
|
/* LED ON */
|
2010-01-26 11:58:40 +08:00
|
|
|
__raw_writeb(__raw_readb(PA_LED) | 0x03, PA_LED);
|
2006-09-27 17:17:31 +08:00
|
|
|
|
|
|
|
printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");
|
|
|
|
pm_power_off = landisk_power_off;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The Machine Vector
|
|
|
|
*/
|
2007-05-15 14:19:34 +08:00
|
|
|
static struct sh_machine_vector mv_landisk __initmv = {
|
2006-09-27 17:17:31 +08:00
|
|
|
.mv_name = "LANDISK",
|
|
|
|
.mv_setup = landisk_setup,
|
|
|
|
.mv_init_irq = init_landisk_IRQ,
|
|
|
|
};
|