| 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> | 
|  | 28 | #include <mach/bast-map.h> | 
|  | 29 | #include <mach/bast-irq.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 |  | 
|  | 37 | #define IDE_CS	S3C2410_CS5 | 
|  | 38 |  | 
|  | 39 | static struct resource bast_ide0_resource[] = { | 
|  | 40 | [0]	= { | 
|  | 41 | .start	= IDE_CS + BAST_PA_IDEPRI, | 
|  | 42 | .end	= IDE_CS + BAST_PA_IDEPRI + (8 * 0x20) - 1, | 
|  | 43 | .flags	= IORESOURCE_MEM, | 
|  | 44 | }, | 
|  | 45 | [1]	= { | 
|  | 46 | .start	= IDE_CS + BAST_PA_IDEPRIAUX + (6 * 0x20) , | 
|  | 47 | .end	= IDE_CS + BAST_PA_IDEPRIAUX + (7 * 0x20) - 1, | 
|  | 48 | .flags	= IORESOURCE_MEM, | 
|  | 49 | }, | 
|  | 50 | [2]	= { | 
|  | 51 | .start	= IRQ_IDE0, | 
|  | 52 | .end	= IRQ_IDE0, | 
|  | 53 | .flags	= IORESOURCE_IRQ, | 
|  | 54 | }, | 
|  | 55 | }; | 
|  | 56 |  | 
|  | 57 | static struct platform_device bast_device_ide0 = { | 
|  | 58 | .name		= "pata_platform", | 
|  | 59 | .id		= 0, | 
|  | 60 | .num_resources	= ARRAY_SIZE(bast_ide0_resource), | 
|  | 61 | .resource	= bast_ide0_resource, | 
|  | 62 | .dev		= { | 
|  | 63 | .platform_data = &bast_ide_platdata, | 
|  | 64 | .coherent_dma_mask = ~0, | 
|  | 65 | } | 
|  | 66 |  | 
|  | 67 | }; | 
|  | 68 |  | 
|  | 69 | static struct resource bast_ide1_resource[] = { | 
|  | 70 | [0]	= { | 
|  | 71 | .start	= IDE_CS + BAST_PA_IDESEC, | 
|  | 72 | .end	= IDE_CS + BAST_PA_IDESEC + (8 * 0x20) - 1, | 
|  | 73 | .flags	= IORESOURCE_MEM, | 
|  | 74 | }, | 
|  | 75 | [1]	= { | 
|  | 76 | .start	= IDE_CS + BAST_PA_IDESECAUX + (6 * 0x20), | 
|  | 77 | .end	= IDE_CS + BAST_PA_IDESECAUX + (7 * 0x20) - 1, | 
|  | 78 | .flags	= IORESOURCE_MEM, | 
|  | 79 | }, | 
|  | 80 | [2]	= { | 
|  | 81 | .start	= IRQ_IDE1, | 
|  | 82 | .end	= IRQ_IDE1, | 
|  | 83 | .flags	= IORESOURCE_IRQ, | 
|  | 84 | }, | 
|  | 85 | }; | 
|  | 86 |  | 
|  | 87 | static struct platform_device bast_device_ide1 = { | 
|  | 88 | .name		= "pata_platform", | 
|  | 89 | .id		= 1, | 
|  | 90 | .num_resources	= ARRAY_SIZE(bast_ide1_resource), | 
|  | 91 | .resource	= bast_ide1_resource, | 
|  | 92 | .dev		= { | 
|  | 93 | .platform_data = &bast_ide_platdata, | 
|  | 94 | .coherent_dma_mask = ~0, | 
|  | 95 | } | 
|  | 96 | }; | 
|  | 97 |  | 
|  | 98 | static struct platform_device *bast_ide_devices[] __initdata = { | 
|  | 99 | &bast_device_ide0, | 
|  | 100 | &bast_device_ide1, | 
|  | 101 | }; | 
|  | 102 |  | 
|  | 103 | static __init int bast_ide_init(void) | 
|  | 104 | { | 
|  | 105 | if (machine_is_bast() || machine_is_vr1000()) | 
|  | 106 | return platform_add_devices(bast_ide_devices, | 
|  | 107 | ARRAY_SIZE(bast_ide_devices)); | 
|  | 108 |  | 
|  | 109 | return 0; | 
|  | 110 | } | 
|  | 111 |  | 
|  | 112 | fs_initcall(bast_ide_init); |