ar71xx: add ar71xx_device_stopped function
authorGabor Juhos <juhosg@openwrt.org>
Fri, 11 Dec 2009 20:32:28 +0000 (20:32 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Fri, 11 Dec 2009 20:32:28 +0000 (20:32 +0000)
SVN-Revision: 18757

target/linux/ar71xx/files/arch/mips/ar71xx/ar71xx.c
target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h

index 2a9dff31116ad28d990b7c27875d630448a4bfe5..0eddf26fbb422c2cb5c37fb541797d398ab30bb0 100644 (file)
@@ -113,6 +113,41 @@ void ar71xx_device_start(u32 mask)
 }
 EXPORT_SYMBOL_GPL(ar71xx_device_start);
 
+int ar71xx_device_stopped(u32 mask)
+{
+       unsigned long flags;
+       u32 t;
+
+       switch (ar71xx_soc) {
+       case AR71XX_SOC_AR7130:
+       case AR71XX_SOC_AR7141:
+       case AR71XX_SOC_AR7161:
+               local_irq_save(flags);
+               t = ar71xx_reset_rr(AR71XX_RESET_REG_RESET_MODULE);
+               local_irq_restore(flags);
+               break;
+
+       case AR71XX_SOC_AR7240:
+               local_irq_save(flags);
+               t = ar71xx_reset_rr(AR724X_RESET_REG_RESET_MODULE);
+               local_irq_restore(flags);
+               break;
+
+       case AR71XX_SOC_AR9130:
+       case AR71XX_SOC_AR9132:
+               local_irq_save(flags);
+               t = ar71xx_reset_rr(AR91XX_RESET_REG_RESET_MODULE);
+               local_irq_restore(flags);
+               break;
+
+       default:
+               BUG();
+       }
+
+       return ((t & mask) == mask);
+}
+EXPORT_SYMBOL_GPL(ar71xx_device_stopped);
+
 void ar71xx_ddr_flush(u32 reg)
 {
        ar71xx_ddr_wr(reg, 1);
index 48f6e0a654bfc08ea9acec1cb2b445f788da083f..e68276698d81c097d0c2a739cf15c495b2ab7a2b 100644 (file)
@@ -510,6 +510,7 @@ static inline u32 ar71xx_reset_rr(unsigned reg)
 
 void ar71xx_device_stop(u32 mask);
 void ar71xx_device_start(u32 mask);
+int ar71xx_device_stopped(u32 mask);
 
 /*
  * SPI block