pxa910.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef __ASM_MACH_PXA910_H
  2. #define __ASM_MACH_PXA910_H
  3. #include <linux/i2c.h>
  4. #include <mach/devices.h>
  5. #include <plat/i2c.h>
  6. extern struct pxa_device_desc pxa910_device_uart1;
  7. extern struct pxa_device_desc pxa910_device_uart2;
  8. extern struct pxa_device_desc pxa910_device_twsi0;
  9. extern struct pxa_device_desc pxa910_device_twsi1;
  10. static inline int pxa910_add_uart(int id)
  11. {
  12. struct pxa_device_desc *d = NULL;
  13. switch (id) {
  14. case 1: d = &pxa910_device_uart1; break;
  15. case 2: d = &pxa910_device_uart2; break;
  16. }
  17. if (d == NULL)
  18. return -EINVAL;
  19. return pxa_register_device(d, NULL, 0);
  20. }
  21. static inline int pxa910_add_twsi(int id, struct i2c_pxa_platform_data *data,
  22. struct i2c_board_info *info, unsigned size)
  23. {
  24. struct pxa_device_desc *d = NULL;
  25. int ret;
  26. switch (id) {
  27. case 0: d = &pxa910_device_twsi0; break;
  28. case 1: d = &pxa910_device_twsi1; break;
  29. default:
  30. return -EINVAL;
  31. }
  32. ret = i2c_register_board_info(id, info, size);
  33. if (ret)
  34. return ret;
  35. return pxa_register_device(d, data, sizeof(*data));
  36. }
  37. #endif /* __ASM_MACH_PXA910_H */