drivers/bcma/driver_chipcommon.c
Source file repositories/reference/linux-study-clean/drivers/bcma/driver_chipcommon.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/bcma/driver_chipcommon.c- Extension
.c- Size
- 10564 bytes
- Lines
- 422
- Domain
- Driver Families
- Bucket
- drivers/bcma
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
bcma_private.hlinux/bcm47xx_wdt.hlinux/export.hlinux/platform_device.hlinux/bcma/bcma.h
Detected Declarations
function bcma_cc_write32_maskedfunction bcma_chipco_get_alp_clockfunction bcma_core_cc_has_pmu_watchdogfunction bcma_chipco_watchdog_get_max_timerfunction bcma_chipco_watchdog_timer_set_wdtfunction bcma_chipco_watchdog_timer_set_ms_wdtfunction bcma_chipco_watchdog_ticks_per_msfunction bcma_chipco_watchdog_registerfunction bcma_core_chipcommon_flash_detectfunction bcma_core_chipcommon_early_initfunction bcma_core_chipcommon_initfunction bcma_chipco_watchdog_timer_setfunction bcma_chipco_irq_maskfunction bcma_chipco_irq_statusfunction bcma_chipco_gpio_infunction bcma_chipco_gpio_outfunction bcma_chipco_gpio_outenfunction bcma_chipco_gpio_controlfunction bcma_chipco_gpio_intmaskfunction bcma_chipco_gpio_polarityfunction bcma_chipco_gpio_pullupfunction bcma_chipco_gpio_pulldownfunction bcma_chipco_serial_initexport bcma_chipco_get_alp_clockexport bcma_chipco_gpio_outexport bcma_chipco_gpio_outenexport bcma_chipco_gpio_control
Annotated Snippet
if (bus->chipinfo.id == BCMA_CHIP_ID_BCM53573) {
WARN(bus->chipinfo.rev <= 1, "No watchdog available\n");
/* 53573B0 and 53573B1 have bugged PMU watchdog. It can
* be enabled but timer can't be bumped. Use CC one
* instead.
*/
return false;
}
return true;
} else {
return false;
}
}
static u32 bcma_chipco_watchdog_get_max_timer(struct bcma_drv_cc *cc)
{
struct bcma_bus *bus = cc->core->bus;
u32 nb;
if (bcma_core_cc_has_pmu_watchdog(cc)) {
if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706)
nb = 32;
else if (cc->core->id.rev < 26)
nb = 16;
else
nb = (cc->core->id.rev >= 37) ? 32 : 24;
} else {
nb = 28;
}
if (nb == 32)
return 0xffffffff;
else
return (1 << nb) - 1;
}
static u32 bcma_chipco_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt,
u32 ticks)
{
struct bcma_drv_cc *cc = bcm47xx_wdt_get_drvdata(wdt);
return bcma_chipco_watchdog_timer_set(cc, ticks);
}
static u32 bcma_chipco_watchdog_timer_set_ms_wdt(struct bcm47xx_wdt *wdt,
u32 ms)
{
struct bcma_drv_cc *cc = bcm47xx_wdt_get_drvdata(wdt);
u32 ticks;
ticks = bcma_chipco_watchdog_timer_set(cc, cc->ticks_per_ms * ms);
return ticks / cc->ticks_per_ms;
}
static int bcma_chipco_watchdog_ticks_per_ms(struct bcma_drv_cc *cc)
{
struct bcma_bus *bus = cc->core->bus;
if (cc->capabilities & BCMA_CC_CAP_PMU) {
if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706)
/* 4706 CC and PMU watchdogs are clocked at 1/4 of ALP
* clock
*/
return bcma_chipco_get_alp_clock(cc) / 4000;
else
/* based on 32KHz ILP clock */
return 32;
} else {
return bcma_chipco_get_alp_clock(cc) / 1000;
}
}
int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc)
{
struct bcma_bus *bus = cc->core->bus;
struct bcm47xx_wdt wdt = {};
struct platform_device *pdev;
if (bus->chipinfo.id == BCMA_CHIP_ID_BCM53573 &&
bus->chipinfo.rev <= 1) {
pr_debug("No watchdog on 53573A0 / 53573A1\n");
return 0;
}
wdt.driver_data = cc;
wdt.timer_set = bcma_chipco_watchdog_timer_set_wdt;
wdt.timer_set_ms = bcma_chipco_watchdog_timer_set_ms_wdt;
wdt.max_timer_ms =
bcma_chipco_watchdog_get_max_timer(cc) / cc->ticks_per_ms;
pdev = platform_device_register_data(NULL, "bcm47xx-wdt",
Annotation
- Immediate include surface: `bcma_private.h`, `linux/bcm47xx_wdt.h`, `linux/export.h`, `linux/platform_device.h`, `linux/bcma/bcma.h`.
- Detected declarations: `function bcma_cc_write32_masked`, `function bcma_chipco_get_alp_clock`, `function bcma_core_cc_has_pmu_watchdog`, `function bcma_chipco_watchdog_get_max_timer`, `function bcma_chipco_watchdog_timer_set_wdt`, `function bcma_chipco_watchdog_timer_set_ms_wdt`, `function bcma_chipco_watchdog_ticks_per_ms`, `function bcma_chipco_watchdog_register`, `function bcma_core_chipcommon_flash_detect`, `function bcma_core_chipcommon_early_init`.
- Atlas domain: Driver Families / drivers/bcma.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.