Skip to content

Commit 87a14a9

Browse files
james-c-linarobroonie
authored andcommitted
spi: spi-fsl-dspi: Re-use one volatile regmap for both device types
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>
1 parent 19272b3 commit 87a14a9

1 file changed

Lines changed: 4 additions & 15 deletions

File tree

drivers/spi/spi-fsl-dspi.c

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,7 @@ static const struct regmap_range dspi_volatile_ranges[] = {
12091209
regmap_reg_range(SPI_MCR, SPI_TCR),
12101210
regmap_reg_range(SPI_SR, SPI_SR),
12111211
regmap_reg_range(SPI_PUSHR, SPI_RXFR3),
1212+
regmap_reg_range(SPI_SREX, SPI_SREX),
12121213
};
12131214

12141215
static const struct regmap_access_table dspi_volatile_table = {
@@ -1220,31 +1221,19 @@ static const struct regmap_config dspi_regmap_config = {
12201221
.reg_bits = 32,
12211222
.val_bits = 32,
12221223
.reg_stride = 4,
1223-
.max_register = 0x88,
1224+
.max_register = SPI_RXFR3,
12241225
.volatile_table = &dspi_volatile_table,
12251226
.rd_table = &dspi_access_table,
12261227
.wr_table = &dspi_access_table,
12271228
};
12281229

1229-
static const struct regmap_range dspi_xspi_volatile_ranges[] = {
1230-
regmap_reg_range(SPI_MCR, SPI_TCR),
1231-
regmap_reg_range(SPI_SR, SPI_SR),
1232-
regmap_reg_range(SPI_PUSHR, SPI_RXFR3),
1233-
regmap_reg_range(SPI_SREX, SPI_SREX),
1234-
};
1235-
1236-
static const struct regmap_access_table dspi_xspi_volatile_table = {
1237-
.yes_ranges = dspi_xspi_volatile_ranges,
1238-
.n_yes_ranges = ARRAY_SIZE(dspi_xspi_volatile_ranges),
1239-
};
1240-
12411230
static const struct regmap_config dspi_xspi_regmap_config[] = {
12421231
{
12431232
.reg_bits = 32,
12441233
.val_bits = 32,
12451234
.reg_stride = 4,
1246-
.max_register = 0x13c,
1247-
.volatile_table = &dspi_xspi_volatile_table,
1235+
.max_register = SPI_SREX,
1236+
.volatile_table = &dspi_volatile_table,
12481237
.rd_table = &dspi_access_table,
12491238
.wr_table = &dspi_access_table,
12501239
},

0 commit comments

Comments
 (0)