Ignore:
Timestamp:
2012-11-20T13:42:00Z (11 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.