drivers/phy/broadcom/phy-bcm63xx-usbh.c

Source file repositories/reference/linux-study-clean/drivers/phy/broadcom/phy-bcm63xx-usbh.c

File Facts

System
Linux kernel
Corpus path
drivers/phy/broadcom/phy-bcm63xx-usbh.c
Extension
.c
Size
12383 bytes
Lines
459
Domain
Driver Families
Bucket
drivers/phy
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

struct bcm63xx_usbh_phy_variant {
	/* Registers */
	long regs[__USBH_ENUM_SIZE];

	/* PLLC bits to set/clear for power on */
	u32 power_pllc_clr;
	u32 power_pllc_set;

	/* Setup bits to set/clear for power on */
	u32 setup_clr;
	u32 setup_set;

	/* Swap Control bits to set */
	u32 swapctl_dev_set;

	/* Test Port Control value to set if non-zero */
	u32 tpc_val;

	/* USB Sim Control bits to set */
	u32 usc_set;

	/* UTMI Control 1 bits to set */
	u32 utmictl1_dev_set;
};

struct bcm63xx_usbh_phy {
	void __iomem *base;
	struct clk *usbh_clk;
	struct clk *usb_ref_clk;
	struct reset_control *reset;
	const struct bcm63xx_usbh_phy_variant *variant;
	bool device_mode;
};

static const struct bcm63xx_usbh_phy_variant usbh_bcm6318 = {
	.regs = {
		[USBH_BRT_CONTROL1] = -1,
		[USBH_BRT_CONTROL2] = -1,
		[USBH_BRT_STATUS1] = -1,
		[USBH_BRT_STATUS2] = -1,
		[USBH_UTMI_CONTROL1] = 0x2c,
		[USBH_TEST_PORT_CONTROL] = 0x1c,
		[USBH_PLL_CONTROL1] = 0x04,
		[USBH_SWAP_CONTROL] = 0x0c,
		[USBH_GENERIC_CONTROL] = -1,
		[USBH_FRAME_ADJUST_VALUE] = 0x08,
		[USBH_SETUP] = 0x00,
		[USBH_MDIO] = 0x14,
		[USBH_MDIO32] = 0x18,
		[USBH_USB_SIM_CONTROL] = 0x20,
	},
	.power_pllc_clr = USBH_6318_PLLC_PLL_IDDQ_PWRDN,
	.power_pllc_set = USBH_6318_PLLC_PLL_SUSPEND_EN,
	.setup_set = USBH_S_IOC,
	.swapctl_dev_set = USBH_SC_USB_DEVICE_SEL,
	.usc_set = USBH_USC_LADDR_SEL,
	.utmictl1_dev_set = USBH_UC1_DEV_MODE_SEL,
};

static const struct bcm63xx_usbh_phy_variant usbh_bcm6328 = {
	.regs = {
		[USBH_BRT_CONTROL1] = 0x00,
		[USBH_BRT_CONTROL2] = 0x04,
		[USBH_BRT_STATUS1] = 0x08,
		[USBH_BRT_STATUS2] = 0x0c,
		[USBH_UTMI_CONTROL1] = 0x10,
		[USBH_TEST_PORT_CONTROL] = 0x14,
		[USBH_PLL_CONTROL1] = 0x18,
		[USBH_SWAP_CONTROL] = 0x1c,
		[USBH_GENERIC_CONTROL] = 0x20,
		[USBH_FRAME_ADJUST_VALUE] = 0x24,
		[USBH_SETUP] = 0x28,
		[USBH_MDIO] = 0x2c,
		[USBH_MDIO32] = 0x30,
		[USBH_USB_SIM_CONTROL] = 0x34,
	},
	.setup_set = USBH_S_IOC,
	.swapctl_dev_set = USBH_SC_USB_DEVICE_SEL,
	.utmictl1_dev_set = USBH_UC1_DEV_MODE_SEL,
};

static const struct bcm63xx_usbh_phy_variant usbh_bcm6358 = {
	.regs = {
		[USBH_BRT_CONTROL1] = -1,
		[USBH_BRT_CONTROL2] = -1,
		[USBH_BRT_STATUS1] = -1,
		[USBH_BRT_STATUS2] = -1,
		[USBH_UTMI_CONTROL1] = -1,
		[USBH_TEST_PORT_CONTROL] = 0x24,
		[USBH_PLL_CONTROL1] = -1,

Annotation

Implementation Notes