/* MN10300 Profiling setup1*2* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.3* Written by David Howells ([email protected])4*5* This program is free software; you can redistribute it and/or6* modify it under the terms of the GNU General Public Licence7* as published by the Free Software Foundation; either version8* 2 of the Licence, or (at your option) any later version.9*/1011/*12* initialise the profiling if enabled13* - using with gdbstub will give anomalous results14* - can't be used with gdbstub if running at IRQ priority 015*/16static __init int profile_init(void)17{18u16 tmp;1920if (!prof_buffer)21return 0;2223/* use timer 11 to drive the profiling interrupts */24set_intr_stub(EXCEP_IRQ_LEVEL0, profile_handler);2526/* set IRQ priority at which to run */27set_intr_level(TM11IRQ, GxICR_LEVEL_0);2829/* set up timer 1130* - source: (IOCLK 33MHz)*2 = 66MHz31* - frequency: (33330000*2) / 8 / 20625 = 202Hz32*/33TM11BR = 20625 - 1;34TM11MD = TM8MD_SRC_IOCLK_8;35TM11MD |= TM8MD_INIT_COUNTER;36TM11MD &= ~TM8MD_INIT_COUNTER;37TM11MD |= TM8MD_COUNT_ENABLE;3839TM11ICR |= GxICR_ENABLE;40tmp = TM11ICR;4142printk(KERN_INFO "Profiling initiated on timer 11, priority 0, %uHz\n",43MN10300_IOCLK / 8 / (TM11BR + 1));44printk(KERN_INFO "Profile histogram stored %p-%p\n",45prof_buffer, (u8 *)(prof_buffer + prof_len) - 1);4647return 0;48}4950__initcall(profile_init);515253