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
Reviewed-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Laxman Dewangan
2023-11-09 14:27:21 +00:00
committed by mobile promotions
parent 3d64e97531
commit 1dd2ef3473
5 changed files with 13 additions and 19 deletions

View File

@@ -291,7 +291,7 @@ inline u32 ttcan_read_ecr(struct ttcan_controller *ttcan)
return ttcan_read32(ttcan, ADR_MTTCAN_ECR); return ttcan_read32(ttcan, ADR_MTTCAN_ECR);
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) #if !defined(CONFIG_TEGRA_PROD_NEXT_GEN)
static void tegra_mttcan_config_prod_settings(struct mttcan_priv *priv) static void tegra_mttcan_config_prod_settings(struct mttcan_priv *priv)
{ {
struct ttcan_controller *ttcan = priv->ttcan; struct ttcan_controller *ttcan = priv->ttcan;

View File

@@ -287,7 +287,7 @@ struct ttcan_controller {
struct list_head rx_q1; struct list_head rx_q1;
struct list_head rx_b; struct list_head rx_b;
struct list_head tx_evt; struct list_head tx_evt;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) #if !defined(CONFIG_TEGRA_PROD_NEXT_GEN)
struct tegra_prod *prod_list; struct tegra_prod *prod_list;
#else #else
struct tegra_prod_cfg_list *prod_list; struct tegra_prod_cfg_list *prod_list;

View File

@@ -12,7 +12,7 @@
#define CAN_MSG_FLUSH_TIMEOUT 100 #define CAN_MSG_FLUSH_TIMEOUT 100
static void mttcan_start(struct net_device *dev); static void mttcan_start(struct net_device *dev);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) #if defined(CONFIG_TEGRA_PROD_NEXT_GEN)
#define MTTCAN_PROD_FIELD(name, rindex, roffset, fname) \ #define MTTCAN_PROD_FIELD(name, rindex, roffset, fname) \
{ \ { \
.field_name = name, \ .field_name = name, \
@@ -1877,7 +1877,7 @@ static int mttcan_probe(struct platform_device *pdev)
if (ret) if (ret)
goto exit_free_device; goto exit_free_device;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) #if !defined(CONFIG_TEGRA_PROD_NEXT_GEN)
priv->ttcan->prod_list = devm_tegra_prod_get(&pdev->dev); priv->ttcan->prod_list = devm_tegra_prod_get(&pdev->dev);
#else #else
priv->ttcan->prod_list = devm_tegra_prod_get_list(&pdev->dev, &mttcan_prod_dev_info); priv->ttcan->prod_list = devm_tegra_prod_get_list(&pdev->dev, &mttcan_prod_dev_info);

View File

@@ -254,14 +254,14 @@ struct tegra_qspi {
dma_addr_t tx_dma_phys; dma_addr_t tx_dma_phys;
struct dma_async_tx_descriptor *tx_dma_desc; struct dma_async_tx_descriptor *tx_dma_desc;
const struct tegra_qspi_soc_data *soc_data; 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; struct tegra_prod_cfg_list *prod_list;
#else #else
struct tegra_prod *prod_list; struct tegra_prod *prod_list;
#endif #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) \ #define QSPI_PROD_FIELD(name, rindex, roffset, fname) \
{ \ { \
.field_name = name, \ .field_name = name, \
@@ -962,7 +962,7 @@ static u32 tegra_qspi_setup_transfer_one(struct spi_device *spi, struct spi_tran
return command1; 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) static void tegra_qspi_write_prod_settings(struct tegra_qspi *tqspi, const char *prod_name)
{ {
struct tegra_prod_reg_info *reg_info; struct tegra_prod_reg_info *reg_info;
@@ -986,7 +986,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) 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; int err;
#endif #endif
@@ -996,7 +996,7 @@ static void tegra_qspi_set_gr_registers(struct tegra_qspi *tqspi)
/* If available, initialise the config registers /* If available, initialise the config registers
* for QSPI with the values mentioned in prod list. * 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); err = tegra_prod_set_by_name(&tqspi->base, "prod", tqspi->prod_list);
if (err < 0) if (err < 0)
dev_info_once(tqspi->dev, dev_info_once(tqspi->dev,
@@ -1726,7 +1726,7 @@ static int tegra_qspi_probe(struct platform_device *pdev)
tqspi->master = master; tqspi->master = master;
tqspi->dev = &pdev->dev; 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); tqspi->prod_list = devm_tegra_prod_get(&pdev->dev);
#else #else
tqspi->prod_list = devm_tegra_prod_get_list(&pdev->dev, &qspi_prod_dev_info); tqspi->prod_list = devm_tegra_prod_get_list(&pdev->dev, &qspi_prod_dev_info);

View File

@@ -8,19 +8,13 @@
#include <linux/version.h> #include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) #if defined(CONFIG_TEGRA_PROD_NEXT_GEN)
#ifdef CONFIG_TEGRA_PROD_LEGACY
#include <soc/tegra/tegra-prod.h> #include <soc/tegra/tegra-prod.h>
#include <linux/tegra_prod.h>
#else
#include <linux/tegra-prod-upstream-dummy.h>
#include <linux/tegra-prod-legacy-dummy.h> #include <linux/tegra-prod-legacy-dummy.h>
#endif #elif defined(CONFIG_TEGRA_PROD_LEGACY)
#else /* LINUX_VERSION_CODE */
#ifdef CONFIG_TEGRA_PROD_LEGACY
#include <linux/tegra_prod.h> #include <linux/tegra_prod.h>
#else #else
#include <linux/tegra-prod-legacy-dummy.h> #include <linux/tegra-prod-legacy-dummy.h>
#endif #endif
#endif /* LINUX_VERSION_CODE */
#endif /* _TEGRA_OOT_PRODS_H */ #endif /* _TEGRA_OOT_PRODS_H */