您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ xhci_port_state_to_neutral函数代码示例

51自学网 2021-06-03 10:21:08
  C++
这篇教程C++ xhci_port_state_to_neutral函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中xhci_port_state_to_neutral函数的典型用法代码示例。如果您正苦于以下问题:C++ xhci_port_state_to_neutral函数的具体用法?C++ xhci_port_state_to_neutral怎么用?C++ xhci_port_state_to_neutral使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了xhci_port_state_to_neutral函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: enableXhciAllPortPower

void enableXhciAllPortPower(struct xhci_hcor *hcor){	int i;	u32 port_id, temp;	__le32 __iomem addr;	g_num_u3_port = SSUSB_U3_PORT_NUM(readl((const volatile void __iomem *)SSUSB_IP_CAP));	g_num_u2_port = SSUSB_U2_PORT_NUM(readl((const volatile void __iomem *)SSUSB_IP_CAP));		for (i = 1; i <= g_num_u3_port; i++) {		port_id = i;		addr =  (__le32 __iomem)(&hcor->portregs);		addr += NUM_PORT_REGS * ((port_id - 1) & 0xff) * sizeof(__le32);		temp = xhci_readl((__le32 __iomem *)addr);		temp = xhci_port_state_to_neutral(temp);		temp |= PORT_POWER;		xhci_writel((__le32 __iomem *)addr, temp);	}	for (i = 1; i <= g_num_u2_port; i++) {		port_id=i+g_num_u3_port;		addr =  (__le32 __iomem)(&hcor->portregs);		addr += NUM_PORT_REGS * ((port_id - 1) & 0xff) * sizeof(__le32);		temp = xhci_readl((__le32 __iomem *)addr);		temp = xhci_port_state_to_neutral(temp);		temp |= PORT_POWER;		xhci_writel((__le32 __iomem *)addr, temp);	}}
开发者ID:andy-padavan,项目名称:rt-n56u,代码行数:29,


示例2: xhci_disable_port_wake_on_bits

static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci){	int port_index;	__le32 __iomem **port_array;	unsigned long flags;	u32 t1, t2;	spin_lock_irqsave(&xhci->lock, flags);	/* disble usb3 ports Wake bits*/	port_index = xhci->num_usb3_ports;	port_array = xhci->usb3_ports;	while (port_index--) {		t1 = readl(port_array[port_index]);		t1 = xhci_port_state_to_neutral(t1);		t2 = t1 & ~PORT_WAKE_BITS;		if (t1 != t2)			writel(t2, port_array[port_index]);	}	/* disble usb2 ports Wake bits*/	port_index = xhci->num_usb2_ports;	port_array = xhci->usb2_ports;	while (port_index--) {		t1 = readl(port_array[port_index]);		t1 = xhci_port_state_to_neutral(t1);		t2 = t1 & ~PORT_WAKE_BITS;		if (t1 != t2)			writel(t2, port_array[port_index]);	}	spin_unlock_irqrestore(&xhci->lock, flags);}
开发者ID:redareda9,项目名称:linux,代码行数:33,


示例3: enableXhciAllPortPower

void enableXhciAllPortPower(struct xhci_hcd *xhci){	int i;	u32 port_id, temp;	u32 __iomem *addr;	g_num_u3_port = SSUSB_U3_PORT_NUM(readl(SSUSB_IP_CAP));	g_num_u2_port = SSUSB_U2_PORT_NUM(readl(SSUSB_IP_CAP));		for(i=1; i<=g_num_u3_port; i++){		port_id=i;		addr = &xhci->op_regs->port_status_base + NUM_PORT_REGS*(port_id-1 & 0xff);		temp = readl(addr);		temp = xhci_port_state_to_neutral(temp);		temp |= PORT_POWER;		writel(temp, addr);	}	for(i=1; i<=g_num_u2_port; i++){		port_id=i+g_num_u3_port;		addr = &xhci->op_regs->port_status_base + NUM_PORT_REGS*(port_id-1 & 0xff);		temp = readl(addr);		temp = xhci_port_state_to_neutral(temp);		temp |= PORT_POWER;		writel(temp, addr);	}}
开发者ID:Yui-Qi-Tang,项目名称:openwrtPKG,代码行数:25,


示例4: xhci_set_port_power

