3 * Daniel Engström, Omicron Ceti AB <daniel@omicron.se>.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 /* stuff specific for the sc520, but independent of implementation */
27 #include <asm/interrupt.h>
28 #include <asm/ic/sc520.h>
30 void reset_timer(void)
32 write_mmcr_word(SC520_GPTMR0CNT, 0);
33 write_mmcr_word(SC520_GPTMR0CTL, 0x6001);
37 ulong get_timer(ulong base)
40 return read_mmcr_word(SC520_GPTMR0CNT) / 33;
43 void set_timer(ulong t)
45 /* FixMe: use two cascade coupled timers */
46 write_mmcr_word(SC520_GPTMR0CTL, 0x4001);
47 write_mmcr_word(SC520_GPTMR0CNT, t*33);
48 write_mmcr_word(SC520_GPTMR0CTL, 0x6001);
52 void udelay(unsigned long usec)
57 read_mmcr_word(SC520_SWTMRMILLI);
58 read_mmcr_word(SC520_SWTMRMICRO);
61 /* do not enable this line, udelay is used in the serial driver -> recursion */
62 printf("udelay: %ld m.u %d.%d tm.tu %d.%d\n", usec, m, u, tm, tu);
66 m += read_mmcr_word(SC520_SWTMRMILLI);
67 u = read_mmcr_word(SC520_SWTMRMICRO) + (m * 1000);