1 /* 2 * Atheros AR71XX/AR724X/AR913X common definitions 3 * 4 * Copyright (C) 2015-2016 Wills Wang <wills.wang@live.com> 5 * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org> 6 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> 7 * 8 * SPDX-License-Identifier: GPL-2.0+ 9 */ 10 11 #ifndef __ASM_MACH_ATH79_H 12 #define __ASM_MACH_ATH79_H 13 14 #include <linux/types.h> 15 16 DECLARE_GLOBAL_DATA_PTR; 17 18 enum ath79_soc_type { 19 ATH79_SOC_UNKNOWN, 20 ATH79_SOC_AR7130, 21 ATH79_SOC_AR7141, 22 ATH79_SOC_AR7161, 23 ATH79_SOC_AR7240, 24 ATH79_SOC_AR7241, 25 ATH79_SOC_AR7242, 26 ATH79_SOC_AR9130, 27 ATH79_SOC_AR9132, 28 ATH79_SOC_AR9330, 29 ATH79_SOC_AR9331, 30 ATH79_SOC_AR9341, 31 ATH79_SOC_AR9342, 32 ATH79_SOC_AR9344, 33 ATH79_SOC_QCA9533, 34 ATH79_SOC_QCA9556, 35 ATH79_SOC_QCA9558, 36 ATH79_SOC_TP9343, 37 ATH79_SOC_QCA9561, 38 }; 39 40 static inline int soc_is_ar71xx(void) 41 { 42 return gd->arch.soc == ATH79_SOC_AR7130 || 43 gd->arch.soc == ATH79_SOC_AR7141 || 44 gd->arch.soc == ATH79_SOC_AR7161; 45 } 46 47 static inline int soc_is_ar724x(void) 48 { 49 return gd->arch.soc == ATH79_SOC_AR7240 || 50 gd->arch.soc == ATH79_SOC_AR7241 || 51 gd->arch.soc == ATH79_SOC_AR7242; 52 } 53 54 static inline int soc_is_ar7240(void) 55 { 56 return gd->arch.soc == ATH79_SOC_AR7240; 57 } 58 59 static inline int soc_is_ar7241(void) 60 { 61 return gd->arch.soc == ATH79_SOC_AR7241; 62 } 63 64 static inline int soc_is_ar7242(void) 65 { 66 return gd->arch.soc == ATH79_SOC_AR7242; 67 } 68 69 static inline int soc_is_ar913x(void) 70 { 71 return gd->arch.soc == ATH79_SOC_AR9130 || 72 gd->arch.soc == ATH79_SOC_AR9132; 73 } 74 75 static inline int soc_is_ar933x(void) 76 { 77 return gd->arch.soc == ATH79_SOC_AR9330 || 78 gd->arch.soc == ATH79_SOC_AR9331; 79 } 80 81 static inline int soc_is_ar9341(void) 82 { 83 return gd->arch.soc == ATH79_SOC_AR9341; 84 } 85 86 static inline int soc_is_ar9342(void) 87 { 88 return gd->arch.soc == ATH79_SOC_AR9342; 89 } 90 91 static inline int soc_is_ar9344(void) 92 { 93 return gd->arch.soc == ATH79_SOC_AR9344; 94 } 95 96 static inline int soc_is_ar934x(void) 97 { 98 return soc_is_ar9341() || 99 soc_is_ar9342() || 100 soc_is_ar9344(); 101 } 102 103 static inline int soc_is_qca9533(void) 104 { 105 return gd->arch.soc == ATH79_SOC_QCA9533; 106 } 107 108 static inline int soc_is_qca953x(void) 109 { 110 return soc_is_qca9533(); 111 } 112 113 static inline int soc_is_qca9556(void) 114 { 115 return gd->arch.soc == ATH79_SOC_QCA9556; 116 } 117 118 static inline int soc_is_qca9558(void) 119 { 120 return gd->arch.soc == ATH79_SOC_QCA9558; 121 } 122 123 static inline int soc_is_qca955x(void) 124 { 125 return soc_is_qca9556() || soc_is_qca9558(); 126 } 127 128 static inline int soc_is_tp9343(void) 129 { 130 return gd->arch.soc == ATH79_SOC_TP9343; 131 } 132 133 static inline int soc_is_qca9561(void) 134 { 135 return gd->arch.soc == ATH79_SOC_QCA9561; 136 } 137 138 static inline int soc_is_qca956x(void) 139 { 140 return soc_is_tp9343() || soc_is_qca9561(); 141 } 142 143 int ath79_eth_reset(void); 144 int ath79_usb_reset(void); 145 146 void ar934x_pll_init(const u16 cpu_mhz, const u16 ddr_mhz, const u16 ahb_mhz); 147 void ar934x_ddr_init(const u16 cpu_mhz, const u16 ddr_mhz, const u16 ahb_mhz); 148 149 #endif /* __ASM_MACH_ATH79_H */ 150