Merge branch 'for-next/gadget' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
* 'for-next/gadget' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb: (50 commits) usb: renesas_usbhs: show error reason on usbhsh_urb_enqueu() usb: renesas_usbhs: add force packet remove method usb: renesas_usbhs: care usb_hcd_giveback_urb() status usb: renesas_usbhs: add usbhsh_is_running() usb: renesas_usbhs: disable attch irq after device attached usb: renesas_usbhs: care pipe sequence usb: renesas_usbhs: add usbhs_pipe_attach() method usb: renesas_usbhs: add usbhsh_endpoint_detach_all() for error case usb: renesas_usbhs: modify device attach method usb: renesas_usbhs: pop packet when urb dequeued usb: renesas_usbhs: add lost error value when enqueue usb: gadget: mv_udc: replace some debug info usb: gadget: mv_udc: refine suspend/resume function usb: gadget: mv_udc: refine the clock relative code usb: gadget: mv_udc: disable ISR when stopped usb: gadget: mv_udc: add otg relative code usb: gadget: Use kcalloc instead of kzalloc to allocate array usb: renesas_usbhs: remove the_controller_link usb: renesas_usbhs: add test-mode support usb: renesas_usbhs: call usbhsg_queue_pop() when pipe disable. ...
This commit is contained in:
@@ -95,25 +95,15 @@ struct usbhs_priv *usbhs_pdev_to_priv(struct platform_device *pdev)
|
||||
/*
|
||||
* syscfg functions
|
||||
*/
|
||||
void usbhs_sys_clock_ctrl(struct usbhs_priv *priv, int enable)
|
||||
static void usbhs_sys_clock_ctrl(struct usbhs_priv *priv, int enable)
|
||||
{
|
||||
usbhs_bset(priv, SYSCFG, SCKE, enable ? SCKE : 0);
|
||||
}
|
||||
|
||||
void usbhs_sys_hispeed_ctrl(struct usbhs_priv *priv, int enable)
|
||||
{
|
||||
usbhs_bset(priv, SYSCFG, HSE, enable ? HSE : 0);
|
||||
}
|
||||
|
||||
void usbhs_sys_usb_ctrl(struct usbhs_priv *priv, int enable)
|
||||
{
|
||||
usbhs_bset(priv, SYSCFG, USBE, enable ? USBE : 0);
|
||||
}
|
||||
|
||||
void usbhs_sys_host_ctrl(struct usbhs_priv *priv, int enable)
|
||||
{
|
||||
u16 mask = DCFM | DRPD | DPRPU;
|
||||
u16 val = DCFM | DRPD;
|
||||
u16 mask = DCFM | DRPD | DPRPU | HSE | USBE;
|
||||
u16 val = DCFM | DRPD | HSE | USBE;
|
||||
int has_otg = usbhs_get_dparam(priv, has_otg);
|
||||
|
||||
if (has_otg)
|
||||
@@ -130,8 +120,8 @@ void usbhs_sys_host_ctrl(struct usbhs_priv *priv, int enable)
|
||||
|
||||
void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable)
|
||||
{
|
||||
u16 mask = DCFM | DRPD | DPRPU;
|
||||
u16 val = DPRPU;
|
||||
u16 mask = DCFM | DRPD | DPRPU | HSE | USBE;
|
||||
u16 val = DPRPU | HSE | USBE;
|
||||
|
||||
/*
|
||||
* if enable
|
||||
@@ -142,6 +132,11 @@ void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable)
|
||||
usbhs_bset(priv, SYSCFG, mask, enable ? val : 0);
|
||||
}
|
||||
|
||||
void usbhs_sys_set_test_mode(struct usbhs_priv *priv, u16 mode)
|
||||
{
|
||||
usbhs_write(priv, TESTMODE, mode);
|
||||
}
|
||||
|
||||
/*
|
||||
* frame functions
|
||||
*/
|
||||
@@ -229,7 +224,7 @@ static void usbhsc_bus_init(struct usbhs_priv *priv)
|
||||
/*
|
||||
* device configuration
|
||||
*/
|
||||
int usbhs_set_device_speed(struct usbhs_priv *priv, int devnum,
|
||||
int usbhs_set_device_config(struct usbhs_priv *priv, int devnum,
|
||||
u16 upphub, u16 hubport, u16 speed)
|
||||
{
|
||||
struct device *dev = usbhs_priv_to_dev(priv);
|
||||
@@ -301,18 +296,25 @@ static u32 usbhsc_default_pipe_type[] = {
|
||||
*/
|
||||
static void usbhsc_power_ctrl(struct usbhs_priv *priv, int enable)
|
||||
{
|
||||
struct platform_device *pdev = usbhs_priv_to_pdev(priv);
|
||||
struct device *dev = usbhs_priv_to_dev(priv);
|
||||
|
||||
if (enable) {
|
||||
/* enable PM */
|
||||
pm_runtime_get_sync(dev);
|
||||
|
||||
/* enable platform power */
|
||||
usbhs_platform_call(priv, power_ctrl, pdev, priv->base, enable);
|
||||
|
||||
/* USB on */
|
||||
usbhs_sys_clock_ctrl(priv, enable);
|
||||
} else {
|
||||
/* USB off */
|
||||
usbhs_sys_clock_ctrl(priv, enable);
|
||||
|
||||
/* disable platform power */
|
||||
usbhs_platform_call(priv, power_ctrl, pdev, priv->base, enable);
|
||||
|
||||
/* disable PM */
|
||||
pm_runtime_put_sync(dev);
|
||||
}
|
||||
@@ -388,7 +390,7 @@ static void usbhsc_notify_hotplug(struct work_struct *work)
|
||||
usbhsc_hotplug(priv);
|
||||
}
|
||||
|
||||
int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev)
|
||||
static int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev)
|
||||
{
|
||||
struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev);
|
||||
int delay = usbhs_get_dparam(priv, detection_delay);
|
||||
@@ -398,7 +400,8 @@ int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev)
|
||||
* To make sure safety context,
|
||||
* use workqueue for usbhs_notify_hotplug
|
||||
*/
|
||||
schedule_delayed_work(&priv->notify_hotplug_work, delay);
|
||||
schedule_delayed_work(&priv->notify_hotplug_work,
|
||||
msecs_to_jiffies(delay));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -33,6 +33,7 @@ struct usbhs_priv;
|
||||
#define SYSCFG 0x0000
|
||||
#define BUSWAIT 0x0002
|
||||
#define DVSTCTR 0x0008
|
||||
#define TESTMODE 0x000C
|
||||
#define CFIFO 0x0014
|
||||
#define CFIFOSEL 0x0020
|
||||
#define CFIFOCTR 0x0022
|
||||
@@ -275,19 +276,15 @@ u16 usbhs_read(struct usbhs_priv *priv, u32 reg);
|
||||
void usbhs_write(struct usbhs_priv *priv, u32 reg, u16 data);
|
||||
void usbhs_bset(struct usbhs_priv *priv, u32 reg, u16 mask, u16 data);
|
||||
|
||||
int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev);
|
||||
|
||||
#define usbhs_lock(p, f) spin_lock_irqsave(usbhs_priv_to_lock(p), f)
|
||||
#define usbhs_unlock(p, f) spin_unlock_irqrestore(usbhs_priv_to_lock(p), f)
|
||||
|
||||
/*
|
||||
* sysconfig
|
||||
*/
|
||||
void usbhs_sys_clock_ctrl(struct usbhs_priv *priv, int enable);
|
||||
void usbhs_sys_hispeed_ctrl(struct usbhs_priv *priv, int enable);
|
||||
void usbhs_sys_usb_ctrl(struct usbhs_priv *priv, int enable);
|
||||
void usbhs_sys_host_ctrl(struct usbhs_priv *priv, int enable);
|
||||
void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable);
|
||||
void usbhs_sys_set_test_mode(struct usbhs_priv *priv, u16 mode);
|
||||
|
||||
/*
|
||||
* usb request
|
||||
@@ -311,7 +308,7 @@ int usbhs_frame_get_num(struct usbhs_priv *priv);
|
||||
/*
|
||||
* device config
|
||||
*/
|
||||
int usbhs_set_device_speed(struct usbhs_priv *priv, int devnum, u16 upphub,
|
||||
int usbhs_set_device_config(struct usbhs_priv *priv, int devnum, u16 upphub,
|
||||
u16 hubport, u16 speed);
|
||||
|
||||
/*
|
||||
|
@@ -56,7 +56,7 @@ static struct usbhs_pkt_handle usbhsf_null_handler = {
|
||||
void usbhs_pkt_push(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt,
|
||||
void (*done)(struct usbhs_priv *priv,
|
||||
struct usbhs_pkt *pkt),
|
||||
void *buf, int len, int zero)
|
||||
void *buf, int len, int zero, int sequence)
|
||||
{
|
||||
struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
|
||||
struct device *dev = usbhs_priv_to_dev(priv);
|
||||
@@ -90,6 +90,7 @@ void usbhs_pkt_push(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt,
|
||||
pkt->zero = zero;
|
||||
pkt->actual = 0;
|
||||
pkt->done = done;
|
||||
pkt->sequence = sequence;
|
||||
|
||||
usbhs_unlock(priv, flags);
|
||||
/******************** spin unlock ******************/
|
||||
@@ -481,6 +482,9 @@ static int usbhsf_pio_try_push(struct usbhs_pkt *pkt, int *is_done)
|
||||
int i, ret, len;
|
||||
int is_short;
|
||||
|
||||
usbhs_pipe_data_sequence(pipe, pkt->sequence);
|
||||
pkt->sequence = -1; /* -1 sequence will be ignored */
|
||||
|
||||
ret = usbhsf_fifo_select(pipe, fifo, 1);
|
||||
if (ret < 0)
|
||||
return 0;
|
||||
@@ -584,6 +588,8 @@ static int usbhsf_prepare_pop(struct usbhs_pkt *pkt, int *is_done)
|
||||
/*
|
||||
* pipe enable to prepare packet receive
|
||||
*/
|
||||
usbhs_pipe_data_sequence(pipe, pkt->sequence);
|
||||
pkt->sequence = -1; /* -1 sequence will be ignored */
|
||||
|
||||
usbhs_pipe_enable(pipe);
|
||||
usbhsf_rx_irq_ctrl(pipe, 1);
|
||||
@@ -641,6 +647,7 @@ static int usbhsf_pio_try_pop(struct usbhs_pkt *pkt, int *is_done)
|
||||
* "Operation" - "FIFO Buffer Memory" - "FIFO Port Function"
|
||||
*/
|
||||
if (0 == rcv_len) {
|
||||
pkt->zero = 1;
|
||||
usbhsf_fifo_clear(pipe, fifo);
|
||||
goto usbhs_fifo_read_end;
|
||||
}
|
||||
|
@@ -59,6 +59,7 @@ struct usbhs_pkt {
|
||||
int trans;
|
||||
int actual;
|
||||
int zero;
|
||||
int sequence;
|
||||
};
|
||||
|
||||
struct usbhs_pkt_handle {
|
||||
@@ -95,7 +96,7 @@ void usbhs_pkt_init(struct usbhs_pkt *pkt);
|
||||
void usbhs_pkt_push(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt,
|
||||
void (*done)(struct usbhs_priv *priv,
|
||||
struct usbhs_pkt *pkt),
|
||||
void *buf, int len, int zero);
|
||||
void *buf, int len, int zero, int sequence);
|
||||
struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt);
|
||||
void usbhs_pkt_start(struct usbhs_pipe *pipe);
|
||||
|
||||
|
@@ -50,7 +50,9 @@ static int usbhsm_autonomy_irq_vbus(struct usbhs_priv *priv,
|
||||
{
|
||||
struct platform_device *pdev = usbhs_priv_to_pdev(priv);
|
||||
|
||||
return usbhsc_drvcllbck_notify_hotplug(pdev);
|
||||
renesas_usbhs_call_notify_hotplug(pdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void usbhs_mod_autonomy_mode(struct usbhs_priv *priv)
|
||||
|
@@ -14,6 +14,7 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#include <linux/delay.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/module.h>
|
||||
@@ -44,7 +45,6 @@ struct usbhsg_uep {
|
||||
struct usbhsg_gpriv {
|
||||
struct usb_gadget gadget;
|
||||
struct usbhs_mod mod;
|
||||
struct list_head link;
|
||||
|
||||
struct usbhsg_uep *uep;
|
||||
int uep_size;
|
||||
@@ -114,16 +114,6 @@ struct usbhsg_recip_handle {
|
||||
#define usbhsg_status_clr(gp, b) (gp->status &= ~b)
|
||||
#define usbhsg_status_has(gp, b) (gp->status & b)
|
||||
|
||||
/* controller */
|
||||
LIST_HEAD(the_controller_link);
|
||||
|
||||
#define usbhsg_for_each_controller(gpriv)\
|
||||
list_for_each_entry(gpriv, &the_controller_link, link)
|
||||
#define usbhsg_controller_register(gpriv)\
|
||||
list_add_tail(&(gpriv)->link, &the_controller_link)
|
||||
#define usbhsg_controller_unregister(gpriv)\
|
||||
list_del_init(&(gpriv)->link)
|
||||
|
||||
/*
|
||||
* queue push/pop
|
||||
*/
|
||||
@@ -164,7 +154,7 @@ static void usbhsg_queue_push(struct usbhsg_uep *uep,
|
||||
req->actual = 0;
|
||||
req->status = -EINPROGRESS;
|
||||
usbhs_pkt_push(pipe, pkt, usbhsg_queue_done,
|
||||
req->buf, req->length, req->zero);
|
||||
req->buf, req->length, req->zero, -1);
|
||||
usbhs_pkt_start(pipe);
|
||||
|
||||
dev_dbg(dev, "pipe %d : queue push (%d)\n",
|
||||
@@ -271,6 +261,8 @@ static int usbhsg_recip_handler_std_clear_endpoint(struct usbhs_priv *priv,
|
||||
|
||||
usbhsg_recip_handler_std_control_done(priv, uep, ctrl);
|
||||
|
||||
usbhs_pkt_start(pipe);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -281,6 +273,145 @@ struct usbhsg_recip_handle req_clear_feature = {
|
||||
.endpoint = usbhsg_recip_handler_std_clear_endpoint,
|
||||
};
|
||||
|
||||
/*
|
||||
* USB_TYPE_STANDARD / set feature functions
|
||||
*/
|
||||
static int usbhsg_recip_handler_std_set_device(struct usbhs_priv *priv,
|
||||
struct usbhsg_uep *uep,
|
||||
struct usb_ctrlrequest *ctrl)
|
||||
{
|
||||
switch (le16_to_cpu(ctrl->wValue)) {
|
||||
case USB_DEVICE_TEST_MODE:
|
||||
usbhsg_recip_handler_std_control_done(priv, uep, ctrl);
|
||||
udelay(100);
|
||||
usbhs_sys_set_test_mode(priv, le16_to_cpu(ctrl->wIndex >> 8));
|
||||
break;
|
||||
default:
|
||||
usbhsg_recip_handler_std_control_done(priv, uep, ctrl);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int usbhsg_recip_handler_std_set_endpoint(struct usbhs_priv *priv,
|
||||
struct usbhsg_uep *uep,
|
||||
struct usb_ctrlrequest *ctrl)
|
||||
{
|
||||
struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep);
|
||||
|
||||
usbhs_pipe_stall(pipe);
|
||||
|
||||
usbhsg_recip_handler_std_control_done(priv, uep, ctrl);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct usbhsg_recip_handle req_set_feature = {
|
||||
.name = "set feature",
|
||||
.device = usbhsg_recip_handler_std_set_device,
|
||||
.interface = usbhsg_recip_handler_std_control_done,
|
||||
.endpoint = usbhsg_recip_handler_std_set_endpoint,
|
||||
};
|
||||
|
||||
/*
|
||||
* USB_TYPE_STANDARD / get status functions
|
||||
*/
|
||||
static void __usbhsg_recip_send_complete(struct usb_ep *ep,
|
||||
struct usb_request *req)
|
||||
{
|
||||
struct usbhsg_request *ureq = usbhsg_req_to_ureq(req);
|
||||
|
||||
/* free allocated recip-buffer/usb_request */
|
||||
kfree(ureq->pkt.buf);
|
||||
usb_ep_free_request(ep, req);
|
||||
}
|
||||
|
||||
static void __usbhsg_recip_send_status(struct usbhsg_gpriv *gpriv,
|
||||
unsigned short status)
|
||||
{
|
||||
struct usbhsg_uep *dcp = usbhsg_gpriv_to_dcp(gpriv);
|
||||
struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(dcp);
|
||||
struct device *dev = usbhsg_gpriv_to_dev(gpriv);
|
||||
struct usb_request *req;
|
||||
unsigned short *buf;
|
||||
|
||||
/* alloc new usb_request for recip */
|
||||
req = usb_ep_alloc_request(&dcp->ep, GFP_ATOMIC);
|
||||
if (!req) {
|
||||
dev_err(dev, "recip request allocation fail\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* alloc recip data buffer */
|
||||
buf = kmalloc(sizeof(*buf), GFP_ATOMIC);
|
||||
if (!buf) {
|
||||
usb_ep_free_request(&dcp->ep, req);
|
||||
dev_err(dev, "recip data allocation fail\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* recip data is status */
|
||||
*buf = cpu_to_le16(status);
|
||||
|
||||
/* allocated usb_request/buffer will be freed */
|
||||
req->complete = __usbhsg_recip_send_complete;
|
||||
req->buf = buf;
|
||||
req->length = sizeof(*buf);
|
||||
req->zero = 0;
|
||||
|
||||
/* push packet */
|
||||
pipe->handler = &usbhs_fifo_pio_push_handler;
|
||||
usbhsg_queue_push(dcp, usbhsg_req_to_ureq(req));
|
||||
}
|
||||
|
||||
static int usbhsg_recip_handler_std_get_device(struct usbhs_priv *priv,
|
||||
struct usbhsg_uep *uep,
|
||||
struct usb_ctrlrequest *ctrl)
|
||||
{
|
||||
struct usbhsg_gpriv *gpriv = usbhsg_uep_to_gpriv(uep);
|
||||
unsigned short status = 1 << USB_DEVICE_SELF_POWERED;
|
||||
|
||||
__usbhsg_recip_send_status(gpriv, status);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int usbhsg_recip_handler_std_get_interface(struct usbhs_priv *priv,
|
||||
struct usbhsg_uep *uep,
|
||||
struct usb_ctrlrequest *ctrl)
|
||||
{
|
||||
struct usbhsg_gpriv *gpriv = usbhsg_uep_to_gpriv(uep);
|
||||
unsigned short status = 0;
|
||||
|
||||
__usbhsg_recip_send_status(gpriv, status);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int usbhsg_recip_handler_std_get_endpoint(struct usbhs_priv *priv,
|
||||
struct usbhsg_uep *uep,
|
||||
struct usb_ctrlrequest *ctrl)
|
||||
{
|
||||
struct usbhsg_gpriv *gpriv = usbhsg_uep_to_gpriv(uep);
|
||||
struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep);
|
||||
unsigned short status = 0;
|
||||
|
||||
if (usbhs_pipe_is_stall(pipe))
|
||||
status = 1 << USB_ENDPOINT_HALT;
|
||||
|
||||
__usbhsg_recip_send_status(gpriv, status);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct usbhsg_recip_handle req_get_status = {
|
||||
.name = "get status",
|
||||
.device = usbhsg_recip_handler_std_get_device,
|
||||
.interface = usbhsg_recip_handler_std_get_interface,
|
||||
.endpoint = usbhsg_recip_handler_std_get_endpoint,
|
||||
};
|
||||
|
||||
/*
|
||||
* USB_TYPE handler
|
||||
*/
|
||||
@@ -303,8 +434,7 @@ static int usbhsg_recip_run_handle(struct usbhs_priv *priv,
|
||||
pipe = usbhsg_uep_to_pipe(uep);
|
||||
if (!pipe) {
|
||||
dev_err(dev, "wrong recip request\n");
|
||||
ret = -EINVAL;
|
||||
goto usbhsg_recip_run_handle_end;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
switch (recip) {
|
||||
@@ -327,20 +457,10 @@ static int usbhsg_recip_run_handle(struct usbhs_priv *priv,
|
||||
}
|
||||
|
||||
if (func) {
|
||||
unsigned long flags;
|
||||
|
||||
dev_dbg(dev, "%s (pipe %d :%s)\n", handler->name, nth, msg);
|
||||
|
||||
/******************** spin lock ********************/
|
||||
usbhs_lock(priv, flags);
|
||||
ret = func(priv, uep, ctrl);
|
||||
usbhs_unlock(priv, flags);
|
||||
/******************** spin unlock ******************/
|
||||
}
|
||||
|
||||
usbhsg_recip_run_handle_end:
|
||||
usbhs_pkt_start(pipe);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -412,6 +532,12 @@ static int usbhsg_irq_ctrl_stage(struct usbhs_priv *priv,
|
||||
case USB_REQ_CLEAR_FEATURE:
|
||||
recip_handler = &req_clear_feature;
|
||||
break;
|
||||
case USB_REQ_SET_FEATURE:
|
||||
recip_handler = &req_set_feature;
|
||||
break;
|
||||
case USB_REQ_GET_STATUS:
|
||||
recip_handler = &req_get_status;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,14 +565,16 @@ static int usbhsg_pipe_disable(struct usbhsg_uep *uep)
|
||||
struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep);
|
||||
struct usbhs_pkt *pkt;
|
||||
|
||||
usbhs_pipe_disable(pipe);
|
||||
|
||||
while (1) {
|
||||
pkt = usbhs_pkt_pop(pipe, NULL);
|
||||
if (!pkt)
|
||||
break;
|
||||
|
||||
usbhsg_queue_pop(uep, usbhsg_pkt_to_ureq(pkt), -ECONNRESET);
|
||||
}
|
||||
|
||||
usbhs_pipe_disable(pipe);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -681,9 +809,7 @@ static int usbhsg_try_start(struct usbhs_priv *priv, u32 status)
|
||||
* - function
|
||||
* - usb module
|
||||
*/
|
||||
usbhs_sys_hispeed_ctrl(priv, 1);
|
||||
usbhs_sys_function_ctrl(priv, 1);
|
||||
usbhs_sys_usb_ctrl(priv, 1);
|
||||
|
||||
/*
|
||||
* enable irq callback
|
||||
@@ -731,9 +857,8 @@ static int usbhsg_try_stop(struct usbhs_priv *priv, u32 status)
|
||||
gpriv->gadget.speed = USB_SPEED_UNKNOWN;
|
||||
|
||||
/* disable sys */
|
||||
usbhs_sys_hispeed_ctrl(priv, 0);
|
||||
usbhs_sys_set_test_mode(priv, 0);
|
||||
usbhs_sys_function_ctrl(priv, 0);
|
||||
usbhs_sys_usb_ctrl(priv, 0);
|
||||
|
||||
usbhsg_pipe_disable(dcp);
|
||||
|
||||
@@ -755,7 +880,7 @@ static int usbhsg_gadget_start(struct usb_gadget *gadget,
|
||||
|
||||
if (!driver ||
|
||||
!driver->setup ||
|
||||
driver->speed < USB_SPEED_FULL)
|
||||
driver->max_speed < USB_SPEED_FULL)
|
||||
return -EINVAL;
|
||||
|
||||
/* first hook up the driver ... */
|
||||
@@ -866,7 +991,7 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
|
||||
gpriv->gadget.dev.parent = dev;
|
||||
gpriv->gadget.name = "renesas_usbhs_udc";
|
||||
gpriv->gadget.ops = &usbhsg_gadget_ops;
|
||||
gpriv->gadget.is_dualspeed = 1;
|
||||
gpriv->gadget.max_speed = USB_SPEED_HIGH;
|
||||
ret = device_register(&gpriv->gadget.dev);
|
||||
if (ret < 0)
|
||||
goto err_add_udc;
|
||||
@@ -896,8 +1021,6 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
|
||||
}
|
||||
}
|
||||
|
||||
usbhsg_controller_register(gpriv);
|
||||
|
||||
ret = usb_add_gadget_udc(dev, &gpriv->gadget);
|
||||
if (ret)
|
||||
goto err_register;
|
||||
@@ -926,8 +1049,6 @@ void usbhs_mod_gadget_remove(struct usbhs_priv *priv)
|
||||
|
||||
device_unregister(&gpriv->gadget.dev);
|
||||
|
||||
usbhsg_controller_unregister(gpriv);
|
||||
|
||||
kfree(gpriv->uep);
|
||||
kfree(gpriv);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -257,6 +257,13 @@ void usbhs_pipe_stall(struct usbhs_pipe *pipe)
|
||||
}
|
||||
}
|
||||
|
||||
int usbhs_pipe_is_stall(struct usbhs_pipe *pipe)
|
||||
{
|
||||
u16 pid = usbhsp_pipectrl_get(pipe) & PID_MASK;
|
||||
|
||||
return (int)(pid == PID_STALL10 || pid == PID_STALL11);
|
||||
}
|
||||
|
||||
/*
|
||||
* pipe setup
|
||||
*/
|
||||
@@ -471,10 +478,27 @@ int usbhs_pipe_is_dir_host(struct usbhs_pipe *pipe)
|
||||
return usbhsp_flags_has(pipe, IS_DIR_HOST);
|
||||
}
|
||||
|
||||
void usbhs_pipe_data_sequence(struct usbhs_pipe *pipe, int data)
|
||||
void usbhs_pipe_data_sequence(struct usbhs_pipe *pipe, int sequence)
|
||||
{
|
||||
u16 mask = (SQCLR | SQSET);
|
||||
u16 val = (data) ? SQSET : SQCLR;
|
||||
u16 val;
|
||||
|
||||
/*
|
||||
* sequence
|
||||
* 0 : data0
|
||||
* 1 : data1
|
||||
* -1 : no change
|
||||
*/
|
||||
switch (sequence) {
|
||||
case 0:
|
||||
val = SQCLR;
|
||||
break;
|
||||
case 1:
|
||||
val = SQSET;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
usbhsp_pipectrl_set(pipe, mask, val);
|
||||
}
|
||||
|
@@ -87,6 +87,7 @@ int usbhs_pipe_is_accessible(struct usbhs_pipe *pipe);
|
||||
void usbhs_pipe_enable(struct usbhs_pipe *pipe);
|
||||
void usbhs_pipe_disable(struct usbhs_pipe *pipe);
|
||||
void usbhs_pipe_stall(struct usbhs_pipe *pipe);
|
||||
int usbhs_pipe_is_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 devsel,
|
||||
u16 epnum, u16 maxp);
|
||||
|
Reference in New Issue
Block a user