Ignore:
Timestamp:
2013-02-13T20:19:29Z (11 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
06c4609
Parents:
4c754f6
Message:

fix sysclock frequency reading and print an error message is the operation was unsuccessful

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/include/drivers/am335x/ctrl_module.h

    r4c754f6 r0f66886  
    3737#define _KERN_AM335X_CTRL_MODULE_H_
    3838
     39#include <errno.h>
    3940#include <typedefs.h>
    4041#include "ctrl_module_regs.h"
     
    4546typedef ioport32_t am335x_ctrl_module_t;
    4647
    47 static unsigned am335x_ctrl_module_clock_freq_get(am335x_ctrl_module_t *base)
     48static int
     49am335x_ctrl_module_clock_freq_get(am335x_ctrl_module_t *base, unsigned *freq)
    4850{
    4951        unsigned const control_status = *AM335x_CTRL_MODULE_REG_ADDR(base,
    50             CONTROL_SYSCONFIG);
     52            CONTROL_STATUS);
    5153        unsigned const sysboot1 = (control_status >> 22) & 0x03;
    5254
    5355        switch (sysboot1) {
    5456        default:
     57                return EOK;
    5558        case 0:
    56                 return 19200000; /* 19.2 Mhz */
     59                *freq = 19200000; /* 19.2 Mhz */
    5760        case 1:
    58                 return 24000000; /* 24 Mhz */
     61                *freq = 24000000; /* 24 Mhz */
    5962        case 2:
    60                 return 25000000; /* 25 Mhz */
     63                *freq = 25000000; /* 25 Mhz */
    6164        case 3:
    62                 return 26000000; /* 26 Mhz */
     65                *freq = 26000000; /* 26 Mhz */
    6366        }
     67
     68        return EINVAL;
    6469}
    6570
Note: See TracChangeset for help on using the changeset viewer.