mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
mttcan: fix kernel compilation issue
fix compilation issue when building mttcan driver with 6.3-rc1 upstream kernel. Bug 4014315 Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com> Change-Id: I33c15af15fa8db1ac0cbb1c619db5429a6495a80 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2868425 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Sandeep Trasi <strasi@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
2884fc0a73
commit
72cf7c99c3
@@ -73,7 +73,11 @@ struct tegra_mttcan_soc_info {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct can_gpio {
|
struct can_gpio {
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
|
||||||
int gpio;
|
int gpio;
|
||||||
|
#else
|
||||||
|
struct gpio_desc *gpio;
|
||||||
|
#endif
|
||||||
int active_low;
|
int active_low;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1250,6 +1250,7 @@ static int mttcan_power_up(struct mttcan_priv *priv)
|
|||||||
int level;
|
int level;
|
||||||
mttcan_pm_runtime_get_sync(priv);
|
mttcan_pm_runtime_get_sync(priv);
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
|
||||||
if (gpio_is_valid(priv->gpio_can_stb.gpio)) {
|
if (gpio_is_valid(priv->gpio_can_stb.gpio)) {
|
||||||
level = !priv->gpio_can_stb.active_low;
|
level = !priv->gpio_can_stb.active_low;
|
||||||
gpio_direction_output(priv->gpio_can_stb.gpio, level);
|
gpio_direction_output(priv->gpio_can_stb.gpio, level);
|
||||||
@@ -1259,7 +1260,17 @@ static int mttcan_power_up(struct mttcan_priv *priv)
|
|||||||
level = !priv->gpio_can_en.active_low;
|
level = !priv->gpio_can_en.active_low;
|
||||||
gpio_direction_output(priv->gpio_can_en.gpio, level);
|
gpio_direction_output(priv->gpio_can_en.gpio, level);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (priv->gpio_can_stb.gpio) {
|
||||||
|
level = !priv->gpio_can_stb.active_low;
|
||||||
|
gpiod_direction_output(priv->gpio_can_stb.gpio, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (priv->gpio_can_en.gpio) {
|
||||||
|
level = !priv->gpio_can_en.active_low;
|
||||||
|
gpiod_direction_output(priv->gpio_can_en.gpio, level);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return ttcan_set_power(priv->ttcan, 1);
|
return ttcan_set_power(priv->ttcan, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1271,6 +1282,7 @@ static int mttcan_power_down(struct net_device *dev)
|
|||||||
if (ttcan_set_power(priv->ttcan, 0))
|
if (ttcan_set_power(priv->ttcan, 0))
|
||||||
return -ETIMEDOUT;
|
return -ETIMEDOUT;
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
|
||||||
if (gpio_is_valid(priv->gpio_can_stb.gpio)) {
|
if (gpio_is_valid(priv->gpio_can_stb.gpio)) {
|
||||||
level = priv->gpio_can_stb.active_low;
|
level = priv->gpio_can_stb.active_low;
|
||||||
gpio_direction_output(priv->gpio_can_stb.gpio, level);
|
gpio_direction_output(priv->gpio_can_stb.gpio, level);
|
||||||
@@ -1280,6 +1292,17 @@ static int mttcan_power_down(struct net_device *dev)
|
|||||||
level = priv->gpio_can_en.active_low;
|
level = priv->gpio_can_en.active_low;
|
||||||
gpio_direction_output(priv->gpio_can_en.gpio, level);
|
gpio_direction_output(priv->gpio_can_en.gpio, level);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (priv->gpio_can_stb.gpio) {
|
||||||
|
level = priv->gpio_can_stb.active_low;
|
||||||
|
gpiod_direction_output(priv->gpio_can_stb.gpio, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (priv->gpio_can_en.gpio) {
|
||||||
|
level = priv->gpio_can_en.active_low;
|
||||||
|
gpiod_direction_output(priv->gpio_can_en.gpio, level);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
mttcan_pm_runtime_put_sync(priv);
|
mttcan_pm_runtime_put_sync(priv);
|
||||||
|
|
||||||
@@ -1698,7 +1721,9 @@ static int mttcan_probe(struct platform_device *pdev)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int irq = 0;
|
int irq = 0;
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
|
||||||
enum of_gpio_flags flags;
|
enum of_gpio_flags flags;
|
||||||
|
#endif
|
||||||
void __iomem *regs = NULL, *xregs = NULL;
|
void __iomem *regs = NULL, *xregs = NULL;
|
||||||
void __iomem *mram_addr = NULL;
|
void __iomem *mram_addr = NULL;
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
@@ -1779,12 +1804,21 @@ static int mttcan_probe(struct platform_device *pdev)
|
|||||||
goto exit_free_device;
|
goto exit_free_device;
|
||||||
|
|
||||||
/* set device-tree properties */
|
/* set device-tree properties */
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
|
||||||
|
priv->gpio_can_en.gpio = devm_gpiod_get_optional(&pdev->dev,
|
||||||
|
"gpio_can_en", 0);
|
||||||
|
priv->gpio_can_en.active_low = GPIOD_OUT_LOW;
|
||||||
|
priv->gpio_can_stb.gpio = devm_gpiod_get_optional(&pdev->dev,
|
||||||
|
"gpio_can_stb", 0);
|
||||||
|
priv->gpio_can_stb.active_low = GPIOD_OUT_LOW;
|
||||||
|
#else
|
||||||
priv->gpio_can_en.gpio = of_get_named_gpio_flags(np,
|
priv->gpio_can_en.gpio = of_get_named_gpio_flags(np,
|
||||||
"gpio_can_en", 0, &flags);
|
"gpio_can_en", 0, &flags);
|
||||||
priv->gpio_can_en.active_low = flags & OF_GPIO_ACTIVE_LOW;
|
priv->gpio_can_en.active_low = flags & OF_GPIO_ACTIVE_LOW;
|
||||||
priv->gpio_can_stb.gpio = of_get_named_gpio_flags(np,
|
priv->gpio_can_stb.gpio = of_get_named_gpio_flags(np,
|
||||||
"gpio_can_stb", 0, &flags);
|
"gpio_can_stb", 0, &flags);
|
||||||
priv->gpio_can_stb.active_low = flags & OF_GPIO_ACTIVE_LOW;
|
priv->gpio_can_stb.active_low = flags & OF_GPIO_ACTIVE_LOW;
|
||||||
|
#endif
|
||||||
priv->instance = of_alias_get_id(np, "mttcan");
|
priv->instance = of_alias_get_id(np, "mttcan");
|
||||||
priv->poll = of_property_read_bool(np, "use-polling");
|
priv->poll = of_property_read_bool(np, "use-polling");
|
||||||
|
|
||||||
@@ -1808,6 +1842,7 @@ static int mttcan_probe(struct platform_device *pdev)
|
|||||||
goto exit_free_device;
|
goto exit_free_device;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
|
||||||
if (gpio_is_valid(priv->gpio_can_stb.gpio)) {
|
if (gpio_is_valid(priv->gpio_can_stb.gpio)) {
|
||||||
if (devm_gpio_request(priv->device, priv->gpio_can_stb.gpio,
|
if (devm_gpio_request(priv->device, priv->gpio_can_stb.gpio,
|
||||||
"gpio_can_stb") < 0) {
|
"gpio_can_stb") < 0) {
|
||||||
@@ -1822,6 +1857,7 @@ static int mttcan_probe(struct platform_device *pdev)
|
|||||||
goto exit_free_device;
|
goto exit_free_device;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* allocate controller struct memory and set fields */
|
/* allocate controller struct memory and set fields */
|
||||||
|
|||||||
Reference in New Issue
Block a user