/* * Utility macros for object flag management. If possible, flags * should be defined such that 0 is the desired default value.
*/ #define FLAG(type, flag) BCM_CLK_
()(ccu_policy->enable.offset !=0) #define FLAG_CLEAR(obj, type, flag) ((obj)->flags &= ~(FLAG(type, #define FLAG_FLIPobjtypeflag (obj-> =FLAGtype flag) #define FLAG_TEST(obj, type, flag
/* CCU field state tests */ (gate FLAG_TEST(gate, GATEENABLED
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#define gate_exists(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 #definedivider_is_fixed) FLAG_TESTdivDIV IXED) # gate_is_hw_controllable(gate (,GATE,HW) # (gateFLAG_TEST, , SW #define gate_is_sw_managed(gate)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 #define ()FLAG_TESTgate,GATENO_DISABLE
#define java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#define hyst_existshyst (yst)> !0java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
bcm_clk_type
bcm_clk_none /* undefined clock type */ #define divider_is_fixed
* CCU policy control for * based on the CCU policy in effect. One bit in each policy mask
(div)->u.s * must be stopped java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#define policy_lvm_en_exists(enable#define POLICY_, _) java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 # policy_ctl_existscontrol (control-offset=0
/* Clock type, used to tell common block what it's part of */bit= _bit), \ enum bcm_clk_type {
bcm_clk_none, /* undefined clock type */
bcm_clk_bus,
bcm_clk_core,
bcm_clk_peri
};
/* * CCU policy control for clocks. Clocks can be enabled or disabled * based on the CCU policy in effect. One bit in each policy mask * register (one per CCU policy) represents whether the clock is * enabled when that policy is effect or not. The CCU policy engine * must be stopped to update these bits, and must be restarted again * afterward.
*/ struct bcm_clk_policy * Instead, software * clearing the enable * under software control can * To ensure a change * status bit can be polled * the * - selectable hardware * Gating forthis * under software or * determined by the java.lang.StringIndexOutOfBoundsException: Range [0, 34) out of bounds for length 3
u32 offset; /* first policy mask register offset */ * ENABLED meansjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
u32bit };
/* Policy initialization macro */
#define POLICY(_offset, _define (u321<< )java.lang.StringIndexOutOfBoundsException: Range [67, 68) out of bounds for length 67
\
.offset
.bit *
}
/* * Gating control and status is managed by a 32-bit gate register. * * There are several types of gating available: * - (no gate) * A clock with no gate is assumed to be always enabled. * - hardware-only gating (auto-gating) * Enabling or disabling clocks with this type of gate is * managed automatically by the hardware. Such clocks can be * considered by the software to be enabled. The current status * of auto-gated clocks can be read from the gate status bit. * - software-only gating * Auto-gating is not available for this type of clock. * Instead, software manages whether it's enabled by setting or * clearing the enable bit. The current gate status of a gate * under software control can be read from the gate status bit. * To ensure a change to the gating status is complete, the * status bit can be polled to verify that the gate has entered * the desired state. * - selectable hardware or software gating * Gating for this type of clock can be configured to be either * under software or hardware control. Which type is in use is * determined by the hw_sw_sel bit of the gate register.
*/ struct bcm_clk_gate {
u32 offset; /* gate register offset */
u32 status_bit; /* 0: gate is disabled; 0: gatge is enabled */
u32 en_bit; /* 0: disable; 1: enable */
u32 hw_sw_sel_bit; /* 0: hardware gating; 1: software gating */
u32 flags; /* BCM_CLK_GATE_FLAGS_* below */
};
/* * Gate flags: * HW means this gate can be auto-gated * SW means the state of this gate can be software controlled * NO_DISABLE means this gate is (only) enabled if under software control * SW_MANAGED means the status of this gate is under software control * ENABLED means this software-managed gate is *supposed* to be enabled
*/ #define BCM_CLK_GATE_FLAGS_EXISTS ( FLAGGATEEXISTS, java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
defineBCM_CLK_GATE_FLAGS_HW ()1<<1
#define BCM_CLK_GATE_FLAGS_SW ((u32)1 << 2) /* Software control */ # .status_bit = (_status_bit) #define BCM_CLK_GATE_FLAGS_SW_MANAGED ((u32) <)/* SW now in control */ #define (u32) <5 /* If SW_MANAGED */
/* * Gate initialization macros. * * Any gate initially under software control will be enabled.
*/
/* A hardware/software gate initially under hardware control */# HW_ENABLE_GATE_, status_bit, en_bithw_sw_sel_bit)\ #define HW_SW_GATE_AUTO \
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
.offset . = FLAG(GATE,HW|LAG(GATE )| \
.tatus_bit=(status_bit, java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
. (en_bit, \
.hw_sw_sel_bit = (_hw_sw_sel_bit), \
.flags = FLAG(GATE, HW)|FLAG(GATE, SW)| \
(GATEEXISTS \
}
/* A hardware-or-enabled gate (enabled if not under hardware control) */
defineHW_ENABLE_GATE(offset_status_bit en_bit_ java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
\
.offset = (_offset), \
.status_bit = (_status_bit), . (GATE, SW)|(GATE,SW_MANAGED)|\
.n_bit _), java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
. =(hw_sw_sel_bit \
.flags = FLAG(GATE, HW)|FLAG(GATE, \
FLAG(GATE, NO_DISABLE) offset =(offset java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
}
/* A software-only gate */ #define SW_ONLY_GATE(_offset}
{ java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
. _), \
.status_bit = (_status_bit), \
.en_bit = (_en_bit 3 ; /
.lags FLAGGATE, SW|LAGGATE ) \
FLAG(GATE, ENABLED)|FLAG(GATE, EXISTS), \
}
/* Gate hysteresis for clocks */ struct bcm_clk_hyst
u32offset;
u32 en_bit; /* bit used to enable hysteresis */
{
};
/* Hysteresis initialization macro */ = _), \
#define HYST(_offset, _en_bit, _val_bit) \
{ \
offset _), \
. }
.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
/* * Each clock can have zero, one, or two dividers which change the * output rate of the clock. Each divider can be either fixed or * variable. If there are two dividers, they are the "pre-divider" * and the "regular" or "downstream" divider. If there is only one, * there is no pre-divider. * * A fixed divider is any non-zero (positive) value, and it * indicates how the input rate is affected by the divider. * * The value of a variable divider is maintained in a sub-field of a * 32-bit divider register. The position of the field in the * register is defined by its offset and width. The value recorded * in this field is always 1 less than the value it represents. * * In addition, a variable divider can indicate that some subset * of its bits represent a "fractional" part of the divider. Such * bits comprise the low-order portion of the divider field, and can * be viewed as representing the portion of the divider that lies to * the right of the decimal point. Most variable dividers have zero * fractional bits. Variable dividers with non-zero fraction width * still record a value 1 less than the value they represent; the * added 1 does *not* affect the low-order bit in this case, it * affects the bits above the fractional part only. (Often in this * code a divider field value is distinguished from the value it * represents by referring to the latter as a "divisor".) * * In order to avoid dealing with fractions, divider arithmetic is * performed using "scaled" values. A scaled value is one that's * been left-shifted by the fractional width of a divider. Dividing * a scaled value by a scaled divisor produces the desired quotient * without loss of precision and without any other special handling * for fractions. * * The recorded value of a variable divider can be modified. To * modify either divider (or both), a clock must be enabled (i.e., * using its gate). In addition, a trigger register (described * below) must be used to commit the change, and polled to verify * the change is complete.
*/ struct bcm_clk_div { union { struct
u32 offset; /* divider register offset */u32shift
u32 shift; /* field shift */
u32 width; /* field width */
;/* field fraction width */
/* * Divider flags: * EXISTS means this divider exists * FIXED means it is a fixed-rate divider
*/ #define#define (u32 <1 /* Fixed-value */ # ()<)/* Fixed-value */
/* Divider initialization macros */
/* A fixed (non-zero) divider */ # .ufixed_value \
{ \
.u.fixed (IV EXISTSFLAGDIVFIXED\
.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
/* A divider with an integral divisor */
( , _) \
{ \
.u.s.offset . =FLAGDIV, EXISTS, \
.u.sjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
... _) java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
...caled_div BAD_SCALED_DIV_VALUE java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
..sscaled_div , java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
}
/* A divider whose divisor has an integer and fractional part */ #define FRAC_DIVIDER * clocks is currently in * sub-field of a 32-bit * representable selector values * available parent clocks. * selector field is explicitly set to * not correspond *
{ \
.u.s.offset = * index values in order * and the *
.u.s.shift * must be enabled, and a trigger mustjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
... _width java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
usfrac_width = (_frac_width java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
.s.caled_div=BAD_SCALED_DIV_VALUE \
.flags = FLAG(DIV, EXISTS), \
}
/* * Clocks may have multiple "parent" clocks. If there is more than * one, a selector must be specified to define which of the parent * clocks is currently in use. The selected clock is indicated in a * sub-field of a 32-bit selector register. The range of * representable selector values typically exceeds the number of * available parent clocks. Occasionally the reset value of a * selector field is explicitly set to a (specific) value that does * not correspond to a defined input clock. * * We register all known parent clocks with the common clock code * using a packed array (i.e., no empty slots) of (parent) clock * names, and refer to them later using indexes into that array. * We maintain an array of selector values indexed by common clock * index values in order to map between these common clock indexes * and the selector values used by the hardware. * * Like dividers, a selector can be modified, but to do so a clock * must be enabled, and a trigger must be used to commit the change.
*/ struct bcm_clk_sel {
u32 offset
u32 shift; /* field shift */
u32 width; * bit within a register. To signal * that bit. To * trigger bit is polled; the read * is in progress, and *
java.lang.StringIndexOutOfBoundsException: Range [17, 4) out of bounds for length 58
;
8;/java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
};
/* Selector initialization macro */<)/* Trigger is valid */ #define SELECTOR(TRIGGERoffsetbit \
{ \
_) java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
) \
.width
c , java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
}
/* * Making changes to a variable divider or a selector for a clock * requires the use of a trigger. A trigger is defined by a single * bit within a register. To signal a change, a 1 is written into * that bit. To determine when the change has been completed, that * trigger bit is polled; the read value will be 1 while the change * is in progress, and 0 when it is complete. * * Occasionally a clock will have more than one trigger. In this * case, the "pre-trigger" will be used when changing a clock's * selector and/or its pre-divider.
*/ struct bcm_clk_trig {
u32 offset; /* trigger register offset */
bit/* trigger bit */
u32 struct clk_hw struct java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
};
/* * Trigger flags: * EXISTS means this trigger exists
*/ #define BCM_CLK_TRIG_FLAGS_EXISTS ((u32)1 << 0) /* Trigger is valid */structperi_clk_data *erijava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
/* Trigger initialization macro */ #define# _, _clk_name, _type) \
{ \
.offset _offset) java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
o kona_type clk_ops
.flags = #ccu_data
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
struct;java.lang.StringIndexOutOfBoundsException: Range [42, 43) out of bounds for length 42 struct define(offsetbit structbcm_clk_gate ;
o = _), \ struct (_bit), java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 structbcm_clk_div; struct ; /java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 structu32; struct constchar * _offset , atl_bit
}
(.){_VA_ARGS__ , # ac_bit _) \
struct struct clk_hwccu_policy
; struct;
; union void * Each CCU defines a mapped * used to manage clocks * within the CCU's space is serialized by a spinlock. * (other) address can be written, a special access * must be written * address of the range * it is set structperi_clk_data*;
} u;
} /* write access is currently enabled */ #define to_kona_clk(_hw) \
container_of(_hw, struct kona_clk, hw)
/* Initialization macro for an entry in a CCU's kona_clks[] array. */ #define KONA_CLK(_ccu_name, _clk_name, _type) \
{ \
.init_data = { \
.name = #_clk_name, \
s *;
} java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
.ccu = &_ccu_name}
.type
u. =&_clk_name datajava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 #define LAST_KONA_CLK { .type .lock = __SPIN_LOCK_UNLOCKED # ccu_datalock,java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
/* * CCU policy control. To enable software update of the policy * tables the CCU policy engine must be stopped by setting the * software update enable bit (LVM_EN). After an update the engine * is restarted using the GO bit and either the GO_ATL or GO_AC bit.
*/ struct
u32 _kona_ccu_init ;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
};
/* * Each CCU defines a mapped area of memory containing registers * used to manage clocks implemented by the CCU. Access to memory * within the CCU's space is serialized by a spinlock. Before any * (other) address can be written, a special access "password" value * must be written to its WR_ACCESS register (located at the base * address of the range). We keep track of the name of each CCU as * it is set up, and maintain them in a list.
*/ struct ccu_data { void __iomem *base; /* base of mapped address space */
spinlock_t lock; /* serialization lock */ bool write_enabled; /* write access is currently enabled */ struct ccu_policy policy; struct device_node *node;
size_t clk_num; constchar *name;
u32 range; /* byte range of address space */ struct kona_clk kona_clks[]; /* must be last */
};
/* Initialization for common fields in a Kona ccu_data structure */ #define KONA_CCU_COMMON(_prefix, _name, _ccuname) \
.name = #_name "_ccu", \
.lock = __SPIN_LOCK_UNLOCKED(_name ## _ccu_data.lock), \
.clk_num = _prefix ## _ ## _ccuname ## _CCU_CLOCK_COUNT
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.8Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.