Skip to content

Commit 82b98fb

Browse files
ambarusbroonie
authored andcommitted
spi: s3c64xx: allow FIFO depth to be determined from the compatible
There are SoCs that use the same FIFO depth for all the instances of the SPI IP. See the fifo_lvl_mask defined for gs101 for example: .fifo_lvl_mask = { 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f}, Instead of specifying the FIFO depth with the same value for all 16 nodes in this case, allow such SoCs to infer the FIFO depth from the compatible. There are other SoCs than can benefit of this, see: {gs101, fsd, exynos850, s3c641, s3c2443}_spi_port_config. The FIFO depth inferred from the compatible has a higher precedence than the one that might be specified via device tree, the driver shall know better. Signed-off-by: Tudor Ambarus <[email protected]> Link: https://msgid.link/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 414d7b8 commit 82b98fb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/spi/spi-s3c64xx.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ struct s3c64xx_spi_dma_data {
137137
* struct s3c64xx_spi_port_config - SPI Controller hardware info
138138
* @fifo_lvl_mask: Bit-mask for {TX|RX}_FIFO_LVL bits in SPI_STATUS register.
139139
* @rx_lvl_offset: Bit offset of RX_FIFO_LVL bits in SPI_STATUS regiter.
140+
* @fifo_depth: depth of the FIFO.
140141
* @rx_fifomask: SPI_STATUS.RX_FIFO_LVL mask. Shifted mask defining the field's
141142
* length and position.
142143
* @tx_fifomask: SPI_STATUS.TX_FIFO_LVL mask. Shifted mask defining the field's
@@ -159,6 +160,7 @@ struct s3c64xx_spi_dma_data {
159160
struct s3c64xx_spi_port_config {
160161
int fifo_lvl_mask[MAX_SPI_PORTS];
161162
int rx_lvl_offset;
163+
unsigned int fifo_depth;
162164
u32 rx_fifomask;
163165
u32 tx_fifomask;
164166
int tx_st_done;
@@ -1263,8 +1265,10 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
12631265
sdd->port_id = pdev->id;
12641266
}
12651267

1266-
if (of_property_read_u32(pdev->dev.of_node, "fifo-depth",
1267-
&sdd->fifo_depth))
1268+
if (sdd->port_conf->fifo_depth)
1269+
sdd->fifo_depth = sdd->port_conf->fifo_depth;
1270+
else if (of_property_read_u32(pdev->dev.of_node, "fifo-depth",
1271+
&sdd->fifo_depth))
12681272
sdd->fifo_depth = FIFO_DEPTH(sdd);
12691273

12701274
s3c64xx_spi_set_fifomask(sdd);

0 commit comments

Comments
 (0)