From patchwork Wed Mar 29 16:24:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 9651933 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 5053D601D7 for ; Wed, 29 Mar 2017 16:25:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43E6228482 for ; Wed, 29 Mar 2017 16:25:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38D8A284F2; Wed, 29 Mar 2017 16:25:39 +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 07BA828482 for ; Wed, 29 Mar 2017 16:25:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753060AbdC2QZd (ORCPT ); Wed, 29 Mar 2017 12:25:33 -0400 Received: from mail-wr0-f175.google.com ([209.85.128.175]:33382 "EHLO mail-wr0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752776AbdC2QZ3 (ORCPT ); Wed, 29 Mar 2017 12:25:29 -0400 Received: by mail-wr0-f175.google.com with SMTP id w43so22451701wrb.0 for ; Wed, 29 Mar 2017 09:25:28 -0700 (PDT) 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=iXAcZ/m0RgL0IbQ9bMSizLxv9FJ3E7mZkYhc3Bia9eE=; b=b+W0gbgHoM+UqOs0AzLidEiT8DoSPcVV8HFS+dLXZszlEGTR8zoJeADPjuCDE5iD+k 5BIXIo62sIQQHhLcwyglfC46LKEYyN5B3vZJHYc9tXtUUpDS83of454zFzlPqTdynxpu bEOy4GuI6v2ozkICx9AYZeavGh3QGs0E1/3CSmoLSORbm8jZ1cwg8Y9+Yq+l2ezg23FQ nH3Exd7oIEG1199T/mhXahBJ594cmS6HCbI3jQSU9i1kPKf9CJzvXZpKyZ3+RuOPfsgO wCK0M/EgvxyrRVtWQcYUYfeiiPovHoSFO6i+JDEDATLpjZqQlTxHnIUpptVWmMqi+jdS hofw== 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=iXAcZ/m0RgL0IbQ9bMSizLxv9FJ3E7mZkYhc3Bia9eE=; b=P+5rEE7+nVOipRo23a3po5QzRZxWSm4J5bf8l0ZgNR68RGdkHqDmpoFu27BncNs+AZ J2z620RVhxnLDFi9KMWjWbOPGRbhjtxgF9zdayFeU90PzdyKKwJ4F6WOvybfvrfxfo3R pK0bivoujbiRXIyOGTBq4ufNZROkjNEEhctn7YHfcf1m+xKGDcFrcF6aMJFChWApLSJY BziuTDKktAZqOG5B/kUZ6+TzBuKQ4K0BeP9HMH/61ci46BnhER8M3Dyfdfc5Bl0bOHId as6wsxlc1r/qhR7gKaIJ+b1l4pD6D3F7MSQJGgpXvwE7FzAHAYPRsg9YoPYWsgbBO1O0 Sb/g== X-Gm-Message-State: AFeK/H1Ze9+0a0D4AP19FZLWNKpQxF1R2adtY/ari6hdN0jaUPebIDQ5ZFoJqkHr/+e4CtCv X-Received: by 10.223.134.173 with SMTP id 42mr1364362wrx.130.1490804727322; Wed, 29 Mar 2017 09:25:27 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id h3sm10041926wrb.6.2017.03.29.09.25.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Mar 2017 09:25:26 -0700 (PDT) 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, grygorii.strashko@ti.com, Alexandre Bailon Subject: [PATCH v7 2/3] usb: musb: Add support of CPPI 4.1 DMA controller to DA8xx Date: Wed, 29 Mar 2017 18:24:31 +0200 Message-Id: <20170329162432.27299-3-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170329162432.27299-1-abailon@baylibre.com> References: <20170329162432.27299-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 | 43 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 44 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..7b9a44d 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, @@ -483,6 +513,12 @@ static const struct musb_hdrc_config da8xx_config = { .multipoint = 1, }; +static struct of_dev_auxdata da8xx_auxdata_lookup[] __initdata = { + OF_DEV_AUXDATA("ti,da830-cppi41", 0x01e01000, "cppi41-dmaengine", + NULL), + {} +}; + static int da8xx_probe(struct platform_device *pdev) { struct resource musb_resources[2]; @@ -533,6 +569,11 @@ static int da8xx_probe(struct platform_device *pdev) } platform_set_drvdata(pdev, glue); + ret = of_platform_populate(pdev->dev.of_node, NULL, + da8xx_auxdata_lookup, &pdev->dev); + if (ret) + return ret; + memset(musb_resources, 0x00, sizeof(*musb_resources) * ARRAY_SIZE(musb_resources));