/* * xhci_set_port_power() must be called with xhci->lock held. * It will release and re-aquire the lock while calling ACPI * method. */static void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd,				u16 index, bool on, unsigned long *flags){	__le32 __iomem *addr;	u32 temp;	addr = xhci_get_port_io_addr(hcd, index);	temp = readl(addr);	temp = xhci_port_state_to_neutral(temp);	if (on) {		/* Power on */		writel(temp | PORT_POWER, addr);		temp = readl(addr);		xhci_dbg(xhci, "set port power, actual port %d status  = 0x%x/n",						index, temp);	} else {		/* Power off */		writel(temp & ~PORT_POWER, addr);	}	spin_unlock_irqrestore(&xhci->lock, *flags);	temp = usb_acpi_power_manageable(hcd->self.root_hub,					index);	if (temp)		usb_acpi_set_power_state(hcd->self.root_hub,			index, on);	spin_lock_irqsave(&xhci->lock, *flags);}
开发者ID:ReneNyffenegger,项目名称:linux,代码行数:33,


示例5: xhci_port_write

static ssize_t xhci_port_write(struct file *file,  const char __user *ubuf,			       size_t count, loff_t *ppos){	struct seq_file         *s = file->private_data;	struct xhci_port	*port = s->private;	struct xhci_hcd		*xhci = hcd_to_xhci(port->rhub->hcd);	char                    buf[32];	u32			portsc;	unsigned long		flags;	if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))		return -EFAULT;	if (!strncmp(buf, "compliance", 10)) {		/* If CTC is clear, compliance is enabled by default */		if (!HCC2_CTC(xhci->hcc_params2))			return count;		spin_lock_irqsave(&xhci->lock, flags);		/* compliance mode can only be enabled on ports in RxDetect */		portsc = readl(port->addr);		if ((portsc & PORT_PLS_MASK) != XDEV_RXDETECT) {			spin_unlock_irqrestore(&xhci->lock, flags);			return -EPERM;		}		portsc = xhci_port_state_to_neutral(portsc);		portsc &= ~PORT_PLS_MASK;		portsc |= PORT_LINK_STROBE | XDEV_COMP_MODE;		writel(portsc, port->addr);		spin_unlock_irqrestore(&xhci->lock, flags);	} else {		return -EINVAL;	}	return count;}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:34,


示例6: xhci_set_remote_wake_mask

static void xhci_set_remote_wake_mask(struct xhci_hcd *xhci,		__le32 __iomem **port_array, int port_id, u16 wake_mask){	u32 temp;	temp = readl(port_array[port_id]);	temp = xhci_port_state_to_neutral(temp);	if (wake_mask & USB_PORT_FEAT_REMOTE_WAKE_CONNECT)		temp |= PORT_WKCONN_E;	else		temp &= ~PORT_WKCONN_E;	if (wake_mask & USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT)		temp |= PORT_WKDISC_E;	else		temp &= ~PORT_WKDISC_E;	if (wake_mask & USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT)		temp |= PORT_WKOC_E;	else		temp &= ~PORT_WKOC_E;	writel(temp, port_array[port_id]);}
开发者ID:GAXUSXX,项目名称:G935FGaXusKernel2,代码行数:25,


示例7: xhci_hub_port_warm_reset

static __maybe_unused int xhci_hub_port_warm_reset(struct xhci_hcd *xhci, int port){	void __iomem *portsc = xhci->usb_ports[port];	u32 reg;	reg = xhci_port_state_to_neutral(readl(portsc));	writel(reg | PORT_WR, portsc);	return xhci_handshake(portsc, PORT_RESET, 0, 10 * SECOND/USECOND);}
开发者ID:RobertCNelson,项目名称:barebox,代码行数:9,


示例8: xhci_set_link_state

void xhci_set_link_state(struct xhci_hcd *xhci, __le32 __iomem **port_array,				int port_id, u32 link_state){	u32 temp;	temp = readl(port_array[port_id]);	temp = xhci_port_state_to_neutral(temp);	temp &= ~PORT_PLS_MASK;	temp |= PORT_LINK_STROBE | link_state;	writel(temp, port_array[port_id]);}
开发者ID:GAXUSXX,项目名称:G935FGaXusKernel2,代码行数:11,


示例9: xhci_hub_port_power

void xhci_hub_port_power(struct xhci_hcd *xhci, int port,			 bool enable){	u32 reg = readl(xhci->usb_ports[port]);	reg = xhci_port_state_to_neutral(reg);	if (enable)		reg |= PORT_POWER;	else		reg &= ~PORT_POWER;	writel(reg, xhci->usb_ports[port]);}
开发者ID:RobertCNelson,项目名称:barebox,代码行数:12,


示例10: xhci_test_and_clear_bit

