platform-pata_imx.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. */
  6. #include <mach/hardware.h>
  7. #include <mach/devices-common.h>
  8. #define imx_pata_imx_data_entry_single(soc, _size) \
  9. { \
  10. .iobase = soc ## _ATA_BASE_ADDR, \
  11. .iosize = _size, \
  12. .irq = soc ## _INT_ATA, \
  13. }
  14. #ifdef CONFIG_SOC_IMX27
  15. const struct imx_pata_imx_data imx27_pata_imx_data __initconst =
  16. imx_pata_imx_data_entry_single(MX27, SZ_4K);
  17. #endif /* ifdef CONFIG_SOC_IMX27 */
  18. #ifdef CONFIG_SOC_IMX31
  19. const struct imx_pata_imx_data imx31_pata_imx_data __initconst =
  20. imx_pata_imx_data_entry_single(MX31, SZ_16K);
  21. #endif /* ifdef CONFIG_SOC_IMX31 */
  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. #ifdef CONFIG_SOC_IMX51
  27. const struct imx_pata_imx_data imx51_pata_imx_data __initconst =
  28. imx_pata_imx_data_entry_single(MX51, SZ_16K);
  29. #endif /* ifdef CONFIG_SOC_IMX51 */
  30. #ifdef CONFIG_SOC_IMX53
  31. const struct imx_pata_imx_data imx53_pata_imx_data __initconst =
  32. imx_pata_imx_data_entry_single(MX53, SZ_16K);
  33. #endif /* ifdef CONFIG_SOC_IMX53 */
  34. struct platform_device *__init imx_add_pata_imx(
  35. const struct imx_pata_imx_data *data)
  36. {
  37. struct resource res[] = {
  38. {
  39. .start = data->iobase,
  40. .end = data->iobase + data->iosize - 1,
  41. .flags = IORESOURCE_MEM,
  42. },
  43. {
  44. .start = data->irq,
  45. .end = data->irq,
  46. .flags = IORESOURCE_IRQ,
  47. },
  48. };
  49. return imx_add_platform_device("pata_imx", -1,
  50. res, ARRAY_SIZE(res), NULL, 0);
  51. }