Commit aa9c2219 authored by Neal Liu's avatar Neal Liu Committed by Greg Kroah-Hartman

usb: aspeed-vhub: support test mode feature

Support aspeed usb vhub set feature to test mode.
Signed-off-by: default avatarNeal Liu <neal_liu@aspeedtech.com>
Acked-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Link: https://lore.kernel.org/r/20211208100545.1441397-5-neal_liu@aspeedtech.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d693bbd4
......@@ -110,15 +110,26 @@ static int ast_vhub_dev_feature(struct ast_vhub_dev *d,
u16 wIndex, u16 wValue,
bool is_set)
{
u32 val;
DDBG(d, "%s_FEATURE(dev val=%02x)\n",
is_set ? "SET" : "CLEAR", wValue);
if (wValue != USB_DEVICE_REMOTE_WAKEUP)
return std_req_driver;
if (wValue == USB_DEVICE_REMOTE_WAKEUP) {
d->wakeup_en = is_set;
return std_req_complete;
}
d->wakeup_en = is_set;
if (wValue == USB_DEVICE_TEST_MODE) {
val = readl(d->vhub->regs + AST_VHUB_CTRL);
val &= ~GENMASK(10, 8);
val |= VHUB_CTRL_SET_TEST_MODE((wIndex >> 8) & 0x7);
writel(val, d->vhub->regs + AST_VHUB_CTRL);
return std_req_complete;
return std_req_complete;
}
return std_req_driver;
}
static int ast_vhub_ep_feature(struct ast_vhub_dev *d,
......
......@@ -212,17 +212,28 @@ static int ast_vhub_hub_dev_feature(struct ast_vhub_ep *ep,
u16 wIndex, u16 wValue,
bool is_set)
{
u32 val;
EPDBG(ep, "%s_FEATURE(dev val=%02x)\n",
is_set ? "SET" : "CLEAR", wValue);
if (wValue != USB_DEVICE_REMOTE_WAKEUP)
return std_req_stall;
if (wValue == USB_DEVICE_REMOTE_WAKEUP) {
ep->vhub->wakeup_en = is_set;
EPDBG(ep, "Hub remote wakeup %s\n",
is_set ? "enabled" : "disabled");
return std_req_complete;
}
ep->vhub->wakeup_en = is_set;
EPDBG(ep, "Hub remote wakeup %s\n",
is_set ? "enabled" : "disabled");
if (wValue == USB_DEVICE_TEST_MODE) {
val = readl(ep->vhub->regs + AST_VHUB_CTRL);
val &= ~GENMASK(10, 8);
val |= VHUB_CTRL_SET_TEST_MODE((wIndex >> 8) & 0x7);
writel(val, ep->vhub->regs + AST_VHUB_CTRL);
return std_req_complete;
return std_req_complete;
}
return std_req_stall;
}
static int ast_vhub_hub_ep_feature(struct ast_vhub_ep *ep,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment