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, ...@@ -110,15 +110,26 @@ static int ast_vhub_dev_feature(struct ast_vhub_dev *d,
u16 wIndex, u16 wValue, u16 wIndex, u16 wValue,
bool is_set) bool is_set)
{ {
u32 val;
DDBG(d, "%s_FEATURE(dev val=%02x)\n", DDBG(d, "%s_FEATURE(dev val=%02x)\n",
is_set ? "SET" : "CLEAR", wValue); is_set ? "SET" : "CLEAR", wValue);
if (wValue != USB_DEVICE_REMOTE_WAKEUP) if (wValue == USB_DEVICE_REMOTE_WAKEUP) {
return std_req_driver; 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, 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, ...@@ -212,17 +212,28 @@ static int ast_vhub_hub_dev_feature(struct ast_vhub_ep *ep,
u16 wIndex, u16 wValue, u16 wIndex, u16 wValue,
bool is_set) bool is_set)
{ {
u32 val;
EPDBG(ep, "%s_FEATURE(dev val=%02x)\n", EPDBG(ep, "%s_FEATURE(dev val=%02x)\n",
is_set ? "SET" : "CLEAR", wValue); is_set ? "SET" : "CLEAR", wValue);
if (wValue != USB_DEVICE_REMOTE_WAKEUP) if (wValue == USB_DEVICE_REMOTE_WAKEUP) {
return std_req_stall; 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; if (wValue == USB_DEVICE_TEST_MODE) {
EPDBG(ep, "Hub remote wakeup %s\n", val = readl(ep->vhub->regs + AST_VHUB_CTRL);
is_set ? "enabled" : "disabled"); 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, 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