Commit Graph

35 Commits

Author SHA1 Message Date
Shubhi Garg
12c09aa934 net: can: mttcan: split 8Mbps for 40MHz and 50MHz
The MTTCAN controller uses different core clock frequencies depending on
the SoC variant: 40MHz for T264 and 50MHz for T194/T234. The 8Mbps data
bitrate needs to be an exact divisor of the clock frequency for proper
operation.

For 40MHz clock: 8Mbps = 8000000 bps (40MHz / 5)
For 50MHz clock: 8Mbps = 8333333 bps (50MHz / 6)

The previous single MTTCAN_SPEED_8MBPS definition (8333333) only worked
correctly for 50MHz clocks and would not divide evenly for 40MHz clocks.

Split MTTCAN_SPEED_8MBPS into two separate defines:
- MTTCAN_SPEED_8MBPS_40MHZ: 8000000 for exact 8Mbps on 40MHz clock
- MTTCAN_SPEED_8MBPS_50MHZ: 8333333 for closest 8Mbps on 50MHz clock

Both values use the same production settings (prod_c_can_8m) and will be
selected based on the chip's configured clock frequency. The 5Mbps rate
remains unchanged as it divides evenly for both clock frequencies.

Bug 5497458

Change-Id: I17190ae6821f89d33e76114f20b91dbd65ba25f2
Signed-off-by: Shubhi Garg <shgarg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3469194
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Tested-by: Kevin Fu <chunhuaif@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
2025-10-15 01:28:10 -07:00
Jon Hunter
76bdc9f5b6 net: can: mttcan: Fix build for Linux v6.17
In Linux v6.17, the 'const' qualifier for the 'struct cyclecounter'
argument on of the cyclecounter 'read' function pointer was dropped.
Add a test to conftest to detect this and update the Tegra MTT CAN
driver accordingly to fix the build.

Bug 5420210

Change-Id: Idff1429bbf45fe160e16a6dbc51e8cb00909a876
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3423831
(cherry picked from commit 10569f9bbea4fc8172a94b8d5c5190fc2687b199)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3462468
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-10-02 10:14:18 -07:00
Jon Hunter
9976ac1020 net: can: mttcan: Drop support for legacy kernels
Drop support for Linux kernel prior to v5.15 because these are no longer
supported.

Bug 5420210

Change-Id: I659c71f11d4c8996a35c952e0c6b27d7b7dcf239
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3423848
(cherry picked from commit f236f1fbd9d5d7b1886fc3abfa83719da1996772)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3462467
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
2025-10-02 10:14:07 -07:00
Jon Hunter
594c03645c net: can: mttcan: Fix build for Linux v6.16
In Linux v6.16, the structure 'data_bittiming_params' was added to the
'can_priv' structure and all the related data bittiming parameters were
moved under this new structure. Add a test to conftest to determine if
this new structure is present and update the Tegra MTTCAN driver
accordingly.

JIRA LINQPJ14-60

Change-Id: Ibd8f6bd81a903b15a55d837023dada835a1e72ca
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3374645
(cherry picked from commit 86396ec47b78a7716a5faa8d492d74efc7f23dce)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3461874
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-10-01 15:27:48 -07:00
Jon Hunter
a59a10dfeb 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
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
2025-07-24 10:19:18 +00:00
Shubhi Garg
975ca77f46 mttcan: support T264 FSI CAN from ccplex
Adding support in existing mttcan driver to control T264 FSI
CAN controllers from CCPLEX whether FSI firmware is loaded on
system or not. FSI CAN clocks will be enabled by FSI crystal clock
upon boot. SW does not need to enable or control clocks. CCPLEX cannot
control FSI controller resets, reset can be handled during boot, thus
disabled clocks and reset for T264 SOC.

Bug 4317516

Change-Id: I8e6b20640c8763ebc0a9d9192e3212a49902f9b4
Signed-off-by: Shubhi Garg <shgarg@nvidia.com>
2025-07-24 10:19:09 +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
Shubhi Garg
21a95b938b 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
(cherry picked from commit f902d95962)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3144103
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:07 +00:00
Krishna Yarlagadda
9dc14f1027 tegra: prod: use legacy prod settings
Remove references to upstream prod settings and use legacy prod.

Bug 4765671

Change-Id: Iafe36bdeab027ae121a99bfda665cc28089907c6
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3186209
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-08-13 10:46:51 -07: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
Laxman Dewangan
1dd2ef3473 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
Reviewed-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-10 08:33:42 -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
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
16d1e13a3b mttcan: fix compilation error for android
1. nvidia-oot/drivers/net/can/mttcan/native/../
   include/m_ttcan_linux.h:35:10:
   fatal error: 'linux/tegra_prod.h' file not found
         ^~~~~~~~~~~~~~~~~~~~
   1 error generated.

2. nvidia-oot/drivers/net/can/mttcan/hal/m_ttcan.c:330:6:
   warning: unused variable _tdcr_reg_ [-Wunused-variable]
   330 |  u32 tdcr_reg;
      |      ^~~~~~~~

Bug 4174549

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: I57ae8d1234745996fb1277c64c632d2d1026a870
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2928348
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Bruce Xu <brucex@nvidia.com>
Tested-by: Bruce Xu <brucex@nvidia.com>
2023-06-30 13:01:41 -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
Laxman Dewangan
1d719d1580 can: mttcan: 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: Ie1fd5a056bd7b6a79f12b73a23a5b0083f08ab55
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2880033
Reviewed-by: svcacv <svcacv@nvidia.com>
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:55:02 -07:00
Manish Bhardwaj
183b86a656 Revert "drivers: Disable broken drivers for Linux v6.3"
Bug 4014315

This reverts commit 877b293bd79071028709ea47deb8fc87d5d65f6c.

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: Ic043c3d18f095a056fa82182664a8b2bf0a52847
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2868424
Reviewed-by: Sandeep Trasi <strasi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-03-25 02:41:40 -07:00
Jon Hunter
fee7e399b9 drivers: Disable broken drivers for Linux v6.3
Several drivers fail to build with Linux v6.3 due to upstream changes in
the Linux kernel. Disable this drivers until a fix is in place.

Bug 4014315

Change-Id: Iddd2c1e552c92311a982ff91837cef6377a947d6
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2867129
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Rohit Khanna <rokhanna@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-03-22 03:25:09 -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