devices.c 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * linux/arch/arm/plat-omap/devices.c
  3. *
  4. * Common platform device setup/initialization for OMAP1 and OMAP2
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. */
  11. #include <linux/gpio.h>
  12. #include <linux/module.h>
  13. #include <linux/kernel.h>
  14. #include <linux/init.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/io.h>
  17. #include <linux/slab.h>
  18. #include <linux/memblock.h>
  19. #include <mach/hardware.h>
  20. #include <asm/mach-types.h>
  21. #include <asm/mach/map.h>
  22. #include <asm/memblock.h>
  23. #include <plat/tc.h>
  24. #include <plat/mmc.h>
  25. #include <plat/menelaus.h>
  26. #include <plat/omap44xx.h>
  27. /*-------------------------------------------------------------------------*/
  28. #if defined(CONFIG_HW_RANDOM_OMAP) || defined(CONFIG_HW_RANDOM_OMAP_MODULE)
  29. #ifdef CONFIG_ARCH_OMAP2
  30. #define OMAP_RNG_BASE 0x480A0000
  31. #else
  32. #define OMAP_RNG_BASE 0xfffe5000
  33. #endif
  34. static struct resource rng_resources[] = {
  35. {
  36. .start = OMAP_RNG_BASE,
  37. .end = OMAP_RNG_BASE + 0x4f,
  38. .flags = IORESOURCE_MEM,
  39. },
  40. };
  41. static struct platform_device omap_rng_device = {
  42. .name = "omap_rng",
  43. .id = -1,
  44. .num_resources = ARRAY_SIZE(rng_resources),
  45. .resource = rng_resources,
  46. };
  47. static void omap_init_rng(void)
  48. {
  49. (void) platform_device_register(&omap_rng_device);
  50. }
  51. #else
  52. static inline void omap_init_rng(void) {}
  53. #endif
  54. /*
  55. * This gets called after board-specific INIT_MACHINE, and initializes most
  56. * on-chip peripherals accessible on this board (except for few like USB):
  57. *
  58. * (a) Does any "standard config" pin muxing needed. Board-specific
  59. * code will have muxed GPIO pins and done "nonstandard" setup;
  60. * that code could live in the boot loader.
  61. * (b) Populating board-specific platform_data with the data drivers
  62. * rely on to handle wiring variations.
  63. * (c) Creating platform devices as meaningful on this board and
  64. * with this kernel configuration.
  65. *
  66. * Claiming GPIOs, and setting their direction and initial values, is the
  67. * responsibility of the device drivers. So is responding to probe().
  68. *
  69. * Board-specific knowledge like creating devices or pin setup is to be
  70. * kept out of drivers as much as possible. In particular, pin setup
  71. * may be handled by the boot loader, and drivers should expect it will
  72. * normally have been done by the time they're probed.
  73. */
  74. static int __init omap_init_devices(void)
  75. {
  76. /* please keep these calls, and their implementations above,
  77. * in alphabetical order so they're easier to sort through.
  78. */
  79. omap_init_rng();
  80. return 0;
  81. }
  82. arch_initcall(omap_init_devices);