blob: 70e2f2a4471440bc200a63135db831775722ef39 [file] [log] [blame]
Arnaud Patard (Rtp)a45adf12011-07-26 16:54:25 +02001/*
2 * This program is free software; you can redistribute it and/or modify it under
3 * the terms of the GNU General Public License version 2 as published by the
4 * Free Software Foundation.
5 */
6#include <mach/hardware.h>
7#include <mach/devices-common.h>
8
Fabio Estevam236c4e82011-08-23 17:18:06 -03009#define imx_pata_imx_data_entry_single(soc, _size) \
Arnaud Patard (Rtp)a45adf12011-07-26 16:54:25 +020010 { \
11 .iobase = soc ## _ATA_BASE_ADDR, \
Fabio Estevam236c4e82011-08-23 17:18:06 -030012 .iosize = _size, \
13 .irq = soc ## _INT_ATA, \
Arnaud Patard (Rtp)a45adf12011-07-26 16:54:25 +020014 }
15
Fabio Estevam236c4e82011-08-23 17:18:06 -030016#ifdef CONFIG_SOC_IMX27
17const struct imx_pata_imx_data imx27_pata_imx_data __initconst =
18 imx_pata_imx_data_entry_single(MX27, SZ_4K);
19#endif /* ifdef CONFIG_SOC_IMX27 */
20
21#ifdef CONFIG_SOC_IMX31
22const struct imx_pata_imx_data imx31_pata_imx_data __initconst =
23 imx_pata_imx_data_entry_single(MX31, SZ_16K);
24#endif /* ifdef CONFIG_SOC_IMX31 */
25
26#ifdef CONFIG_SOC_IMX35
27const struct imx_pata_imx_data imx35_pata_imx_data __initconst =
28 imx_pata_imx_data_entry_single(MX35, SZ_16K);
29#endif /* ifdef CONFIG_SOC_IMX35 */
30
Arnaud Patard (Rtp)a45adf12011-07-26 16:54:25 +020031#ifdef CONFIG_SOC_IMX51
32const struct imx_pata_imx_data imx51_pata_imx_data __initconst =
Fabio Estevam236c4e82011-08-23 17:18:06 -030033 imx_pata_imx_data_entry_single(MX51, SZ_16K);
Arnaud Patard (Rtp)a45adf12011-07-26 16:54:25 +020034#endif /* ifdef CONFIG_SOC_IMX51 */
35
Fabio Estevam236c4e82011-08-23 17:18:06 -030036#ifdef CONFIG_SOC_IMX53
37const struct imx_pata_imx_data imx53_pata_imx_data __initconst =
38 imx_pata_imx_data_entry_single(MX53, SZ_16K);
39#endif /* ifdef CONFIG_SOC_IMX53 */
40
Arnaud Patard (Rtp)a45adf12011-07-26 16:54:25 +020041struct platform_device *__init imx_add_pata_imx(
42 const struct imx_pata_imx_data *data)
43{
44 struct resource res[] = {
45 {
46 .start = data->iobase,
Arnaud Patard (Rtp)318007e2011-08-27 15:19:00 +020047 .end = data->iobase + data->iosize - 1,
Arnaud Patard (Rtp)a45adf12011-07-26 16:54:25 +020048 .flags = IORESOURCE_MEM,
49 },
50 {
51 .start = data->irq,
52 .end = data->irq,
53 .flags = IORESOURCE_IRQ,
54 },
55 };
56 return imx_add_platform_device("pata_imx", -1,
57 res, ARRAY_SIZE(res), NULL, 0);
58}
59