pxa168.h 3.8 KB

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