Commit Graph

25 Commits

Author SHA1 Message Date
Jon Hunter
2ec6cdcc9b drivers: Update timer APIs for Linux v6.15
In Linux v6.15, the timer APIs hrtimer_init() and del_timer() have been
removed. The hrtimer_setup() was added in Linux v6.13 to replace
hrtimer_init() and hrtimer_init() have finally been removed. The
functions del_timer()/del_timer_sync() were renamed to
timer_delete()/timer_delete_sync() in Linux v6.15. Use conftest to
detect these changes and update the drivers as necessary.

JIRA LINQPJ14-47

Change-Id: Id3994900384aad4b91155507cda91e04898ab12c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3336168
(cherry picked from commit ce90abdb8137610988f291cd02ed8cf97bca673f)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3499760
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Tested-by: Brad Griffis <bgriffis@nvidia.com>
2025-12-04 09:41:48 -08:00
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
Shubhi Garg
f902d95962 drivers: mttcan: fix bus-off restart txfer
[Issue]: CAN freezes/stops to send messages after restart from bus-off state.
Throws following log from kernel: "write: No buffer space available"

[Reason]: When message txfer starts, tx_object (which keeps track of active tx)
gets filled. If CAN goes to bus-off state, txfer remains incomplete for some
messages. In such case, tx_object bits will not get cleared. It will stop
adding more messages in controller RAM.

Along with tx_object, from network layer, there are socket echo buffers.
When CAN is initialized and up on network, netif_start_queue is pushed to start
transmission. When msg txfer starts, socket buffer gets filled and freed only
when txfer completes. During bus-off, since network queue remains ON, all the
queued msgs get filled in socket buffers and does not allow upcoming msgs.
Therefore we see "write: No buffer space available".

[Fix]: Clear tx_object when device goes to bus-off state and stop network queue.
Start network queue again during restart from bus-off.

Bug 4438223

Change-Id: I3cbc6529a90f357372c8b0095bdce4217b133e9b
Signed-off-by: Shubhi Garg <shgarg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3142091
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2024-05-23 01:54:36 -07: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
9a65689ba2 mttcan: 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: I86adc7b72a28802d73fee8a085db2bccf0d6d1cc
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2996771
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-14 05:56:30 -07:00
Jon Hunter
ece68dd0d1 net: Use conftest
Instead of relying on kernel version to determine if functions or
specific versions of functions are present in the kernel, add compile
time tests to the conftest.sh script to determine this at compile time
for the kernel being used. 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: I79e701940ca70ca4d66500c75b5992f9d92b54b0
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2985744
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-10-03 04:01:15 -07:00
Jon Hunter
8409b7c652 net: can: mttcan: Make LED support depend on CAN_LEDS
CONFIG_CAN_LEDS has been marked as BROKEN since Linux v4.19 and was
finally removed in Linux v5.19. Only compile support for LEDS if enabled
in the kernel. Long-term we need to move the MTTCAN driver to use
LEDS_TRIGGER_NETDEV.

This is a better solution for working with 3rd party Linux kernels that
may backport upstream changes to the kernel and hence are not compatible
with these existing version checks.

Bug 4228080
Bug 4283911

Change-Id: I70e800c4a3699af59742d30111bc3a3cbf80bcb5
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2982135
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-21 13:11:36 -07:00
Jon Hunter
8f976ab022 net: can: mttcan: Drop unnecessary version checks
GPIO descriptor support has been supported in the Linux kernel since
v3.16. Therefore, simplify the MTTCAN driver by removing the legacy GPIO
support and only use GPIO descriptors.

Bug 4119327
Bug 4228080

Change-Id: Ib1c50d17c514dee6a5c69145a8f5d3e07b5b3855
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2981396
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-19 21:11:29 -07:00
Manish Bhardwaj
df0489a1e0 CAN: program prod setting for tdcr register
Using this patch we are programming tdcr register
of can controllers based on the data speed.

Bug 4165928

