Commit Graph

88 Commits

Author SHA1 Message Date
Nagarjuna Kristam
4dce44a907 PCI: tegra: Add common DMA IRQ
IRQ is external interface for DMA driver. Use one IRQ handler callbacks
to register and call SoC specific handler them based on SoC type.
Add ICD documentation for common IRQ API's

JIRA NET-2663

Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Change-Id: I51137489ebe071e2e4a3edc3c5e3fefb84c994fa
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3305091
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
2025-07-24 10:19:15 +00:00
Nagarjuna Kristam
330ecd452b pci: tegra264: Remove MSI info from ICD
MSI API are not supported via GuestOs decomposition. Disable documentation
for the same during ICD compilation.

JIRA NET-2663

Change-Id: Ie1a0ca75b91e848152d0748f8f49735bedd0be70
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3305090
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2025-07-24 10:19:15 +00:00
Nagarjuna Kristam
789e70d35e pci: tegra264: Add EP driver ICD documentation
JIRA NET-2663

Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Change-Id: I5855c28c7834fe6ca8f0571321b04a4997dc6185
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3293557
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2025-07-24 10:19:15 +00:00
Manish Bhardwaj
b6c2cf9a34 nvidia-oot: check dependency of pci driver on host1x
Bug 4936618

Change-Id: I9c8d98b43cffa6cff4ea06d7bb38acf0b42819fb
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3257441
Reviewed-by: Bharath H S <bhs@nvidia.com>
Tested-by: Hyong Bin Kim <hyongbink@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
Reviewed-by: Hyong Bin Kim <hyongbink@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:13 +00:00
Srishti Goel
eeb5d6e7a2 pci: epf: Correct deviceid in DMA test app
Correct device ID in the DMA test app to 0x22D7

Bug 4938994

Change-Id: Ibf8d5bc0a7bc6cc299fd92daa8fcc1bb4e2e116d
Signed-off-by: Srishti Goel <srgoel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3275919
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2025-07-24 10:19:12 +00:00
Manikanta Maddireddy
1f56aa1d73 PCI: tegra264: Add IO BAR support
PCI supports IO BAR with 32-bit address, however XAL HW module provide
a way to use 64-bit MMIO address as a CPU address and a 32-bit PCI
address for IO BAR. Program 64-bit MMIO address in XAL registers,
when sending the TLP over the bus, XAL truncates it to 32-bit address.

Bug 4883004

Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Change-Id: Idf2fdfa9d345ae7d0630d4ab9b1074422a9f68f4
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3256977
Reviewed-by: Ankit Patel (SW-TEGRA) <anpatel@nvidia.com>
Tested-by: Ankit Patel (SW-TEGRA) <anpatel@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:12 +00:00
Nagarjuna Kristam
276faff8d4 pci: tegra264: turn off controller when no link
When Link up fails during driver probe, controller is kept powered
on, even when controller is not configured as hot plug capable.
This results in more power consumption. Turn off controller when
no link detected during driver probe, only when controller does not
have hot-plug capability.
Ignore resume and remove AI's when no link during probe for no
hot-pluggable controllers.
Ignore Link state check for VDK, on which it cannot be detected.

Bug 4688706

Change-Id: I80a2b5845d48b07f25f65dc7cf5509aeb5778399
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3246221
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2025-07-24 10:19:11 +00:00
Srishti Goel
5a0c14c4df Revert "PCI: endpoint: Add DMA sanity test function driver"
This reverts commit f22862928ad7bd08df0008fa40074df850aaec12.

Reason for revert: Changing this to tests-oot directory

Bug 4865361

Change-Id: I7f0c9d6466e21c34bd6d1be3b32401eb68db637d
Signed-off-by: Srishti Goel <srgoel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3246558
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2025-07-24 10:19:10 +00:00
Srishti Goel
64e63a9ca3 Revert "PCI: endpoint: Fix DMA sanity for Linux v6.11"
This reverts commit 2f3e25b601c241bf50a30b07a0aaa64413c57925.

Reason for revert: Changing this to tests-oot directory

