Commit Graph

8 Commits

Author SHA1 Message Date
Mayuresh Kulkarni
d3bc17ca8b tsec: add debugfs support
add a debugfs file to read-out firmware log messages

Change-Id: I3501b117884a822bd835beecd8e3956481c37386
Signed-off-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2884815
(cherry picked from commit 590640045e9ba26914cad055000f7ce3618640b9)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2895857
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-03 21:02:32 -07:00
Laxman Dewangan
0daf056dc9 tsec: Use SPDX license GPL 2.0 format
Use SPDX license GPL-V2.0 format and change Nvidia
copyright year to include 2023.

Bug 4078035

Change-Id: If13a0a9309c76e1e7b53d6967eada9ed321b8e93
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2890633
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mayuresh Kulkarni <mkulkarni@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-22 09:59:15 -07:00
Mayuresh Kulkarni
6e2882db16 tsec: use correct struct in tsec_of_match
bug 3817626

Change-Id: I98d1e5b63a68abc25dee1fcff49c4b090d58b0d1
Signed-off-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2874293
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@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-04 05:28:43 +00:00
Sahil Mukund Patki
6df40510f9 video: tegra: tsec: fix static analysis issues
Remove address space errors by casting properly. Also make variables
static if used within the same translation unit.

Bug 3528414

Change-Id: Id9d566f5b5c9594c69a1483d2945712e6c9f665c
Signed-off-by: Sahil Mukund Patki <spatki@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2835170
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:28:43 +00:00
Bharat Nihalani
78db0d7c41 tsec: Conditionally turn off clock in suspend
Problem:
=======
In current implementation of tsec_poweroff, tsec clock is getting
turned off unconditionally.

During suspend-resume operation, there is an issue in MB1 as
explained in bug 3796711 (comment 16). Due to this, when
tsec_poweroff function is called for second suspend operation,
tsec clock is turned off even when the power state variable
"pdata->power_on" is not set to true or 1.

This causes the following warning from clock driver highlighting
that tsec clock is already disabled.

<snip>
[  631.507596] tsec already disabled
[  631.507632] WARNING: CPU: 2 PID: 10535 at drivers/clk/clk.c:1216 clk_core_disable+0x2b4/0x340
[  631.507634] Modules linked in: ... <skipped these prints>
[  631.507714] CPU: 2 PID: 10535 Comm: systemd-sleep Tainted: G           OE     5.10.120-tegra #1
[  631.507716] Hardware name: Unknown t234-Orin-SLT-e2421-1099-e2425-1099/t234-Orin-SLT-e2421-1099-e2425-1099, BIOS buildbrain-gcid-32270834 01/05/2023
[  631.507718] pstate: 60400089 (nZCv daIf +PAN -UAO -TCO BTYPE=--)
[  631.507720] pc : clk_core_disable+0x2b4/0x340
[  631.507722] lr : clk_core_disable+0x2b4/0x340
[  631.507723] sp : ffff80001770b8e0
[  631.507724] x29: ffff80001770b8e0 x28: ffff000081f0d140
[  631.507727] x27: ffff000082345930 x26: ffff8000126b1ee0
[  631.507729] x25: ffff8000126b1f70 x24: ffff800010b75630
[  631.507731] x23: 0000000000000000 x22: ffff8000125f23f8
[  631.507734] x21: ffff8000125f2638 x20: ffff0000869aca00
[  631.507736] x19: ffff0000869aca00 x18: 0000000000000000
[  631.507738] x17: 0000000000000000 x16: ffff800011008460
[  631.507740] x15: 0000000000000000 x14: ffff000080990000
[  631.507742] x13: ffff80079c8dc000 x12: 0000000000000028
[  631.507745] x11: 0000000000000003 x10: 0101010101010101
[  631.507747] x9 : 00000000fffffffe x8 : ffff8000128c2dd8
[  631.507749] x7 : 0000000000000004 x6 : ffff8000128d1e4d
[  631.507751] x5 : ffff0007ae6d8a28 x4 : 0000000100011117
[  631.507754] x3 : 0000000000000001 x2 : ffff0007ae6d8a30
[  631.507756] x1 : 0000000000000000 x0 : 0000000000000000
[  631.507758] Call trace:
[  631.507760]  clk_core_disable+0x2b4/0x340
[  631.507763]  clk_core_disable_lock+0x2c/0x50
[  631.507765]  clk_disable+0x30/0x50
[  631.507769]  tsec_disable_clk+0x4c/0x80
[  631.507771]  tsec_poweroff+0x3c/0x80
[  631.507772]  tsec_module_suspend+0x24/0x40
[  631.507776]  platform_pm_suspend+0x40/0xb0
[  631.507780]  dpm_run_callback+0x60/0x260
[  631.507783]  __device_suspend+0x130/0x560
[  631.507785]  dpm_suspend+0x158/0x390
[  631.507787]  dpm_suspend_start+0xc0/0xf0
[  631.507794]  suspend_devices_and_enter+0x100/0x9f0
[  631.507796]  pm_suspend+0x21c/0x4a0
[  631.507798]  state_store+0xa0/0xd0
[  631.507802]  kobj_attr_store+0x14/0x50
[  631.507806]  sysfs_kf_write+0x60/0x90
[  631.507808]  kernfs_fop_write_iter+0x134/0x1e0
[  631.507811]  new_sync_write+0xfc/0x1d0
[  631.507813]  vfs_write+0x26c/0x3b0
[  631.507815]  ksys_write+0x7c/0x110
[  631.507817]  __arm64_sys_write+0x28/0x40
</snip>

Solution:
========

There is a check present in tsec_poweroff function to conditionally
call tsec_prepare_poweroff only if TSEC is powered on. Use the
same check to conditionally call tsec_disable_clk

Bug 3930482
Bug 3893914

Change-Id: Id1f6a8e42f43db4dd91ef4f6ae39166c13f1ba8f
Signed-off-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2838694
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Nikesh Oswal <noswal@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:28:43 +00:00
Sahil Mukund Patki
4de7c8f6d0 video: tegra: Add T239 support in new TSEC driver
This patch adds T239 support in new TSEC driver and removes the
support from the old driver.

Bug 3817626

Change-Id: I705e0bac25e6a905588145aef4a4cc98d0a81651
Signed-off-by: Sahil Mukund Patki <spatki@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2800494
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:28:43 +00:00
Nikesh Oswal
31d2e5fff7 video: tegra: tsec: changes to compile for k5.15
This patch does changes needed in cache flush and
carevout related memory apis which are different
between k5.10 and k5.15.

Also Makefile is changed so that driver gets built
as module on k5.15 and as part of kernel image for
the older k5.10 kernel

Bug 3817626

Change-Id: I4050d41efc61353c34d32d347917e813473ba113
Signed-off-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2793274
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:28:43 +00:00
Nikesh Oswal
d1dc679881 video: tegra: add tsec driver
This driver is inspired from the existing tsec driver
under host1x but its highly simplified to use only
the stuff that is needed and is completely decoupled
from the host1x driver

Bug: 3817626

Change-Id: I8fff7ab539cd5393ea13896c3b056472ca0e0a72
Signed-off-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2785908
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:28:43 +00:00