pxa168.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. extern void pxa168_restart(char, const char *);
  7. extern void pxa168_clear_keypad_wakeup(void);
  8. #include <linux/i2c.h>
  9. #include <linux/i2c/pxa-i2c.h>
  10. #include <mach/devices.h>
  11. #include <plat/pxa3xx_nand.h>
  12. #include <video/pxa168fb.h>
  13. #include <plat/pxa27x_keypad.h>
  14. #include <mach/cputype.h>
  15. #include <linux/pxa168_eth.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. struct pxa168_usb_pdata {
  35. /* If NULL, default phy init routine for PXA168 would be called */
  36. int (*phy_init)(void __iomem *usb_phy_reg_base);
  37. };
  38. /* pdata can be NULL */
  39. int __init pxa168_add_usb_host(struct pxa168_usb_pdata *pdata);
  40. extern struct platform_device pxa168_device_gpio;
  41. static inline int pxa168_add_uart(int id)
  42. {
  43. struct pxa_device_desc *d = NULL;
  44. switch (id) {
  45. case 1: d = &pxa168_device_uart1; break;
  46. case 2: d = &pxa168_device_uart2; break;
  47. case 3: d = &pxa168_device_uart3; break;
  48. }
  49. if (d == NULL)
  50. return -EINVAL;
  51. return pxa_register_device(d, NULL, 0);
  52. }
  53. static inline int pxa168_add_twsi(int id, struct i2c_pxa_platform_data *data,
  54. struct i2c_board_info *info, unsigned size)
  55. {
  56. struct pxa_device_desc *d = NULL;
  57. int ret;
  58. switch (id) {
  59. case 0: d = &pxa168_device_twsi0; break;
  60. case 1: d = &pxa168_device_twsi1; break;
  61. default:
  62. return -EINVAL;
  63. }
  64. ret = i2c_register_board_info(id, info, size);
  65. if (ret)
  66. return ret;
  67. return pxa_register_device(d, data, sizeof(*data));
  68. }
  69. static inline int pxa168_add_pwm(int id)
  70. {
  71. struct pxa_device_desc *d = NULL;
  72. switch (id) {
  73. case 1: d = &pxa168_device_pwm1; break;
  74. case 2: d = &pxa168_device_pwm2; break;
  75. case 3: d = &pxa168_device_pwm3; break;
  76. case 4: d = &pxa168_device_pwm4; break;
  77. default:
  78. return -EINVAL;
  79. }
  80. return pxa_register_device(d, NULL, 0);
  81. }
  82. static inline int pxa168_add_ssp(int id)
  83. {
  84. struct pxa_device_desc *d = NULL;
  85. switch (id) {
  86. case 1: d = &pxa168_device_ssp1; break;
  87. case 2: d = &pxa168_device_ssp2; break;
  88. case 3: d = &pxa168_device_ssp3; break;
  89. case 4: d = &pxa168_device_ssp4; break;
  90. case 5: d = &pxa168_device_ssp5; break;
  91. default:
  92. return -EINVAL;
  93. }
  94. return pxa_register_device(d, NULL, 0);
  95. }
  96. static inline int pxa168_add_nand(struct pxa3xx_nand_platform_data *info)
  97. {
  98. return pxa_register_device(&pxa168_device_nand, info, sizeof(*info));
  99. }
  100. static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
  101. {
  102. return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
  103. }
  104. static inline int pxa168_add_keypad(struct pxa27x_keypad_platform_data *data)
  105. {
  106. if (cpu_is_pxa168())
  107. data->clear_wakeup_event = pxa168_clear_keypad_wakeup;
  108. return pxa_register_device(&pxa168_device_keypad, data, sizeof(*data));
  109. }
  110. static inline int pxa168_add_eth(struct pxa168_eth_platform_data *data)
  111. {
  112. return pxa_register_device(&pxa168_device_eth, data, sizeof(*data));
  113. }
  114. #endif /* __ASM_MACH_PXA168_H */