Bug 4865361

Change-Id: I19002466616450cf073e2a66a1dd27da9e3409a2
Signed-off-by: Srishti Goel <srgoel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3246783
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:10 +00:00
Jon Hunter
f51248fd49 PCI: endpoint: Fix DMA sanity for Linux v6.11
The Tegra PCI endpoint DMA sanity driver build fails for Linux v6.11
because the 'core_init' callback was renamed to 'epc_init'. Update the
driver accordingly to fix the build for Linux v6.11.

Bug 4749580

Change-Id: I66a3c848f3f01b607d045c221bcc2ed21ac3df61
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3242701
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Srishti Goel <srgoel@nvidia.com>
2025-07-24 10:19:10 +00:00
Srishti Goel
9c40df022c PCI: endpoint: Add DMA sanity test function driver
Added a sanity DMA testing driver which submits 2 descriptors of 0.5MB,
2.5MB and 6.25MB each. Repeats this 10 times and captures the perf,
bit-transfer errors and time taken.

Bug 4865361

Change-Id: Ibda3d55d848c918bb3b97412b0cbb33b0a460f6e
Signed-off-by: Srishti Goel <srgoel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3220195
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:10 +00:00
Jon Hunter
a813cd8c7f PCI: tegra264: Don't initialise core_init_notifier
The 'core_init_notifier' has been removed from the pci_epc_features
structure in Linux v6.10. Given that this is a static structure and it
is initialised as 'false', we don't need to explicitly initialise this
because it will always be initialised as 'false' by default for kernels
that support this.

Bug 4787193
Bug 4593750

Change-Id: Ic2abaa3d2ab1a5c766a805936fd8ab394214bf42
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3233999
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:08 +00:00
Jon Hunter
7ca94a27fa PCI: tegra264: Use conftest
Building the Tegra264 PCI Endpoint driver fails with certain kernel
versions such as Linux v6.7. Use the existing conftest definitions for
detecting differences between kernel versions instead of relying on
kernel version itself.

Bug 4911768

Change-Id: I1a755c9f2bc4a58e15c6caf1ecde261faebd57bb
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3234750
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:08 +00:00
Jon Hunter
cded4cedac PCI: tegra264: Add missing module.h header
The Tegra264 PCIe Endpoint driver is missing the module.h header and
when compiling on some Linux kernel versions the build fails because
the various module functions and macros prototypes are not defined.

Bug 4911768

Change-Id: I4bd83bd1bb8049ad7828aa4ce452fe2ecbbc6be7
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3234210
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:08 +00:00
Jon Hunter
87799bf046 PCI: tegra264: Fix build for Linux v6.11
In Linux v6.11, the 'platform_driver' structure 'remove' callback was
updated to return void instead of 'int'. Update the Tegra264 PCI drivers
as necessary to ensure that they can be built for Linux v6.11+ kernels.

Bug 4749580
Bug 4911768

Change-Id: I9081f7cb61e9020ec8c1462a3c1b21118d7025bc
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3233981
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:08 +00:00
Jon Hunter
f01227d4ea drivers: Drop inline from driver remove wrapper
The driver remove function is a function pointer and therefore, it does
not make sense to define the function as an 'inline'. Update the
coccinelle script and drivers to remove the inline statement.

Bug 4749580

Change-Id: Ia03691b75c4edffe609f27468b911a92a5ddbd68
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3233980
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:08 +00:00
Laxman Dewangan
17ef98bafa pcie: T264: Skip build of T264 specific PCIE driver for few kernel
Skip T264 PCIE drivers for the few kernels like jammy-src, rhivos-1 and
stable.

Bug 4911768

Change-Id: I198fb279712594a69950b72d6b8f14a9ef151e5f
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2025-07-24 10:19:08 +00:00
Laxman Dewangan
1e0bef1f51 pci: Implement function of tegra_pcie if proper config is selected
To avoid the duplicate function defintion between the header and
source, use the proper config to protect it.

Bug 4911768

