devices.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. /*-------------------------------------------------------------------------*/
  63. static int __init omap2_init_devices(void)
  64. {
  65. /* please keep these calls, and their implementations above,
  66. * in alphabetical order so they're easier to sort through.
  67. */
  68. omap_init_i2c();
  69. return 0;
  70. }
  71. arch_initcall(omap2_init_devices);