From patchwork Tue Dec 3 10:43:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qiao Zhou X-Patchwork-Id: 3275281 X-Patchwork-Delegate: dan.j.williams@gmail.com Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 99439C0D4A for ; Tue, 3 Dec 2013 10:44:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 45F9320304 for ; Tue, 3 Dec 2013 10:44:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DB35F202FF for ; Tue, 3 Dec 2013 10:44:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752575Ab3LCKoU (ORCPT ); Tue, 3 Dec 2013 05:44:20 -0500 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:11931 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752468Ab3LCKoT (ORCPT ); Tue, 3 Dec 2013 05:44:19 -0500 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.14.5/8.14.5) with SMTP id rB3Ahc6F015243; Tue, 3 Dec 2013 02:43:38 -0800 Received: from sc-owa02.marvell.com ([199.233.58.137]) by mx0b-0016f401.pphosted.com with ESMTP id 1gh7xyh2m9-434 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT); Tue, 03 Dec 2013 02:43:37 -0800 Received: from maili.marvell.com (10.93.76.43) by sc-owa02.marvell.com (10.93.76.22) with Microsoft SMTP Server id 8.3.327.1; Tue, 3 Dec 2013 02:43:23 -0800 Received: from [10.38.36.144] (unknown [10.38.36.144]) by maili.marvell.com (Postfix) with ESMTP id 7704A1CCDC1; Tue, 3 Dec 2013 02:43:21 -0800 (PST) Message-ID: <529DB5C8.1010500@marvell.com> Date: Tue, 3 Dec 2013 18:43:20 +0800 From: Qiao Zhou User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130330 Thunderbird/17.0.5 MIME-Version: 1.0 To: Haojian Zhuang CC: Zhangfei Gao , Dan Williams , Leo Yan , "dmaengine@vger.kernel.org" , Vinod Koul , "linux-arm-kernel@lists.infradead.org" , Chao Xie Subject: Re: Build warning in drivers/dma/mmp_tdma.c References: <529C37F3.1040205@marvell.com> <529D4273.10602@gmail.com> In-Reply-To: <529D4273.10602@gmail.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.11.72, 1.0.14, 0.0.0000 definitions=2013-12-03_04:2013-12-03, 2013-12-03, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1305240000 definitions=main-1312030022 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 12/03/2013 10:31 AM, Haojian Zhuang wrote: > I prefer to add CONFIG_MMP_SRAM instead, since sram isn't available in > pxa168. Hi Dan, I have two patches. Could you help check whether it can fix the issue? BTW, actually the 2nd alone is enough. The 1st patch is just in case that you still want to use the old sram driver, and you need to enable MMP_SRAM. All, please help review the patches. From 94601015d525db6d2baf47f4d517f38ae2e5e802 Mon Sep 17 00:00:00 2001 From: Qiao Zhou Date: Tue, 3 Dec 2013 11:06:29 +0800 Subject: [PATCH 1/2] arm: mmp: build sram driver alone sram driver can be used by many chips besides CPU_MMP2, and so build it alone. Signed-off-by: Qiao Zhou Acked-by: Zhangfei Gao --- arch/arm/mach-mmp/Makefile | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) size); @@ -346,7 +347,7 @@ struct mmp_tdma_desc *mmp_tdma_alloc_descriptor(struct mmp_tdma_chan *tdmac) struct gen_pool *gpool; int size = tdmac->desc_num * sizeof(struct mmp_tdma_desc); - gpool = sram_get_gpool("asram"); + gpool = tdmac->pool; if (!gpool) return NULL; @@ -477,7 +478,8 @@ static int mmp_tdma_remove(struct platform_device *pdev) } static int mmp_tdma_chan_init(struct mmp_tdma_device *tdev, - int idx, int irq, int type) + int idx, int irq, + int type, struct gen_pool *pool) { struct mmp_tdma_chan *tdmac; @@ -498,6 +500,7 @@ static int mmp_tdma_chan_init(struct mmp_tdma_device *tdev, tdmac->chan.device = &tdev->device; tdmac->idx = idx; tdmac->type = type; + tdmac->pool = pool; tdmac->reg_base = (unsigned long)tdev->base + idx * 4; tdmac->status = DMA_SUCCESS; tdev->tdmac[tdmac->idx] = tdmac; @@ -525,6 +528,8 @@ static int mmp_tdma_probe(struct platform_device *pdev) int i, ret; int irq = 0, irq_num = 0; int chan_num = TDMA_CHANNEL_NUM; + struct device_node *np = pdev->dev.of_node; + struct gen_pool *pool; of_id = of_match_device(mmp_tdma_dt_ids, &pdev->dev); if (of_id) @@ -551,6 +556,13 @@ static int mmp_tdma_probe(struct platform_device *pdev) INIT_LIST_HEAD(&tdev->device.channels); + /* Get audio sram from device tree or platform data */ + pool = of_get_named_gen_pool(np, "asram", 0); + if (!pool) { + dev_err(&pdev->dev, "asram pool not available\n"); + return -ENOMEM; + } + if (irq_num != chan_num) { irq = platform_get_irq(pdev, 0); ret = devm_request_irq(&pdev->dev, irq, @@ -562,7 +574,7 @@ static int mmp_tdma_probe(struct platform_device *pdev) /* initialize channel parameters */ for (i = 0; i < chan_num; i++) { irq = (irq_num != chan_num) ? 0 : platform_get_irq(pdev, i); - ret = mmp_tdma_chan_init(tdev, i, irq, type); + ret = mmp_tdma_chan_init(tdev, i, irq, type, pool); if (ret) return ret; } diff --git a/arch/arm/mach-mmp/Makefile b/arch/arm/mach-mmp/Makefile index 9b702a1..98f0f63 100644 --- a/arch/arm/mach-mmp/Makefile +++ b/arch/arm/mach-mmp/Makefile @@ -7,7 +7,8 @@ obj-y += common.o devices.o time.o # SoC support obj-$(CONFIG_CPU_PXA168) += pxa168.o obj-$(CONFIG_CPU_PXA910) += pxa910.o -obj-$(CONFIG_CPU_MMP2) += mmp2.o sram.o +obj-$(CONFIG_CPU_MMP2) += mmp2.o +obj-$(CONFIG_MMP_SRAM) += sram.o ifeq ($(CONFIG_COMMON_CLK), ) obj-y += clock.o -- 1.7.0.4 From 5396b1bffd574dbe778387979ecc24c51ee0c7a4 Mon Sep 17 00:00:00 2001 From: Qiao Zhou Date: Tue, 3 Dec 2013 18:17:02 +0800 Subject: [PATCH 2/2] dma: mmp-tdma: use gen_pool to get asram use generic pool to get audio sram, instead of sram driver Signed-off-by: nhcao Signed-off-by: Qiao Zhou --- drivers/dma/Kconfig | 1 + drivers/dma/mmp_tdma.c | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index dd2874e..eeffe3c 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -288,6 +288,7 @@ config MMP_TDMA bool "MMP Two-Channel DMA support" depends on ARCH_MMP select DMA_ENGINE + select GENERIC_ALLOCATOR help Support the MMP Two-Channel DMA engine. This engine used for MMP Audio DMA and pxa910 SQU. diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c index d3b6358..93537d1 100644 --- a/drivers/dma/mmp_tdma.c +++ b/drivers/dma/mmp_tdma.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include "dmaengine.h" @@ -121,6 +121,7 @@ struct mmp_tdma_chan { size_t buf_len; size_t period_len; size_t pos; + struct gen_pool *pool; }; #define TDMA_CHANNEL_NUM 2 @@ -296,7 +297,7 @@ static void mmp_tdma_free_descriptor(struct mmp_tdma_chan *tdmac) struct gen_pool *gpool; int size = tdmac->desc_num * sizeof(struct mmp_tdma_desc); - gpool = sram_get_gpool("asram"); + gpool = tdmac->pool; if (tdmac->desc_arr) gen_pool_free(gpool, (unsigned long)tdmac->desc_arr,