pxa168.h 3.7 KB

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