ARM: kernel: fix system_time() when being called too early.
This commit is contained in:
parent
09d213f3b3
commit
34ed0fe74a
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#define PXA_TIMERS_PHYS_BASE 0x40A00000
|
#define PXA_TIMERS_PHYS_BASE 0x40A00000
|
||||||
#define PXA_TIMERS_SIZE 0x000000C0
|
#define PXA_TIMERS_SIZE B_PAGE_SIZE
|
||||||
#define PXA_TIMERS_INTERRUPT 7 /* OST_4_11 */
|
#define PXA_TIMERS_INTERRUPT 7 /* OST_4_11 */
|
||||||
|
|
||||||
#define PXA_OSSR 0x05
|
#define PXA_OSSR 0x05
|
||||||
@ -48,7 +48,7 @@
|
|||||||
#define US2S(bt) ((bt) / 1000000ULL)
|
#define US2S(bt) ((bt) / 1000000ULL)
|
||||||
#define US2MS(bt) ((bt) / 1000ULL)
|
#define US2MS(bt) ((bt) / 1000ULL)
|
||||||
|
|
||||||
static area_id sPxaTimersArea = B_ERROR;
|
static area_id sPxaTimersArea = -1;
|
||||||
static uint32 *sPxaTimersBase = NULL;
|
static uint32 *sPxaTimersBase = NULL;
|
||||||
static bigtime_t sSystemTime = 0;
|
static bigtime_t sSystemTime = 0;
|
||||||
|
|
||||||
@ -107,6 +107,7 @@ arch_timer_clear_hardware_timer()
|
|||||||
int
|
int
|
||||||
arch_init_timer(kernel_args *args)
|
arch_init_timer(kernel_args *args)
|
||||||
{
|
{
|
||||||
|
TRACE(("%s\n", __func__));
|
||||||
sPxaTimersArea = map_physical_memory("pxa_timers", PXA_TIMERS_PHYS_BASE,
|
sPxaTimersArea = map_physical_memory("pxa_timers", PXA_TIMERS_PHYS_BASE,
|
||||||
PXA_TIMERS_SIZE, 0, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, (void**)&sPxaTimersBase);
|
PXA_TIMERS_SIZE, 0, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, (void**)&sPxaTimersBase);
|
||||||
|
|
||||||
@ -126,6 +127,9 @@ arch_init_timer(kernel_args *args)
|
|||||||
bigtime_t
|
bigtime_t
|
||||||
system_time(void)
|
system_time(void)
|
||||||
{
|
{
|
||||||
|
if (sPxaTimersArea < 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
return (sPxaTimersBase != NULL) ?
|
return (sPxaTimersBase != NULL) ?
|
||||||
sSystemTime + sPxaTimersBase[PXA_OSCR5] :
|
sSystemTime + sPxaTimersBase[PXA_OSCR5] :
|
||||||
0ULL;
|
0ULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user