mmp2.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef __ASM_MACH_MMP2_H
  2. #define __ASM_MACH_MMP2_H
  3. #include <linux/i2c.h>
  4. #include <mach/devices.h>
  5. #include <plat/i2c.h>
  6. extern struct pxa_device_desc mmp2_device_uart1;
  7. extern struct pxa_device_desc mmp2_device_uart2;
  8. extern struct pxa_device_desc mmp2_device_uart3;
  9. extern struct pxa_device_desc mmp2_device_uart4;
  10. extern struct pxa_device_desc mmp2_device_twsi1;
  11. extern struct pxa_device_desc mmp2_device_twsi2;
  12. extern struct pxa_device_desc mmp2_device_twsi3;
  13. extern struct pxa_device_desc mmp2_device_twsi4;
  14. extern struct pxa_device_desc mmp2_device_twsi5;
  15. extern struct pxa_device_desc mmp2_device_twsi6;
  16. static inline int mmp2_add_uart(int id)
  17. {
  18. struct pxa_device_desc *d = NULL;
  19. switch (id) {
  20. case 1: d = &mmp2_device_uart1; break;
  21. case 2: d = &mmp2_device_uart2; break;
  22. case 3: d = &mmp2_device_uart3; break;
  23. case 4: d = &mmp2_device_uart4; break;
  24. default:
  25. return -EINVAL;
  26. }
  27. return pxa_register_device(d, NULL, 0);
  28. }
  29. static inline int mmp2_add_twsi(int id, struct i2c_pxa_platform_data *data,
  30. struct i2c_board_info *info, unsigned size)
  31. {
  32. struct pxa_device_desc *d = NULL;
  33. int ret;
  34. switch (id) {
  35. case 1: d = &mmp2_device_twsi1; break;
  36. case 2: d = &mmp2_device_twsi2; break;
  37. case 3: d = &mmp2_device_twsi3; break;
  38. case 4: d = &mmp2_device_twsi4; break;
  39. case 5: d = &mmp2_device_twsi5; break;
  40. case 6: d = &mmp2_device_twsi6; break;
  41. default:
  42. return -EINVAL;
  43. }
  44. ret = i2c_register_board_info(id - 1, info, size);
  45. if (ret)
  46. return ret;
  47. return pxa_register_device(d, data, sizeof(*data));
  48. }
  49. #endif /* __ASM_MACH_MMP2_H */