i2c.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * I2C initialization for PNX4008.
  3. *
  4. * Author: Vitaly Wool <vitalywool@gmail.com>
  5. *
  6. * 2005-2006 (c) MontaVista Software, Inc. This file is licensed under
  7. * the terms of the GNU General Public License version 2. This program
  8. * is licensed "as is" without any warranty of any kind, whether express
  9. * or implied.
  10. */
  11. #include <linux/clk.h>
  12. #include <linux/i2c.h>
  13. #include <linux/i2c-pnx.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/err.h>
  16. #include <mach/platform.h>
  17. #include <mach/irqs.h>
  18. #include <mach/i2c.h>
  19. static struct i2c_pnx_data i2c0_data = {
  20. .name = I2C_CHIP_NAME "0",
  21. .base = PNX4008_I2C1_BASE,
  22. .irq = I2C_1_INT,
  23. };
  24. static struct i2c_pnx_data i2c1_data = {
  25. .name = I2C_CHIP_NAME "1",
  26. .base = PNX4008_I2C2_BASE,
  27. .irq = I2C_2_INT,
  28. };
  29. static struct i2c_pnx_data i2c2_data = {
  30. .name = "USB-I2C",
  31. .base = (PNX4008_USB_CONFIG_BASE + 0x300),
  32. .irq = USB_I2C_INT,
  33. };
  34. static struct platform_device i2c0_device = {
  35. .name = "pnx-i2c",
  36. .id = 0,
  37. .dev = {
  38. .platform_data = &i2c0_data,
  39. },
  40. };
  41. static struct platform_device i2c1_device = {
  42. .name = "pnx-i2c",
  43. .id = 1,
  44. .dev = {
  45. .platform_data = &i2c1_data,
  46. },
  47. };
  48. static struct platform_device i2c2_device = {
  49. .name = "pnx-i2c",
  50. .id = 2,
  51. .dev = {
  52. .platform_data = &i2c2_data,
  53. },
  54. };
  55. static struct platform_device *devices[] __initdata = {
  56. &i2c0_device,
  57. &i2c1_device,
  58. &i2c2_device,
  59. };
  60. void __init pnx4008_register_i2c_devices(void)
  61. {
  62. platform_add_devices(devices, ARRAY_SIZE(devices));
  63. }