Changeset 08d059a in mainline


Ignore:
Timestamp:
2012-03-13T04:08:21Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d1714e8
Parents:
08a2007
Message:

amdm37x_gpt: Fix timer setup.

Qemu does not support advanced timer functionality, so I can't tell whether it will work as expected. The numbers look correct though.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/include/drivers/amdm37x_gpt/amdm37x_gpt.h

    r08a2007 r08d059a  
    202202        timer->regs = (void*) km_map(ioregs, iosize, PAGE_NOT_CACHEABLE);
    203203
    204         /* Set tldr and tccr */
    205         timer->regs->tldr = 0xffffffff - 32768 / hz;
    206         timer->regs->tccr = 0xffffffff - 32768 / hz;
    207204
    208205        /* Set autoreload */
     
    213210            (ioregs == AMDM37x_GPT2_BASE_ADDRESS) ||
    214211            (ioregs == AMDM37x_GPT10_BASE_ADDRESS));
     212        timer->regs->tldr = 0xffffffff - (32768 / hz) + 1;
     213        if (timer->special_available) {
     214                /* Set values for according to formula (manual p. 2733) */
     215                const uint32_t tpir =
     216                    ((32768 / hz + 1) * 1000000) - (32768000L * (1000 / hz));
     217                const uint32_t tnir =
     218                    ((32768 / hz) * 1000000) - (32768000 * (1000 / hz));
     219                timer->regs->tpir = tpir;
     220                timer->regs->tnir = tnir;
     221        }
    215222
    216223}
Note: See TracChangeset for help on using the changeset viewer.