Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3700621imu; Mon, 28 Jan 2019 09:16:00 -0800 (PST) X-Google-Smtp-Source: ALg8bN5gvJkGdbjzaDn0sB7Vn1Bk3J1u9DdCAx5oAa3LrEgXxbgBTuXfktgAE9+VKyYgYbdZ296h X-Received: by 2002:a17:902:4225:: with SMTP id g34mr22959074pld.152.1548695760918; Mon, 28 Jan 2019 09:16:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548695760; cv=none; d=google.com; s=arc-20160816; b=khw4ypLIgVUd11HOnTBbkYWK3YAu5NEDbt8+HcYRwUSrRPDpxcTubAaKCiotLflF1/ aFmxkLYkwcn8tE9UukMlagO2aVuQcQiElbzdU40blqwV9rF636So2MtNCXLa7fZu4dpW zBw89bQc9NXgMeezeZHYcTNu4rX8U2sdfE+LDIhr3wAM14cU/TyEsn1vEFOcrnTHo1AH igsAGSMz15D979oOzTVEH2gzNshXCxdkzAIMf1jUp3K6DLqoKEoxzDWPEHHUPqNkJmoa BHGxi3bmHdMMrLmrVWXuLMZePSaV/JKtLzMx+LLA/SbOPcGHB9+LJIBfjK8Bw7EOul+u uIPg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZrWguHWvt9YJLErjSrwSFN2SX9URDvxGBus4IwgpfU8=; b=G17+SvbUfIKRaFN4JCcMdVd9yqzpft08NjRLHxhSNf6rM2Mi7IoxIzfya9veWC+YBS yUUeAZnCaK5U0FHLm0TDBGij8dObPs2XZ8TvXlc6W0BMaun30MbvGeI9v95EhYsZYVgh yCXtiye0SQvP7EDjmcXhSm/ZoZeQFuyi75YMMufA90xX+1MDSC4yeefPmXD+jcmxo0FA GYglFy8kdVsRDXLERT0Z5sfl8g4FLDNRxqkmv140dEu0KSB6IEo5iTQwXaZU02TUfkrJ v9O/ftU6cBCaNxc9JdargAQisgo9Zg2a5QQaD8X4jqt9x7n9AU3czah+zVJ3TcQkgIsn jtoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Bb5Oq948; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 38si9839679pln.313.2019.01.28.09.15.44; Mon, 28 Jan 2019 09:16:00 -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=Bb5Oq948; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732062AbfA1ROU (ORCPT + 99 others); Mon, 28 Jan 2019 12:14:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:58648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732249AbfA1QHj (ORCPT ); Mon, 28 Jan 2019 11:07:39 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0F13F20989; Mon, 28 Jan 2019 16:07:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691659; bh=iSfAMUiCuC9aWufMmuPoIFfGGmQeKUJiinfqa4JLUHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bb5Oq9488hGuSZn9wL70EXqgULRjJ6QuzVmZXRvxA/Jk5z/82J53KW3NHAcF3SsEc t9jD36e/89uhH8Qc3HoWKL9B+YBUTD6VaUcuqDFXGPcxn349cVa32WuK2OqcXo8nGi CSxqi1cuzq9eLyH7HBX9orLmVrtZPi9LMUVXHqzM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Bin Liu , Greg Kroah-Hartman , Sasha Levin , linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 177/258] usb: musb: dsps: fix runtime pm for peripheral mode Date: Mon, 28 Jan 2019 10:58:03 -0500 Message-Id: <20190128155924.51521-177-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bin Liu [ 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