1 /* 2 * arch/sh/boards/landisk/setup.c 3 * 4 * I-O DATA Device, Inc. LANDISK Support. 5 * 6 * 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 10 * 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. 14 */ 15 #include <linux/init.h> 16 #include <linux/platform_device.h> 17 #include <linux/ata_platform.h> 18 #include <linux/pm.h> 19 #include <linux/mm.h> 20 #include <asm/machvec.h> 21 #include <mach-landisk/mach/iodata_landisk.h> 22 #include <asm/io.h> 23 24 void init_landisk_IRQ(void); 25 26 static void landisk_power_off(void) 27 { 28 ctrl_outb(0x01, PA_SHUTDOWN); 29 } 30 31 static struct resource cf_ide_resources[3]; 32 33 static struct pata_platform_info pata_info = { 34 .ioport_shift = 1, 35 }; 36 37 static 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 }; 46 47 static struct platform_device rtc_device = { 48 .name = "rs5c313", 49 .id = -1, 50 }; 51 52 static struct platform_device *landisk_devices[] __initdata = { 53 &cf_ide_device, 54 &rtc_device, 55 }; 56 57 static int __init landisk_devices_setup(void) 58 { 59 pgprot_t prot; 60 unsigned long paddrbase; 61 void *cf_ide_base; 62 63 /* open I/O area window */ 64 paddrbase = virt_to_phys((void *)PA_AREA5_IO); 65 prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16); 66 cf_ide_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot); 67 if (!cf_ide_base) { 68 printk("allocate_cf_area : can't open CF I/O window!\n"); 69 return -ENOMEM; 70 } 71 72 /* 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; 81 82 return platform_add_devices(landisk_devices, 83 ARRAY_SIZE(landisk_devices)); 84 } 85 86 __initcall(landisk_devices_setup); 87 88 static void __init landisk_setup(char **cmdline_p) 89 { 90 /* LED ON */ 91 ctrl_outb(ctrl_inb(PA_LED) | 0x03, PA_LED); 92 93 printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n"); 94 pm_power_off = landisk_power_off; 95 } 96 97 /* 98 * The Machine Vector 99 */ 100 static struct sh_machine_vector mv_landisk __initmv = { 101 .mv_name = "LANDISK", 102 .mv_nr_irqs = 72, 103 .mv_setup = landisk_setup, 104 .mv_init_irq = init_landisk_IRQ, 105 }; 106