Change-Id: I8d6880833c122eb2eb7194929eb5ea2cb78a9c45
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2025-07-24 10:19:08 +00:00
ruppala
3909cff8d5 PCI: tegra264: Add support for PEX WAKE GPIO
Add support for handling the PEX WAKE GPIO (pex_wake_gpiod) by
parsing the pex-wake GPIO from the device tree and setup the
interrupt line.

Enable and disable the wake-up interrupt during system
suspend/resume.

Bug 4788812

Change-Id: Ie8936aa9cc551db1a5d24b277b091de5fbc0439e
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/3212875
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
2025-07-24 10:19:08 +00:00
Nagarjuna Kristam
f4df943461 PCI: tegra264-ep: Disable SW PME_TO_ACK
SW PME_TO_ACK is no longer used as BLCG is applied for EP
between L2 and controller powergate.

Bug 4844371

Change-Id: Ibc5c0735aa1e46b91a3a0dfa828cf72ce16e6e12
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/3208143
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
2025-07-24 10:19:08 +00:00
Manikanta Maddireddy
a558aeb624 PCI: tegra264: On EP_RESET poll for detect reset LTSSM
When Root port applies secondary bus reset(SBR) or link disable, EP_RESET
interrupt is received at Endpoint. On EP_RESET poll for detect reset LTSSM
state which confirms that SBR reset released or link disable is cleared.
After polling perform Endpoint controller cold reset.

Due to HW bug 4777981, C2 x2/x1 LTSSM state doesn't move to detect reset
when SBR reset is released, instead it stays in hot reset state. In this
case perform Endpoint controller cold reset after poll timeout. PCIe link
still comes up in this case.

Bug 4777981
Bug 4785875

Change-Id: I89402aa7c963082510170b88a1f7a4ec481162be
Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/3197116
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2025-07-24 10:19:08 +00:00
Nagarjuna Kristam
216461effa PCI: tegra264: Add pinctl support
Configure pinmux settings if any available in DT.

Bug 3191308

Change-Id: I79b1965dfe95f39322828ce5ea9acb22d2cb43e1
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/3191308
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2025-07-24 10:19:08 +00:00
Nagarjuna Kristam
49f357d6e1 pci: t264-xdma: Fix MSI error handling
Issue:
When XDMA interrupt is received and only error is set, interrupt is not
processed resulting in DMA HW halt and no further transfers working.

Fix:
Process XDMA irq, when either transfer complete or error status is set.

Bug 4747322

Change-Id: Ic71f3bf93343e986a1f4be9b570bcc36f03afeeb
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/3175952
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:08 +00:00
Nagarjuna Kristam
8774bd321b pci: t264: xdma: Fix MSI for local and remote
Use different MSI channels for local and remote use case to avoid
configuring same registers with different info.

Bug 4779415

Change-Id: I13fab912589d47484881cd862fc9eaf0f602e64e
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/3186319
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Tested-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:08 +00:00
Manikanta Maddireddy
c51582e26e PCI: Enable CONFIG_PCIE_TEGRA_DMA flag in header file
Tegra DMA driver functions are defined in nvidia-t264 repo and these
functions are used in nvidia-oot repo. Prototypes of these functions
are defined in nvidia-oot repo header file tegra-pcie-dma.h. Enable
CONFIG_PCIE_TEGRA_DMA flag to expose the function prototypes to the
drivers in nvidia-oot repo. This functions should be exposed only if
nvidia-t264 drivers are included in kernel compilation.

Bug 4712065

Change-Id: I74bb98bd9efbf2e36ed05aae866760a92a4ee7dd
Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/3164961
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2025-07-24 10:19:08 +00:00
Nagarjuna Kristam
bb8ac1d6be PCI: tegra264: Update EP state change handling
When Thor EP is connected to Thor RP, PERST# signal don't get toggle
post Thor RP boot.
- When EP start is triggered, de-assert EP if RP PERST# is released.
- When EP stop is triggered, assert EP directly.

Bug 4567932

