pxa168.h 2.5 KB

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