Change-Id: I4d3f9426695b4ac19bef144f242dcf74371c00b7
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2924921
Reviewed-by: Suresh Venkatachalam <skathirampat@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-06-28 01:58:03 -07:00
Abhijit
16a076bf64 net: can: mttcan: fix mttcan close in case of PXE
When mttcan
- is set into DAR (Disable Automatic Retransmission) mode
- and Protocol Exception Handling is enabled
- and PXE (Protocol Exeception Event) is generated
then no TCF (Transmission cancellation Finished) event is generated.
This leads to mismatch between internal driver state and mttcan HW
state. This results in "no buffer space available" error.

This patch clears the driver internal state in close callback to
handle this situation.

Bug 200502350

Change-Id: Ie9f8fcc902a8d9b6c65662888904be5ad9aae49e
Signed-off-by: Abhijit <abhijit@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2854706
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2921328
Tested-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-by: Suresh Venkatachalam <skathirampat@nvidia.com>
Reviewed-by: Sandeep Trasi <strasi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-24 07:26:26 -07:00
Manish Bhardwaj
364ae3ed23 mttcan: wait to flush CAN messages
Using this patch we are waiting for CAN messages
to get flushed before going to suspend during
sc7 cycle

JIRA ESLC-7354

Change-Id: Ie368fd9e6b119df71646bf5fddbd89ae2f7c5697
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2881872
Reviewed-by: Suresh Venkatachalam <skathirampat@nvidia.com>
Reviewed-by: Sandeep Trasi <strasi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-06 10:16:08 -07:00
Manish Bhardwaj
72cf7c99c3 mttcan: fix kernel compilation issue
fix compilation issue when building mttcan driver
with 6.3-rc1 upstream kernel.

Bug 4014315

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: I33c15af15fa8db1ac0cbb1c619db5429a6495a80
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2868425
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Sandeep Trasi <strasi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-03-21 02:35:01 -07:00
Manish Bhardwaj
e04d8c343f nvidia-oot: fix sparse errors in mttcan driver.
Using this patch we are fixing below sparse
errors :-
1. drivers/net/can/mttcan/native/m_ttcan_linux.c:627:66:
   warning: Using plain integer as NULL pointer
2. drivers/net/can/mttcan/native/m_ttcan_linux.c:658:56:
   warning: Using plain integer as NULL pointer

Bug 3954363

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: I1dcf51b0a765ee47ee3fae06c1ed31f0d5e84230
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2863100
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-03-01 10:27:26 -08:00
Manish Bhardwaj
aa5d06bcd3 nvidia-oot: fix Coverity defects
Using this patch we are fixing coverity defects in
CAN and storage OOPS driver.

CID 10132028: Unchecked return value (CHECKED_RETURN)
CID 10166522: Uninitialized scalar variable (UNINIT)
CID 10166537: Uninitialized scalar variable (UNINIT)
CID 10166580: Uninitialized scalar variable (UNINIT)

Bug 3952896

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: I3caf0a9121a4480567ce32c6777b547901f24815
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2860630
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-02-21 03:42:27 -08:00
Jon Hunter
4cf27b4441 net: can: mttcan: Fix build for Linux v5.14
Building the mttcan driver currently fails for Linux v5.14 with the
following error ...

 drivers/net/can/mttcan/native/m_ttcan_linux.c:1535:2: error: unknown
 field 'ndo_eth_ioctl' specified in initializer
  .ndo_eth_ioctl = mttcan_ioctl,

Fix this by using the appropriate field name for Linux v5.14.

Bug 3820317
Bug 3896592

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Change-Id: I822d988b097350538fbf4a568181e9fde9928ea3
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2836716
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-01-04 06:57:46 -08:00
Manish Bhardwaj
b0d4743a8b can: reinitialize message ram during resume
Getting below error while data transfer on CAN bus
when target coming out of SC7 cycle.
mttcan c310000.mttcan can0: mram Bit error detectedand uncorrected

reinitialize message ram in resume path to fix this issue

Bug 3837424

