Arnaud Patard (Rtp) | a45adf1 | 2011-07-26 16:54:25 +0200 | [diff] [blame] | 1 | /* |
| 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 | */ |
Shawn Guo | 50f2de6 | 2012-09-14 14:14:45 +0800 | [diff] [blame] | 6 | #include "../hardware.h" |
Shawn Guo | e0557c0 | 2012-09-13 15:51:15 +0800 | [diff] [blame] | 7 | #include "devices-common.h" |
Arnaud Patard (Rtp) | a45adf1 | 2011-07-26 16:54:25 +0200 | [diff] [blame] | 8 | |
Fabio Estevam | 236c4e8 | 2011-08-23 17:18:06 -0300 | [diff] [blame] | 9 | #define imx_pata_imx_data_entry_single(soc, _size) \ |
Arnaud Patard (Rtp) | a45adf1 | 2011-07-26 16:54:25 +0200 | [diff] [blame] | 10 | { \ |
| 11 | .iobase = soc ## _ATA_BASE_ADDR, \ |
Fabio Estevam | 236c4e8 | 2011-08-23 17:18:06 -0300 | [diff] [blame] | 12 | .iosize = _size, \ |
| 13 | .irq = soc ## _INT_ATA, \ |
Arnaud Patard (Rtp) | a45adf1 | 2011-07-26 16:54:25 +0200 | [diff] [blame] | 14 | } |
| 15 | |
Fabio Estevam | 236c4e8 | 2011-08-23 17:18:06 -0300 | [diff] [blame] | 16 | #ifdef CONFIG_SOC_IMX27 |
| 17 | const 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 |
| 22 | const 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 |
| 27 | const 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) | a45adf1 | 2011-07-26 16:54:25 +0200 | [diff] [blame] | 31 | struct platform_device *__init imx_add_pata_imx( |
| 32 | const struct imx_pata_imx_data *data) |
| 33 | { |
| 34 | struct resource res[] = { |
| 35 | { |
| 36 | .start = data->iobase, |
Arnaud Patard (Rtp) | 318007e | 2011-08-27 15:19:00 +0200 | [diff] [blame] | 37 | .end = data->iobase + data->iosize - 1, |
Arnaud Patard (Rtp) | a45adf1 | 2011-07-26 16:54:25 +0200 | [diff] [blame] | 38 | .flags = IORESOURCE_MEM, |
| 39 | }, |
| 40 | { |
| 41 | .start = data->irq, |
| 42 | .end = data->irq, |
| 43 | .flags = IORESOURCE_IRQ, |
| 44 | }, |
| 45 | }; |
| 46 | return imx_add_platform_device("pata_imx", -1, |
| 47 | res, ARRAY_SIZE(res), NULL, 0); |
| 48 | } |
| 49 | |