arch/arm/mach-omap1/clock.c
Source file repositories/reference/linux-study-clean/arch/arm/mach-omap1/clock.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/mach-omap1/clock.c- Extension
.c- Size
- 21663 bytes
- Lines
- 848
- Domain
- Architecture Layer
- Bucket
- arch/arm
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- 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
linux/kernel.hlinux/export.hlinux/list.hlinux/errno.hlinux/err.hlinux/io.hlinux/clk.hlinux/clkdev.hlinux/clk-provider.hlinux/soc/ti/omap1-io.hlinux/spinlock.hasm/mach-types.hhardware.hsoc.hiomap.hclock.hopp.hsram.h
Detected Declarations
function omap1_uart_recalcfunction omap1_sossi_recalcfunction omap1_clk_allow_idlefunction omap1_clk_deny_idlefunction verify_ckctl_valuefunction calc_dsor_expfunction omap1_ckctl_recalcfunction omap1_clk_is_enabledfunction omap1_ckctl_recalc_dsp_domainfunction omap1_select_table_ratefunction omap1_clk_set_rate_dsp_domainfunction omap1_clk_round_rate_ckctl_armfunction omap1_clk_set_rate_ckctl_armfunction omap1_round_to_table_ratefunction calc_ext_dsorfunction omap1_round_uart_ratefunction omap1_set_uart_ratefunction omap1_set_ext_clk_ratefunction calc_div_sossifunction omap1_round_sossi_ratefunction omap1_set_sossi_ratefunction omap1_round_ext_clk_ratefunction omap1_init_ext_clkfunction omap1_clk_enablefunction omap1_clk_disablefunction omap1_clk_enable_genericfunction omap1_clk_disable_genericfunction omap1_clk_enable_dsp_domainfunction omap1_clk_disable_dsp_domainfunction omap1_clk_enable_uart_functional_16xxfunction omap1_clk_disable_uart_functional_16xxfunction omap1_clk_recalc_ratefunction omap1_clk_determine_ratefunction omap1_clk_set_ratefunction omap1_clk_init_opfunction omap1_clk_disable_unusedfunction followparent_recalcfunction omap_fixed_divisor_recalcfunction propagate_rate
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* linux/arch/arm/mach-omap1/clock.c
*
* Copyright (C) 2004 - 2005, 2009-2010 Nokia Corporation
* Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
*
* Modified to use omap shared clock framework by
* Tony Lindgren <tony@atomide.com>
*/
#include <linux/kernel.h>
#include <linux/export.h>
#include <linux/list.h>
#include <linux/errno.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/clk.h>
#include <linux/clkdev.h>
#include <linux/clk-provider.h>
#include <linux/soc/ti/omap1-io.h>
#include <linux/spinlock.h>
#include <asm/mach-types.h>
#include "hardware.h"
#include "soc.h"
#include "iomap.h"
#include "clock.h"
#include "opp.h"
#include "sram.h"
__u32 arm_idlect1_mask;
/* provide direct internal access (not via clk API) to some clocks */
struct omap1_clk *api_ck_p, *ck_dpll1_p, *ck_ref_p;
/* protect registeres shared among clk_enable/disable() and clk_set_rate() operations */
static DEFINE_SPINLOCK(arm_ckctl_lock);
static DEFINE_SPINLOCK(arm_idlect2_lock);
static DEFINE_SPINLOCK(mod_conf_ctrl_0_lock);
static DEFINE_SPINLOCK(mod_conf_ctrl_1_lock);
static DEFINE_SPINLOCK(swd_clk_div_ctrl_sel_lock);
/*
* Omap1 specific clock functions
*/
unsigned long omap1_uart_recalc(struct omap1_clk *clk, unsigned long p_rate)
{
unsigned int val = __raw_readl(clk->enable_reg);
return val & 1 << clk->enable_bit ? 48000000 : 12000000;
}
unsigned long omap1_sossi_recalc(struct omap1_clk *clk, unsigned long p_rate)
{
u32 div = omap_readl(MOD_CONF_CTRL_1);
div = (div >> 17) & 0x7;
div++;
return p_rate / div;
}
static void omap1_clk_allow_idle(struct omap1_clk *clk)
{
struct arm_idlect1_clk * iclk = (struct arm_idlect1_clk *)clk;
if (!(clk->flags & CLOCK_IDLE_CONTROL))
return;
if (iclk->no_idle_count > 0 && !(--iclk->no_idle_count))
arm_idlect1_mask |= 1 << iclk->idlect_shift;
}
static void omap1_clk_deny_idle(struct omap1_clk *clk)
{
struct arm_idlect1_clk * iclk = (struct arm_idlect1_clk *)clk;
if (!(clk->flags & CLOCK_IDLE_CONTROL))
return;
if (iclk->no_idle_count++ == 0)
arm_idlect1_mask &= ~(1 << iclk->idlect_shift);
}
static __u16 verify_ckctl_value(__u16 newval)
{
/* This function checks for following limitations set
* by the hardware (all conditions must be true):
* DSPMMU_CK == DSP_CK or DSPMMU_CK == DSP_CK/2
* ARM_CK >= TC_CK
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/export.h`, `linux/list.h`, `linux/errno.h`, `linux/err.h`, `linux/io.h`, `linux/clk.h`, `linux/clkdev.h`.
- Detected declarations: `function omap1_uart_recalc`, `function omap1_sossi_recalc`, `function omap1_clk_allow_idle`, `function omap1_clk_deny_idle`, `function verify_ckctl_value`, `function calc_dsor_exp`, `function omap1_ckctl_recalc`, `function omap1_clk_is_enabled`, `function omap1_ckctl_recalc_dsp_domain`, `function omap1_select_table_rate`.
- Atlas domain: Architecture Layer / arch/arm.
- Implementation status: source 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.