blob: 5de7a43f79ead4e0f0c39a1f0635920b78294f98 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Wills Wang833a1a82016-03-16 16:59:52 +08002/*
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 Wang833a1a82016-03-16 16:59:52 +08008 */
9
10#ifndef __ASM_MACH_ATH79_H
11#define __ASM_MACH_ATH79_H
12
13#include <linux/types.h>
14
15DECLARE_GLOBAL_DATA_PTR;
16
17enum 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
39static 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
46static 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
53static inline int soc_is_ar7240(void)
54{
55 return gd->arch.soc == ATH79_SOC_AR7240;
56}
57
58static inline int soc_is_ar7241(void)
59{
60 return gd->arch.soc == ATH79_SOC_AR7241;
61}
62
63static inline int soc_is_ar7242(void)
64{
65 return gd->arch.soc == ATH79_SOC_AR7242;
66}
67
68static inline int soc_is_ar913x(void)
69{
70 return gd->arch.soc == ATH79_SOC_AR9130 ||
71 gd->arch.soc == ATH79_SOC_AR9132;
72}
73
74static inline int soc_is_ar933x(void)
75{
76 return gd->arch.soc == ATH79_SOC_AR9330 ||
77 gd->arch.soc == ATH79_SOC_AR9331;
78}
79
80static inline int soc_is_ar9341(void)
81{
82 return gd->arch.soc == ATH79_SOC_AR9341;
83}
84
85static inline int soc_is_ar9342(void)
86{
87 return gd->arch.soc == ATH79_SOC_AR9342;
88}
89
90static inline int soc_is_ar9344(void)
91{
92 return gd->arch.soc == ATH79_SOC_AR9344;
93}
94
95static inline int soc_is_ar934x(void)
96{
97 return soc_is_ar9341() ||
98 soc_is_ar9342() ||
99 soc_is_ar9344();
100}
101
102static inline int soc_is_qca9533(void)
103{
104 return gd->arch.soc == ATH79_SOC_QCA9533;
105}
106
107static inline int soc_is_qca953x(void)
108{
109 return soc_is_qca9533();
110}
111
112static inline int soc_is_qca9556(void)
113{
114 return gd->arch.soc == ATH79_SOC_QCA9556;
115}
116
117static inline int soc_is_qca9558(void)
118{
119 return gd->arch.soc == ATH79_SOC_QCA9558;
120}
121
122static inline int soc_is_qca955x(void)
123{
124 return soc_is_qca9556() || soc_is_qca9558();
125}
126
127static inline int soc_is_tp9343(void)
128{
129 return gd->arch.soc == ATH79_SOC_TP9343;
130}
131
132static inline int soc_is_qca9561(void)
133{
134 return gd->arch.soc == ATH79_SOC_QCA9561;
135}
136
137static inline int soc_is_qca956x(void)
138{
139 return soc_is_tp9343() || soc_is_qca9561();
140}
141
Wills Wangddc05522016-05-30 22:54:50 +0800142u32 ath79_get_bootstrap(void);
Marek Vasutc06cdad2016-05-06 20:10:39 +0200143int ath79_eth_reset(void);
Marek Vasutdff26d82016-05-06 20:10:37 +0200144int ath79_usb_reset(void);
145
Marek Vasut6a713ea2016-05-06 20:10:40 +0200146void ar934x_pll_init(const u16 cpu_mhz, const u16 ddr_mhz, const u16 ahb_mhz);
147void ar934x_ddr_init(const u16 cpu_mhz, const u16 ddr_mhz, const u16 ahb_mhz);
148
Wills Wang833a1a82016-03-16 16:59:52 +0800149#endif /* __ASM_MACH_ATH79_H */