* [PATCH] i2c: cadence: Fix the driver in interrupt flurry case
@ 2019-02-15 12:03 ` shubhrajyoti.datta
0 siblings, 0 replies; 4+ messages in thread
From: shubhrajyoti.datta @ 2019-02-15 12:03 UTC (permalink / raw)
To: linux-i2c; +Cc: Shubhrajyoti Datta, michal.simek, linux-arm-kernel
From: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
In case there are a lot of interrupts then the hold bit is not
released protect the code by making it atomic by disabling interrupts.
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---
drivers/i2c/busses/i2c-cadence.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
index b136057..92829be 100644
--- a/drivers/i2c/busses/i2c-cadence.c
+++ b/drivers/i2c/busses/i2c-cadence.c
@@ -365,6 +365,7 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
{
unsigned int ctrl_reg;
unsigned int isr_status;
+ unsigned long flags;
id->p_recv_buf = id->p_msg->buf;
id->recv_count = id->p_msg->len;
@@ -405,6 +406,7 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
cdns_i2c_writereg(id->recv_count, CDNS_I2C_XFER_SIZE_OFFSET);
}
+ local_irq_save(flags);
/* Set the slave address in address register - triggers operation */
cdns_i2c_writereg(id->p_msg->addr & CDNS_I2C_ADDR_MASK,
CDNS_I2C_ADDR_OFFSET);
@@ -413,6 +415,7 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
((id->p_msg->flags & I2C_M_RECV_LEN) != I2C_M_RECV_LEN) &&
(id->recv_count <= CDNS_I2C_FIFO_DEPTH))
cdns_i2c_clear_bus_hold(id);
+ local_irq_restore(flags);
cdns_i2c_writereg(CDNS_I2C_ENABLED_INTR_MASK, CDNS_I2C_IER_OFFSET);
}
--
2.1.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] i2c: cadence: Fix the driver in interrupt flurry case
@ 2019-02-15 12:03 ` shubhrajyoti.datta
0 siblings, 0 replies; 4+ messages in thread
From: shubhrajyoti.datta @ 2019-02-15 12:03 UTC (permalink / raw)
To: linux-i2c; +Cc: Shubhrajyoti Datta, michal.simek, linux-arm-kernel
From: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
In case there are a lot of interrupts then the hold bit is not
released protect the code by making it atomic by disabling interrupts.
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---
drivers/i2c/busses/i2c-cadence.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
index b136057..92829be 100644
--- a/drivers/i2c/busses/i2c-cadence.c
+++ b/drivers/i2c/busses/i2c-cadence.c
@@ -365,6 +365,7 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
{
unsigned int ctrl_reg;
unsigned int isr_status;
+ unsigned long flags;
id->p_recv_buf = id->p_msg->buf;
id->recv_count = id->p_msg->len;
@@ -405,6 +406,7 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
cdns_i2c_writereg(id->recv_count, CDNS_I2C_XFER_SIZE_OFFSET);
}
+ local_irq_save(flags);
/* Set the slave address in address register - triggers operation */
cdns_i2c_writereg(id->p_msg->addr & CDNS_I2C_ADDR_MASK,
CDNS_I2C_ADDR_OFFSET);
@@ -413,6 +415,7 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
((id->p_msg->flags & I2C_M_RECV_LEN) != I2C_M_RECV_LEN) &&
(id->recv_count <= CDNS_I2C_FIFO_DEPTH))
cdns_i2c_clear_bus_hold(id);
+ local_irq_restore(flags);
cdns_i2c_writereg(CDNS_I2C_ENABLED_INTR_MASK, CDNS_I2C_IER_OFFSET);
}
--
2.1.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: cadence: Fix the driver in interrupt flurry case
2019-02-15 12:03 ` shubhrajyoti.datta
@ 2019-02-18 15:10 ` Michal Simek
-1 siblings, 0 replies; 4+ messages in thread
From: Michal Simek @ 2019-02-18 15:10 UTC (permalink / raw)
To: shubhrajyoti.datta, linux-i2c
Cc: Shubhrajyoti Datta, michal.simek, linux-arm-kernel
On 15. 02. 19 13:03, shubhrajyoti.datta@gmail.com wrote:
> From: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
>
> In case there are a lot of interrupts then the hold bit is not
> released protect the code by making it atomic by disabling interrupts.
There are two sentences in one.
Isn't it "released. Protect"?
>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> ---
> drivers/i2c/busses/i2c-cadence.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
> index b136057..92829be 100644
> --- a/drivers/i2c/busses/i2c-cadence.c
> +++ b/drivers/i2c/busses/i2c-cadence.c
> @@ -365,6 +365,7 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
> {
> unsigned int ctrl_reg;
> unsigned int isr_status;
> + unsigned long flags;
>
> id->p_recv_buf = id->p_msg->buf;
> id->recv_count = id->p_msg->len;
> @@ -405,6 +406,7 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
> cdns_i2c_writereg(id->recv_count, CDNS_I2C_XFER_SIZE_OFFSET);
> }
>
> + local_irq_save(flags);
> /* Set the slave address in address register - triggers operation */
> cdns_i2c_writereg(id->p_msg->addr & CDNS_I2C_ADDR_MASK,
> CDNS_I2C_ADDR_OFFSET);
> @@ -413,6 +415,7 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
> ((id->p_msg->flags & I2C_M_RECV_LEN) != I2C_M_RECV_LEN) &&
> (id->recv_count <= CDNS_I2C_FIFO_DEPTH))
> cdns_i2c_clear_bus_hold(id);
> + local_irq_restore(flags);
> cdns_i2c_writereg(CDNS_I2C_ENABLED_INTR_MASK, CDNS_I2C_IER_OFFSET);
> }
>
>
The rest looks good.
M
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: cadence: Fix the driver in interrupt flurry case
@ 2019-02-18 15:10 ` Michal Simek
0 siblings, 0 replies; 4+ messages in thread
From: Michal Simek @ 2019-02-18 15:10 UTC (permalink / raw)
To: shubhrajyoti.datta, linux-i2c
Cc: Shubhrajyoti Datta, michal.simek, linux-arm-kernel
On 15. 02. 19 13:03, shubhrajyoti.datta@gmail.com wrote:
> From: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
>
> In case there are a lot of interrupts then the hold bit is not
> released protect the code by making it atomic by disabling interrupts.
There are two sentences in one.
Isn't it "released. Protect"?
>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> ---
> drivers/i2c/busses/i2c-cadence.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
> index b136057..92829be 100644
> --- a/drivers/i2c/busses/i2c-cadence.c
> +++ b/drivers/i2c/busses/i2c-cadence.c
> @@ -365,6 +365,7 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
> {
> unsigned int ctrl_reg;
> unsigned int isr_status;
> + unsigned long flags;
>
> id->p_recv_buf = id->p_msg->buf;
> id->recv_count = id->p_msg->len;
> @@ -405,6 +406,7 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
> cdns_i2c_writereg(id->recv_count, CDNS_I2C_XFER_SIZE_OFFSET);
> }
>
> + local_irq_save(flags);
> /* Set the slave address in address register - triggers operation */
> cdns_i2c_writereg(id->p_msg->addr & CDNS_I2C_ADDR_MASK,
> CDNS_I2C_ADDR_OFFSET);
> @@ -413,6 +415,7 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
> ((id->p_msg->flags & I2C_M_RECV_LEN) != I2C_M_RECV_LEN) &&
> (id->recv_count <= CDNS_I2C_FIFO_DEPTH))
> cdns_i2c_clear_bus_hold(id);
> + local_irq_restore(flags);
> cdns_i2c_writereg(CDNS_I2C_ENABLED_INTR_MASK, CDNS_I2C_IER_OFFSET);
> }
>
>
The rest looks good.
M
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-02-18 15:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-15 12:03 [PATCH] i2c: cadence: Fix the driver in interrupt flurry case shubhrajyoti.datta
2019-02-15 12:03 ` shubhrajyoti.datta
2019-02-18 15:10 ` Michal Simek
2019-02-18 15:10 ` Michal Simek
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.