Ben Dooks | b7a12d1 | 2008-07-03 11:24:37 +0100 | [diff] [blame] | 1 | /* linux/arch/arm/mach-s3c2410/bast-ide.c |
| 2 | * |
| 3 | * Copyright 2007 Simtec Electronics |
| 4 | * http://www.simtec.co.uk/products/EB2410ITX/ |
| 5 | * http://armlinux.simtec.co.uk/ |
| 6 | * Ben Dooks <ben@simtec.co.uk> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License version 2 as |
| 10 | * published by the Free Software Foundation. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/types.h> |
| 15 | #include <linux/init.h> |
| 16 | #include <linux/interrupt.h> |
| 17 | |
| 18 | #include <linux/platform_device.h> |
| 19 | #include <linux/ata_platform.h> |
| 20 | |
| 21 | #include <asm/mach-types.h> |
| 22 | |
| 23 | #include <asm/mach/arch.h> |
| 24 | #include <asm/mach/map.h> |
| 25 | #include <asm/mach/irq.h> |
| 26 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 27 | #include <mach/map.h> |
Kukjin Kim | bbd7e5e | 2013-01-01 19:56:20 -0800 | [diff] [blame] | 28 | |
| 29 | #include "bast.h" |
Ben Dooks | b7a12d1 | 2008-07-03 11:24:37 +0100 | [diff] [blame] | 30 | |
| 31 | /* IDE ports */ |
| 32 | |
| 33 | static struct pata_platform_info bast_ide_platdata = { |
| 34 | .ioport_shift = 5, |
| 35 | }; |
| 36 | |
Ben Dooks | b7a12d1 | 2008-07-03 11:24:37 +0100 | [diff] [blame] | 37 | static struct resource bast_ide0_resource[] = { |
Kukjin Kim | bbd7e5e | 2013-01-01 19:56:20 -0800 | [diff] [blame] | 38 | [0] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDEPRI, 8 * 0x20), |
| 39 | [1] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDEPRIAUX + (6 * 0x20), 0x20), |
| 40 | [2] = DEFINE_RES_IRQ(BAST_IRQ_IDE0), |
Ben Dooks | b7a12d1 | 2008-07-03 11:24:37 +0100 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | static struct platform_device bast_device_ide0 = { |
| 44 | .name = "pata_platform", |
| 45 | .id = 0, |
| 46 | .num_resources = ARRAY_SIZE(bast_ide0_resource), |
| 47 | .resource = bast_ide0_resource, |
| 48 | .dev = { |
| 49 | .platform_data = &bast_ide_platdata, |
| 50 | .coherent_dma_mask = ~0, |
| 51 | } |
| 52 | |
| 53 | }; |
| 54 | |
| 55 | static struct resource bast_ide1_resource[] = { |
Kukjin Kim | bbd7e5e | 2013-01-01 19:56:20 -0800 | [diff] [blame] | 56 | [0] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDESEC, 8 * 0x20), |
| 57 | [1] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDESECAUX + (6 * 0x20), 0x20), |
| 58 | [2] = DEFINE_RES_IRQ(BAST_IRQ_IDE1), |
Ben Dooks | b7a12d1 | 2008-07-03 11:24:37 +0100 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | static struct platform_device bast_device_ide1 = { |
| 62 | .name = "pata_platform", |
| 63 | .id = 1, |
| 64 | .num_resources = ARRAY_SIZE(bast_ide1_resource), |
| 65 | .resource = bast_ide1_resource, |
| 66 | .dev = { |
| 67 | .platform_data = &bast_ide_platdata, |
| 68 | .coherent_dma_mask = ~0, |
| 69 | } |
| 70 | }; |
| 71 | |
| 72 | static struct platform_device *bast_ide_devices[] __initdata = { |
| 73 | &bast_device_ide0, |
| 74 | &bast_device_ide1, |
| 75 | }; |
| 76 | |
| 77 | static __init int bast_ide_init(void) |
| 78 | { |
| 79 | if (machine_is_bast() || machine_is_vr1000()) |
| 80 | return platform_add_devices(bast_ide_devices, |
| 81 | ARRAY_SIZE(bast_ide_devices)); |
| 82 | |
| 83 | return 0; |
| 84 | } |
| 85 | |
| 86 | fs_initcall(bast_ide_init); |