Re: [PATCH] musb gadget: Fix wrong hardware endpint is used for musb core configured with shared FIFO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

Kan Yan wrote:

Use musb->endpoints[epnum].ep_in instead of ep_out when shared FIFO is
used, because only ep_in get initialized when musb_g_init_endpoints() is called if the
musb core use shared FIFO option.

This was tested on Ubicom's IP7K Evaluation board.

Signed-off-by: Kan Yan <kyan@xxxxxxxxxx>

[...]

diff --git a/drivers/usb/musb/musb_gadget.c
b/drivers/usb/musb/musb_gadget.c
old mode 100644
new mode 100755
index 8b3c4e2..d17575b
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -585,10 +585,16 @@ static void rxstate(struct musb *musb, struct
musb_request *req)
 	u16			csr = 0;
 	const u8		epnum = req->epnum;
 	struct usb_request	*request = &req->request;
-	struct musb_ep		*musb_ep =
&musb->endpoints[epnum].ep_out;

   Your patch is line-wrapped.

+	struct musb_ep		*musb_ep = NULL;

   Pointless initializer.

 	void __iomem		*epio = musb->endpoints[epnum].regs;
 	unsigned		fifo_count = 0;
-	u16			len = musb_ep->packet_sz;
+	u16			len = 0;
+	
+	if (musb->endpoints[epnum].is_shared_fifo)
+		musb_ep = &musb->endpoints[epnum].ep_in;
+	else
+		musb_ep = &musb->endpoints[epnum].ep_out;
+	len =  musb_ep->packet_sz;
csr = musb_readw(epio, MUSB_RXCSR); @@ -746,10 +752,15 @@ void musb_g_rx(struct musb *musb, u8 epnum)
 	u16			csr;
 	struct usb_request	*request;
 	void __iomem		*mbase = musb->mregs;
-	struct musb_ep		*musb_ep =
&musb->endpoints[epnum].ep_out;
+	struct musb_ep		*musb_ep = NULL;

   Again...

 	void __iomem		*epio = musb->endpoints[epnum].regs;
 	struct dma_channel	*dma;
+ if (musb->endpoints[epnum].is_shared_fifo)
+		musb_ep = &musb->endpoints[epnum].ep_in;
+	else
+		musb_ep = &musb->endpoints[epnum].ep_out;
+	
 	musb_ep_select(mbase, epnum);
request = next_request(musb_ep);

WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux