diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2011-10-11 01:05:30 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2011-10-13 13:41:46 -0400 |
commit | 6e6db82ba9bf2d5912897f77ccf6902cb8543372 (patch) | |
tree | e59b3c6280bba0a33a3115bf71bd02f50166f61a | |
parent | 654c35ab5e643aa7ff34fbc11315f4a6e3a3e1f5 (diff) |
usb: gadget: renesas_usbhs: modify pipe sequence settings
renesas_usbhs can manually set DATA0/DATA1.
This patch is prepare for mod_host support
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/renesas_usbhs/common.h | 3 | ||||
-rw-r--r-- | drivers/usb/renesas_usbhs/mod_gadget.c | 4 | ||||
-rw-r--r-- | drivers/usb/renesas_usbhs/pipe.c | 9 | ||||
-rw-r--r-- | drivers/usb/renesas_usbhs/pipe.h | 5 |
4 files changed, 14 insertions, 7 deletions
diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h index 3b233809cdaa..7822b0b8aeed 100644 --- a/drivers/usb/renesas_usbhs/common.h +++ b/drivers/usb/renesas_usbhs/common.h | |||
@@ -187,8 +187,9 @@ struct usbhs_priv; | |||
187 | #define BSTS (1 << 15) /* Buffer Status */ | 187 | #define BSTS (1 << 15) /* Buffer Status */ |
188 | #define SUREQ (1 << 14) /* Sending SETUP Token */ | 188 | #define SUREQ (1 << 14) /* Sending SETUP Token */ |
189 | #define CSSTS (1 << 12) /* CSSTS Status */ | 189 | #define CSSTS (1 << 12) /* CSSTS Status */ |
190 | #define SQCLR (1 << 8) /* Toggle Bit Clear */ | ||
191 | #define ACLRM (1 << 9) /* Buffer Auto-Clear Mode */ | 190 | #define ACLRM (1 << 9) /* Buffer Auto-Clear Mode */ |
191 | #define SQCLR (1 << 8) /* Toggle Bit Clear */ | ||
192 | #define SQSET (1 << 7) /* Toggle Bit Set */ | ||
192 | #define PBUSY (1 << 5) /* Pipe Busy */ | 193 | #define PBUSY (1 << 5) /* Pipe Busy */ |
193 | #define PID_MASK (0x3) /* Response PID */ | 194 | #define PID_MASK (0x3) /* Response PID */ |
194 | #define PID_NAK 0 | 195 | #define PID_NAK 0 |
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index d3d833bce5f4..4cc7ee0babc6 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c | |||
@@ -265,7 +265,7 @@ static int usbhsg_recip_handler_std_clear_endpoint(struct usbhs_priv *priv, | |||
265 | 265 | ||
266 | if (!usbhsg_status_has(gpriv, USBHSG_STATUS_WEDGE)) { | 266 | if (!usbhsg_status_has(gpriv, USBHSG_STATUS_WEDGE)) { |
267 | usbhs_pipe_disable(pipe); | 267 | usbhs_pipe_disable(pipe); |
268 | usbhs_pipe_clear_sequence(pipe); | 268 | usbhs_pipe_sequence_data0(pipe); |
269 | usbhs_pipe_enable(pipe); | 269 | usbhs_pipe_enable(pipe); |
270 | } | 270 | } |
271 | 271 | ||
@@ -479,7 +479,7 @@ static int usbhsg_ep_enable(struct usb_ep *ep, | |||
479 | */ | 479 | */ |
480 | if (uep->pipe) { | 480 | if (uep->pipe) { |
481 | usbhs_pipe_clear(uep->pipe); | 481 | usbhs_pipe_clear(uep->pipe); |
482 | usbhs_pipe_clear_sequence(uep->pipe); | 482 | usbhs_pipe_sequence_data0(uep->pipe); |
483 | return 0; | 483 | return 0; |
484 | } | 484 | } |
485 | 485 | ||
diff --git a/drivers/usb/renesas_usbhs/pipe.c b/drivers/usb/renesas_usbhs/pipe.c index 6bc9e3327064..1acbe29437cb 100644 --- a/drivers/usb/renesas_usbhs/pipe.c +++ b/drivers/usb/renesas_usbhs/pipe.c | |||
@@ -471,9 +471,12 @@ int usbhs_pipe_is_dir_host(struct usbhs_pipe *pipe) | |||
471 | return usbhsp_flags_has(pipe, IS_DIR_HOST); | 471 | return usbhsp_flags_has(pipe, IS_DIR_HOST); |
472 | } | 472 | } |
473 | 473 | ||
474 | void usbhs_pipe_clear_sequence(struct usbhs_pipe *pipe) | 474 | void usbhs_pipe_data_sequence(struct usbhs_pipe *pipe, int data) |
475 | { | 475 | { |
476 | usbhsp_pipectrl_set(pipe, SQCLR, SQCLR); | 476 | u16 mask = (SQCLR | SQSET); |
477 | u16 val = (data) ? SQSET : SQCLR; | ||
478 | |||
479 | usbhsp_pipectrl_set(pipe, mask, val); | ||
477 | } | 480 | } |
478 | 481 | ||
479 | void usbhs_pipe_clear(struct usbhs_pipe *pipe) | 482 | void usbhs_pipe_clear(struct usbhs_pipe *pipe) |
@@ -584,7 +587,7 @@ struct usbhs_pipe *usbhs_pipe_malloc(struct usbhs_priv *priv, | |||
584 | usbhsp_pipe_cfg_set(pipe, 0xFFFF, pipecfg); | 587 | usbhsp_pipe_cfg_set(pipe, 0xFFFF, pipecfg); |
585 | usbhsp_pipe_buf_set(pipe, 0xFFFF, pipebuf); | 588 | usbhsp_pipe_buf_set(pipe, 0xFFFF, pipebuf); |
586 | 589 | ||
587 | usbhs_pipe_clear_sequence(pipe); | 590 | usbhs_pipe_sequence_data0(pipe); |
588 | 591 | ||
589 | dev_dbg(dev, "enable pipe %d : %s (%s)\n", | 592 | dev_dbg(dev, "enable pipe %d : %s (%s)\n", |
590 | usbhs_pipe_number(pipe), | 593 | usbhs_pipe_number(pipe), |
diff --git a/drivers/usb/renesas_usbhs/pipe.h b/drivers/usb/renesas_usbhs/pipe.h index ddbd3193c1fb..6334fc644cc0 100644 --- a/drivers/usb/renesas_usbhs/pipe.h +++ b/drivers/usb/renesas_usbhs/pipe.h | |||
@@ -82,7 +82,6 @@ int usbhs_pipe_is_dir_host(struct usbhs_pipe *pipe); | |||
82 | void usbhs_pipe_init(struct usbhs_priv *priv, | 82 | void usbhs_pipe_init(struct usbhs_priv *priv, |
83 | int (*dma_map_ctrl)(struct usbhs_pkt *pkt, int map)); | 83 | int (*dma_map_ctrl)(struct usbhs_pkt *pkt, int map)); |
84 | int usbhs_pipe_get_maxpacket(struct usbhs_pipe *pipe); | 84 | int usbhs_pipe_get_maxpacket(struct usbhs_pipe *pipe); |
85 | void usbhs_pipe_clear_sequence(struct usbhs_pipe *pipe); | ||
86 | void usbhs_pipe_clear(struct usbhs_pipe *pipe); | 85 | void usbhs_pipe_clear(struct usbhs_pipe *pipe); |
87 | int usbhs_pipe_is_accessible(struct usbhs_pipe *pipe); | 86 | int usbhs_pipe_is_accessible(struct usbhs_pipe *pipe); |
88 | void usbhs_pipe_enable(struct usbhs_pipe *pipe); | 87 | void usbhs_pipe_enable(struct usbhs_pipe *pipe); |
@@ -92,6 +91,10 @@ void usbhs_pipe_select_fifo(struct usbhs_pipe *pipe, struct usbhs_fifo *fifo); | |||
92 | void usbhs_pipe_config_update(struct usbhs_pipe *pipe, u16 devsel, | 91 | void usbhs_pipe_config_update(struct usbhs_pipe *pipe, u16 devsel, |
93 | u16 epnum, u16 maxp); | 92 | u16 epnum, u16 maxp); |
94 | 93 | ||
94 | #define usbhs_pipe_sequence_data0(pipe) usbhs_pipe_data_sequence(pipe, 0) | ||
95 | #define usbhs_pipe_sequence_data1(pipe) usbhs_pipe_data_sequence(pipe, 1) | ||
96 | void usbhs_pipe_data_sequence(struct usbhs_pipe *pipe, int data); | ||
97 | |||
95 | #define usbhs_pipe_to_priv(p) ((p)->priv) | 98 | #define usbhs_pipe_to_priv(p) ((p)->priv) |
96 | #define usbhs_pipe_number(p) (int)((p) - (p)->priv->pipe_info.pipe) | 99 | #define usbhs_pipe_number(p) (int)((p) - (p)->priv->pipe_info.pipe) |
97 | #define usbhs_pipe_is_dcp(p) ((p)->priv->pipe_info.pipe == (p)) | 100 | #define usbhs_pipe_is_dcp(p) ((p)->priv->pipe_info.pipe == (p)) |