Commit Graph

24 Commits

Author SHA1 Message Date
Jon Hunter
ac6a53078b ufs: Remove UFSHCD_QUIRK_ENABLE_STREAM_ID
Remove the legacy downstream quirk 'UFSHCD_QUIRK_ENABLE_STREAM_ID' and
always use the supported upstream quirk from now on. The legacy quirk
will never be upstreamed and so to support 3rd Party Linux distributions
that will not have this quirk, we should only support the official
upstream quirk.

Bug 4346767
Bug 4450187

Change-Id: Iabec6beb63b99ada7e8893cfa2acc0ed5e7ee92f
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3045039
(cherry picked from commit ce916e3f13)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3055492
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
2024-01-17 09:10:08 -08:00
Laxman Dewangan
56c05f8e3f ufs: Use UFS headers directly if it is public header in core kernel
The UFS headers are moved to include as public headers from
Linux 5.19. Use the headers directly from the core kernel
instead of making the copy in drivers-private for nvidia-oot.

Keep copy of only those drivers which are still in the
drivers folder in core kernel.

This will help to align all definition which driver needs to
sync with core driver available in the core kernel.

Bug 4346767

Change-Id: I1e59e32bee0f89591e50fff2f61e35d468f4207c
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3039312
(cherry picked from commit b2dcbdbc93)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3055490
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
2024-01-17 09:10:02 -08:00
Laxman Dewangan
822abd1943 ufs: Port UFS driver to use headers from core kernel for Linux 6.7
Some of the drivers-private headers are now available in public
header path in core kernel. Use such headers directly from the
core kernel for Linux 6.7 and later instead of copying it in the
nvidia-oot/include/driver-private.

Also match the quirks definition with core kernel for Linux 6.0 and
later.

Bug 4346767

Change-Id: If994466a3cabc6df8eeb0e97018f48d48a8306dc
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3038489
(cherry picked from commit dfff2311c3)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3055485
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-01-17 09:09:57 -08:00
Jon Hunter
abeacc3534 scsi: ufs: Use conftest for Tegra264
The chip ID for Tegra264 was added in Linux v6.5 and not Linux v6.1 as
indicated in the Tegra UFS driver. Hence, the Tegra UFS driver does not
build against any generic Linux v6.1 to v6.4 kernel. Fix this by using
conftest to determine if the chip ID definition is present in the
kernel.

Bug 4221847

Change-Id: If2ca1202b2a69bf7de36fc327406f1579d2f4969
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3054870
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-01-17 06:54:45 -08:00
Jon Hunter
902712a236 scsi: ufs: Use conftest for suspend differences
In Linux v5.19, the arguments to the 'suspend' function pointer defined
in the structure 'ufs_hba_variant_ops' was updated to add a 'status'
argument. Add a new test to the conftest script that checks if the
'suspend' function has a 'status' argument and use the definition
created by conftest to select which structure member is 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 4221847

Change-Id: I05011a4a1aff7c54cd258147d6519b696904a2de
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2996214
(cherry picked from commit f748f0ef72)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3032086
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-01-17 06:54:34 -08:00
Jon Hunter
ff6f3c6916 scsi: ufs: Clean-up headers
Clean-up the UFS headers by adding a new top-level header for ufshcd.h,
ufshci.h and unipro.h that will include the appropriate header
depending on kernel version. This saves replicating the kernel version
check for every source file that includes these headers.

Note that the ufshcd-pltfrm.h header is identical between v5.15, v5.16
and 6.1 kernels and so remove the duplicated versions of this header and
just use a common header for all kernel versions.

Bug 4221847

Change-Id: I0e0ba2f4389af7e34ab62e3131141405d87aeeb1
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2996211
(cherry picked from commit 54e01347ea)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031885
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-17 06:54:24 -08:00
Mallikarjun Kasoju
63486a422c ufs: mphy programming change for fpga
mphy is not available in fpga.
Updated driver accordingly.

Bug 4306006

Change-Id: I179678e51c3a0bb4607bf91d39c7e1f44641752f
Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3002056
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-25 12:05:12 -07:00
Mallikarjun Kasoju
644f308d71 scsi: ufs: Enable PA to VA enable control
Enable UFSHC_PA_VA_CTRL bit for ISC Fabric to consider
virtual memory when SMMU is enabled.

If UFSHC_PA_VA_CTRL is not set, ISC Fabric considers ufs
allocated memory as physical address.

Bug 4243018
Bug 4199052
Bug 4334121

