realtek: timer: Register enabled scheduler clock
Before calling sched_clock_register(), the timer used to drive the
scheduling clock should already be enabled. Otherwise the kernel log
will show strange time jumps during, and the watchdog might not be
pinged in a timely fashion, resulting in reboots.
[    0.160281] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[   78.104319] clocksource: Switched to clocksource realtek_otto_timer
Fixes: 3cc8011171 ("realtek: resurrect timer driver")
Signed-off-by: Sander Vanheule <sander@svanheule.net>
			
			
This commit is contained in:
		 Sander Vanheule
					Sander Vanheule
				
			
				
					committed by
					
						 Olliver Schinagl
						Olliver Schinagl
					
				
			
			
				
	
			
			
			 Olliver Schinagl
						Olliver Schinagl
					
				
			
						parent
						
							a63430eac3
						
					
				
				
					commit
					38cba61bff
				
			| @@ -229,7 +229,6 @@ struct rttm_cs rttm_cs = { | |||||||
| 		.mask	= CLOCKSOURCE_MASK(RTTM_BIT_COUNT), | 		.mask	= CLOCKSOURCE_MASK(RTTM_BIT_COUNT), | ||||||
| 		.flags	= CLOCK_SOURCE_IS_CONTINUOUS, | 		.flags	= CLOCK_SOURCE_IS_CONTINUOUS, | ||||||
| 		.read	= rttm_read_clocksource, | 		.read	= rttm_read_clocksource, | ||||||
| 		.enable	= rttm_enable_clocksource |  | ||||||
| 	} | 	} | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -276,6 +275,7 @@ static int __init rttm_probe(struct device_node *np) | |||||||
| 	to->of_base.index = clkidx; | 	to->of_base.index = clkidx; | ||||||
| 	timer_of_init(np, to); | 	timer_of_init(np, to); | ||||||
| 	if (rttm_cs.to.of_base.base && rttm_cs.to.of_clk.rate) { | 	if (rttm_cs.to.of_base.base && rttm_cs.to.of_clk.rate) { | ||||||
|  | 		rttm_enable_clocksource(&rttm_cs.cs); | ||||||
| 		clocksource_register_hz(&rttm_cs.cs, RTTM_TICKS_PER_SEC); | 		clocksource_register_hz(&rttm_cs.cs, RTTM_TICKS_PER_SEC); | ||||||
| 		sched_clock_register(rttm_read_clock, RTTM_BIT_COUNT, RTTM_TICKS_PER_SEC); | 		sched_clock_register(rttm_read_clock, RTTM_BIT_COUNT, RTTM_TICKS_PER_SEC); | ||||||
| 	} else | 	} else | ||||||
|   | |||||||
| @@ -229,7 +229,6 @@ struct rttm_cs rttm_cs = { | |||||||
| 		.mask	= CLOCKSOURCE_MASK(RTTM_BIT_COUNT), | 		.mask	= CLOCKSOURCE_MASK(RTTM_BIT_COUNT), | ||||||
| 		.flags	= CLOCK_SOURCE_IS_CONTINUOUS, | 		.flags	= CLOCK_SOURCE_IS_CONTINUOUS, | ||||||
| 		.read	= rttm_read_clocksource, | 		.read	= rttm_read_clocksource, | ||||||
| 		.enable	= rttm_enable_clocksource |  | ||||||
| 	} | 	} | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -276,6 +275,7 @@ static int __init rttm_probe(struct device_node *np) | |||||||
| 	to->of_base.index = clkidx; | 	to->of_base.index = clkidx; | ||||||
| 	timer_of_init(np, to); | 	timer_of_init(np, to); | ||||||
| 	if (rttm_cs.to.of_base.base && rttm_cs.to.of_clk.rate) { | 	if (rttm_cs.to.of_base.base && rttm_cs.to.of_clk.rate) { | ||||||
|  | 		rttm_enable_clocksource(&rttm_cs.cs); | ||||||
| 		clocksource_register_hz(&rttm_cs.cs, RTTM_TICKS_PER_SEC); | 		clocksource_register_hz(&rttm_cs.cs, RTTM_TICKS_PER_SEC); | ||||||
| 		sched_clock_register(rttm_read_clock, RTTM_BIT_COUNT, RTTM_TICKS_PER_SEC); | 		sched_clock_register(rttm_read_clock, RTTM_BIT_COUNT, RTTM_TICKS_PER_SEC); | ||||||
| 	} else | 	} else | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user