From patchwork Wed Feb 14 09:46:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 200886 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp1108912dyb; Wed, 14 Feb 2024 02:10:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXxna0RjZOe9FwzMCVm+n6GpUaMLVk2YwQtSeMxcb/sJQIVtGCCWpWLWdnHJ++CO348+4747IbevnzQBAPh7rJAn9w9hg== X-Google-Smtp-Source: AGHT+IHoD+//++oAStiLqxRRAQvunfSoMcwSjyou6h83U0lbAAZhvOiyXrJF3PAW2v57+crfBqCh X-Received: by 2002:a05:6358:4196:b0:175:ed25:d44d with SMTP id w22-20020a056358419600b00175ed25d44dmr1345796rwc.9.1707905419676; Wed, 14 Feb 2024 02:10:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707905419; cv=pass; d=google.com; s=arc-20160816; b=oJvY7sVCulpDLHhsN0SR3Jzx66lanXj6vNAV0iRS2/fAH8tD/V51cPt3Kg6TkU3bqi abEeyhTXqp1HaiLwlQ5Pw8vzJzUkZ3MFZG7wc+cWSewPW/XgudKF0UrJA9soGF5Xlmp+ 3ZkXdGY0QqM6GTNYlmV3+pmDwp2NrtuUS1L1xn7HrmriaBpT+Pe9PXM2Ih/DPRpl8lqn XHtL29jlSImk9PrLXk1TRf+Y46LU9Vxhmoz98plMENkYWLzt+xhoYLua9oYRqbDWt+iJ aqOTENs0epwcQ7rCvDGXo+XwtakM1cfeqWmmG81Df+fVdR4ZTm2zdYADeLcP31xKkWYa HlHw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=x3FM4+w6d8IdRcffFMvAhI9bbluIC+IS0oo+Jr2rDms=; fh=feOL6xNclXjBt756z5ZmEBFL4DuwpHfZ+9+CPnyYuio=; b=bjk3VpoX7zDrHGNLwNMUSWGgJD8zfhiLqTMXw14Z1njPQX3v3yywE5M2pcG/Gohwgw YJQFwHJM7rFJOrLYpZSfLruC/0QJRe0Qj8egVoFv/u1xE3muyrSRPI0CsUculQb7Pje3 YNTljhQuSU6pNZN0d9B93Y8QScIl0+w7tc3StOitfsKEto3TXV8kXg+Dzi+bcptzQQz3 InBD3RTYpklgwgUqOF9leNht2Q/mOq77dytGvTShMWixp8NYO311ZRJnnmd6td4W+LIq Zb9jQXT9dZWqCuH1rR2i+zycmHz3tMrw5dFaU9UxCGMhQyYW7sfZ0Iu99pVs/WbDCfwx ZAsg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c8c+f7gA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-65001-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65001-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCUk5VWK2/lzZYwHucq7Twm8cV+qBPolZjyqE/yjEf8FyMPsNCVxZ9FZw6SKA2ONYAb7xcDkKFQjneY4z1XILAIhicDrNQ== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id hq20-20020a056a00681400b006e04e5cdc7csi8164452pfb.306.2024.02.14.02.10.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 02:10:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65001-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c8c+f7gA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-65001-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65001-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 63615B239CC for ; Wed, 14 Feb 2024 09:49:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D0073182A0; Wed, 14 Feb 2024 09:48:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="c8c+f7gA" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49FC7134B7; Wed, 14 Feb 2024 09:48:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707904114; cv=none; b=Sr3NYNxq3w0poUbjr6FoJVEka2ZB9JlzWo+wR0+VO2a2nC6idHOf+KJlwkmqkxsFbmzAB2E2/1upWfSpWCRHGo+KeyMLySN1x5DC9Ey/hnJURWyPEyEF0ulQWIfFUjzQqhxnjf+2R6/33NCcFlsZy0Gd6IELgnffNqiG+Fd2UgQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707904114; c=relaxed/simple; bh=X6q1RJmRQMsVDI4YiUe1YyTnSAgbGDQ417oRLZK4lXI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uWNsOqT3ii+ra9H2TymC8JpFjYGWcX39yDUc+o0CIv7sgbG7M6uC/2anaGgJgSUnGeT6XnQRMZnRgQvm0Us1mPEQfNnPY4yJZWtt6rVZ4i0l3nVkJQoYJATrnPSgIs2IRiwqE8TQTyk8c5hZviF0flWOLccL/F/KSLCdlmBSBS4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=c8c+f7gA; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73BBEC433C7; Wed, 14 Feb 2024 09:48:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707904113; bh=X6q1RJmRQMsVDI4YiUe1YyTnSAgbGDQ417oRLZK4lXI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=c8c+f7gAoInFPPuMVB4yAtDaQAsBeQMYAs1JZDObosYWgmk6ShzYpJeNLtasQJkPH 5GZqqFx0ZokEJUKJsNIon6mxzdy8buXVPDmy6gpzo53reFivF1XJMgn3nSYpgZj76L DkJ/DA3Y5g4Wg3ksoLXBz2f/SWar0SCM62zmJnvm9XBbWCrH1IAj300Gx8dh2qh/Ol iMLV3SLaZ5JcsaHjUpmOgOPyX+UkgbQSs3/4bjZZYLqSVtx/tjh99t8ZWIo30RgU6t TaowW00cSEOT9nTSNRjiXati2xRUenFmUqvsXiV0raQYHQjELbxshpOv1WGb/LNN6v XqS6wQxJMvq8A== From: Roger Quadros Date: Wed, 14 Feb 2024 11:46:46 +0200 Subject: [PATCH v3 2/5] usb: dwc3-am62: fix error on module removal Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240214-for-v6-9-am62-usb-errata-3-0-v3-2-147ec5eae18c@kernel.org> References: <20240214-for-v6-9-am62-usb-errata-3-0-v3-0-147ec5eae18c@kernel.org> In-Reply-To: <20240214-for-v6-9-am62-usb-errata-3-0-v3-0-147ec5eae18c@kernel.org> To: Thinh Nguyen , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: nm@ti.com, r-gunasekaran@ti.com, afd@ti.com, b-liu@ti.com, srk@ti.com, francesco@dolcini.it, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Roger Quadros X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1664; i=rogerq@kernel.org; h=from:subject:message-id; bh=X6q1RJmRQMsVDI4YiUe1YyTnSAgbGDQ417oRLZK4lXI=; b=owEBbQKS/ZANAwAIAdJaa9O+djCTAcsmYgBlzIxm+plz9xtRjCi0mKOJqe+jko1TMnexVm8D4 lVjylqMW36JAjMEAAEIAB0WIQRBIWXUTJ9SeA+rEFjSWmvTvnYwkwUCZcyMZgAKCRDSWmvTvnYw k7LDD/0aKob4z9hUZeVJF/q1v63kbVkPai6rpB8aVtdKAK7hM2JeVP57ozvkWCIryJJ4I13aV2d cQV/C+ivi4BluDvr+zPm9PtddmGfuF390+KyfwM6BRwwZBag3IKQtPRv14Q/HXTfp6iXgZQvAQI xYWuRBxojnoQDL4i7X5CzdF1XImo/4PymMnZS/BGaAk7aV6o+vL2lZqlYlqJFv6bMLB3AtCIL6x 56Yvxb8lfCrrBaZ455mKCO5kMS9WRw+MoNCJZ6RYGwe97L1rD4foauUK1QzIs9wB6+Tr9NyuHki 92quRgRF+axVYAmA6s0L1bj2nuvEnfCFOBbN0kGuxCM1dTTuyR1ZorR/vKxxQweIew0qWbeKwdE nOHs8UWZhoiVs9DdTsuBcGzdzTVcVPAPkgwxZ8nAmAATCe7+D4RFH2thsKqDVUgW/3EJzyfXlf7 2a6WtfIGgVA897S2A5mvPx0zErxkrYO+E5CEtbYSZe/yIfL626Ajy1ZruMwSJW61dxxHj0v9eD7 pE3Gee2tInjDs2Ag3HMnSPwFbven8qDKuvop0S0nCaDv138wt19ot7D9Z1O7ssSTwmkTtFEs5Lu 0s99/fqcz53OgrH4UOh3crXi9ezqypu3WIYZTAFcnwtzeY6Q/w+ZVQp+aCqdADij0M6VtcQOwRr QGrpEfxBdSIn+Cw== X-Developer-Key: i=rogerq@kernel.org; a=openpgp; fpr=412165D44C9F52780FAB1058D25A6BD3BE763093 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790868633081132929 X-GMAIL-MSGID: 1790868633081132929 As runtime PM is enabled, the module can be runtime suspended when .remove() is called. Do a pm_runtime_get_sync() to make sure module is active before doing any register operations. Doing a pm_runtime_put_sync() should disable the refclk so no need to disable it again. Fixes the below warning at module removel. [ 39.705310] ------------[ cut here ]------------ [ 39.710004] clk:162:3 already disabled [ 39.713941] WARNING: CPU: 0 PID: 921 at drivers/clk/clk.c:1090 clk_core_disable+0xb0/0xb8 Signed-off-by: Roger Quadros Acked-by: Thinh Nguyen --- Changelog: v3: no change v2: no change https://lore.kernel.org/all/20240205141221.56076-3-rogerq@kernel.org/ v1: https://lore.kernel.org/all/20240201121220.5523-3-rogerq@kernel.org/ --- drivers/usb/dwc3/dwc3-am62.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c index 1bfc9e67614f..600ba9cfefea 100644 --- a/drivers/usb/dwc3/dwc3-am62.c +++ b/drivers/usb/dwc3/dwc3-am62.c @@ -273,6 +273,11 @@ static void dwc3_ti_remove(struct platform_device *pdev) struct dwc3_am62 *am62 = platform_get_drvdata(pdev); u32 reg; + pm_runtime_get_sync(dev); + + device_wakeup_disable(dev); + device_set_wakeup_capable(dev, false); + of_platform_depopulate(dev); /* Clear mode valid bit */ @@ -281,7 +286,6 @@ static void dwc3_ti_remove(struct platform_device *pdev) dwc3_ti_writel(am62, USBSS_MODE_CONTROL, reg); pm_runtime_put_sync(dev); - clk_disable_unprepare(am62->usb2_refclk); pm_runtime_disable(dev); pm_runtime_set_suspended(dev); }