devices.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * mach-davinci/devices.c
  3. *
  4. * DaVinci 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/module.h>
  12. #include <linux/kernel.h>
  13. #include <linux/init.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/dma-mapping.h>
  16. #include <linux/io.h>
  17. #include <asm/mach/map.h>
  18. #include <mach/hardware.h>
  19. #include <mach/i2c.h>
  20. static struct resource i2c_resources[] = {
  21. {
  22. .start = DAVINCI_I2C_BASE,
  23. .end = DAVINCI_I2C_BASE + 0x40,
  24. .flags = IORESOURCE_MEM,
  25. },
  26. {
  27. .start = IRQ_I2C,
  28. .flags = IORESOURCE_IRQ,
  29. },
  30. };
  31. static struct platform_device davinci_i2c_device = {
  32. .name = "i2c_davinci",
  33. .id = 1,
  34. .num_resources = ARRAY_SIZE(i2c_resources),
  35. .resource = i2c_resources,
  36. };
  37. void __init davinci_init_i2c(struct davinci_i2c_platform_data *pdata)
  38. {
  39. davinci_i2c_device.dev.platform_data = pdata;
  40. (void) platform_device_register(&davinci_i2c_device);
  41. }