All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 linux dev-4.13 1/2] fsi/gpio: Include command build in locked section
@ 2018-05-10  9:22 Jeremy Kerr
  2018-05-10  9:22 ` [PATCH v2 linux dev-4.13 2/2] fsi/gpio: Use relative-addressing commands Jeremy Kerr
  2018-05-11 21:28 ` [PATCH v2 linux dev-4.13 1/2] fsi/gpio: Include command build in locked section Christopher Bostic
  0 siblings, 2 replies; 4+ messages in thread
From: Jeremy Kerr @ 2018-05-10  9:22 UTC (permalink / raw)
  To: openbmc

For implementing relative addressing mode, we'll need to build a command
that is coherent with CFAM state. To do that, include the
build_command_* functions in the locked section of read/write/term.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
---
 drivers/fsi/fsi-master-gpio.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/drivers/fsi/fsi-master-gpio.c b/drivers/fsi/fsi-master-gpio.c
index 029b0a5b6d89..1723fe4284b0 100644
--- a/drivers/fsi/fsi-master-gpio.c
+++ b/drivers/fsi/fsi-master-gpio.c
@@ -457,14 +457,10 @@ static int fsi_master_gpio_xfer(struct fsi_master_gpio *master, uint8_t slave,
 {
 	int rc;
 
-	mutex_lock(&master->cmd_lock);
-
 	rc = send_request(master, cmd);
 	if (!rc)
 		rc = poll_for_response(master, slave, resp_len, resp);
 
-	mutex_unlock(&master->cmd_lock);
-
 	return rc;
 }
 
@@ -473,12 +469,17 @@ static int fsi_master_gpio_read(struct fsi_master *_master, int link,
 {
 	struct fsi_master_gpio *master = to_fsi_master_gpio(_master);
 	struct fsi_gpio_msg cmd;
+	int rc;
 
 	if (link != 0)
 		return -ENODEV;
 
+	mutex_lock(&master->cmd_lock);
 	build_abs_ar_command(&cmd, id, addr, size, NULL);
-	return fsi_master_gpio_xfer(master, id, &cmd, size, val);
+	rc = fsi_master_gpio_xfer(master, id, &cmd, size, val);
+	mutex_unlock(&master->cmd_lock);
+
+	return rc;
 }
 
 static int fsi_master_gpio_write(struct fsi_master *_master, int link,
@@ -486,12 +487,17 @@ static int fsi_master_gpio_write(struct fsi_master *_master, int link,
 {
 	struct fsi_master_gpio *master = to_fsi_master_gpio(_master);
 	struct fsi_gpio_msg cmd;
+	int rc;
 
 	if (link != 0)
 		return -ENODEV;
 
+	mutex_lock(&master->cmd_lock);
 	build_abs_ar_command(&cmd, id, addr, size, val);
-	return fsi_master_gpio_xfer(master, id, &cmd, 0, NULL);
+	rc = fsi_master_gpio_xfer(master, id, &cmd, 0, NULL);
+	mutex_unlock(&master->cmd_lock);
+
+	return rc;
 }
 
 static int fsi_master_gpio_term(struct fsi_master *_master,
@@ -499,12 +505,17 @@ static int fsi_master_gpio_term(struct fsi_master *_master,
 {
 	struct fsi_master_gpio *master = to_fsi_master_gpio(_master);
 	struct fsi_gpio_msg cmd;
+	int rc;
 
 	if (link != 0)
 		return -ENODEV;
 
+	mutex_lock(&master->cmd_lock);
 	build_term_command(&cmd, id);
-	return fsi_master_gpio_xfer(master, id, &cmd, 0, NULL);
+	rc = fsi_master_gpio_xfer(master, id, &cmd, 0, NULL);
+	mutex_unlock(&master->cmd_lock);
+
+	return rc;
 }
 
 static int fsi_master_gpio_break(struct fsi_master *_master, int link)
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 linux dev-4.13 2/2] fsi/gpio: Use relative-addressing commands
  2018-05-10  9:22 [PATCH v2 linux dev-4.13 1/2] fsi/gpio: Include command build in locked section Jeremy Kerr
@ 2018-05-10  9:22 ` Jeremy Kerr
  2018-05-11 21:30   ` Christopher Bostic
  2018-05-11 21:28 ` [PATCH v2 linux dev-4.13 1/2] fsi/gpio: Include command build in locked section Christopher Bostic
  1 sibling, 1 reply; 4+ messages in thread
From: Jeremy Kerr @ 2018-05-10  9:22 UTC (permalink / raw)
  To: openbmc

FSI CFAMs support shorter commands that use a relative (or same) address
as the last. This change introduces a last_addr to the master state, and
uses it for subsequent reads/writes, and performs relative addressing
when a subsequent read/write is in range.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
---
v2:
 - actually send real version this time
 - rebase onto shenki/fsi-speedups
---
 drivers/fsi/fsi-master-gpio.c | 102 +++++++++++++++++++++++++++++++++++++-----
 1 file changed, 91 insertions(+), 11 deletions(-)

diff --git a/drivers/fsi/fsi-master-gpio.c b/drivers/fsi/fsi-master-gpio.c
index 1723fe4284b0..8d14168d8660 100644
--- a/drivers/fsi/fsi-master-gpio.c
+++ b/drivers/fsi/fsi-master-gpio.c
@@ -28,6 +28,8 @@
 #define	FSI_GPIO_CMD_DPOLL      0x2
 #define	FSI_GPIO_CMD_TERM	0x3f
 #define FSI_GPIO_CMD_ABS_AR	0x4
+#define FSI_GPIO_CMD_REL_AR	0x5
+#define FSI_GPIO_CMD_SAME_AR	0x3	/* but only a 2-bit opcode... */
 
 #define	FSI_GPIO_DPOLL_CLOCKS	100      /* < 21 will cause slave to hang */
 
@@ -51,6 +53,8 @@
 #define	FSI_GPIO_MSG_RESPID_SIZE	2
 #define	FSI_GPIO_PRIME_SLAVE_CLOCKS	20
 
+#define LAST_ADDR_INVALID		0x1
+
 struct fsi_master_gpio {
 	struct fsi_master	master;
 	struct device		*dev;
@@ -63,6 +67,7 @@ struct fsi_master_gpio {
 	struct gpio_desc	*gpio_mux;	/* Mux control */
 	bool			external_mode;
 	bool			no_delays;
+	uint32_t		last_addr;
 };
 
 #define CREATE_TRACE_POINTS
@@ -199,22 +204,89 @@ static void msg_push_crc(struct fsi_gpio_msg *msg)
 	msg_push_bits(msg, crc, 4);
 }
 
+static bool check_same_address(struct fsi_master_gpio *master, int id,
+		uint32_t addr)
+{
+	/* this will also handle LAST_ADDR_INVALID */
+	return master->last_addr == (((id & 0x3) << 21) | (addr & ~0x3));
+}
+
+static bool check_relative_address(struct fsi_master_gpio *master, int id,
+		uint32_t addr, uint32_t *rel_addrp)
+{
+	uint32_t last_addr = master->last_addr;
+	int32_t rel_addr;
+
+	if (last_addr == LAST_ADDR_INVALID)
+		return false;
+
+	/* We may be in 23-bit addressing mode, which uses the id as the
+	 * top two address bits. So, if we're referencing a different ID,
+	 * use absolute addresses.
+	 */
+	if (((last_addr >> 21) & 0x3) != id)
+		return false;
+
+	/* remove the top two bits from any 23-bit addressing */
+	last_addr &= (1 << 21) - 1;
+
+	/* We know that the addresses are limited to 21 bits, so this won't
+	 * overflow the signed rel_addr */
+	rel_addr = addr - last_addr;
+	if (rel_addr > 255 || rel_addr < -256)
+		return false;
+
+	*rel_addrp = (uint32_t)rel_addr;
+
+	return true;
+}
+
+static void last_address_update(struct fsi_master_gpio *master,
+		int id, bool valid, uint32_t addr)
+{
+	if (!valid)
+		master->last_addr = LAST_ADDR_INVALID;
+	else
+		master->last_addr = ((id & 0x3) << 21) | (addr & ~0x3);
+}
+
 /*
- * Encode an Absolute Address command
+ * Encode an Absolute/Relative/Same Address command
  */
-static void build_abs_ar_command(struct fsi_gpio_msg *cmd,
-		uint8_t id, uint32_t addr, size_t size, const void *data)
+static void build_ar_command(struct fsi_master_gpio *master,
+		struct fsi_gpio_msg *cmd, uint8_t id,
+		uint32_t addr, size_t size, const void *data)
 {
+	int i, addr_bits, opcode_bits;
 	bool write = !!data;
-	uint8_t ds;
-	int i;
+	uint8_t ds, opcode;
+	uint32_t rel_addr;
 
 	cmd->bits = 0;
 	cmd->msg = 0;
 
-	msg_push_bits(cmd, id, 2);
-	msg_push_bits(cmd, FSI_GPIO_CMD_ABS_AR, 3);
-	msg_push_bits(cmd, write ? 0 : 1, 1);
+	/* we have 21 bits of address max */
+	addr &= ((1 << 21) - 1);
+
+	/* cmd opcodes are variable length - SAME_AR is only two bits */
+	opcode_bits = 3;
+
+	if (check_same_address(master, id, addr)) {
+		/* we still address the byte offset within the word */
+		addr_bits = 2;
+		opcode_bits = 2;
+		opcode = FSI_GPIO_CMD_SAME_AR;
+
+	} else if (check_relative_address(master, id, addr, &rel_addr)) {
+		/* 8 bits plus sign */
+		addr_bits = 9;
+		addr = rel_addr;
+		opcode = FSI_GPIO_CMD_REL_AR;
+
+	} else {
+		addr_bits = 21;
+		opcode = FSI_GPIO_CMD_ABS_AR;
+	}
 
 	/*
 	 * The read/write size is encoded in the lower bits of the address
@@ -231,7 +303,10 @@ static void build_abs_ar_command(struct fsi_gpio_msg *cmd,
 	if (size == 4)
 		addr |= 1;
 
-	msg_push_bits(cmd, addr & ((1 << 21) - 1), 21);
+	msg_push_bits(cmd, id, 2);
+	msg_push_bits(cmd, opcode, opcode_bits);
+	msg_push_bits(cmd, write ? 0 : 1, 1);
+	msg_push_bits(cmd, addr, addr_bits);
 	msg_push_bits(cmd, ds, 1);
 	for (i = 0; write && i < size; i++)
 		msg_push_bits(cmd, ((uint8_t *)data)[i], 8);
@@ -475,8 +550,9 @@ static int fsi_master_gpio_read(struct fsi_master *_master, int link,
 		return -ENODEV;
 
 	mutex_lock(&master->cmd_lock);
-	build_abs_ar_command(&cmd, id, addr, size, NULL);
+	build_ar_command(master, &cmd, id, addr, size, NULL);
 	rc = fsi_master_gpio_xfer(master, id, &cmd, size, val);
+	last_address_update(master, id, rc == 0, addr);
 	mutex_unlock(&master->cmd_lock);
 
 	return rc;
@@ -493,8 +569,9 @@ static int fsi_master_gpio_write(struct fsi_master *_master, int link,
 		return -ENODEV;
 
 	mutex_lock(&master->cmd_lock);
-	build_abs_ar_command(&cmd, id, addr, size, val);
+	build_ar_command(master, &cmd, id, addr, size, val);
 	rc = fsi_master_gpio_xfer(master, id, &cmd, 0, NULL);
+	last_address_update(master, id, rc == 0, addr);
 	mutex_unlock(&master->cmd_lock);
 
 	return rc;
@@ -513,6 +590,7 @@ static int fsi_master_gpio_term(struct fsi_master *_master,
 	mutex_lock(&master->cmd_lock);
 	build_term_command(&cmd, id);
 	rc = fsi_master_gpio_xfer(master, id, &cmd, 0, NULL);
+	last_address_update(master, id, false, 0);
 	mutex_unlock(&master->cmd_lock);
 
 	return rc;
@@ -546,6 +624,7 @@ static int fsi_master_gpio_break(struct fsi_master *_master, int link)
 	clock_toggle(master, FSI_POST_BREAK_CLOCKS);
 
 	spin_unlock_irqrestore(&master->bit_lock, flags);
+	last_address_update(master, 0, false, 0);
 	mutex_unlock(&master->cmd_lock);
 
 	/* Wait for logic reset to take effect */
@@ -656,6 +735,7 @@ static int fsi_master_gpio_probe(struct platform_device *pdev)
 	master->dev = &pdev->dev;
 	master->master.dev.parent = master->dev;
 	master->master.dev.of_node = of_node_get(dev_of_node(master->dev));
+	master->last_addr = LAST_ADDR_INVALID;
 
 	gpio = devm_gpiod_get(&pdev->dev, "clock", 0);
 	if (IS_ERR(gpio)) {
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 linux dev-4.13 1/2] fsi/gpio: Include command build in locked section
  2018-05-10  9:22 [PATCH v2 linux dev-4.13 1/2] fsi/gpio: Include command build in locked section Jeremy Kerr
  2018-05-10  9:22 ` [PATCH v2 linux dev-4.13 2/2] fsi/gpio: Use relative-addressing commands Jeremy Kerr
@ 2018-05-11 21:28 ` Christopher Bostic
  1 sibling, 0 replies; 4+ messages in thread
From: Christopher Bostic @ 2018-05-11 21:28 UTC (permalink / raw)
  To: Jeremy Kerr, openbmc

Reviewed-by: Christopher Bostic <cbostic@linux.vnet.ibm.com>


On 5/10/18 4:22 AM, Jeremy Kerr wrote:
> For implementing relative addressing mode, we'll need to build a command
> that is coherent with CFAM state. To do that, include the
> build_command_* functions in the locked section of read/write/term.
>
> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
> ---
>   drivers/fsi/fsi-master-gpio.c | 25 ++++++++++++++++++-------
>   1 file changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/fsi/fsi-master-gpio.c b/drivers/fsi/fsi-master-gpio.c
> index 029b0a5b6d89..1723fe4284b0 100644
> --- a/drivers/fsi/fsi-master-gpio.c
> +++ b/drivers/fsi/fsi-master-gpio.c
> @@ -457,14 +457,10 @@ static int fsi_master_gpio_xfer(struct fsi_master_gpio *master, uint8_t slave,
>   {
>   	int rc;
>
> -	mutex_lock(&master->cmd_lock);
> -
>   	rc = send_request(master, cmd);
>   	if (!rc)
>   		rc = poll_for_response(master, slave, resp_len, resp);
>
> -	mutex_unlock(&master->cmd_lock);
> -
>   	return rc;
>   }
>
> @@ -473,12 +469,17 @@ static int fsi_master_gpio_read(struct fsi_master *_master, int link,
>   {
>   	struct fsi_master_gpio *master = to_fsi_master_gpio(_master);
>   	struct fsi_gpio_msg cmd;
> +	int rc;
>
>   	if (link != 0)
>   		return -ENODEV;
>
> +	mutex_lock(&master->cmd_lock);
>   	build_abs_ar_command(&cmd, id, addr, size, NULL);
> -	return fsi_master_gpio_xfer(master, id, &cmd, size, val);
> +	rc = fsi_master_gpio_xfer(master, id, &cmd, size, val);
> +	mutex_unlock(&master->cmd_lock);
> +
> +	return rc;
>   }
>
>   static int fsi_master_gpio_write(struct fsi_master *_master, int link,
> @@ -486,12 +487,17 @@ static int fsi_master_gpio_write(struct fsi_master *_master, int link,
>   {
>   	struct fsi_master_gpio *master = to_fsi_master_gpio(_master);
>   	struct fsi_gpio_msg cmd;
> +	int rc;
>
>   	if (link != 0)
>   		return -ENODEV;
>
> +	mutex_lock(&master->cmd_lock);
>   	build_abs_ar_command(&cmd, id, addr, size, val);
> -	return fsi_master_gpio_xfer(master, id, &cmd, 0, NULL);
> +	rc = fsi_master_gpio_xfer(master, id, &cmd, 0, NULL);
> +	mutex_unlock(&master->cmd_lock);
> +
> +	return rc;
>   }
>
>   static int fsi_master_gpio_term(struct fsi_master *_master,
> @@ -499,12 +505,17 @@ static int fsi_master_gpio_term(struct fsi_master *_master,
>   {
>   	struct fsi_master_gpio *master = to_fsi_master_gpio(_master);
>   	struct fsi_gpio_msg cmd;
> +	int rc;
>
>   	if (link != 0)
>   		return -ENODEV;
>
> +	mutex_lock(&master->cmd_lock);
>   	build_term_command(&cmd, id);
> -	return fsi_master_gpio_xfer(master, id, &cmd, 0, NULL);
> +	rc = fsi_master_gpio_xfer(master, id, &cmd, 0, NULL);
> +	mutex_unlock(&master->cmd_lock);
> +
> +	return rc;
>   }
>
>   static int fsi_master_gpio_break(struct fsi_master *_master, int link)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 linux dev-4.13 2/2] fsi/gpio: Use relative-addressing commands
  2018-05-10  9:22 ` [PATCH v2 linux dev-4.13 2/2] fsi/gpio: Use relative-addressing commands Jeremy Kerr
@ 2018-05-11 21:30   ` Christopher Bostic
  0 siblings, 0 replies; 4+ messages in thread
From: Christopher Bostic @ 2018-05-11 21:30 UTC (permalink / raw)
  To: Jeremy Kerr, openbmc

Reviewed-by: Christopher Bostic <cbostic@linux.vnet.ibm.com>


On 5/10/18 4:22 AM, Jeremy Kerr wrote:
> FSI CFAMs support shorter commands that use a relative (or same) address
> as the last. This change introduces a last_addr to the master state, and
> uses it for subsequent reads/writes, and performs relative addressing
> when a subsequent read/write is in range.
>
> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
> ---
> v2:
>   - actually send real version this time
>   - rebase onto shenki/fsi-speedups
> ---
>   drivers/fsi/fsi-master-gpio.c | 102 +++++++++++++++++++++++++++++++++++++-----
>   1 file changed, 91 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/fsi/fsi-master-gpio.c b/drivers/fsi/fsi-master-gpio.c
> index 1723fe4284b0..8d14168d8660 100644
> --- a/drivers/fsi/fsi-master-gpio.c
> +++ b/drivers/fsi/fsi-master-gpio.c
> @@ -28,6 +28,8 @@
>   #define	FSI_GPIO_CMD_DPOLL      0x2
>   #define	FSI_GPIO_CMD_TERM	0x3f
>   #define FSI_GPIO_CMD_ABS_AR	0x4
> +#define FSI_GPIO_CMD_REL_AR	0x5
> +#define FSI_GPIO_CMD_SAME_AR	0x3	/* but only a 2-bit opcode... */
>
>   #define	FSI_GPIO_DPOLL_CLOCKS	100      /* < 21 will cause slave to hang */
>
> @@ -51,6 +53,8 @@
>   #define	FSI_GPIO_MSG_RESPID_SIZE	2
>   #define	FSI_GPIO_PRIME_SLAVE_CLOCKS	20
>
> +#define LAST_ADDR_INVALID		0x1
> +
>   struct fsi_master_gpio {
>   	struct fsi_master	master;
>   	struct device		*dev;
> @@ -63,6 +67,7 @@ struct fsi_master_gpio {
>   	struct gpio_desc	*gpio_mux;	/* Mux control */
>   	bool			external_mode;
>   	bool			no_delays;
> +	uint32_t		last_addr;
>   };
>
>   #define CREATE_TRACE_POINTS
> @@ -199,22 +204,89 @@ static void msg_push_crc(struct fsi_gpio_msg *msg)
>   	msg_push_bits(msg, crc, 4);
>   }
>
> +static bool check_same_address(struct fsi_master_gpio *master, int id,
> +		uint32_t addr)
> +{
> +	/* this will also handle LAST_ADDR_INVALID */
> +	return master->last_addr == (((id & 0x3) << 21) | (addr & ~0x3));
> +}
> +
> +static bool check_relative_address(struct fsi_master_gpio *master, int id,
> +		uint32_t addr, uint32_t *rel_addrp)
> +{
> +	uint32_t last_addr = master->last_addr;
> +	int32_t rel_addr;
> +
> +	if (last_addr == LAST_ADDR_INVALID)
> +		return false;
> +
> +	/* We may be in 23-bit addressing mode, which uses the id as the
> +	 * top two address bits. So, if we're referencing a different ID,
> +	 * use absolute addresses.
> +	 */
> +	if (((last_addr >> 21) & 0x3) != id)
> +		return false;
> +
> +	/* remove the top two bits from any 23-bit addressing */
> +	last_addr &= (1 << 21) - 1;
> +
> +	/* We know that the addresses are limited to 21 bits, so this won't
> +	 * overflow the signed rel_addr */
> +	rel_addr = addr - last_addr;
> +	if (rel_addr > 255 || rel_addr < -256)
> +		return false;
> +
> +	*rel_addrp = (uint32_t)rel_addr;
> +
> +	return true;
> +}
> +
> +static void last_address_update(struct fsi_master_gpio *master,
> +		int id, bool valid, uint32_t addr)
> +{
> +	if (!valid)
> +		master->last_addr = LAST_ADDR_INVALID;
> +	else
> +		master->last_addr = ((id & 0x3) << 21) | (addr & ~0x3);
> +}
> +
>   /*
> - * Encode an Absolute Address command
> + * Encode an Absolute/Relative/Same Address command
>    */
> -static void build_abs_ar_command(struct fsi_gpio_msg *cmd,
> -		uint8_t id, uint32_t addr, size_t size, const void *data)
> +static void build_ar_command(struct fsi_master_gpio *master,
> +		struct fsi_gpio_msg *cmd, uint8_t id,
> +		uint32_t addr, size_t size, const void *data)
>   {
> +	int i, addr_bits, opcode_bits;
>   	bool write = !!data;
> -	uint8_t ds;
> -	int i;
> +	uint8_t ds, opcode;
> +	uint32_t rel_addr;
>
>   	cmd->bits = 0;
>   	cmd->msg = 0;
>
> -	msg_push_bits(cmd, id, 2);
> -	msg_push_bits(cmd, FSI_GPIO_CMD_ABS_AR, 3);
> -	msg_push_bits(cmd, write ? 0 : 1, 1);
> +	/* we have 21 bits of address max */
> +	addr &= ((1 << 21) - 1);
> +
> +	/* cmd opcodes are variable length - SAME_AR is only two bits */
> +	opcode_bits = 3;
> +
> +	if (check_same_address(master, id, addr)) {
> +		/* we still address the byte offset within the word */
> +		addr_bits = 2;
> +		opcode_bits = 2;
> +		opcode = FSI_GPIO_CMD_SAME_AR;
> +
> +	} else if (check_relative_address(master, id, addr, &rel_addr)) {
> +		/* 8 bits plus sign */
> +		addr_bits = 9;
> +		addr = rel_addr;
> +		opcode = FSI_GPIO_CMD_REL_AR;
> +
> +	} else {
> +		addr_bits = 21;
> +		opcode = FSI_GPIO_CMD_ABS_AR;
> +	}
>
>   	/*
>   	 * The read/write size is encoded in the lower bits of the address
> @@ -231,7 +303,10 @@ static void build_abs_ar_command(struct fsi_gpio_msg *cmd,
>   	if (size == 4)
>   		addr |= 1;
>
> -	msg_push_bits(cmd, addr & ((1 << 21) - 1), 21);
> +	msg_push_bits(cmd, id, 2);
> +	msg_push_bits(cmd, opcode, opcode_bits);
> +	msg_push_bits(cmd, write ? 0 : 1, 1);
> +	msg_push_bits(cmd, addr, addr_bits);
>   	msg_push_bits(cmd, ds, 1);
>   	for (i = 0; write && i < size; i++)
>   		msg_push_bits(cmd, ((uint8_t *)data)[i], 8);
> @@ -475,8 +550,9 @@ static int fsi_master_gpio_read(struct fsi_master *_master, int link,
>   		return -ENODEV;
>
>   	mutex_lock(&master->cmd_lock);
> -	build_abs_ar_command(&cmd, id, addr, size, NULL);
> +	build_ar_command(master, &cmd, id, addr, size, NULL);
>   	rc = fsi_master_gpio_xfer(master, id, &cmd, size, val);
> +	last_address_update(master, id, rc == 0, addr);
>   	mutex_unlock(&master->cmd_lock);
>
>   	return rc;
> @@ -493,8 +569,9 @@ static int fsi_master_gpio_write(struct fsi_master *_master, int link,
>   		return -ENODEV;
>
>   	mutex_lock(&master->cmd_lock);
> -	build_abs_ar_command(&cmd, id, addr, size, val);
> +	build_ar_command(master, &cmd, id, addr, size, val);
>   	rc = fsi_master_gpio_xfer(master, id, &cmd, 0, NULL);
> +	last_address_update(master, id, rc == 0, addr);
>   	mutex_unlock(&master->cmd_lock);
>
>   	return rc;
> @@ -513,6 +590,7 @@ static int fsi_master_gpio_term(struct fsi_master *_master,
>   	mutex_lock(&master->cmd_lock);
>   	build_term_command(&cmd, id);
>   	rc = fsi_master_gpio_xfer(master, id, &cmd, 0, NULL);
> +	last_address_update(master, id, false, 0);
>   	mutex_unlock(&master->cmd_lock);
>
>   	return rc;
> @@ -546,6 +624,7 @@ static int fsi_master_gpio_break(struct fsi_master *_master, int link)
>   	clock_toggle(master, FSI_POST_BREAK_CLOCKS);
>
>   	spin_unlock_irqrestore(&master->bit_lock, flags);
> +	last_address_update(master, 0, false, 0);
>   	mutex_unlock(&master->cmd_lock);
>
>   	/* Wait for logic reset to take effect */
> @@ -656,6 +735,7 @@ static int fsi_master_gpio_probe(struct platform_device *pdev)
>   	master->dev = &pdev->dev;
>   	master->master.dev.parent = master->dev;
>   	master->master.dev.of_node = of_node_get(dev_of_node(master->dev));
> +	master->last_addr = LAST_ADDR_INVALID;
>
>   	gpio = devm_gpiod_get(&pdev->dev, "clock", 0);
>   	if (IS_ERR(gpio)) {

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-05-11 21:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-10  9:22 [PATCH v2 linux dev-4.13 1/2] fsi/gpio: Include command build in locked section Jeremy Kerr
2018-05-10  9:22 ` [PATCH v2 linux dev-4.13 2/2] fsi/gpio: Use relative-addressing commands Jeremy Kerr
2018-05-11 21:30   ` Christopher Bostic
2018-05-11 21:28 ` [PATCH v2 linux dev-4.13 1/2] fsi/gpio: Include command build in locked section Christopher Bostic

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.