/* Test and clear port RWC bit */void xhci_test_and_clear_bit(struct xhci_hcd *xhci, __le32 __iomem **port_array,				int port_id, u32 port_bit){	u32 temp;	temp = readl(port_array[port_id]);	if (temp & port_bit) {		temp = xhci_port_state_to_neutral(temp);		temp |= port_bit;		writel(temp, port_array[port_id]);	}}
开发者ID:GAXUSXX,项目名称:G935FGaXusKernel2,代码行数:13,


示例11: xhci_bus_resume

int xhci_bus_resume(struct usb_hcd *hcd){	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);	int max_ports, port_index;	__le32 __iomem **port_array;	struct xhci_bus_state *bus_state;	u32 temp;	unsigned long flags;	max_ports = xhci_get_ports(hcd, &port_array);	bus_state = &xhci->bus_state[hcd_index(hcd)];	if (time_before(jiffies, bus_state->next_statechange))		msleep(5);	spin_lock_irqsave(&xhci->lock, flags);	if (!HCD_HW_ACCESSIBLE(hcd)) {		spin_unlock_irqrestore(&xhci->lock, flags);		return -ESHUTDOWN;	}	/* delay the irqs */	temp = xhci_readl(xhci, &xhci->op_regs->command);	temp &= ~CMD_EIE;	xhci_writel(xhci, temp, &xhci->op_regs->command);	port_index = max_ports;	while (port_index--) {		/* Check whether need resume ports. If needed		   resume port and disable remote wakeup */		u32 temp;		int slot_id;		temp = xhci_readl(xhci, port_array[port_index]);		if (DEV_SUPERSPEED(temp))			temp &= ~(PORT_RWC_BITS | PORT_CEC | PORT_WAKE_BITS);		else			temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS);		if (test_bit(port_index, &bus_state->bus_suspended) &&		    (temp & PORT_PLS_MASK)) {			if (DEV_SUPERSPEED(temp)) {				temp = xhci_port_state_to_neutral(temp);				temp &= ~PORT_PLS_MASK;				temp |= PORT_LINK_STROBE | XDEV_U0;				xhci_writel(xhci, temp, port_array[port_index]);			} else {				temp = xhci_port_state_to_neutral(temp);				temp &= ~PORT_PLS_MASK;				temp |= PORT_LINK_STROBE | XDEV_RESUME;				xhci_writel(xhci, temp, port_array[port_index]);				spin_unlock_irqrestore(&xhci->lock, flags);				msleep(20);				spin_lock_irqsave(&xhci->lock, flags);				temp = xhci_readl(xhci, port_array[port_index]);				temp = xhci_port_state_to_neutral(temp);				temp &= ~PORT_PLS_MASK;				temp |= PORT_LINK_STROBE | XDEV_U0;				xhci_writel(xhci, temp, port_array[port_index]);			}			/* wait for the port to enter U0 and report port link			 * state change.			 */			spin_unlock_irqrestore(&xhci->lock, flags);			msleep(20);			spin_lock_irqsave(&xhci->lock, flags);			/* Clear PLC */			xhci_test_and_clear_bit(xhci, port_array, port_index,						PORT_PLC);			slot_id = xhci_find_slot_id_by_port(hcd,					xhci, port_index + 1);			if (slot_id)				xhci_ring_device(xhci, slot_id);		} else			xhci_writel(xhci, temp, port_array[port_index]);		if (hcd->speed != HCD_USB3) {			/* disable remote wake up for USB 2.0 */			__le32 __iomem *addr;			u32 tmp;			/* Add one to the port status register address to get			 * the port power control register address.			 */			addr = port_array[port_index] + 1;			tmp = xhci_readl(xhci, addr);			tmp &= ~PORT_RWE;			xhci_writel(xhci, tmp, addr);		}	}	(void) xhci_readl(xhci, &xhci->op_regs->command);	bus_state->next_statechange = jiffies + msecs_to_jiffies(5);	/* re-enable irqs */	temp = xhci_readl(xhci, &xhci->op_regs->command);	temp |= CMD_EIE;//.........这里部分代码省略.........
开发者ID:303750856,项目名称:linux-3.1,代码行数:101,


示例12: xhci_hub_control

