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