Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: tidspbridge: ioremap dsp sync addr

Change the type of sync_addr to 'void __iomem *' and ioremap the
physical address in the shared memory so we can access it using
_raw_*. While at it, drop 'dw_' prefix.

Fix the warning associated with dsp's sync_addr:

warning: passing argument 2 of '__raw_writel' makes pointer from integer without a cast
../io.h:88: note: expected 'volatile void *' but argument is of type 'u32'

Signed-off-by: Omar Ramirez Luna <omar.ramirez@copitl.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Omar Ramirez Luna and committed by
Greg Kroah-Hartman
7de8a0cf 3c867696

+26 -11
+26 -11
drivers/staging/tidspbridge/core/tiomap3430.c
··· 126 126 u32 ul_num_bytes, 127 127 struct hw_mmu_map_attrs_t *hw_attrs); 128 128 129 - bool wait_for_start(struct bridge_dev_context *dev_context, u32 dw_sync_addr); 129 + bool wait_for_start(struct bridge_dev_context *dev_context, 130 + void __iomem *sync_addr); 130 131 131 132 /* ----------------------------------- Globals */ 132 133 ··· 364 363 { 365 364 int status = 0; 366 365 struct bridge_dev_context *dev_context = dev_ctxt; 367 - u32 dw_sync_addr = 0; 366 + void __iomem *sync_addr; 368 367 u32 ul_shm_base; /* Gpp Phys SM base addr(byte) */ 369 368 u32 ul_shm_base_virt; /* Dsp Virt SM base addr */ 370 369 u32 ul_tlb_base_virt; /* Base of MMU TLB entry */ 370 + u32 shm_sync_pa; 371 371 /* Offset of shm_base_virt from tlb_base_virt */ 372 372 u32 ul_shm_offset_virt; 373 373 s32 entry_ndx; ··· 399 397 /* Kernel logical address */ 400 398 ul_shm_base = dev_context->atlb_entry[0].gpp_va + ul_shm_offset_virt; 401 399 400 + /* SHM physical sync address */ 401 + shm_sync_pa = dev_context->atlb_entry[0].gpp_pa + ul_shm_offset_virt + 402 + SHMSYNCOFFSET; 403 + 402 404 /* 2nd wd is used as sync field */ 403 - dw_sync_addr = ul_shm_base + SHMSYNCOFFSET; 405 + sync_addr = ioremap(shm_sync_pa, SZ_32); 406 + if (!sync_addr) 407 + return -ENOMEM; 408 + 404 409 /* Write a signature into the shm base + offset; this will 405 410 * get cleared when the DSP program starts. */ 406 411 if ((ul_shm_base_virt == 0) || (ul_shm_base == 0)) { 407 412 pr_err("%s: Illegal SM base\n", __func__); 408 413 status = -EPERM; 409 414 } else 410 - __raw_writel(0xffffffff, dw_sync_addr); 415 + __raw_writel(0xffffffff, sync_addr); 411 416 412 417 if (!status) { 413 418 resources = dev_context->resources; ··· 428 419 * function is made available. 429 420 */ 430 421 void __iomem *ctrl = ioremap(0x48002000, SZ_4K); 431 - if (!ctrl) 422 + if (!ctrl) { 423 + iounmap(sync_addr); 432 424 return -ENOMEM; 425 + } 433 426 434 427 (*pdata->dsp_prm_rmw_bits)(OMAP3430_RST1_IVA2_MASK, 435 428 OMAP3430_RST1_IVA2_MASK, OMAP3430_IVA2_MOD, ··· 599 588 (*pdata->dsp_prm_rmw_bits)(OMAP3430_RST1_IVA2_MASK, 0, 600 589 OMAP3430_IVA2_MOD, OMAP2_RM_RSTCTRL); 601 590 602 - dev_dbg(bridge, "Waiting for Sync @ 0x%x\n", dw_sync_addr); 591 + dev_dbg(bridge, "Waiting for Sync @ 0x%x\n", *(u32 *)sync_addr); 603 592 dev_dbg(bridge, "DSP c_int00 Address = 0x%x\n", dsp_addr); 604 593 if (dsp_debug) 605 - while (__raw_readw(dw_sync_addr)) 594 + while (__raw_readw(sync_addr)) 606 595 ; 607 596 608 597 /* Wait for DSP to clear word in shared memory */ 609 598 /* Read the Location */ 610 - if (!wait_for_start(dev_context, dw_sync_addr)) 599 + if (!wait_for_start(dev_context, sync_addr)) 611 600 status = -ETIMEDOUT; 612 601 613 602 dev_get_symbol(dev_context->dev_obj, "_WDT_enable", &wdt_en); ··· 623 612 /* Write the synchronization bit to indicate the 624 613 * completion of OPP table update to DSP 625 614 */ 626 - __raw_writel(0XCAFECAFE, dw_sync_addr); 615 + __raw_writel(0XCAFECAFE, sync_addr); 627 616 628 617 /* update board state */ 629 618 dev_context->brd_state = BRD_RUNNING; ··· 632 621 dev_context->brd_state = BRD_UNKNOWN; 633 622 } 634 623 } 624 + 625 + iounmap(sync_addr); 626 + 635 627 return status; 636 628 } 637 629 ··· 1810 1796 * ======== wait_for_start ======== 1811 1797 * Wait for the singal from DSP that it has started, or time out. 1812 1798 */ 1813 - bool wait_for_start(struct bridge_dev_context *dev_context, u32 dw_sync_addr) 1799 + bool wait_for_start(struct bridge_dev_context *dev_context, 1800 + void __iomem *sync_addr) 1814 1801 { 1815 1802 u16 timeout = TIHELEN_ACKTIMEOUT; 1816 1803 1817 1804 /* Wait for response from board */ 1818 - while (__raw_readw(dw_sync_addr) && --timeout) 1805 + while (__raw_readw(sync_addr) && --timeout) 1819 1806 udelay(10); 1820 1807 1821 1808 /* If timed out: return false */