platform-mxc_nand.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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_IMX27
  33. const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst =
  34. imx_mxc_nand_data_entry_single(MX27, "imx27-nand", SZ_4K);
  35. #endif /* ifdef CONFIG_SOC_IMX27 */
  36. #ifdef CONFIG_SOC_IMX31
  37. const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst =
  38. imx_mxc_nand_data_entry_single(MX31, "imx27-nand", SZ_4K);
  39. #endif
  40. #ifdef CONFIG_SOC_IMX35
  41. const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst =
  42. imx_mxc_nand_data_entry_single(MX35, "imx25-nand", SZ_8K);
  43. #endif
  44. struct platform_device *__init imx_add_mxc_nand(
  45. const struct imx_mxc_nand_data *data,
  46. const struct mxc_nand_platform_data *pdata)
  47. {
  48. /* AXI has to come first, that's how the mxc_nand driver expect it */
  49. struct resource res[] = {
  50. {
  51. .start = data->iobase,
  52. .end = data->iobase + data->iosize - 1,
  53. .flags = IORESOURCE_MEM,
  54. }, {
  55. .start = data->irq,
  56. .end = data->irq,
  57. .flags = IORESOURCE_IRQ,
  58. }, {
  59. .start = data->axibase,
  60. .end = data->axibase + SZ_16K - 1,
  61. .flags = IORESOURCE_MEM,
  62. },
  63. };
  64. return imx_add_platform_device(data->devid, data->id,
  65. res, ARRAY_SIZE(res) - !data->axibase,
  66. pdata, sizeof(*pdata));
  67. }