aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2012-01-16 04:31:47 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-02-09 10:34:14 -0500
commit6ad1b614007c556129989b9f6b020d0d2e058121 (patch)
treed146b694cad7d3134b3166f56f401b203e073811
parent710455201f6690841e9a40bedba09ddd0a7e0620 (diff)
ARM: sa11x0: neponset: provide function to manipulate NCR_0
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>
-rw-r--r--arch/arm/mach-sa1100/include/mach/neponset.h4
-rw-r--r--arch/arm/mach-sa1100/neponset.c9
-rw-r--r--drivers/net/ethernet/smsc/smc91x.c2
-rw-r--r--drivers/pcmcia/sa1100_neponset.c7
4 files changed, 15 insertions, 7 deletions
diff --git a/arch/arm/mach-sa1100/include/mach/neponset.h b/arch/arm/mach-sa1100/include/mach/neponset.h
index ffe2bc45eed0..6032216e1830 100644
--- a/arch/arm/mach-sa1100/include/mach/neponset.h
+++ b/arch/arm/mach-sa1100/include/mach/neponset.h
@@ -71,4 +71,8 @@
71#define NCR_A0VPP (1<<5) 71#define NCR_A0VPP (1<<5)
72#define NCR_A1VPP (1<<6) 72#define NCR_A1VPP (1<<6)
73 73
74void neponset_ncr_frob(unsigned int, unsigned int);
75#define neponset_ncr_set(v) neponset_ncr_frob(0, v)
76#define neponset_ncr_clear(v) neponset_ncr_frob(v, 0)
77
74#endif 78#endif
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 6a14d3760ccd..10be07e2bd56 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -20,6 +20,15 @@
20#include <asm/hardware/sa1111.h> 20#include <asm/hardware/sa1111.h>
21#include <asm/sizes.h> 21#include <asm/sizes.h>
22 22
23void neponset_ncr_frob(unsigned int mask, unsigned int val)
24{
25 unsigned long flags;
26
27 local_irq_save(flags);
28 NCR_0 = (NCR_0 & ~mask) | val;
29 local_irq_restore(flags);
30}
31
23/* 32/*
24 * Install handler for Neponset IRQ. Note that we have to loop here 33 * Install handler for Neponset IRQ. Note that we have to loop here
25 * since the ETHERNET and USAR IRQs are level based, and we need to 34 * since the ETHERNET and USAR IRQs are level based, and we need to
diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c
index 64ad3ed74495..0dba0501b712 100644
--- a/drivers/net/ethernet/smsc/smc91x.c
+++ b/drivers/net/ethernet/smsc/smc91x.c
@@ -2281,7 +2281,7 @@ static int __devinit smc_drv_probe(struct platform_device *pdev)
2281 if (ret) 2281 if (ret)
2282 goto out_release_io; 2282 goto out_release_io;
2283#if defined(CONFIG_SA1100_ASSABET) 2283#if defined(CONFIG_SA1100_ASSABET)
2284 NCR_0 |= NCR_ENET_OSC_EN; 2284 neponset_ncr_set(NCR_ENET_OSC_EN);
2285#endif 2285#endif
2286 platform_set_drvdata(pdev, ndev); 2286 platform_set_drvdata(pdev, ndev);
2287 ret = smc_enable_device(pdev); 2287 ret = smc_enable_device(pdev);
diff --git a/drivers/pcmcia/sa1100_neponset.c b/drivers/pcmcia/sa1100_neponset.c
index c95639b5f2a0..4300a7fb3edb 100644
--- a/drivers/pcmcia/sa1100_neponset.c
+++ b/drivers/pcmcia/sa1100_neponset.c
@@ -94,12 +94,7 @@ neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_sta
94 94
95 ret = sa1111_pcmcia_configure_socket(skt, state); 95 ret = sa1111_pcmcia_configure_socket(skt, state);
96 if (ret == 0) { 96 if (ret == 0) {
97 unsigned long flags; 97 neponset_ncr_frob(ncr_mask, ncr_set);
98
99 local_irq_save(flags);
100 NCR_0 = (NCR_0 & ~ncr_mask) | ncr_set;
101
102 local_irq_restore(flags);
103 sa1111_set_io(s->dev, pa_dwr_mask, pa_dwr_set); 98 sa1111_set_io(s->dev, pa_dwr_mask, pa_dwr_set);
104 } 99 }
105 100