LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Bryan Wu <bryan.wu@analog.com>
To: dbrownell@users.sourceforge.net, spi-devel-general@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org,
Sonic Zhang <sonic.zhang@analog.com>,
Bryan Wu <bryan.wu@analog.com>
Subject: [PATCH 5/6] [Blackfin] SPI driver: Fix bug SPI_write should not return until complete bit is set.
Date: Wed, 30 Jan 2008 17:13:40 +0800 [thread overview]
Message-ID: <1201684421-26124-6-git-send-email-bryan.wu@analog.com> (raw)
In-Reply-To: <1201684421-26124-1-git-send-email-bryan.wu@analog.com>
From: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
---
drivers/spi/spi_bfin5xx.c | 22 ++++++++++------------
1 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index c5d4d77..9f12639 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -278,16 +278,16 @@ static void u8_writer(struct driver_data *drv_data)
dev_dbg(&drv_data->pdev->dev,
"cr8-s is 0x%x\n", read_STAT(drv_data));
- /* poll for SPI completion before start */
- while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
- cpu_relax();
-
while (drv_data->tx < drv_data->tx_end) {
write_TDBR(drv_data, (*(u8 *) (drv_data->tx)));
while (read_STAT(drv_data) & BIT_STAT_TXS)
cpu_relax();
++drv_data->tx;
}
+
+ /* poll for SPI completion before return */
+ while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
+ cpu_relax();
}
static void u8_cs_chg_writer(struct driver_data *drv_data)
@@ -398,32 +398,30 @@ static void u16_writer(struct driver_data *drv_data)
dev_dbg(&drv_data->pdev->dev,
"cr16 is 0x%x\n", read_STAT(drv_data));
- /* poll for SPI completion before start */
- while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
- cpu_relax();
-
while (drv_data->tx < drv_data->tx_end) {
write_TDBR(drv_data, (*(u16 *) (drv_data->tx)));
while ((read_STAT(drv_data) & BIT_STAT_TXS))
cpu_relax();
drv_data->tx += 2;
}
+
+ /* poll for SPI completion before return */
+ while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
+ cpu_relax();
}
static void u16_cs_chg_writer(struct driver_data *drv_data)
{
struct chip_data *chip = drv_data->cur_chip;
- /* poll for SPI completion before start */
- while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
- cpu_relax();
-
while (drv_data->tx < drv_data->tx_end) {
cs_active(drv_data, chip);
write_TDBR(drv_data, (*(u16 *) (drv_data->tx)));
while ((read_STAT(drv_data) & BIT_STAT_TXS))
cpu_relax();
+ while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
+ cpu_relax();
cs_deactive(drv_data, chip);
--
1.5.3.4
next prev parent reply other threads:[~2008-01-30 9:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-30 9:13 [PATCH 0/6] [Blackfin] SPI driver updates Bryan Wu
2008-01-30 9:13 ` [PATCH 1/6] [Blackfin] SPI driver: remove useless return status check in restore_state function pointed by Michael Bryan Wu
2008-01-30 9:13 ` [PATCH 2/6] [Blackfin] SPI driver: Use SPI device name to do gpio peripheral request Bryan Wu
2008-01-30 21:48 ` [spi-devel-general] " David Brownell
2008-01-31 3:12 ` Bryan Wu
2008-01-30 9:13 ` [PATCH 3/6] [Blackfin] SPI driver: fix bug - PBX cannot work with this SPI framework driver Bryan Wu
2008-01-30 9:13 ` [PATCH 4/6] [Blackfin] SPI driver: fix bug - SPI duplex operation can read a dummy byte at the first transfer Bryan Wu
2008-01-30 9:13 ` Bryan Wu [this message]
2008-01-30 9:13 ` [PATCH 6/6] [Blackfin] SPI driver: use simpler comment headers and strip out information that is maintained in the scm's log Bryan Wu
2008-01-31 20:50 ` [spi-devel-general] [PATCH 0/6] [Blackfin] SPI driver updates David Brownell
2008-02-01 9:41 ` Bryan Wu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1201684421-26124-6-git-send-email-bryan.wu@analog.com \
--to=bryan.wu@analog.com \
--cc=dbrownell@users.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=sonic.zhang@analog.com \
--cc=spi-devel-general@lists.sourceforge.net \
--subject='Re: [PATCH 5/6] [Blackfin] SPI driver: Fix bug SPI_write should not return until complete bit is set.' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).