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