| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) ST-Ericsson SA 2011 |
|---|
| 3 | 4 | * |
|---|
| 4 | | - * License Terms: GNU General Public License v2 |
|---|
| 5 | 5 | * Author: Mattias Wallin <mattias.wallin@stericsson.com> for ST-Ericsson |
|---|
| 6 | 6 | * Author: Sundar Iyer for ST-Ericsson |
|---|
| 7 | 7 | * sched_clock implementation is based on: |
|---|
| .. | .. |
|---|
| 15 | 15 | #include <linux/of.h> |
|---|
| 16 | 16 | #include <linux/of_address.h> |
|---|
| 17 | 17 | #include <linux/clockchips.h> |
|---|
| 18 | | -#include <linux/sched_clock.h> |
|---|
| 19 | 18 | |
|---|
| 20 | 19 | #define RATE_32K 32768 |
|---|
| 21 | 20 | |
|---|
| .. | .. |
|---|
| 25 | 24 | #define PRCMU_TIMER_REF 0 |
|---|
| 26 | 25 | #define PRCMU_TIMER_DOWNCOUNT 0x4 |
|---|
| 27 | 26 | #define PRCMU_TIMER_MODE 0x8 |
|---|
| 28 | | - |
|---|
| 29 | | -#define SCHED_CLOCK_MIN_WRAP 131072 /* 2^32 / 32768 */ |
|---|
| 30 | 27 | |
|---|
| 31 | 28 | static void __iomem *clksrc_dbx500_timer_base; |
|---|
| 32 | 29 | |
|---|
| .. | .. |
|---|
| 46 | 43 | |
|---|
| 47 | 44 | static struct clocksource clocksource_dbx500_prcmu = { |
|---|
| 48 | 45 | .name = "dbx500-prcmu-timer", |
|---|
| 49 | | - .rating = 300, |
|---|
| 46 | + .rating = 100, |
|---|
| 50 | 47 | .read = clksrc_dbx500_prcmu_read, |
|---|
| 51 | 48 | .mask = CLOCKSOURCE_MASK(32), |
|---|
| 52 | | - .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
|---|
| 49 | + .flags = CLOCK_SOURCE_IS_CONTINUOUS | CLOCK_SOURCE_SUSPEND_NONSTOP, |
|---|
| 53 | 50 | }; |
|---|
| 54 | | - |
|---|
| 55 | | -#ifdef CONFIG_CLKSRC_DBX500_PRCMU_SCHED_CLOCK |
|---|
| 56 | | - |
|---|
| 57 | | -static u64 notrace dbx500_prcmu_sched_clock_read(void) |
|---|
| 58 | | -{ |
|---|
| 59 | | - if (unlikely(!clksrc_dbx500_timer_base)) |
|---|
| 60 | | - return 0; |
|---|
| 61 | | - |
|---|
| 62 | | - return clksrc_dbx500_prcmu_read(&clocksource_dbx500_prcmu); |
|---|
| 63 | | -} |
|---|
| 64 | | - |
|---|
| 65 | | -#endif |
|---|
| 66 | 51 | |
|---|
| 67 | 52 | static int __init clksrc_dbx500_prcmu_init(struct device_node *node) |
|---|
| 68 | 53 | { |
|---|
| .. | .. |
|---|
| 81 | 66 | writel(TIMER_DOWNCOUNT_VAL, |
|---|
| 82 | 67 | clksrc_dbx500_timer_base + PRCMU_TIMER_REF); |
|---|
| 83 | 68 | } |
|---|
| 84 | | -#ifdef CONFIG_CLKSRC_DBX500_PRCMU_SCHED_CLOCK |
|---|
| 85 | | - sched_clock_register(dbx500_prcmu_sched_clock_read, 32, RATE_32K); |
|---|
| 86 | | -#endif |
|---|
| 87 | 69 | return clocksource_register_hz(&clocksource_dbx500_prcmu, RATE_32K); |
|---|
| 88 | 70 | } |
|---|
| 89 | 71 | TIMER_OF_DECLARE(dbx500_prcmu, "stericsson,db8500-prcmu-timer-4", |
|---|