]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - arch/mips/kernel/csrc-sb1250.c
Merge remote-tracking branch 'powerpc/next'
[karo-tx-linux.git] / arch / mips / kernel / csrc-sb1250.c
index 6ecb77d820631972a8bf3494ffa7b9a56098b610..d915652b4d56f88585fdb16428c2761a85e32c11 100644 (file)
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 #include <linux/clocksource.h>
+#include <linux/sched_clock.h>
 
 #include <asm/addrspace.h>
 #include <asm/io.h>
  * The HPT is free running from SB1250_HPT_VALUE down to 0 then starts over
  * again.
  */
-static cycle_t sb1250_hpt_read(struct clocksource *cs)
+static inline cycle_t sb1250_hpt_get_cycles(void)
 {
        unsigned int count;
+       void __iomem *addr;
 
-       count = G_SCD_TIMER_CNT(__raw_readq(IOADDR(A_SCD_TIMER_REGISTER(SB1250_HPT_NUM, R_SCD_TIMER_CNT))));
+       addr = IOADDR(A_SCD_TIMER_REGISTER(SB1250_HPT_NUM, R_SCD_TIMER_CNT));
+       count = G_SCD_TIMER_CNT(__raw_readq(addr));
 
        return SB1250_HPT_VALUE - count;
 }
 
+static cycle_t sb1250_hpt_read(struct clocksource *cs)
+{
+       return sb1250_hpt_get_cycles();
+}
+
 struct clocksource bcm1250_clocksource = {
        .name   = "bcm1250-counter-3",
        .rating = 200,
@@ -50,6 +54,11 @@ struct clocksource bcm1250_clocksource = {
        .flags  = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
+static u64 notrace sb1250_read_sched_clock(void)
+{
+       return sb1250_hpt_get_cycles();
+}
+
 void __init sb1250_clocksource_init(void)
 {
        struct clocksource *cs = &bcm1250_clocksource;
@@ -66,4 +75,6 @@ void __init sb1250_clocksource_init(void)
                                                 R_SCD_TIMER_CFG)));
 
        clocksource_register_hz(cs, V_SCD_TIMER_FREQ);
+
+       sched_clock_register(sb1250_read_sched_clock, 23, V_SCD_TIMER_FREQ);
 }