diff options
Diffstat (limited to 'drivers/usb/renesas_usbhs')
| -rw-r--r-- | drivers/usb/renesas_usbhs/common.c | 2 | ||||
| -rw-r--r-- | drivers/usb/renesas_usbhs/fifo.c | 4 | ||||
| -rw-r--r-- | drivers/usb/renesas_usbhs/mod.h | 8 | ||||
| -rw-r--r-- | drivers/usb/renesas_usbhs/mod_gadget.c | 4 | ||||
| -rw-r--r-- | drivers/usb/renesas_usbhs/mod_host.c | 63 | 
5 files changed, 48 insertions, 33 deletions
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index d2e2efaba65..08c679c0dde 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c @@ -405,7 +405,7 @@ int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev)  /*   *		platform functions   */ -static int __devinit usbhs_probe(struct platform_device *pdev) +static int usbhs_probe(struct platform_device *pdev)  {  	struct renesas_usbhs_platform_info *info = pdev->dev.platform_data;  	struct renesas_usbhs_driver_callback *dfunc; diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index 8da685e796d..ffdf5d15085 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c @@ -820,7 +820,7 @@ static int usbhsf_dma_prepare_push(struct usbhs_pkt *pkt, int *is_done)  	if (len % 4) /* 32bit alignment */  		goto usbhsf_pio_prepare_push; -	if ((*(u32 *) pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */ +	if ((uintptr_t)(pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */  		goto usbhsf_pio_prepare_push;  	/* get enable DMA fifo */ @@ -897,7 +897,7 @@ static int usbhsf_dma_try_pop(struct usbhs_pkt *pkt, int *is_done)  	if (!fifo)  		goto usbhsf_pio_prepare_pop; -	if ((*(u32 *) pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */ +	if ((uintptr_t)(pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */  		goto usbhsf_pio_prepare_pop;  	ret = usbhsf_fifo_select(pipe, fifo, 0); diff --git a/drivers/usb/renesas_usbhs/mod.h b/drivers/usb/renesas_usbhs/mod.h index 8ae3733031c..6c6875533f0 100644 --- a/drivers/usb/renesas_usbhs/mod.h +++ b/drivers/usb/renesas_usbhs/mod.h @@ -143,8 +143,8 @@ void usbhs_irq_callback_update(struct usbhs_priv *priv, struct usbhs_mod *mod);   */  #if	defined(CONFIG_USB_RENESAS_USBHS_HCD) || \  	defined(CONFIG_USB_RENESAS_USBHS_HCD_MODULE) -extern int __devinit usbhs_mod_host_probe(struct usbhs_priv *priv); -extern int __devexit usbhs_mod_host_remove(struct usbhs_priv *priv); +extern int usbhs_mod_host_probe(struct usbhs_priv *priv); +extern int usbhs_mod_host_remove(struct usbhs_priv *priv);  #else  static inline int usbhs_mod_host_probe(struct usbhs_priv *priv)  { @@ -157,8 +157,8 @@ static inline void usbhs_mod_host_remove(struct usbhs_priv *priv)  #if	defined(CONFIG_USB_RENESAS_USBHS_UDC) || \  	defined(CONFIG_USB_RENESAS_USBHS_UDC_MODULE) -extern int __devinit usbhs_mod_gadget_probe(struct usbhs_priv *priv); -extern void __devexit usbhs_mod_gadget_remove(struct usbhs_priv *priv); +extern int usbhs_mod_gadget_probe(struct usbhs_priv *priv); +extern void usbhs_mod_gadget_remove(struct usbhs_priv *priv);  #else  static inline int usbhs_mod_gadget_probe(struct usbhs_priv *priv)  { diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index 4cc7ee0babc..d9717e0bc1f 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -830,7 +830,7 @@ static int usbhsg_stop(struct usbhs_priv *priv)  	return usbhsg_try_stop(priv, USBHSG_STATUS_STARTED);  } -int __devinit usbhs_mod_gadget_probe(struct usbhs_priv *priv) +int usbhs_mod_gadget_probe(struct usbhs_priv *priv)  {  	struct usbhsg_gpriv *gpriv;  	struct usbhsg_uep *uep; @@ -927,7 +927,7 @@ usbhs_mod_gadget_probe_err_gpriv:  	return ret;  } -void __devexit usbhs_mod_gadget_remove(struct usbhs_priv *priv) +void usbhs_mod_gadget_remove(struct usbhs_priv *priv)  {  	struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv); diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c index 1a7208a50af..bade761a1e5 100644 --- a/drivers/usb/renesas_usbhs/mod_host.c +++ b/drivers/usb/renesas_usbhs/mod_host.c @@ -103,7 +103,7 @@ struct usbhsh_hpriv {  	u32	port_stat;	/* USB_PORT_STAT_xxx */ -	struct completion	*done; +	struct completion	setup_ack_done;  	/* see usbhsh_req_alloc/free */  	struct list_head	ureq_link_active; @@ -355,6 +355,7 @@ static void usbhsh_device_free(struct usbhsh_hpriv *hpriv,  struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv,  					struct usbhsh_device *udev,  					struct usb_host_endpoint *ep, +					int dir_in_req,  					gfp_t mem_flags)  {  	struct usbhs_priv *priv = usbhsh_hpriv_to_priv(hpriv); @@ -364,27 +365,38 @@ struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv,  	struct usbhs_pipe *pipe, *best_pipe;  	struct device *dev = usbhsh_hcd_to_dev(hcd);  	struct usb_endpoint_descriptor *desc = &ep->desc; -	int type, i; +	int type, i, dir_in;  	unsigned int min_usr; +	dir_in_req = !!dir_in_req; +  	uep = kzalloc(sizeof(struct usbhsh_ep), mem_flags);  	if (!uep) {  		dev_err(dev, "usbhsh_ep alloc fail\n");  		return NULL;  	} -	type = usb_endpoint_type(desc); + +	if (usb_endpoint_xfer_control(desc)) { +		best_pipe = usbhsh_hpriv_to_dcp(hpriv); +		goto usbhsh_endpoint_alloc_find_pipe; +	}  	/*  	 * find best pipe for endpoint  	 * see  	 *	HARDWARE LIMITATION  	 */ +	type = usb_endpoint_type(desc);  	min_usr = ~0;  	best_pipe = NULL; -	usbhs_for_each_pipe_with_dcp(pipe, priv, i) { +	usbhs_for_each_pipe(pipe, priv, i) {  		if (!usbhs_pipe_type_is(pipe, type))  			continue; +		dir_in = !!usbhs_pipe_is_dir_in(pipe); +		if (0 != (dir_in - dir_in_req)) +			continue; +  		info = usbhsh_pipe_info(pipe);  		if (min_usr > info->usr_cnt) { @@ -398,7 +410,7 @@ struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv,  		kfree(uep);  		return NULL;  	} - +usbhsh_endpoint_alloc_find_pipe:  	/*  	 * init uep  	 */ @@ -423,6 +435,7 @@ struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv,  	 * see  	 *  DCPMAXP/PIPEMAXP  	 */ +	usbhs_pipe_sequence_data0(uep->pipe);  	usbhs_pipe_config_update(uep->pipe,  				 usbhsh_device_number(hpriv, udev),  				 usb_endpoint_num(desc), @@ -430,7 +443,7 @@ struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv,  	dev_dbg(dev, "%s [%d-%s](%p)\n", __func__,  		usbhsh_device_number(hpriv, udev), -		usbhs_pipe_name(pipe), uep); +		usbhs_pipe_name(uep->pipe), uep);  	return uep;  } @@ -549,8 +562,7 @@ static void usbhsh_setup_stage_packet_push(struct usbhsh_hpriv *hpriv,  	 *	usbhsh_irq_setup_ack()  	 *	usbhsh_irq_setup_err()  	 */ -	DECLARE_COMPLETION(done); -	hpriv->done = &done; +	init_completion(&hpriv->setup_ack_done);  	/* copy original request */  	memcpy(&req, urb->setup_packet, sizeof(struct usb_ctrlrequest)); @@ -572,8 +584,7 @@ static void usbhsh_setup_stage_packet_push(struct usbhsh_hpriv *hpriv,  	/*  	 * wait setup packet ACK  	 */ -	wait_for_completion(&done); -	hpriv->done = NULL; +	wait_for_completion(&hpriv->setup_ack_done);  	dev_dbg(dev, "%s done\n", __func__);  } @@ -724,11 +735,11 @@ static int usbhsh_urb_enqueue(struct usb_hcd *hcd,  	struct usbhsh_device *udev, *new_udev = NULL;  	struct usbhs_pipe *pipe;  	struct usbhsh_ep *uep; +	int is_dir_in = usb_pipein(urb->pipe);  	int ret; -	dev_dbg(dev, "%s (%s)\n", -		__func__, usb_pipein(urb->pipe) ? "in" : "out"); +	dev_dbg(dev, "%s (%s)\n", __func__, is_dir_in ? "in" : "out");  	ret = usb_hcd_link_urb_to_ep(hcd, urb);  	if (ret) @@ -751,7 +762,8 @@ static int usbhsh_urb_enqueue(struct usb_hcd *hcd,  	 */  	uep = usbhsh_ep_to_uep(ep);  	if (!uep) { -		uep = usbhsh_endpoint_alloc(hpriv, udev, ep, mem_flags); +		uep = usbhsh_endpoint_alloc(hpriv, udev, ep, +					    is_dir_in, mem_flags);  		if (!uep)  			goto usbhsh_urb_enqueue_error_free_device;  	} @@ -1095,10 +1107,7 @@ static int usbhsh_irq_setup_ack(struct usbhs_priv *priv,  	dev_dbg(dev, "setup packet OK\n"); -	if (unlikely(!hpriv->done)) -		dev_err(dev, "setup ack happen without necessary data\n"); -	else -		complete(hpriv->done); /* see usbhsh_urb_enqueue() */ +	complete(&hpriv->setup_ack_done); /* see usbhsh_urb_enqueue() */  	return 0;  } @@ -1111,10 +1120,7 @@ static int usbhsh_irq_setup_err(struct usbhs_priv *priv,  	dev_dbg(dev, "setup packet Err\n"); -	if (unlikely(!hpriv->done)) -		dev_err(dev, "setup err happen without necessary data\n"); -	else -		complete(hpriv->done); /* see usbhsh_urb_enqueue() */ +	complete(&hpriv->setup_ack_done); /* see usbhsh_urb_enqueue() */  	return 0;  } @@ -1221,8 +1227,18 @@ static int usbhsh_stop(struct usbhs_priv *priv)  {  	struct usbhsh_hpriv *hpriv = usbhsh_priv_to_hpriv(priv);  	struct usb_hcd *hcd = usbhsh_hpriv_to_hcd(hpriv); +	struct usbhs_mod *mod = usbhs_mod_get_current(priv);  	struct device *dev = usbhs_priv_to_dev(priv); +	/* +	 * disable irq callback +	 */ +	mod->irq_attch	= NULL; +	mod->irq_dtch	= NULL; +	mod->irq_sack	= NULL; +	mod->irq_sign	= NULL; +	usbhs_irq_callback_update(priv, mod); +  	usb_remove_hcd(hcd);  	/* disable sys */ @@ -1235,7 +1251,7 @@ static int usbhsh_stop(struct usbhs_priv *priv)  	return 0;  } -int __devinit usbhs_mod_host_probe(struct usbhs_priv *priv) +int usbhs_mod_host_probe(struct usbhs_priv *priv)  {  	struct usbhsh_hpriv *hpriv;  	struct usb_hcd *hcd; @@ -1279,7 +1295,6 @@ int __devinit usbhs_mod_host_probe(struct usbhs_priv *priv)  	hpriv->mod.stop		= usbhsh_stop;  	hpriv->pipe_info	= pipe_info;  	hpriv->pipe_size	= pipe_size; -	hpriv->done		= NULL;  	usbhsh_req_list_init(hpriv);  	usbhsh_port_stat_init(hpriv); @@ -1299,7 +1314,7 @@ usbhs_mod_host_probe_err:  	return -ENOMEM;  } -int __devexit usbhs_mod_host_remove(struct usbhs_priv *priv) +int usbhs_mod_host_remove(struct usbhs_priv *priv)  {  	struct usbhsh_hpriv *hpriv = usbhsh_priv_to_hpriv(priv);  	struct usb_hcd *hcd = usbhsh_hpriv_to_hcd(hpriv);  |