mirror of https://gitee.com/openkylin/linux.git
usb: gadget: aspeed: allow to set device IDs in device tree
The patch overrides idVendor, idProduct and bcdDevice fields in vhub Device Descriptor if according device tree properties are defined. Signed-off-by: Tao Ren <rentao.bupt@gmail.com> Signed-off-by: Felipe Balbi <balbi@kernel.org>
This commit is contained in:
parent
30d2617fd7
commit
2e596d8843
|
@ -887,6 +887,26 @@ void ast_vhub_hub_reset(struct ast_vhub *vhub)
|
||||||
writel(0, vhub->regs + AST_VHUB_EP1_STS_CHG);
|
writel(0, vhub->regs + AST_VHUB_EP1_STS_CHG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ast_vhub_of_parse_dev_desc(struct ast_vhub *vhub,
|
||||||
|
const struct device_node *vhub_np)
|
||||||
|
{
|
||||||
|
u16 id;
|
||||||
|
u32 data;
|
||||||
|
|
||||||
|
if (!of_property_read_u32(vhub_np, "vhub-vendor-id", &data)) {
|
||||||
|
id = (u16)data;
|
||||||
|
vhub->vhub_dev_desc.idVendor = cpu_to_le16(id);
|
||||||
|
}
|
||||||
|
if (!of_property_read_u32(vhub_np, "vhub-product-id", &data)) {
|
||||||
|
id = (u16)data;
|
||||||
|
vhub->vhub_dev_desc.idProduct = cpu_to_le16(id);
|
||||||
|
}
|
||||||
|
if (!of_property_read_u32(vhub_np, "vhub-device-revision", &data)) {
|
||||||
|
id = (u16)data;
|
||||||
|
vhub->vhub_dev_desc.bcdDevice = cpu_to_le16(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static struct usb_gadget_string_container*
|
static struct usb_gadget_string_container*
|
||||||
ast_vhub_str_container_alloc(struct ast_vhub *vhub)
|
ast_vhub_str_container_alloc(struct ast_vhub *vhub)
|
||||||
{
|
{
|
||||||
|
@ -1000,6 +1020,7 @@ static int ast_vhub_init_desc(struct ast_vhub *vhub)
|
||||||
/* Initialize vhub Device Descriptor. */
|
/* Initialize vhub Device Descriptor. */
|
||||||
memcpy(&vhub->vhub_dev_desc, &ast_vhub_dev_desc,
|
memcpy(&vhub->vhub_dev_desc, &ast_vhub_dev_desc,
|
||||||
sizeof(vhub->vhub_dev_desc));
|
sizeof(vhub->vhub_dev_desc));
|
||||||
|
ast_vhub_of_parse_dev_desc(vhub, vhub_np);
|
||||||
|
|
||||||
/* Initialize vhub Configuration Descriptor. */
|
/* Initialize vhub Configuration Descriptor. */
|
||||||
memcpy(&vhub->vhub_conf_desc, &ast_vhub_conf_desc,
|
memcpy(&vhub->vhub_conf_desc, &ast_vhub_conf_desc,
|
||||||
|
|
Loading…
Reference in New Issue