b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | #ifndef __ASM_MACH_MMP2_H |
| 2 | #define __ASM_MACH_MMP2_H |
| 3 | |
| 4 | #include <linux/platform_data/pxa_sdhci.h> |
| 5 | |
| 6 | extern void mmp2_timer_init(void); |
| 7 | extern void __init mmp2_init_icu(void); |
| 8 | extern void __init mmp2_init_irq(void); |
| 9 | extern void mmp2_clear_pmic_int(void); |
| 10 | |
| 11 | #include <linux/i2c.h> |
| 12 | #include <linux/i2c/pxa-i2c.h> |
| 13 | #include <soc/asr/devices.h> |
| 14 | #include <linux/platform_data/dma-mmp_tdma.h> |
| 15 | |
| 16 | extern struct pxa_device_desc mmp2_device_uart1; |
| 17 | extern struct pxa_device_desc mmp2_device_uart2; |
| 18 | extern struct pxa_device_desc mmp2_device_uart3; |
| 19 | extern struct pxa_device_desc mmp2_device_uart4; |
| 20 | extern struct pxa_device_desc mmp2_device_twsi1; |
| 21 | extern struct pxa_device_desc mmp2_device_twsi2; |
| 22 | extern struct pxa_device_desc mmp2_device_twsi3; |
| 23 | extern struct pxa_device_desc mmp2_device_twsi4; |
| 24 | extern struct pxa_device_desc mmp2_device_twsi5; |
| 25 | extern struct pxa_device_desc mmp2_device_twsi6; |
| 26 | extern struct pxa_device_desc mmp2_device_sdh0; |
| 27 | extern struct pxa_device_desc mmp2_device_sdh1; |
| 28 | extern struct pxa_device_desc mmp2_device_sdh2; |
| 29 | extern struct pxa_device_desc mmp2_device_sdh3; |
| 30 | extern struct pxa_device_desc mmp2_device_asram; |
| 31 | extern struct pxa_device_desc mmp2_device_isram; |
| 32 | extern struct pxa_device_desc mmp2_device_u2o; |
| 33 | extern struct pxa_device_desc mmp2_device_u2ootg; |
| 34 | extern struct pxa_device_desc mmp2_device_u2oehci; |
| 35 | extern struct pxa_device_desc mmp2_device_u2ophy; |
| 36 | |
| 37 | extern struct platform_device mmp2_device_gpio; |
| 38 | |
| 39 | static inline int mmp2_add_uart(int id) |
| 40 | { |
| 41 | struct pxa_device_desc *d = NULL; |
| 42 | |
| 43 | switch (id) { |
| 44 | case 1: d = &mmp2_device_uart1; break; |
| 45 | case 2: d = &mmp2_device_uart2; break; |
| 46 | case 3: d = &mmp2_device_uart3; break; |
| 47 | case 4: d = &mmp2_device_uart4; break; |
| 48 | default: |
| 49 | return -EINVAL; |
| 50 | } |
| 51 | |
| 52 | return pxa_register_device(d, NULL, 0); |
| 53 | } |
| 54 | |
| 55 | static inline int mmp2_add_twsi(int id, struct i2c_pxa_platform_data *data, |
| 56 | struct i2c_board_info *info, unsigned size) |
| 57 | { |
| 58 | struct pxa_device_desc *d = NULL; |
| 59 | int ret; |
| 60 | |
| 61 | switch (id) { |
| 62 | case 1: d = &mmp2_device_twsi1; break; |
| 63 | case 2: d = &mmp2_device_twsi2; break; |
| 64 | case 3: d = &mmp2_device_twsi3; break; |
| 65 | case 4: d = &mmp2_device_twsi4; break; |
| 66 | case 5: d = &mmp2_device_twsi5; break; |
| 67 | case 6: d = &mmp2_device_twsi6; break; |
| 68 | default: |
| 69 | return -EINVAL; |
| 70 | } |
| 71 | |
| 72 | ret = i2c_register_board_info(id - 1, info, size); |
| 73 | if (ret) |
| 74 | return ret; |
| 75 | |
| 76 | return pxa_register_device(d, data, sizeof(*data)); |
| 77 | } |
| 78 | |
| 79 | static inline int mmp2_add_sdhost(int id, struct sdhci_pxa_platdata *data) |
| 80 | { |
| 81 | struct pxa_device_desc *d = NULL; |
| 82 | |
| 83 | switch (id) { |
| 84 | case 0: d = &mmp2_device_sdh0; break; |
| 85 | case 1: d = &mmp2_device_sdh1; break; |
| 86 | case 2: d = &mmp2_device_sdh2; break; |
| 87 | case 3: d = &mmp2_device_sdh3; break; |
| 88 | default: |
| 89 | return -EINVAL; |
| 90 | } |
| 91 | |
| 92 | return pxa_register_device(d, data, sizeof(*data)); |
| 93 | } |
| 94 | |
| 95 | static inline int mmp2_add_asram(struct sram_platdata *data) |
| 96 | { |
| 97 | return pxa_register_device(&mmp2_device_asram, data, sizeof(*data)); |
| 98 | } |
| 99 | |
| 100 | static inline int mmp2_add_isram(struct sram_platdata *data) |
| 101 | { |
| 102 | return pxa_register_device(&mmp2_device_isram, data, sizeof(*data)); |
| 103 | } |
| 104 | |
| 105 | #endif /* __ASM_MACH_MMP2_H */ |
| 106 | |