forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[bluefield] Fix BF drivers compilation under 5.10 Kernel.
- Loading branch information
1 parent
7d6e8a5
commit 6eb5b6c
Showing
4 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
diff --git a/i2c-mlxbf.c b/i2c-mlxbf.c | ||
index 05c3025..6fdd865 100644 | ||
--- a/i2c-mlxbf.c | ||
+++ b/i2c-mlxbf.c | ||
@@ -20,6 +20,8 @@ | ||
#include <linux/acpi.h> | ||
#include <linux/mutex.h> | ||
|
||
+#include <linux/version.h> | ||
+ | ||
/* Defines what functionality is present */ | ||
#define MLX_I2C_FUNC_SMBUS_BLOCK \ | ||
(I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_BLOCK_PROC_CALL) | ||
@@ -1396,7 +1398,11 @@ static int mlx_i2c_get_gpio(struct platform_device *pdev, | ||
if (!devm_request_mem_region(dev, params->start, size, params->name)) | ||
return -EFAULT; | ||
|
||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) | ||
+ gpio_res->io = devm_ioremap(dev, params->start, size); | ||
+#else | ||
gpio_res->io = devm_ioremap_nocache(dev, params->start, size); | ||
+#endif | ||
if (IS_ERR(gpio_res->io)) { | ||
devm_release_mem_region(dev, params->start, size); | ||
return PTR_ERR(gpio_res->io); | ||
@@ -1460,7 +1466,11 @@ static int mlx_i2c_get_corepll(struct platform_device *pdev, | ||
if (!devm_request_mem_region(dev, params->start, size, params->name)) | ||
return -EFAULT; | ||
|
||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) | ||
+ corepll_res->io = devm_ioremap(dev, params->start, size); | ||
+#else | ||
corepll_res->io = devm_ioremap_nocache(dev, params->start, size); | ||
+#endif | ||
if (IS_ERR(corepll_res->io)) { | ||
devm_release_mem_region(dev, params->start, size); | ||
return PTR_ERR(corepll_res->io); | ||
@@ -1813,7 +1823,11 @@ static int mlx_i2c_init_coalesce(struct platform_device *pdev, | ||
if (!request_mem_region(params->start, size, params->name)) | ||
return -EFAULT; | ||
|
||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) | ||
+ coalesce_res->io = ioremap(params->start, size); | ||
+#else | ||
coalesce_res->io = ioremap_nocache(params->start, size); | ||
+#endif | ||
if (IS_ERR(coalesce_res->io)) { | ||
release_mem_region(params->start, size); | ||
return PTR_ERR(coalesce_res->io); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
diff --git a/pka_dev.c b/pka_dev.c | ||
index a084713..93032be 100644 | ||
--- a/pka_dev.c | ||
+++ b/pka_dev.c | ||
@@ -38,6 +38,7 @@ | ||
#include <linux/ioport.h> | ||
#include <linux/timex.h> | ||
#include <linux/vfio.h> | ||
+#include <linux/version.h> | ||
#else | ||
#include <stdint.h> | ||
#include <string.h> | ||
@@ -239,7 +240,11 @@ static int pka_dev_set_resource_config(pka_dev_shim_t *shim, | ||
return -EPERM; | ||
} | ||
|
||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) | ||
+ res_ptr->ioaddr = ioremap(res_ptr->base, res_ptr->size); | ||
+#else | ||
res_ptr->ioaddr = ioremap_nocache(res_ptr->base, res_ptr->size); | ||
+#endif | ||
} | ||
|
||
res_ptr->status = PKA_DEV_RES_STATUS_MAPPED; |