diff options
| author | Mark Brown <broonie@kernel.org> | 2025-09-12 03:25:40 +0100 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2025-09-12 03:25:40 +0100 |
| commit | 34c2202f5ca2325511a0e0b8802492eec17a2c76 (patch) | |
| tree | 509c7fa9bb5cd9bda0c4fc2d38dfce6358160a3e /include | |
| parent | support for Amlogic SPI Flash Controller IP (diff) | |
| parent | spi: axi-spi-engine: use adi_axi_pcore_ver_gteq() (diff) | |
| download | linux-34c2202f5ca2325511a0e0b8802492eec17a2c76.tar.gz linux-34c2202f5ca2325511a0e0b8802492eec17a2c76.zip | |
spi: axi-spi-engine: improve version checks
Merge series from David Lechner <dlechner@baylibre.com>:
We have a pending major version bump for the axi-spi-engine so to
prepare for that, improve the existing version checks for feature
enablement.
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/adi-axi-common.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/adi-axi-common.h b/include/linux/adi-axi-common.h index f64f4ad4beda..37962ba530df 100644 --- a/include/linux/adi-axi-common.h +++ b/include/linux/adi-axi-common.h @@ -8,6 +8,8 @@ * https://wiki.analog.com/resources/fpga/docs/hdl/regmap */ +#include <linux/types.h> + #ifndef ADI_AXI_COMMON_H_ #define ADI_AXI_COMMON_H_ @@ -21,6 +23,25 @@ #define ADI_AXI_PCORE_VER_MINOR(version) (((version) >> 8) & 0xff) #define ADI_AXI_PCORE_VER_PATCH(version) ((version) & 0xff) +/** + * adi_axi_pcore_ver_gteq() - check if a version is satisfied + * @version: the full version read from the hardware + * @major: the major version to compare against + * @minor: the minor version to compare against + * + * ADI AXI IP Cores use semantic versioning, so this can be used to check for + * feature availability. + * + * Return: true if the version is greater than or equal to the specified + * major and minor version, false otherwise. + */ +static inline bool adi_axi_pcore_ver_gteq(u32 version, u32 major, u32 minor) +{ + return ADI_AXI_PCORE_VER_MAJOR(version) > (major) || + (ADI_AXI_PCORE_VER_MAJOR(version) == (major) && + ADI_AXI_PCORE_VER_MINOR(version) >= (minor)); +} + #define ADI_AXI_INFO_FPGA_TECH(info) (((info) >> 24) & 0xff) #define ADI_AXI_INFO_FPGA_FAMILY(info) (((info) >> 16) & 0xff) #define ADI_AXI_INFO_FPGA_SPEED_GRADE(info) (((info) >> 8) & 0xff) |
