aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorDmitry Baryshkov <dbaryshkov@gmail.com>2008-04-09 18:05:09 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-04-10 10:31:35 -0400
commitc353faa4b2abd8d5142640b880532c97a0807460 (patch)
tree7e50227256a58c88ca7baefb2cd206f9d55d33e9 /arch/arm
parent2f8c51493323550529ed295ba6ddcdd3d0f704d5 (diff)
[ARM] 4957/1: Drop special macro SCOOP_REG in favour if ioread16/iowrite16.
Make scoop driver use generic purpose io routines: ioread16 and iowrite16 instead of direct writing to memory. Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com> Acked-by: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/common/scoop.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index 04b4a92d7b6f..fc08577cdd6c 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -30,8 +30,6 @@
30struct scoop_pcmcia_config *platform_scoop_config; 30struct scoop_pcmcia_config *platform_scoop_config;
31EXPORT_SYMBOL(platform_scoop_config); 31EXPORT_SYMBOL(platform_scoop_config);
32 32
33#define SCOOP_REG(d,adr) (*(volatile __iomem unsigned short*)(d +(adr)))
34
35struct scoop_dev { 33struct scoop_dev {
36 void __iomem *base; 34 void __iomem *base;
37 spinlock_t scoop_lock; 35 spinlock_t scoop_lock;
@@ -44,13 +42,13 @@ void reset_scoop(struct device *dev)
44{ 42{
45 struct scoop_dev *sdev = dev_get_drvdata(dev); 43 struct scoop_dev *sdev = dev_get_drvdata(dev);
46 44
47 SCOOP_REG(sdev->base,SCOOP_MCR) = 0x0100; // 00 45 iowrite16(0x0100, sdev->base + SCOOP_MCR); // 00
48 SCOOP_REG(sdev->base,SCOOP_CDR) = 0x0000; // 04 46 iowrite16(0x0000, sdev->base + SCOOP_CDR); // 04
49 SCOOP_REG(sdev->base,SCOOP_CCR) = 0x0000; // 10 47 iowrite16(0x0000, sdev->base + SCOOP_CCR); // 10
50 SCOOP_REG(sdev->base,SCOOP_IMR) = 0x0000; // 18 48 iowrite16(0x0000, sdev->base + SCOOP_IMR); // 18
51 SCOOP_REG(sdev->base,SCOOP_IRM) = 0x00FF; // 14 49 iowrite16(0x00FF, sdev->base + SCOOP_IRM); // 14
52 SCOOP_REG(sdev->base,SCOOP_ISR) = 0x0000; // 1C 50 iowrite16(0x0000, sdev->base + SCOOP_ISR); // 1C
53 SCOOP_REG(sdev->base,SCOOP_IRM) = 0x0000; 51 iowrite16(0x0000, sdev->base + SCOOP_IRM);
54} 52}
55 53
56unsigned short set_scoop_gpio(struct device *dev, unsigned short bit) 54unsigned short set_scoop_gpio(struct device *dev, unsigned short bit)
@@ -60,8 +58,8 @@ unsigned short set_scoop_gpio(struct device *dev, unsigned short bit)
60 struct scoop_dev *sdev = dev_get_drvdata(dev); 58 struct scoop_dev *sdev = dev_get_drvdata(dev);
61 59
62 spin_lock_irqsave(&sdev->scoop_lock, flag); 60 spin_lock_irqsave(&sdev->scoop_lock, flag);
63 gpio_bit = SCOOP_REG(sdev->base, SCOOP_GPWR) | bit; 61 gpio_bit = ioread16(sdev->base + SCOOP_GPWR) | bit;
64 SCOOP_REG(sdev->base, SCOOP_GPWR) = gpio_bit; 62 iowrite16(gpio_bit, sdev->base + SCOOP_GPWR);
65 spin_unlock_irqrestore(&sdev->scoop_lock, flag); 63 spin_unlock_irqrestore(&sdev->scoop_lock, flag);
66 64
67 return gpio_bit; 65 return gpio_bit;
@@ -74,8 +72,8 @@ unsigned short reset_scoop_gpio(struct device *dev, unsigned short bit)
74 struct scoop_dev *sdev = dev_get_drvdata(dev); 72 struct scoop_dev *sdev = dev_get_drvdata(dev);
75 73
76 spin_lock_irqsave(&sdev->scoop_lock, flag); 74 spin_lock_irqsave(&sdev->scoop_lock, flag);
77 gpio_bit = SCOOP_REG(sdev->base, SCOOP_GPWR) & ~bit; 75 gpio_bit = ioread16(sdev->base + SCOOP_GPWR) & ~bit;
78 SCOOP_REG(sdev->base,SCOOP_GPWR) = gpio_bit; 76 iowrite16(gpio_bit, sdev->base + SCOOP_GPWR);
79 spin_unlock_irqrestore(&sdev->scoop_lock, flag); 77 spin_unlock_irqrestore(&sdev->scoop_lock, flag);
80 78
81 return gpio_bit; 79 return gpio_bit;
@@ -87,13 +85,13 @@ EXPORT_SYMBOL(reset_scoop_gpio);
87unsigned short read_scoop_reg(struct device *dev, unsigned short reg) 85unsigned short read_scoop_reg(struct device *dev, unsigned short reg)
88{ 86{
89 struct scoop_dev *sdev = dev_get_drvdata(dev); 87 struct scoop_dev *sdev = dev_get_drvdata(dev);
90 return SCOOP_REG(sdev->base,reg); 88 return ioread16(sdev->base + reg);
91} 89}
92 90
93void write_scoop_reg(struct device *dev, unsigned short reg, unsigned short data) 91void write_scoop_reg(struct device *dev, unsigned short reg, unsigned short data)
94{ 92{
95 struct scoop_dev *sdev = dev_get_drvdata(dev); 93 struct scoop_dev *sdev = dev_get_drvdata(dev);
96 SCOOP_REG(sdev->base,reg)=data; 94 iowrite16(data, sdev->base + reg);
97} 95}
98 96
99EXPORT_SYMBOL(reset_scoop); 97EXPORT_SYMBOL(reset_scoop);
@@ -104,9 +102,9 @@ static void check_scoop_reg(struct scoop_dev *sdev)
104{ 102{
105 unsigned short mcr; 103 unsigned short mcr;
106 104
107 mcr = SCOOP_REG(sdev->base, SCOOP_MCR); 105 mcr = ioread16(sdev->base + SCOOP_MCR);
108 if ((mcr & 0x100) == 0) 106 if ((mcr & 0x100) == 0)
109 SCOOP_REG(sdev->base, SCOOP_MCR) = 0x0101; 107 iowrite16(0x0101, sdev->base + SCOOP_MCR);
110} 108}
111 109
112#ifdef CONFIG_PM 110#ifdef CONFIG_PM
@@ -115,8 +113,8 @@ static int scoop_suspend(struct platform_device *dev, pm_message_t state)
115 struct scoop_dev *sdev = platform_get_drvdata(dev); 113 struct scoop_dev *sdev = platform_get_drvdata(dev);
116 114
117 check_scoop_reg(sdev); 115 check_scoop_reg(sdev);
118 sdev->scoop_gpwr = SCOOP_REG(sdev->base, SCOOP_GPWR); 116 sdev->scoop_gpwr = ioread16(sdev->base + SCOOP_GPWR);
119 SCOOP_REG(sdev->base, SCOOP_GPWR) = (sdev->scoop_gpwr & ~sdev->suspend_clr) | sdev->suspend_set; 117 iowrite16((sdev->scoop_gpwr & ~sdev->suspend_clr) | sdev->suspend_set, sdev->base + SCOOP_GPWR);
120 118
121 return 0; 119 return 0;
122} 120}
@@ -126,7 +124,7 @@ static int scoop_resume(struct platform_device *dev)
126 struct scoop_dev *sdev = platform_get_drvdata(dev); 124 struct scoop_dev *sdev = platform_get_drvdata(dev);
127 125
128 check_scoop_reg(sdev); 126 check_scoop_reg(sdev);
129 SCOOP_REG(sdev->base,SCOOP_GPWR) = sdev->scoop_gpwr; 127 iowrite16(sdev->scoop_gpwr, sdev->base + SCOOP_GPWR);
130 128
131 return 0; 129 return 0;
132} 130}
@@ -162,11 +160,11 @@ static int __devinit scoop_probe(struct platform_device *pdev)
162 160
163 printk("Sharp Scoop Device found at 0x%08x -> 0x%8p\n",(unsigned int)mem->start, devptr->base); 161 printk("Sharp Scoop Device found at 0x%08x -> 0x%8p\n",(unsigned int)mem->start, devptr->base);
164 162
165 SCOOP_REG(devptr->base, SCOOP_MCR) = 0x0140; 163 iowrite16(0x0140, devptr->base + SCOOP_MCR);
166 reset_scoop(&pdev->dev); 164 reset_scoop(&pdev->dev);
167 SCOOP_REG(devptr->base, SCOOP_CPR) = 0x0000; 165 iowrite16(0x0000, devptr->base + SCOOP_CPR);
168 SCOOP_REG(devptr->base, SCOOP_GPCR) = inf->io_dir & 0xffff; 166 iowrite16(inf->io_dir & 0xffff, devptr->base + SCOOP_GPCR);
169 SCOOP_REG(devptr->base, SCOOP_GPWR) = inf->io_out & 0xffff; 167 iowrite16(inf->io_out & 0xffff, devptr->base + SCOOP_GPWR);
170 168
171 devptr->suspend_clr = inf->suspend_clr; 169 devptr->suspend_clr = inf->suspend_clr;
172 devptr->suspend_set = inf->suspend_set; 170 devptr->suspend_set = inf->suspend_set;