int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,		u16 wIndex, char *buf, u16 wLength){	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);	int ports;	unsigned long flags;	u32 temp, temp1, status;	int retval = 0;	u32 __iomem **port_array;	int slot_id;	struct xhci_bus_state *bus_state;	if (hcd->speed == HCD_USB3) {		ports = xhci->num_usb3_ports;		port_array = xhci->usb3_ports;	} else {		ports = xhci->num_usb2_ports;		port_array = xhci->usb2_ports;	}	bus_state = &xhci->bus_state[hcd_index(hcd)];	spin_lock_irqsave(&xhci->lock, flags);	switch (typeReq) {	case GetHubStatus:		/* No power source, over-current reported per port */		memset(buf, 0, 4);		break;	case GetHubDescriptor:		/* Check to make sure userspace is asking for the USB 3.0 hub		 * descriptor for the USB 3.0 roothub.  If not, we stall the		 * endpoint, like external hubs do.		 */		if (hcd->speed == HCD_USB3 &&				(wLength < USB_DT_SS_HUB_SIZE ||				 wValue != (USB_DT_SS_HUB << 8))) {			xhci_dbg(xhci, "Wrong hub descriptor type for "					"USB 3.0 roothub./n");			goto error;		}		xhci_hub_descriptor(hcd, xhci,				(struct usb_hub_descriptor *) buf);		break;	case GetPortStatus:		if (!wIndex || wIndex > ports)			goto error;		wIndex--;		status = 0;		temp = xhci_readl(xhci, port_array[wIndex]);		if (temp == 0xffffffff) {			retval = -ENODEV;			break;		}		xhci_dbg(xhci, "get port status, actual port %d status  = 0x%x/n", wIndex, temp);		/* FIXME - should we return a port status value like the USB		 * 3.0 external hubs do?		 */		/* wPortChange bits */		if (temp & PORT_CSC)			status |= USB_PORT_STAT_C_CONNECTION << 16;		if (temp & PORT_PEC)			status |= USB_PORT_STAT_C_ENABLE << 16;		if ((temp & PORT_OCC))			status |= USB_PORT_STAT_C_OVERCURRENT << 16;		/*		 * FIXME ignoring reset and USB 2.1/3.0 specific		 * changes		 */		if ((temp & PORT_PLS_MASK) == XDEV_U3			&& (temp & PORT_POWER))			status |= 1 << USB_PORT_FEAT_SUSPEND;		if ((temp & PORT_PLS_MASK) == XDEV_RESUME) {			if ((temp & PORT_RESET) || !(temp & PORT_PE))				goto error;			if (!DEV_SUPERSPEED(temp) && time_after_eq(jiffies,						bus_state->resume_done[wIndex])) {				xhci_dbg(xhci, "Resume USB2 port %d/n",					wIndex + 1);				bus_state->resume_done[wIndex] = 0;				temp1 = xhci_port_state_to_neutral(temp);				temp1 &= ~PORT_PLS_MASK;				temp1 |= PORT_LINK_STROBE | XDEV_U0;				xhci_writel(xhci, temp1, port_array[wIndex]);				xhci_dbg(xhci, "set port %d resume/n",					wIndex + 1);				slot_id = xhci_find_slot_id_by_port(hcd, xhci,								 wIndex + 1);				if (!slot_id) {					xhci_dbg(xhci, "slot_id is zero/n");					goto error;				}				xhci_ring_device(xhci, slot_id);				bus_state->port_c_suspend |= 1 << wIndex;				bus_state->suspended_ports &= ~(1 << wIndex);			}		}		if ((temp & PORT_PLS_MASK) == XDEV_U0			&& (temp & PORT_POWER)			&& (bus_state->suspended_ports & (1 << wIndex))) {//.........这里部分代码省略.........
开发者ID:patrick-ken,项目名称:MyNet_N900,代码行数:101,


示例13: xhci_bus_suspend

int xhci_bus_suspend(struct usb_hcd *hcd){	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);	int max_ports, port_index;	__le32 __iomem **port_array;	struct xhci_bus_state *bus_state;	unsigned long flags;	max_ports = xhci_get_ports(hcd, &port_array);	bus_state = &xhci->bus_state[hcd_index(hcd)];	if (time_before_eq(jiffies, bus_state->next_statechange))		usleep_range(10000, 11000);	spin_lock_irqsave(&xhci->lock, flags);	if (hcd->self.root_hub->do_remote_wakeup) {		if (bus_state->resuming_ports ||	/* USB2 */		    bus_state->port_remote_wakeup) {	/* USB3 */			spin_unlock_irqrestore(&xhci->lock, flags);			xhci_dbg(xhci, "suspend failed because a port is resuming/n");			return -EBUSY;		}	}	port_index = max_ports;	bus_state->bus_suspended = 0;	while (port_index--) {		/* suspend the port if the port is not suspended */		u32 t1, t2;		int slot_id;		t1 = xhci_readl(xhci, port_array[port_index]);		t2 = xhci_port_state_to_neutral(t1);		if ((t1 & PORT_PE) && !(t1 & PORT_PLS_MASK)) {			xhci_dbg(xhci, "port %d not suspended/n", port_index);			slot_id = xhci_find_slot_id_by_port(hcd, xhci,					port_index + 1);			if (slot_id) {				spin_unlock_irqrestore(&xhci->lock, flags);				xhci_stop_device(xhci, slot_id, 1);				spin_lock_irqsave(&xhci->lock, flags);			}			t2 &= ~PORT_PLS_MASK;			t2 |= PORT_LINK_STROBE | XDEV_U3;			set_bit(port_index, &bus_state->bus_suspended);		}		/* USB core sets remote wake mask for USB 3.0 hubs,		 * including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME		 * is enabled, so also enable remote wake here.		 */		if (hcd->self.root_hub->do_remote_wakeup) {			if (t1 & PORT_CONNECT) {				t2 |= PORT_WKOC_E | PORT_WKDISC_E;				t2 &= ~PORT_WKCONN_E;			} else {				t2 |= PORT_WKOC_E | PORT_WKCONN_E;				t2 &= ~PORT_WKDISC_E;			}		} else			t2 &= ~PORT_WAKE_BITS;		t1 = xhci_port_state_to_neutral(t1);		if (t1 != t2) {			xhci_writel(xhci, t2, port_array[port_index]);			if (xhci->quirks & XHCI_PORTSC_DELAY)				ndelay(100);		}		if (hcd->speed != HCD_USB3) {			/* enable remote wake up for USB 2.0 */			__le32 __iomem *addr;			u32 tmp;			/* Add one to the port status register address to get			 * the port power control register address.			 */			addr = port_array[port_index] + 1;			tmp = xhci_readl(xhci, addr);			tmp |= PORT_RWE;			xhci_writel(xhci, tmp, addr);			if (xhci->quirks & XHCI_PORTSC_DELAY)				ndelay(100);		}	}	hcd->state = HC_STATE_SUSPENDED;	bus_state->next_statechange = jiffies + msecs_to_jiffies(10);	spin_unlock_irqrestore(&xhci->lock, flags);	return 0;}
开发者ID:Pafcholini,项目名称:Beta_TW,代码行数:91,


示例14: xhci_bus_suspend

int xhci_bus_suspend(struct usb_hcd *hcd){	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);	int max_ports, port_index;	__le32 __iomem **port_array;	struct xhci_bus_state *bus_state;	unsigned long flags;	max_ports = xhci_get_ports(hcd, &port_array);	bus_state = &xhci->bus_state[hcd_index(hcd)];	spin_lock_irqsave(&xhci->lock, flags);	if (hcd->self.root_hub->do_remote_wakeup) {		port_index = max_ports;		while (port_index--) {			if (bus_state->resume_done[port_index] != 0) {				spin_unlock_irqrestore(&xhci->lock, flags);				xhci_dbg(xhci, "suspend failed because "						"port %d is resuming/n",						port_index + 1);				return -EBUSY;			}		}	}	port_index = max_ports;	bus_state->bus_suspended = 0;	while (port_index--) {		/* suspend the port if the port is not suspended */		u32 t1, t2;		int slot_id;		t1 = xhci_readl(xhci, port_array[port_index]);		t2 = xhci_port_state_to_neutral(t1);		if ((t1 & PORT_PE) && !(t1 & PORT_PLS_MASK)) {			xhci_dbg(xhci, "port %d not suspended/n", port_index);			slot_id = xhci_find_slot_id_by_port(hcd, xhci,					port_index + 1);			if (slot_id) {				spin_unlock_irqrestore(&xhci->lock, flags);				xhci_stop_device(xhci, slot_id, 1);				spin_lock_irqsave(&xhci->lock, flags);			}			t2 &= ~PORT_PLS_MASK;			t2 |= PORT_LINK_STROBE | XDEV_U3;			set_bit(port_index, &bus_state->bus_suspended);		}		if (hcd->self.root_hub->do_remote_wakeup) {			if (t1 & PORT_CONNECT) {				t2 |= PORT_WKOC_E | PORT_WKDISC_E;				t2 &= ~PORT_WKCONN_E;			} else {				t2 |= PORT_WKOC_E | PORT_WKCONN_E;				t2 &= ~PORT_WKDISC_E;			}		} else			t2 &= ~PORT_WAKE_BITS;		t1 = xhci_port_state_to_neutral(t1);		if (t1 != t2)			xhci_writel(xhci, t2, port_array[port_index]);		if (hcd->speed != HCD_USB3) {			/* enable remote wake up for USB 2.0 */			__le32 __iomem *addr;			u32 tmp;			/* Add one to the port status register address to get			 * the port power control register address.			 */			addr = port_array[port_index] + 1;			tmp = xhci_readl(xhci, addr);			tmp |= PORT_RWE;			xhci_writel(xhci, tmp, addr);		}	}	hcd->state = HC_STATE_SUSPENDED;	bus_state->next_statechange = jiffies + msecs_to_jiffies(10);	spin_unlock_irqrestore(&xhci->lock, flags);	return 0;}
开发者ID:OneOfMany07,项目名称:fjord-kernel,代码行数:83,


