devices.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * linux/arch/arm/mach-omap2/devices.c
  3. *
  4. * OMAP2 platform device setup/initialization
  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/config.h>
  12. #include <linux/module.h>
  13. #include <linux/kernel.h>
  14. #include <linux/init.h>
  15. #include <linux/platform_device.h>
  16. #include <asm/hardware.h>
  17. #include <asm/io.h>
  18. #include <asm/mach-types.h>
  19. #include <asm/mach/map.h>
  20. #include <asm/arch/tc.h>
  21. #include <asm/arch/board.h>
  22. #include <asm/arch/mux.h>
  23. #include <asm/arch/gpio.h>
  24. extern void omap_nop_release(struct device *dev);
  25. /*-------------------------------------------------------------------------*/
  26. #if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
  27. #define OMAP2_I2C_BASE2 0x48072000
  28. #define OMAP2_I2C_INT2 57
  29. static struct resource i2c_resources2[] = {
  30. {
  31. .start = OMAP2_I2C_BASE2,
  32. .end = OMAP2_I2C_BASE2 + 0x3f,
  33. .flags = IORESOURCE_MEM,
  34. },
  35. {
  36. .start = OMAP2_I2C_INT2,
  37. .flags = IORESOURCE_IRQ,
  38. },
  39. };
  40. static struct platform_device omap_i2c_device2 = {
  41. .name = "i2c_omap",
  42. .id = 2,
  43. .dev = {
  44. .release = omap_nop_release,
  45. },
  46. .num_resources = ARRAY_SIZE(i2c_resources2),
  47. .resource = i2c_resources2,
  48. };
  49. /* See also arch/arm/plat-omap/devices.c for first I2C on 24xx */
  50. static void omap_init_i2c(void)
  51. {
  52. /* REVISIT: Second I2C not in use on H4? */
  53. if (machine_is_omap_h4())
  54. return;
  55. omap_cfg_reg(J15_24XX_I2C2_SCL);
  56. omap_cfg_reg(H19_24XX_I2C2_SDA);
  57. (void) platform_device_register(&omap_i2c_device2);
  58. }
  59. #else
  60. static void omap_init_i2c(void) {}
  61. #endif
  62. #if defined(CONFIG_OMAP_STI)
  63. #define OMAP2_STI_BASE IO_ADDRESS(0x48068000)
  64. #define OMAP2_STI_CHANNEL_BASE 0x54000000
  65. #define OMAP2_STI_IRQ 4
  66. static struct resource sti_resources[] = {
  67. {
  68. .start = OMAP2_STI_BASE,
  69. .end = OMAP2_STI_BASE + 0x7ff,
  70. .flags = IORESOURCE_MEM,
  71. },
  72. {
  73. .start = OMAP2_STI_CHANNEL_BASE,
  74. .end = OMAP2_STI_CHANNEL_BASE + SZ_64K - 1,
  75. .flags = IORESOURCE_MEM,
  76. },
  77. {
  78. .start = OMAP2_STI_IRQ,
  79. .flags = IORESOURCE_IRQ,
  80. }
  81. };
  82. static struct platform_device sti_device = {
  83. .name = "sti",
  84. .id = -1,
  85. .dev = {
  86. .release = omap_nop_release,
  87. },
  88. .num_resources = ARRAY_SIZE(sti_resources),
  89. .resource = sti_resources,
  90. };
  91. static inline void omap_init_sti(void)
  92. {
  93. platform_device_register(&sti_device);
  94. }
  95. #else
  96. static inline void omap_init_sti(void) {}
  97. #endif
  98. /*-------------------------------------------------------------------------*/
  99. static int __init omap2_init_devices(void)
  100. {
  101. /* please keep these calls, and their implementations above,
  102. * in alphabetical order so they're easier to sort through.
  103. */
  104. omap_init_i2c();
  105. omap_init_sti();
  106. return 0;
  107. }
  108. arch_initcall(omap2_init_devices);