Add linux-next specific files for 20110831
[linux-2.6/next.git] / arch / mips / include / asm / mach-ath79 / ath79.h
blob6a9f168506fe061cb85f517c04e4605cc9f54208
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
32 extern enum ath79_soc_type ath79_soc;
34 static inline int soc_is_ar71xx(void)
36 return (ath79_soc == ATH79_SOC_AR7130 ||
37 ath79_soc == ATH79_SOC_AR7141 ||
38 ath79_soc == ATH79_SOC_AR7161);
41 static inline int soc_is_ar724x(void)
43 return (ath79_soc == ATH79_SOC_AR7240 ||
44 ath79_soc == ATH79_SOC_AR7241 ||
45 ath79_soc == ATH79_SOC_AR7242);
48 static inline int soc_is_ar7240(void)
50 return (ath79_soc == ATH79_SOC_AR7240);
53 static inline int soc_is_ar7241(void)
55 return (ath79_soc == ATH79_SOC_AR7241);
58 static inline int soc_is_ar7242(void)
60 return (ath79_soc == ATH79_SOC_AR7242);
63 static inline int soc_is_ar913x(void)
65 return (ath79_soc == ATH79_SOC_AR9130 ||
66 ath79_soc == ATH79_SOC_AR9132);
69 extern void __iomem *ath79_ddr_base;
70 extern void __iomem *ath79_pll_base;
71 extern void __iomem *ath79_reset_base;
73 static inline void ath79_pll_wr(unsigned reg, u32 val)
75 __raw_writel(val, ath79_pll_base + reg);
78 static inline u32 ath79_pll_rr(unsigned reg)
80 return __raw_readl(ath79_pll_base + reg);
83 static inline void ath79_reset_wr(unsigned reg, u32 val)
85 __raw_writel(val, ath79_reset_base + reg);
88 static inline u32 ath79_reset_rr(unsigned reg)
90 return __raw_readl(ath79_reset_base + reg);
93 void ath79_device_reset_set(u32 mask);
94 void ath79_device_reset_clear(u32 mask);
96 #endif /* __ASM_MACH_ATH79_H */