drivers/clk/ti/gate.c
Source file repositories/reference/linux-study-clean/drivers/clk/ti/gate.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/ti/gate.c- Extension
.c- Size
- 7065 bytes
- Lines
- 259
- 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.
- 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/clk-provider.hlinux/slab.hlinux/io.hlinux/of.hlinux/of_address.hlinux/clk/ti.hclock.h
Detected Declarations
function omap36xx_gate_clk_enable_with_hsdiv_restorefunction _of_ti_gate_clk_setupfunction _of_ti_composite_gate_clk_setupfunction of_ti_composite_no_wait_gate_clk_setupfunction of_ti_composite_interface_clk_setupfunction of_ti_composite_gate_clk_setupfunction of_ti_clkdm_gate_clk_setupfunction of_ti_hsdiv_gate_clk_setupfunction of_ti_gate_clk_setupfunction of_ti_wait_gate_clk_setupfunction of_ti_am35xx_gate_clk_setupfunction of_ti_dss_gate_clk_setup
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* OMAP gate clock support
*
* Copyright (C) 2013 Texas Instruments, Inc.
*
* Tero Kristo <t-kristo@ti.com>
*/
#include <linux/clk-provider.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/clk/ti.h>
#include "clock.h"
#undef pr_fmt
#define pr_fmt(fmt) "%s: " fmt, __func__
static int omap36xx_gate_clk_enable_with_hsdiv_restore(struct clk_hw *clk);
static const struct clk_ops omap_gate_clkdm_clk_ops = {
.init = &omap2_init_clk_clkdm,
.enable = &omap2_clkops_enable_clkdm,
.disable = &omap2_clkops_disable_clkdm,
.restore_context = clk_gate_restore_context,
};
const struct clk_ops omap_gate_clk_ops = {
.init = &omap2_init_clk_clkdm,
.enable = &omap2_dflt_clk_enable,
.disable = &omap2_dflt_clk_disable,
.is_enabled = &omap2_dflt_clk_is_enabled,
.restore_context = clk_gate_restore_context,
};
static const struct clk_ops omap_gate_clk_hsdiv_restore_ops = {
.init = &omap2_init_clk_clkdm,
.enable = &omap36xx_gate_clk_enable_with_hsdiv_restore,
.disable = &omap2_dflt_clk_disable,
.is_enabled = &omap2_dflt_clk_is_enabled,
.restore_context = clk_gate_restore_context,
};
/**
* omap36xx_gate_clk_enable_with_hsdiv_restore - enable clocks suffering
* from HSDivider PWRDN problem Implements Errata ID: i556.
* @hw: DPLL output struct clk_hw
*
* 3630 only: dpll3_m3_ck, dpll4_m2_ck, dpll4_m3_ck, dpll4_m4_ck,
* dpll4_m5_ck & dpll4_m6_ck dividers gets loaded with reset
* valueafter their respective PWRDN bits are set. Any dummy write
* (Any other value different from the Read value) to the
* corresponding CM_CLKSEL register will refresh the dividers.
*/
static int omap36xx_gate_clk_enable_with_hsdiv_restore(struct clk_hw *hw)
{
struct clk_omap_divider *parent;
struct clk_hw *parent_hw;
u32 dummy_v, orig_v;
int ret;
/* Clear PWRDN bit of HSDIVIDER */
ret = omap2_dflt_clk_enable(hw);
/* Parent is the x2 node, get parent of parent for the m2 div */
parent_hw = clk_hw_get_parent(clk_hw_get_parent(hw));
parent = to_clk_omap_divider(parent_hw);
/* Restore the dividers */
if (!ret) {
orig_v = ti_clk_ll_ops->clk_readl(&parent->reg);
dummy_v = orig_v;
/* Write any other value different from the Read value */
dummy_v ^= (1 << parent->shift);
ti_clk_ll_ops->clk_writel(dummy_v, &parent->reg);
/* Write the original divider */
ti_clk_ll_ops->clk_writel(orig_v, &parent->reg);
}
return ret;
}
static struct clk *_register_gate(struct device_node *node, const char *name,
const char *parent_name, unsigned long flags,
struct clk_omap_reg *reg, u8 bit_idx,
Annotation
- Immediate include surface: `linux/clk-provider.h`, `linux/slab.h`, `linux/io.h`, `linux/of.h`, `linux/of_address.h`, `linux/clk/ti.h`, `clock.h`.
- Detected declarations: `function omap36xx_gate_clk_enable_with_hsdiv_restore`, `function _of_ti_gate_clk_setup`, `function _of_ti_composite_gate_clk_setup`, `function of_ti_composite_no_wait_gate_clk_setup`, `function of_ti_composite_interface_clk_setup`, `function of_ti_composite_gate_clk_setup`, `function of_ti_clkdm_gate_clk_setup`, `function of_ti_hsdiv_gate_clk_setup`, `function of_ti_gate_clk_setup`, `function of_ti_wait_gate_clk_setup`.
- Atlas domain: Driver Families / drivers/clk.
- 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.