[PATCH 15/27] usb: renesas_usbhs: add device select support in usbhs_pipe_config_update()

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

 



device select method will be used on mod_host

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
---
 drivers/usb/renesas_usbhs/mod_gadget.c |    4 ++--
 drivers/usb/renesas_usbhs/pipe.c       |   16 ++++++++++++++--
 drivers/usb/renesas_usbhs/pipe.h       |    3 ++-
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c
index bcaaedc..9b5c7f2 100644
--- a/drivers/usb/renesas_usbhs/mod_gadget.c
+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
@@ -489,7 +489,7 @@ static int usbhsg_ep_enable(struct usb_ep *ep,
 		pipe->mod_private	= uep;
 
 		/* set epnum / maxp */
-		usbhs_pipe_config_update(pipe,
+		usbhs_pipe_config_update(pipe, 0,
 					 usb_endpoint_num(desc),
 					 usb_endpoint_maxp(desc));
 
@@ -672,7 +672,7 @@ static int usbhsg_try_start(struct usbhs_priv *priv, u32 status)
 	/* dcp init */
 	dcp->pipe		= usbhs_dcp_malloc(priv);
 	dcp->pipe->mod_private	= dcp;
-	usbhs_pipe_config_update(dcp->pipe, 0, 64);
+	usbhs_pipe_config_update(dcp->pipe, 0, 0, 64);
 
 	/*
 	 * system config enble
diff --git a/drivers/usb/renesas_usbhs/pipe.c b/drivers/usb/renesas_usbhs/pipe.c
index 08d11b0..4235a2e 100644
--- a/drivers/usb/renesas_usbhs/pipe.c
+++ b/drivers/usb/renesas_usbhs/pipe.c
@@ -418,14 +418,26 @@ static u16 usbhsp_setup_pipebuff(struct usbhs_pipe *pipe)
 		(0xff & bufnmb)		<<  0;
 }
 
-void usbhs_pipe_config_update(struct usbhs_pipe *pipe, u16 epnum, u16 maxp)
+void usbhs_pipe_config_update(struct usbhs_pipe *pipe, u16 devsel,
+			      u16 epnum, u16 maxp)
 {
+	if (devsel > 0xA) {
+		struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
+		struct device *dev = usbhs_priv_to_dev(priv);
+
+		dev_err(dev, "devsel error %d\n", devsel);
+
+		devsel = 0;
+	}
+
 	usbhsp_pipe_barrier(pipe);
 
 	pipe->maxp = maxp;
 
 	usbhsp_pipe_select(pipe);
-	usbhsp_pipe_maxp_set(pipe, 0xFFFF, maxp);
+	usbhsp_pipe_maxp_set(pipe, 0xFFFF,
+			     (devsel << 12) |
+			     maxp);
 
 	if (!usbhs_pipe_is_dcp(pipe))
 		usbhsp_pipe_cfg_set(pipe,  0x000F, epnum);
diff --git a/drivers/usb/renesas_usbhs/pipe.h b/drivers/usb/renesas_usbhs/pipe.h
index 05b706a..aff8bfa 100644
--- a/drivers/usb/renesas_usbhs/pipe.h
+++ b/drivers/usb/renesas_usbhs/pipe.h
@@ -91,7 +91,8 @@ void usbhs_pipe_enable(struct usbhs_pipe *pipe);
 void usbhs_pipe_disable(struct usbhs_pipe *pipe);
 void usbhs_pipe_stall(struct usbhs_pipe *pipe);
 void usbhs_pipe_select_fifo(struct usbhs_pipe *pipe, struct usbhs_fifo *fifo);
-void usbhs_pipe_config_update(struct usbhs_pipe *pipe, u16 epnum, u16 maxp);
+void usbhs_pipe_config_update(struct usbhs_pipe *pipe, u16 devsel,
+			      u16 epnum, u16 maxp);
 
 #define usbhs_pipe_to_priv(p)	((p)->priv)
 #define usbhs_pipe_number(p)	(int)((p) - (p)->priv->pipe_info.pipe)
-- 
1.7.4.1

--
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