mirror of
https://github.com/lingble/meta-tegra.git
synced 2025-10-29 11:32:30 +00:00
99 lines
3.6 KiB
Diff
99 lines
3.6 KiB
Diff
From 30e70a4c2fec54bce91fa1fc53cca7c9ee9390ca Mon Sep 17 00:00:00 2001
|
|
From: Vidya Sagar <vidyas@nvidia.com>
|
|
Date: Thu, 13 Oct 2022 23:48:12 +0530
|
|
Subject: [PATCH 8/9] UBUNTU: SAUCE: PCI: endpoint: Add core_deinit() callback
|
|
support
|
|
|
|
BugLink: https://bugs.launchpad.net/bugs/2001557
|
|
|
|
The endpoint function driver should undo the things done in core_init()
|
|
and stop hardware access before deinitializing the controller. Add
|
|
core_deinit() callback support for function driver to do this cleanup.
|
|
This core_deinit() callback should be invoked by the controller driver
|
|
before deinitializing the controller.
|
|
|
|
Upstream-Status: Pending
|
|
Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
|
|
Signed-off-by: Kartik <kkartik@nvidia.com>
|
|
Acked-by: Brad Figg <bfigg@nvidia.com>
|
|
Acked-by: Jacob Martin <jacob.martin@canonical.com>
|
|
Acked-by: Ian May <ian.may@canonical.com>
|
|
Signed-off-by: Brad Figg <bfigg@nvidia.com>
|
|
---
|
|
drivers/pci/endpoint/pci-epc-core.c | 26 ++++++++++++++++++++++++++
|
|
include/linux/pci-epc.h | 1 +
|
|
include/linux/pci-epf.h | 2 ++
|
|
3 files changed, 29 insertions(+)
|
|
|
|
diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
|
|
index a7d3a92391a4..94e61baedef7 100644
|
|
--- a/drivers/pci/endpoint/pci-epc-core.c
|
|
+++ b/drivers/pci/endpoint/pci-epc-core.c
|
|
@@ -757,6 +757,32 @@ void pci_epc_init_notify(struct pci_epc *epc)
|
|
}
|
|
EXPORT_SYMBOL_GPL(pci_epc_init_notify);
|
|
|
|
+/**
|
|
+ * pci_epc_deinit_notify() - Notify the EPF device that EPC device's core
|
|
+ * deinitialization is scheduled.
|
|
+ * @epc: the EPC device whose core deinitialization is scheduled
|
|
+ *
|
|
+ * Invoke to Notify the EPF device that the EPC device's deinitialization
|
|
+ * is scheduled.
|
|
+ */
|
|
+void pci_epc_deinit_notify(struct pci_epc *epc)
|
|
+{
|
|
+ struct pci_epf *epf;
|
|
+
|
|
+ if (!epc || IS_ERR(epc))
|
|
+ return;
|
|
+
|
|
+ mutex_lock(&epc->list_lock);
|
|
+ list_for_each_entry(epf, &epc->pci_epf, list) {
|
|
+ mutex_lock(&epf->lock);
|
|
+ if (epf->event_ops->core_deinit)
|
|
+ epf->event_ops->core_deinit(epf);
|
|
+ mutex_unlock(&epf->lock);
|
|
+ }
|
|
+ mutex_unlock(&epc->list_lock);
|
|
+}
|
|
+EXPORT_SYMBOL_GPL(pci_epc_deinit_notify);
|
|
+
|
|
/**
|
|
* pci_epc_bme_notify() - Notify the EPF device that the EPC device has received
|
|
* the BME event from the Root complex
|
|
diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h
|
|
index 5cb694031072..907f69b51ee0 100644
|
|
--- a/include/linux/pci-epc.h
|
|
+++ b/include/linux/pci-epc.h
|
|
@@ -205,6 +205,7 @@ int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf,
|
|
void pci_epc_linkup(struct pci_epc *epc);
|
|
void pci_epc_linkdown(struct pci_epc *epc);
|
|
void pci_epc_init_notify(struct pci_epc *epc);
|
|
+void pci_epc_deinit_notify(struct pci_epc *epc);
|
|
void pci_epc_bme_notify(struct pci_epc *epc);
|
|
void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf,
|
|
enum pci_epc_interface_type type);
|
|
diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h
|
|
index 3f44b6aec477..27b2a7f63ceb 100644
|
|
--- a/include/linux/pci-epf.h
|
|
+++ b/include/linux/pci-epf.h
|
|
@@ -70,12 +70,14 @@ struct pci_epf_ops {
|
|
/**
|
|
* struct pci_epf_event_ops - Callbacks for capturing the EPC events
|
|
* @core_init: Callback for the EPC initialization complete event
|
|
+ * @core_deinit: Callback for the EPC deinitialization schedule event
|
|
* @link_up: Callback for the EPC link up event
|
|
* @link_down: Callback for the EPC link down event
|
|
* @bme: Callback for the EPC BME (Bus Master Enable) event
|
|
*/
|
|
struct pci_epc_event_ops {
|
|
int (*core_init)(struct pci_epf *epf);
|
|
+ int (*core_deinit)(struct pci_epf *epf);
|
|
int (*link_up)(struct pci_epf *epf);
|
|
int (*link_down)(struct pci_epf *epf);
|
|
int (*bme)(struct pci_epf *epf);
|
|
--
|
|
2.25.1
|
|
|