summaryrefslogtreecommitdiff
path: root/drivers/dma
diff options
context:
space:
mode:
authorguoyin.chen <guoyin.chen@freescale.com>2013-08-12 13:12:19 +0800
committerguoyin.chen <guoyin.chen@freescale.com>2013-08-12 13:12:19 +0800
commiteaa67b8feb7d97821fd08749430392eba2900091 (patch)
treefa91e19b64a44da61e0d63b04c61bd92f77dbf38 /drivers/dma
parentf9017b715db9ac5a2ece1216117ee5185eda9f69 (diff)
parent98894af902b374bcbc1769f18662d587c3859304 (diff)
Merge remote-tracking branch 'fsl-linux-sdk/imx_3.0.35_4.1.0' into imx_3.0.35_android
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/imx-sdma.c52
-rw-r--r--drivers/dma/pxp/pxp_dma_v2.c23
2 files changed, 18 insertions, 57 deletions
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index bee75e8c85c5..81434d6af1bb 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -339,34 +339,6 @@ struct sdma_engine {
#define SDMA_H_CONFIG_ACR (1 << 4) /* indicates if AHB freq /core freq = 2 or 1 */
#define SDMA_H_CONFIG_CSM (3) /* indicates which context switch mode is selected*/
-#ifdef CONFIG_SDMA_IRAM
-static unsigned long sdma_iram_paddr;
-static void *sdma_iram_vaddr;
-#define sdma_iram_phys_to_virt(p) (sdma_iram_vaddr + ((p) - sdma_iram_paddr))
-#define sdma_iram_virt_to_phys(v) (sdma_iram_paddr + ((v) - sdma_iram_vaddr))
-static struct gen_pool *sdma_iram_pool;
-
-/*!
- * Allocates uncacheable buffer from IRAM
- */
-void __iomem *sdma_iram_malloc(size_t size, unsigned long *buf)
-{
- *buf = gen_pool_alloc(sdma_iram_pool, size);
- if (!buf)
- return NULL;
-
- return sdma_iram_phys_to_virt(*buf);
-}
-
-void sdma_iram_free(unsigned long buf, size_t size)
-{
- if (!sdma_iram_pool)
- return;
-
- gen_pool_free(sdma_iram_pool, buf, size);
-}
-#endif /*CONFIG_SDMA_IRAM */
-
static inline u32 chnenbl_ofs(struct sdma_engine *sdma, unsigned int event)
{
@@ -449,7 +421,7 @@ static int sdma_load_script(struct sdma_engine *sdma, void *buf, int size,
int ret;
#ifdef CONFIG_SDMA_IRAM
- buf_virt = sdma_iram_malloc(size, (unsigned long *)&buf_phys);
+ buf_virt = iram_alloc(size, (unsigned long *)&buf_phys);
#else
buf_virt = dma_alloc_coherent(NULL,
size,
@@ -472,7 +444,7 @@ static int sdma_load_script(struct sdma_engine *sdma, void *buf, int size,
spin_unlock_irqrestore(&sdma->channel_0_lock, flags);
#ifdef CONFIG_SDMA_IRAM
- sdma_iram_free(buf_phys, size);
+ iram_free(buf_phys, size);
#else
dma_free_coherent(NULL, size, buf_virt, buf_phys);
#endif
@@ -938,8 +910,7 @@ static int sdma_request_channel(struct sdma_channel *sdmac)
int ret = -EBUSY;
#ifdef CONFIG_SDMA_IRAM
- sdmac->bd = sdma_iram_malloc(sizeof(sdmac->bd),
- (unsigned long *)&sdmac->bd_phys);
+ sdmac->bd = iram_alloc(PAGE_SIZE, (unsigned long *)&sdmac->bd_phys);
#else
sdmac->bd = dma_alloc_noncached(NULL, PAGE_SIZE, &sdmac->bd_phys, GFP_KERNEL);
#endif
@@ -1106,7 +1077,7 @@ static void sdma_free_chan_resources(struct dma_chan *chan)
sdma_set_channel_priority(sdmac, 0);
#ifdef CONFIG_SDMA_IRAM
- sdma_iram_free(sdmac->bd_phys, sizeof(sdmac->bd));
+ iram_free(sdmac->bd_phys, PAGE_SIZE);
#else
dma_free_coherent(NULL, PAGE_SIZE, sdmac->bd, sdmac->bd_phys);
#endif
@@ -1494,12 +1465,7 @@ static int __init sdma_init(struct sdma_engine *sdma)
writel_relaxed(0, sdma->regs + SDMA_H_C0PTR);
#ifdef CONFIG_SDMA_IRAM
- /* Allocate memory for SDMA channel and buffer descriptors */
- sdma_iram_vaddr = iram_alloc(SZ_4K, &sdma_iram_paddr);
- sdma_iram_pool = gen_pool_create(PAGE_SHIFT/2, -1);
- gen_pool_add(sdma_iram_pool, sdma_iram_paddr, SZ_4K, -1);
-
- sdma->channel_control = sdma_iram_malloc(MAX_DMA_CHANNELS *
+ sdma->channel_control = iram_alloc(MAX_DMA_CHANNELS *
sizeof(struct sdma_channel_control)
+ sizeof(struct sdma_context_data),
(unsigned long *)&ccb_phys);
@@ -1534,7 +1500,7 @@ static int __init sdma_init(struct sdma_engine *sdma)
ret = sdma_request_channel(&sdma->channel[0]);
if (ret)
- goto err_dma_alloc;
+ goto err_dma_request;
sdma_config_ownership(&sdma->channel[0], false, true, false);
@@ -1557,6 +1523,12 @@ static int __init sdma_init(struct sdma_engine *sdma)
return 0;
+err_dma_request:
+#ifdef CONFIG_SDMA_IRAM
+ iram_free((unsigned long)ccb_phys, MAX_DMA_CHANNELS
+ * sizeof(struct sdma_channel_control)
+ + sizeof(struct sdma_context_data));
+#endif
err_dma_alloc:
clk_disable(sdma->clk);
dev_err(sdma->dev, "initialisation failed with %d\n", ret);
diff --git a/drivers/dma/pxp/pxp_dma_v2.c b/drivers/dma/pxp/pxp_dma_v2.c
index f0b50b7a1c05..7169b44a9bb3 100644
--- a/drivers/dma/pxp/pxp_dma_v2.c
+++ b/drivers/dma/pxp/pxp_dma_v2.c
@@ -800,8 +800,6 @@ static void pxp_clk_enable(struct pxps *pxp)
}
clk_enable(pxp->clk);
- /* Pull PxP out of reset */
- __raw_writel(0, pxp->base + HW_PXP_CTRL);
pxp->clk_stat = CLK_STAT_ON;
mutex_unlock(&pxp->clk_mutex);
@@ -820,13 +818,6 @@ static void pxp_clk_disable(struct pxps *pxp)
spin_lock_irqsave(&pxp->lock, flags);
if ((pxp->pxp_ongoing == 0) && list_empty(&head)) {
- /* Put the PXP into reset as the Display MIX is going
- * to be Power gated.
- */
- while (__raw_readl(pxp->base + HW_PXP_CTRL)
- & BM_PXP_CTRL_ENABLE)
- ;
- __raw_writel(BM_PXP_CTRL_SFTRST, pxp->base + HW_PXP_CTRL);
spin_unlock_irqrestore(&pxp->lock, flags);
clk_disable(pxp->clk);
pxp->clk_stat = CLK_STAT_OFF;
@@ -1636,11 +1627,11 @@ static int pxp_suspend(struct platform_device *pdev, pm_message_t state)
{
struct pxps *pxp = platform_get_drvdata(pdev);
- /* Need to call the enable/disable sequence here to
- * ensure that the PXP is in the right state before the
- * SOC enters suspend state.
- */
pxp_clk_enable(pxp);
+ while (__raw_readl(pxp->base + HW_PXP_CTRL) & BM_PXP_CTRL_ENABLE)
+ ;
+
+ __raw_writel(BM_PXP_CTRL_SFTRST, pxp->base + HW_PXP_CTRL);
pxp_clk_disable(pxp);
return 0;
@@ -1650,11 +1641,9 @@ static int pxp_resume(struct platform_device *pdev)
{
struct pxps *pxp = platform_get_drvdata(pdev);
- /* Need to call the enable/disable sequence here to
- * ensure that the PXP is in the right state after the
- * SOC exits suspend state.
- */
pxp_clk_enable(pxp);
+ /* Pull PxP out of reset */
+ __raw_writel(0, pxp->base + HW_PXP_CTRL);
pxp_clk_disable(pxp);
return 0;