devices.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. #if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
  25. #define OMAP2_I2C_BASE2 0x48072000
  26. #define OMAP2_I2C_INT2 57
  27. static struct resource i2c_resources2[] = {
  28. {
  29. .start = OMAP2_I2C_BASE2,
  30. .end = OMAP2_I2C_BASE2 + 0x3f,
  31. .flags = IORESOURCE_MEM,
  32. },
  33. {
  34. .start = OMAP2_I2C_INT2,
  35. .flags = IORESOURCE_IRQ,
  36. },
  37. };
  38. static struct platform_device omap_i2c_device2 = {
  39. .name = "i2c_omap",
  40. .id = 2,
  41. .num_resources = ARRAY_SIZE(i2c_resources2),
  42. .resource = i2c_resources2,
  43. };
  44. /* See also arch/arm/plat-omap/devices.c for first I2C on 24xx */
  45. static void omap_init_i2c(void)
  46. {
  47. /* REVISIT: Second I2C not in use on H4? */
  48. if (machine_is_omap_h4())
  49. return;
  50. omap_cfg_reg(J15_24XX_I2C2_SCL);
  51. omap_cfg_reg(H19_24XX_I2C2_SDA);
  52. (void) platform_device_register(&omap_i2c_device2);
  53. }
  54. #else
  55. static void omap_init_i2c(void) {}
  56. #endif
  57. #if defined(CONFIG_OMAP_STI)
  58. #define OMAP2_STI_BASE IO_ADDRESS(0x48068000)
  59. #define OMAP2_STI_CHANNEL_BASE 0x54000000
  60. #define OMAP2_STI_IRQ 4
  61. static struct resource sti_resources[] = {
  62. {
  63. .start = OMAP2_STI_BASE,
  64. .end = OMAP2_STI_BASE + 0x7ff,
  65. .flags = IORESOURCE_MEM,
  66. },
  67. {
  68. .start = OMAP2_STI_CHANNEL_BASE,
  69. .end = OMAP2_STI_CHANNEL_BASE + SZ_64K - 1,
  70. .flags = IORESOURCE_MEM,
  71. },
  72. {
  73. .start = OMAP2_STI_IRQ,
  74. .flags = IORESOURCE_IRQ,
  75. }
  76. };
  77. static struct platform_device sti_device = {
  78. .name = "sti",
  79. .id = -1,
  80. .num_resources = ARRAY_SIZE(sti_resources),
  81. .resource = sti_resources,
  82. };
  83. static inline void omap_init_sti(void)
  84. {
  85. platform_device_register(&sti_device);
  86. }
  87. #else
  88. static inline void omap_init_sti(void) {}
  89. #endif
  90. /*-------------------------------------------------------------------------*/
  91. static int __init omap2_init_devices(void)
  92. {
  93. /* please keep these calls, and their implementations above,
  94. * in alphabetical order so they're easier to sort through.
  95. */
  96. omap_init_i2c();
  97. omap_init_sti();
  98. return 0;
  99. }
  100. arch_initcall(omap2_init_devices);