Change-Id: Ice275511fd04a91e30665f8ff826da6364b4e4fa
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2795002
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Suresh Venkatachalam <skathirampat@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2832904
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-12-26 06:48:39 -08:00
Manish Bhardwaj
983e121cff nvidia-oot: changes ioctl callback handler
callback handler has been changed in k5.15 so
update ioctl callback handler to invoke
mtttcan ioctl handler

Bug 3896592

Change-Id: I363134263ec8b1d0929847a02251baf3d7bf4940
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2832903
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sandeep Trasi <strasi@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-12-26 06:48:30 -08:00
Manish Bhardwaj
c126c2ee93 mttcan: fix kernel compilation warnings
Using this patch we are fixing below kernel compilation
warnings.
nvidia-oot/drivers/net/can/mttcan/native/m_ttcan_linux.c:
In function 'mttcan_tx_complete':
nvidia-oot/drivers/net/can/mttcan/native/m_ttcan_linux.c
:619:3: warning: ignoring return value of 'can_get_echo_skb',
declared with attribute warn_unused_result [-Wunused-result]
   can_get_echo_skb(dev, msg_no, 0);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Bug 3832874

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: I38426d44a479eb7f87f911985bcaabc96b6b1aa1
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2811270
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Shubhi Garg <shgarg@nvidia.com>
Reviewed-by: Sandeep Trasi <strasi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-22 11:57:40 -08:00
Manish Bhardwaj
9408892331 mttcan: fix kernel compilation warnings
Using this patch we are fixing below kernel compilation
warnings.
out/linux/arm64-defconfig-jetson-modules/nvidia-oot/drivers
/net/can/mttcan/native/m_ttcan_linux.c: In function 'mttcan_start_xmit':
/mlt/kernel/include/linux/stddef.h:8:14: warning: passing argument 4 of
'can_put_echo_skb' makes integer from pointer without a cast
[-Wint-conversion]
 #define NULL ((void *)0)

Bug 3832874

Change-Id: I2aa565f37494f6af39a43b389ea3e1ad7775ed44
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2809373
Reviewed-by: Sandeep Trasi <strasi@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-15 11:29:11 -08:00
Jon Hunter
1cb49e59a3 net: can: mttcan: Fix build for Linux v5.19
When compiling the MTTCAN driver for Linux v5.19 the build fails because
the can_led_xxx() functions are not found. The can_led_xxx() functions
were removed for Linux v5.19 and not Linux 6.0 and so update the driver
accordingly to fix this.

Bug 3820317

Change-Id: I340cc9cbb44b5cb892c50cc0b5d06444ef894fe9
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2792549
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-10-20 02:20:03 -07:00
Jon Hunter
5cfa3e3c3f net: Fix build for Linux v6.1
Upstream Linux kernel commit b48b89f9c189 ("net: drop the weight
argument from netif_napi_add") removes the weight argument from the
netif_napi_add() function and this is breaking the build of a few
drivers that use this function. Fix this by updating these drivers to
use the netif_napi_add_weight() function instead for Linux v6.1.

Bug 3831575

Change-Id: I5ab3c2380db75313f9226c68777e6245e9e9dad5
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2793511
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-10-18 11:24:42 -07:00
Manish Bhardwaj
bb37b5d666 nvidia-oot: fix mttcan driver compilaiton error.
Using this patch we are fixing below compilation
error of mttcan driver with stable kernel.

nvidia-oot/drivers/net/can/mttcan/native/m_ttcan_linux.c:620:3:
error: implicit declaration of function _can_led_event_
[-Werror=implicit-function-declaration]
can_led_event(dev, CAN_LED_EVENT_TX);

Bug 3767126

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: Ic7fa91a34b59f165ce689ad956f1c3779ef13f9a
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2787166
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-05 20:15:02 -07:00
Manish Bhardwaj
0e0d2f2c07 nvidia-oot: add support for mttcan driver
Using this patch we are adding support for
mttcan driver in oot kernel.

JIRA ESLC-6885

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: I83a6d43aa99278a546778cf1700e2bd106ec42a9
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2785360
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-03 21:31:05 -07:00