示例15: xhci_hub_control

//.........这里部分代码省略.........				status |= USB_SS_PORT_STAT_POWER;			else				status |= USB_PORT_STAT_POWER;		}		/* Update Port Link State for super speed ports*/		if (hcd->speed == HCD_USB3) {			xhci_hub_report_link_state(xhci, &status, temp);			/*			 * Verify if all USB3 Ports Have entered U0 already.			 * Delete Compliance Mode Timer if so.			 */			xhci_del_comp_mod_timer(xhci, temp, wIndex);		}		if (bus_state->port_c_suspend & (1 << wIndex))			status |= 1 << USB_PORT_FEAT_C_SUSPEND;		xhci_dbg(xhci, "Get port status returned 0x%x/n", status);		put_unaligned(cpu_to_le32(status), (__le32 *) buf);		break;	case SetPortFeature:		selector = wIndex >> 8;		if (wValue == USB_PORT_FEAT_LINK_STATE)			link_state = (wIndex & 0xff00) >> 3;		if (wValue == USB_PORT_FEAT_REMOTE_WAKE_MASK)			wake_mask = wIndex & 0xff00;		wIndex &= 0xff;		if (!wIndex || wIndex > max_ports)			goto error;		wIndex--;		temp = xhci_readl(xhci, port_array[wIndex]);		if (temp == 0xffffffff) {			retval = -ENODEV;			break;		}		temp = xhci_port_state_to_neutral(temp);		/* FIXME: What new port features do we need to support? */		switch (wValue) {		case USB_PORT_FEAT_SUSPEND:			temp = xhci_readl(xhci, port_array[wIndex]);			if ((temp & PORT_PLS_MASK) != XDEV_U0) {				/* Resume the port to U0 first */				xhci_set_link_state(xhci, port_array, wIndex,							XDEV_U0);				spin_unlock_irqrestore(&xhci->lock, flags);				msleep(10);				spin_lock_irqsave(&xhci->lock, flags);			}			/* In spec software should not attempt to suspend			 * a port unless the port reports that it is in the			 * enabled (PED = ??1??,PLS < ??3??) state.			 */			temp = xhci_readl(xhci, port_array[wIndex]);			if ((temp & PORT_PE) == 0 || (temp & PORT_RESET)				|| (temp & PORT_PLS_MASK) >= XDEV_U3) {				xhci_warn(xhci, "USB core suspending device "					  "not in U0/U1/U2./n");				goto error;			}			slot_id = xhci_find_slot_id_by_port(hcd, xhci,					wIndex + 1);			if (!slot_id) {				xhci_warn(xhci, "slot_id is zero/n");				goto error;			}			/* unlock to execute stop endpoint commands */			spin_unlock_irqrestore(&xhci->lock, flags);
开发者ID:DJSteve,项目名称:g800f_custom_kernel,代码行数:67,