Change-Id: I86e9251205a7c19dd32789052a10669fc3b48098
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/3170657
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2025-07-24 10:19:08 +00:00
Manikanta Maddireddy
4ab2bfd19c PCI: Fix crash in PCIe dma test deinit
PCIe deinit function tegra_pcie_dma_deinit() takes cookie double pointer
as argument. Add null check for pointer stored in double pointer variable
to avoid crash in tegra_pcie_dma_deinit().

Bug 4712065

Change-Id: Ib272058f558738c7e6b5a20c6f2ba85c2bf2a781
Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/3163949
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
2025-07-24 10:19:08 +00:00
Manikanta Maddireddy
f439ffe285 PCI: tegra264: Fix kernel crash during outbound map
Kernel crash is observed during outbound mapping since memory is not
allocated for ob_addr pointer. Tegra264 support fixed 8 outbound channels,
so change ob_addr pointer as a static array to fix the kernel crash.

Bug 4705050

Change-Id: Ibf675c1d00abcbd8596f9be9b76ae7ef19d2fd38
Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/3163948
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Tested-by: Nagarjuna Kristam <nkristam@nvidia.com>
2025-07-24 10:19:08 +00:00
Manikanta Maddireddy
e9881b2cee PCI: tegra264: Add link disable and SBR support
When PCIe link is disabled or secondary bus reset is done by RP,
EP LTSSM state goes to link disable or hot reset respectively.
Update the LTSSM state check accordingly to support link disable
and secondary bus reset.

XTL_EP_PRI_BAR_CONFIG and XTL_EP_PRI_RESIZE_BAR1 are part of
hot reset domain, when link is going through hot reset, these
registers are not accessible. So, remove these register programming
in tegra264_pcie_ep_clear_bar(). After hot reset these registers
come back with reset values.

Bug 4712053

Change-Id: Ieaf37ed9fed6722db8a16027947121b1cfd1ef4c
Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/3163927
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:08 +00:00
Manikanta Maddireddy
d091253965 PCI: tegra264: Add driver unbind support
Add remove callback function support driver unbind.

Bug 4712048

Change-Id: I9c855d6403f187de1c93c00ba8cc270e4fed37f4
Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/3163926
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:08 +00:00
Manikanta Maddireddy
26c5dc150d PCI: Fix XDMA reset flow
When XDMA error is observed driver resets the XDMA engine.
xdma_ll_ch_init() function is called to reinitialize the
XDMA engine. Incorrect value is passed as the argument for
channel type. Fix this issue by using correct variable for
channel type.

Bug 4707453

Change-Id: Ic06563d599bfd7c0979c9db0a20cebeaa18fe3c8
Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/3163925
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:08 +00:00
Manikanta Maddireddy
c1de5ba655 PCI: Add Tegra264 PCIe DMA driver
Copy T234 DMA driver and add Tegra264 PCIe DMA driver with common wrapper
to support both T264 and T234 PCIe DMA.

Bug 4549851

Change-Id: Ie4f55021aadd4c4f9b468b49fe34a562cdf3fa6c
Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/3124399
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:08 +00:00
Jon Hunter
4d4e8e54eb PCI: tegra264: Fix build for Linux v6.9
The pci_epc_features structure was updated in Linux v6.9 to move various
fields under a new pci_epc_bar_desc structure. Use conftest to determine
if the new pci_epc_bar_desc structure is present.

Finally, add the endpoint alignment for the inbound ATU on Tegra264
which is 64kB.

Bug 4627271

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Change-Id: I074e19ca53cea0e13d9872b240a023dd83779ae7
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/3129630
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:08 +00:00
Manikanta Maddireddy
0bf232b1d8 PCI: tegra264: Add PCIe EP controller driver
Register Tegra264 PCIe EP controller platform driver. Handle PERST#
deassert and send MRQ call to initialize PCIe HW. Register with EPC
core driver and define EPC core ops callback functions.

Bug 4549851

Change-Id: I353209852d0162d8219fa66b523a3cb3daf642a7
Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/2994454
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:07 +00:00
Jon Hunter
c81c525baf PCI: tegra264: Remove private headers
The only functions needed from the private pci.h header are
pci_dev_is_disconnected() and of_get_pci_domain_nr().

