aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/qe_lib/qe.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/sysdev/qe_lib/qe.c')
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 7f4c07543961..90f87408b5d5 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -244,7 +244,7 @@ EXPORT_SYMBOL(qe_put_snum);
244static int qe_sdma_init(void) 244static int qe_sdma_init(void)
245{ 245{
246 struct sdma *sdma = &qe_immr->sdma; 246 struct sdma *sdma = &qe_immr->sdma;
247 u32 sdma_buf_offset; 247 unsigned long sdma_buf_offset;
248 248
249 if (!sdma) 249 if (!sdma)
250 return -ENODEV; 250 return -ENODEV;
@@ -252,10 +252,10 @@ static int qe_sdma_init(void)
252 /* allocate 2 internal temporary buffers (512 bytes size each) for 252 /* allocate 2 internal temporary buffers (512 bytes size each) for
253 * the SDMA */ 253 * the SDMA */
254 sdma_buf_offset = qe_muram_alloc(512 * 2, 4096); 254 sdma_buf_offset = qe_muram_alloc(512 * 2, 4096);
255 if (IS_MURAM_ERR(sdma_buf_offset)) 255 if (IS_ERR_VALUE(sdma_buf_offset))
256 return -ENOMEM; 256 return -ENOMEM;
257 257
258 out_be32(&sdma->sdebcr, sdma_buf_offset & QE_SDEBCR_BA_MASK); 258 out_be32(&sdma->sdebcr, (u32) sdma_buf_offset & QE_SDEBCR_BA_MASK);
259 out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK | 259 out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK |
260 (0x1 << QE_SDMR_CEN_SHIFT))); 260 (0x1 << QE_SDMR_CEN_SHIFT)));
261 261
@@ -291,33 +291,32 @@ static void qe_muram_init(void)
291 if ((np = of_find_node_by_name(NULL, "data-only")) != NULL) { 291 if ((np = of_find_node_by_name(NULL, "data-only")) != NULL) {
292 address = *of_get_address(np, 0, &size, &flags); 292 address = *of_get_address(np, 0, &size, &flags);
293 of_node_put(np); 293 of_node_put(np);
294 rh_attach_region(&qe_muram_info, 294 rh_attach_region(&qe_muram_info, address, (int) size);
295 (void *)address, (int)size);
296 } 295 }
297} 296}
298 297
299/* This function returns an index into the MURAM area. 298/* This function returns an index into the MURAM area.
300 */ 299 */
301u32 qe_muram_alloc(u32 size, u32 align) 300unsigned long qe_muram_alloc(int size, int align)
302{ 301{
303 void *start; 302 unsigned long start;
304 unsigned long flags; 303 unsigned long flags;
305 304
306 spin_lock_irqsave(&qe_muram_lock, flags); 305 spin_lock_irqsave(&qe_muram_lock, flags);
307 start = rh_alloc_align(&qe_muram_info, size, align, "QE"); 306 start = rh_alloc_align(&qe_muram_info, size, align, "QE");
308 spin_unlock_irqrestore(&qe_muram_lock, flags); 307 spin_unlock_irqrestore(&qe_muram_lock, flags);
309 308
310 return (u32) start; 309 return start;
311} 310}
312EXPORT_SYMBOL(qe_muram_alloc); 311EXPORT_SYMBOL(qe_muram_alloc);
313 312
314int qe_muram_free(u32 offset) 313int qe_muram_free(unsigned long offset)
315{ 314{
316 int ret; 315 int ret;
317 unsigned long flags; 316 unsigned long flags;
318 317
319 spin_lock_irqsave(&qe_muram_lock, flags); 318 spin_lock_irqsave(&qe_muram_lock, flags);
320 ret = rh_free(&qe_muram_info, (void *)offset); 319 ret = rh_free(&qe_muram_info, offset);
321 spin_unlock_irqrestore(&qe_muram_lock, flags); 320 spin_unlock_irqrestore(&qe_muram_lock, flags);
322 321
323 return ret; 322 return ret;
@@ -325,16 +324,16 @@ int qe_muram_free(u32 offset)
325EXPORT_SYMBOL(qe_muram_free); 324EXPORT_SYMBOL(qe_muram_free);
326 325
327/* not sure if this is ever needed */ 326/* not sure if this is ever needed */
328u32 qe_muram_alloc_fixed(u32 offset, u32 size) 327unsigned long qe_muram_alloc_fixed(unsigned long offset, int size)
329{ 328{
330 void *start; 329 unsigned long start;
331 unsigned long flags; 330 unsigned long flags;
332 331
333 spin_lock_irqsave(&qe_muram_lock, flags); 332 spin_lock_irqsave(&qe_muram_lock, flags);
334 start = rh_alloc_fixed(&qe_muram_info, (void *)offset, size, "commproc"); 333 start = rh_alloc_fixed(&qe_muram_info, offset, size, "commproc");
335 spin_unlock_irqrestore(&qe_muram_lock, flags); 334 spin_unlock_irqrestore(&qe_muram_lock, flags);
336 335
337 return (u32) start; 336 return start;
338} 337}
339EXPORT_SYMBOL(qe_muram_alloc_fixed); 338EXPORT_SYMBOL(qe_muram_alloc_fixed);
340 339
@@ -344,7 +343,7 @@ void qe_muram_dump(void)
344} 343}
345EXPORT_SYMBOL(qe_muram_dump); 344EXPORT_SYMBOL(qe_muram_dump);
346 345
347void *qe_muram_addr(u32 offset) 346void *qe_muram_addr(unsigned long offset)
348{ 347{
349 return (void *)&qe_immr->muram[offset]; 348 return (void *)&qe_immr->muram[offset];
350} 349}