blob: 50337acc18c5aa9d80b9e0fa832c7c9da57a7487 [file] [log] [blame]
kogiidena94c0fa52006-09-27 14:53:35 +09001/*
2 * arch/sh/boards/landisk/setup.c
3 *
kogiidena94c0fa52006-09-27 14:53:35 +09004 * I-O DATA Device, Inc. LANDISK Support.
5 *
kogiidena00e8c492007-03-19 16:24:12 +09006 * Copyright (C) 2000 Kazumoto Kojima
7 * Copyright (C) 2002 Paul Mundt
8 * Copylight (C) 2002 Atom Create Engineering Co., Ltd.
9 * Copyright (C) 2005-2007 kogiidena
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090010 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
kogiidena94c0fa52006-09-27 14:53:35 +090014 */
kogiidena94c0fa52006-09-27 14:53:35 +090015#include <linux/init.h>
kogiidena00e8c492007-03-19 16:24:12 +090016#include <linux/platform_device.h>
Jeff Garzik0a87e3e2008-02-01 18:02:30 -050017#include <linux/ata_platform.h>
kogiidena94c0fa52006-09-27 14:53:35 +090018#include <linux/pm.h>
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090019#include <linux/mm.h>
kogiidena94c0fa52006-09-27 14:53:35 +090020#include <asm/machvec.h>
Paul Mundt0764bff2008-07-29 22:10:01 +090021#include <mach-landisk/mach/iodata_landisk.h>
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090022#include <asm/io.h>
kogiidena94c0fa52006-09-27 14:53:35 +090023
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090024void init_landisk_IRQ(void);
kogiidena94c0fa52006-09-27 14:53:35 +090025
kogiidena94c0fa52006-09-27 14:53:35 +090026static void landisk_power_off(void)
27{
Paul Mundt9d56dd32010-01-26 12:58:40 +090028 __raw_writeb(0x01, PA_SHUTDOWN);
kogiidena94c0fa52006-09-27 14:53:35 +090029}
30
kogiidena00e8c492007-03-19 16:24:12 +090031static struct resource cf_ide_resources[3];
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090032
kogiidena00e8c492007-03-19 16:24:12 +090033static struct pata_platform_info pata_info = {
34 .ioport_shift = 1,
35};
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090036
kogiidena00e8c492007-03-19 16:24:12 +090037static struct platform_device cf_ide_device = {
38 .name = "pata_platform",
39 .id = -1,
40 .num_resources = ARRAY_SIZE(cf_ide_resources),
41 .resource = cf_ide_resources,
42 .dev = {
43 .platform_data = &pata_info,
44 },
45};
kogiidena94c0fa52006-09-27 14:53:35 +090046
kogiidenaad47c122007-05-12 20:24:15 +090047static struct platform_device rtc_device = {
48 .name = "rs5c313",
49 .id = -1,
50};
51
kogiidena00e8c492007-03-19 16:24:12 +090052static struct platform_device *landisk_devices[] __initdata = {
53 &cf_ide_device,
kogiidenaad47c122007-05-12 20:24:15 +090054 &rtc_device,
kogiidena00e8c492007-03-19 16:24:12 +090055};
kogiidena94c0fa52006-09-27 14:53:35 +090056
kogiidena00e8c492007-03-19 16:24:12 +090057static int __init landisk_devices_setup(void)
kogiidena94c0fa52006-09-27 14:53:35 +090058{
59 pgprot_t prot;
kogiidena00e8c492007-03-19 16:24:12 +090060 unsigned long paddrbase;
61 void *cf_ide_base;
kogiidena94c0fa52006-09-27 14:53:35 +090062
63 /* open I/O area window */
64 paddrbase = virt_to_phys((void *)PA_AREA5_IO);
kogiidena94c0fa52006-09-27 14:53:35 +090065 prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
Paul Mundtf33609342010-01-19 13:55:41 +090066 cf_ide_base = ioremap_prot(paddrbase, PAGE_SIZE, pgprot_val(prot));
kogiidena00e8c492007-03-19 16:24:12 +090067 if (!cf_ide_base) {
kogiidena94c0fa52006-09-27 14:53:35 +090068 printk("allocate_cf_area : can't open CF I/O window!\n");
69 return -ENOMEM;
70 }
71
kogiidena00e8c492007-03-19 16:24:12 +090072 /* IDE cmd address : 0x1f0-0x1f7 and 0x3f6 */
73 cf_ide_resources[0].start = (unsigned long)cf_ide_base + 0x40;
74 cf_ide_resources[0].end = (unsigned long)cf_ide_base + 0x40 + 0x0f;
75 cf_ide_resources[0].flags = IORESOURCE_IO;
76 cf_ide_resources[1].start = (unsigned long)cf_ide_base + 0x2c;
77 cf_ide_resources[1].end = (unsigned long)cf_ide_base + 0x2c + 0x03;
78 cf_ide_resources[1].flags = IORESOURCE_IO;
79 cf_ide_resources[2].start = IRQ_FATA;
80 cf_ide_resources[2].flags = IORESOURCE_IRQ;
kogiidena94c0fa52006-09-27 14:53:35 +090081
kogiidena00e8c492007-03-19 16:24:12 +090082 return platform_add_devices(landisk_devices,
83 ARRAY_SIZE(landisk_devices));
kogiidena94c0fa52006-09-27 14:53:35 +090084}
85
kogiidena00e8c492007-03-19 16:24:12 +090086__initcall(landisk_devices_setup);
87
Paul Mundt2c7834a2006-09-27 18:17:31 +090088static void __init landisk_setup(char **cmdline_p)
89{
kogiidena00e8c492007-03-19 16:24:12 +090090 /* LED ON */
Paul Mundt9d56dd32010-01-26 12:58:40 +090091 __raw_writeb(__raw_readb(PA_LED) | 0x03, PA_LED);
Paul Mundt2c7834a2006-09-27 18:17:31 +090092
93 printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");
Paul Mundt2c7834a2006-09-27 18:17:31 +090094 pm_power_off = landisk_power_off;
95}
96
97/*
98 * The Machine Vector
99 */
Paul Mundt82f81f42007-05-15 15:19:34 +0900100static struct sh_machine_vector mv_landisk __initmv = {
Paul Mundt2c7834a2006-09-27 18:17:31 +0900101 .mv_name = "LANDISK",
kogiidenaf6a3c1c2007-05-08 20:49:46 +0900102 .mv_nr_irqs = 72,
Paul Mundt2c7834a2006-09-27 18:17:31 +0900103 .mv_setup = landisk_setup,
Paul Mundt2c7834a2006-09-27 18:17:31 +0900104 .mv_init_irq = init_landisk_IRQ,
Paul Mundt2c7834a2006-09-27 18:17:31 +0900105};