From patchwork Tue Jan 17 14:35:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 91667 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp518496qgi; Tue, 17 Jan 2017 06:35:51 -0800 (PST) X-Received: by 10.84.218.76 with SMTP id f12mr59018595plm.146.1484663751634; Tue, 17 Jan 2017 06:35:51 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 61si19063841pld.335.2017.01.17.06.35.51; Tue, 17 Jan 2017 06:35:51 -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 S1751395AbdAQOfn (ORCPT + 4 others); Tue, 17 Jan 2017 09:35:43 -0500 Received: from mail-wm0-f49.google.com ([74.125.82.49]:35397 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751389AbdAQOfm (ORCPT ); Tue, 17 Jan 2017 09:35:42 -0500 Received: by mail-wm0-f49.google.com with SMTP id r126so203355006wmr.0 for ; Tue, 17 Jan 2017 06:35:41 -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=mx2/Mdg4G7Qxfk/i8rTTeUh1uoUXo8mBWHhXDecWtOY=; b=Fc34fgObERdO+0v1qG3ZmhBw3dUNgezxzkDlawZhUbMSwcYwGuuTUd8VYc1eCm2hRy aYFGS14ykQPK0vQFJQt0ZDhLVvtU80wPwUPXYOMzZpvNNkSNIZ2I76yme2sh1kk7wEPx 1/I6ns7dSkmFJ5pllsOGXWl5i7uLRM6FUJiUAYWMhIQYzrOhx0YWdWWqhBGg4BeHrYc0 ybHusC2X9z3Gj9K7BBqjESmI1zH9acfJjIMdauF91w10uyBV2EpiFWR+jgUIDLG/6zH5 ALy+K/FD6WaDp/4eOILfgvAbpat6KhQSEr2fpxTNrweH7HgZRNk7W2+GWBDb4YYi8Rc7 tRyA== 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=mx2/Mdg4G7Qxfk/i8rTTeUh1uoUXo8mBWHhXDecWtOY=; b=WWVSn6+xuKPuR0KvbtCTLXg2gRaLV4zz11zxneZ0p44vLo5oPScFAjKx1UAYUTN+IS DRnFQlR1ZGPe7djedIrC9MjsEZv+vbcyo5hbDUar2iK/giyXA/6WK5o9Qd7RpDmwSAd6 +EjfrffRzI3NdUI2EJFAbvrQ7tcRxMeoMZT2aU/UiKNPEZkkRjnjnPR4BDOo5caAFBJK pg01IUMQ22HxP8Z6wuX0gDLJ52hE7a4MH7lItd7t4ee6CTI1+97PHO9GgZD7WaVqzDxA OJ2dVHXnD2oZJK0DRXf6rqgVOgJVOUGaf6jz6ao4KPlPpOEVrxjv4PJ4MFyZiaXX5W34 498A== X-Gm-Message-State: AIkVDXL14hZ0nXKg9+AAnZHGx6nh3zpFONGEWwiQi4j6Kzderi/+5pMx642zoYUSOy+WwS11 X-Received: by 10.28.35.65 with SMTP id j62mr15409319wmj.31.1484663735459; Tue, 17 Jan 2017 06:35:35 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id k11sm37394939wmb.18.2017.01.17.06.35.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jan 2017 06:35:35 -0800 (PST) From: Alexandre Bailon To: b-liu@ti.com Cc: vinod.koul@intel.com, dmaengine@vger.kernel.org, nsekhar@ti.com, khilman@baylibre.com, ptitiano@baylibre.com, tony@atomide.com, linux-omap@vger.kernel.org, sergei.shtylyov@cogentembedded.com, Alexandre Bailon Subject: [PATCH v2 1/5] usb: musb: da8xx: Remove CPPI 3.0 quirk and methods Date: Tue, 17 Jan 2017 15:35:24 +0100 Message-Id: <20170117143528.11404-2-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170117143528.11404-1-abailon@baylibre.com> References: <20170117143528.11404-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. Signed-off-by: Alexandre Bailon --- 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 Acked-by: Sergei Shtylyov Acked-by: Tony Lindgren 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 17 14:35:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 91666 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp518492qgi; Tue, 17 Jan 2017 06:35:51 -0800 (PST) X-Received: by 10.84.179.194 with SMTP id b60mr59707264plc.147.1484663751069; Tue, 17 Jan 2017 06:35:51 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 61si19063841pld.335.2017.01.17.06.35.50; Tue, 17 Jan 2017 06:35:51 -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 S1751228AbdAQOfl (ORCPT + 4 others); Tue, 17 Jan 2017 09:35:41 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:36899 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751386AbdAQOfi (ORCPT ); Tue, 17 Jan 2017 09:35:38 -0500 Received: by mail-wm0-f42.google.com with SMTP id c206so225715500wme.0 for ; Tue, 17 Jan 2017 06:35:37 -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=oQiKcbXF7cLeT+jAZM3NJx575Tr1HKB2nj1euslWBGuMwUnymOBhXBnQmuUaFD1228 nRgBGbNWDcfhYL510lAhzPb26JYrslNaYyQO5csp0aM+iInvyBNa9nFAZPorC5rmq4Fw tByt+G0eZu8afIlx003kWNuCsfRJJgZKVrxltsz0zroyD7gc71iqdAAmNMSYEG52SwYM C8YqUGZoUnzB3Tm8V++owwrD37z4U4TtBRVP4RRad5f0MG7dNoJogIuS+xvo2ZVDU/F5 gRnjAyBualjY92iemrCWXKQbVAJ6Du4Fjs4KrShDWJhcmNkaeDFY+iwVc+Jb5r3nsqGu YMyw== 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=rRsDGp3QG9L+xvGU16NJ3Gg7aXR+RSdKxqlb/hxrUmr4F2mMGtCKzt/LtAuuszV1YU S3LxkznBFKVnA6OLTb/FRRuGpcJcrRMxPzi+8vSkx/2cHyIflJdIaCXw2ceFcEX4obql JukLSJOk67AH+6h/TwgzdmAMlHPR476V7YkgZTvuocMMrKrr5NI3/u5r4O51MMZZrP2N wOuX9gDnYV1/RvcUVGGkFn47y9S+uaIJMZYWl2bdayYxjr7H0xVJUduQx5l1c3UHVQMa r6eLDCvDOS1xszSKFHPIePWmCde8Lh14AQeLzMccb+7ArGukfVp1DnhLltHUz6T6Its9 vzIg== X-Gm-Message-State: AIkVDXKYjkAWnssZXVoG1s/PbU6GZ+sm/1pHIpzHZ+01b6bWycP+fHK3dkTw+laroUqC62FU X-Received: by 10.223.176.142 with SMTP id i14mr28000775wra.4.1484663736713; Tue, 17 Jan 2017 06:35:36 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id k11sm37394939wmb.18.2017.01.17.06.35.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jan 2017 06:35:36 -0800 (PST) From: Alexandre Bailon To: b-liu@ti.com Cc: vinod.koul@intel.com, dmaengine@vger.kernel.org, nsekhar@ti.com, khilman@baylibre.com, ptitiano@baylibre.com, tony@atomide.com, linux-omap@vger.kernel.org, sergei.shtylyov@cogentembedded.com, Alexandre Bailon Subject: [PATCH v2 2/5] usb: musb: Use shared irq Date: Tue, 17 Jan 2017 15:35:25 +0100 Message-Id: <20170117143528.11404-3-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170117143528.11404-1-abailon@baylibre.com> References: <20170117143528.11404-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 Tue Jan 17 14:35:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 91669 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp518506qgi; Tue, 17 Jan 2017 06:35:52 -0800 (PST) X-Received: by 10.98.24.14 with SMTP id 14mr35725410pfy.73.1484663752543; Tue, 17 Jan 2017 06:35:52 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 61si19063841pld.335.2017.01.17.06.35.52; Tue, 17 Jan 2017 06:35:52 -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 S1751045AbdAQOfq (ORCPT + 4 others); Tue, 17 Jan 2017 09:35:46 -0500 Received: from mail-wm0-f49.google.com ([74.125.82.49]:35439 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751389AbdAQOfp (ORCPT ); Tue, 17 Jan 2017 09:35:45 -0500 Received: by mail-wm0-f49.google.com with SMTP id r126so203357054wmr.0 for ; Tue, 17 Jan 2017 06:35: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=bOhzKQXBV+lOXVdQi2ouTHD+PVxVUUhsAwQ0SXg5SoM=; b=j+WLxIUYj+ovEgejzq4Z68/MmUkWRkBPwI6Zy4tYvkTrjYSb+8XCWjCUiC+hJTVTXB x/fOs26ZII4JjD+yXORGl4zDvGY+zHr7X51v+MnokoWmJbe3Y6m+qw0MiBiRIV7ruOgp 05QDNMQDoi2dTSXf9NCb/rtqrEfI/MbbOMIM1jHYPWSVC1RnZkeHWsGDt/fpuDrHQdx7 s1ZAZi9A27RJPTfRP/WAiU2nHs3QSg64kP7p2QM026HrG128LP4IrGjzJhAX1iW8yW4S Np/v8OQYyQbvPzXX7T0w8NjYzwkITa4I1CZ6dgtlOnqzycod8GMWdcmsjCtcO5RuqRl9 Y92A== 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=bOhzKQXBV+lOXVdQi2ouTHD+PVxVUUhsAwQ0SXg5SoM=; b=IqUPWsooe8CfBRKTGqn5AFxQoGDRj/+cmVRPGzJCgsap8mjJ0LXaZn9Av8hyengmrx KJa4ciFFMT34PvQBKG7K8x1eKClvbGvPKNrDSC/uZHGLx5yMFgYK5gjVTFSYlE8av++B TvWLvsg5YhrIY/aknWp630n019jg3nU5qXT8dtC841UW5MwKLYHbMMVG8MDI245ui/7K +9wJ6d+IFFHGzOt3eMykoZLf6CZBTVjIjheNQmF0pGLC1KjxCwQS+SPnSPsOKjwDOqOs F5M/qifWOu83Pn5UsIKgYybQNfle/TyVkvFAtcwWlm6bqpMHUbjcJYQhiTkqCjV7rt4x zOow== X-Gm-Message-State: AIkVDXKD7xxn1zZsFKjEuq7p/0xIByNLEHr9s8Kw0J/g2sZ+v5ntPWwLkkpfQPswsFJgcAcb X-Received: by 10.223.166.106 with SMTP id k97mr31613827wrc.170.1484663738474; Tue, 17 Jan 2017 06:35:38 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id k11sm37394939wmb.18.2017.01.17.06.35.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jan 2017 06:35:37 -0800 (PST) From: Alexandre Bailon To: b-liu@ti.com Cc: vinod.koul@intel.com, dmaengine@vger.kernel.org, nsekhar@ti.com, khilman@baylibre.com, ptitiano@baylibre.com, tony@atomide.com, linux-omap@vger.kernel.org, sergei.shtylyov@cogentembedded.com, Alexandre Bailon Subject: [PATCH v2 3/5] usb: musb: Add support of CPPI 4.1 DMA controller to DA8xx Date: Tue, 17 Jan 2017 15:35:26 +0100 Message-Id: <20170117143528.11404-4-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170117143528.11404-1-abailon@baylibre.com> References: <20170117143528.11404-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/dma/Kconfig | 2 +- drivers/usb/musb/Kconfig | 4 ++-- drivers/usb/musb/da8xx.c | 32 +++++++++++++++++++++++++++++++- 3 files changed, 34 insertions(+), 4 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/dma/Kconfig b/drivers/dma/Kconfig index 0d6a96e..8fe9de7 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -515,7 +515,7 @@ config TIMB_DMA config TI_CPPI41 tristate "AM33xx CPPI41 DMA support" - depends on ARCH_OMAP + depends on (ARCH_OMAP || ARCH_DAVINCI_DA8XX) select DMA_ENGINE help The Communications Port Programming Interface (CPPI) 4.1 DMA engine diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 72a2a50..3018518 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 (AM335x or DA8xx)' + 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..be2d0eb 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -89,6 +90,8 @@ struct da8xx_glue { struct phy *phy; }; +static void da8xx_dma_controller_callback(struct musb *musb); + /* * Because we don't set CTRL.UINT, it's "important" to: * - not read/write INTRUSB/INTRUSBE (except during @@ -457,12 +460,35 @@ static inline u8 get_vbus_power(struct device *dev) return current_uA / 1000 / 2; } +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)) + cppi41_register_dma_callback(controller, + da8xx_dma_controller_callback); + return controller; +} + +static void da8xx_dma_controller_callback(struct musb *musb) +{ + void __iomem *reg_base = musb->ctrl_base; + + musb_writel(reg_base, DA8XX_USB_END_OF_INTR_REG, 0); +} + 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 +560,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 17 14:35:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 91670 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp518510qgi; Tue, 17 Jan 2017 06:35:53 -0800 (PST) X-Received: by 10.99.61.13 with SMTP id k13mr46619277pga.154.1484663753041; Tue, 17 Jan 2017 06:35:53 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 61si19063841pld.335.2017.01.17.06.35.52; Tue, 17 Jan 2017 06:35:53 -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 S1751400AbdAQOft (ORCPT + 4 others); Tue, 17 Jan 2017 09:35:49 -0500 Received: from mail-wm0-f48.google.com ([74.125.82.48]:33365 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751393AbdAQOfq (ORCPT ); Tue, 17 Jan 2017 09:35:46 -0500 Received: by mail-wm0-f48.google.com with SMTP id d140so21366885wmd.0 for ; Tue, 17 Jan 2017 06:35: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=IhGzjebBhI/AoXIZOC0k20QebcmCfoIi86o8oDmHiwM=; b=PO4lWF8rOBi3dOiCtpebv9CXv6uDslxwJFCUs4dYzZhpNjSbiNJdXb125Jr8cbc00I CZ00cahf8pDaiZZT1GJ8k07hJwk2YrSwkesvlrWHzvwOydmQx8OeEsaloHNbOBJKRdCh 1Zg3nePktwwfMTCO846OTsZhz2uN7E4uNlO9vJKpCa7urdt8ugzikMEcVGev19QUm9Gc xhwSChluxQaJTqOLsfvVpy6Dq96BGSZV540uKRXs259AAL/k7uZOkXx6UjoyXpLwrW70 42jXLjPDVcZrtHzsHINQtOpAHzmJtDGUPAwQkeyK+dk+coKDXW35uOZfy/XPXhPoXRx8 S7QQ== 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=IhGzjebBhI/AoXIZOC0k20QebcmCfoIi86o8oDmHiwM=; b=BFTtMCtEHE+jgpzAOs2F9XC5335m3CYm+4FRmSASTZ33QgYRDrUBcTnEy+8Ht4mCL1 pmynnEz4tvJKOODQLkYDeoTaJs5aGuUunWbasTMCcCM93v1aePXG451dXt6QWzHqYCVE 6OYSFYbeaC/LZT0DKWs0Va1xz5geKN7R3YmcLUCsV58zyw9Q8WCa5v3S3OdmrG92uT99 iR27HGyYfx6cv8cE4wy9nrfR9knzlY1YNzpRuIXDHU0VciU+k2WI2+/u1SobOxCa33DQ GsvcsTCtqbl8m9WD9j3yM5TNO9jKv21YdwKWTwE6q3H5NuGBQldx7/4Rrn8ZFwxDB3No akaQ== X-Gm-Message-State: AIkVDXI8jusjNuEcYGy7XD01L+6CRfAUrriGyEBF3GbKKry9UIgtdNv9gZxmEVYxDR8WHbT4 X-Received: by 10.223.176.210 with SMTP id j18mr27790280wra.8.1484663739727; Tue, 17 Jan 2017 06:35:39 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id k11sm37394939wmb.18.2017.01.17.06.35.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jan 2017 06:35:39 -0800 (PST) From: Alexandre Bailon To: b-liu@ti.com Cc: vinod.koul@intel.com, dmaengine@vger.kernel.org, nsekhar@ti.com, khilman@baylibre.com, ptitiano@baylibre.com, tony@atomide.com, linux-omap@vger.kernel.org, sergei.shtylyov@cogentembedded.com, Alexandre Bailon Subject: [PATCH v2 4/5] usb: musb: musb_cppi41: Workaround DMA stall issue during teardown Date: Tue, 17 Jan 2017 15:35:27 +0100 Message-Id: <20170117143528.11404-5-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170117143528.11404-1-abailon@baylibre.com> References: <20170117143528.11404-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 be2d0eb..046356f 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -480,7 +480,7 @@ static void da8xx_dma_controller_callback(struct musb *musb) } 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 f182c07..b9af602 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c @@ -566,6 +566,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 17 14:35:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 91668 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp518499qgi; Tue, 17 Jan 2017 06:35:52 -0800 (PST) X-Received: by 10.84.129.131 with SMTP id b3mr58028435plb.54.1484663752176; Tue, 17 Jan 2017 06:35:52 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 61si19063841pld.335.2017.01.17.06.35.52; Tue, 17 Jan 2017 06:35:52 -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 S1751394AbdAQOfp (ORCPT + 4 others); Tue, 17 Jan 2017 09:35:45 -0500 Received: from mail-wm0-f43.google.com ([74.125.82.43]:35476 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751386AbdAQOfm (ORCPT ); Tue, 17 Jan 2017 09:35:42 -0500 Received: by mail-wm0-f43.google.com with SMTP id r126so203358763wmr.0 for ; Tue, 17 Jan 2017 06:35:41 -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=awC65UmPIRgoCgyeY606qntMWyjVQFeLu8xp6PCY1WE=; b=TMQls8kQC3lU8XD40zfM0yFTAB8BTArCK4pkf+e29Qe6D6tKU4j78fCHpxRNjlKq0G fP60aQNPmP4D3eurju1HYNgCGdRoAUzDXtkDoOuJnrWpfXcjVBFdXCdsEyeOnUB9XpAO 20XzZCPwvLjYODTiIGeIyzmVSn09b2761ZkQmZyqxjgoopkY0TueRb9M9O54J475Tic4 tHoBY4Q71wpY8Oc5IYXW43DvzEWIppDPPgVzXdyeeuYKxgkvG6VDDP5a6P+/kvg5jbrw n5ZTuDRnPfuYAkdqbZ6AdMpuspYTPqtmdFWwaAKjKyei6WHPx4wDG3NrudE6lSsvvGvD 9p9g== 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=awC65UmPIRgoCgyeY606qntMWyjVQFeLu8xp6PCY1WE=; b=IJq7Lqf3XAMaAlriUbRreYG878P43pAG1Wc2Ia+c4bMnst4E67LOfbDOyUn2O9rbFp woXyhbKm3WFccAVjXZx4DdgYgP2xtEeWYIkI2mmV/oEeMLpCrhrWcAbHuvv6kmMGMTPC 763aRbNvWmO2/Wh4YRqyA9Rr5ZcteYJU7+Bk9iBRi5cwF77RGEYMRbcMwRyiT2vT5GO2 YNGD248AXImd/ZVVvWawireU2YcQaVthojyTQiVM0opuR8rBXEmwbtFheQYaxmHX2zNM Af5fr0wgiJb/7r6NQiU6ZozKrIew07Sm8VSqRjLlKAX4dkDXAqW5tp6jvJGLn/maX3vM z39Q== X-Gm-Message-State: AIkVDXLLipVClju2J2BwJreaJzc1a1mmfrij2xcSxQjwOq/x63WRhdnn13SL66EyzXxHF/vj X-Received: by 10.223.136.109 with SMTP id e42mr18093074wre.14.1484663740959; Tue, 17 Jan 2017 06:35:40 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id k11sm37394939wmb.18.2017.01.17.06.35.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jan 2017 06:35:40 -0800 (PST) From: Alexandre Bailon To: b-liu@ti.com Cc: vinod.koul@intel.com, dmaengine@vger.kernel.org, nsekhar@ti.com, khilman@baylibre.com, ptitiano@baylibre.com, tony@atomide.com, linux-omap@vger.kernel.org, sergei.shtylyov@cogentembedded.com, Alexandre Bailon Subject: [PATCH v2 5/5] usb: musb: da8xx: Add a primary support of PM runtime Date: Tue, 17 Jan 2017 15:35:28 +0100 Message-Id: <20170117143528.11404-6-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170117143528.11404-1-abailon@baylibre.com> References: <20170117143528.11404-1-abailon@baylibre.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@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 | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 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 046356f..e67c41d 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -379,11 +379,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(musb->controller->parent); /* Returns zero if e.g. not clocked */ rev = musb_readl(reg_base, DA8XX_USB_REVISION_REG); @@ -426,7 +422,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; } @@ -438,7 +434,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); @@ -584,6 +580,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) { @@ -614,12 +612,41 @@ static const struct of_device_id da8xx_id_table[] = { MODULE_DEVICE_TABLE(of, da8xx_id_table); #endif +static int da8xx_runtime_suspend(struct device *dev) +{ + struct da8xx_glue *glue = dev_get_drvdata(dev); + + clk_disable_unprepare(glue->clk); + + return 0; +} + +static int da8xx_runtime_resume(struct device *dev) +{ + int ret; + struct da8xx_glue *glue = dev_get_drvdata(dev); + + ret = clk_prepare_enable(glue->clk); + if (ret) { + dev_err(glue->dev, "failed to enable clock\n"); + return ret; + } + + return 0; +} + +static const struct dev_pm_ops da8xx_pm_ops = { + .runtime_suspend = da8xx_runtime_suspend, + .runtime_resume = da8xx_runtime_resume, +}; + static struct platform_driver da8xx_driver = { .probe = da8xx_probe, .remove = da8xx_remove, .driver = { .name = "musb-da8xx", .of_match_table = of_match_ptr(da8xx_id_table), + .pm = &da8xx_pm_ops, }, };