diff options
Diffstat (limited to 'sys/arm/mv/discovery/discovery.c')
-rw-r--r-- | sys/arm/mv/discovery/discovery.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/arm/mv/discovery/discovery.c b/sys/arm/mv/discovery/discovery.c index c245fa9..5d41b92 100644 --- a/sys/arm/mv/discovery/discovery.c +++ b/sys/arm/mv/discovery/discovery.c @@ -226,3 +226,25 @@ const struct decode_win idma_win_tbl[] = { }; const struct decode_win *idma_wins = idma_win_tbl; int idma_wins_no = sizeof(idma_win_tbl) / sizeof(struct decode_win); + +uint32_t +get_tclk(void) +{ + uint32_t sar; + + /* + * On Discovery TCLK is can be configured to 166 MHz or 200 MHz. + * Current setting is read from Sample At Reset register. + */ + sar = bus_space_read_4(obio_tag, MV_MPP_BASE, SAMPLE_AT_RESET_HI); + sar = (sar & TCLK_MASK) >> TCLK_SHIFT; + + switch (sar) { + case 0: + return (TCLK_166MHZ); + case 1: + return (TCLK_200MHZ); + default: + panic("Unknown TCLK settings!"); + } +} |