pxa168.h 2.7 KB

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