1 // SPDX-License-Identifier: GPL-2.0
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 #include <linux/kernel.h>
9 #include <linux/types.h>
10 #include <linux/init.h>
11 #include <linux/interrupt.h>
12 
13 #include <linux/platform_device.h>
14 #include <linux/ata_platform.h>
15 
16 #include <asm/mach-types.h>
17 
18 #include <asm/mach/arch.h>
19 #include <asm/mach/map.h>
20 #include <asm/mach/irq.h>
21 
22 #include <mach/map.h>
23 
24 #include "bast.h"
25 
26 /* IDE ports */
27 
28 static struct pata_platform_info bast_ide_platdata = {
29 	.ioport_shift	= 5,
30 };
31 
32 static struct resource bast_ide0_resource[] = {
33 	[0] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDEPRI, 8 * 0x20),
34 	[1] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDEPRIAUX + (6 * 0x20), 0x20),
35 	[2] = DEFINE_RES_IRQ(BAST_IRQ_IDE0),
36 };
37 
38 static struct platform_device bast_device_ide0 = {
39 	.name		= "pata_platform",
40 	.id		= 0,
41 	.num_resources	= ARRAY_SIZE(bast_ide0_resource),
42 	.resource	= bast_ide0_resource,
43 	.dev		= {
44 		.platform_data = &bast_ide_platdata,
45 		.coherent_dma_mask = ~0,
46 	}
47 
48 };
49 
50 static struct resource bast_ide1_resource[] = {
51 	[0] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDESEC, 8 * 0x20),
52 	[1] = DEFINE_RES_MEM(BAST_IDE_CS + BAST_PA_IDESECAUX + (6 * 0x20), 0x20),
53 	[2] = DEFINE_RES_IRQ(BAST_IRQ_IDE1),
54 };
55 
56 static struct platform_device bast_device_ide1 = {
57 	.name		= "pata_platform",
58 	.id		= 1,
59 	.num_resources	= ARRAY_SIZE(bast_ide1_resource),
60 	.resource	= bast_ide1_resource,
61 	.dev		= {
62 		.platform_data = &bast_ide_platdata,
63 		.coherent_dma_mask = ~0,
64 	}
65 };
66 
67 static struct platform_device *bast_ide_devices[] __initdata = {
68 	&bast_device_ide0,
69 	&bast_device_ide1,
70 };
71 
bast_ide_init(void)72 static __init int bast_ide_init(void)
73 {
74 	if (machine_is_bast() || machine_is_vr1000())
75 		return platform_add_devices(bast_ide_devices,
76 					    ARRAY_SIZE(bast_ide_devices));
77 
78 	return 0;
79 }
80 
81 fs_initcall(bast_ide_init);
82