drivers/usb/c67x00/c67x00-hcd.c

Source file repositories/reference/linux-study-clean/drivers/usb/c67x00/c67x00-hcd.c

File Facts

System
Linux kernel
Corpus path
drivers/usb/c67x00/c67x00-hcd.c
Extension
.c
Size
9335 bytes
Lines
400
Domain
Driver Families
Bucket
drivers/usb
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (usb_status & LOW_SPEED_PORT(port)) {
			wPortStatus |= USB_PORT_STAT_LOW_SPEED;
			c67x00->low_speed_ports |= (1 << port);
		} else
			c67x00->low_speed_ports &= ~(1 << port);

		if (usb_status & SOF_EOP_EN(port))
			wPortStatus |= USB_PORT_STAT_ENABLE;

		*(__le16 *) buf = cpu_to_le16(wPortStatus);
		*(__le16 *) (buf + 2) = cpu_to_le16(wPortChange);
		len = 4;
		break;

	case SetHubFeature:	/* We don't implement these */
	case ClearHubFeature:
		switch (wValue) {
		case C_HUB_OVER_CURRENT:
		case C_HUB_LOCAL_POWER:
			len = 0;
			break;

		default:
			return -EPIPE;
		}
		break;

	case SetPortFeature:
		if (wIndex > C67X00_PORTS)
			return -EPIPE;

		switch (wValue) {
		case USB_PORT_FEAT_SUSPEND:
			dev_dbg(c67x00_hcd_dev(c67x00),
				"SetPortFeature %d (SUSPEND)\n", port);
			len = 0;
			break;

		case USB_PORT_FEAT_RESET:
			c67x00_hub_reset_host_port(sie, port);
			len = 0;
			break;

		case USB_PORT_FEAT_POWER:
			/* Power always enabled */
			len = 0;
			break;

		default:
			dev_dbg(c67x00_hcd_dev(c67x00),
				"%s: SetPortFeature %d (0x%04x) Error!\n",
				__func__, port, wValue);
			return -EPIPE;
		}
		break;

	case ClearPortFeature:
		if (wIndex > C67X00_PORTS)
			return -EPIPE;

		switch (wValue) {
		case USB_PORT_FEAT_ENABLE:
			/* Reset the port so that the c67x00 also notices the
			 * disconnect */
			c67x00_hub_reset_host_port(sie, port);
			len = 0;
			break;

		case USB_PORT_FEAT_C_ENABLE:
			dev_dbg(c67x00_hcd_dev(c67x00),
				"ClearPortFeature (%d): C_ENABLE\n", port);
			len = 0;
			break;

		case USB_PORT_FEAT_SUSPEND:
			dev_dbg(c67x00_hcd_dev(c67x00),
				"ClearPortFeature (%d): SUSPEND\n", port);
			len = 0;
			break;

		case USB_PORT_FEAT_C_SUSPEND:
			dev_dbg(c67x00_hcd_dev(c67x00),
				"ClearPortFeature (%d): C_SUSPEND\n", port);
			len = 0;
			break;

		case USB_PORT_FEAT_POWER:
			dev_dbg(c67x00_hcd_dev(c67x00),
				"ClearPortFeature (%d): POWER\n", port);
			return -EPIPE;

Annotation

Implementation Notes