drivers/usb/isp1760/isp1760-core.c

Source file repositories/reference/linux-study-clean/drivers/usb/isp1760/isp1760-core.c

File Facts

System
Linux kernel
Corpus path
drivers/usb/isp1760/isp1760-core.c
Extension
.c
Size
23894 bytes
Lines
608
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 (isp->devflags & ISP1760_FLAG_PERIPHERAL_EN) {
			otg_ctrl = (ISP176x_HW_DM_PULLDOWN_CLEAR |
				    ISP176x_HW_DP_PULLDOWN_CLEAR |
				    ISP176x_HW_OTG_DISABLE);
		} else {
			otg_ctrl = (ISP176x_HW_SW_SEL_HC_DC_CLEAR |
				    ISP176x_HW_VBUS_DRV |
				    ISP176x_HW_SEL_CP_EXT);
		}
		isp1760_reg_write(hcd->regs, ISP176x_HC_OTG_CTRL, otg_ctrl);
	}

	dev_info(isp->dev, "%s bus width: %u, oc: %s\n",
		 hcd->is_isp1763 ? "isp1763" : "isp1760",
		 isp->devflags & ISP1760_FLAG_BUS_WIDTH_8 ? 8 :
		 isp->devflags & ISP1760_FLAG_BUS_WIDTH_16 ? 16 : 32,
		 hcd->is_isp1763 ? "not available" :
		 isp->devflags & ISP1760_FLAG_ANALOG_OC ? "analog" : "digital");

	return 0;
}

void isp1760_set_pullup(struct isp1760_device *isp, bool enable)
{
	struct isp1760_udc *udc = &isp->udc;

	if (enable)
		isp1760_field_set(udc->fields, HW_DP_PULLUP);
	else
		isp1760_field_set(udc->fields, HW_DP_PULLUP_CLEAR);
}

/*
 * ISP1760/61:
 *
 * 60kb divided in:
 * - 32 blocks @ 256  bytes
 * - 20 blocks @ 1024 bytes
 * -  4 blocks @ 8192 bytes
 */
static const struct isp1760_memory_layout isp176x_memory_conf = {
	.blocks[0]		= 32,
	.blocks_size[0]		= 256,
	.blocks[1]		= 20,
	.blocks_size[1]		= 1024,
	.blocks[2]		= 4,
	.blocks_size[2]		= 8192,

	.slot_num		= 32,
	.payload_blocks		= 32 + 20 + 4,
	.payload_area_size	= 0xf000,
};

/*
 * ISP1763:
 *
 * 20kb divided in:
 * - 8 blocks @ 256  bytes
 * - 2 blocks @ 1024 bytes
 * - 4 blocks @ 4096 bytes
 */
static const struct isp1760_memory_layout isp1763_memory_conf = {
	.blocks[0]		= 8,
	.blocks_size[0]		= 256,
	.blocks[1]		= 2,
	.blocks_size[1]		= 1024,
	.blocks[2]		= 4,
	.blocks_size[2]		= 4096,

	.slot_num		= 16,
	.payload_blocks		= 8 + 2 + 4,
	.payload_area_size	= 0x5000,
};

static const struct regmap_range isp176x_hc_volatile_ranges[] = {
	regmap_reg_range(ISP176x_HC_USBCMD, ISP176x_HC_ATL_PTD_LASTPTD),
	regmap_reg_range(ISP176x_HC_BUFFER_STATUS, ISP176x_HC_MEMORY),
	regmap_reg_range(ISP176x_HC_INTERRUPT, ISP176x_HC_OTG_CTRL_CLEAR),
};

static const struct regmap_access_table isp176x_hc_volatile_table = {
	.yes_ranges	= isp176x_hc_volatile_ranges,
	.n_yes_ranges	= ARRAY_SIZE(isp176x_hc_volatile_ranges),
};

static const struct regmap_config isp1760_hc_regmap_conf = {
	.name = "isp1760-hc",
	.reg_bits = 16,
	.reg_stride = 4,
	.val_bits = 32,

Annotation

Implementation Notes