platform-mxc_nand.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 <mach/devices-common.h>
  11. static struct platform_device *__init imx_add_mxc_nand(resource_size_t iobase,
  12. int irq, const struct mxc_nand_platform_data *pdata,
  13. resource_size_t iosize)
  14. {
  15. static int id = 0;
  16. struct resource res[] = {
  17. {
  18. .start = iobase,
  19. .end = iobase + iosize - 1,
  20. .flags = IORESOURCE_MEM,
  21. }, {
  22. .start = irq,
  23. .end = irq,
  24. .flags = IORESOURCE_IRQ,
  25. },
  26. };
  27. return imx_add_platform_device("mxc_nand", id++, res, ARRAY_SIZE(res),
  28. pdata, sizeof(*pdata));
  29. }
  30. struct platform_device *__init imx_add_mxc_nand_v1(resource_size_t iobase,
  31. int irq, const struct mxc_nand_platform_data *pdata)
  32. {
  33. return imx_add_mxc_nand(iobase, irq, pdata, SZ_4K);
  34. }
  35. struct platform_device *__init imx_add_mxc_nand_v21(resource_size_t iobase,
  36. int irq, const struct mxc_nand_platform_data *pdata)
  37. {
  38. return imx_add_mxc_nand(iobase, irq, pdata, SZ_8K);
  39. }