From patchwork Thu Jan 22 08:34:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 5682831 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9FF40C058D for ; Thu, 22 Jan 2015 08:34:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B69D22034C for ; Thu, 22 Jan 2015 08:34:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AC4712035B for ; Thu, 22 Jan 2015 08:34:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751494AbbAVIeJ (ORCPT ); Thu, 22 Jan 2015 03:34:09 -0500 Received: from relmlor4.renesas.com ([210.160.252.174]:28987 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751427AbbAVIeI (ORCPT ); Thu, 22 Jan 2015 03:34:08 -0500 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie3.idc.renesas.com with ESMTP; 22 Jan 2015 17:34:05 +0900 Received: from relmlac2.idc.renesas.com (relmlac2.idc.renesas.com [10.200.69.22]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id D067F4CB24; Thu, 22 Jan 2015 17:34:05 +0900 (JST) Received: by relmlac2.idc.renesas.com (Postfix, from userid 0) id C19262806E; Thu, 22 Jan 2015 17:34:05 +0900 (JST) Received: from relmlac2.idc.renesas.com (localhost [127.0.0.1]) by relmlac2.idc.renesas.com (Postfix) with ESMTP id BB59F2806D; Thu, 22 Jan 2015 17:34:05 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac2.idc.renesas.com with ESMTP id TAZ09511; Thu, 22 Jan 2015 17:34:05 +0900 X-IronPort-AV: E=Sophos;i="5.09,447,1418050800"; d="scan'208";a="178234115" Received: from mail-hk1lp0126.outbound.protection.outlook.com (HELO APAC01-HK1-obe.outbound.protection.outlook.com) ([207.46.51.126]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 22 Jan 2015 17:34:04 +0900 Received: from remon.renesas.com (211.11.155.132) by SINPR06MB171.apcprd06.prod.outlook.com (10.242.57.18) with Microsoft SMTP Server (TLS) id 15.1.59.20; Thu, 22 Jan 2015 08:34:03 +0000 Message-ID: <87a91bkyc3.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 1/5 v6] dmaengine: shdma-base: enable to be non multiplexed DMAEngine driver User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") To: Vinod Koul , Arnd Bergmann , Simon CC: , Rob Herring , Linux-SH , Laurent In-Reply-To: <87bnlrkydd.wl%kuninori.morimoto.gx@renesas.com> References: <8761ekokpf.wl%kuninori.morimoto.gx@renesas.com> <87oaqat5b9.wl%kuninori.morimoto.gx@renesas.com> <87bnlrkydd.wl%kuninori.morimoto.gx@renesas.com> Date: Thu, 22 Jan 2015 08:34:03 +0000 X-Originating-IP: [211.11.155.132] X-ClientProxiedBy: SINPR01CA0024.apcprd01.prod.exchangelabs.com (10.141.109.24) To SINPR06MB171.apcprd06.prod.outlook.com (10.242.57.18) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; X-DmarcAction-Test: None X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(3005004);SRVR:SINPR06MB171; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004); SRVR:SINPR06MB171; X-Forefront-PRVS: 0464DBBBC4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(189002)(199003)(54356999)(76176999)(47776003)(64706001)(86362001)(87976001)(50466002)(97736003)(50986999)(66066001)(19580405001)(92566002)(19580395003)(83506001)(46406003)(69596002)(42186005)(229853001)(77096005)(53416004)(2950100001)(40100003)(33646002)(122386002)(101416001)(23726002)(77156002)(68736005)(36756003)(46102003)(62966003)(106356001)(81156004)(105586002); DIR:OUT; SFP:1102; SCL:1; SRVR:SINPR06MB171; H:remon.renesas.com; FPR:; SPF:None; MLV:sfv; PTR:InfoNoRecords; MX:1; A:1; LANG:en; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:SINPR06MB171; X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2015 08:34:03.1306 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SINPR06MB171 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 From: Arnd Bergmann Current shdma-base driver which was created originally for R-Mobile series is assuming that it is working as multiplexed DMAEngine. But, current Renesas SoC (= R-Car series) also uses non-multiplexed DMAEngine driver (= rcar-dmac). This case, shdma-base and rcar-dmac will have same ID on each drivers. Then, dma_request_slave_channel_compat() will call __dma_request_channel(), and, shdma driver might return channel which was requested as rcar-dma channel if 1) there are rcar-dmac driver user and shdma-base driver user in system 2) user driver requests rcar-dmac side channel 3) system compiles shdma-base driver only 4) user driver uses dma_request_slave_channel_compat() 5) user driver uses shdma_chan_filter in dma_request_slave_channel_compat() This patch adds shdma_dev :: multiplexed as short term bugfix. rcar-audmapp will be trouble without this patch. Signed-off-by: Arnd Bergmann Signed-off-by: Kuninori Morimoto --- drivers/dma/sh/rcar-hpbdma.c | 1 + drivers/dma/sh/shdma-base.c | 11 +++++++++++ drivers/dma/sh/shdmac.c | 1 + include/linux/shdma-base.h | 1 + 4 files changed, 14 insertions(+) diff --git a/drivers/dma/sh/rcar-hpbdma.c b/drivers/dma/sh/rcar-hpbdma.c index 6fef1b9..dd171e5 100644 --- a/drivers/dma/sh/rcar-hpbdma.c +++ b/drivers/dma/sh/rcar-hpbdma.c @@ -602,6 +602,7 @@ static int hpb_dmae_probe(struct platform_device *pdev) dma_dev->directions = BIT(DMA_MEM_TO_DEV) | BIT(DMA_DEV_TO_MEM); dma_dev->residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; + hpbdev->shdma_dev.multiplexed = true; hpbdev->shdma_dev.ops = &hpb_dmae_ops; hpbdev->shdma_dev.desc_size = sizeof(struct hpb_desc); err = shdma_init(&pdev->dev, &hpbdev->shdma_dev, pdata->num_channels); diff --git a/drivers/dma/sh/shdma-base.c b/drivers/dma/sh/shdma-base.c index 8ee383d..359eaa6 100644 --- a/drivers/dma/sh/shdma-base.c +++ b/drivers/dma/sh/shdma-base.c @@ -293,6 +293,17 @@ bool shdma_chan_filter(struct dma_chan *chan, void *arg) return false; sdev = to_shdma_dev(schan->dma_chan.device); + + /* + * FIXME: this is short term bug fix + * dma_request_slave_channel_compat() will call + * __dma_request_channel() (ex DT case) + * sdhma / shdma_chan_filter doesn't have compatibility + * with non multiplexed DMAC (ex rcar-dmac) + */ + if (!sdev->multiplexed) + return false; + ret = sdev->ops->set_slave(schan, match, 0, true); if (ret < 0) return false; diff --git a/drivers/dma/sh/shdmac.c b/drivers/dma/sh/shdmac.c index aec8a84..d7b6ef8 100644 --- a/drivers/dma/sh/shdmac.c +++ b/drivers/dma/sh/shdmac.c @@ -754,6 +754,7 @@ static int sh_dmae_probe(struct platform_device *pdev) /* Default transfer size of 32 bytes requires 32-byte alignment */ dma_dev->copy_align = LOG2_DEFAULT_XFER_SIZE; + shdev->shdma_dev.multiplexed = true; shdev->shdma_dev.ops = &sh_dmae_shdma_ops; shdev->shdma_dev.desc_size = sizeof(struct sh_dmae_desc); err = shdma_init(&pdev->dev, &shdev->shdma_dev, diff --git a/include/linux/shdma-base.h b/include/linux/shdma-base.h index abdf1f2..9a9319d 100644 --- a/include/linux/shdma-base.h +++ b/include/linux/shdma-base.h @@ -110,6 +110,7 @@ struct shdma_dev { struct shdma_chan **schan; const struct shdma_ops *ops; size_t desc_size; + bool multiplexed; }; #define shdma_for_each_chan(c, d, i) for (i = 0, c = (d)->schan[0]; \