]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
spi: spi-fsl-dspi: Re-use one volatile regmap for both device types
authorJames Clark <james.clark@linaro.org>
Thu, 22 May 2025 14:51:33 +0000 (15:51 +0100)
committerMark Brown <broonie@kernel.org>
Sun, 8 Jun 2025 22:35:28 +0000 (23:35 +0100)
max_register overrides anything in the volatile ranges, so we can get
away with sharing the same one for both types. In a later commit we'll
add more devices so this avoids adding even more duplication. Also
replace the max_register magic numbers with their register definitions
so it's clearer what's going on.

No functional changes.

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Link: https://patch.msgid.link/20250522-james-nxp-spi-v2-4-bea884630cfb@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-fsl-dspi.c

index 863781ba6c1601f5d32cbf5a2d904374d33268b2..09b2b25ed274799acba60afe3854ceae02035c62 100644 (file)
@@ -1209,6 +1209,7 @@ static const struct regmap_range dspi_volatile_ranges[] = {
        regmap_reg_range(SPI_MCR, SPI_TCR),
        regmap_reg_range(SPI_SR, SPI_SR),
        regmap_reg_range(SPI_PUSHR, SPI_RXFR3),
+       regmap_reg_range(SPI_SREX, SPI_SREX),
 };
 
 static const struct regmap_access_table dspi_volatile_table = {
@@ -1220,31 +1221,19 @@ static const struct regmap_config dspi_regmap_config = {
        .reg_bits       = 32,
        .val_bits       = 32,
        .reg_stride     = 4,
-       .max_register   = 0x88,
+       .max_register   = SPI_RXFR3,
        .volatile_table = &dspi_volatile_table,
        .rd_table       = &dspi_access_table,
        .wr_table       = &dspi_access_table,
 };
 
-static const struct regmap_range dspi_xspi_volatile_ranges[] = {
-       regmap_reg_range(SPI_MCR, SPI_TCR),
-       regmap_reg_range(SPI_SR, SPI_SR),
-       regmap_reg_range(SPI_PUSHR, SPI_RXFR3),
-       regmap_reg_range(SPI_SREX, SPI_SREX),
-};
-
-static const struct regmap_access_table dspi_xspi_volatile_table = {
-       .yes_ranges     = dspi_xspi_volatile_ranges,
-       .n_yes_ranges   = ARRAY_SIZE(dspi_xspi_volatile_ranges),
-};
-
 static const struct regmap_config dspi_xspi_regmap_config[] = {
        {
                .reg_bits       = 32,
                .val_bits       = 32,
                .reg_stride     = 4,
-               .max_register   = 0x13c,
-               .volatile_table = &dspi_xspi_volatile_table,
+               .max_register   = SPI_SREX,
+               .volatile_table = &dspi_volatile_table,
                .rd_table       = &dspi_access_table,
                .wr_table       = &dspi_access_table,
        },