Ignore:
Timestamp:
11/10/11 08:44:37 (11 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
742a2ba
Parents:
5c0fb7c
Message:

2011-11-10 Sebastian Huber <sebastian.huber@…>

PR 1927/bsps:

  • mpc83xx/network/tsec.c: Fixed integer truncation.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libcpu/powerpc/mpc83xx/network/tsec.c

    r5c0fb7c rf0e748c  
    332332\*=========================================================================*/
    333333{
    334   static const uint8_t divider [] = { 64, 64, 96, 128, 160, 224, 320, 448 };
     334  static const uint8_t divider [] = { 32, 32, 48, 64, 80, 112, 160, 224 };
    335335  size_t n = sizeof(divider) / sizeof(divider [0]);
    336336  size_t i = 0;
    337   uint32_t clock = UINT32_MAX;
     337  uint32_t mii_clock = UINT32_MAX;
     338  uint32_t tsec_system_clock = BSP_bus_frequency / 2;
    338339
    339340  /* Set TSEC registers for MDIO communication */
     
    342343   * set clock divider
    343344   */
    344   for (i = 0; i < n && clock > 2500000; ++i) {
    345     clock = BSP_bus_frequency / divider [i];
     345  for (i = 0; i < n && mii_clock > 2500000; ++i) {
     346    mii_clock = tsec_system_clock / divider [i];
    346347  }
    347348
Note: See TracChangeset for help on using the changeset viewer.