platform-gpmi-nand.c 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along
  15. * with this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  17. */
  18. #include <asm/sizes.h>
  19. #include <mach/mx23.h>
  20. #include <mach/mx28.h>
  21. #include <mach/devices-common.h>
  22. #include <linux/dma-mapping.h>
  23. #ifdef CONFIG_SOC_IMX23
  24. const struct mxs_gpmi_nand_data mx23_gpmi_nand_data __initconst = {
  25. .devid = "imx23-gpmi-nand",
  26. .res = {
  27. /* GPMI */
  28. DEFINE_RES_MEM_NAMED(MX23_GPMI_BASE_ADDR, SZ_8K,
  29. GPMI_NAND_GPMI_REGS_ADDR_RES_NAME),
  30. DEFINE_RES_IRQ_NAMED(MX23_INT_GPMI_ATTENTION,
  31. GPMI_NAND_GPMI_INTERRUPT_RES_NAME),
  32. /* BCH */
  33. DEFINE_RES_MEM_NAMED(MX23_BCH_BASE_ADDR, SZ_8K,
  34. GPMI_NAND_BCH_REGS_ADDR_RES_NAME),
  35. DEFINE_RES_IRQ_NAMED(MX23_INT_BCH,
  36. GPMI_NAND_BCH_INTERRUPT_RES_NAME),
  37. /* DMA */
  38. DEFINE_RES_NAMED(MX23_DMA_GPMI0,
  39. MX23_DMA_GPMI3 - MX23_DMA_GPMI0 + 1,
  40. GPMI_NAND_DMA_CHANNELS_RES_NAME,
  41. IORESOURCE_DMA),
  42. DEFINE_RES_IRQ_NAMED(MX23_INT_GPMI_DMA,
  43. GPMI_NAND_DMA_INTERRUPT_RES_NAME),
  44. },
  45. };
  46. #endif
  47. #ifdef CONFIG_SOC_IMX28
  48. const struct mxs_gpmi_nand_data mx28_gpmi_nand_data __initconst = {
  49. .devid = "imx28-gpmi-nand",
  50. .res = {
  51. /* GPMI */
  52. DEFINE_RES_MEM_NAMED(MX28_GPMI_BASE_ADDR, SZ_8K,
  53. GPMI_NAND_GPMI_REGS_ADDR_RES_NAME),
  54. DEFINE_RES_IRQ_NAMED(MX28_INT_GPMI,
  55. GPMI_NAND_GPMI_INTERRUPT_RES_NAME),
  56. /* BCH */
  57. DEFINE_RES_MEM_NAMED(MX28_BCH_BASE_ADDR, SZ_8K,
  58. GPMI_NAND_BCH_REGS_ADDR_RES_NAME),
  59. DEFINE_RES_IRQ_NAMED(MX28_INT_BCH,
  60. GPMI_NAND_BCH_INTERRUPT_RES_NAME),
  61. /* DMA */
  62. DEFINE_RES_NAMED(MX28_DMA_GPMI0,
  63. MX28_DMA_GPMI7 - MX28_DMA_GPMI0 + 1,
  64. GPMI_NAND_DMA_CHANNELS_RES_NAME,
  65. IORESOURCE_DMA),
  66. DEFINE_RES_IRQ_NAMED(MX28_INT_GPMI_DMA,
  67. GPMI_NAND_DMA_INTERRUPT_RES_NAME),
  68. },
  69. };
  70. #endif
  71. struct platform_device *__init
  72. mxs_add_gpmi_nand(const struct gpmi_nand_platform_data *pdata,
  73. const struct mxs_gpmi_nand_data *data)
  74. {
  75. return mxs_add_platform_device_dmamask(data->devid, -1,
  76. data->res, GPMI_NAND_RES_SIZE,
  77. pdata, sizeof(*pdata), DMA_BIT_MASK(32));
  78. }