Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2759311imj; Mon, 11 Feb 2019 08:04:19 -0800 (PST) X-Google-Smtp-Source: AHgI3IaTehiqHqzxI06BzqiO85vOiPYTdoGdavAjJ06grVo2hKE0q5uwXLgsJCA6ri6O03y872nQ X-Received: by 2002:a62:1bd4:: with SMTP id b203mr1366970pfb.144.1549901059444; Mon, 11 Feb 2019 08:04:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549901059; cv=none; d=google.com; s=arc-20160816; b=AcN6lmbq0s5piQEV2dUryT+G2rmiNtbylhIbWueKTycF3hS7/1D7dOe+nEBdDNJOVH V43GhhzUf1aSV6XXB58YEWitQd/wo8lYE2UNk8DhHhJ6a0g7Rh7w7cGGMhhsCAIrXrbb 9DJ+PJt41Uj9xICkQtlDrgdm8JZ2E8rqLTebAEqsEklg/yVHH123Rg19VE7YP1j58qSc CRmaunIWH9fN1Rn840P+kKQJNYi1R8f/IomT+DdOmwym2YG5Es4g15iuEzIzgGXm2sPp w2SFNGZUYr5R5Yad8UFcbQNXIa/jvOpPcCVoQpEiVSk0K0DDnSR9jQ+Oqx84LwbPeiM3 hW8g== 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=SZGYFW9+gAJ0QgZwiGhZkCiCf5DrD7mnE2K9LXkHVjQ=; b=ou8Qr7cQkmOjOoTeVBZXoNLOxz4/tMjjXYoKiu+cjSHgNg1OfihYpWGK30+JosNUkW 2WKmAy33rgF+KqeDbAJZb+Zh2t8NcPAp1FfKvtcNKDxExiRCRVbmz+IajWAS4JwyLCAl dARo0irvEVVbKozJGlb7ruaSGX5F1NByUVU/Yx3PP8ZBCj1gglvtekEeHM7LzhFsNHph ci/DfKPznNVnJVzzP2s7n6gujS8CYKSRQMvgWBysNutbZyvcEwRHd1z0N0X7qnDu08Nl 44g9+rvGoKIou5FwJj3kZH5RlIZ7iqJFgziCTsLzwz9LoTZ8oHJSjxjo22yfiR58Sjxc ppzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CLUWLho5; 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 s9si4442918plr.316.2019.02.11.08.03.58; Mon, 11 Feb 2019 08:04:19 -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=CLUWLho5; 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 S1730115AbfBKOa0 (ORCPT + 99 others); Mon, 11 Feb 2019 09:30:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:36808 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728329AbfBKOaZ (ORCPT ); Mon, 11 Feb 2019 09:30:25 -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 0DE4A20675; Mon, 11 Feb 2019 14:30:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895424; bh=+BRbOeCpB2lP6IwibabmLjxeqWytazCjeZkE461rQKs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CLUWLho5o/N/eA42oh2ZIk2SFJZ7wvelRuy5ac3R2O12MU46rDy/3QU/KNZUS1FYH 3yFdffX/QEhyEhoPH7c7t1Ca54qU/iFCr8RT9AiRQbh8/4DZIJ7zyGcU4FR3aNM3+v KrLkJrVLexY52SBS5ZxVWc8ynNlJYce61/G4T9l4= 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.20 200/352] usb: musb: dsps: fix runtime pm for peripheral mode Date: Mon, 11 Feb 2019 15:17:07 +0100 Message-Id: <20190211141859.865905118@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@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.20-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