aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2011-09-21 11:47:50 +0000
committerGabor Juhos <juhosg@openwrt.org>2011-09-21 11:47:50 +0000
commit8c46da4f794309b1995cbf6e6e23ce890f55e508 (patch)
treec5a0db199c0d52163f426b398d2beb890ae29a03 /target/linux
parentbf499e2ee8a4a95bd0caa861c4839646d3e01edf (diff)
downloadupstream-8c46da4f794309b1995cbf6e6e23ce890f55e508.tar.gz
upstream-8c46da4f794309b1995cbf6e6e23ce890f55e508.tar.bz2
upstream-8c46da4f794309b1995cbf6e6e23ce890f55e508.zip
ar71xx: add ar71xx_device_reset_rmw helper
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@28275 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/ar71xx.c48
-rw-r--r--target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h1
2 files changed, 49 insertions, 0 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/ar71xx.c b/target/linux/ar71xx/files/arch/mips/ar71xx/ar71xx.c
index ef956fbf4d..93cbe5331f 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/ar71xx.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/ar71xx.c
@@ -153,6 +153,54 @@ void ar71xx_device_start(u32 mask)
}
EXPORT_SYMBOL_GPL(ar71xx_device_start);
+void ar71xx_device_reset_rmw(u32 clear, u32 set)
+{
+ unsigned long flags;
+ unsigned int reg;
+ u32 t;
+
+ switch (ar71xx_soc) {
+ case AR71XX_SOC_AR7130:
+ case AR71XX_SOC_AR7141:
+ case AR71XX_SOC_AR7161:
+ reg = AR71XX_RESET_REG_RESET_MODULE;
+ break;
+
+ case AR71XX_SOC_AR7240:
+ case AR71XX_SOC_AR7241:
+ case AR71XX_SOC_AR7242:
+ reg = AR724X_RESET_REG_RESET_MODULE;
+ break;
+
+ case AR71XX_SOC_AR9130:
+ case AR71XX_SOC_AR9132:
+ reg = AR91XX_RESET_REG_RESET_MODULE;
+ break;
+
+ case AR71XX_SOC_AR9330:
+ case AR71XX_SOC_AR9331:
+ reg = AR933X_RESET_REG_RESET_MODULE;
+ break;
+
+ case AR71XX_SOC_AR9341:
+ case AR71XX_SOC_AR9342:
+ case AR71XX_SOC_AR9344:
+ reg = AR934X_RESET_REG_RESET_MODULE;
+ break;
+
+ default:
+ BUG();
+ }
+
+ spin_lock_irqsave(&ar71xx_device_lock, flags);
+ t = ar71xx_reset_rr(reg);
+ t &= ~clear;
+ t |= set;
+ ar71xx_reset_wr(reg, t);
+ spin_unlock_irqrestore(&ar71xx_device_lock, flags);
+}
+EXPORT_SYMBOL_GPL(ar71xx_device_reset_rmw);
+
int ar71xx_device_stopped(u32 mask)
{
unsigned long flags;
diff --git a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h
index f78ae16651..ec5e0bb2b5 100644
--- a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h
+++ b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h
@@ -724,6 +724,7 @@ static inline u32 ar71xx_reset_rr(unsigned reg)
void ar71xx_device_stop(u32 mask);
void ar71xx_device_start(u32 mask);
+void ar71xx_device_reset_rmw(u32 clear, u32 set);
int ar71xx_device_stopped(u32 mask);
/*