Starting with Linux v6.9, pci_dev_is_disconnected() has been moved to
the public header and now the private header conflicts with the public
due to multiple definitions. It is better to remove the private pci.h
header file and backport the upstream change that moves the definition
of pci_dev_is_disconnected() to the public header.

With regard to the function of_get_pci_domain_nr(), just declare an
extern for the function prototype in the driver file rather than
copying the entire kernel header.

Bug 4471899

Change-Id: I10e7c3c6a92e9ba87153b2682cc3e69ced8c1a31
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/3117272
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:07 +00:00
Manikanta Maddireddy
f0ec6ab5f5 PCI: tegra264: Add PCIe resume support
Per PCIe r5.0, 6.6.1 wait for 100 ms after DLL up. Optimize PCIe link up
poll logic. Add resume_noirq() callback back function in PCIe driver and
call tegra264_pcie_init() to deassert PERST# and get PCIe link up.
Also, fix minor coding style issues.

Bug 4404453

Change-Id: Iad2d22166eb0c80a20b74ada2ee2766f8d3e174f
Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/3107413
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2025-07-24 10:19:07 +00:00
Manikanta Maddireddy
ef4d11362e PCI: tegra264: Move driver file to new dir t264
nvidia-t264 drivers are copied to nvidia-oot path and compile them to
create out-of-the-tree driver modules. Create new directory to avoid
replacing exisiting Makefile in out-of-the-tree repo.

Bug 4000789

Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Change-Id: I8040a86102b164feae6e1fd2251c69d3dc039dde
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/2870776
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:07 +00:00
Laxman Dewangan
050b888cca pcie: remove private-soc makefile to prepare to merge T264 pcie drivers
Remvoe the existing makefile as preparation to merge T264 specific
PCIE drivers into core repo.

Bug 4911768

Change-Id: Ifa65e36b5253bf2dc4ab62fe8caaf10a53e7cff3
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2025-07-24 10:19:07 +00:00
Nagarjuna Kristam
b55db09752 pci: epf: dma-test: Fix free_irq during remove
Issue: epf-dma-test driver uses MSI IRQ for CRC handling, however, different
IRQ is used when free the same.

Fix: Correct IRQ number to free. Correct ordering of free_irq and
platform MSI irq free.

Bug 4820157

Change-Id: Idbbaed61ddbd45a52e8e833e76c6b64f0fd3e48f
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3204910
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:07 +00:00
Jon Hunter
951b2423a8 drivers: Fix platform_driver remove for Linux v6.11
In Linux v6.11, the 'platform_driver' structure 'remove' callback was
updated to return void instead of 'int'. Update all the impacted drivers
as necessary to fix this.

Bug 4749580

Change-Id: I3bb5c549777f7ccad0e3f870373fdd25726ad7ed
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3182878
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Tested-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-08-11 17:20:34 -07:00
Jon Hunter
b0ff4f1358 pci: endpoint: Update drivers for Linux v6.11
For Linux v6.11, the 'pci_epc_event_ops' structure 'core_init' callback
was renamed to 'epc_init' and a new 'epc_deinit' callback was added.

Update the PCI endpoint drivers for Linux v6.11 by:

 1. Adding tests to conftest to detect the presence of 'epc_init' and
    'epc_deinit'.
 2. Update the drivers as necessary to use the appropriate callback
    depending upon what is present in the kernel.

Bug 4749580

Change-Id: Ife7e2d5d18332bf84f22142c9727dc1ece913c49
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3186686
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-08-05 12:28:50 -07:00
Nagarjuna Kristam
6a29330225 pci: epf: dma-test: Use predefined macros for MSI
Use pre-defined  MSI interrupt numbers for read, write and CRC.

Bug 4779415

Change-Id: I03fd5c9d5f955c2aeefdf26b2fb7d10a2b080d5b
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3186459
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
2024-08-05 12:27:32 -07:00
Nagarjuna Kristam
38bbe2a3b0 pci: endpoint: functions: dma-test: Remove read and add IRQ handling
Remove readtest debugfs, as same can be achieved from regular DMA tests.
Add RP IRQ handling to calculate CRC.

