Skip to content

Commit 0921e11

Browse files
geertubroonie
authored andcommitted
spi: sh-msiof: Fix setting SIRMDR1.SYNCAC to match SITMDR1.SYNCAC
According to section 59.2.4 MSIOF Receive Mode Register 1 (SIRMDR1) in the R-Car Gen3 datasheet Rev.1.00, the value of the SIRMDR1.SYNCAC bit must match the value of the SITMDR1.SYNCAC bit. However, sh_msiof_spi_setup() changes only the latter. Fix this by updating the SIRMDR1 register like the SITMDR1 register, taking into account register bits that exist in SITMDR1 only. Reported-by: Renesas BSP team via Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Fixes: 7ff0b53 ("spi: sh-msiof: Avoid writing to registers from spi_master.setup()") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent bc519d9 commit 0921e11

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎drivers/spi/spi-sh-msiof.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,14 +564,16 @@ static int sh_msiof_spi_setup(struct spi_device *spi)
564564

565565
/* Configure native chip select mode/polarity early */
566566
clr = MDR1_SYNCMD_MASK;
567-
set = MDR1_TRMD | TMDR1_PCON | MDR1_SYNCMD_SPI;
567+
set = MDR1_SYNCMD_SPI;
568568
if (spi->mode & SPI_CS_HIGH)
569569
clr |= BIT(MDR1_SYNCAC_SHIFT);
570570
else
571571
set |= BIT(MDR1_SYNCAC_SHIFT);
572572
pm_runtime_get_sync(&p->pdev->dev);
573573
tmp = sh_msiof_read(p, TMDR1) & ~clr;
574-
sh_msiof_write(p, TMDR1, tmp | set);
574+
sh_msiof_write(p, TMDR1, tmp | set | MDR1_TRMD | TMDR1_PCON);
575+
tmp = sh_msiof_read(p, RMDR1) & ~clr;
576+
sh_msiof_write(p, RMDR1, tmp | set);
575577
pm_runtime_put(&p->pdev->dev);
576578
p->native_cs_high = spi->mode & SPI_CS_HIGH;
577579
p->native_cs_inited = true;

0 commit comments

Comments
 (0)