diff options
author | dmitry pervushin <dpervushin@embeddedalley.com> | 2009-05-31 08:32:11 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-05-31 08:55:56 -0400 |
commit | 98f420b23a62e0c9df78c5851860d47bf1bc87dd (patch) | |
tree | b7e88059454d2410b1a2107c17a748a03d366fdf /arch/arm/mach-stmp378x/stmp378x.c | |
parent | 3f52326a85666c1cb0210eb5556ef3d483933cfc (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-stmp378x/stmp378x.c')
-rw-r--r-- | arch/arm/mach-stmp378x/stmp378x.c | 109 |
1 files changed, 61 insertions, 48 deletions
diff --git a/arch/arm/mach-stmp378x/stmp378x.c b/arch/arm/mach-stmp378x/stmp378x.c index f156ec7306c0..9a363fb2acf3 100644 --- a/arch/arm/mach-stmp378x/stmp378x.c +++ b/arch/arm/mach-stmp378x/stmp378x.c | |||
@@ -47,25 +47,28 @@ | |||
47 | static void stmp378x_ack_irq(unsigned int irq) | 47 | static void stmp378x_ack_irq(unsigned int irq) |
48 | { | 48 | { |
49 | /* Tell ICOLL to release IRQ line */ | 49 | /* Tell ICOLL to release IRQ line */ |
50 | HW_ICOLL_VECTOR_WR(0x0); | 50 | __raw_writel(0, REGS_ICOLL_BASE + HW_ICOLL_VECTOR); |
51 | 51 | ||
52 | /* ACK current interrupt */ | 52 | /* ACK current interrupt */ |
53 | HW_ICOLL_LEVELACK_WR(BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0); | 53 | __raw_writel(0x01 /* BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0 */, |
54 | REGS_ICOLL_BASE + HW_ICOLL_LEVELACK); | ||
54 | 55 | ||
55 | /* Barrier */ | 56 | /* Barrier */ |
56 | (void) HW_ICOLL_STAT_RD(); | 57 | (void)__raw_readl(REGS_ICOLL_BASE + HW_ICOLL_STAT); |
57 | } | 58 | } |
58 | 59 | ||
59 | static void stmp378x_mask_irq(unsigned int irq) | 60 | static void stmp378x_mask_irq(unsigned int irq) |
60 | { | 61 | { |
61 | /* IRQ disable */ | 62 | /* IRQ disable */ |
62 | HW_ICOLL_INTERRUPTn_CLR(irq, BM_ICOLL_INTERRUPTn_ENABLE); | 63 | stmp3xxx_clearl(BM_ICOLL_INTERRUPTn_ENABLE, |
64 | REGS_ICOLL_BASE + HW_ICOLL_INTERRUPTn + irq * 0x10); | ||
63 | } | 65 | } |
64 | 66 | ||
65 | static void stmp378x_unmask_irq(unsigned int irq) | 67 | static void stmp378x_unmask_irq(unsigned int irq) |
66 | { | 68 | { |
67 | /* IRQ enable */ | 69 | /* IRQ enable */ |
68 | HW_ICOLL_INTERRUPTn_SET(irq, BM_ICOLL_INTERRUPTn_ENABLE); | 70 | stmp3xxx_setl(BM_ICOLL_INTERRUPTn_ENABLE, |
71 | REGS_ICOLL_BASE + HW_ICOLL_INTERRUPTn + irq * 0x10); | ||
69 | } | 72 | } |
70 | 73 | ||
71 | static struct irq_chip stmp378x_chip = { | 74 | static struct irq_chip stmp378x_chip = { |
@@ -84,52 +87,63 @@ void __init stmp378x_init_irq(void) | |||
84 | */ | 87 | */ |
85 | void stmp3xxx_arch_dma_enable_interrupt(int channel) | 88 | void stmp3xxx_arch_dma_enable_interrupt(int channel) |
86 | { | 89 | { |
87 | int dmabus = channel / 16; | 90 | void __iomem *c1, *c2; |
88 | 91 | ||
89 | switch (dmabus) { | 92 | switch (STMP3XXX_DMA_BUS(channel)) { |
90 | case STMP3XXX_BUS_APBH: | 93 | case STMP3XXX_BUS_APBH: |
91 | HW_APBH_CTRL1_SET(1 << (16 + (channel % 16))); | 94 | c1 = REGS_APBH_BASE + HW_APBH_CTRL1; |
92 | HW_APBH_CTRL2_SET(1 << (16 + (channel % 16))); | 95 | c2 = REGS_APBH_BASE + HW_APBH_CTRL2; |
93 | break; | 96 | break; |
94 | 97 | ||
95 | case STMP3XXX_BUS_APBX: | 98 | case STMP3XXX_BUS_APBX: |
96 | HW_APBX_CTRL1_SET(1 << (16 + (channel % 16))); | 99 | c1 = REGS_APBX_BASE + HW_APBX_CTRL1; |
97 | HW_APBX_CTRL2_SET(1 << (16 + (channel % 16))); | 100 | c2 = REGS_APBX_BASE + HW_APBX_CTRL2; |
98 | break; | 101 | break; |
102 | |||
103 | default: | ||
104 | return; | ||
99 | } | 105 | } |
106 | stmp3xxx_setl(1 << (16 + STMP3XXX_DMA_CHANNEL(channel)), c1); | ||
107 | stmp3xxx_setl(1 << (16 + STMP3XXX_DMA_CHANNEL(channel)), c2); | ||
100 | } | 108 | } |
101 | EXPORT_SYMBOL(stmp3xxx_arch_dma_enable_interrupt); | 109 | EXPORT_SYMBOL(stmp3xxx_arch_dma_enable_interrupt); |
102 | 110 | ||
103 | void stmp3xxx_arch_dma_clear_interrupt(int channel) | 111 | void stmp3xxx_arch_dma_clear_interrupt(int channel) |
104 | { | 112 | { |
105 | int dmabus = channel / 16; | 113 | void __iomem *c1, *c2; |
106 | 114 | ||
107 | switch (dmabus) { | 115 | switch (STMP3XXX_DMA_BUS(channel)) { |
108 | case STMP3XXX_BUS_APBH: | 116 | case STMP3XXX_BUS_APBH: |
109 | HW_APBH_CTRL1_CLR(1 << (channel % 16)); | 117 | c1 = REGS_APBH_BASE + HW_APBH_CTRL1; |
110 | HW_APBH_CTRL2_CLR(1 << (channel % 16)); | 118 | c2 = REGS_APBH_BASE + HW_APBH_CTRL2; |
111 | break; | 119 | break; |
112 | 120 | ||
113 | case STMP3XXX_BUS_APBX: | 121 | case STMP3XXX_BUS_APBX: |
114 | HW_APBX_CTRL1_CLR(1 << (channel % 16)); | 122 | c1 = REGS_APBX_BASE + HW_APBX_CTRL1; |
115 | HW_APBX_CTRL2_CLR(1 << (channel % 16)); | 123 | c2 = REGS_APBX_BASE + HW_APBX_CTRL2; |
116 | break; | 124 | break; |
125 | |||
126 | default: | ||
127 | return; | ||
117 | } | 128 | } |
129 | stmp3xxx_clearl(1 << STMP3XXX_DMA_CHANNEL(channel), c1); | ||
130 | stmp3xxx_clearl(1 << STMP3XXX_DMA_CHANNEL(channel), c2); | ||
118 | } | 131 | } |
119 | EXPORT_SYMBOL(stmp3xxx_arch_dma_clear_interrupt); | 132 | EXPORT_SYMBOL(stmp3xxx_arch_dma_clear_interrupt); |
120 | 133 | ||
121 | int stmp3xxx_arch_dma_is_interrupt(int channel) | 134 | int stmp3xxx_arch_dma_is_interrupt(int channel) |
122 | { | 135 | { |
123 | int dmabus = channel / 16; | ||
124 | int r = 0; | 136 | int r = 0; |
125 | 137 | ||
126 | switch (dmabus) { | 138 | switch (STMP3XXX_DMA_BUS(channel)) { |
127 | case STMP3XXX_BUS_APBH: | 139 | case STMP3XXX_BUS_APBH: |
128 | r = HW_APBH_CTRL1_RD() & (1 << (channel % 16)); | 140 | r = __raw_readl(REGS_APBH_BASE + HW_APBH_CTRL1) & |
141 | (1 << STMP3XXX_DMA_CHANNEL(channel)); | ||
129 | break; | 142 | break; |
130 | 143 | ||
131 | case STMP3XXX_BUS_APBX: | 144 | case STMP3XXX_BUS_APBX: |
132 | r = HW_APBX_CTRL1_RD() & (1 << (channel % 16)); | 145 | r = __raw_readl(REGS_APBX_BASE + HW_APBX_CTRL1) & |
146 | (1 << STMP3XXX_DMA_CHANNEL(channel)); | ||
133 | break; | 147 | break; |
134 | } | 148 | } |
135 | return r; | 149 | return r; |
@@ -138,42 +152,41 @@ EXPORT_SYMBOL(stmp3xxx_arch_dma_is_interrupt); | |||
138 | 152 | ||
139 | void stmp3xxx_arch_dma_reset_channel(int channel) | 153 | void stmp3xxx_arch_dma_reset_channel(int channel) |
140 | { | 154 | { |
141 | int dmabus = channel / 16; | 155 | unsigned chbit = 1 << STMP3XXX_DMA_CHANNEL(channel); |
142 | unsigned chbit = 1 << (channel % 16); | 156 | void __iomem *c0; |
157 | u32 mask; | ||
143 | 158 | ||
144 | switch (dmabus) { | 159 | switch (STMP3XXX_DMA_BUS(channel)) { |
145 | case STMP3XXX_BUS_APBH: | 160 | case STMP3XXX_BUS_APBH: |
146 | /* Reset channel and wait for it to complete */ | 161 | c0 = REGS_APBH_BASE + HW_APBH_CTRL0; |
147 | HW_APBH_CTRL0_SET(chbit << | 162 | mask = chbit << BP_APBH_CTRL0_RESET_CHANNEL; |
148 | BP_APBH_CTRL0_RESET_CHANNEL); | ||
149 | while (HW_APBH_CTRL0_RD() & | ||
150 | (chbit << BP_APBH_CTRL0_RESET_CHANNEL)) | ||
151 | continue; | ||
152 | break; | 163 | break; |
153 | |||
154 | case STMP3XXX_BUS_APBX: | 164 | case STMP3XXX_BUS_APBX: |
155 | /* Reset channel and wait for it to complete */ | 165 | c0 = REGS_APBX_BASE + HW_APBX_CHANNEL_CTRL; |
156 | HW_APBX_CHANNEL_CTRL_SET( | 166 | mask = chbit << BP_APBX_CHANNEL_CTRL_RESET_CHANNEL; |
157 | BF_APBX_CHANNEL_CTRL_RESET_CHANNEL(chbit)); | ||
158 | while (HW_APBX_CHANNEL_CTRL_RD() & | ||
159 | BF_APBX_CHANNEL_CTRL_RESET_CHANNEL(chbit)) | ||
160 | continue; | ||
161 | break; | 167 | break; |
168 | default: | ||
169 | return; | ||
162 | } | 170 | } |
171 | |||
172 | /* Reset channel and wait for it to complete */ | ||
173 | stmp3xxx_setl(mask, c0); | ||
174 | while (__raw_readl(c0) & mask) | ||
175 | cpu_relax(); | ||
163 | } | 176 | } |
164 | EXPORT_SYMBOL(stmp3xxx_arch_dma_reset_channel); | 177 | EXPORT_SYMBOL(stmp3xxx_arch_dma_reset_channel); |
165 | 178 | ||
166 | void stmp3xxx_arch_dma_freeze(int channel) | 179 | void stmp3xxx_arch_dma_freeze(int channel) |
167 | { | 180 | { |
168 | int dmabus = channel / 16; | 181 | unsigned chbit = 1 << STMP3XXX_DMA_CHANNEL(channel); |
169 | unsigned chbit = 1 << (channel % 16); | 182 | u32 mask = 1 << chbit; |
170 | 183 | ||
171 | switch (dmabus) { | 184 | switch (STMP3XXX_DMA_BUS(channel)) { |
172 | case STMP3XXX_BUS_APBH: | 185 | case STMP3XXX_BUS_APBH: |
173 | HW_APBH_CTRL0_SET(1<<chbit); | 186 | stmp3xxx_setl(mask, REGS_APBH_BASE + HW_APBH_CTRL0); |
174 | break; | 187 | break; |
175 | case STMP3XXX_BUS_APBX: | 188 | case STMP3XXX_BUS_APBX: |
176 | HW_APBX_CHANNEL_CTRL_SET(1<<chbit); | 189 | stmp3xxx_setl(mask, REGS_APBX_BASE + HW_APBX_CHANNEL_CTRL); |
177 | break; | 190 | break; |
178 | } | 191 | } |
179 | } | 192 | } |
@@ -181,15 +194,15 @@ EXPORT_SYMBOL(stmp3xxx_arch_dma_freeze); | |||
181 | 194 | ||
182 | void stmp3xxx_arch_dma_unfreeze(int channel) | 195 | void stmp3xxx_arch_dma_unfreeze(int channel) |
183 | { | 196 | { |
184 | int dmabus = channel / 16; | 197 | unsigned chbit = 1 << STMP3XXX_DMA_CHANNEL(channel); |
185 | unsigned chbit = 1 << (channel % 16); | 198 | u32 mask = 1 << chbit; |
186 | 199 | ||
187 | switch (dmabus) { | 200 | switch (STMP3XXX_DMA_BUS(channel)) { |
188 | case STMP3XXX_BUS_APBH: | 201 | case STMP3XXX_BUS_APBH: |
189 | HW_APBH_CTRL0_CLR(1<<chbit); | 202 | stmp3xxx_clearl(mask, REGS_APBH_BASE + HW_APBH_CTRL0); |
190 | break; | 203 | break; |
191 | case STMP3XXX_BUS_APBX: | 204 | case STMP3XXX_BUS_APBX: |
192 | HW_APBX_CHANNEL_CTRL_CLR(1<<chbit); | 205 | stmp3xxx_clearl(mask, REGS_APBX_BASE + HW_APBX_CHANNEL_CTRL); |
193 | break; | 206 | break; |
194 | } | 207 | } |
195 | } | 208 | } |
@@ -201,7 +214,7 @@ EXPORT_SYMBOL(stmp3xxx_arch_dma_unfreeze); | |||
201 | * | 214 | * |
202 | * Logical Physical | 215 | * Logical Physical |
203 | * f0000000 80000000 On-chip registers | 216 | * f0000000 80000000 On-chip registers |
204 | * f1000000 00000000 256k on-chip SRAM | 217 | * f1000000 00000000 32k on-chip SRAM |
205 | */ | 218 | */ |
206 | 219 | ||
207 | static struct map_desc stmp378x_io_desc[] __initdata = { | 220 | static struct map_desc stmp378x_io_desc[] __initdata = { |