platform-mxc_rnga.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (C) 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 <mach/hardware.h>
  10. #include <mach/devices-common.h>
  11. struct imx_mxc_rnga_data {
  12. resource_size_t iobase;
  13. };
  14. #define imx_mxc_rnga_data_entry_single(soc) \
  15. { \
  16. .iobase = soc ## _RNGA_BASE_ADDR, \
  17. }
  18. #ifdef CONFIG_SOC_IMX31
  19. static const struct imx_mxc_rnga_data imx31_mxc_rnga_data __initconst =
  20. imx_mxc_rnga_data_entry_single(MX31);
  21. #endif /* ifdef CONFIG_SOC_IMX31 */
  22. static struct platform_device *__init imx_add_mxc_rnga(
  23. const struct imx_mxc_rnga_data *data)
  24. {
  25. struct resource res[] = {
  26. {
  27. .start = data->iobase,
  28. .end = data->iobase + SZ_16K - 1,
  29. .flags = IORESOURCE_MEM,
  30. },
  31. };
  32. return imx_add_platform_device("mxc_rnga", -1,
  33. res, ARRAY_SIZE(res), NULL, 0);
  34. }
  35. static int __init imxXX_add_mxc_rnga(void)
  36. {
  37. struct platform_device *ret;
  38. #if defined(CONFIG_SOC_IMX31)
  39. if (cpu_is_mx31())
  40. ret = imx_add_mxc_rnga(&imx31_mxc_rnga_data);
  41. else
  42. #endif /* if defined(CONFIG_SOC_IMX31) */
  43. ret = ERR_PTR(-ENODEV);
  44. if (IS_ERR(ret))
  45. return PTR_ERR(ret);
  46. return 0;
  47. }
  48. arch_initcall(imxXX_add_mxc_rnga);