Depending on kernel version the Tegra UFS driver includes different
headers to build the driver. Now that Linux v5.x kernels are no longer
supported, we can simplify this. Simplify the headers for the Tegra UFS
driver as follows ...
1. For Linux v6.x kernels only the ufshcd-priv.h and ufshcd-pltfrm.h
headers are required. These headers are copied from the Linux kernel.
However, only the prototypes for the functions 'ufshcd_query_attr',
'ufshcd_query_descriptor_retry' and 'ufshcd_pltfrm_init' are needed.
The functions 'ufshcd_query_attr' and 'ufshcd_query_descriptor_retry'
have not been change since they were introduced in Linux v4.17 and
the function 'ufshcd_pltfrm_init' was last updated in Linux v6.1
(making the ufs_hba_variant_ops argument const). Although redefining
the prototypes outside the kernel is fragile and does not protect the
Tegra UFS driver from updates to these functions, this problem
already exists.
2. Move the files ufshcd-pltfrm.h and ufshcd-priv.h into the Tegra UFS
driver directory because these are not needed outside of the driver.
JIRA LINQPJ14-47
Change-Id: I3891bf756723f730f036637891c55090b5d2a384
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3349825
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
In Linux v6.13, the quirk definition 'UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS'
was removed and replaced with a function pointer than can be used to set
the DMA mask as needed for a given device. Update the Tegra UFS driver
to fix support for Linux v6.13. Note that prior to Linux v6.13, the flag
'UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS' would set the DMA mask to 32-bits
and so this change is equivalent to the configuration of prior kernels.
Bug 4991705
Change-Id: I859331e9eea918d2438d68b871642fee5e4148e0
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3283447
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Not all kernel define the enum UFSHCD_QUIRK_BROKEN_PWR_SEQUENCE
Add conftest to find out whether kernel has define the enum
UFSHCD_QUIRK_BROKEN_PWR_SEQUENCE or not and then check for macro
before using it.
Bug 4911768
Change-Id: I4eba6f02ab79c1d4a5bdefb3ec831cc4ae34d527
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
GO bit will be cleared after driver
writing it to 1. Need to check the
clear status. Added check for the same.
Bug 4782274
Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Change-Id: I71f035a27fb95de3e37d515a34c48c493f827a44
Set utmi_pll1 as parent for cpu_isc clocks
Bug 4782274
Change-Id: Iab71527dc6de3f46d4b7880c3dd00eadc130c5ba
Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
dev_err is used for information prints.
Changed them to dev_info and dev_dbg.
Bug 4736849
Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Change-Id: I990edef75566ca718fab611b36385f6ec5f12c44
Read fuse to check if chip has RDL fix or not.
Return error for non-RDL chips.
Bug 4243018
Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Change-Id: Ibe441ca136c18e03cebbc1cd5d0cc529d45005c6
UFS parent clock in T264 is pllrefufs_clkout624
and the rate is to 208 MHz.
Bug 4199271
Change-Id: I5b86e199f93fc1c81506cb29391b96efdc7de3a4
Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Set HCLKDIV to 0xD0 as per IAS.
Bug 4199271
Change-Id: I4779c74c657d8723a27a167096dfac9d22128436
Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
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
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: svc-bootloader-acv <svc-bootloader-acv@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
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
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
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
Reviewed-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Tested-by: Vishwaroop A <va@nvidia.com>
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
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
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
Reviewed-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>