diff mbox

[U-Boot,2/2] x86: ich-spi: Clear atomic preop only when SPI settings are not locked

Message ID 1503800579-19321-2-git-send-email-bmeng.cn@gmail.com
State Accepted
Commit d2ca80c3d7e314c2dd2ac1bf63e5630ae7131a57
Delegated to: Bin Meng
Headers show

Commit Message

Bin Meng Aug. 27, 2017, 2:22 a.m. UTC
The atomic preop register can only be written when SPI settings are
not locked, otherwise it's read-only.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

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

Comments

Stefan Roese Aug. 27, 2017, 8 a.m. UTC | #1
On 27.08.2017 04:22, Bin Meng wrote:
> The atomic preop register can only be written when SPI settings are
> not locked, otherwise it's read-only.
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> 
>   drivers/spi/ich.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c
> index 5a3d690..22fc83d 100644
> --- a/drivers/spi/ich.c
> +++ b/drivers/spi/ich.c
> @@ -563,7 +563,8 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,
>   	}
>   
>   	/* Clear atomic preop now that xfer is done */
> -	ich_writew(ctlr, 0, ctlr->preop);
> +	if (!lock)
> +		ich_writew(ctlr, 0, ctlr->preop);
>   
>   	return 0;
>   }
> 

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan
Bin Meng Sept. 1, 2017, 9:44 a.m. UTC | #2
On Sun, Aug 27, 2017 at 4:00 PM, Stefan Roese <sr@denx.de> wrote:
> On 27.08.2017 04:22, Bin Meng wrote:
>>
>> The atomic preop register can only be written when SPI settings are
>> not locked, otherwise it's read-only.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>>   drivers/spi/ich.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>

applied to u-boot-x86, thanks!
diff mbox

Patch

diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c
index 5a3d690..22fc83d 100644
--- a/drivers/spi/ich.c
+++ b/drivers/spi/ich.c
@@ -563,7 +563,8 @@  static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,
 	}
 
 	/* Clear atomic preop now that xfer is done */
-	ich_writew(ctlr, 0, ctlr->preop);
+	if (!lock)
+		ich_writew(ctlr, 0, ctlr->preop);
 
 	return 0;
 }