drivers/usb/host/bcma-hcd.c
Source file repositories/reference/linux-study-clean/drivers/usb/host/bcma-hcd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/host/bcma-hcd.c- Extension
.c- Size
- 12618 bytes
- Lines
- 500
- 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.
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bcma/bcma.hlinux/delay.hlinux/gpio/consumer.hlinux/platform_device.hlinux/module.hlinux/slab.hlinux/of.hlinux/of_platform.hlinux/usb/ehci_pdriver.hlinux/usb/ohci_pdriver.h
Detected Declarations
struct bcma_hcd_devicefunction bcma_wait_bitsfunction bcma_hcd_4716wafunction bcma_hcd_init_chip_mipsfunction bcma_hcd_usb20_old_arm_initfunction bcma_hcd_usb20_ns_init_hcfunction bcma_hcd_usb20_ns_initfunction bcma_hci_platform_power_gpiofunction bcma_hcd_usb20_initfunction bcma_hcd_usb30_initfunction bcma_hcd_probefunction bcma_hcd_removefunction bcma_hcd_shutdownfunction bcma_hcd_suspendfunction bcma_hcd_resume
Annotated Snippet
struct bcma_hcd_device {
struct bcma_device *core;
struct platform_device *ehci_dev;
struct platform_device *ohci_dev;
struct gpio_desc *gpio_desc;
};
/* Wait for bitmask in a register to get set or cleared.
* timeout is in units of ten-microseconds.
*/
static int bcma_wait_bits(struct bcma_device *dev, u16 reg, u32 bitmask,
int timeout)
{
int i;
u32 val;
for (i = 0; i < timeout; i++) {
val = bcma_read32(dev, reg);
if ((val & bitmask) == bitmask)
return 0;
udelay(10);
}
return -ETIMEDOUT;
}
static void bcma_hcd_4716wa(struct bcma_device *dev)
{
#ifdef CONFIG_BCMA_DRIVER_MIPS
/* Work around for 4716 failures. */
if (dev->bus->chipinfo.id == 0x4716) {
u32 tmp;
tmp = bcma_cpu_clock(&dev->bus->drv_mips);
if (tmp >= 480000000)
tmp = 0x1846b; /* set CDR to 0x11(fast) */
else if (tmp == 453000000)
tmp = 0x1046b; /* set CDR to 0x10(slow) */
else
tmp = 0;
/* Change Shim mdio control reg to fix host not acking at
* high frequencies
*/
if (tmp) {
bcma_write32(dev, 0x524, 0x1); /* write sel to enable */
udelay(500);
bcma_write32(dev, 0x524, tmp);
udelay(500);
bcma_write32(dev, 0x524, 0x4ab);
udelay(500);
bcma_read32(dev, 0x528);
bcma_write32(dev, 0x528, 0x80000000);
}
}
#endif /* CONFIG_BCMA_DRIVER_MIPS */
}
/* based on arch/mips/brcm-boards/bcm947xx/pcibios.c */
static void bcma_hcd_init_chip_mips(struct bcma_device *dev)
{
u32 tmp;
/*
* USB 2.0 special considerations:
*
* 1. Since the core supports both OHCI and EHCI functions, it must
* only be reset once.
*
* 2. In addition to the standard SI reset sequence, the Host Control
* Register must be programmed to bring the USB core and various
* phy components out of reset.
*/
if (!bcma_core_is_enabled(dev)) {
bcma_core_enable(dev, 0);
mdelay(10);
if (dev->id.rev >= 5) {
/* Enable Misc PLL */
tmp = bcma_read32(dev, 0x1e0);
tmp |= 0x100;
bcma_write32(dev, 0x1e0, tmp);
if (bcma_wait_bits(dev, 0x1e0, 1 << 24, 100))
printk(KERN_EMERG "Failed to enable misc PPL!\n");
/* Take out of resets */
bcma_write32(dev, 0x200, 0x4ff);
udelay(25);
bcma_write32(dev, 0x200, 0x6ff);
udelay(25);
Annotation
- Immediate include surface: `linux/bcma/bcma.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/platform_device.h`, `linux/module.h`, `linux/slab.h`, `linux/of.h`, `linux/of_platform.h`.
- Detected declarations: `struct bcma_hcd_device`, `function bcma_wait_bits`, `function bcma_hcd_4716wa`, `function bcma_hcd_init_chip_mips`, `function bcma_hcd_usb20_old_arm_init`, `function bcma_hcd_usb20_ns_init_hc`, `function bcma_hcd_usb20_ns_init`, `function bcma_hci_platform_power_gpio`, `function bcma_hcd_usb20_init`, `function bcma_hcd_usb30_init`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.