From patchwork Tue Jan 24 10:11:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 92312 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp1621884obz; Tue, 24 Jan 2017 02:12:00 -0800 (PST) X-Received: by 10.98.38.130 with SMTP id m124mr34375266pfm.22.1485252719915; Tue, 24 Jan 2017 02:11:59 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y25si18593848pfi.47.2017.01.24.02.11.59; Tue, 24 Jan 2017 02:11:59 -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 S1750870AbdAXKL5 (ORCPT + 4 others); Tue, 24 Jan 2017 05:11:57 -0500 Received: from mail-wm0-f51.google.com ([74.125.82.51]:35545 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750856AbdAXKLz (ORCPT ); Tue, 24 Jan 2017 05:11:55 -0500 Received: by mail-wm0-f51.google.com with SMTP id r126so173802764wmr.0 for ; Tue, 24 Jan 2017 02:11:54 -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=QbBK5J6sAqToHb9BlADYdAddXRZ7E2FAkkwXztbQrp/iAejdHgTXk01vq2JWeaoR6f Y1ClpgGRHnQNUh6RZpr0ZJxlE3jcipwo2Gs8bS2uPV9sVGjuR8meTi0EErqdgpv8LLHr ztifEYJfyeKOvuslvsG0Zz3Onc//42x5Uwi0KqbBQfYr/+SVNrUSZmf2Rt/sMKGMf6AW PH559p6SW28MNphhX5GUYSQEGIyMvy+gSq744jLC7VAWnZo960nriuylst2695wpu4Sq jTMGfA0lu2Dn73bfSUr0EO4jmGCWgfI/tlg0TzgT5a0+Zg1pMzYV7v2STe5ieQm0jdCV 2m/A== 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=gMo8ZBNzdfsIXGzPwkyFtYdLUmZA2E1R2aBenqGDcszcmIfskNR3Av2DQXhupovjbk Eo/b9ixVt0RvyXzc1i0xxsG5XFDEDKsZ5Gq+qL7ncYD7r0u5jRdv/NPjMvT1bInXVdP4 8SGDvTF4JLOtbTric4PFV5JvFfdiDjNj6Kpud83wMwD43xMlZ+hYpOAfVMbsuVhgZ/EZ /1vQnJMEDhElXwrrti3psuXJfTd8gIZG9DXz9Gk+2xSact7wGjz3O062KRhYvNkNc58P wGi3wr/RUZ5GFFlh02KEU72gUpS+IPKJskGcDiG9BxTcchOJaTUeNVzY+tVbk5TLChH5 90Eg== X-Gm-Message-State: AIkVDXLK9ISvJUulX+yUe0JGK6Fuf/xzHArMHJAfkyrlThY0M6mIqhn+skcxOM2GCO5U2Xo9 X-Received: by 10.223.153.135 with SMTP id y7mr27755136wrb.55.1485252714075; Tue, 24 Jan 2017 02:11:54 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id c81sm25427318wmf.22.2017.01.24.02.11.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jan 2017 02:11:53 -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 1/5] usb: musb: da8xx: Remove CPPI 3.0 quirk and methods Date: Tue, 24 Jan 2017 11:11:45 +0100 Message-Id: <20170124101149.14920-2-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-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@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-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 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 Tue Jan 24 10:11:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 92316 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp1621965obz; Tue, 24 Jan 2017 02:12:12 -0800 (PST) X-Received: by 10.98.10.69 with SMTP id s66mr37146150pfi.146.1485252732671; Tue, 24 Jan 2017 02:12:12 -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.12; Tue, 24 Jan 2017 02:12:12 -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 S1750871AbdAXKMG (ORCPT + 4 others); Tue, 24 Jan 2017 05:12:06 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:37617 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750807AbdAXKMB (ORCPT ); Tue, 24 Jan 2017 05:12:01 -0500 Received: by mail-wm0-f52.google.com with SMTP id c206so200730191wme.0 for ; Tue, 24 Jan 2017 02:12:01 -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=1X0VokqypoR6r2YJkoczl4siGWVR0xuA7t5dkQpf6N0/M76FEuDZ0RBxH2BY7dmcK7 GNWaYs3Vras+OaW9xJRvoNZD0wlUnb2ox/mR7TfOKnKgpL3/nAc0+GiKqS8Z9+EK1Rd5 CaEzogIPK71RmSpOWzJcWHtVykP0Zp1A4W2B5ScoSb1FSOqLXpI5GacKa2kWVpqfQiGF WPW3JnKfgs/B6FEpChopHlevwAevYgJIwrzC0Ua2pnkZgj+bXy8omWDhoosuacuUBkk6 su2W3bWNrsgdDzxKGxhxZASye9SD2RMNAkZJtayKGREP1KXbbGHrASa/a08aoFej76R6 nH9g== 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=OPYOZvL4puOjU0XMbO8n3bbuzy3kSWEchecFmRymCcpGjr58cIxMm6Q/Z10TdlisV9 8CSZrfh2qxlCSjOgyPJ7FbzsH+r0R9xoGSbAmS3AiIrB47zbZrEklq6O0AgMsDTNwuPd NHJ0PwlNWe0Y1TJlVXOrTV0x4l6xR/pObfDpDYrKz1jHzb4tp0Q+j9st1Q74Y7SgjwYs 2BVSH35+Wy9UlS0M9UV/GFshwxzp/IIA9K+ego1kevLjCgq23fg0S/c/yqNwi921smG6 2r7ow4Q+DNt+3Gy+Ivup3HIvNgpy1U98p0r9eBU0ZlddP/KI+2Ngn92qDHJS99ce6YDw eApg== X-Gm-Message-State: AIkVDXKOWL603XBmhmOdDnSzikMPUmLyU2razGDxvgQ5VsVzvf6isiGaPqhkir/4jqiU/mtL X-Received: by 10.223.178.146 with SMTP id g18mr28294003wrd.124.1485252715189; Tue, 24 Jan 2017 02:11:55 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id c81sm25427318wmf.22.2017.01.24.02.11.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jan 2017 02:11:54 -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 2/5] usb: musb: Use shared irq Date: Tue, 24 Jan 2017 11:11:46 +0100 Message-Id: <20170124101149.14920-3-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 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-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/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 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)); From patchwork Tue Jan 24 10:11:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 92314 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp1621953obz; Tue, 24 Jan 2017 02:12:11 -0800 (PST) X-Received: by 10.99.66.198 with SMTP id p189mr38113589pga.30.1485252731442; Tue, 24 Jan 2017 02:12:11 -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.11; Tue, 24 Jan 2017 02:12:11 -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 S1750883AbdAXKMC (ORCPT + 4 others); Tue, 24 Jan 2017 05:12:02 -0500 Received: from mail-wm0-f48.google.com ([74.125.82.48]:33233 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750862AbdAXKL7 (ORCPT ); Tue, 24 Jan 2017 05:11:59 -0500 Received: by mail-wm0-f48.google.com with SMTP id d140so41387925wmd.0 for ; Tue, 24 Jan 2017 02:11:58 -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=WcC5Xn5sSMdLuBaZQgCYrEBJ+tpOnl93Rz1hI2Mrvns=; b=xtdNx5revvFQPuoEyTsrekZXngaREoQqIQ6rF/VbQ4GuXrYee2QiXsYBSpZbpWFPrH kU3fh7Q3eVgvgdgG25Ci4xm8q4EpWwPvLV9wkOi0Dr2S8oTO00phfWLeJOOEuzkOOYa6 rvfKyWQEElAX7npvb2uff3y9msRBYYAA5Qmq8VtZRLg01GwHDnKEd0m9+8xMU5wT1mD0 JqrKIOISYQnSkkf7NmypXF8RyVNUJOU36PwPB7PFU9fwu3WZmBauv0150qj3V41JqazW 6mSbac1pDshYjFfbVqK9EEG0ar6WDahMkHMYBH5bUSTQsm0VqtBQrGR17RpZxiXHEdub zqyA== 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=WcC5Xn5sSMdLuBaZQgCYrEBJ+tpOnl93Rz1hI2Mrvns=; b=tnM/t89EFbEyeYb0b2z44qwq/DmHF5TqDyGYUjVYixbomDdn352hyEI3+m4vBjkUcK InTw5kyXsgfRPrMM7IfIYcDhW+GkiJBAHernad+lMDUFYax0J0ms0JZVBQyoqP33BUug 69TlauIM93H8xwpa9KwPbHfMCoEcQ3+cq7u/1n3Z1NmBfpl4Y0vXBWJQ9qzNv89oyZm8 KUiIMLowHh5mYJGwLe5T19GZk0KvRnWAZd44SzxGcZYLwgbEQlE9UDzZWqh4f52dgq2I 9pctM2B5mt73+/f9HVlGJTsj9Qt8T3JvZKEjokB1/RSM589gM2quvNpIwYMp79UocNhG P1sw== X-Gm-Message-State: AIkVDXIZBMqKX+UtIqWW3KJssJJgC5h6u+QqI1vEa+fnpBaC/tj4fRgu9whik0Pgp9xUU+DV X-Received: by 10.223.168.111 with SMTP id l102mr27102937wrc.150.1485252717917; Tue, 24 Jan 2017 02:11:57 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id c81sm25427318wmf.22.2017.01.24.02.11.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jan 2017 02:11:57 -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 4/5] usb: musb: musb_cppi41: Workaround DMA stall issue during teardown Date: Tue, 24 Jan 2017 11:11:48 +0100 Message-Id: <20170124101149.14920-5-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-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org The DMA may hung 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-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 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 7253ea1..2fb2b81 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c @@ -553,6 +553,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 Tue Jan 24 10:11:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 92315 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp1621964obz; Tue, 24 Jan 2017 02:12:12 -0800 (PST) X-Received: by 10.99.64.4 with SMTP id n4mr33298317pga.71.1485252732403; Tue, 24 Jan 2017 02:12:12 -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.12; Tue, 24 Jan 2017 02:12:12 -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 S1750891AbdAXKMG (ORCPT + 4 others); Tue, 24 Jan 2017 05:12:06 -0500 Received: from mail-wm0-f47.google.com ([74.125.82.47]:35628 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750867AbdAXKMA (ORCPT ); Tue, 24 Jan 2017 05:12:00 -0500 Received: by mail-wm0-f47.google.com with SMTP id r126so173806135wmr.0 for ; Tue, 24 Jan 2017 02:11:59 -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=R7NwmbEouLtWggADZSGXsiR9TRbHrwxB1X49PDlsfqJ3VZyYY8LGecQ+CzOvJwKLYC /eU3jDvlKK/yDMy2r5/l+GMuwv8el4nLzdDJpqCBxzrWknIR2Ym1h7DmKbkg3XywbY4B tJIqPIQYsw2kYaQoLDPLV9TIS8ePVhO2XBGztGdaKnon94P++bpreyjRlVMMUV40oURp 1ichz6KTjOfK9WGUuoFJt8mOgdghd16RrlZws41PnslfiB94HW3mDwrcvHoch6l3dzCn sJTUW8bd1m61jSgSJuvVR67PFwo2XbFJ6uWLFrL8cVEriXV/QEsEZg8fV3rSGA1gqsiM DWhg== 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=mRrKhkRnwftKxgE9fwTl9UPLWIQWK388UDZcCpddAR9NYBEy3YKND0o8EezKXGQFDY mbHmJJpqEomgdGfIQZmIzl8CTbTsGaDPFfE9MbX1vlgMwa0UgyuLkhLHl5eqj3167oSr oFSc57YPGMI39QtN5q8SGwxovonckJ64eQRbVcGWna4n34TbG4IiGONu2w1KTJzqNG8z XKTjI+qDnxjEZPTpsqu++5jVhCsx93rbEdE40CmIVq4HZZ0Bis07aKs+biwQQ/5EYDNq omrFQMGw7WyCqnfmEazhz/MKC1rDE0TT3OIIvQGTZEkTdKH/7KSvy3oQrnw9k2a1K7pT kT9g== X-Gm-Message-State: AIkVDXKTYZuajSZx+HfFbiSRtgPcddl878k4Hr9jNsbyc4SxKAfzKMk5AdFiHpttNlJsJdjy X-Received: by 10.28.84.88 with SMTP id p24mr16413714wmi.52.1485252718896; Tue, 24 Jan 2017 02:11:58 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id c81sm25427318wmf.22.2017.01.24.02.11.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jan 2017 02:11:58 -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 5/5] usb: musb: da8xx: Add a primary support of PM runtime Date: Tue, 24 Jan 2017 11:11:49 +0100 Message-Id: <20170124101149.14920-6-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, 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-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 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; }