On Mon, Oct 29, 2012 at 04:28:39PM +0800, Lan Tianyu wrote: > This patch is to set xhci root hub's DeviceRemovable according to usb port's > connect type which currently comes from ACPI information. If ACPI information > was different with PORTSC, there would be a warning. You should also add the note here that you're trusting the ACPI tables over the xHCI DeviceRemovable port status register bits when you decide whether to mark a port as hard-wired. Tianyu is doing it this way because Windows is likely to rely on the ACPI tables over the DeviceRemovable bits. Other than that, this looks fine. Sarah Sharp > > Signed-off-by: Lan Tianyu <tianyu.lan@xxxxxxxxx> > --- > drivers/usb/host/xhci-hub.c | 19 +++++++++++++++++-- > 1 file changed, 17 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c > index aa90ad4..0c25a73 100644 > --- a/drivers/usb/host/xhci-hub.c > +++ b/drivers/usb/host/xhci-hub.c > @@ -97,11 +97,18 @@ static void xhci_usb2_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, > /* If a device is removable, PORTSC reports a 0, same as in the > * hub descriptor DeviceRemovable bits. > */ > - if (portsc & PORT_DEV_REMOVE) > + if (usb_get_hub_port_connect_type( > + hcd->self.root_hub, i + 1) > + == USB_PORT_CONNECT_TYPE_HARD_WIRED) { > + if (!(portsc & PORT_DEV_REMOVE)) > + xhci_warn(xhci, "usb2.0 port%d's connect type from ACPI is different with PORTSC register. ACPI returns hard-wired.\n", > + i + 1); > + > /* This math is hairy because bit 0 of DeviceRemovable > * is reserved, and bit 1 is for port 1, etc. > */ > port_removable[(i + 1) / 8] |= 1 << ((i + 1) % 8); > + } > } > > /* ch11.h defines a hub descriptor that has room for USB_MAXCHILDREN > @@ -148,8 +155,16 @@ static void xhci_usb3_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, > /* bit 0 is reserved, bit 1 is for port 1, etc. */ > for (i = 0; i < ports; i++) { > portsc = xhci_readl(xhci, xhci->usb3_ports[i]); > - if (portsc & PORT_DEV_REMOVE) > + > + if (usb_get_hub_port_connect_type( > + hcd->self.root_hub, i + 1) > + == USB_PORT_CONNECT_TYPE_HARD_WIRED) { > + if (!(portsc & PORT_DEV_REMOVE)) > + xhci_warn(xhci, "usb3.0 port%d's connect type from ACPI is different with PORTSC register. ACPI returns hard-wired.\n", > + i + 1); > + > port_removable |= 1 << (i + 1); > + } > } > memset(&desc->u.ss.DeviceRemovable, > (__force __u16) cpu_to_le16(port_removable), > -- > 1.7.9.5 > -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html