From patchwork Thu Oct 17 01:58:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 13839292 X-Patchwork-Delegate: kw@linux.com 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 6DF4E224F6; Thu, 17 Oct 2024 01:59:14 +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=1729130354; cv=none; b=fDS812wski/2IZiCZ7vLMC5zt7z5CPs9oFM6P44UNdn+yD39852QyczQHHYe3DVjaDH1z6rS9RZYIOExR0pqDbc6S+n+IGJXwDYjm0wqrIxGB9m3cHxBkPhlYDP2XF00V1/ATWhDdmRphrnZ9Ov5hA8aqP4WmfLs6ERhlbpmrUY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729130354; c=relaxed/simple; bh=n3+4MHzpZTxOko007OMWF0UsEmdv7vfTkgVtFLo08kE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pGWPbMPmDwuSha6ptShrmMjyCj2N24mACGHpInoCrp8aQ3RI9wi5JVXiYNRyVDraFI/CgIcsPveaonJrWtzNzLWwek4adt8Eh1k7j2RdPKzEL6dTL7tTS1Mc0Mh2AoSSkGd9GgjKEhl54h4hJcbxxh0rugCkbFjmz97WU8nHB1I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GmbAtcti; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GmbAtcti" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9376EC4CED0; Thu, 17 Oct 2024 01:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729130354; bh=n3+4MHzpZTxOko007OMWF0UsEmdv7vfTkgVtFLo08kE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GmbAtctizjnCh25Tl42dHuTn5w+DfF2JjQpau1ml53/3gswwSmXY1UkSbITof/cmv SdiTbH9EEeaZk5LElktzydhLLT0O2JqpjOuAnOyX1FX2a8Rc6W5I4xXF6sA/MufJko +Fi3M87+8nvIvn/Z4bC2PjHEmgvGctov4TcDY6StCFH2nQDeckoNIKbOgIhFXbjlkK PgPU6BgkPGTNorKT6pOKisBqx8T8nmoT24FqHcyuWdVbdQzWLyYTqt+lriXpM/2uqx bR4zAfu9zjnEIVrifZ8yUJUyKIB7wCOPH7F0G0iE8CdrIWt9mfhmQ5bEZdNIYn3i7c l7AIkTYKEil4g== From: Damien Le Moal To: Manivannan Sadhasivam , Lorenzo Pieralisi , Kishon Vijay Abraham I , Shawn Lin , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , linux-pci@vger.kernel.org, Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , devicetree@vger.kernel.org Cc: linux-rockchip@lists.infradead.org, Rick Wertenbroek , Niklas Cassel Subject: [PATCH v5 11/14] PCI: rockship-ep: Implement the pci_epc_ops::stop_link() operation Date: Thu, 17 Oct 2024 10:58:46 +0900 Message-ID: <20241017015849.190271-12-dlemoal@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241017015849.190271-1-dlemoal@kernel.org> References: <20241017015849.190271-1-dlemoal@kernel.org> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Define the EPC operation ->stop() for the Rockchip endpoint driver with the function rockchip_pcie_ep_stop(). This function disables link training and the controller configuration, as the reverse to what the start operation defined with rockchip_pcie_ep_start() does. Signed-off-by: Damien Le Moal Reviewed-by: Manivannan Sadhasivam --- drivers/pci/controller/pcie-rockchip-ep.c | 13 +++++++++++++ drivers/pci/controller/pcie-rockchip.h | 1 + 2 files changed, 14 insertions(+) diff --git a/drivers/pci/controller/pcie-rockchip-ep.c b/drivers/pci/controller/pcie-rockchip-ep.c index 256a90485fe4..2f7709ba1cac 100644 --- a/drivers/pci/controller/pcie-rockchip-ep.c +++ b/drivers/pci/controller/pcie-rockchip-ep.c @@ -473,6 +473,18 @@ static int rockchip_pcie_ep_start(struct pci_epc *epc) return 0; } +static void rockchip_pcie_ep_stop(struct pci_epc *epc) +{ + struct rockchip_pcie_ep *ep = epc_get_drvdata(epc); + struct rockchip_pcie *rockchip = &ep->rockchip; + + /* Stop link training and disable configuration */ + rockchip_pcie_write(rockchip, + PCIE_CLIENT_CONF_DISABLE | + PCIE_CLIENT_LINK_TRAIN_DISABLE, + PCIE_CLIENT_CONFIG); +} + static const struct pci_epc_features rockchip_pcie_epc_features = { .linkup_notifier = false, .msi_capable = true, @@ -497,6 +509,7 @@ static const struct pci_epc_ops rockchip_pcie_epc_ops = { .get_msi = rockchip_pcie_ep_get_msi, .raise_irq = rockchip_pcie_ep_raise_irq, .start = rockchip_pcie_ep_start, + .stop = rockchip_pcie_ep_stop, .get_features = rockchip_pcie_ep_get_features, }; diff --git a/drivers/pci/controller/pcie-rockchip.h b/drivers/pci/controller/pcie-rockchip.h index 30398156095f..0263f158ee8d 100644 --- a/drivers/pci/controller/pcie-rockchip.h +++ b/drivers/pci/controller/pcie-rockchip.h @@ -32,6 +32,7 @@ #define PCIE_CLIENT_CONF_ENABLE HIWORD_UPDATE_BIT(0x0001) #define PCIE_CLIENT_CONF_DISABLE HIWORD_UPDATE(0x0001, 0) #define PCIE_CLIENT_LINK_TRAIN_ENABLE HIWORD_UPDATE_BIT(0x0002) +#define PCIE_CLIENT_LINK_TRAIN_DISABLE HIWORD_UPDATE(0x0002, 0) #define PCIE_CLIENT_ARI_ENABLE HIWORD_UPDATE_BIT(0x0008) #define PCIE_CLIENT_CONF_LANE_NUM(x) HIWORD_UPDATE(0x0030, ENCODE_LANES(x)) #define PCIE_CLIENT_MODE_RC HIWORD_UPDATE_BIT(0x0040)