Bug 4747330

Change-Id: Iac07195eb3fcc05b8af16ca6d7e5e8849b14a98c
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3184953
Tested-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2024-08-02 16:44:06 -07:00
Nagarjuna Kristam
c0896b1af7 pci: epf: dma-test: Clear bar only for T23x
During EP deinit, BAR is cleared. However, For T26x, this notification
is triggered from stop() ops callback. Both stop and clear bar executes
on EPC mutex lock, resulting in deadlock.
Since during EP deinit all EP registers are cleared, clear_bar execution
is not needed.

Bug 4567932

Change-Id: I7b28a85a4da51bdaf5228b6462fb723758c46753
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3171420
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-07-13 12:45:34 -07:00
Jason Mei
b8d1d9a28e PCI: EPF: tvnet: disable the edma interrupt
1. Disable the corresponding PCIe EP controller
   EDMA interrupt.
2. Disable IP checksum to improve performance
   since the PCIe link is reliable.
3. DMA unmap matches the map size.
4. Adjust the SKB buffer link list handle.

Bug 4704944

Signed-off-by: Jason Mei <jianjunm@nvidia.com>
Change-Id: I05f76fa60e3533c2dd01e53ed17664d6898fcffd
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3158126
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3164057
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
2024-07-13 12:35:19 -07:00
Jon Hunter
d449f6cfd6 PCI: EPF: dma-test: Fix build for Linux v6.10
In Linux v6.10, the 'core_init_notifier' flag has been removed and
dw_pcie_ep_init_notify() is now called by the designware endpoint driver
so it is not necessary to call from the EPF DMA test driver. Add a test
to the conftest script to detect the presence of the
'core_init_notifier' flag and update the EPF DMA test driver as
necessary.

Bug 4593750

Change-Id: I1c3862df2c673fcb2d7c19ebbf5e7d1cbdefea1f
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3152309
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-07-13 02:47:36 -07:00
Laxman Dewangan
13027c8c90 pci: Port pci-epf-tegra-vnet to support 5.14.0
Most of the code in the file pci-epf-tegra-vnet.c is written
to support the linux kernel version 5.14.x (x != 0), all minor
version above 0.
Make the condition of linux version check such that 5.14.0 is
also part of 5.14.x i.e. (5.14).

Jira HOSTX-5375

Change-Id: Ib3d7ca619497761b8bc77796c9fe0f59c2ab9cf8
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3166767
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-07-03 07:47:55 -07:00
Laxman Dewangan
00a95facef pci: Add conftest to determine if msi_get_virq() present
The API msi_get_virq() get added by commit 98043704f375 ("genirq/msi:
Make msi_get_virq() device domain aware") in Linux v6.1. Use
conftest to determine if this API is available or not.

Jira HOSTX-5375

Change-Id: I5e4cef9622d852fc889d9652e6631a79f2d21f9b
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3166766
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-07-03 07:47:50 -07:00
Laxman Dewangan
b260a8f442 pci: Use conf test to determine API change of pci_epc_write_header()
Add conftest to determine if the pci_epc_write_header() has the vfn
argument or not.

Commit 53fd3cbe5e9d791("PCI: endpoint: Add virtual function number
in pci_epc ops") added virtual function number as argument in the
APIs in Linux 5.14.

Jira HOSTX-5375

Change-Id: Ib0b1fbc2a33f9159f3497374d253e264a90f7b4d
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3166765
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-07-03 07:47:40 -07:00
Manikanta Maddireddy
49bb1dec11 PCI: EPF: dma-test: Add outbound ATU test function
PCIe endpoint controller supports 8 outbound channels to map Root port
address and access it as memory mapped IO. Add test function to verify
this feature.

Bug 4705051

Change-Id: I126e94619c581ed15f1d6db54845de209742af0e
Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3163953
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
2024-07-01 14:38:00 -07:00