devices.c 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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/board.h>
  25. #include <plat/mmc.h>
  26. #include <plat/menelaus.h>
  27. #include <plat/omap44xx.h>
  28. /*-------------------------------------------------------------------------*/
  29. #if defined(CONFIG_HW_RANDOM_OMAP) || defined(CONFIG_HW_RANDOM_OMAP_MODULE)
  30. #ifdef CONFIG_ARCH_OMAP2
  31. #define OMAP_RNG_BASE 0x480A0000
  32. #else
  33. #define OMAP_RNG_BASE 0xfffe5000
  34. #endif
  35. static struct resource rng_resources[] = {
  36. {
  37. .start = OMAP_RNG_BASE,
  38. .end = OMAP_RNG_BASE + 0x4f,
  39. .flags = IORESOURCE_MEM,
  40. },
  41. };
  42. static struct platform_device omap_rng_device = {
  43. .name = "omap_rng",
  44. .id = -1,
  45. .num_resources = ARRAY_SIZE(rng_resources),
  46. .resource = rng_resources,
  47. };
  48. static void omap_init_rng(void)
  49. {
  50. (void) platform_device_register(&omap_rng_device);
  51. }
  52. #else
  53. static inline void omap_init_rng(void) {}
  54. #endif
  55. /*
  56. * This gets called after board-specific INIT_MACHINE, and initializes most
  57. * on-chip peripherals accessible on this board (except for few like USB):
  58. *
  59. * (a) Does any "standard config" pin muxing needed. Board-specific
  60. * code will have muxed GPIO pins and done "nonstandard" setup;
  61. * that code could live in the boot loader.
  62. * (b) Populating board-specific platform_data with the data drivers
  63. * rely on to handle wiring variations.
  64. * (c) Creating platform devices as meaningful on this board and
  65. * with this kernel configuration.
  66. *
  67. * Claiming GPIOs, and setting their direction and initial values, is the
  68. * responsibility of the device drivers. So is responding to probe().
  69. *
  70. * Board-specific knowledge like creating devices or pin setup is to be
  71. * kept out of drivers as much as possible. In particular, pin setup
  72. * may be handled by the boot loader, and drivers should expect it will
  73. * normally have been done by the time they're probed.
  74. */
  75. static int __init omap_init_devices(void)
  76. {
  77. /* please keep these calls, and their implementations above,
  78. * in alphabetical order so they're easier to sort through.
  79. */
  80. omap_init_rng();
  81. return 0;
  82. }
  83. arch_initcall(omap_init_devices);