PCI: endpoint: pci-epf-{mhi/test}: Move DMA initialization to EPC init callback
To maintain uniformity across EPF drivers, move DMA initialization to EPC init callback. This will also allow us to deinit DMA during PERST# assert in the further commits. For EPC drivers without PERST#, DMA deinit will only happen during driver unbind. Link: https://lore.kernel.org/linux-pci/20240430-pci-epf-rework-v4-6-22832d0d456f@linaro.org Tested-by: Niklas Cassel <cassel@kernel.org> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Niklas Cassel <cassel@kernel.org>
This commit is contained in:
parent
942ceba0e4
commit
60bd3e039a
@ -753,6 +753,14 @@ static int pci_epf_mhi_epc_init(struct pci_epf *epf)
|
||||
if (!epf_mhi->epc_features)
|
||||
return -ENODATA;
|
||||
|
||||
if (info->flags & MHI_EPF_USE_DMA) {
|
||||
ret = pci_epf_mhi_dma_init(epf_mhi);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to initialize DMA: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -765,14 +773,6 @@ static int pci_epf_mhi_link_up(struct pci_epf *epf)
|
||||
struct device *dev = &epf->dev;
|
||||
int ret;
|
||||
|
||||
if (info->flags & MHI_EPF_USE_DMA) {
|
||||
ret = pci_epf_mhi_dma_init(epf_mhi);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to initialize DMA: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
mhi_cntrl->mmio = epf_mhi->mmio;
|
||||
mhi_cntrl->irq = epf_mhi->irq;
|
||||
mhi_cntrl->mru = info->mru;
|
||||
|
@ -737,6 +737,12 @@ static int pci_epf_test_epc_init(struct pci_epf *epf)
|
||||
bool linkup_notifier = false;
|
||||
int ret;
|
||||
|
||||
epf_test->dma_supported = true;
|
||||
|
||||
ret = pci_epf_test_init_dma_chan(epf_test);
|
||||
if (ret)
|
||||
epf_test->dma_supported = false;
|
||||
|
||||
if (epf->vfunc_no <= 1) {
|
||||
ret = pci_epc_write_header(epc, epf->func_no, epf->vfunc_no, header);
|
||||
if (ret) {
|
||||
@ -883,12 +889,6 @@ static int pci_epf_test_bind(struct pci_epf *epf)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
epf_test->dma_supported = true;
|
||||
|
||||
ret = pci_epf_test_init_dma_chan(epf_test);
|
||||
if (ret)
|
||||
epf_test->dma_supported = false;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user