From patchwork Wed Jan 25 10:33:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 92422 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2143362qgi; Wed, 25 Jan 2017 02:33:32 -0800 (PST) X-Received: by 10.99.103.133 with SMTP id b127mr46567310pgc.168.1485340412668; Wed, 25 Jan 2017 02:33:32 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x23si22998087pfa.140.2017.01.25.02.33.32; Wed, 25 Jan 2017 02:33:32 -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 S1751892AbdAYKda (ORCPT + 4 others); Wed, 25 Jan 2017 05:33:30 -0500 Received: from mail-wm0-f46.google.com ([74.125.82.46]:35175 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751777AbdAYKd0 (ORCPT ); Wed, 25 Jan 2017 05:33:26 -0500 Received: by mail-wm0-f46.google.com with SMTP id r126so20015736wmr.0 for ; Wed, 25 Jan 2017 02:33:26 -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=YVPELWrxH2zHaDPbA1AaKjp4UtC9vzT954WI8jNE8qE=; b=dtffGdIq21Yg8o+9lW6JyHgwZrb4/B2UrIRpNtSmSqluh0dVNyX75o+N3XVfiuFzZ3 DeaJA/FuyPKzGqGwwOFG+YGVc369t0LfBFEFizLkjmCVfnyj3pf8NTglsQqZBniJFNye blWD59cTeH3Msq/ECoV6Oaad4g6RbxaQsZY365KX9KaL5tMSOr+ncu8zTaqXvZ39SX+m LW8Wa+LGoBg7xMZUtiP3MIwgJSE5SHU4vd51OzmHzcFB7rW/2/rnftp8fS+zqvMUQWBh w7G4TTyEA9hvltgetr7zremJg3CGcgAffdYWIB1Jdywji/fl/f4hZVzODxejxXjFOIoD vu5Q== 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=YVPELWrxH2zHaDPbA1AaKjp4UtC9vzT954WI8jNE8qE=; b=sL9sDPn7HxuGqikXxaHJdmEtJLbsNzBEFqRtvZs2Vukr5tHlBze4hLg6YlXiKXe/E3 Wlub4KQrt0rILU8pcpv7R5qCoeHyhibmE/HJmgWuw6cHSBpOjfma6L2Pe7q7/FKbIPk+ yT/8jiZGcks5cl3tzgNdDFiZeTPpLSTpxP0YvC2yUd8+19GFU4RhJNH4nMu3naCsbz78 ocP5utZ2fHkq17dLTZotKdcbz81M3mz4D0oX/57pYgO1RTxjy3nuKeFm5XZU7xVsGbbf du0gJNOcGzhTdojJf3gSTh3vXKmV9Lw+7pBr4pVwG1itTnk9QpKl7N7hV1fZhDM+Ah5s +u+w== X-Gm-Message-State: AIkVDXLYL/BFF0OGIwVMoEuT0+napTIHUv6UYy64xb23GmrN7Rxlh7uyJorCu64J4kZOYucc X-Received: by 10.28.12.13 with SMTP id 13mr20732974wmm.10.1485340405505; Wed, 25 Jan 2017 02:33:25 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id z134sm30599521wmc.20.2017.01.25.02.33.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Jan 2017 02:33:24 -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 v5 1/5] usb: musb: da8xx: Remove CPPI 3.0 quirk and methods Date: Wed, 25 Jan 2017 11:33:15 +0100 Message-Id: <20170125103319.26021-2-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170125103319.26021-1-abailon@baylibre.com> References: <20170125103319.26021-1-abailon@baylibre.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org DA8xx driver is registering and using the CPPI 3.0 DMA controller but actually, the DA8xx has a CPPI 4.1 DMA controller. Remove the CPPI 3.0 quirk and methods. Fixes: f8e9f34f80a2 ("usb: musb: Fix up DMA related macros") Fixes: 7f6283ed6fe8 ("usb: musb: Set up function pointers for DMA") Signed-off-by: Alexandre Bailon Acked-by: Sergei Shtylyov Acked-by: Tony Lindgren --- drivers/usb/musb/da8xx.c | 6 +----- 1 file changed, 1 insertion(+), 5 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/da8xx.c b/drivers/usb/musb/da8xx.c index e89708d..cd3d763 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -458,15 +458,11 @@ static inline u8 get_vbus_power(struct device *dev) } static const struct musb_platform_ops da8xx_ops = { - .quirks = MUSB_DMA_CPPI | MUSB_INDEXED_EP, + .quirks = MUSB_INDEXED_EP, .init = da8xx_musb_init, .exit = da8xx_musb_exit, .fifo_mode = 2, -#ifdef CONFIG_USB_TI_CPPI_DMA - .dma_init = cppi_dma_controller_create, - .dma_exit = cppi_dma_controller_destroy, -#endif .enable = da8xx_musb_enable, .disable = da8xx_musb_disable, From patchwork Wed Jan 25 10:33:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 92421 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2143357qgi; Wed, 25 Jan 2017 02:33:31 -0800 (PST) X-Received: by 10.99.37.199 with SMTP id l190mr46442305pgl.86.1485340411810; Wed, 25 Jan 2017 02:33:31 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x23si22998087pfa.140.2017.01.25.02.33.31; Wed, 25 Jan 2017 02:33:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-omap-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-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751845AbdAYKd3 (ORCPT + 4 others); Wed, 25 Jan 2017 05:33:29 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:38115 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751841AbdAYKd2 (ORCPT ); Wed, 25 Jan 2017 05:33:28 -0500 Received: by mail-wm0-f45.google.com with SMTP id r144so22797747wme.1 for ; Wed, 25 Jan 2017 02:33:27 -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=v7jMPRN+ekKdwRSf8to4qcDPnXhz1D2f4+8UL6k9Hs8=; b=fK74e+ovP1s48n3uzakpqolq21kfAP4cWArQQuwLER30u0JX5qxOajT2d+R+kpGNrd 1fjtdRcnU3HoQsrpahCxZIEKUI63yK2+np+prinJW/OOViR4HsKtwWTdDwluoOq2ini+ qCcWllR8tqzjXnrE3vGYjktNEz5sR7WnqJB0kYvn1PxOCumeyGjw5rSdGzHUD+Z5rTIy DG65fqwjcl97znxDAqGwQ7Vqo66+SWZY/ZgvL/h51hM9udjB4csv+1fws5NmhSaOY8FJ sc81W8r6cwKlpfzebAv2U738f2azILeyTUEito0s5WnXsRVRPB5dSf5cncd/qrBaktY/ /KoQ== 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=v7jMPRN+ekKdwRSf8to4qcDPnXhz1D2f4+8UL6k9Hs8=; b=mS/d21C5g84JaSPqxN+dl3uSczc1AfPr1aooaU0zVyJwhFiOjnLewbotZeRGjH5//x mzJxwdfRqmdaNmAa7hcpPYt1STBiIvL0ONl2Sv2i7C4N6JeimE2CiSlF5iofzR33zslg oTPf5WYeVTPSetXBxXvNn10xvGDlIwCXs3ILYipFmaoj/+maSs1bJmwVe193TzBVJ23Q dlXx6pore2TQx9e9VRqytOKGLrsY3gVbWvjr5Bz97f0vj3lgVg3ThdGk6YmeP/LnkSTe ItpVw9UsMmWnYqZOqf6l5Sy5EdMQ5JNUlNpx4xGlTokjkeafImkAtPhx7ZvJ5E9o7Ghb PPFQ== X-Gm-Message-State: AIkVDXLO629ovaubOOjx9gTBZFG2Q+NLIBvl2xDma9rcxtO09rp5H2Et/lRkzYlSU4LBoiNe X-Received: by 10.223.169.85 with SMTP id u79mr32879411wrc.169.1485340406527; Wed, 25 Jan 2017 02:33:26 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id z134sm30599521wmc.20.2017.01.25.02.33.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Jan 2017 02:33:26 -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 v5 2/5] usb: musb: Use shared irq Date: Wed, 25 Jan 2017 11:33:16 +0100 Message-Id: <20170125103319.26021-3-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170125103319.26021-1-abailon@baylibre.com> References: <20170125103319.26021-1-abailon@baylibre.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org In the DA8xx, USB and CPPI 4.1 are sharing the same interrupt line. Update the driver to request a shared irq. Signed-off-by: Alexandre Bailon --- drivers/usb/musb/musb_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" 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/musb_core.c b/drivers/usb/musb/musb_core.c index fca288bb..cf40adf 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2329,7 +2329,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) setup_timer(&musb->otg_timer, musb_otg_timer_func, (unsigned long) musb); /* attach to the IRQ */ - if (request_irq(nIrq, musb->isr, 0, dev_name(dev), musb)) { + if (request_irq(nIrq, musb->isr, IRQF_SHARED, dev_name(dev), musb)) { dev_err(dev, "request_irq %d failed!\n", nIrq); status = -ENODEV; goto fail3; From patchwork Wed Jan 25 10:33:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 92425 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2143427qgi; Wed, 25 Jan 2017 02:33:43 -0800 (PST) X-Received: by 10.99.103.133 with SMTP id b127mr46568191pgc.168.1485340423422; Wed, 25 Jan 2017 02:33:43 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x23si22998087pfa.140.2017.01.25.02.33.43; Wed, 25 Jan 2017 02:33:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-omap-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-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751915AbdAYKdm (ORCPT + 4 others); Wed, 25 Jan 2017 05:33:42 -0500 Received: from mail-wm0-f51.google.com ([74.125.82.51]:38135 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751695AbdAYKd3 (ORCPT ); Wed, 25 Jan 2017 05:33:29 -0500 Received: by mail-wm0-f51.google.com with SMTP id r144so22798496wme.1 for ; Wed, 25 Jan 2017 02:33:28 -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=dpRPLiAOPS9WyRnQ5W1PDuLL95S07KYVloP6QSDKzObYdi3VgUu+zG1WXr1RybSx2Q +tIaBbA+H9ikwaFSlI3BtD98ivwECUEw+OL7h3bVuVGf9U5TjbfCeWcOYhL/yLuDwT16 QM+L+flMDsDx3tHmu1B1vOuHmukM4047c/koY4qgujERjL4RqPQwKCxljzE/86jtAYdu YGnlPwCab5Qk540MqRD9TG2mUNcfStjsgsdrh1Pf3Vc0X5hCRXQJhDiGMZ1zxC2q64RA M8jfR6EaSeAWG4MinBv9MszCaL7x9D/bl5m7MjzjLKNgKzSpT/zOiPaJLJQxtjYkpgmM GfuQ== 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=IDbvuyjkYle5bsqCVi+OB4M4Yo9/N0K2PFVINJ4IwpB3Nn6qTDjYMkd6VOgZv9/ozm 33we2JDTL2FLDvhmF32cInWuxH/p9ypaIsrKTiH7i/Ry2BJPhOJcZcO3PooOLIyiEt1/ HpaPfTlBhxjJS/Ha7eKMpgA2/32M/nFq1S+yrmRQZjfDEOZFYEtGzzwEvOaCR+fuyGiD E8pVCkrVX2j/k8khb5Zv6rl7o3LTe8molzkdtK7HBiyqUBM0URxaEqF70xnmovoooh9S IWGgX1Pzs4lCg0Kn+VIzEZpqcAV7zSUgQtbzy8mQvuA5ya66xx6LAq0XQgSfwBKDaih8 h9ug== X-Gm-Message-State: AIkVDXKYMHxUkAyl8bnHdh2Nm+YeZpYZK4KGg3E3iiruZXvR4/+MQISDv/o75YEp+P1TuQEP X-Received: by 10.28.140.140 with SMTP id o134mr23713040wmd.87.1485340407485; Wed, 25 Jan 2017 02:33:27 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id z134sm30599521wmc.20.2017.01.25.02.33.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Jan 2017 02:33:26 -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 v5 3/5] usb: musb: Add support of CPPI 4.1 DMA controller to DA8xx Date: Wed, 25 Jan 2017 11:33:17 +0100 Message-Id: <20170125103319.26021-4-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170125103319.26021-1-abailon@baylibre.com> References: <20170125103319.26021-1-abailon@baylibre.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@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-omap" 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)); From patchwork Wed Jan 25 10:33:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 92424 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2143410qgi; Wed, 25 Jan 2017 02:33:39 -0800 (PST) X-Received: by 10.98.37.132 with SMTP id l126mr40093748pfl.45.1485340419766; Wed, 25 Jan 2017 02:33:39 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x23si22998087pfa.140.2017.01.25.02.33.39; Wed, 25 Jan 2017 02:33:39 -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 S1751918AbdAYKdh (ORCPT + 4 others); Wed, 25 Jan 2017 05:33:37 -0500 Received: from mail-wm0-f41.google.com ([74.125.82.41]:35221 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751841AbdAYKd3 (ORCPT ); Wed, 25 Jan 2017 05:33:29 -0500 Received: by mail-wm0-f41.google.com with SMTP id r126so20017565wmr.0 for ; Wed, 25 Jan 2017 02:33:29 -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=y0oRiK2gyAECtFsmUvACCWrht8NI+9nroAEJ42d/HqM=; b=p4KqljQ5T5AYCDuj8pUY4g7hYlqEA50NdeYRBcUldzGqWE6nmthRxi7GsULHi4W8WH Q6ofIscl/CaoBTDvIL76zwOV+J2Z62bZKZfsPsSYKukFJj3p3OXdIdXi/rEvG/zTRn3G 6NTzzCujjTD+NjOGFq61WEbmUkAyxOc1zNB7as/vlg/MCeFSnhLkCs1PXu6L1IGHbNRl H6pFNcmDMovx3vslbqmDZ3meWmSbNwQAtqPevhYUraLSZoNg3/9ie3BCEw9FdjDZIWT9 4YNP2Cnm6U8MJE7VdNIr4TcvDV0dMNAqDcD8QAZJF2haCmVp8h1f8RQJP8qC88C7jQyP 47xg== 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=y0oRiK2gyAECtFsmUvACCWrht8NI+9nroAEJ42d/HqM=; b=iBVoT14jb1tSkQkhcJLAcaGNChTJajSxfFwPeKJV60OdzH+cRpsSof/F9D1KqHDQG0 zNLn1d4LlJ9NQRD2KtCARsCqhSptirX6PFGFtiql/nV/dnYRNXLCFMQq96AUWrxDs2Ux z8qk3cEI6QeH/7OXH2RaXCmXmScbfkblmoGmIV8uc0SihzfZYMSDoWxtdjLE/y1slYMb EQbeiDrhQ5x6YEXfLJmUrHj26d4Sgkmf/CnX3nuw75bnlGkeGDjKvPYHIOUBwtPh4fiX 6JjTyeGMzVkuIOjZ+GOjHnuqrPLtskscH2uvZpBcqz+2Hv0WP1xyfK651D5Mt7xH+47O QL6g== X-Gm-Message-State: AIkVDXI3D9FNkezkkSHEqrORj1RTtO3eN2FxTArVObES6QPvfF5aklWbuyYfUSrxnt8QQtfz X-Received: by 10.223.155.221 with SMTP id e29mr33156612wrc.107.1485340408417; Wed, 25 Jan 2017 02:33:28 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id z134sm30599521wmc.20.2017.01.25.02.33.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Jan 2017 02:33:27 -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 v5 4/5] usb: musb: musb_cppi41: Workaround DMA stall issue during teardown Date: Wed, 25 Jan 2017 11:33:18 +0100 Message-Id: <20170125103319.26021-5-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170125103319.26021-1-abailon@baylibre.com> References: <20170125103319.26021-1-abailon@baylibre.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The DMA may hang up if a teardown is initiated while an endpoint is still active (Advisory 2.3.27 of DA8xx errata). To workaround this issue, add a delay before to initiate the teardown. Signed-off-by: Alexandre Bailon --- drivers/usb/musb/da8xx.c | 2 +- drivers/usb/musb/musb_core.h | 1 + drivers/usb/musb/musb_cppi41.c | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) -- 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/da8xx.c b/drivers/usb/musb/da8xx.c index d279438..d87fb9b 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -483,7 +483,7 @@ da8xx_dma_controller_create(struct musb *musb, void __iomem *base) #endif static const struct musb_platform_ops da8xx_ops = { - .quirks = MUSB_INDEXED_EP | MUSB_DMA_CPPI41, + .quirks = MUSB_INDEXED_EP | MUSB_DMA_CPPI41 | MUSB_DA8XX, .init = da8xx_musb_init, .exit = da8xx_musb_exit, diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index ade902e..d129278 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -172,6 +172,7 @@ struct musb_io; */ struct musb_platform_ops { +#define MUSB_DA8XX BIT(7) #define MUSB_DMA_UX500 BIT(6) #define MUSB_DMA_CPPI41 BIT(5) #define MUSB_DMA_CPPI BIT(4) diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index 00e272b..2df37be 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c @@ -552,6 +552,10 @@ static int cppi41_dma_channel_abort(struct dma_channel *channel) } } + /* DA8xx Advisory 2.3.27: wait 250 ms before to start the teardown */ + if (musb->io.quirks & MUSB_DA8XX) + mdelay(250); + tdbit = 1 << cppi41_channel->port_num; if (is_tx) tdbit <<= 16; From patchwork Wed Jan 25 10:33:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 92423 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2143377qgi; Wed, 25 Jan 2017 02:33:35 -0800 (PST) X-Received: by 10.99.152.65 with SMTP id l1mr17580957pgo.28.1485340415502; Wed, 25 Jan 2017 02:33:35 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x23si22998087pfa.140.2017.01.25.02.33.35; Wed, 25 Jan 2017 02:33:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-omap-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-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751900AbdAYKdd (ORCPT + 4 others); Wed, 25 Jan 2017 05:33:33 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:37558 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751867AbdAYKdb (ORCPT ); Wed, 25 Jan 2017 05:33:31 -0500 Received: by mail-wm0-f45.google.com with SMTP id c206so22857278wme.0 for ; Wed, 25 Jan 2017 02:33:30 -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=0q33KdiIIb8XngnzO2a6Da8IUut9FKf6dTmewQw1SjY=; b=zULMq2ZDhqhmJdhw24xQuwQgQjPDs0DogrN9mYapwm/TtfmZ4F7FQdemqrjUGS75o+ WPJqm5xcpU5ON+sal+wX+dfJiGqUUU8x+4DFtnxTTzuhA0DYPB8l2HIRBvUutJKCyJxR PFYDDrborCPOslE30b5gf+jZ+TBM1UQAKPTTmx37ICKb6Nvay99nFIyujm/Yuht3wst9 jLAajhjurBDD4ZnjcGU6+GfHiVbDHylQq7Hc9jmWsxKj7zKggGELlVELgFZF1URNmAqp wq3QBZfN5JwCnh+kKmxkCBRukJ0p6aotroascE8tvteuR3qXTjGuxeeS7z42bc63+dIb KUxw== 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=0q33KdiIIb8XngnzO2a6Da8IUut9FKf6dTmewQw1SjY=; b=SkrTH7Kt91Q8A6w6uE3f4kDuSQZHcY1aFFrqVGUo2NsYk4mfEgP4OIIpl1IDWPaYwh fnUMCXTCIht/NdlS0c45qiKvvoBsjFQuMmQcSDqrPYnLaW1AV22Je7zG4AOjwdNQe4xi U3+h4/9x+ueiC8Xc/8nHMIOUV9P+eaOli5fvp1fOfGygKO05XA+3fjwzdcx+zkhTHRe0 rGZP9gm2V+jPbgbF9mG3KF9otjnxOiHx8UyjfAzPzBqy2gTf+MtsYGZ+8cH8uSIoh1Ah /MQEUQhSZbLNUrwdo2GWiV9FKdSzQ9piDTDvdVH9Rm/qVJSQq8+TBzEGr1Metxgxy49Z vgBQ== X-Gm-Message-State: AIkVDXLIGkAmvy9UUfTkjHMNLVAC1yicYiYX8i5k44pSZY0UKVvlb+NRKGFvBZxee0gb/jiT X-Received: by 10.28.60.66 with SMTP id j63mr12613661wma.74.1485340409392; Wed, 25 Jan 2017 02:33:29 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id z134sm30599521wmc.20.2017.01.25.02.33.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Jan 2017 02:33:28 -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 v5 5/5] usb: musb: da8xx: Add a primary support of PM runtime Date: Wed, 25 Jan 2017 11:33:19 +0100 Message-Id: <20170125103319.26021-6-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170125103319.26021-1-abailon@baylibre.com> References: <20170125103319.26021-1-abailon@baylibre.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Currently, MUSB DA8xx glue driver doesn't have PM runtime support. Because the CPPI 4.1 is using the same clock as MUSB DA8xx and CPPI 4.1 is a child of MUSB DA8xx glue, add support of PM runtime to the DA8xx glue driver in order to let the CPPI 4.1 driver manage the clock by using PM runtime. Signed-off-by: Alexandre Bailon --- drivers/usb/musb/da8xx.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) -- 2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" 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/da8xx.c b/drivers/usb/musb/da8xx.c index d87fb9b..bebc9ed 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -30,7 +30,6 @@ */ #include -#include #include #include #include @@ -86,7 +85,6 @@ struct da8xx_glue { struct device *dev; struct platform_device *musb; struct platform_device *usb_phy; - struct clk *clk; struct phy *phy; }; @@ -377,11 +375,7 @@ static int da8xx_musb_init(struct musb *musb) musb->mregs += DA8XX_MENTOR_CORE_OFFSET; - ret = clk_prepare_enable(glue->clk); - if (ret) { - dev_err(glue->dev, "failed to enable clock\n"); - return ret; - } + pm_runtime_get_sync(musb->controller->parent); /* Returns zero if e.g. not clocked */ rev = musb_readl(reg_base, DA8XX_USB_REVISION_REG); @@ -424,7 +418,7 @@ static int da8xx_musb_init(struct musb *musb) err_phy_power_on: phy_exit(glue->phy); fail: - clk_disable_unprepare(glue->clk); + pm_runtime_put(musb->controller->parent); return ret; } @@ -436,7 +430,7 @@ static int da8xx_musb_exit(struct musb *musb) phy_power_off(glue->phy); phy_exit(glue->phy); - clk_disable_unprepare(glue->clk); + pm_runtime_put(musb->controller->parent); usb_put_phy(musb->xceiv); @@ -519,7 +513,6 @@ static int da8xx_probe(struct platform_device *pdev) struct musb_hdrc_platform_data *pdata = dev_get_platdata(&pdev->dev); struct da8xx_glue *glue; struct platform_device_info pinfo; - struct clk *clk; struct device_node *np = pdev->dev.of_node; int ret; @@ -527,12 +520,6 @@ static int da8xx_probe(struct platform_device *pdev) if (!glue) return -ENOMEM; - clk = devm_clk_get(&pdev->dev, "usb20"); - if (IS_ERR(clk)) { - dev_err(&pdev->dev, "failed to get clock\n"); - return PTR_ERR(clk); - } - glue->phy = devm_phy_get(&pdev->dev, "usb-phy"); if (IS_ERR(glue->phy)) { if (PTR_ERR(glue->phy) != -EPROBE_DEFER) @@ -541,7 +528,6 @@ static int da8xx_probe(struct platform_device *pdev) } glue->dev = &pdev->dev; - glue->clk = clk; if (IS_ENABLED(CONFIG_OF) && np) { pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); @@ -587,6 +573,8 @@ static int da8xx_probe(struct platform_device *pdev) pinfo.data = pdata; pinfo.size_data = sizeof(*pdata); + pm_runtime_enable(&pdev->dev); + glue->musb = platform_device_register_full(&pinfo); ret = PTR_ERR_OR_ZERO(glue->musb); if (ret) { @@ -603,6 +591,7 @@ static int da8xx_remove(struct platform_device *pdev) platform_device_unregister(glue->musb); usb_phy_generic_unregister(glue->usb_phy); + pm_runtime_disable(&pdev->dev); return 0; }