Commit Graph

9 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
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
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
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
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
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