pxa168.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef __ASM_MACH_PXA168_H
  2. #define __ASM_MACH_PXA168_H
  3. #include <linux/i2c.h>
  4. #include <mach/devices.h>
  5. #include <plat/i2c.h>
  6. #include <plat/pxa3xx_nand.h>
  7. extern struct pxa_device_desc pxa168_device_uart1;
  8. extern struct pxa_device_desc pxa168_device_uart2;
  9. extern struct pxa_device_desc pxa168_device_twsi0;
  10. extern struct pxa_device_desc pxa168_device_twsi1;
  11. extern struct pxa_device_desc pxa168_device_pwm1;
  12. extern struct pxa_device_desc pxa168_device_pwm2;
  13. extern struct pxa_device_desc pxa168_device_pwm3;
  14. extern struct pxa_device_desc pxa168_device_pwm4;
  15. extern struct pxa_device_desc pxa168_device_ssp1;
  16. extern struct pxa_device_desc pxa168_device_ssp2;
  17. extern struct pxa_device_desc pxa168_device_ssp3;
  18. extern struct pxa_device_desc pxa168_device_ssp4;
  19. extern struct pxa_device_desc pxa168_device_ssp5;
  20. extern struct pxa_device_desc pxa168_device_nand;
  21. static inline int pxa168_add_uart(int id)
  22. {
  23. struct pxa_device_desc *d = NULL;
  24. switch (id) {
  25. case 1: d = &pxa168_device_uart1; break;
  26. case 2: d = &pxa168_device_uart2; break;
  27. }
  28. if (d == NULL)
  29. return -EINVAL;
  30. return pxa_register_device(d, NULL, 0);
  31. }
  32. static inline int pxa168_add_twsi(int id, struct i2c_pxa_platform_data *data,
  33. struct i2c_board_info *info, unsigned size)
  34. {
  35. struct pxa_device_desc *d = NULL;
  36. int ret;
  37. switch (id) {
  38. case 0: d = &pxa168_device_twsi0; break;
  39. case 1: d = &pxa168_device_twsi1; break;
  40. default:
  41. return -EINVAL;
  42. }
  43. ret = i2c_register_board_info(id, info, size);
  44. if (ret)
  45. return ret;
  46. return pxa_register_device(d, data, sizeof(*data));
  47. }
  48. static inline int pxa168_add_pwm(int id)
  49. {
  50. struct pxa_device_desc *d = NULL;
  51. switch (id) {
  52. case 1: d = &pxa168_device_pwm1; break;
  53. case 2: d = &pxa168_device_pwm2; break;
  54. case 3: d = &pxa168_device_pwm3; break;
  55. case 4: d = &pxa168_device_pwm4; break;
  56. default:
  57. return -EINVAL;
  58. }
  59. return pxa_register_device(d, NULL, 0);
  60. }
  61. static inline int pxa168_add_ssp(int id)
  62. {
  63. struct pxa_device_desc *d = NULL;
  64. switch (id) {
  65. case 1: d = &pxa168_device_ssp1; break;
  66. case 2: d = &pxa168_device_ssp2; break;
  67. case 3: d = &pxa168_device_ssp3; break;
  68. case 4: d = &pxa168_device_ssp4; break;
  69. case 5: d = &pxa168_device_ssp5; break;
  70. default:
  71. return -EINVAL;
  72. }
  73. return pxa_register_device(d, NULL, 0);
  74. }
  75. static inline int pxa168_add_nand(struct pxa3xx_nand_platform_data *info)
  76. {
  77. return pxa_register_device(&pxa168_device_nand, info, sizeof(*info));
  78. }
  79. #endif /* __ASM_MACH_PXA168_H */