Commit Graph

6 Commits

Author SHA1 Message Date
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
c196de1377 spi: tegra124-slave: Fix callback prototype
The Tegra124 SPI slave driver declares a prototype for the function
tegra_spi_slave_register_callback() that does not exist. The correct
function name is tegra124_spi_slave_register_callback() and so fix the
prototype accordingly. Move the prototype to an actual header because
this is the correct place for defining prototypes for other drivers to
reference. This was caught by enabling the compiler flag
-Wmissing-prototype.

Bug 4404965

Change-Id: I765723d0a5ed6369784e5f6c480a6f03500659f3
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3027487
(cherry picked from commit 19a85c968c)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031243
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-11 12:09:42 -08:00
Jon Hunter
4b3511a749 spi: tegra124-slave: Drop legacy GPIO support
Since Linux v6.3, legacy GPIO support has been dropped from the Linux
kernel and the gpiod_xxx functions have been supported for a long time
going back to Linux v3.x kernels. Therefore, drop support for the legacy
GPIO functions.

This is beneficial for working with 3rd party Linux kernels that may
have back-ported upstream changes into their kernel and so the kernel
version checks do not work.

Bug 4119327

Change-Id: Ib84e70b27645032108b2c25ce5d4ea3977f6cae1
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2993098
Reviewed-by: Vishwaroop A <va@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-09 15:30:33 -07:00
Jon Hunter
bc6f405401 spi: tegra124-slave: Fix support for Linux v6.3
Linux v6.3 updated the GPIO APIs to use GPIO descriptors instead of
indices. This broke the Tegra SPI slave driver and when compiling the
driver for Linux v6.3 various warnings are observed. Update the Tegra
SPI slave driver as necessary to fix support for Linux v6.3.

Bug 4014315
Bug 4190165

Change-Id: Idfa29f729351d2971a649ddbcf1c3e9bf658d160
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2938376
Reviewed-by: Vishwaroop A <va@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-19 08:47:08 -07:00
Vishwaroop A
f7fd6ebb95 nv-oot: spi: fix kernel compilation issues
fix compilation issue when building spi slave driver
with 6.3-rc1 upstream kernel.

Bug 4014315

Change-Id: I4f8d83a5fdbc8957333034a4b8894e8e34d29ecc
Signed-off-by: Vishwaroop A <va@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2900975
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-10 13:54:15 -07:00
Vishwaroop A
a557199c74 spi: tegra124-slave: tegra124 spi slave driver
Tegra spi slave driver for T124 and later chips.

Fix build error as
"'fpclk_name' may be used uninitialized".

Check and avoid divide by zero where clock rate
can be zero while selecting best clock.

SPI slave controller clock should be between 1.5 times to 4 times
of interface clock. Currently it is set to 4 times.
Change it to 3 times to avoid border cases where actual clock is not
same as what is requested.
Ex: master is set to .99MHz when 1MHz is requested and
slave is set to 4MHz as requested. Here above rule is violated.

SPI slave controller clock should be 1.5x of interface clock.
Change it to 2x to avoid border cases where actual clock set
is not same as what is requested.
Ex: master is set to 1MHz and slave is set to 1.48MHz instead
of 1.5MHz as requested. Here above rule is violated.

Set max buffer size to dma buffer size if dma init is
successful

Change based on below commits from linux-5.10
9de18723 spi: handle dma_slave_config error.
3a33b5fb spi: fix mem leak in spi slave driver
4b9b15ae drivers: Fix compile errors seen while merging 'v5.10-rc2'

Change based on below commits from linux-4.9
76a47a65 spi: tegra124-slave: tegra124 spi slave driver
2c341aa0 drivers: spi: fix -werror
b511c6f4 spi: tegra: Avoid divide by zero error
fdd18c3f spi: slave: Fix controller clock multiplier
829c57d6 spi: slave: Fix controller clock multiplier
85f8f7c2 spi: tegra: fix max buffer size

Bug 200021334
Bug 1899778
bug 1745660
Bug 200304626
Bug 200106113
Bug 200112595
bug 200054134
bug 1585361
Bug 200157229
bug 200116059
Bug 200063654
Bug 200045563
Bug 200084260
Bug 200141432
bug 200194538
bug 200129610
Bug 200319741
Coverity ID: 29578
Bug 200319815
Bug 200379969

Change-Id: Ibfadb40469f30b21350ed0fb7ee5daf96047197d
Signed-off-by: Vishwaroop A <va@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2888151
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-27 08:01:45 -07:00