]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ARM: sa11x0: neponset: provide function to manipulate NCR_0
authorRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 16 Jan 2012 09:31:47 +0000 (09:31 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 9 Feb 2012 15:34:14 +0000 (15:34 +0000)
Rather than having direct register accesses to NCR_0 scattered amongst
the code, provide a function instead.  This contains the necessary
race protection for this platform, ensuring that updates to this
register are safe.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-sa1100/include/mach/neponset.h
arch/arm/mach-sa1100/neponset.c
drivers/net/ethernet/smsc/smc91x.c
drivers/pcmcia/sa1100_neponset.c

index ffe2bc45eed0a7b6fb4706251efef2b4d18691b6..6032216e1830259a9c1c1d59b1bc85d32b004381 100644 (file)
@@ -71,4 +71,8 @@
 #define NCR_A0VPP              (1<<5)
 #define NCR_A1VPP              (1<<6)
 
+void neponset_ncr_frob(unsigned int, unsigned int);
+#define neponset_ncr_set(v)    neponset_ncr_frob(0, v)
+#define neponset_ncr_clear(v)  neponset_ncr_frob(v, 0)
+
 #endif
index 6a14d3760ccdd48fcf77d427f16304a61e540bc8..10be07e2bd5662cb4ffc3a03aff10b36119c3083 100644 (file)
 #include <asm/hardware/sa1111.h>
 #include <asm/sizes.h>
 
+void neponset_ncr_frob(unsigned int mask, unsigned int val)
+{
+       unsigned long flags;
+
+       local_irq_save(flags);
+       NCR_0 = (NCR_0 & ~mask) | val;
+       local_irq_restore(flags);
+}
+
 /*
  * Install handler for Neponset IRQ.  Note that we have to loop here
  * since the ETHERNET and USAR IRQs are level based, and we need to
index 64ad3ed74495f171e29ff5d4e88c1d1efeab8a51..0dba0501b7120b15d34d6a2bd381dfcb9e26300a 100644 (file)
@@ -2281,7 +2281,7 @@ static int __devinit smc_drv_probe(struct platform_device *pdev)
        if (ret)
                goto out_release_io;
 #if defined(CONFIG_SA1100_ASSABET)
-       NCR_0 |= NCR_ENET_OSC_EN;
+       neponset_ncr_set(NCR_ENET_OSC_EN);
 #endif
        platform_set_drvdata(pdev, ndev);
        ret = smc_enable_device(pdev);
index c95639b5f2a06095c9c586aebe80f0e1bed9fa8a..4300a7fb3edb090c5c5bc3db33e5add213a0913d 100644 (file)
@@ -94,12 +94,7 @@ neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_sta
 
        ret = sa1111_pcmcia_configure_socket(skt, state);
        if (ret == 0) {
-               unsigned long flags;
-
-               local_irq_save(flags);
-               NCR_0 = (NCR_0 & ~ncr_mask) | ncr_set;
-
-               local_irq_restore(flags);
+               neponset_ncr_frob(ncr_mask, ncr_set);
                sa1111_set_io(s->dev, pa_dwr_mask, pa_dwr_set);
        }