2 * Atheros AR71XX/AR724X/AR913X common definitions
4 * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
7 * Parts of this file are based on Atheros' 2.6.15 BSP
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation.
14 #ifndef __ASM_MACH_ATH79_H
15 #define __ASM_MACH_ATH79_H
17 #include <linux/types.h>
42 extern enum ath79_soc_type ath79_soc;
43 extern unsigned int ath79_soc_rev;
45 static inline int soc_is_ar71xx(void)
47 return (ath79_soc == ATH79_SOC_AR7130 ||
48 ath79_soc == ATH79_SOC_AR7141 ||
49 ath79_soc == ATH79_SOC_AR7161);
52 static inline int soc_is_ar724x(void)
54 return (ath79_soc == ATH79_SOC_AR7240 ||
55 ath79_soc == ATH79_SOC_AR7241 ||
56 ath79_soc == ATH79_SOC_AR7242);
59 static inline int soc_is_ar7240(void)
61 return (ath79_soc == ATH79_SOC_AR7240);
64 static inline int soc_is_ar7241(void)
66 return (ath79_soc == ATH79_SOC_AR7241);
69 static inline int soc_is_ar7242(void)
71 return (ath79_soc == ATH79_SOC_AR7242);
74 static inline int soc_is_ar913x(void)
76 return (ath79_soc == ATH79_SOC_AR9130 ||
77 ath79_soc == ATH79_SOC_AR9132);
80 static inline int soc_is_ar933x(void)
82 return (ath79_soc == ATH79_SOC_AR9330 ||
83 ath79_soc == ATH79_SOC_AR9331);
86 static inline int soc_is_ar9341(void)
88 return (ath79_soc == ATH79_SOC_AR9341);
91 static inline int soc_is_ar9342(void)
93 return (ath79_soc == ATH79_SOC_AR9342);
96 static inline int soc_is_ar9344(void)
98 return (ath79_soc == ATH79_SOC_AR9344);
101 static inline int soc_is_ar934x(void)
103 return soc_is_ar9341() || soc_is_ar9342() || soc_is_ar9344();
106 static inline int soc_is_qca9533(void)
108 return ath79_soc == ATH79_SOC_QCA9533;
111 static inline int soc_is_qca953x(void)
113 return soc_is_qca9533();
116 static inline int soc_is_qca9556(void)
118 return ath79_soc == ATH79_SOC_QCA9556;
121 static inline int soc_is_qca9558(void)
123 return ath79_soc == ATH79_SOC_QCA9558;
126 static inline int soc_is_qca955x(void)
128 return soc_is_qca9556() || soc_is_qca9558();
131 static inline int soc_is_tp9343(void)
133 return ath79_soc == ATH79_SOC_TP9343;
136 static inline int soc_is_qca9561(void)
138 return ath79_soc == ATH79_SOC_QCA956X;
141 static inline int soc_is_qca9563(void)
143 return ath79_soc == ATH79_SOC_QCA956X;
146 static inline int soc_is_qca956x(void)
148 return soc_is_qca9561() || soc_is_qca9563();
151 void ath79_ddr_wb_flush(unsigned int reg);
152 void ath79_ddr_set_pci_windows(void);
154 extern void __iomem *ath79_pll_base;
155 extern void __iomem *ath79_reset_base;
157 static inline void ath79_pll_wr(unsigned reg, u32 val)
159 __raw_writel(val, ath79_pll_base + reg);
162 static inline u32 ath79_pll_rr(unsigned reg)
164 return __raw_readl(ath79_pll_base + reg);
167 static inline void ath79_reset_wr(unsigned reg, u32 val)
169 __raw_writel(val, ath79_reset_base + reg);
170 (void) __raw_readl(ath79_reset_base + reg); /* flush */
173 static inline u32 ath79_reset_rr(unsigned reg)
175 return __raw_readl(ath79_reset_base + reg);
178 void ath79_device_reset_set(u32 mask);
179 void ath79_device_reset_clear(u32 mask);
181 void ath79_cpu_irq_init(unsigned irq_wb_chan2, unsigned irq_wb_chan3);
182 void ath79_misc_irq_init(void __iomem *regs, int irq,
183 int irq_base, bool is_ar71xx);
185 #endif /* __ASM_MACH_ATH79_H */