Merge tag 'for-linus-v3.10-rc4-crc-xattr-fixes' of git://oss.sgi.com/xfs/xfs
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / mn10300 / kernel / profile.c
CommitLineData
b920de1b
DH
1/* MN10300 Profiling setup
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12/*
13 * initialise the profiling if enabled
14 * - using with gdbstub will give anomalous results
15 * - can't be used with gdbstub if running at IRQ priority 0
16 */
17static __init int profile_init(void)
18{
19 u16 tmp;
20
21 if (!prof_buffer)
22 return 0;
23
24 /* use timer 11 to drive the profiling interrupts */
25 set_intr_stub(EXCEP_IRQ_LEVEL0, profile_handler);
26
27 /* set IRQ priority at which to run */
28 set_intr_level(TM11IRQ, GxICR_LEVEL_0);
29
30 /* set up timer 11
31 * - source: (IOCLK 33MHz)*2 = 66MHz
32 * - frequency: (33330000*2) / 8 / 20625 = 202Hz
33 */
34 TM11BR = 20625 - 1;
35 TM11MD = TM8MD_SRC_IOCLK_8;
36 TM11MD |= TM8MD_INIT_COUNTER;
37 TM11MD &= ~TM8MD_INIT_COUNTER;
38 TM11MD |= TM8MD_COUNT_ENABLE;
39
40 TM11ICR |= GxICR_ENABLE;
41 tmp = TM11ICR;
42
43 printk(KERN_INFO "Profiling initiated on timer 11, priority 0, %uHz\n",
368dd5ac 44 MN10300_IOCLK / 8 / (TM11BR + 1));
b920de1b
DH
45 printk(KERN_INFO "Profile histogram stored %p-%p\n",
46 prof_buffer, (u8 *)(prof_buffer + prof_len) - 1);
47
48 return 0;
49}
50
51__initcall(profile_init);