spi: axi-spi-engine: use common AXI macros
authorDavid Lechner <dlechner@baylibre.com>
Fri, 2 Feb 2024 21:31:32 +0000 (15:31 -0600)
committerMark Brown <broonie@kernel.org>
Mon, 5 Feb 2024 14:35:45 +0000 (14:35 +0000)
This avoid duplicating the same macros in multiple drivers by reusing
the common AXI macros for the version register.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240202213132.3863124-2-dlechner@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-axi-spi-engine.c

index 9ace259d2d29d6f9147e2348e9d98c0d707c008b..6b0c72bf3395f2f2c1aebdd8413f62eaf62ac35e 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <linux/clk.h>
+#include <linux/fpga/adi-axi-common.h>
 #include <linux/idr.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/spi/spi.h>
 #include <linux/timer.h>
 
-#define SPI_ENGINE_VERSION_MAJOR(x)    ((x >> 16) & 0xff)
-#define SPI_ENGINE_VERSION_MINOR(x)    ((x >> 8) & 0xff)
-#define SPI_ENGINE_VERSION_PATCH(x)    (x & 0xff)
-
-#define SPI_ENGINE_REG_VERSION                 0x00
-
 #define SPI_ENGINE_REG_RESET                   0x40
 
 #define SPI_ENGINE_REG_INT_ENABLE              0x80
@@ -661,12 +656,12 @@ static int spi_engine_probe(struct platform_device *pdev)
        if (IS_ERR(spi_engine->base))
                return PTR_ERR(spi_engine->base);
 
-       version = readl(spi_engine->base + SPI_ENGINE_REG_VERSION);
-       if (SPI_ENGINE_VERSION_MAJOR(version) != 1) {
+       version = readl(spi_engine->base + ADI_AXI_REG_VERSION);
+       if (ADI_AXI_PCORE_VER_MAJOR(version) != 1) {
                dev_err(&pdev->dev, "Unsupported peripheral version %u.%u.%c\n",
-                       SPI_ENGINE_VERSION_MAJOR(version),
-                       SPI_ENGINE_VERSION_MINOR(version),
-                       SPI_ENGINE_VERSION_PATCH(version));
+                       ADI_AXI_PCORE_VER_MAJOR(version),
+                       ADI_AXI_PCORE_VER_MINOR(version),
+                       ADI_AXI_PCORE_VER_PATCH(version));
                return -ENODEV;
        }