mmp2.h 2.8 KB

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