Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6168209imu; Mon, 21 Jan 2019 04:26:06 -0800 (PST) X-Google-Smtp-Source: ALg8bN6+rARQqvNlNoMXmNKyDvJtDK35rrkkk809Ksvb627Z8J4hTnvumH0ZlknkVhDE0e9IOyBZ X-Received: by 2002:a17:902:848d:: with SMTP id c13mr30090468plo.257.1548073566062; Mon, 21 Jan 2019 04:26:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548073566; cv=none; d=google.com; s=arc-20160816; b=ufZKTFKbVVmrCATxbz7d77iX9XycbGPiPenYKnZsSrAUTxL18d+Qi+6tuiEID2x24O Vw2ahzF+WF5t5Y/4//hKqbfB8EH7pS+Pwc+ScbDiecD9XQ6HijYtHdrjrAIqSt1OslTy OCWIAfYv4LQhCXGtYNn3X9y3mMHdzn1JSfIE5UIDXonA8QIdERHcUxg4hBL/6EbVXMbE ooaojk3ZuhpVziVwtL3aOA9ZdJwKiSGOsEfyFGh6NS2Aigqwqvc7s3DRDvFhriiGv3Oh k1t6OUSCKiNwGIDHgVHZbDV4FZ4da8uBlBUBc+f5kzBIYVNMTl6BmNM6AA9ZXySmqnEr P4Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=R3cLMC3AE7r6m0DIaIGRgluC1+sgP3pjDwbSt5+MNOs=; b=U903GhXKZ3koj+MY5RvLoFLz06g9g2GX/UiRHq9U2XEJ4Ue4xm/4LEELVYYH2/0Yzg 9Nk/a/cWnHnDX3hIIHeGiyPZgf/2UkkJEeALxET4zgg2CNTr8X3HfubR4U77UUAwfGpI 0iqUKEI7ZzGlTr2ehkNcgJa9KbSobMlyycOiV37i7F/o1l7vvyfJtfa5jffwtd4qzXcL AehPRpzpNfB3OB5yQ6TDXSggSPIy+mHPdKRn4JK5JR6h7uJMRWu+9IA+KK8PHKYTgp7L HhusRXNSCKrUAafVmTstwcNpZKm5G4cCpkLlfdOnddfc8AicwVlqDCxZF8R8bg95q1h2 6dRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v6si12850879pgv.277.2019.01.21.04.25.42; Mon, 21 Jan 2019 04:26:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728734AbfAUMXd (ORCPT + 99 others); Mon, 21 Jan 2019 07:23:33 -0500 Received: from mailgw02.mediatek.com ([1.203.163.81]:9135 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728357AbfAUMW5 (ORCPT ); Mon, 21 Jan 2019 07:22:57 -0500 X-UUID: 6850877b3f1947e788d5353772bdabf4-20190121 X-UUID: 6850877b3f1947e788d5353772bdabf4-20190121 Received: from mtkcas36.mediatek.inc [(172.27.4.250)] by mailgw02.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 1238450024; Mon, 21 Jan 2019 20:22:50 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by MTKMBS31DR.mediatek.inc (172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 21 Jan 2019 20:22:48 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 21 Jan 2019 20:22:47 +0800 From: To: Bin Liu , Rob Herring CC: Greg Kroah-Hartman , Mark Rutland , Matthias Brugger , Alan Stern , , , , , , , , , Min Guo Subject: [PATCH v4 4/6] usb: musb: Add noirq type of dma create interface Date: Mon, 21 Jan 2019 20:22:29 +0800 Message-ID: <1548073351-13739-5-git-send-email-min.guo@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1548073351-13739-1-git-send-email-min.guo@mediatek.com> References: <1548073351-13739-1-git-send-email-min.guo@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Min Guo Add noirq type of dma create interface for platform which do not have dedicated DMA interrupt line, move musbhsdma macro definition to musb_dma.h Signed-off-by: Min Guo --- new patch based on v3: --- drivers/usb/musb/musb_dma.h | 9 ++++++++ drivers/usb/musb/musbhsdma.c | 54 ++++++++++++++++++++++++++++++-------------- 2 files changed, 46 insertions(+), 17 deletions(-) diff --git a/drivers/usb/musb/musb_dma.h b/drivers/usb/musb/musb_dma.h index 8f60271..05103ea 100644 --- a/drivers/usb/musb/musb_dma.h +++ b/drivers/usb/musb/musb_dma.h @@ -35,6 +35,12 @@ * whether shared with the Inventra core or separate. */ +#define MUSB_HSDMA_BASE 0x200 +#define MUSB_HSDMA_INTR (MUSB_HSDMA_BASE + 0) +#define MUSB_HSDMA_CONTROL 0x4 +#define MUSB_HSDMA_ADDRESS 0x8 +#define MUSB_HSDMA_COUNT 0xc + #define DMA_ADDR_INVALID (~(dma_addr_t)0) #ifdef CONFIG_MUSB_PIO_ONLY @@ -191,6 +197,9 @@ static inline void musb_dma_controller_destroy(struct dma_controller *d) { } extern struct dma_controller * musbhs_dma_controller_create(struct musb *musb, void __iomem *base); extern void musbhs_dma_controller_destroy(struct dma_controller *c); +extern struct dma_controller * +musbhs_dma_controller_create_noirq(struct musb *musb, void __iomem *base); +extern irqreturn_t dma_controller_irq(int irq, void *private_data); extern struct dma_controller * tusb_dma_controller_create(struct musb *musb, void __iomem *base); diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c index a688f7f..b2394a7 100644 --- a/drivers/usb/musb/musbhsdma.c +++ b/drivers/usb/musb/musbhsdma.c @@ -10,12 +10,7 @@ #include #include #include "musb_core.h" - -#define MUSB_HSDMA_BASE 0x200 -#define MUSB_HSDMA_INTR (MUSB_HSDMA_BASE + 0) -#define MUSB_HSDMA_CONTROL 0x4 -#define MUSB_HSDMA_ADDRESS 0x8 -#define MUSB_HSDMA_COUNT 0xc +#include "musb_dma.h" #define MUSB_HSDMA_CHANNEL_OFFSET(_bchannel, _offset) \ (MUSB_HSDMA_BASE + (_bchannel << 4) + _offset) @@ -268,7 +263,7 @@ static int dma_channel_abort(struct dma_channel *channel) return 0; } -static irqreturn_t dma_controller_irq(int irq, void *private_data) +irqreturn_t dma_controller_irq(int irq, void *private_data) { struct musb_dma_controller *controller = private_data; struct musb *musb = controller->private_data; @@ -382,6 +377,7 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data) spin_unlock_irqrestore(&musb->lock, flags); return retval; } +EXPORT_SYMBOL_GPL(dma_controller_irq); void musbhs_dma_controller_destroy(struct dma_controller *c) { @@ -397,18 +393,10 @@ void musbhs_dma_controller_destroy(struct dma_controller *c) } EXPORT_SYMBOL_GPL(musbhs_dma_controller_destroy); -struct dma_controller *musbhs_dma_controller_create(struct musb *musb, - void __iomem *base) +static struct musb_dma_controller * +dma_controller_alloc(struct musb *musb, void __iomem *base) { struct musb_dma_controller *controller; - struct device *dev = musb->controller; - struct platform_device *pdev = to_platform_device(dev); - int irq = platform_get_irq_byname(pdev, "dma"); - - if (irq <= 0) { - dev_err(dev, "No DMA interrupt line!\n"); - return NULL; - } controller = kzalloc(sizeof(*controller), GFP_KERNEL); if (!controller) @@ -422,6 +410,25 @@ struct dma_controller *musbhs_dma_controller_create(struct musb *musb, controller->controller.channel_release = dma_channel_release; controller->controller.channel_program = dma_channel_program; controller->controller.channel_abort = dma_channel_abort; + return controller; +} + +struct dma_controller * +musbhs_dma_controller_create(struct musb *musb, void __iomem *base) +{ + struct musb_dma_controller *controller; + struct device *dev = musb->controller; + struct platform_device *pdev = to_platform_device(dev); + int irq = platform_get_irq_byname(pdev, "dma"); + + if (irq <= 0) { + dev_err(dev, "No DMA interrupt line!\n"); + return NULL; + } + + controller = dma_controller_alloc(musb, base); + if (!controller) + return NULL; if (request_irq(irq, dma_controller_irq, 0, dev_name(musb->controller), &controller->controller)) { @@ -436,3 +443,16 @@ struct dma_controller *musbhs_dma_controller_create(struct musb *musb, return &controller->controller; } EXPORT_SYMBOL_GPL(musbhs_dma_controller_create); + +struct dma_controller * +musbhs_dma_controller_create_noirq(struct musb *musb, void __iomem *base) +{ + struct musb_dma_controller *controller; + + controller = dma_controller_alloc(musb, base); + if (!controller) + return NULL; + + return &controller->controller; +} +EXPORT_SYMBOL_GPL(musbhs_dma_controller_create_noirq); -- 1.9.1