drivers/clk/bcm/clk-bcm281xx.c

Source file repositories/reference/linux-study-clean/drivers/clk/bcm/clk-bcm281xx.c

File Facts

System
Linux kernel
Corpus path
drivers/clk/bcm/clk-bcm281xx.c
Extension
.c
Size
9276 bytes
Lines
368
Domain
Driver Families
Bucket
drivers/clk
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

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2013 Broadcom Corporation
 * Copyright 2013 Linaro Limited
 */

#include "clk-kona.h"
#include "dt-bindings/clock/bcm281xx.h"

#define BCM281XX_CCU_COMMON(_name, _ucase_name) \
	KONA_CCU_COMMON(BCM281XX, _name, _ucase_name)

/* Root CCU */

static struct peri_clk_data frac_1m_data = {
	.gate		= HW_SW_GATE(0x214, 16, 0, 1),
	.trig		= TRIGGER(0x0e04, 0),
	.div		= FRAC_DIVIDER(0x0e00, 0, 22, 16),
	.clocks		= CLOCKS("ref_crystal"),
};

static struct ccu_data root_ccu_data = {
	BCM281XX_CCU_COMMON(root, ROOT),
	.kona_clks	= {
		[BCM281XX_ROOT_CCU_FRAC_1M] =
			KONA_CLK(root, frac_1m, peri),
		[BCM281XX_ROOT_CCU_CLOCK_COUNT] = LAST_KONA_CLK,
	},
};

/* AON CCU */

static struct peri_clk_data hub_timer_data = {
	.gate		= HW_SW_GATE(0x0414, 16, 0, 1),
	.clocks		= CLOCKS("bbl_32k",
				 "frac_1m",
				 "dft_19_5m"),
	.sel		= SELECTOR(0x0a10, 0, 2),
	.trig		= TRIGGER(0x0a40, 4),
};

static struct peri_clk_data pmu_bsc_data = {
	.gate		= HW_SW_GATE(0x0418, 16, 0, 1),
	.clocks		= CLOCKS("ref_crystal",
				 "pmu_bsc_var",
				 "bbl_32k"),
	.sel		= SELECTOR(0x0a04, 0, 2),
	.div		= DIVIDER(0x0a04, 3, 4),
	.trig		= TRIGGER(0x0a40, 0),
};

static struct peri_clk_data pmu_bsc_var_data = {
	.clocks		= CLOCKS("var_312m",
				 "ref_312m"),
	.sel		= SELECTOR(0x0a00, 0, 2),
	.div		= DIVIDER(0x0a00, 4, 5),
	.trig		= TRIGGER(0x0a40, 2),
};

static struct ccu_data aon_ccu_data = {
	BCM281XX_CCU_COMMON(aon, AON),
	.kona_clks	= {
		[BCM281XX_AON_CCU_HUB_TIMER] =
			KONA_CLK(aon, hub_timer, peri),
		[BCM281XX_AON_CCU_PMU_BSC] =
			KONA_CLK(aon, pmu_bsc, peri),
		[BCM281XX_AON_CCU_PMU_BSC_VAR] =
			KONA_CLK(aon, pmu_bsc_var, peri),
		[BCM281XX_AON_CCU_CLOCK_COUNT] = LAST_KONA_CLK,
	},
};

/* Hub CCU */

static struct peri_clk_data tmon_1m_data = {
	.gate		= HW_SW_GATE(0x04a4, 18, 2, 3),
	.clocks		= CLOCKS("ref_crystal",
				 "frac_1m"),
	.sel		= SELECTOR(0x0e74, 0, 2),
	.trig		= TRIGGER(0x0e84, 1),
};

static struct ccu_data hub_ccu_data = {
	BCM281XX_CCU_COMMON(hub, HUB),
	.kona_clks	= {
		[BCM281XX_HUB_CCU_TMON_1M] =
			KONA_CLK(hub, tmon_1m, peri),
		[BCM281XX_HUB_CCU_CLOCK_COUNT] = LAST_KONA_CLK,
	},
};

Annotation

Implementation Notes