Change-Id: Ia557ea510673f19f59d23ac704b068050f5e355e
Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3000988
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-24 23:50:46 -07:00
Jon Hunter
a4334a5009 scsi: ufs: Add missing headers
When compiling the Tegra UFS driver on certain kernels the various clk
and udelay functions are not found. Add the corresponding headers to fix
the build.

Bug 4221847

Change-Id: Ief2f20abf3704ab7c61c5c802e9eb2ec201179c7
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2996210
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-13 15:47:12 -07:00
Manish Bhardwaj
3d4d545d18 nvidia-oot: ufs: add support for ufs driver for thor
Bug 4199271

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: If8f0270e7d1141e218d031ff8faca1274ec42c96
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2974347
Reviewed-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Reviewed-by: Sandeep Trasi <strasi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-20 18:55:44 -07:00
Mallikarjun Kasoju
c9dae14cce scsi: ufs: Fix CBB errors for K6.1
Made below changes to hba structure to make it
symmetric as core hba structure for K6.1.

1. Remove unused members in hbs structure.
2. Added write booster mutex.

Bug 4161857

Change-Id: I1fdb5e7da11e51edb9f072f8fde25795b38bdc30
Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2973021
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-09-04 08:25:48 -07:00
Mallikarjun Kasoju
7939750e65 scsi: ufs: Fix CBB errors
UFS virtualization registers are accessed
without taking controller out of reset.

Bug 4161857

Change-Id: I6860eb2011fc6be5ffe9dba91ed94a8a749a4add
Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2970936
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-01 13:08:08 -07:00
Jian-Min Liu
6f90c6d858 Fix unused function errors for ack user build
In Android's user-build, debugfs is not configured. This has led to
multiple warning errors related to Debugfs usage in the nvidia-oot
build. Add CONFIG_DEBUG_FS conditional compilation around the
functions that use it.

drivers/scsi/ufs/ufs-tegra-common.c:39:13: error: unused function
'ufs_tegra_init_debugfs' [-Werror,-Wunused-function]
static void ufs_tegra_init_debugfs(struct ufs_hba *hba)
            ^
 1 error generated.

drivers/platform/tegra/aon/tegra-aon-debug.c:732:13:
error: unused function 'tegra_aondbg_recv_msg'
[-Werror,-Wunused-function]
static void tegra_aondbg_recv_msg(struct mbox_client *cl, void *rx_msg)
            ^

drivers/platform/tegra/aon/tegra-aon-debug.c:749:12:
error: unused function 'aon_dbg_init' [-Werror,-Wunused-function]
static int aon_dbg_init(struct tegra_aondbg *aon)
           ^
 2 errors generated.

Bug 4230728

Change-Id: I4210c3574b4d76205fdca45990e9ccc02c18620a
Signed-off-by: Jian-Min Liu <jianminl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2964635
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
2023-08-23 11:19:18 -07:00
Abhilash G
2797b7499d scsi: ufs: Remove hardcoded programming to enable HS mode
Remove hardcoded programming to enable HS mode since we
need to support PWM mode for UFS for provisioning.

Bug 3866554

Change-Id: I8b3ef6ca61b51009129f6b42fa169eaa5101c347
Signed-off-by: Abhilash G <abhilashg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2938538
Reviewed-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-21 12:11:05 -07:00
Abhilash G
e3e15a3cb1 scsi: ufs: Fix UFS CBB errors
Fix UFS CBB errors by using the vendor register for
T234 instead of T194.

Bug 4089453

Change-Id: Ic54b2eea6822d459a6103d15eb60ff2d595fc256
Signed-off-by: Abhilash G <abhilashg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2906058
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-05 14:27:39 -07:00
Bharat Nihalani
1f9587aca3 drivers: Fix build errors with DEBUGFS_FS disabled
When CONFIG_DEBUG_FS is disabled, build errors are seen in the
following 2 drivers:

1. bpmpfw - The build error was seen because bpmp-debugfs.c was
getting compiled even when CONFIG_DEBUG_FS was disabled.

2. ufs - The build error was seen due to a couple of reasons:
- Function debugfs_provision_init is defined in a file that is
protected with CONFIG_DEBUG_FS, but is called from another file
unconditionally.
- In ufs-tegra-common.c, there are calls to debugfs_* functions, but
inclusion of the standard header debugfs.h is protected under
CONFIG_DEBUG_FS.

Fix these issues with this change.

Bug 4164776

