Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ff5d09b authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Felipe Balbi
Browse files

usb: gadget: renesas_usbhs: disable pipe on top of interrupt



When data read interrupt happened, the pipe is BUF which means "enable".
then, next un-necessary interrupt/token might be
issued again when all data were popped from fifo.
It will cause un-understandable bug.
This patch decides pipe disable on top of read interrupt.

Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 6e6db82b
Loading
Loading
Loading
Loading
+14 −9
Original line number Original line Diff line number Diff line
@@ -475,6 +475,20 @@ static int usbhsf_pio_try_pop(struct usbhs_pkt *pkt, int *is_done)
	len		= min(len, rcv_len);
	len		= min(len, rcv_len);
	total_len	= len;
	total_len	= len;


	/*
	 * update actual length first here to decide disable pipe.
	 * if this pipe keeps BUF status and all data were popped,
	 * then, next interrupt/token will be issued again
	 */
	pkt->actual += total_len;

	if ((pkt->actual == pkt->length) ||	/* receive all data */
	    (total_len < maxp)) {		/* short packet */
		*is_done = 1;
		usbhsf_rx_irq_ctrl(pipe, 0);
		usbhs_pipe_disable(pipe);	/* disable pipe first */
	}

	/*
	/*
	 * Buffer clear if Zero-Length packet
	 * Buffer clear if Zero-Length packet
	 *
	 *
@@ -505,16 +519,7 @@ static int usbhsf_pio_try_pop(struct usbhs_pkt *pkt, int *is_done)
		buf[i] = (data >> ((i & 0x03) * 8)) & 0xff;
		buf[i] = (data >> ((i & 0x03) * 8)) & 0xff;
	}
	}


	pkt->actual += total_len;

usbhs_fifo_read_end:
usbhs_fifo_read_end:
	if ((pkt->actual == pkt->length) ||	/* receive all data */
	    (total_len < maxp)) {		/* short packet */
		*is_done = 1;
		usbhsf_rx_irq_ctrl(pipe, 0);
		usbhs_pipe_disable(pipe);
	}

	dev_dbg(dev, "  recv %d (%d/ %d/ %d/ %d)\n",
	dev_dbg(dev, "  recv %d (%d/ %d/ %d/ %d)\n",
		usbhs_pipe_number(pipe),
		usbhs_pipe_number(pipe),
		pkt->length, pkt->actual, *is_done, pkt->zero);
		pkt->length, pkt->actual, *is_done, pkt->zero);