From patchwork Wed Feb 15 14:26:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 9574201 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A308C60209 for ; Wed, 15 Feb 2017 14:27:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96F6A27D4D for ; Wed, 15 Feb 2017 14:27:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B7ED27E5A; Wed, 15 Feb 2017 14:27:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E4A627D4D for ; Wed, 15 Feb 2017 14:27:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751451AbdBOO1G (ORCPT ); Wed, 15 Feb 2017 09:27:06 -0500 Received: from mail-wr0-f175.google.com ([209.85.128.175]:34297 "EHLO mail-wr0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751108AbdBOO1F (ORCPT ); Wed, 15 Feb 2017 09:27:05 -0500 Received: by mail-wr0-f175.google.com with SMTP id z61so4244724wrc.1 for ; Wed, 15 Feb 2017 06:27:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Oymls6j1FITylisXMerit23RQp2yEYoL+1zj7S1fE3E=; b=a5ZX3/3XB/BOwGVsqoQpBCly2oJnSZ0Rgz6BpxZV8Ig9NRAIAKHk2gHLyVVQK7ZLL4 rqCzMGKawu+ZeNqzPphfua3wFS0o6/LoaR4IU/sdIWhTEKr+mMXSieeXiVMXr28rdK4H wNn0S25Q9C/fQe9GWJAssYc6fES8vNNOgX9X3PjScWhTWeXc89snOODSQ+eD/gFbbNAi ZUjzeStdFenRwjcTiZIHIds1thLcSXN2BPyN9xL/BUt7uig+fzUHH/eQN0YAP3aqhAyh veUzQZdD64O+4ft6jCShsKhpRxQOuaxhxiNDnQtSpURgQZu0gCTHLiPU/UfsMtb/Xftu kyuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Oymls6j1FITylisXMerit23RQp2yEYoL+1zj7S1fE3E=; b=DkbJ/+VEzzP91VH1m6I0ZcJYPfE1PpXFof4R/+oN5FLnCsoiITjnahw8Cm2tfpL/TP U7KSEpO1+tRPWgDYWAPy/NL28uMTKejeWIju+deF3o+3OeW791+TrUcg71PKvRh4V0Rg 5OiChdHmXkE8NcWDuWUEeeI54uKieuCWAa59lbllNGgO0ZU51U/AaLCam70TpPVhPB9K PY0LDH9lDSd4jZ6eBOJgqAsHANPh2k36JSNVHtW9SSCD+rqXFUqQ0KxE/q+fMa6gan8N 5FVCwwPpK+eE0CLnFj9QtfmKW4HyYJ7zFiES/zOjxaWShLZVu16ov7ck+37ATF909EtR WmsQ== X-Gm-Message-State: AMke39nWWlVVWCJ7LrZm9h13kmX/FaIX2E7+5cKicHUdF1dV1XD1UDr9YXzPmzxim00HGqwP X-Received: by 10.223.141.148 with SMTP id o20mr4660032wrb.191.1487168823828; Wed, 15 Feb 2017 06:27:03 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id z90sm5127419wrc.24.2017.02.15.06.27.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Feb 2017 06:27:03 -0800 (PST) From: Alexandre Bailon To: b-liu@ti.com Cc: nsekhar@ti.com, khilman@baylibre.com, ptitiano@baylibre.com, tony@atomide.com, linux-omap@vger.kernel.org, sergei.shtylyov@cogentembedded.com, linux-usb@vger.kernel.org, Alexandre Bailon Subject: [PATCH v6 2/4] usb: musb: Add support of CPPI 4.1 DMA controller to DA8xx Date: Wed, 15 Feb 2017 15:26:55 +0100 Message-Id: <20170215142657.31571-3-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170215142657.31571-1-abailon@baylibre.com> References: <20170215142657.31571-1-abailon@baylibre.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, only the PIO mode is supported. This add support of CPPI 4.1 to DA8xx. As the In DA8xx the CPPI 4.1 DMA is a part of the USB. Create the CPPI 4.1 device as a child of USB. Signed-off-by: Alexandre Bailon --- drivers/usb/musb/Kconfig | 4 ++-- drivers/usb/musb/da8xx.c | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 72a2a50..5506a9c 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig @@ -160,8 +160,8 @@ config USB_TI_CPPI_DMA Enable DMA transfers when TI CPPI DMA is available. config USB_TI_CPPI41_DMA - bool 'TI CPPI 4.1 (AM335x)' - depends on ARCH_OMAP && DMADEVICES + bool 'TI CPPI 4.1' + depends on (ARCH_OMAP || ARCH_DAVINCI_DA8XX) && DMADEVICES select TI_CPPI41 config USB_TUSB_OMAP_DMA diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index d79c288..458a499 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -456,12 +457,41 @@ static inline u8 get_vbus_power(struct device *dev) return current_uA / 1000 / 2; } +#ifdef CONFIG_USB_TI_CPPI41_DMA +static void da8xx_dma_controller_callback(struct dma_controller *c) +{ + struct musb *musb = c->musb; + void __iomem *reg_base = musb->ctrl_base; + + musb_writel(reg_base, DA8XX_USB_END_OF_INTR_REG, 0); +} + +static struct dma_controller * +da8xx_dma_controller_create(struct musb *musb, void __iomem *base) +{ + struct dma_controller *controller; + + controller = cppi41_dma_controller_create(musb, base); + if (IS_ERR_OR_NULL(controller)) + return controller; + + controller->dma_callback = da8xx_dma_controller_callback; + + return controller; +} +#endif + static const struct musb_platform_ops da8xx_ops = { - .quirks = MUSB_INDEXED_EP | MUSB_PRESERVE_SESSION, + .quirks = MUSB_INDEXED_EP | MUSB_PRESERVE_SESSION | + MUSB_DMA_CPPI41, .init = da8xx_musb_init, .exit = da8xx_musb_exit, .fifo_mode = 2, +#ifdef CONFIG_USB_TI_CPPI41_DMA + .dma_init = da8xx_dma_controller_create, + .dma_exit = cppi41_dma_controller_destroy, +#endif .enable = da8xx_musb_enable, .disable = da8xx_musb_disable, @@ -533,6 +563,10 @@ static int da8xx_probe(struct platform_device *pdev) } platform_set_drvdata(pdev, glue); + ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); + if (ret) + return ret; + memset(musb_resources, 0x00, sizeof(*musb_resources) * ARRAY_SIZE(musb_resources));