Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2736375imj; Mon, 11 Feb 2019 07:44:04 -0800 (PST) X-Google-Smtp-Source: AHgI3IbMRWZjQPhWc/4EQs8xSXmvesrba6GUIrDlcKg0Ql7k7aEvEJE5zWnaPusNEM8fQ3diqXR0 X-Received: by 2002:a62:4bd5:: with SMTP id d82mr11257894pfj.85.1549899843919; Mon, 11 Feb 2019 07:44:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549899843; cv=none; d=google.com; s=arc-20160816; b=r/WvaBGgY6p4MWzHFO49doQi2fPqvRauhpyL6JhWyGB5oUT7WojtwCbBbSc1t6sqzO C9InBhjmol8VQc8wH74MbaeTnI1Zkxjz18y37D+e7fItLfaYkhwzA2TooixR+biBd6a8 PMHm5xsWdtIlwAHaioqt+nImdnePyCpL8v9WEG2OGBHHnrxKDEXbFnxTPaTXT+5fs8QU Dnxcg8Sa1jz/CncagCN/jIQQGAgsphT5Fap+bvNHUg6ejaJDUa5FLzGQjSUi2s9pWnAN iXk8Rj/1QY1IFbT/qPEj6XSnctklCCBKHR/42wJLGsh6HvV8MEgYIU/nyB5oXEJMAgW6 fuxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ulbuh6YtOhBJjLMwBvpx9Sq3xofTOuxIYSHHVYY9dFg=; b=zBjJaQoMlW7F5zmvpBGmvrJz6Tk2/3zx7cLtIoWiM/PQOskeDlv2xEdtyPe4CeTHhq kQGlgDN+ooPlBwRP0YVcf6yVBwboQewBIcorppETOJMAae+QmbLaII9AZIX38jMV+04S TO5ol+ehTzsBqoHiIXk7XenfYJDsu0iZ5ts9vKxQMPu5AJiY2ASPQNDwp8KrE0q8NCif IdWh80Qh7ps+nk+dNiYMMv6BCLyICdi7rAYa3yJGZ0EEayuWjX4Eb6xp3+968tuMfLpS LEROajSd2cQhPLtkfPkNZpeOdgNsRPCYHxnNtzfl8Y3wwdBOnTbtmDK+DbCiAqcfig3V /tdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WrHApATH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 13si10408078pld.398.2019.02.11.07.43.47; Mon, 11 Feb 2019 07:44:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WrHApATH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733266AbfBKOqg (ORCPT + 99 others); Mon, 11 Feb 2019 09:46:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:59660 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733254AbfBKOqb (ORCPT ); Mon, 11 Feb 2019 09:46:31 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 77ED4206BA; Mon, 11 Feb 2019 14:46:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549896390; bh=Bj0tR+1MSMXlK8KkE3YYqhnhOyunEgRR9JJQmJg27Ms=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WrHApATHAF4LVibb46Nhouiu8AYnvpRubqkysqYfiD1mC7ChNLL1tGFP05c7j7fDo 87C2bFplOkmkTW6K9bJd6+Rw0VdE6NEH4yTc2tPpmh4YNCbEkRZu43yY6VulDJ2Cqa NfWwhYXRltjMoh1GypnASxiG0BkNZoP8g0AtbP0M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tony Lindgren , Bin Liu , Sasha Levin Subject: [PATCH 4.19 169/313] usb: musb: dsps: fix runtime pm for peripheral mode Date: Mon, 11 Feb 2019 15:17:29 +0100 Message-Id: <20190211141904.701598932@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141852.749630980@linuxfoundation.org> References: <20190211141852.749630980@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 54578ee883e34d2d1c518d48f1c1e2dd3f387188 ] Since the runtime PM support was added in musb, dsps relies on the timer calling otg_timer() to activate the usb subsystem. However the driver doesn't enable the timer for peripheral port, then the peripheral port is unable to be enumerated by a host if the other usb port is disabled or in peripheral mode too. So let's start the timer for peripheral port too. Fixes: ea2f35c01d5e ("usb: musb: Fix sleeping function called from invalid context for hdrc glue") Acked-by: Tony Lindgren Signed-off-by: Bin Liu Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/musb/musb_dsps.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 1e6d78b1334e..403eb97915f8 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -181,9 +181,11 @@ static void dsps_musb_enable(struct musb *musb) musb_writel(reg_base, wrp->epintr_set, epmask); musb_writel(reg_base, wrp->coreintr_set, coremask); - /* start polling for ID change in dual-role idle mode */ - if (musb->xceiv->otg->state == OTG_STATE_B_IDLE && - musb->port_mode == MUSB_OTG) + /* + * start polling for runtime PM active and idle, + * and for ID change in dual-role idle mode. + */ + if (musb->xceiv->otg->state == OTG_STATE_B_IDLE) dsps_mod_timer(glue, -1); } @@ -254,6 +256,10 @@ static int dsps_check_status(struct musb *musb, void *unused) musb->xceiv->otg->state = OTG_STATE_A_IDLE; MUSB_HST_MODE(musb); } + + if (musb->port_mode == MUSB_PERIPHERAL) + skip_session = 1; + if (!(devctl & MUSB_DEVCTL_SESSION) && !skip_session) musb_writeb(mregs, MUSB_DEVCTL, MUSB_DEVCTL_SESSION); -- 2.19.1