Thread (29 messages) flat view 29 messages, 5 authors, 2021-01-18

Re: [PATCH net-next v4 1/4] net: phy: mdio-i2c: support I2C MDIO protocol for RollBall SFP modules

From: Marek Behún <kabel@kernel.org>
Date: 2021-01-12 21:40:39

On Tue, 12 Jan 2021 21:54:24 +0100
Andrew Lunn [off-list ref] wrote:
quoted
+static int i2c_transfer_rollball(struct i2c_adapter *i2c,
+				 struct i2c_msg *msgs, int num)
+{
+	u8 saved_page;
+	int ret;
+
+	i2c_lock_bus(i2c, I2C_LOCK_SEGMENT);
+
+	/* save original page */
+	ret = __i2c_rollball_get_page(i2c, msgs->addr, &saved_page);
+	if (ret)
+		goto unlock;
+
+	/* change to RollBall MDIO page */
+	ret = __i2c_rollball_set_page(i2c, msgs->addr, SFP_PAGE_ROLLBALL_MDIO);
+	if (ret)
+		goto unlock;
+
+	/* do the transfer */
+	ret = __i2c_transfer_err(i2c, msgs, num);
+	if (ret)
+		goto unlock;  
If get page and set page worked, and you get an error in during the
actual data transfer, i wonder if you should try restoring the page
before returning with the error?
I don't know. Can i2c trasfer fail and the next one succeed?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help