mmp2.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #ifndef __ASM_MACH_MMP2_H
  2. #define __ASM_MACH_MMP2_H
  3. #include <linux/platform_data/pxa_sdhci.h>
  4. extern void mmp2_timer_init(void);
  5. extern void __init mmp2_init_icu(void);
  6. extern void __init mmp2_init_irq(void);
  7. extern void mmp2_clear_pmic_int(void);
  8. #include <linux/i2c.h>
  9. #include <linux/i2c/pxa-i2c.h>
  10. #include <linux/platform_data/dma-mmp_tdma.h>
  11. #include "devices.h"
  12. extern struct pxa_device_desc mmp2_device_uart1;
  13. extern struct pxa_device_desc mmp2_device_uart2;
  14. extern struct pxa_device_desc mmp2_device_uart3;
  15. extern struct pxa_device_desc mmp2_device_uart4;
  16. extern struct pxa_device_desc mmp2_device_twsi1;
  17. extern struct pxa_device_desc mmp2_device_twsi2;
  18. extern struct pxa_device_desc mmp2_device_twsi3;
  19. extern struct pxa_device_desc mmp2_device_twsi4;
  20. extern struct pxa_device_desc mmp2_device_twsi5;
  21. extern struct pxa_device_desc mmp2_device_twsi6;
  22. extern struct pxa_device_desc mmp2_device_sdh0;
  23. extern struct pxa_device_desc mmp2_device_sdh1;
  24. extern struct pxa_device_desc mmp2_device_sdh2;
  25. extern struct pxa_device_desc mmp2_device_sdh3;
  26. extern struct pxa_device_desc mmp2_device_asram;
  27. extern struct pxa_device_desc mmp2_device_isram;
  28. extern struct platform_device mmp2_device_gpio;
  29. static inline int mmp2_add_uart(int id)
  30. {
  31. struct pxa_device_desc *d = NULL;
  32. switch (id) {
  33. case 1: d = &mmp2_device_uart1; break;
  34. case 2: d = &mmp2_device_uart2; break;
  35. case 3: d = &mmp2_device_uart3; break;
  36. case 4: d = &mmp2_device_uart4; break;
  37. default:
  38. return -EINVAL;
  39. }
  40. return pxa_register_device(d, NULL, 0);
  41. }
  42. static inline int mmp2_add_twsi(int id, struct i2c_pxa_platform_data *data,
  43. struct i2c_board_info *info, unsigned size)
  44. {
  45. struct pxa_device_desc *d = NULL;
  46. int ret;
  47. switch (id) {
  48. case 1: d = &mmp2_device_twsi1; break;
  49. case 2: d = &mmp2_device_twsi2; break;
  50. case 3: d = &mmp2_device_twsi3; break;
  51. case 4: d = &mmp2_device_twsi4; break;
  52. case 5: d = &mmp2_device_twsi5; break;
  53. case 6: d = &mmp2_device_twsi6; break;
  54. default:
  55. return -EINVAL;
  56. }
  57. ret = i2c_register_board_info(id - 1, info, size);
  58. if (ret)
  59. return ret;
  60. return pxa_register_device(d, data, sizeof(*data));
  61. }
  62. static inline int mmp2_add_sdhost(int id, struct sdhci_pxa_platdata *data)
  63. {
  64. struct pxa_device_desc *d = NULL;
  65. switch (id) {
  66. case 0: d = &mmp2_device_sdh0; break;
  67. case 1: d = &mmp2_device_sdh1; break;
  68. case 2: d = &mmp2_device_sdh2; break;
  69. case 3: d = &mmp2_device_sdh3; break;
  70. default:
  71. return -EINVAL;
  72. }
  73. return pxa_register_device(d, data, sizeof(*data));
  74. }
  75. static inline int mmp2_add_asram(struct sram_platdata *data)
  76. {
  77. return pxa_register_device(&mmp2_device_asram, data, sizeof(*data));
  78. }
  79. static inline int mmp2_add_isram(struct sram_platdata *data)
  80. {
  81. return pxa_register_device(&mmp2_device_isram, data, sizeof(*data));
  82. }
  83. #endif /* __ASM_MACH_MMP2_H */