Commit Graph

13 Commits

Author SHA1 Message Date
Laxman Dewangan
3713d89fdb prod: Add support for legacy and next-gen prod via config
Instead of using the Linux kernel version, use the
configs coming from core kernel to find out whether
legacy or next-gen prod configuration method is used.

This will help on porting changes on any kernel and
configuring via core kernel configs.

Bug 3389584

Change-Id: I19c242c573dd63c7dbecbf87d4ba807857dcf4fb
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3013911
(cherry picked from commit 1dd2ef3473)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3087161
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-04-16 12:09:22 -07:00
Jon Hunter
74c0a6d16d 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
(cherry picked from commit 2c3a31c9b72785ee35ad079422b624f59a35f622)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3276870
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-01-06 06:09:10 -08:00
Jon Hunter
15ca4ff659 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
(cherry picked from commit 951b2423a8)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3210788
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-09-11 04:39:43 -07:00
Jon Hunter
6997999d7a spi: Fix build for Linux v6.9
For Linux v6.9 the compatibility layer that existed for transitioning
SPI drivers from using the legacy 'master' based naming to the
'controller' based naming for functions, structures and variables has
been removed. This is causing the various SPI driver build failures.

The compatibility layer was first introduced in Linux v4.13 by commit
8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"") and given
that the newer "controller" based naming works for kernels from v4.13,
update the various SPI drivers to use the new naming for all current
supported kernels.

Bug 4471899

Change-Id: I5d9fcc429ab4262eb2827b61eb5aec729059f4b5
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3109504
(cherry picked from commit 4432f3b652)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3111546
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-04-18 13:56:47 -07:00
Jon Hunter
11670f570d spi: Fix build for Linux v6.8
For Linux v6.8, support for SPI controllers with multiple chip-selects
was added to the SPI core and this updated the 'chip_select' member of
the 'spi_device' structure to be an array. This breaks building the
Tegra124 SPI Slave driver and Tegra210 QUAD SPI driver.

A helper function, spi_get_chipselect(), was added for Linux v6.3 to
retrieve the chip-select for a SPI device and can be used for retrieving
the chip-select for all Linux v6.3+ kernels.

Add a conftest rule to detecting if spi_get_chipselect() is present and
if so use this for getting the chip-select. This fixes the build issues
for Linux v6.8.

Bug 4448428

Change-Id: Ia4f95ed96b9a18cc7da7a4a52305fc64bc31905c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3050146
(cherry picked from commit 9e2f7ecdf7)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3051189
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-12 02:37:51 -08:00
Jon Hunter
325bd67f86 drivers: prod: Fix kernel version checks
The new Tegra Prod APIs are to be used for NVIDIA Linux kernels v5.16+.
Building the MTTCAN and QUAD SPI driver currently fail for upstream
Linux v5.16 because the various version definitions are not correct.

Some definitions have greater than v5.16.0 instead of greater than OR
equal to v5.16.0. This means that the new APIs will only be used
starting with v5.16.1+ and not v5.16.0 as inteaded.

Other definitions have less than or equal to v5.16.0 instead of just
less than v5.16.0. This means that we will still use the legacy APIs for
v5.16.0.

Fix this by correcting the definition that the drivers can be built for
upstream Linux v5.16.

Bug 4097475

Change-Id: I7d8dd04911a7d6426c67e82396c8a6f1b372875d
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3006521
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-01 08:58:34 -07:00
Laxman Dewangan
1e8bd7b606 qspi: tegra: Add new prod setting support
Add new prod setting support which is the
property based on device tree. The prod
setting of each register field are new property
in DT and prod configurations are configured
via these new properties.

Bug 4097475

Change-Id: Iac61ddd20ceb5b1ea588519ab031275a926f5c41
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2996302
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-14 05:54:31 -07:00
Vishwaroop A
a47fbd17b7 drivers: spi: enable autosupsend delay
Add runtime auto suspend support and provide
a dt option to set this delay for each bus.

Perf drop is seen due to clock switching during
write operation. QSPI flash device write page size
is 256 KB so clock switching was being done for every
256KB due to pm_runtime_put(&pdev->dev) call.

pm_runtime_put() function is called, the Linux kernel
will begin to power down the device. This may involve
disabling clocks, powering down voltage regulators, and
releasing other resources etc.