示例16: xhci_bus_suspend

int xhci_bus_suspend(struct usb_hcd *hcd){	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);	int max_ports, port_index;	__le32 __iomem **port_array;	struct xhci_bus_state *bus_state;	unsigned long flags;	max_ports = xhci_get_ports(hcd, &port_array);	bus_state = &xhci->bus_state[hcd_index(hcd)];	spin_lock_irqsave(&xhci->lock, flags);	if (hcd->self.root_hub->do_remote_wakeup) {		if (bus_state->resuming_ports) {			spin_unlock_irqrestore(&xhci->lock, flags);			xhci_dbg(xhci, "suspend failed because "						"a port is resuming/n");			return -EBUSY;		}	}	port_index = max_ports;	bus_state->bus_suspended = 0;	while (port_index--) {		/* suspend the port if the port is not suspended */		u32 t1, t2;		int slot_id;		t1 = xhci_readl(xhci, port_array[port_index]);		t2 = xhci_port_state_to_neutral(t1);		if ((t1 & PORT_PE) && !(t1 & PORT_PLS_MASK)) {			xhci_dbg(xhci, "port %d not suspended/n", port_index);			slot_id = xhci_find_slot_id_by_port(hcd, xhci,					port_index + 1);			if (slot_id) {				spin_unlock_irqrestore(&xhci->lock, flags);				xhci_stop_device(xhci, slot_id, 1);				spin_lock_irqsave(&xhci->lock, flags);			}			t2 &= ~PORT_PLS_MASK;			t2 |= PORT_LINK_STROBE | XDEV_U3;			set_bit(port_index, &bus_state->bus_suspended);		}		/* USB core sets remote wake mask for USB 3.0 hubs,		 * including the USB 3.0 roothub, but only if CONFIG_USB_SUSPEND		 * is enabled, so also enable remote wake here.		 */		if (hcd->self.root_hub->do_remote_wakeup) {			if (t1 & PORT_CONNECT) {				t2 |= PORT_WKOC_E | PORT_WKDISC_E;				t2 &= ~PORT_WKCONN_E;			} else {				t2 |= PORT_WKOC_E | PORT_WKCONN_E;				t2 &= ~PORT_WKDISC_E;			}		} else			t2 &= ~PORT_WAKE_BITS;		t1 = xhci_port_state_to_neutral(t1);		if (t1 != t2) {			xhci_writel(xhci, t2, port_array[port_index]);	}	hcd->state = HC_STATE_SUSPENDED;	bus_state->next_statechange = jiffies + msecs_to_jiffies(10);	spin_unlock_irqrestore(&xhci->lock, flags);	return 0;}int xhci_bus_resume(struct usb_hcd *hcd){	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);	int max_ports, port_index;	__le32 __iomem **port_array;	struct xhci_bus_state *bus_state;	u32 temp;	unsigned long flags;	max_ports = xhci_get_ports(hcd, &port_array);	bus_state = &xhci->bus_state[hcd_index(hcd)];	if (time_before(jiffies, bus_state->next_statechange))		msleep(5);	spin_lock_irqsave(&xhci->lock, flags);	if (!HCD_HW_ACCESSIBLE(hcd)) {		spin_unlock_irqrestore(&xhci->lock, flags);		return -ESHUTDOWN;	}	/* delay the irqs */	temp = xhci_readl(xhci, &xhci->op_regs->command);	temp &= ~CMD_EIE;	xhci_writel(xhci, temp, &xhci->op_regs->command);	port_index = max_ports;	while (port_index--) {		/* Check whether need resume ports. If needed		   resume port and disable remote wakeup *///.........这里部分代码省略.........
开发者ID:leezhenghui,项目名称:AGK-LOLLIPOP,代码行数:101,


示例17: xhci_hub_control

int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,		u16 wIndex, char *buf, u16 wLength){	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);	int ports;	unsigned long flags;	u32 temp, status;	int retval = 0;	u32 __iomem *addr;	char *port_change_bit;	ports = HCS_MAX_PORTS(xhci->hcs_params1);	spin_lock_irqsave(&xhci->lock, flags);	switch (typeReq) {	case GetHubStatus:		/* No power source, over-current reported per port */		memset(buf, 0, 4);		break;	case GetHubDescriptor:		xhci_hub_descriptor(xhci, (struct usb_hub_descriptor *) buf);		break;	case GetPortStatus:		if (!wIndex || wIndex > ports)			goto error;		wIndex--;		status = 0;		addr = &xhci->op_regs->port_status_base + NUM_PORT_REGS*(wIndex & 0xff);		temp = xhci_readl(xhci, addr);		xhci_dbg(xhci, "get port status, actual port %d status  = 0x%x/n", wIndex, temp);		/* wPortChange bits */		if (temp & PORT_CSC)			status |= 1 << USB_PORT_FEAT_C_CONNECTION;		if (temp & PORT_PEC)			status |= 1 << USB_PORT_FEAT_C_ENABLE;		if ((temp & PORT_OCC))			status |= 1 << USB_PORT_FEAT_C_OVER_CURRENT;		/*		 * FIXME ignoring suspend, reset, and USB 2.1/3.0 specific		 * changes		 */		if (temp & PORT_CONNECT) {			status |= 1 << USB_PORT_FEAT_CONNECTION;			status |= xhci_port_speed(temp);		}		if (temp & PORT_PE)			status |= 1 << USB_PORT_FEAT_ENABLE;		if (temp & PORT_OC)			status |= 1 << USB_PORT_FEAT_OVER_CURRENT;		if (temp & PORT_RESET)			status |= 1 << USB_PORT_FEAT_RESET;		if (temp & PORT_POWER)			status |= 1 << USB_PORT_FEAT_POWER;		xhci_dbg(xhci, "Get port status returned 0x%x/n", status);		put_unaligned(cpu_to_le32(status), (__le32 *) buf);		break;	case SetPortFeature:		wIndex &= 0xff;		if (!wIndex || wIndex > ports)			goto error;		wIndex--;		addr = &xhci->op_regs->port_status_base + NUM_PORT_REGS*(wIndex & 0xff);		temp = xhci_readl(xhci, addr);		temp = xhci_port_state_to_neutral(temp);		switch (wValue) {		case USB_PORT_FEAT_POWER:			/*			 * Turn on ports, even if there isn't per-port switching.			 * HC will report connect events even before this is set.			 * However, khubd will ignore the roothub events until			 * the roothub is registered.			 */			xhci_writel(xhci, temp | PORT_POWER, addr);			temp = xhci_readl(xhci, addr);			xhci_dbg(xhci, "set port power, actual port %d status  = 0x%x/n", wIndex, temp);			break;		case USB_PORT_FEAT_RESET:			temp = (temp | PORT_RESET);			xhci_writel(xhci, temp, addr);			temp = xhci_readl(xhci, addr);			xhci_dbg(xhci, "set port reset, actual port %d status  = 0x%x/n", wIndex, temp);			break;		default:			goto error;		}		temp = xhci_readl(xhci, addr); /* unblock any posted writes */		break;	case ClearPortFeature:		if (!wIndex || wIndex > ports)			goto error;		wIndex--;		addr = &xhci->op_regs->port_status_base +			NUM_PORT_REGS*(wIndex & 0xff);		temp = xhci_readl(xhci, addr);		temp = xhci_port_state_to_neutral(temp);		switch (wValue) {		case USB_PORT_FEAT_C_RESET://.........这里部分代码省略.........
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:101,


示例18: xhci_hub_control

//.........这里部分代码省略.........				status |= USB_PORT_STAT_POWER;		}		/* Update Port Link State for super speed ports*/		if (hcd->speed == HCD_USB3) {			xhci_hub_report_link_state(&status, temp);			/*			 * Verify if all USB3 Ports Have entered U0 already.			 * Delete Compliance Mode Timer if so.			 */			xhci_del_comp_mod_timer(xhci, temp, wIndex);		}		if (bus_state->port_c_suspend & (1 << wIndex))			status |= 1 << USB_PORT_FEAT_C_SUSPEND;		xhci_dbg(xhci, "Get port status returned 0x%x/n", status);		put_unaligned(cpu_to_le32(status), (__le32 *) buf);		break;	case SetPortFeature:		if (wValue == USB_PORT_FEAT_LINK_STATE)			link_state = (wIndex & 0xff00) >> 3;		if (wValue == USB_PORT_FEAT_REMOTE_WAKE_MASK)			wake_mask = wIndex & 0xff00;		selector = wIndex >> 8;		wIndex &= 0xff;		if (!wIndex || wIndex > max_ports)			goto error;		wIndex--;		status_reg = &xhci->op_regs->port_power_base +			NUM_PORT_REGS*wIndex;		temp = xhci_readl(xhci, port_array[wIndex]);		if (temp == 0xffffffff) {			retval = -ENODEV;			break;		}		temp = xhci_port_state_to_neutral(temp);		/* FIXME: What new port features do we need to support? */		switch (wValue) {		case USB_PORT_FEAT_SUSPEND:			temp = xhci_readl(xhci, port_array[wIndex]);			if ((temp & PORT_PLS_MASK) != XDEV_U0) {				/* Resume the port to U0 first */				xhci_set_link_state(xhci, port_array, wIndex,							XDEV_U0);				spin_unlock_irqrestore(&xhci->lock, flags);				msleep(10);				spin_lock_irqsave(&xhci->lock, flags);			}			/* In spec software should not attempt to suspend			 * a port unless the port reports that it is in the			 * enabled (PED = ‘1’,PLS < ‘3’) state.			 */			temp = xhci_readl(xhci, port_array[wIndex]);			if ((temp & PORT_PE) == 0 || (temp & PORT_RESET)				|| (temp & PORT_PLS_MASK) >= XDEV_U3) {				xhci_warn(xhci, "USB core suspending device "					  "not in U0/U1/U2./n");				goto error;			}			slot_id = xhci_find_slot_id_by_port(hcd, xhci,					wIndex + 1);			if (!slot_id) {				xhci_warn(xhci, "slot_id is zero/n");				goto error;			}			/* unlock to execute stop endpoint commands */			spin_unlock_irqrestore(&xhci->lock, flags);
开发者ID:AirShark,项目名称:android_kernel_lenovo_redhookbay,代码行数:67,



注:本文中的xhci_port_state_to_neutral函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ xhci_readl函数代码示例
C++ xhci_get_ports函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。