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
(cherry picked from commit 1dd2ef3473)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3087161
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Laxman Dewangan
2023-11-09 14:27:21 +00:00
committed by mobile promotions
parent e748c978d5
commit 3713d89fdb
5 changed files with 13 additions and 19 deletions

View File

@@ -255,14 +255,14 @@ struct tegra_qspi {
dma_addr_t tx_dma_phys;
struct dma_async_tx_descriptor *tx_dma_desc;
const struct tegra_qspi_soc_data *soc_data;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
#if defined(CONFIG_TEGRA_PROD_NEXT_GEN)
struct tegra_prod_cfg_list *prod_list;
#else
struct tegra_prod *prod_list;
#endif
};
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
#if defined(CONFIG_TEGRA_PROD_NEXT_GEN)
#define QSPI_PROD_FIELD(name, rindex, roffset, fname) \
{ \
.field_name = name, \
@@ -967,7 +967,7 @@ static u32 tegra_qspi_setup_transfer_one(struct spi_device *spi, struct spi_tran
return command1;
}
#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 16, 0)
#if defined(CONFIG_TEGRA_PROD_NEXT_GEN)
static void tegra_qspi_write_prod_settings(struct tegra_qspi *tqspi, const char *prod_name)
{
struct tegra_prod_reg_info *reg_info;
@@ -991,7 +991,7 @@ static void tegra_qspi_write_prod_settings(struct tegra_qspi *tqspi, const char
static void tegra_qspi_set_gr_registers(struct tegra_qspi *tqspi)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#if !defined(CONFIG_TEGRA_PROD_NEXT_GEN)
int err;
#endif
@@ -1001,7 +1001,7 @@ static void tegra_qspi_set_gr_registers(struct tegra_qspi *tqspi)
/* If available, initialise the config registers
* for QSPI with the values mentioned in prod list.
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#if !defined(CONFIG_TEGRA_PROD_NEXT_GEN)
err = tegra_prod_set_by_name(&tqspi->base, "prod", tqspi->prod_list);
if (err < 0)
dev_info_once(tqspi->dev,
@@ -1741,7 +1741,7 @@ static int tegra_qspi_probe(struct platform_device *pdev)
tqspi->controller = controller;
tqspi->dev = &pdev->dev;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#if !defined(CONFIG_TEGRA_PROD_NEXT_GEN)
tqspi->prod_list = devm_tegra_prod_get(&pdev->dev);
#else
tqspi->prod_list = devm_tegra_prod_get_list(&pdev->dev, &qspi_prod_dev_info);