pm_runtime_set_autosuspend_delay function sets the
autosuspend delay for a device. The autosuspend delay
is the amount of time that the device will remain active
after it has been idle before it is automatically suspended.
The pm_runtime_set_autosuspend_delay() function can be used to
reduce power consumption by automatically suspending devices
when they are not in use.

Bug 4229700

Change-Id: Ib49b02c78ad25957c80d22f5cc316afa55aa24dd
Signed-off-by: Vishwaroop A <va@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2985140
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-09-27 08:21:40 -07:00
Vishwaroop A
41b335e6a1 spi: tegra-quad: add support for prod framework
Write production settings through prod framework

Bug 4165918

Signed-off-by: Vishwaroop A <va@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2924617
(cherry picked from commit c7cf9886e781e46385212ba1b821900488e39132)

Change-Id: I514f19ffdf1749c2e6935714bba68d0bf049954a
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2929348
Reviewed-by: Vishwaroop A <va@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Vishwaroop A <va@nvidia.com>
2023-07-02 10:02:21 -07:00
Vishwaroop A
9d101a46bb spi: use non combined seq for split xfers
Add check to switch to non combined sequence for
transfers if transfer length is greater than
DMA buffer size. Combined sequence cannot handle
split transfers so anything above dma_buf_size fails.
In case the transfers are beyond 64KB add a mechanism to
switch to non combined sequence of transfers.

Bug 3754288

Change-Id: I4d4eda56dcefdd9e35c19cdaf770783b99650c2c
Signed-off-by: Vishwaroop A <va@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2886311
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-27 08:01:15 -07:00
Laxman Dewangan
bf3ab1984d spi: tegra210: quad: Fix fall through warning
There is switch-case where one case is falling to the
next case. This is creating the compilation warning.
Make this fall through as intentional by adding
compiler attribute as "fallthrough".

Bug 4052299

Change-Id: I0276a4a673284ffbdbc0ca18b650b3c51a4a095f
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2880031
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-01 10:54:53 -07:00
Vishwaroop A
dd88969020 spi: tegra210-quad: fix combined sequence programming
Fix the failures observed in combined sequence programming
while validating qspi flash on orin platforms.

Change-Id: Ifd404eebfc1480f328c58930c95b30903f2d3269
Signed-off-by: Vishwaroop A <va@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2869997
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-03-17 10:07:53 -07:00
Vishwaroop A
78ef37abb0 spi: tegra210-quad: enable qspi controller driver
Enable QSPI controller driver for kernel-OOT

Change based on below commits:

[UPSTREAM v5.16] 134a7237 spi: tegra210-quad: Put device into suspend on driver removal
[UPSTREAM v5.17] f89d2cc3 spi: tegra210-quad: use devm call for cdata memory
[UPSTREAM v5.18] 47c3e06e spi: tegra210-quad: Fix missin IRQ check in tegra qspi probe
[UPSTREAM v5.18] ac982578 spi: tegra210-quad: use device reset method
[UPSTREAM v5.18] ea23f0e1 spi: tegra210-quad: add new chips to compatible
[UPSTREAM v5.18] 75a1b44a spi: tegra210-quad: add acpi support
[UPSTREAM v5.18] 1b8342cc spi: tegra210-quad: combined sequence mode
[UPSTREAM v6.0]  b7613417 spi: tegra210-quad: Multi-cs support
[UPSTREAM v6.1]  8777dd9d spi: tegra210-quad: Fix combined sequence
[UPSTREAM PENDING] spi: tegra210-quad: Fix duplicate resource error
[UPSTREAM PENDING] spi: tegra210-quad: Use nbits in combined seq
[UPSTREAM PENDING] spi: tegra210-quad: combined seq for 4READ
[UPSTREAM PENDING] spi: tegra210-quad: native dma support
[UPSTREAM v6.1] spi: tegra210-quad: Don't initialise DMA if not supported
[UPSTREAM PENDING] spi: tegra210-quad: Fix cs change in cmd sequence
665a990fdbea6 spi: tegra210-quad: Fix an error message
6a8a8b51703c6 spi: tegra210-quad: Add support for hardware dummy cycles transfer
921fc1838fb03 spi: tegra210-quad: Add support for Tegra210 QSPI controller

Change-Id: I372ba5556b50457d41b1ba09364ed9c71659e520
Signed-off-by: Vishwaroop A <va@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2817463
Reviewed-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-30 10:44:08 -08:00