1 // SPDX-License-Identifier: GPL-2.0-only
2 #include "../hardware.h"
3 #include "devices-common.h"
4 
5 #define imx_pata_imx_data_entry_single(soc, _size)			\
6 	{								\
7 		.iobase = soc ## _ATA_BASE_ADDR,			\
8 		.iosize = _size,					\
9 		.irq = soc ## _INT_ATA,					\
10 	}
11 
12 #ifdef CONFIG_SOC_IMX27
13 const struct imx_pata_imx_data imx27_pata_imx_data __initconst =
14 	imx_pata_imx_data_entry_single(MX27, SZ_4K);
15 #endif /* ifdef CONFIG_SOC_IMX27 */
16 
17 #ifdef CONFIG_SOC_IMX31
18 const struct imx_pata_imx_data imx31_pata_imx_data __initconst =
19 	imx_pata_imx_data_entry_single(MX31, SZ_16K);
20 #endif /* ifdef CONFIG_SOC_IMX31 */
21 
22 #ifdef CONFIG_SOC_IMX35
23 const struct imx_pata_imx_data imx35_pata_imx_data __initconst =
24 	imx_pata_imx_data_entry_single(MX35, SZ_16K);
25 #endif /* ifdef CONFIG_SOC_IMX35 */
26 
imx_add_pata_imx(const struct imx_pata_imx_data * data)27 struct platform_device *__init imx_add_pata_imx(
28 		const struct imx_pata_imx_data *data)
29 {
30 	struct resource res[] = {
31 		{
32 			.start = data->iobase,
33 			.end = data->iobase + data->iosize - 1,
34 			.flags = IORESOURCE_MEM,
35 		},
36 		{
37 			.start = data->irq,
38 			.end = data->irq,
39 			.flags = IORESOURCE_IRQ,
40 		},
41 	};
42 	return imx_add_platform_device("pata_imx", -1,
43 			res, ARRAY_SIZE(res), NULL, 0);
44 }
45 
46