Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / mips / include / asm / mach-ath79 / ath79.h
blob441faa92c3cd488ac97685a1930597f7449a88f4
1 /*
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>
18 #include <linux/io.h>
20 enum ath79_soc_type {
21 ATH79_SOC_UNKNOWN,
22 ATH79_SOC_AR7130,
23 ATH79_SOC_AR7141,
24 ATH79_SOC_AR7161,
25 ATH79_SOC_AR7240,
26 ATH79_SOC_AR7241,
27 ATH79_SOC_AR7242,
28 ATH79_SOC_AR9130,
29 ATH79_SOC_AR9132,
30 ATH79_SOC_AR9330,
31 ATH79_SOC_AR9331,
32 ATH79_SOC_AR9341,
33 ATH79_SOC_AR9342,
34 ATH79_SOC_AR9344,
35 ATH79_SOC_QCA9556,
36 ATH79_SOC_QCA9558,
39 extern enum ath79_soc_type ath79_soc;
40 extern unsigned int ath79_soc_rev;
42 static inline int soc_is_ar71xx(void)
44 return (ath79_soc == ATH79_SOC_AR7130 ||
45 ath79_soc == ATH79_SOC_AR7141 ||
46 ath79_soc == ATH79_SOC_AR7161);
49 static inline int soc_is_ar724x(void)
51 return (ath79_soc == ATH79_SOC_AR7240 ||
52 ath79_soc == ATH79_SOC_AR7241 ||
53 ath79_soc == ATH79_SOC_AR7242);
56 static inline int soc_is_ar7240(void)
58 return (ath79_soc == ATH79_SOC_AR7240);
61 static inline int soc_is_ar7241(void)
63 return (ath79_soc == ATH79_SOC_AR7241);
66 static inline int soc_is_ar7242(void)
68 return (ath79_soc == ATH79_SOC_AR7242);
71 static inline int soc_is_ar913x(void)
73 return (ath79_soc == ATH79_SOC_AR9130 ||
74 ath79_soc == ATH79_SOC_AR9132);
77 static inline int soc_is_ar933x(void)
79 return (ath79_soc == ATH79_SOC_AR9330 ||
80 ath79_soc == ATH79_SOC_AR9331);
83 static inline int soc_is_ar9341(void)
85 return (ath79_soc == ATH79_SOC_AR9341);
88 static inline int soc_is_ar9342(void)
90 return (ath79_soc == ATH79_SOC_AR9342);
93 static inline int soc_is_ar9344(void)
95 return (ath79_soc == ATH79_SOC_AR9344);
98 static inline int soc_is_ar934x(void)
100 return soc_is_ar9341() || soc_is_ar9342() || soc_is_ar9344();
103 static inline int soc_is_qca9556(void)
105 return ath79_soc == ATH79_SOC_QCA9556;
108 static inline int soc_is_qca9558(void)
110 return ath79_soc == ATH79_SOC_QCA9558;
113 static inline int soc_is_qca955x(void)
115 return soc_is_qca9556() || soc_is_qca9558();
118 void ath79_ddr_wb_flush(unsigned int reg);
119 void ath79_ddr_set_pci_windows(void);
121 extern void __iomem *ath79_pll_base;
122 extern void __iomem *ath79_reset_base;
124 static inline void ath79_pll_wr(unsigned reg, u32 val)
126 __raw_writel(val, ath79_pll_base + reg);
129 static inline u32 ath79_pll_rr(unsigned reg)
131 return __raw_readl(ath79_pll_base + reg);
134 static inline void ath79_reset_wr(unsigned reg, u32 val)
136 __raw_writel(val, ath79_reset_base + reg);
139 static inline u32 ath79_reset_rr(unsigned reg)
141 return __raw_readl(ath79_reset_base + reg);
144 void ath79_device_reset_set(u32 mask);
145 void ath79_device_reset_clear(u32 mask);
147 void ath79_cpu_irq_init(unsigned irq_wb_chan2, unsigned irq_wb_chan3);
148 void ath79_misc_irq_init(void __iomem *regs, int irq,
149 int irq_base, bool is_ar71xx);
151 #endif /* __ASM_MACH_ATH79_H */