blob: 0fde5079b16780c5da07dededcc0fd518af9ded7 [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 *
Rosy Songbd905c32019-03-16 09:24:44 +08005 * Copyright (C) 2018-2019 Rosy Song <rosysong@rosinson.com>
Wills Wang833a1a82016-03-16 16:59:52 +08006 * Copyright (C) 2015-2016 Wills Wang <wills.wang@live.com>
7 * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
8 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
Wills Wang833a1a82016-03-16 16:59:52 +08009 */
10
11#ifndef __ASM_MACH_ATH79_H
12#define __ASM_MACH_ATH79_H
13
14#include <linux/types.h>
15
16DECLARE_GLOBAL_DATA_PTR;
17
18enum 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
40static 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
47static 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
54static inline int soc_is_ar7240(void)
55{
56 return gd->arch.soc == ATH79_SOC_AR7240;
57}
58
59static inline int soc_is_ar7241(void)
60{
61 return gd->arch.soc == ATH79_SOC_AR7241;
62}
63
64static inline int soc_is_ar7242(void)
65{
66 return gd->arch.soc == ATH79_SOC_AR7242;
67}
68
69static inline int soc_is_ar913x(void)
70{
71 return gd->arch.soc == ATH79_SOC_AR9130 ||
72 gd->arch.soc == ATH79_SOC_AR9132;
73}
74
75static inline int soc_is_ar933x(void)
76{
77 return gd->arch.soc == ATH79_SOC_AR9330 ||
78 gd->arch.soc == ATH79_SOC_AR9331;
79}
80
81static inline int soc_is_ar9341(void)
82{
83 return gd->arch.soc == ATH79_SOC_AR9341;
84}
85
86static inline int soc_is_ar9342(void)
87{
88 return gd->arch.soc == ATH79_SOC_AR9342;
89}
90
91static inline int soc_is_ar9344(void)
92{
93 return gd->arch.soc == ATH79_SOC_AR9344;
94}
95
96static inline int soc_is_ar934x(void)
97{
98 return soc_is_ar9341() ||
99 soc_is_ar9342() ||
100 soc_is_ar9344();
101}
102
103static inline int soc_is_qca9533(void)
104{
105 return gd->arch.soc == ATH79_SOC_QCA9533;
106}
107
108static inline int soc_is_qca953x(void)
109{
110 return soc_is_qca9533();
111}
112
113static inline int soc_is_qca9556(void)
114{
115 return gd->arch.soc == ATH79_SOC_QCA9556;
116}
117
118static inline int soc_is_qca9558(void)
119{
120 return gd->arch.soc == ATH79_SOC_QCA9558;
121}
122
123static inline int soc_is_qca955x(void)
124{
125 return soc_is_qca9556() || soc_is_qca9558();
126}
127
128static inline int soc_is_tp9343(void)
129{
130 return gd->arch.soc == ATH79_SOC_TP9343;
131}
132
133static inline int soc_is_qca9561(void)
134{
135 return gd->arch.soc == ATH79_SOC_QCA9561;
136}
137
138static inline int soc_is_qca956x(void)
139{
140 return soc_is_tp9343() || soc_is_qca9561();
141}
142
Wills Wangddc05522016-05-30 22:54:50 +0800143u32 ath79_get_bootstrap(void);
Marek Vasutc06cdad2016-05-06 20:10:39 +0200144int ath79_eth_reset(void);
Marek Vasutdff26d82016-05-06 20:10:37 +0200145int ath79_usb_reset(void);
146
Marek Vasut6a713ea2016-05-06 20:10:40 +0200147void ar934x_pll_init(const u16 cpu_mhz, const u16 ddr_mhz, const u16 ahb_mhz);
148void ar934x_ddr_init(const u16 cpu_mhz, const u16 ddr_mhz, const u16 ahb_mhz);
149
Rosy Songbd905c32019-03-16 09:24:44 +0800150void qca956x_pll_init(void);
151void qca956x_ddr_init(void);
Wills Wang833a1a82016-03-16 16:59:52 +0800152#endif /* __ASM_MACH_ATH79_H */