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>
This commit is contained in:
Jon Hunter
2024-01-16 15:34:15 +00:00
committed by mobile promotions
parent 902712a236
commit abeacc3534
3 changed files with 22 additions and 3 deletions

View File

@@ -1,5 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
// Copyright (c) 2015-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // Copyright (c) 2015-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <nvidia/conftest.h>
#include <nvidia/conftest.h> #include <nvidia/conftest.h>
@@ -1903,7 +1905,7 @@ static struct ufs_tegra_soc_data tegra234_soc_data = {
.chip_id = TEGRA234, .chip_id = TEGRA234,
}; };
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) #if defined(NV_TEGRA264_CHIP_ID_PRESENT) /* Linux v6.5 */
static struct ufs_tegra_soc_data tegra264_soc_data = { static struct ufs_tegra_soc_data tegra264_soc_data = {
.chip_id = TEGRA264, .chip_id = TEGRA264,
}; };
@@ -1916,7 +1918,7 @@ static const struct of_device_id ufs_tegra_of_match[] = {
}, { }, {
.compatible = "tegra234,ufs_variant", .compatible = "tegra234,ufs_variant",
.data = &tegra234_soc_data, .data = &tegra234_soc_data,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) #if defined(NV_TEGRA264_CHIP_ID_PRESENT) /* Linux v6.5 */
}, { }, {
.compatible = "tegra264,ufs_variant", .compatible = "tegra264,ufs_variant",
.data = &tegra264_soc_data, .data = &tegra264_soc_data,

View File

@@ -148,6 +148,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_rtd_to_codec
NV_CONFTEST_FUNCTION_COMPILE_TESTS += simple_util_dai_init NV_CONFTEST_FUNCTION_COMPILE_TESTS += simple_util_dai_init
NV_CONFTEST_FUNCTION_COMPILE_TESTS += spi_get_chipselect NV_CONFTEST_FUNCTION_COMPILE_TESTS += spi_get_chipselect
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tc_taprio_qopt_offload_struct_has_cmd NV_CONFTEST_FUNCTION_COMPILE_TESTS += tc_taprio_qopt_offload_struct_has_cmd
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra264_chip_id
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_dev_iommu_get_stream_id NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_dev_iommu_get_stream_id
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_ivc_struct_has_iosys_map NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_ivc_struct_has_iosys_map
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tty_operations_struct_write_has_u8_ptr_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += tty_operations_struct_write_has_u8_ptr_arg

View File

@@ -7439,6 +7439,22 @@ compile_test() {
compile_check_conftest "$CODE" "NV_TC_TAPRIO_QOPT_OFFLOAD_STRUCT_HAS_CMD" "" "types" compile_check_conftest "$CODE" "NV_TC_TAPRIO_QOPT_OFFLOAD_STRUCT_HAS_CMD" "" "types"
;; ;;
tegra264_chip_id)
#
# Determine if the 'TEGRA264' definition is present.
#
# Added by commit d94436465152 ("soc/tegra: fuse: Add support for
# Tegra264") in Linux v6.5.
#
CODE="
#include <soc/tegra/fuse.h>
u8 conftest_tegra264_chip_id(void) {
return TEGRA264;
}"
compile_check_conftest "$CODE" "NV_TEGRA264_CHIP_ID_PRESENT" "" "types"
;;
tegra_ivc_struct_has_iosys_map) tegra_ivc_struct_has_iosys_map)
# #
# Determine if the 'tegra_ivc' structure has the 'map' argument. # Determine if the 'tegra_ivc' structure has the 'map' argument.