Re: [PATCH] ipoctal: clear break interrupt as soon as it occurs

2014-09-01 Thread Samuel Iglesias Gonsálvez
On Mon, 2014-09-01 at 13:49 +0200, Federico Vaga wrote:
> In some condition we receive the break interrupt but nothing is putted
> in the Rx FIFO and the correspondend bit in the status register is not
> set. Thus, no-one clear the interrupt and the handler will be called
> forever.
> 
> This patch clear the break interrupt as soon as it occurs. Then, if the
> break character '\0' is putted in the fifo we will manage it.
> 
> We can also unmask the Break interrupt but its bit in ISR is still set
> on break. So I think is better to keep the registers clean.
> 
> Signed-off-by: Federico Vaga 
> ---
>  drivers/ipack/devices/ipoctal.c |4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ipack/devices/ipoctal.c b/drivers/ipack/devices/ipoctal.c
> index e41bef0..90b96a1b 100644
> --- a/drivers/ipack/devices/ipoctal.c
> +++ b/drivers/ipack/devices/ipoctal.c
> @@ -151,7 +151,6 @@ static void ipoctal_irq_rx(struct ipoctal_channel 
> *channel, u8 sr)
>   flag = TTY_FRAME;
>   }
>   if (sr & SR_RECEIVED_BREAK) {
> - iowrite8(CR_CMD_RESET_BREAK_CHANGE, 
> >regs->w.cr);
>   channel->stats.rcv_break++;
>   flag = TTY_BREAK;
>   }
> @@ -196,6 +195,9 @@ static void ipoctal_irq_channel(struct ipoctal_channel 
> *channel)
>   isr = ioread8(>block_regs->r.isr);
>   sr = ioread8(>regs->r.sr);
>  
> + if (isr & (IMR_DELTA_BREAK_A | IMR_DELTA_BREAK_B))
> + iowrite8(CR_CMD_RESET_BREAK_CHANGE, >regs->w.cr);
> +
>   if ((sr & SR_TX_EMPTY) && (channel->nb_bytes == 0)) {
>   iowrite8(CR_DISABLE_TX, >regs->w.cr);
>   /* In case of RS-485, change from TX to RX when finishing TX.

Acked-by: Samuel Iglesias Gonsalvez 

Thanks for the patch!

Greg, Would you mind picking this patch through your char-misc tree?

Sam


signature.asc
Description: This is a digitally signed message part


[PATCH] ipoctal: clear break interrupt as soon as it occurs

2014-09-01 Thread Federico Vaga
In some condition we receive the break interrupt but nothing is putted
in the Rx FIFO and the correspondend bit in the status register is not
set. Thus, no-one clear the interrupt and the handler will be called
forever.

This patch clear the break interrupt as soon as it occurs. Then, if the
break character '\0' is putted in the fifo we will manage it.

We can also unmask the Break interrupt but its bit in ISR is still set
on break. So I think is better to keep the registers clean.

Signed-off-by: Federico Vaga 
---
 drivers/ipack/devices/ipoctal.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/ipack/devices/ipoctal.c b/drivers/ipack/devices/ipoctal.c
index e41bef0..90b96a1b 100644
--- a/drivers/ipack/devices/ipoctal.c
+++ b/drivers/ipack/devices/ipoctal.c
@@ -151,7 +151,6 @@ static void ipoctal_irq_rx(struct ipoctal_channel *channel, 
u8 sr)
flag = TTY_FRAME;
}
if (sr & SR_RECEIVED_BREAK) {
-   iowrite8(CR_CMD_RESET_BREAK_CHANGE, 
>regs->w.cr);
channel->stats.rcv_break++;
flag = TTY_BREAK;
}
@@ -196,6 +195,9 @@ static void ipoctal_irq_channel(struct ipoctal_channel 
*channel)
isr = ioread8(>block_regs->r.isr);
sr = ioread8(>regs->r.sr);
 
+   if (isr & (IMR_DELTA_BREAK_A | IMR_DELTA_BREAK_B))
+   iowrite8(CR_CMD_RESET_BREAK_CHANGE, >regs->w.cr);
+
if ((sr & SR_TX_EMPTY) && (channel->nb_bytes == 0)) {
iowrite8(CR_DISABLE_TX, >regs->w.cr);
/* In case of RS-485, change from TX to RX when finishing TX.
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ipoctal: clear break interrupt as soon as it occurs

2014-09-01 Thread Federico Vaga
In some condition we receive the break interrupt but nothing is putted
in the Rx FIFO and the correspondend bit in the status register is not
set. Thus, no-one clear the interrupt and the handler will be called
forever.

This patch clear the break interrupt as soon as it occurs. Then, if the
break character '\0' is putted in the fifo we will manage it.

We can also unmask the Break interrupt but its bit in ISR is still set
on break. So I think is better to keep the registers clean.

Signed-off-by: Federico Vaga federico.v...@cern.ch
---
 drivers/ipack/devices/ipoctal.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/ipack/devices/ipoctal.c b/drivers/ipack/devices/ipoctal.c
index e41bef0..90b96a1b 100644
--- a/drivers/ipack/devices/ipoctal.c
+++ b/drivers/ipack/devices/ipoctal.c
@@ -151,7 +151,6 @@ static void ipoctal_irq_rx(struct ipoctal_channel *channel, 
u8 sr)
flag = TTY_FRAME;
}
if (sr  SR_RECEIVED_BREAK) {
-   iowrite8(CR_CMD_RESET_BREAK_CHANGE, 
channel-regs-w.cr);
channel-stats.rcv_break++;
flag = TTY_BREAK;
}
@@ -196,6 +195,9 @@ static void ipoctal_irq_channel(struct ipoctal_channel 
*channel)
isr = ioread8(channel-block_regs-r.isr);
sr = ioread8(channel-regs-r.sr);
 
+   if (isr  (IMR_DELTA_BREAK_A | IMR_DELTA_BREAK_B))
+   iowrite8(CR_CMD_RESET_BREAK_CHANGE, channel-regs-w.cr);
+
if ((sr  SR_TX_EMPTY)  (channel-nb_bytes == 0)) {
iowrite8(CR_DISABLE_TX, channel-regs-w.cr);
/* In case of RS-485, change from TX to RX when finishing TX.
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ipoctal: clear break interrupt as soon as it occurs

2014-09-01 Thread Samuel Iglesias Gonsálvez
On Mon, 2014-09-01 at 13:49 +0200, Federico Vaga wrote:
 In some condition we receive the break interrupt but nothing is putted
 in the Rx FIFO and the correspondend bit in the status register is not
 set. Thus, no-one clear the interrupt and the handler will be called
 forever.
 
 This patch clear the break interrupt as soon as it occurs. Then, if the
 break character '\0' is putted in the fifo we will manage it.
 
 We can also unmask the Break interrupt but its bit in ISR is still set
 on break. So I think is better to keep the registers clean.
 
 Signed-off-by: Federico Vaga federico.v...@cern.ch
 ---
  drivers/ipack/devices/ipoctal.c |4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/ipack/devices/ipoctal.c b/drivers/ipack/devices/ipoctal.c
 index e41bef0..90b96a1b 100644
 --- a/drivers/ipack/devices/ipoctal.c
 +++ b/drivers/ipack/devices/ipoctal.c
 @@ -151,7 +151,6 @@ static void ipoctal_irq_rx(struct ipoctal_channel 
 *channel, u8 sr)
   flag = TTY_FRAME;
   }
   if (sr  SR_RECEIVED_BREAK) {
 - iowrite8(CR_CMD_RESET_BREAK_CHANGE, 
 channel-regs-w.cr);
   channel-stats.rcv_break++;
   flag = TTY_BREAK;
   }
 @@ -196,6 +195,9 @@ static void ipoctal_irq_channel(struct ipoctal_channel 
 *channel)
   isr = ioread8(channel-block_regs-r.isr);
   sr = ioread8(channel-regs-r.sr);
  
 + if (isr  (IMR_DELTA_BREAK_A | IMR_DELTA_BREAK_B))
 + iowrite8(CR_CMD_RESET_BREAK_CHANGE, channel-regs-w.cr);
 +
   if ((sr  SR_TX_EMPTY)  (channel-nb_bytes == 0)) {
   iowrite8(CR_DISABLE_TX, channel-regs-w.cr);
   /* In case of RS-485, change from TX to RX when finishing TX.

Acked-by: Samuel Iglesias Gonsalvez sigles...@igalia.com

Thanks for the patch!

Greg, Would you mind picking this patch through your char-misc tree?

Sam


signature.asc
Description: This is a digitally signed message part