Change-Id: Iae6384fd2352e55aed2a0ea85e778be6c26a4d54
Signed-off-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2926891
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-28 08:27:28 -07:00
Laxman Dewangan
b275ffc1ef ufs: tegra: Create provisioned and normal version of module
Create the two loadable module for ufs tegra, one without
provisioning and other with provisioning.

This will help to avoid need of the CONFIG variable and
usecase to use the module per their requirements.

Change-Id: I2c9d6e9680b9b2007fcccfa91002154ed29a6928
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2869279
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-03-13 05:01:24 -07:00
Abhilash G
d4d822ee06 scsi: ufs: Add support for UFS provisioning
Add support for UFS provisioning and changing
reference clock frequency using sysfs nodes
for automotive flashing kernel.

Bug 3978622

Change-Id: I236c3d9de3d7ea89c631aec6f11ef20d11656549
Signed-off-by: Abhilash G <abhilashg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2859426
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-03-08 06:20:31 -08:00
Abhilash G
60153c77c1 scsi: ufs: Make functions static and remove unused functions
Sparse is reporting following warnings:
warning: symbol 'ufs_tegra_disable_mphy_slcg' was not declared.
warning: symbol 'ufs_tegra_mphy_tx_advgran' was not declared.
warning: symbol 'ufs_tegra_mphy_rx_advgran' was not declared.
warning: symbol 'ufs_tegra_ufs_aux_ref_clk_enable' was not declared.
warning: symbol 'ufs_tegra_ufs_aux_ref_clk_disable' was not declared.
warning: symbol 'ufs_tegra_aux_reset_enable' was not declared
warning: symbol 'ufs_tegra_ufs_aux_prog' was not declared.

Resolve these issues by making them static and remove functions
that are not getting called.

Bug 3954363

Change-Id: I59b2feeb45c93d8e51dca4fb0d3c752043c15ecd
Signed-off-by: Abhilash G <abhilashg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2855754
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-02-16 00:04:24 -08:00
Jon Hunter
c9981b9ac9 scsi: ufs: Fix build for Linux v6.2
Building the Tegra UFS driver with Linux v6.2 fails with the following
error ...

 drivers/scsi/ufs/ufs-tegra.c:1004:10: error: implicit declaration of
 function ‘pinctrl_select_state’ [-Werror=implicit-function-declaration]
    ret = pinctrl_select_state(ufs_tegra->ufs_pinctrl,
          ^~~~~~~~~~~~~~~~~~~~

Fix this by including the "pinctrl/consumer.h" header file that defines
this function.

Bug 3936429

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Change-Id: I91fdbcb39d8d458021661e2103aa2dc236001066
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2841035
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
2023-01-11 11:26:56 -08:00
Abhilash G
7fb44152e2 scsi: ufs: Add MPHY war for boot failure
Added two wars for boot failure:

1. Added MPHY reset after link startup and set
2. Override control of mux select of MPHY2UPHY RX interface signals

Bug 3677354
Bug 3621817

Change-Id: Ia412d328561905faad4df8982fa86f754f028943
Signed-off-by: Abhilash G <abhilashg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2794834
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-12-13 06:16:25 -08:00
Abhilash G
6f8cb66166 scsi: ufs: Add Stream ID support
Add stream-id programming and Configure
stream-id in resume.

Bug 3441520
Bug 3621817

Change-Id: I16b01ef37e4549a5263d8e232d78805c8f84a5f6
Signed-off-by: Abhilash G <abhilashg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2794804
Reviewed-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-12-12 15:01:00 -08:00
Jon Hunter
fc8041ed6a scsi: ufs: Fix build for Linux v5.16
When building the UFS driver for Linux v5.16 some header files such as
keyslot-manager.h are not found and the build fails. Update the UFS
driver and reorganise the header files to fix the build for Linux v5.16.

Bug 3820317

Change-Id: I10eea40411369e4c5d6809086bb1c35628c0bbad
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2791963
Reviewed-by: Kartik . <kkartik@nvidia.com>
Reviewed-by: Abhilash G <abhilashg@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-20 02:19:39 -07:00
Kartik
1ba41d5ee2 scsi: ufs: add ufs-tegra driver as oot module
Add ufs-tegra driver.

Bug 3621817

Change-Id: I4bf56d02ad627af84d516262edd93e1b593f4e50
Signed-off-by: Kartik <kkartik@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2734906
Reviewed-by: Abhilash G <abhilashg@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Abhilash G <abhilashg@nvidia.com>
2022-09-07 12:19:47 -07:00