Skip to contentSkip to conversation

drivers/fsi/scom: Remove reset before every putscom

PATCH Applied Eddie James 3 participants 5 messages Jul 20, 2017 – Aug 8, 2017 FSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/fsi/scom: Remove reset before every putscom

From: "Edward A. James" <[email protected]>

Reset causes problems for operations requiring multiple scoms (e.g. i2c over scom). Instead, reset scom engine during probe.

---
 drivers/fsi/fsi-scom.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/fsi/fsi-scom.c +4 -6
index 98d062f..e13353a 100644
@@ -57,12 +57,6 @@ static int put_scom(struct scom_device *scom_dev, uint64_t value,
 	int rc;
 	uint32_t data;
 
-	data = cpu_to_be32(SCOM_RESET_CMD);
-	rc = fsi_device_write(scom_dev->fsi_dev, SCOM_RESET_REG, &data,
-				sizeof(uint32_t));
-	if (rc)
-		return rc;
-
 	data = cpu_to_be32((value >> 32) & 0xffffffff);
 	rc = fsi_device_write(scom_dev->fsi_dev, SCOM_DATA0_REG, &data,
 				sizeof(uint32_t));
@@ -186,6 +180,7 @@ static loff_t scom_llseek(struct file *file, loff_t offset, int whence)
 
 static int scom_probe(struct device *dev)
 {
+	uint32_t data;
 	struct fsi_device *fsi_dev = to_fsi_dev(dev);
 	struct scom_device *scom;
 
@@ -202,6 +197,9 @@ static int scom_probe(struct device *dev)
 	scom->mdev.parent = dev;
 	list_add(&scom->link, &scom_devices);
 
+	data = cpu_to_be32(SCOM_RESET_CMD);
+	fsi_device_write(fsi_dev, SCOM_RESET_REG, &data, sizeof(uint32_t));
+
 	return misc_register(&scom->mdev);
 }
 
Signature · 1 line
1.8.3.1
Acked-by on v1 1/1
#1 lore raw

Hi Eddie,

Quoted 2 lines

Reset causes problems for operations requiring multiple scoms (e.g. i2c over scom). Instead, reset scom engine during probe.

Looks good to me. Out of curiosity, what kind of problems?

Cheers,

Jeremy

#2 lore raw
Quoted 5 lines · Jeremy Kerr

Hi Eddie,

Quoted 2 lines

Reset causes problems for operations requiring multiple scoms (e.g. i2c over scom). Instead, reset scom engine during probe.

Looks good to me. Out of curiosity, what kind of problems?

Mainly I2C bus arbitration errors. I guess the reset interrupted the I2C clock line control during an operation.

Thanks,
Eddie

Quoted 8 lines

Cheers,

Jeremy

Applied
#3 lore raw

Hello Eddie,

Quoted 9 lines · Eddie James
Quoted 4 lines · Jeremy Kerr
Quoted 2 lines

Reset causes problems for operations requiring multiple scoms (e.g. i2c over scom). Instead, reset scom engine during probe.

Looks good to me. Out of curiosity, what kind of problems?

Mainly I2C bus arbitration errors. I guess the reset interrupted the I2C clock line control during an operation.

I've applied this to dev-4.10. One clarification:

drivers/fsi/fsi-scom.c static int scom_probe(struct device *dev) · line 203

Quoted 8 lines
drivers/fsi/fsi-scom.c +3 -0
@@ -202,6 +197,9 @@ static int scom_probe(struct device *dev)
        scom->mdev.parent = dev;
        list_add(&scom->link, &scom_devices);
 
+       data = cpu_to_be32(SCOM_RESET_CMD);
+       fsi_device_write(fsi_dev, SCOM_RESET_REG, &data, sizeof(uint32_t));
+
        return misc_register(&scom->mdev);

I wanted to check that you were ignoring the return value of fsi_device_write here intentionally. If not, please send a follow up that adds a check.

Cheers,

Joel

#4 lore raw
Quoted 17 lines · Joel Stanley

Hello Eddie,

Quoted 7 lines · Eddie James
Quoted 3 lines · Jeremy Kerr
Quoted 2 lines

Reset causes problems for operations requiring multiple scoms (e.g. i2c over scom). Instead, reset scom engine during probe.

Looks good to me. Out of curiosity, what kind of problems?

Mainly I2C bus arbitration errors. I guess the reset interrupted the I2C clock line control during an operation.

I've applied this to dev-4.10. One clarification:

Quoted 4 lines
drivers/fsi/fsi-scom.c +0 -0
@@ -202,6 +197,9 @@ static int scom_probe(struct device *dev)
         scom->mdev.parent = dev;
         list_add(&scom->link, &scom_devices);
 
Quoted 7 lines

drivers/fsi/fsi-scom.c static int scom_probe(struct device *dev) · line 203

Quoted 4 lines
drivers/fsi/fsi-scom.c +3 -0
+       data = cpu_to_be32(SCOM_RESET_CMD);
+       fsi_device_write(fsi_dev, SCOM_RESET_REG, &data, sizeof(uint32_t));
+
         return misc_register(&scom->mdev);

I wanted to check that you were ignoring the return value of fsi_device_write here intentionally. If not, please send a follow up that adds a check.

That is correct, I did not want to check the return value.

Thanks,
Eddie

Quoted 5 lines

Cheers,

Joel