From patchwork Thu Jan 19 14:08: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: 91908 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp293152qgi; Thu, 19 Jan 2017 06:08:48 -0800 (PST) X-Received: by 10.84.231.203 with SMTP id g11mr13565147pln.165.1484834927976; Thu, 19 Jan 2017 06:08:47 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h88si3674019pfk.4.2017.01.19.06.08.47; Thu, 19 Jan 2017 06:08:47 -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 S1752868AbdASOIp (ORCPT + 4 others); Thu, 19 Jan 2017 09:08:45 -0500 Received: from mail-wm0-f54.google.com ([74.125.82.54]:38437 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752748AbdASOIn (ORCPT ); Thu, 19 Jan 2017 09:08:43 -0500 Received: by mail-wm0-f54.google.com with SMTP id r144so78872929wme.1 for ; Thu, 19 Jan 2017 06:08:42 -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=w0TjPODa+XXdE/785qEk2944lQCBz3xvClyv/92puRWVnzsunfAlM59EuPbs2ys0AG cLgFzzwlP6LrWOMnn5Vl/V1ST9PX9RHUoebrjtO9y4uacgZSN1YCFnjex8Lc3yy+pYyN dpOMfvZGrvYNrDJhPhRCfPIPJfCz93WonV1Q1JWAx8puWwKKpDr28qUJJ5iDZXKQeHd+ Yjd/SJgp9pjh3bvIZJSlLegILuxzaXBhmHaGAvmm5z+jErC24puYFbXQ/vLUJzGdR3zH 1msX3CQFBk10da+YOQSkAtQMuipJKDcc6x5huvAulWv6K33WaFKtMut3Lg0Eun6F93EU VP5w== 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=k8dfJa9plsfzbnmZmnnPXNVdNiHUI7/ZRlCB5KmyjBjUF+4pzbEdJrwyLvmcWDK/qa 8un+dNadrpr5bXHscPuNyDs28ttwyiu8Znvxi+FL83jJcU8NpwbZKqTAq/wTD98NZdsw /aWsw9FqDHfl002xb5UUzEzb/+TsQ1/Bp52xdPhsob1K6ngHwG09mvOiCzSu7Z6wGWzk gRdomfpyWzy8AZ8GtUST1Zi+9apjsxFZTwcge4CR8F+RFONvJNrhTOI0NwMtxLE4+80v l+oG1SCcA+1gBvRD8QDr9ieK+lhsn8OMv+ckLCXtjDDw8xXJgyw0fvwzgCDK7xjxf+tA jhMg== X-Gm-Message-State: AIkVDXJoLDyU+RGBxHYP5LQDaFT8B6djXSWGx/GALMzPOb1LZGJvkrVH/DXpWAfWZt1ewmgW X-Received: by 10.223.138.172 with SMTP id y41mr7670972wry.118.1484834921689; Thu, 19 Jan 2017 06:08:41 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id d64sm53546626wmh.3.2017.01.19.06.08.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Jan 2017 06:08:41 -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, grygorii.strashko@ti.com, linux-usb@vger.kernel.org, Alexandre Bailon Subject: [PATCH v3 1/5] usb: musb: da8xx: Remove CPPI 3.0 quirk and methods Date: Thu, 19 Jan 2017 15:08:31 +0100 Message-Id: <20170119140835.18981-2-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170119140835.18981-1-abailon@baylibre.com> References: <20170119140835.18981-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 Thu Jan 19 14:08:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 91912 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp293252qgi; Thu, 19 Jan 2017 06:08:58 -0800 (PST) X-Received: by 10.84.172.131 with SMTP id n3mr13295065plb.5.1484834938712; Thu, 19 Jan 2017 06:08:58 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h88si3674019pfk.4.2017.01.19.06.08.58; Thu, 19 Jan 2017 06:08:58 -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 S1752894AbdASOI5 (ORCPT + 4 others); Thu, 19 Jan 2017 09:08:57 -0500 Received: from mail-wm0-f54.google.com ([74.125.82.54]:38452 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752694AbdASOIn (ORCPT ); Thu, 19 Jan 2017 09:08:43 -0500 Received: by mail-wm0-f54.google.com with SMTP id r144so78873664wme.1 for ; Thu, 19 Jan 2017 06:08:43 -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=LAZvhxngVQ1k27PqM0eZgULL5bcm+rh9bJgGksc0LmjaZ5KOZT15YvmR1Sp6+aTDn7 OyqBTSIVGNlgtCwdyLNw1dmeqtokkSKD/uXv5IGN5VgbD1MdufZUcBxgF93kU6/6AlY+ 41Ilj6AqrML39dPaN4E/NHUG7NizNknnWEME39a9xX+xyGmuMgM4JcuXpcZ9bDAzHvRU IbQb4Pz342VPX5+g/Q6bFIuXm8fHst3QGjM5vBey78GKBfqgjtUoDn1DECiwGLLxP4vw 2MyGsrdH4k304jc+nonny6SGL/rnFeEE6p8QY/dagHDnVsjGH148vXu7GiabC0k/+vW9 mqzg== 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=fwXvSB8Oss+I0wU2KcD3r5b58P1J46xXniBo/knuPId5Bhdln9R1TA//8h4By0M/+K KCOhOQ7Lgb6n/nBkV5VFX8mAwcCGZqu+npc2Sjb99CrN1nMPRgmK7FLhCEh2nj1sla3L jyrBZWKkX7N+T7OLQsI3xosmv5zGu4W3NL+xyajKcCN+O2dSDeq6OqdFu+g97ZZxpmj+ 78mSbm9aw7pftweRUlvt9PjxGB3qb16vGzLxXMXLf1uuV5FgaE+2L62QfhENnVhDPR1R oSgh3grpnXv9znalJkmH1A6b47rVDd4guaejQvk+MwR4+zXLpw17+PTD3xkfG/J8v1Cc yb+A== X-Gm-Message-State: AIkVDXKgfhPjzVonu22qECNDT8ArJRoWfnX7QWHMjKVCQHYpnn1cWLoD9x/4XUWM2RzB5eTq X-Received: by 10.223.169.140 with SMTP id b12mr7756061wrd.138.1484834922606; Thu, 19 Jan 2017 06:08:42 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id d64sm53546626wmh.3.2017.01.19.06.08.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Jan 2017 06:08:42 -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, grygorii.strashko@ti.com, linux-usb@vger.kernel.org, Alexandre Bailon Subject: [PATCH v3 2/5] usb: musb: Use shared irq Date: Thu, 19 Jan 2017 15:08:32 +0100 Message-Id: <20170119140835.18981-3-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170119140835.18981-1-abailon@baylibre.com> References: <20170119140835.18981-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 Thu Jan 19 14:08:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 91909 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp293170qgi; Thu, 19 Jan 2017 06:08:50 -0800 (PST) X-Received: by 10.98.1.213 with SMTP id 204mr10219293pfb.61.1484834930071; Thu, 19 Jan 2017 06:08:50 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h88si3674019pfk.4.2017.01.19.06.08.49; Thu, 19 Jan 2017 06:08:50 -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 S1752879AbdASOIq (ORCPT + 4 others); Thu, 19 Jan 2017 09:08:46 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:35543 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752812AbdASOIp (ORCPT ); Thu, 19 Jan 2017 09:08:45 -0500 Received: by mail-wm0-f50.google.com with SMTP id r126so291060207wmr.0 for ; Thu, 19 Jan 2017 06:08:44 -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=MF2vD+AmRfDoJ9A5wN4h03QQtRTFk0cQlK9Ic7jndUs=; b=2HVqJB3nosdPOzCLzaPfm16d829mjGe3RWgEQqdn+dkW04c0zic6QzRjHQAqPSiihq tl1N/ivHDQwQmUU/BVgHP++il3nhCP8AlHXgr3W2rL+T8abXTM9pMTEVv0aNybvP8cDN fZ05msleJI2ifjoNEJod0TKG/aQbsvvg532hqoNevC4lKiwxCdeEbRNjg1EZLqmSRHYf QyEmv8B9jr2F87xYofEyRMFCNNH3iUOLaXg1RQsorIZ1Rps67mXt8YwpBJDEIw9XJoK5 GvlElljvIDeH9Izmkf3padZrDO953Qb+YnjwYjxR/dqmYl9h+ZQerXIlnj0iRXxbepr8 0iYw== 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=MF2vD+AmRfDoJ9A5wN4h03QQtRTFk0cQlK9Ic7jndUs=; b=ET5tuh2j3gclBrN995bEc7Q8dHN7IJcelbqDQ7xAWAfK869s27SlEvn6Mo0IFDiNZg fqmd/dkRRzeXLZNAx5/qlJ6iEnD72RI5dCsj5vDbhr+pBR4wrsMCRvEaKqbJlz6m4Lyo Bv26wuCAvhf7X/TPMkIhAvJnXQAm932V8uZCYMOU83fEsjEtNekeo3UebP1PN1duby+i ystEwqCURVO3qBkklkIVEXWWxtMreh941cI0bkWGrGunDmTfjEvv835IhPtsIX+rjRAE 6LXyn1aVMiVeQAhlzd0r2qT9Nv3CydPI5ebxI78t4wn2DWKmcVFtf8ssKdnWH/1QWXvP lT3Q== X-Gm-Message-State: AIkVDXLpg4X4wUlCHwW6kXU662yK+4gb02DwAtNgmJxnvVUfSyVPQdE+r25d780kNvOrkq44 X-Received: by 10.223.160.180 with SMTP id m49mr2430502wrm.160.1484834923561; Thu, 19 Jan 2017 06:08:43 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id d64sm53546626wmh.3.2017.01.19.06.08.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Jan 2017 06:08:43 -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, grygorii.strashko@ti.com, linux-usb@vger.kernel.org, Alexandre Bailon Subject: [PATCH v3 3/5] usb: musb: Add support of CPPI 4.1 DMA controller to DA8xx Date: Thu, 19 Jan 2017 15:08:33 +0100 Message-Id: <20170119140835.18981-4-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170119140835.18981-1-abailon@baylibre.com> References: <20170119140835.18981-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..5f50a78 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_DM +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 Thu Jan 19 14:08:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 91911 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp293228qgi; Thu, 19 Jan 2017 06:08:56 -0800 (PST) X-Received: by 10.84.133.69 with SMTP id 63mr10425679plf.97.1484834936052; Thu, 19 Jan 2017 06:08:56 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h88si3674019pfk.4.2017.01.19.06.08.55; Thu, 19 Jan 2017 06:08:56 -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 S1752887AbdASOIx (ORCPT + 4 others); Thu, 19 Jan 2017 09:08:53 -0500 Received: from mail-wm0-f48.google.com ([74.125.82.48]:33959 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752718AbdASOIp (ORCPT ); Thu, 19 Jan 2017 09:08:45 -0500 Received: by mail-wm0-f48.google.com with SMTP id f73so6105287wmf.1 for ; Thu, 19 Jan 2017 06:08:45 -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=brn296tbhyqIZBTNK2gXtMyRJPKNh2Tu45s9F47VjuE=; b=HiP9tnLMZ5tP7y96lq8NWrUTys+QRPbokls67fjfy2TfetViG1eCSXi7CClPvu8o2f 3TUlR8phR8Rrg6UdjyHkDWT3CTEbopMaCkfWrTSLI87ZDeKPLQI/uCoBAbK5AmHLXUfX cQXo8iqhTOFerApoqTMQkc3F6YHfCE7oBEQwGSWW9COllDQzu+Rf03Wz2cFPwZ/0btnb yOxKdDCZ7Xi7C5j5NTjXy5i1a1wfxSJ4s8DIVD5j+kT2g/g14/w9TqtVy4NoU/7DLmUc elRCOnrcjN3DF/O5JzkJ00ddsaqw00G+dNcKO3VdlMgX5BH0QVJaEW4h8LOVNAxm2ZFJ Ju6Q== 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=brn296tbhyqIZBTNK2gXtMyRJPKNh2Tu45s9F47VjuE=; b=WP8XsL5rucdFAg3B9+AbHuaUlFUK9/TBFWDRvJLjdSwsGIE1cFguQkSpTctPRWzETW GSbvcUse08tf7Xn1pKg+/x4hVSrB3F7JCo3r04WXrKCfU1MUYwlRIbCZMpISqQezkqFV hwhtsUNjg3UZAtxe0+asem8QYGXMbtwGrtJKvnpgy0gNCCsUcZbQgB96/VgyW+v6BkKV FYwxj1Q8BbDpCDobdzDGPSM4yJqRueU2m0sLoCgN/auu2ju5djwQcc5h+JLunwmdnHUg YUzbT6+4zegFi29H0JsYIgj3baksAqWaoXi0zmrLC6ZlbaS8rihI7tb0PwHCmm4HfZZQ 9Ufg== X-Gm-Message-State: AIkVDXKEtPjgm8HN8RJ+FTAyoyJs1t6fXFQ81/31ktYKNoh+gC/T5WoeLHAlgmtLro3RfIII X-Received: by 10.223.177.130 with SMTP id q2mr7783675wra.39.1484834924470; Thu, 19 Jan 2017 06:08:44 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id d64sm53546626wmh.3.2017.01.19.06.08.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Jan 2017 06:08:43 -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, grygorii.strashko@ti.com, linux-usb@vger.kernel.org, Alexandre Bailon Subject: [PATCH v3 4/5] usb: musb: musb_cppi41: Workaround DMA stall issue during teardown Date: Thu, 19 Jan 2017 15:08:34 +0100 Message-Id: <20170119140835.18981-5-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170119140835.18981-1-abailon@baylibre.com> References: <20170119140835.18981-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 5f50a78..8c9850c 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 1fe7eae..d371d05 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c @@ -554,6 +554,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 Thu Jan 19 14:08:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 91910 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp293182qgi; Thu, 19 Jan 2017 06:08:51 -0800 (PST) X-Received: by 10.98.66.138 with SMTP id h10mr10113939pfd.94.1484834931225; Thu, 19 Jan 2017 06:08:51 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h88si3674019pfk.4.2017.01.19.06.08.51; Thu, 19 Jan 2017 06:08:51 -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 S1752884AbdASOIs (ORCPT + 4 others); Thu, 19 Jan 2017 09:08:48 -0500 Received: from mail-wm0-f47.google.com ([74.125.82.47]:38503 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752869AbdASOIr (ORCPT ); Thu, 19 Jan 2017 09:08:47 -0500 Received: by mail-wm0-f47.google.com with SMTP id r144so78876082wme.1 for ; Thu, 19 Jan 2017 06:08:46 -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=biuRaR4qumnJY4A5XhG1RCCjITW/V/xZwlnjfJnF+no=; b=aFhr9bgHjh2DRGsKl0yk695Wev9S/VYXuV0fa/zo8bp6ghYzA5BJwzVJiiiKtVjin+ bh4wxqIr4w8qsBnPZ7nMFShpeHqBC6oUMFZ5RKhgBtAWYslW2n/pBQEirogsjzZTamkU Qt/KtEHF1Ibdzv3TFn4oVHOL62Z5Dz3LX2bPPX9RFfjzKOOClgnLSKVL5+pJEu940gXX EoUOOchBXpokyvHlaaNTblzvbnLBkET1z2C0SFvlp8qftIYBny4o1Eig6CMeCjTwik2C DOKtBxAzFIP+iQ31+Lt88wIEkQ3NfvF+cwved3K4GWAoW0rnZUkbUl8MCr2l0cGMaSfy fbUg== 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=biuRaR4qumnJY4A5XhG1RCCjITW/V/xZwlnjfJnF+no=; b=PXbeXFcaID0GcintmRm8moDuZY/A0drbsObgM4/1p39ar+IZ3lDN0rTVDVR8p0GmRE qeTCkO3TznU8jjygadAApGV0cRyvpHXFOMqCl61v0qUdTW7PP08UAMd8w3zqMxhEHuw9 /zlt6zjmtXALvFM2zUwexMBOc3PWgw2/N+RrkgGTZVISE0qiEouPgJF6fxDZs3R1httB 0E0qRYar5K0ICjiQ4GHK17OCvKaPVckoP0snIZaCwNIh9IAh7PDgk23eMqEVNpNTHkrZ g9a1+RZz5MyrkPsdkgbTxrjAMojCmWp02cw08mbz2wbf49q2821Mf3Hs+18STtbW4ArX /KJQ== X-Gm-Message-State: AIkVDXLRPcxVoOSjOvp15kBDvsDy07axRt6YEewCPNw7uRbh2CL7aR6JylYx4Sr0neeyudp7 X-Received: by 10.223.160.206 with SMTP id n14mr7732350wrn.31.1484834925527; Thu, 19 Jan 2017 06:08:45 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id d64sm53546626wmh.3.2017.01.19.06.08.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Jan 2017 06:08:44 -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, grygorii.strashko@ti.com, linux-usb@vger.kernel.org, Alexandre Bailon Subject: [PATCH v3 5/5] usb: musb: da8xx: Add a primary support of PM runtime Date: Thu, 19 Jan 2017 15:08:35 +0100 Message-Id: <20170119140835.18981-6-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170119140835.18981-1-abailon@baylibre.com> References: <20170119140835.18981-1-abailon@baylibre.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Currently, DA8xx doesn't support PM runtime. In addition, the glue driver is managing the clock itself. But the CPPI DMA needs to manage this clock too. Add support to PM runtime and use the callback to enable / disable the clock. And because the CPPI 4.1 is a child of Da8xx USB, it will be able to enable / disable 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 8c9850c..c4478c7 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_sync(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_sync(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; }