diff mbox

[U-Boot,03/11] dm: spi: Correct status register access width

Message ID 1433688642-19861-4-git-send-email-sjg@chromium.org
State Superseded
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass June 7, 2015, 2:50 p.m. UTC
The status register is a single byte, so use byte access when writing to it,
to avoid updating the control register also.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/spi/ich.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bin Meng June 8, 2015, 1:41 a.m. UTC | #1
Hi Simon,

On Sun, Jun 7, 2015 at 10:50 PM, Simon Glass <sjg@chromium.org> wrote:
> The status register is a single byte, so use byte access when writing to it,
> to avoid updating the control register also.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/spi/ich.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c
> index 6b6cfbf..a8b4d0d 100644
> --- a/drivers/spi/ich.c
> +++ b/drivers/spi/ich.c
> @@ -477,7 +477,7 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,
>         if (ret < 0)
>                 return ret;
>
> -       ich_writew(ctlr, SPIS_CDS | SPIS_FCERR, ctlr->status);
> +       ich_writeb(ctlr, SPIS_CDS | SPIS_FCERR, ctlr->status);

But for ICH7 the status is 16-bit. Please handle both cases.

>
>         spi_setup_type(trans, using_cmd ? bytes : 0);
>         opcode_index = spi_setup_opcode(ctlr, trans);
> --

Regards,
Bin
diff mbox

Patch

diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c
index 6b6cfbf..a8b4d0d 100644
--- a/drivers/spi/ich.c
+++ b/drivers/spi/ich.c
@@ -477,7 +477,7 @@  static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,
 	if (ret < 0)
 		return ret;
 
-	ich_writew(ctlr, SPIS_CDS | SPIS_FCERR, ctlr->status);
+	ich_writeb(ctlr, SPIS_CDS | SPIS_FCERR, ctlr->status);
 
 	spi_setup_type(trans, using_cmd ? bytes : 0);
 	opcode_index = spi_setup_opcode(ctlr, trans);