pxa168.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #ifndef __ASM_MACH_PXA168_H
  2. #define __ASM_MACH_PXA168_H
  3. extern void pxa168_timer_init(void);
  4. extern void __init pxa168_init_irq(void);
  5. extern void pxa168_restart(char, const char *);
  6. extern void pxa168_clear_keypad_wakeup(void);
  7. #include <linux/i2c.h>
  8. #include <linux/i2c/pxa-i2c.h>
  9. #include <mach/devices.h>
  10. #include <linux/platform_data/mtd-nand-pxa3xx.h>
  11. #include <video/pxa168fb.h>
  12. #include <linux/platform_data/keypad-pxa27x.h>
  13. #include <mach/cputype.h>
  14. #include <linux/pxa168_eth.h>
  15. #include <linux/platform_data/mv_usb.h>
  16. extern struct pxa_device_desc pxa168_device_uart1;
  17. extern struct pxa_device_desc pxa168_device_uart2;
  18. extern struct pxa_device_desc pxa168_device_uart3;
  19. extern struct pxa_device_desc pxa168_device_twsi0;
  20. extern struct pxa_device_desc pxa168_device_twsi1;
  21. extern struct pxa_device_desc pxa168_device_pwm1;
  22. extern struct pxa_device_desc pxa168_device_pwm2;
  23. extern struct pxa_device_desc pxa168_device_pwm3;
  24. extern struct pxa_device_desc pxa168_device_pwm4;
  25. extern struct pxa_device_desc pxa168_device_ssp1;
  26. extern struct pxa_device_desc pxa168_device_ssp2;
  27. extern struct pxa_device_desc pxa168_device_ssp3;
  28. extern struct pxa_device_desc pxa168_device_ssp4;
  29. extern struct pxa_device_desc pxa168_device_ssp5;
  30. extern struct pxa_device_desc pxa168_device_nand;
  31. extern struct pxa_device_desc pxa168_device_fb;
  32. extern struct pxa_device_desc pxa168_device_keypad;
  33. extern struct pxa_device_desc pxa168_device_eth;
  34. /* pdata can be NULL */
  35. extern int __init pxa168_add_usb_host(struct mv_usb_platform_data *pdata);
  36. extern struct platform_device pxa168_device_gpio;
  37. static inline int pxa168_add_uart(int id)
  38. {
  39. struct pxa_device_desc *d = NULL;
  40. switch (id) {
  41. case 1: d = &pxa168_device_uart1; break;
  42. case 2: d = &pxa168_device_uart2; break;
  43. case 3: d = &pxa168_device_uart3; break;
  44. }
  45. if (d == NULL)
  46. return -EINVAL;
  47. return pxa_register_device(d, NULL, 0);
  48. }
  49. static inline int pxa168_add_twsi(int id, struct i2c_pxa_platform_data *data,
  50. struct i2c_board_info *info, unsigned size)
  51. {
  52. struct pxa_device_desc *d = NULL;
  53. int ret;
  54. switch (id) {
  55. case 0: d = &pxa168_device_twsi0; break;
  56. case 1: d = &pxa168_device_twsi1; break;
  57. default:
  58. return -EINVAL;
  59. }
  60. ret = i2c_register_board_info(id, info, size);
  61. if (ret)
  62. return ret;
  63. return pxa_register_device(d, data, sizeof(*data));
  64. }
  65. static inline int pxa168_add_pwm(int id)
  66. {
  67. struct pxa_device_desc *d = NULL;
  68. switch (id) {
  69. case 1: d = &pxa168_device_pwm1; break;
  70. case 2: d = &pxa168_device_pwm2; break;
  71. case 3: d = &pxa168_device_pwm3; break;
  72. case 4: d = &pxa168_device_pwm4; break;
  73. default:
  74. return -EINVAL;
  75. }
  76. return pxa_register_device(d, NULL, 0);
  77. }
  78. static inline int pxa168_add_ssp(int id)
  79. {
  80. struct pxa_device_desc *d = NULL;
  81. switch (id) {
  82. case 1: d = &pxa168_device_ssp1; break;
  83. case 2: d = &pxa168_device_ssp2; break;
  84. case 3: d = &pxa168_device_ssp3; break;
  85. case 4: d = &pxa168_device_ssp4; break;
  86. case 5: d = &pxa168_device_ssp5; break;
  87. default:
  88. return -EINVAL;
  89. }
  90. return pxa_register_device(d, NULL, 0);
  91. }
  92. static inline int pxa168_add_nand(struct pxa3xx_nand_platform_data *info)
  93. {
  94. return pxa_register_device(&pxa168_device_nand, info, sizeof(*info));
  95. }
  96. static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
  97. {
  98. return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
  99. }
  100. static inline int pxa168_add_keypad(struct pxa27x_keypad_platform_data *data)
  101. {
  102. if (cpu_is_pxa168())
  103. data->clear_wakeup_event = pxa168_clear_keypad_wakeup;
  104. return pxa_register_device(&pxa168_device_keypad, data, sizeof(*data));
  105. }
  106. static inline int pxa168_add_eth(struct pxa168_eth_platform_data *data)
  107. {
  108. return pxa_register_device(&pxa168_device_eth, data, sizeof(*data));
  109. }
  110. #endif /* __ASM_MACH_PXA168_H */