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