Changeset fde2dab9 in mainline


Ignore:
Timestamp:
2012-11-20T14:57:30Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8138d4f
Parents:
bf2a269
Message:

rootamdm37x: Fix off by one freq calculations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/infrastructure/rootamdm37x/rootamdm37x.c

    rbf2a269 rfde2dab9  
    179179                                & MPU_CM_CLKSEL2_PLL_MPU_DPLL_CLKOUT_DIV_MASK);
    180180                        if (multiplier && divisor && divisor2) {
     181                                /** See AMDM37x TRM p. 300 for the formula */
    181182                                const unsigned freq =
    182                                     ((base_freq / divisor) * multiplier) / divisor2;
     183                                    ((base_freq * multiplier) / (divisor + 1))
     184                                    / divisor2;
    183185                                ddf_msg(LVL_NOTE, "MPU running at %d.%d MHz",
    184186                                    freq / 1000, freq % 1000);
     
    238240                    CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_CLKOUT_DIV_GET(reg);
    239241                if (multiplier && divisor && divisor2) {
     242                        /** See AMDM37x TRM p. 300 for the formula */
    240243                        const unsigned freq =
    241                             ((base_freq / divisor) * multiplier) / divisor2;
     244                            ((base_freq * multiplier) / (divisor + 1)) / divisor2;
    242245                        ddf_msg(LVL_NOTE, "CORE CLK running at %d.%d MHz",
    243246                            freq / 1000, freq % 1000);
     
    288291                & CLOCK_CONTROL_CM_CLKEN2_PLL_EN_PERIPH2_DPLL_MASK)
    289292            != CLOCK_CONTROL_CM_CLKEN2_PLL_EN_PERIPH2_DPLL_LOCK) {
    290                 /* Compute divisors and multiplier */
     293                /* Compute divisors and multiplier
     294                 * See AMDM37x TRM p. 300 for the formula */
    291295                assert((base_freq % 100) == 0);
    292296                const unsigned mult = 1200;
    293                 const unsigned div = base_freq / 100;
     297                const unsigned div = (base_freq / 100) - 1;
    294298                const unsigned div2 = 1;
    295299
Note: See TracChangeset for help on using the changeset viewer.