From patchwork Tue Jan 24 10:11:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 92317 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp1621994obz; Tue, 24 Jan 2017 02:12:17 -0800 (PST) X-Received: by 10.84.238.1 with SMTP id u1mr51230036plk.174.1485252737526; Tue, 24 Jan 2017 02:12:17 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q186si18562325pga.81.2017.01.24.02.12.17; Tue, 24 Jan 2017 02:12:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750904AbdAXKMO (ORCPT + 4 others); Tue, 24 Jan 2017 05:12:14 -0500 Received: from mail-wm0-f41.google.com ([74.125.82.41]:37978 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750899AbdAXKMN (ORCPT ); Tue, 24 Jan 2017 05:12:13 -0500 Received: by mail-wm0-f41.google.com with SMTP id r144so200362558wme.1 for ; Tue, 24 Jan 2017 02:12:12 -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=mf6LsFmSgF0XcWMk6up9kSEt7nqoc4i7TJLbMn0tAZI=; b=aILL16n/9AKeP/YzliXgLk7/D7AhC5jVkTvGZ3hNSILXT1kKBHsMKwADHLbHnV+aCH AsXHyFRl4cduLbJYZn8oMkMqGssKDVpq+FPhx2Ny/mPY9rV6MN75xudHAyRgONgDlvUX f6Y9ACtXnDGxPTG/dQYzdIZqRkdjAUf+/3NpH2HAGmpzGQlfJU60imSDZBikUquXZJdi JB+wUHm6/EJoIuuGIthVHEqMZnKJyo/SQKR994WH76Upw7xv9T5edBqyNFWT+SvFNr+Y vg6nn94StNMTMb2wKGklj7QI9mLWPf3pCcNDGDGTPLmmug1vdGNqd9/mx3Ua4joLp3p0 pcgQ== 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=mf6LsFmSgF0XcWMk6up9kSEt7nqoc4i7TJLbMn0tAZI=; b=HwLDvdrsVAICEtH/o6C1c512tpIbHdt7V9/1EA+alQ4CvvgxXM4NcNC5ZL85z7q6vi xB0DiD1neKvBX47FZY7grlw8XNiRh38Bt39JyxF0YE5CFGwkS495XwtJjYvM2VOKD0Zb NkauR5g8ueW/SLdDuJbRYfKpTYvb6iYCsjxKlHTO31IJUxHugwgnBCCaUwXYQtCNDGM5 du+22013ISJs4R5VhCbwsuJ27EpP5s2xeiv7zJigQ+aaYmjLmZsZf9BhdgRHfA5T1PPU 078Kzk2rKNRsatL9XIhIN8WQfIOqKWEuZkMABTJKsHu6v+PuxBM/nrkix/7nqHsnmRo2 NOKg== X-Gm-Message-State: AIkVDXJ5QyvjklS8IKc4UEtz+4mI2SPXLggSi6vwwnLDLZrQi0waqscdEuzErLXc5W+TNfyV X-Received: by 10.28.163.3 with SMTP id m3mr18835273wme.85.1485252716870; Tue, 24 Jan 2017 02:11:56 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id c81sm25427318wmf.22.2017.01.24.02.11.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jan 2017 02:11:56 -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, linux-usb@vger.kernel.org, sergei.shtylyov@cogentembedded.com, Alexandre Bailon Subject: [PATCH v4 3/5] usb: musb: Add support of CPPI 4.1 DMA controller to DA8xx Date: Tue, 24 Jan 2017 11:11:47 +0100 Message-Id: <20170124101149.14920-4-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170124101149.14920-1-abailon@baylibre.com> References: <20170124101149.14920-1-abailon@baylibre.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 3 deletions(-) -- 2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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 cd3d763..d279438 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -457,12 +458,40 @@ 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, + .quirks = MUSB_INDEXED_EP | 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, @@ -534,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));