blob: 2eda38885e364a84310071afe97c95cbcea064fc [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
Simon Glass3ba929a2020-10-30 21:38:53 -060014#include <asm/global_data.h>
Wills Wang833a1a82016-03-16 16:59:52 +080015#include <linux/types.h>
16
17DECLARE_GLOBAL_DATA_PTR;
18
19enum ath79_soc_type {
20 ATH79_SOC_UNKNOWN,
21 ATH79_SOC_AR7130,
22 ATH79_SOC_AR7141,
23 ATH79_SOC_AR7161,
24 ATH79_SOC_AR7240,
25 ATH79_SOC_AR7241,
26 ATH79_SOC_AR7242,
27 ATH79_SOC_AR9130,
28 ATH79_SOC_AR9132,
29 ATH79_SOC_AR9330,
30 ATH79_SOC_AR9331,
31 ATH79_SOC_AR9341,
32 ATH79_SOC_AR9342,
33 ATH79_SOC_AR9344,
34 ATH79_SOC_QCA9533,
35 ATH79_SOC_QCA9556,
36 ATH79_SOC_QCA9558,
37 ATH79_SOC_TP9343,
38 ATH79_SOC_QCA9561,
39};
40
41static inline int soc_is_ar71xx(void)
42{
43 return gd->arch.soc == ATH79_SOC_AR7130 ||
44 gd->arch.soc == ATH79_SOC_AR7141 ||
45 gd->arch.soc == ATH79_SOC_AR7161;
46}
47
48static inline int soc_is_ar724x(void)
49{
50 return gd->arch.soc == ATH79_SOC_AR7240 ||
51 gd->arch.soc == ATH79_SOC_AR7241 ||
52 gd->arch.soc == ATH79_SOC_AR7242;
53}
54
55static inline int soc_is_ar7240(void)
56{
57 return gd->arch.soc == ATH79_SOC_AR7240;
58}
59
60static inline int soc_is_ar7241(void)
61{
62 return gd->arch.soc == ATH79_SOC_AR7241;
63}
64
65static inline int soc_is_ar7242(void)
66{
67 return gd->arch.soc == ATH79_SOC_AR7242;
68}
69
70static inline int soc_is_ar913x(void)
71{
72 return gd->arch.soc == ATH79_SOC_AR9130 ||
73 gd->arch.soc == ATH79_SOC_AR9132;
74}
75
76static inline int soc_is_ar933x(void)
77{
78 return gd->arch.soc == ATH79_SOC_AR9330 ||
79 gd->arch.soc == ATH79_SOC_AR9331;
80}
81
82static inline int soc_is_ar9341(void)
83{
84 return gd->arch.soc == ATH79_SOC_AR9341;
85}
86
87static inline int soc_is_ar9342(void)
88{
89 return gd->arch.soc == ATH79_SOC_AR9342;
90}
91
92static inline int soc_is_ar9344(void)
93{
94 return gd->arch.soc == ATH79_SOC_AR9344;
95}
96
97static inline int soc_is_ar934x(void)
98{
99 return soc_is_ar9341() ||
100 soc_is_ar9342() ||
101 soc_is_ar9344();
102}
103
104static inline int soc_is_qca9533(void)
105{
106 return gd->arch.soc == ATH79_SOC_QCA9533;
107}
108
109static inline int soc_is_qca953x(void)
110{
111 return soc_is_qca9533();
112}
113
114static inline int soc_is_qca9556(void)
115{
116 return gd->arch.soc == ATH79_SOC_QCA9556;
117}
118
119static inline int soc_is_qca9558(void)
120{
121 return gd->arch.soc == ATH79_SOC_QCA9558;
122}
123
124static inline int soc_is_qca955x(void)
125{
126 return soc_is_qca9556() || soc_is_qca9558();
127}
128
129static inline int soc_is_tp9343(void)
130{
131 return gd->arch.soc == ATH79_SOC_TP9343;
132}
133
134static inline int soc_is_qca9561(void)
135{
136 return gd->arch.soc == ATH79_SOC_QCA9561;
137}
138
139static inline int soc_is_qca956x(void)
140{
141 return soc_is_tp9343() || soc_is_qca9561();
142}
143
Wills Wangddc05522016-05-30 22:54:50 +0800144u32 ath79_get_bootstrap(void);
Marek Vasutc06cdad2016-05-06 20:10:39 +0200145int ath79_eth_reset(void);
Marek Vasutdff26d82016-05-06 20:10:37 +0200146int ath79_usb_reset(void);
147
Marek Vasut6a713ea2016-05-06 20:10:40 +0200148void ar934x_pll_init(const u16 cpu_mhz, const u16 ddr_mhz, const u16 ahb_mhz);
149void ar934x_ddr_init(const u16 cpu_mhz, const u16 ddr_mhz, const u16 ahb_mhz);
150
Rosy Songbd905c32019-03-16 09:24:44 +0800151void qca956x_pll_init(void);
152void qca956x_ddr_init(void);
Wills Wang833a1a82016-03-16 16:59:52 +0800153#endif /* __ASM_MACH_ATH79_H */