Skip to contentSkip to conversation

x86: ich-spi: Remove useless assignment in ich_spi_xfer()

PATCH New Bin Meng 2 participants 6 messages Aug 27, 2017 – Sep 1, 2017 SPI

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/2 x86: ich-spi: Remove useless assignment in ich_spi_xfer()

In ich_spi_xfer() when the driver presets control fields, control variable gets assigned twice. Apparently only the last assignment takes effect. Remove the other one.

---

 drivers/spi/ich.c | 2 --
 1 file changed, 2 deletions(-)
drivers/spi/ich.c +0 -2
index 373bc26..5a3d690 100644
@@ -468,8 +468,6 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,
 	}
 
 	/* Preset control fields */
-	control = ich_readw(ctlr, ctlr->control);
-	control &= ~SSFC_RESERVED;
 	control = SPIC_SCGO | ((opcode_index & 0x07) << 4);
 
 	/* Issue atomic preop cycle if needed */
Signature · 1 line
2.9.2
author
#1 lore raw

PATCH 2/2 x86: ich-spi: Clear atomic preop only when SPI settings are not locked

The atomic preop register can only be written when SPI settings are not locked, otherwise it's read-only.

---

 drivers/spi/ich.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/ich.c +2 -1
index 5a3d690..22fc83d 100644
@@ -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;
 }
Signature · 1 line
2.9.2
#2 lore raw

PATCH 2/2 x86: ich-spi: Clear atomic preop only when SPI settings are not locked

Quoted 15 lines · Bin Meng

The atomic preop register can only be written when SPI settings are not locked, otherwise it's read-only.

---

  drivers/spi/ich.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/ich.c +0 -0
index 5a3d690..22fc83d 100644

drivers/spi/ich.c static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen, · line 570

Quoted 9 lines
drivers/spi/ich.c +2 -1
@@ -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;
  }

Thanks,
Stefan

author
#3 lore raw

PATCH 2/2 x86: ich-spi: Clear atomic preop only when SPI settings are not locked

Quoted 11 lines · Stefan Roese
Quoted 10 lines · Bin Meng

The atomic preop register can only be written when SPI settings are not locked, otherwise it's read-only.

---

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

applied to u-boot-x86, thanks!

#4 lore raw

PATCH 1/2 x86: ich-spi: Remove useless assignment in ich_spi_xfer()

In reply to Bin Meng
Quoted 16 lines · Bin Meng

In ich_spi_xfer() when the driver presets control fields, control variable gets assigned twice. Apparently only the last assignment takes effect. Remove the other one.

---

  drivers/spi/ich.c | 2 --
  1 file changed, 2 deletions(-)
drivers/spi/ich.c +0 -0
index 373bc26..5a3d690 100644

drivers/spi/ich.c static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen, · line 473

Quoted 8 lines
drivers/spi/ich.c +0 -2
@@ -468,8 +468,6 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,
  	}
 
  	/* Preset control fields */
-	control = ich_readw(ctlr, ctlr->control);
-	control &= ~SSFC_RESERVED;
  	control = SPIC_SCGO | ((opcode_index & 0x07) << 4);
 
  	/* Issue atomic preop cycle if needed */

Thanks,
Stefan

author
#5 lore raw

PATCH 1/2 x86: ich-spi: Remove useless assignment in ich_spi_xfer()

Quoted 6 lines · Stefan Roese
Quoted 5 lines · Bin Meng

In ich_spi_xfer() when the driver presets control fields, control variable gets assigned twice. Apparently only the last assignment takes effect. Remove the other one.

Quoted 6 lines
Quoted 6 lines

---

  drivers/spi/ich.c | 2 --
  1 file changed, 2 deletions(-)

applied to u-boot-x86, thanks!