platform-mxc_nand.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * Copyright (C) 2009-2010 Pengutronix
  3. * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it under
  6. * the terms of the GNU General Public License version 2 as published by the
  7. * Free Software Foundation.
  8. */
  9. #include <asm/sizes.h>
  10. #include "../hardware.h"
  11. #include "devices-common.h"
  12. #define imx_mxc_nand_data_entry_single(soc, _devid, _size) \
  13. { \
  14. .devid = _devid, \
  15. .iobase = soc ## _NFC_BASE_ADDR, \
  16. .iosize = _size, \
  17. .irq = soc ## _INT_NFC \
  18. }
  19. #define imx_mxc_nandv3_data_entry_single(soc, _devid, _size) \
  20. { \
  21. .devid = _devid, \
  22. .id = -1, \
  23. .iobase = soc ## _NFC_BASE_ADDR, \
  24. .iosize = _size, \
  25. .axibase = soc ## _NFC_AXI_BASE_ADDR, \
  26. .irq = soc ## _INT_NFC \
  27. }
  28. #ifdef CONFIG_SOC_IMX21
  29. const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst =
  30. imx_mxc_nand_data_entry_single(MX21, "imx21-nand", SZ_4K);
  31. #endif /* ifdef CONFIG_SOC_IMX21 */
  32. #ifdef CONFIG_SOC_IMX25
  33. const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst =
  34. imx_mxc_nand_data_entry_single(MX25, "imx25-nand", SZ_8K);
  35. #endif /* ifdef CONFIG_SOC_IMX25 */
  36. #ifdef CONFIG_SOC_IMX27
  37. const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst =
  38. imx_mxc_nand_data_entry_single(MX27, "imx27-nand", SZ_4K);
  39. #endif /* ifdef CONFIG_SOC_IMX27 */
  40. #ifdef CONFIG_SOC_IMX31
  41. const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst =
  42. imx_mxc_nand_data_entry_single(MX31, "imx27-nand", SZ_4K);
  43. #endif
  44. #ifdef CONFIG_SOC_IMX35
  45. const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst =
  46. imx_mxc_nand_data_entry_single(MX35, "imx25-nand", SZ_8K);
  47. #endif
  48. struct platform_device *__init imx_add_mxc_nand(
  49. const struct imx_mxc_nand_data *data,
  50. const struct mxc_nand_platform_data *pdata)
  51. {
  52. /* AXI has to come first, that's how the mxc_nand driver expect it */
  53. struct resource res[] = {
  54. {
  55. .start = data->iobase,
  56. .end = data->iobase + data->iosize - 1,
  57. .flags = IORESOURCE_MEM,
  58. }, {
  59. .start = data->irq,
  60. .end = data->irq,
  61. .flags = IORESOURCE_IRQ,
  62. }, {
  63. .start = data->axibase,
  64. .end = data->axibase + SZ_16K - 1,
  65. .flags = IORESOURCE_MEM,
  66. },
  67. };
  68. return imx_add_platform_device(data->devid, data->id,
  69. res, ARRAY_SIZE(res) - !data->axibase,
  70. pdata, sizeof(*pdata));
  71. }