From patchwork Fri Mar 19 15:50:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 404806 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1485715jai; Fri, 19 Mar 2021 08:42:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAAjVyzGfX7A4vBY4DX8uKn8jVMqyR+yDGdJFcAr427nHNdEpLR+M4YKsTCJM6va+kZBZx X-Received: by 2002:a17:906:aada:: with SMTP id kt26mr4933745ejb.137.1616168562072; Fri, 19 Mar 2021 08:42:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616168562; cv=none; d=google.com; s=arc-20160816; b=QiK39MHZWXmHMofMtqfOmCFWb+fBowtmbQpSxxK2HkSjP3rg/ZolS46muu4OxzJ2cq cJSA4/tK6ioXt1ip1uteCTPPjekPfN409C69fuuvKg+QKF+0rB+1UVjTV+f8bMB3/yzq pUpBGFKfOv4T+W1QeS8abt+7CPB8S0xVBPRHV/cy3CNl3y9hK71d/ptRed+rpQvPrpVN hXDCz9pOl2gnbAc9ZLuWsQ6vGN/179bDdxqddddaQRusIZbHZxz+pYDATPyjlnATenjs FvzcguAW70OjPI7b454s3/Q1wXK99SHlVREA9X207O8rBoVhMHvjZ6WhbrL/dmd8o3Rb Q7XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=GRAl5Em2B1mCYlVdeSo9RSVSNPlh6dys+c8hwugvgok=; b=ogiRcVUIE3cH2obpjhIPaQIh53zBmKnqeDkS+QbUzNLoLSVsAXS9c/Gia5QyxZ8qgg 2epCzdP8Qz5RPD9JBu6P+QMIZZ55QTp8fmcavbJL/nozkORBNeg2lPrxS+S7nBS1jlMP 0VsYNrC2uQomUE5aHtTTakMWNaSFsvJWsQ86tP2EaZNH/xZnDDSvfdHXHUfETmErcQv9 UpgZ+vkOR9w9xfJPcBkTr1zdoSdoFJcEtMbKkj0H3bqFr7vd8JMEtNwKvATNPa0mtHvA RoAdplhQsCDfJsnApb96CmXL5RoWiXB3H4fD58OhnriVLuXpsgL1dJkz56dvkuEXzMRM gu4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O+NloZDE; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u16si1579854ejy.630.2021.03.19.08.42.41; Fri, 19 Mar 2021 08:42:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O+NloZDE; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230039AbhCSPmJ (ORCPT + 16 others); Fri, 19 Mar 2021 11:42:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230228AbhCSPmE (ORCPT ); Fri, 19 Mar 2021 11:42:04 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE416C06174A for ; Fri, 19 Mar 2021 08:42:03 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id e18so9578203wrt.6 for ; Fri, 19 Mar 2021 08:42:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=GRAl5Em2B1mCYlVdeSo9RSVSNPlh6dys+c8hwugvgok=; b=O+NloZDENgFf4zVcct1MkM+oY18j8ycOp17VdzjUOhpm6rekijsi/hV9MP5labrKgQ YxuKPR1v6E5CvSxO3RO5fwjnBkw99Gnsu+eBMy36g6fceNUcriJePP4OeHyFf9Iqojki 1x/ygrCyqLJC7lpcR3n3LHgAy77kvfCOqe2Suvn8PEYUjx5+N+x6+ZsGtUPhso8oAwRQ 40WqvB0jT0W609H0rMcG2BxOG+U2+KWtVeEvIbo4OngTYvmw2R+lcAWSLU/iDk5L9JaH Y2SZuBzVnLGd7z5FV8MpxJi9PxHpaIgLU8TUXrADlE88uSEqSJbA/nTsVjm7BtapG1gW S1CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=GRAl5Em2B1mCYlVdeSo9RSVSNPlh6dys+c8hwugvgok=; b=nprjbC4/OEiwcH0Y0bdVcYWeX8ksFCPkGNgzJhBYLxKl04N7DDruj62OYVMB6O6PbF WlNHHLqMQ0iH3jgQ1c/qfjwvYATXWM7YUXoeJ5/gROXK/dxwD1VHQeJPTqeDsfQmz3sh DqMfOAdAwop4YgDKP1DhVRnhWyz6d7Af3JcY3Gy7yQFh+SFnquWYAtWAxsoHQl6kQ/qx nropTKJvZzE+UvUerWFG1Z23z5oBXIpp4L/zSuimZ/Kai6zRKUPsZFQ3PCECT/JIFRcw T1fbxmrVjbi7MQvkw5E3SSRaIUa7Aoli1uiY2VQsWaheee3R8g7SS9JD8JvbI/TwVHtD n2Tw== X-Gm-Message-State: AOAM533mTi8JeOtv0+p8w7bik4BlAGNYDM1bgvvetiOygs2Yi+DCA0Lv zwAcnALxg4Pzbf7QHfOjmIePJA== X-Received: by 2002:a05:6000:221:: with SMTP id l1mr5189715wrz.370.1616168522460; Fri, 19 Mar 2021 08:42:02 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:82c:5f0:ae5e:7ec2:5176:d0c0]) by smtp.gmail.com with ESMTPSA id i4sm6111346wmq.12.2021.03.19.08.42.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Mar 2021 08:42:02 -0700 (PDT) From: Loic Poulain To: manivannan.sadhasivam@linaro.org, hemantk@codeaurora.org Cc: linux-arm-msm@vger.kernel.org, Loic Poulain Subject: [PATCH] bus: mhi: pci_generic: Implement PCI shutdown callback Date: Fri, 19 Mar 2021 16:50:37 +0100 Message-Id: <1616169037-7969-1-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Deinit the device on shutdown to halt MHI/PCI operation on device side. This change fixes floating device state with some hosts that do not fully shutdown PCIe device when rebooting. Signed-off-by: Loic Poulain --- drivers/bus/mhi/pci_generic.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.7.4 Reviewed-by: Manivannan Sadhasivam diff --git a/drivers/bus/mhi/pci_generic.c b/drivers/bus/mhi/pci_generic.c index cbd2224..b104ab8 100644 --- a/drivers/bus/mhi/pci_generic.c +++ b/drivers/bus/mhi/pci_generic.c @@ -532,6 +532,12 @@ static void mhi_pci_remove(struct pci_dev *pdev) mhi_unregister_controller(mhi_cntrl); } +static void mhi_pci_shutdown(struct pci_dev *pdev) +{ + mhi_pci_remove(pdev); + pci_set_power_state(pdev, PCI_D3hot); +} + static void mhi_pci_reset_prepare(struct pci_dev *pdev) { struct mhi_pci_device *mhi_pdev = pci_get_drvdata(pdev); @@ -704,6 +710,7 @@ static struct pci_driver mhi_pci_driver = { .id_table = mhi_pci_id_table, .probe = mhi_pci_probe, .remove = mhi_pci_remove, + .shutdown = mhi_pci_shutdown, .err_handler = &mhi_pci_err_handler, .driver.pm = &mhi_pci_pm_ops };