1*83d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */
21d3d0f1fSWills Wang /*
31d3d0f1fSWills Wang * Atheros AR71XX/AR724X/AR913X common definitions
41d3d0f1fSWills Wang *
51d3d0f1fSWills Wang * Copyright (C) 2015-2016 Wills Wang <wills.wang@live.com>
61d3d0f1fSWills Wang * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
71d3d0f1fSWills Wang * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
81d3d0f1fSWills Wang */
91d3d0f1fSWills Wang
101d3d0f1fSWills Wang #ifndef __ASM_MACH_ATH79_H
111d3d0f1fSWills Wang #define __ASM_MACH_ATH79_H
121d3d0f1fSWills Wang
131d3d0f1fSWills Wang #include <linux/types.h>
141d3d0f1fSWills Wang
151d3d0f1fSWills Wang DECLARE_GLOBAL_DATA_PTR;
161d3d0f1fSWills Wang
171d3d0f1fSWills Wang enum ath79_soc_type {
181d3d0f1fSWills Wang ATH79_SOC_UNKNOWN,
191d3d0f1fSWills Wang ATH79_SOC_AR7130,
201d3d0f1fSWills Wang ATH79_SOC_AR7141,
211d3d0f1fSWills Wang ATH79_SOC_AR7161,
221d3d0f1fSWills Wang ATH79_SOC_AR7240,
231d3d0f1fSWills Wang ATH79_SOC_AR7241,
241d3d0f1fSWills Wang ATH79_SOC_AR7242,
251d3d0f1fSWills Wang ATH79_SOC_AR9130,
261d3d0f1fSWills Wang ATH79_SOC_AR9132,
271d3d0f1fSWills Wang ATH79_SOC_AR9330,
281d3d0f1fSWills Wang ATH79_SOC_AR9331,
291d3d0f1fSWills Wang ATH79_SOC_AR9341,
301d3d0f1fSWills Wang ATH79_SOC_AR9342,
311d3d0f1fSWills Wang ATH79_SOC_AR9344,
321d3d0f1fSWills Wang ATH79_SOC_QCA9533,
331d3d0f1fSWills Wang ATH79_SOC_QCA9556,
341d3d0f1fSWills Wang ATH79_SOC_QCA9558,
351d3d0f1fSWills Wang ATH79_SOC_TP9343,
361d3d0f1fSWills Wang ATH79_SOC_QCA9561,
371d3d0f1fSWills Wang };
381d3d0f1fSWills Wang
soc_is_ar71xx(void)391d3d0f1fSWills Wang static inline int soc_is_ar71xx(void)
401d3d0f1fSWills Wang {
411d3d0f1fSWills Wang return gd->arch.soc == ATH79_SOC_AR7130 ||
421d3d0f1fSWills Wang gd->arch.soc == ATH79_SOC_AR7141 ||
431d3d0f1fSWills Wang gd->arch.soc == ATH79_SOC_AR7161;
441d3d0f1fSWills Wang }
451d3d0f1fSWills Wang
soc_is_ar724x(void)461d3d0f1fSWills Wang static inline int soc_is_ar724x(void)
471d3d0f1fSWills Wang {
481d3d0f1fSWills Wang return gd->arch.soc == ATH79_SOC_AR7240 ||
491d3d0f1fSWills Wang gd->arch.soc == ATH79_SOC_AR7241 ||
501d3d0f1fSWills Wang gd->arch.soc == ATH79_SOC_AR7242;
511d3d0f1fSWills Wang }
521d3d0f1fSWills Wang
soc_is_ar7240(void)531d3d0f1fSWills Wang static inline int soc_is_ar7240(void)
541d3d0f1fSWills Wang {
551d3d0f1fSWills Wang return gd->arch.soc == ATH79_SOC_AR7240;
561d3d0f1fSWills Wang }
571d3d0f1fSWills Wang
soc_is_ar7241(void)581d3d0f1fSWills Wang static inline int soc_is_ar7241(void)
591d3d0f1fSWills Wang {
601d3d0f1fSWills Wang return gd->arch.soc == ATH79_SOC_AR7241;
611d3d0f1fSWills Wang }
621d3d0f1fSWills Wang
soc_is_ar7242(void)631d3d0f1fSWills Wang static inline int soc_is_ar7242(void)
641d3d0f1fSWills Wang {
651d3d0f1fSWills Wang return gd->arch.soc == ATH79_SOC_AR7242;
661d3d0f1fSWills Wang }
671d3d0f1fSWills Wang
soc_is_ar913x(void)681d3d0f1fSWills Wang static inline int soc_is_ar913x(void)
691d3d0f1fSWills Wang {
701d3d0f1fSWills Wang return gd->arch.soc == ATH79_SOC_AR9130 ||
711d3d0f1fSWills Wang gd->arch.soc == ATH79_SOC_AR9132;
721d3d0f1fSWills Wang }
731d3d0f1fSWills Wang
soc_is_ar933x(void)741d3d0f1fSWills Wang static inline int soc_is_ar933x(void)
751d3d0f1fSWills Wang {
761d3d0f1fSWills Wang return gd->arch.soc == ATH79_SOC_AR9330 ||
771d3d0f1fSWills Wang gd->arch.soc == ATH79_SOC_AR9331;
781d3d0f1fSWills Wang }
791d3d0f1fSWills Wang
soc_is_ar9341(void)801d3d0f1fSWills Wang static inline int soc_is_ar9341(void)
811d3d0f1fSWills Wang {
821d3d0f1fSWills Wang return gd->arch.soc == ATH79_SOC_AR9341;
831d3d0f1fSWills Wang }
841d3d0f1fSWills Wang
soc_is_ar9342(void)851d3d0f1fSWills Wang static inline int soc_is_ar9342(void)
861d3d0f1fSWills Wang {
871d3d0f1fSWills Wang return gd->arch.soc == ATH79_SOC_AR9342;
881d3d0f1fSWills Wang }
891d3d0f1fSWills Wang
soc_is_ar9344(void)901d3d0f1fSWills Wang static inline int soc_is_ar9344(void)
911d3d0f1fSWills Wang {
921d3d0f1fSWills Wang return gd->arch.soc == ATH79_SOC_AR9344;
931d3d0f1fSWills Wang }
941d3d0f1fSWills Wang
soc_is_ar934x(void)951d3d0f1fSWills Wang static inline int soc_is_ar934x(void)
961d3d0f1fSWills Wang {
971d3d0f1fSWills Wang return soc_is_ar9341() ||
981d3d0f1fSWills Wang soc_is_ar9342() ||
991d3d0f1fSWills Wang soc_is_ar9344();
1001d3d0f1fSWills Wang }
1011d3d0f1fSWills Wang
soc_is_qca9533(void)1021d3d0f1fSWills Wang static inline int soc_is_qca9533(void)
1031d3d0f1fSWills Wang {
1041d3d0f1fSWills Wang return gd->arch.soc == ATH79_SOC_QCA9533;
1051d3d0f1fSWills Wang }
1061d3d0f1fSWills Wang
soc_is_qca953x(void)1071d3d0f1fSWills Wang static inline int soc_is_qca953x(void)
1081d3d0f1fSWills Wang {
1091d3d0f1fSWills Wang return soc_is_qca9533();
1101d3d0f1fSWills Wang }
1111d3d0f1fSWills Wang
soc_is_qca9556(void)1121d3d0f1fSWills Wang static inline int soc_is_qca9556(void)
1131d3d0f1fSWills Wang {
1141d3d0f1fSWills Wang return gd->arch.soc == ATH79_SOC_QCA9556;
1151d3d0f1fSWills Wang }
1161d3d0f1fSWills Wang
soc_is_qca9558(void)1171d3d0f1fSWills Wang static inline int soc_is_qca9558(void)
1181d3d0f1fSWills Wang {
1191d3d0f1fSWills Wang return gd->arch.soc == ATH79_SOC_QCA9558;
1201d3d0f1fSWills Wang }
1211d3d0f1fSWills Wang
soc_is_qca955x(void)1221d3d0f1fSWills Wang static inline int soc_is_qca955x(void)
1231d3d0f1fSWills Wang {
1241d3d0f1fSWills Wang return soc_is_qca9556() || soc_is_qca9558();
1251d3d0f1fSWills Wang }
1261d3d0f1fSWills Wang
soc_is_tp9343(void)1271d3d0f1fSWills Wang static inline int soc_is_tp9343(void)
1281d3d0f1fSWills Wang {
1291d3d0f1fSWills Wang return gd->arch.soc == ATH79_SOC_TP9343;
1301d3d0f1fSWills Wang }
1311d3d0f1fSWills Wang
soc_is_qca9561(void)1321d3d0f1fSWills Wang static inline int soc_is_qca9561(void)
1331d3d0f1fSWills Wang {
1341d3d0f1fSWills Wang return gd->arch.soc == ATH79_SOC_QCA9561;
1351d3d0f1fSWills Wang }
1361d3d0f1fSWills Wang
soc_is_qca956x(void)1371d3d0f1fSWills Wang static inline int soc_is_qca956x(void)
1381d3d0f1fSWills Wang {
1391d3d0f1fSWills Wang return soc_is_tp9343() || soc_is_qca9561();
1401d3d0f1fSWills Wang }
1411d3d0f1fSWills Wang
14237523917SWills Wang u32 ath79_get_bootstrap(void);
1434771bbeeSMarek Vasut int ath79_eth_reset(void);
1446b699742SMarek Vasut int ath79_usb_reset(void);
1456b699742SMarek Vasut
146e08539b7SMarek Vasut void ar934x_pll_init(const u16 cpu_mhz, const u16 ddr_mhz, const u16 ahb_mhz);
147e08539b7SMarek Vasut void ar934x_ddr_init(const u16 cpu_mhz, const u16 ddr_mhz, const u16 ahb_mhz);
148e08539b7SMarek Vasut
1491d3d0f1fSWills Wang #endif /* __ASM_MACH_ATH79_H */
150