aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-stmp37xx/stmp37xx.c
diff options
context:
space:
mode:
authordmitry pervushin <dpervushin@embeddedalley.com>2009-05-31 08:32:11 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-05-31 08:55:56 -0400
commit98f420b23a62e0c9df78c5851860d47bf1bc87dd (patch)
treeb7e88059454d2410b1a2107c17a748a03d366fdf /arch/arm/mach-stmp37xx/stmp37xx.c
parent3f52326a85666c1cb0210eb5556ef3d483933cfc (diff)
[ARM] 5532/1: Freescale STMP: register definitions [3/3]
Replace HW_zzz register access macros by regular __raw_readl/__raw_writel calls Signed-off-by: dmitry pervushin <dpervushin@embeddedalley.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-stmp37xx/stmp37xx.c')
-rw-r--r--arch/arm/mach-stmp37xx/stmp37xx.c84
1 files changed, 43 insertions, 41 deletions
diff --git a/arch/arm/mach-stmp37xx/stmp37xx.c b/arch/arm/mach-stmp37xx/stmp37xx.c
index 83a41c90c252..8c7d6fb191a3 100644
--- a/arch/arm/mach-stmp37xx/stmp37xx.c
+++ b/arch/arm/mach-stmp37xx/stmp37xx.c
@@ -34,6 +34,7 @@
34#include <mach/stmp3xxx.h> 34#include <mach/stmp3xxx.h>
35#include <mach/dma.h> 35#include <mach/dma.h>
36 36
37#include <mach/platform.h>
37#include <mach/regs-icoll.h> 38#include <mach/regs-icoll.h>
38#include <mach/regs-apbh.h> 39#include <mach/regs-apbh.h>
39#include <mach/regs-apbx.h> 40#include <mach/regs-apbx.h>
@@ -45,25 +46,28 @@
45static void stmp37xx_ack_irq(unsigned int irq) 46static void stmp37xx_ack_irq(unsigned int irq)
46{ 47{
47 /* Disable IRQ */ 48 /* Disable IRQ */
48 HW_ICOLL_PRIORITYn_CLR(irq / 4, 0x04 << ((irq % 4) * 8)); 49 stmp3xxx_clearl(0x04 << ((irq % 4) * 8),
50 REGS_ICOLL_BASE + HW_ICOLL_PRIORITYn + irq / 4 * 0x10);
49 51
50 /* ACK current interrupt */ 52 /* ACK current interrupt */
51 HW_ICOLL_LEVELACK_WR(1); 53 __raw_writel(1, REGS_ICOLL_BASE + HW_ICOLL_LEVELACK);
52 54
53 /* Barrier */ 55 /* Barrier */
54 (void) HW_ICOLL_STAT_RD(); 56 (void)__raw_readl(REGS_ICOLL_BASE + HW_ICOLL_STAT);
55} 57}
56 58
57static void stmp37xx_mask_irq(unsigned int irq) 59static void stmp37xx_mask_irq(unsigned int irq)
58{ 60{
59 /* IRQ disable */ 61 /* IRQ disable */
60 HW_ICOLL_PRIORITYn_CLR(irq / 4, 0x04 << ((irq % 4) * 8)); 62 stmp3xxx_clearl(0x04 << ((irq % 4) * 8),
63 REGS_ICOLL_BASE + HW_ICOLL_PRIORITYn + irq / 4 * 0x10);
61} 64}
62 65
63static void stmp37xx_unmask_irq(unsigned int irq) 66static void stmp37xx_unmask_irq(unsigned int irq)
64{ 67{
65 /* IRQ enable */ 68 /* IRQ enable */
66 HW_ICOLL_PRIORITYn_SET(irq / 4, 0x04 << ((irq % 4) * 8)); 69 stmp3xxx_setl(0x04 << ((irq % 4) * 8),
70 REGS_ICOLL_BASE + HW_ICOLL_PRIORITYn + irq / 4 * 0x10);
67} 71}
68 72
69static struct irq_chip stmp37xx_chip = { 73static struct irq_chip stmp37xx_chip = {
@@ -82,15 +86,15 @@ void __init stmp37xx_init_irq(void)
82 */ 86 */
83void stmp3xxx_arch_dma_enable_interrupt(int channel) 87void stmp3xxx_arch_dma_enable_interrupt(int channel)
84{ 88{
85 int dmabus = channel / 16; 89 switch (STMP3XXX_DMA_BUS(channel)) {
86
87 switch (dmabus) {
88 case STMP3XXX_BUS_APBH: 90 case STMP3XXX_BUS_APBH:
89 HW_APBH_CTRL1_SET(1 << (8 + (channel % 16))); 91 stmp3xxx_setl(1 << (8 + STMP3XXX_DMA_CHANNEL(channel)),
92 REGS_APBH_BASE + HW_APBH_CTRL1);
90 break; 93 break;
91 94
92 case STMP3XXX_BUS_APBX: 95 case STMP3XXX_BUS_APBX:
93 HW_APBX_CTRL1_SET(1 << (8 + (channel % 16))); 96 stmp3xxx_setl(1 << (8 + STMP3XXX_DMA_CHANNEL(channel)),
97 REGS_APBX_BASE + HW_APBX_CTRL1);
94 break; 98 break;
95 } 99 }
96} 100}
@@ -98,15 +102,15 @@ EXPORT_SYMBOL(stmp3xxx_arch_dma_enable_interrupt);
98 102
99void stmp3xxx_arch_dma_clear_interrupt(int channel) 103void stmp3xxx_arch_dma_clear_interrupt(int channel)
100{ 104{
101 int dmabus = channel / 16; 105 switch (STMP3XXX_DMA_BUS(channel)) {
102
103 switch (dmabus) {
104 case STMP3XXX_BUS_APBH: 106 case STMP3XXX_BUS_APBH:
105 HW_APBH_CTRL1_CLR(1 << (channel % 16)); 107 stmp3xxx_clearl(1 << STMP3XXX_DMA_CHANNEL(channel),
108 REGS_APBH_BASE + HW_APBH_CTRL1);
106 break; 109 break;
107 110
108 case STMP3XXX_BUS_APBX: 111 case STMP3XXX_BUS_APBX:
109 HW_APBX_CTRL1_CLR(1 << (channel % 16)); 112 stmp3xxx_clearl(1 << STMP3XXX_DMA_CHANNEL(channel),
113 REGS_APBX_BASE + HW_APBX_CTRL1);
110 break; 114 break;
111 } 115 }
112} 116}
@@ -116,15 +120,15 @@ int stmp3xxx_arch_dma_is_interrupt(int channel)
116{ 120{
117 int r = 0; 121 int r = 0;
118 122
119 int dmabus = channel / 16; 123 switch (STMP3XXX_DMA_BUS(channel)) {
120
121 switch (dmabus) {
122 case STMP3XXX_BUS_APBH: 124 case STMP3XXX_BUS_APBH:
123 r = HW_APBH_CTRL1_RD() & (1 << (channel % 16)); 125 r = __raw_readl(REGS_APBH_BASE + HW_APBH_CTRL1) &
126 (1 << STMP3XXX_DMA_CHANNEL(channel));
124 break; 127 break;
125 128
126 case STMP3XXX_BUS_APBX: 129 case STMP3XXX_BUS_APBX:
127 r = HW_APBX_CTRL1_RD() & (1 << (channel % 16)); 130 r = __raw_readl(REGS_APBH_BASE + HW_APBH_CTRL1) &
131 (1 << STMP3XXX_DMA_CHANNEL(channel));
128 break; 132 break;
129 } 133 }
130 return r; 134 return r;
@@ -133,24 +137,24 @@ EXPORT_SYMBOL(stmp3xxx_arch_dma_is_interrupt);
133 137
134void stmp3xxx_arch_dma_reset_channel(int channel) 138void stmp3xxx_arch_dma_reset_channel(int channel)
135{ 139{
136 int dmabus = channel / 16; 140 unsigned chbit = 1 << STMP3XXX_DMA_CHANNEL(channel);
137 unsigned chbit = 1 << (channel % 16);
138 141
139 switch (dmabus) { 142 switch (STMP3XXX_DMA_BUS(channel)) {
140 case STMP3XXX_BUS_APBH: 143 case STMP3XXX_BUS_APBH:
141 /* Reset channel and wait for it to complete */ 144 /* Reset channel and wait for it to complete */
142 HW_APBH_CTRL0_SET(chbit << BP_APBH_CTRL0_RESET_CHANNEL); 145 stmp3xxx_setl(chbit << BP_APBH_CTRL0_RESET_CHANNEL,
143 while (HW_APBH_CTRL0_RD() & 146 REGS_APBH_BASE + HW_APBH_CTRL0);
147 while (__raw_readl(REGS_APBH_BASE + HW_APBH_CTRL0) &
144 (chbit << BP_APBH_CTRL0_RESET_CHANNEL)) 148 (chbit << BP_APBH_CTRL0_RESET_CHANNEL))
145 continue; 149 cpu_relax();
146 break; 150 break;
147 151
148 case STMP3XXX_BUS_APBX: 152 case STMP3XXX_BUS_APBX:
149 /* Reset channel and wait for it to complete */ 153 stmp3xxx_setl(chbit << BP_APBX_CTRL0_RESET_CHANNEL,
150 HW_APBX_CTRL0_SET(chbit << BP_APBX_CTRL0_RESET_CHANNEL); 154 REGS_APBX_BASE + HW_APBX_CTRL0);
151 while (HW_APBX_CTRL0_RD() & 155 while (__raw_readl(REGS_APBX_BASE + HW_APBX_CTRL0) &
152 (chbit << BP_APBX_CTRL0_RESET_CHANNEL)) 156 (chbit << BP_APBX_CTRL0_RESET_CHANNEL))
153 continue; 157 cpu_relax();
154 break; 158 break;
155 } 159 }
156} 160}
@@ -158,15 +162,14 @@ EXPORT_SYMBOL(stmp3xxx_arch_dma_reset_channel);
158 162
159void stmp3xxx_arch_dma_freeze(int channel) 163void stmp3xxx_arch_dma_freeze(int channel)
160{ 164{
161 int dmabus = channel / 16; 165 unsigned chbit = 1 << STMP3XXX_DMA_CHANNEL(channel);
162 unsigned chbit = 1 << (channel % 16);
163 166
164 switch (dmabus) { 167 switch (STMP3XXX_DMA_BUS(channel)) {
165 case STMP3XXX_BUS_APBH: 168 case STMP3XXX_BUS_APBH:
166 HW_APBH_CTRL0_SET(1<<chbit); 169 stmp3xxx_setl(1 << chbit, REGS_APBH_BASE + HW_APBH_CTRL0);
167 break; 170 break;
168 case STMP3XXX_BUS_APBX: 171 case STMP3XXX_BUS_APBX:
169 HW_APBX_CTRL0_SET(1<<chbit); 172 stmp3xxx_setl(1 << chbit, REGS_APBH_BASE + HW_APBH_CTRL0);
170 break; 173 break;
171 } 174 }
172} 175}
@@ -174,15 +177,14 @@ EXPORT_SYMBOL(stmp3xxx_arch_dma_freeze);
174 177
175void stmp3xxx_arch_dma_unfreeze(int channel) 178void stmp3xxx_arch_dma_unfreeze(int channel)
176{ 179{
177 int dmabus = channel / 16; 180 unsigned chbit = 1 << STMP3XXX_DMA_CHANNEL(channel);
178 unsigned chbit = 1 << (channel % 16);
179 181
180 switch (dmabus) { 182 switch (STMP3XXX_DMA_BUS(channel)) {
181 case STMP3XXX_BUS_APBH: 183 case STMP3XXX_BUS_APBH:
182 HW_APBH_CTRL0_CLR(1<<chbit); 184 stmp3xxx_clearl(1 << chbit, REGS_APBH_BASE + HW_APBH_CTRL0);
183 break; 185 break;
184 case STMP3XXX_BUS_APBX: 186 case STMP3XXX_BUS_APBX:
185 HW_APBX_CTRL0_CLR(1<<chbit); 187 stmp3xxx_clearl(1 << chbit, REGS_APBH_BASE + HW_APBH_CTRL0);
186 break; 188 break;
187 } 189 }
188} 190}
@@ -194,7 +196,7 @@ EXPORT_SYMBOL(stmp3xxx_arch_dma_unfreeze);
194 * 196 *
195 * Logical Physical 197 * Logical Physical
196 * f0000000 80000000 On-chip registers 198 * f0000000 80000000 On-chip registers
197 * f1000000 00000000 256k on-chip SRAM 199 * f1000000 00000000 32k on-chip SRAM
198 */ 200 */
199static struct map_desc stmp37xx_io_desc[] __initdata = { 201static struct map_desc stmp37xx_io_desc[] __initdata = {
200 { 202 {