From patchwork Mon Nov 28 16:26:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 84423 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1210642qgi; Mon, 28 Nov 2016 08:26:31 -0800 (PST) X-Received: by 10.84.171.1 with SMTP id k1mr51887234plb.169.1480350391297; Mon, 28 Nov 2016 08:26:31 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a24si55876310pfg.259.2016.11.28.08.26.31; Mon, 28 Nov 2016 08:26:31 -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 S932978AbcK1Q03 (ORCPT + 4 others); Mon, 28 Nov 2016 11:26:29 -0500 Received: from mail-wm0-f47.google.com ([74.125.82.47]:37922 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932949AbcK1Q01 (ORCPT ); Mon, 28 Nov 2016 11:26:27 -0500 Received: by mail-wm0-f47.google.com with SMTP id f82so160774739wmf.1 for ; Mon, 28 Nov 2016 08:26: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=0F/We8LwlgCPXDb/U7Kzgnjz5zpolMWnuozZPjcRa1U=; b=y94cHHqMnrlFm3JwRGTkN+bVSr95xpB+1V2BZiYqYQQuER1bcYepDmlbFW36o0nwDj UMaPD3k8LU1GLzfzzUZHrUeUFSkhyxPvHcmN5ugDiFSsgYPEJVwVeJjbaGcYWjzH5Ypf L/j4TEXqvG1n/6ceRjLoFB3VPzQDlDqpUD8R0pJIk8Gtp8a1cKIcEHJNL8F/cgk8kKhJ KvKtlxQPQfo9koD1tGmDjNp24wQk/Of+2zFLfIh9cH0UH66b4lRGZbNbcsS/yCjIFA+l T663q5tT6EaqQiiO1I0MeEg6lNrHdHorevikVncCxe3og2x9FBSkv6pxhTFHBSLJ4Bze ngtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0F/We8LwlgCPXDb/U7Kzgnjz5zpolMWnuozZPjcRa1U=; b=ZzhFtA+ca1QczFFzqgJKSCsHNcdZ9yTYdgH7D2sQxI5D+QLrFNsxXg8+4qAXXuuP91 DPTWVmjUsOC3Qqv3bblsdZtCiim839QWCIRKfSqzNdl6gZhOz1UAKdVeANStJYQ/Ui9y UHcmmXZZHoaEIM8cQpThDba13ieeM9NAJ3ZYzQ+naPiuzAjcF8z4aFEuetg4ED2E+Jz3 p8jntbAUi8x3CqTnPnnRN6zla27WjwrAVFpKrpYV8wPVRyPGt9CLd0KWtqr/GLiYbJfE JjJSaCnf91hhzT4+SVbWwl/jdHk2R2qnGpy1yUNw2iECVELgd4/Xkqu+GowSXSKnFB9O BziA== X-Gm-Message-State: AKaTC01S6HGwHanVtgidsAmu9UmWFSnRhjfap6+/2sL+n+xkIbH/7KuVe7sAhfWt2hNdYnZ2 X-Received: by 10.28.47.15 with SMTP id v15mr20643106wmv.76.1480350385504; Mon, 28 Nov 2016 08:26:25 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id t82sm29710641wmd.17.2016.11.28.08.26.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Nov 2016 08:26:25 -0800 (PST) From: Alexandre Bailon To: b-liu@ti.com Cc: linux-usb@vger.kernel.org, nsekhar@ti.com, khilman@baylibre.com, ptitiano@baylibre.com, Alexandre Bailon Subject: [PATCH 2/3] usb: musb: Add a quirk to preserve MUSB_DEVCTL during suspend Date: Mon, 28 Nov 2016 17:26:20 +0100 Message-Id: <1480350381-26151-3-git-send-email-abailon@baylibre.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1480350381-26151-1-git-send-email-abailon@baylibre.com> References: <1480350381-26151-1-git-send-email-abailon@baylibre.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On da8xx, VBUS is not maintained during suspend when musb is in host mode. On resume, all the connected devices will be disconnected and then will be enumerated again. This happens because MUSB_DEVCTL is cleared during suspend. Add a quirk to preserve MUSB_DEVCTL during a suspend. Signed-off-by: Alexandre Bailon --- drivers/usb/musb/musb_core.c | 13 +++++++------ drivers/usb/musb/musb_core.h | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) -- 2.7.3 -- 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 9e22646..7e2cd98 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1040,14 +1040,15 @@ static void musb_enable_interrupts(struct musb *musb) } -static void musb_generic_disable(struct musb *musb) +static void musb_generic_disable(struct musb *musb, bool suspend) { void __iomem *mbase = musb->mregs; musb_disable_interrupts(musb); /* off */ - musb_writeb(mbase, MUSB_DEVCTL, 0); + if (!suspend || !(musb->io.quirks & MUSB_PRESERVE_DEVCTL)) + musb_writeb(mbase, MUSB_DEVCTL, 0); } /* @@ -1106,7 +1107,7 @@ void musb_stop(struct musb *musb) { /* stop IRQs, timers, ... */ musb_platform_disable(musb); - musb_generic_disable(musb); + musb_generic_disable(musb, false); musb_dbg(musb, "HDRC disabled"); /* FIXME @@ -2310,7 +2311,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) /* be sure interrupts are disabled before connecting ISR */ musb_platform_disable(musb); - musb_generic_disable(musb); + musb_generic_disable(musb, false); /* Init IRQ workqueue before request_irq */ INIT_DELAYED_WORK(&musb->irq_work, musb_irq_work); @@ -2486,7 +2487,7 @@ static int musb_remove(struct platform_device *pdev) musb_gadget_cleanup(musb); spin_lock_irqsave(&musb->lock, flags); musb_platform_disable(musb); - musb_generic_disable(musb); + musb_generic_disable(musb, false); spin_unlock_irqrestore(&musb->lock, flags); musb_writeb(musb->mregs, MUSB_DEVCTL, 0); pm_runtime_dont_use_autosuspend(musb->controller); @@ -2663,7 +2664,7 @@ static int musb_suspend(struct device *dev) unsigned long flags; musb_platform_disable(musb); - musb_generic_disable(musb); + musb_generic_disable(musb, true); WARN_ON(!list_empty(&musb->pending_list)); spin_lock_irqsave(&musb->lock, flags); diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index a611e2f..22961ef 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_PRESERVE_DEVCTL BIT(7) #define MUSB_DMA_UX500 BIT(6) #define MUSB_DMA_CPPI41 BIT(5) #define MUSB_DMA_CPPI BIT(4)