diff options
author | Mark Brown <broonie@kernel.org> | 2018-06-04 11:51:12 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-06-04 11:51:12 +0100 |
commit | 16c10b3bf84df5564683c704039f6199b8359b16 (patch) | |
tree | 3d25504362f952e0dd87a200b0d1050280539b81 /drivers/spi/spi-bcm-qspi.c | |
parent | 29e795ca017f9db8c0226c5f27c135d7922b392a (diff) | |
parent | 0921e11e1e12802ae0a3c19cb02e33354ca51967 (diff) | |
download | lwn-16c10b3bf84df5564683c704039f6199b8359b16.tar.gz lwn-16c10b3bf84df5564683c704039f6199b8359b16.zip |
Merge branch 'spi-4.17' into spi-4.18 for the merge window
Diffstat (limited to 'drivers/spi/spi-bcm-qspi.c')
-rw-r--r-- | drivers/spi/spi-bcm-qspi.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c index 57ceec6c6301..8612525fa4e3 100644 --- a/drivers/spi/spi-bcm-qspi.c +++ b/drivers/spi/spi-bcm-qspi.c @@ -488,7 +488,7 @@ static int bcm_qspi_bspi_set_mode(struct bcm_qspi *qspi, static void bcm_qspi_enable_bspi(struct bcm_qspi *qspi) { - if (!has_bspi(qspi) || (qspi->bspi_enabled)) + if (!has_bspi(qspi)) return; qspi->bspi_enabled = 1; @@ -503,7 +503,7 @@ static void bcm_qspi_enable_bspi(struct bcm_qspi *qspi) static void bcm_qspi_disable_bspi(struct bcm_qspi *qspi) { - if (!has_bspi(qspi) || (!qspi->bspi_enabled)) + if (!has_bspi(qspi)) return; qspi->bspi_enabled = 0; @@ -517,16 +517,19 @@ static void bcm_qspi_disable_bspi(struct bcm_qspi *qspi) static void bcm_qspi_chip_select(struct bcm_qspi *qspi, int cs) { - u32 data = 0; + u32 rd = 0; + u32 wr = 0; - if (qspi->curr_cs == cs) - return; if (qspi->base[CHIP_SELECT]) { - data = bcm_qspi_read(qspi, CHIP_SELECT, 0); - data = (data & ~0xff) | (1 << cs); - bcm_qspi_write(qspi, CHIP_SELECT, 0, data); + rd = bcm_qspi_read(qspi, CHIP_SELECT, 0); + wr = (rd & ~0xff) | (1 << cs); + if (rd == wr) + return; + bcm_qspi_write(qspi, CHIP_SELECT, 0, wr); usleep_range(10, 20); } + + dev_dbg(&qspi->pdev->dev, "using cs:%d\n", cs); qspi->curr_cs = cs; } @@ -753,8 +756,13 @@ static int write_to_hw(struct bcm_qspi *qspi, struct spi_device *spi) dev_dbg(&qspi->pdev->dev, "WR %04x\n", val); } mspi_cdram = MSPI_CDRAM_CONT_BIT; - mspi_cdram |= (~(1 << spi->chip_select) & - MSPI_CDRAM_PCS); + + if (has_bspi(qspi)) + mspi_cdram &= ~1; + else + mspi_cdram |= (~(1 << spi->chip_select) & + MSPI_CDRAM_PCS); + mspi_cdram |= ((tp.trans->bits_per_word <= 8) ? 0 : MSPI_CDRAM_BITSE_BIT); |