Changeset 19acf24 in mainline


Ignore:
Timestamp:
2012-11-20T13:42:00Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bf6f6ca
Parents:
9c0eba6
Message:

rootamdm37x: Print Core clock and l3 interface clock values.

Location:
uspace/drv/infrastructure/rootamdm37x
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/infrastructure/rootamdm37x/cm/clock_control.h

    r9c0eba6 r19acf24  
    114114        ioport32_t clksel1_pll;
    115115#define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_CLKOUT_DIV_MASK   (0x1f << 27)
    116 #define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_CLKOUT_DIV_(x)   (((x) & 0x1f) << 27)
     116#define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_CLKOUT_DIV_CREATE(x)   (((x) & 0x1f) << 27)
     117#define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_CLKOUT_DIV_GET(x)   (((x) >> 27) & 0x1f)
    117118#define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_MULT_MASK   (0x7ff << 16)
    118 #define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_MULT(x)   (((x) & 0x7ff) << 16)
     119#define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_MULT_CREATE(x)   (((x) & 0x7ff) << 16)
     120#define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_MULT_GET(x)   (((x) >> 16) & 0x7ff)
    119121#define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_DIV_MASK   (0x7f << 8)
    120 #define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_DIV(x)   (((x) & 0x7f) << 8)
     122#define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_DIV_CREATE(x)   (((x) & 0x7f) << 8)
     123#define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_DIV_GET(x)   (((x) >> 8) & 0x7f)
    121124#define CLOCK_CONTROL_CM_CLKSEL1_PLL_SOURCE_96M_FLAG   (1 << 6)
    122125#define CLOCK_CONTROL_CM_CLKSEL1_PLL_SOURCE_54M_FLAG   (1 << 5)
  • uspace/drv/infrastructure/rootamdm37x/rootamdm37x.c

    r9c0eba6 r19acf24  
    227227         * interconnects.
    228228         */
     229        if (pio_read_32(&device->cm.clocks->idlest_ckgen) & CLOCK_CONTROL_CM_IDLEST_CKGEN_ST_CORE_CLK_FLAG) {
     230                /* DPLL active and locked */
     231                const uint32_t reg =
     232                    pio_read_32(&device->cm.clocks->clksel1_pll);
     233                const unsigned multiplier =
     234                    CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_MULT_GET(reg);
     235                const unsigned divisor =
     236                    CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_DIV_GET(reg);
     237                const unsigned divisor2 =
     238                    CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_CLKOUT_DIV_GET(reg);
     239                if (multiplier && divisor && divisor2) {
     240                        const unsigned freq =
     241                            ((base_freq / divisor) * multiplier) / divisor2;
     242                        ddf_msg(LVL_NOTE, "CORE CLK running at %d.%d MHz",
     243                            freq / 1000, freq % 1000);
     244                        const unsigned l3_div =
     245                            pio_read_32(&device->cm.core->clksel)
     246                            & CORE_CM_CLKSEL_CLKSEL_L3_MASK;
     247                        if (l3_div == CORE_CM_CLKSEL_CLKSEL_L3_DIVIDED1 ||
     248                            l3_div == CORE_CM_CLKSEL_CLKSEL_L3_DIVIDED2) {
     249                                ddf_msg(LVL_NOTE, "L3 interface at %d.%d MHz",
     250                                    (freq / l3_div) / 1000,
     251                                    (freq / l3_div) % 1000);
     252                        } else {
     253                                ddf_msg(LVL_WARN,"L3 interface clock divisor is"
     254                                    " invalid: %d", l3_div);
     255                        }
     256                } else {
     257                        ddf_msg(LVL_WARN, "DPLL3 frequency divisor and/or "
     258                            "multiplier value invalid: %d %d %d",
     259                            multiplier, divisor, divisor2);
     260                }
     261        } else {
     262                ddf_msg(LVL_WARN, "CORE CLK in bypass mode, fruunig at SYS_CLK"
     263                   " frreq of %d.%d MHz", base_freq / 1000, base_freq % 1000);
     264        }
    229265
    230266        /* Set DPLL3 to automatic to save power */
Note: See TracChangeset for help on using the changeset viewer.