Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm: zynq: Do not use xilinx specific function names

Remove all xilinx specific names from the driver
because this is generic driver for cadence ttc.
xttc->ttc
ttcps->ttc
...

No functional changes in this driver.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

+106 -106
+106 -106
arch/arm/mach-zynq/timer.c
··· 1 1 /* 2 - * This file contains driver for the Xilinx PS Timer Counter IP. 2 + * This file contains driver for the Cadence Triple Timer Counter Rev 06 3 3 * 4 4 * Copyright (C) 2011-2013 Xilinx 5 5 * ··· 42 42 * Timer Register Offset Definitions of Timer 1, Increment base address by 4 43 43 * and use same offsets for Timer 2 44 44 */ 45 - #define XTTCPS_CLK_CNTRL_OFFSET 0x00 /* Clock Control Reg, RW */ 46 - #define XTTCPS_CNT_CNTRL_OFFSET 0x0C /* Counter Control Reg, RW */ 47 - #define XTTCPS_COUNT_VAL_OFFSET 0x18 /* Counter Value Reg, RO */ 48 - #define XTTCPS_INTR_VAL_OFFSET 0x24 /* Interval Count Reg, RW */ 49 - #define XTTCPS_ISR_OFFSET 0x54 /* Interrupt Status Reg, RO */ 50 - #define XTTCPS_IER_OFFSET 0x60 /* Interrupt Enable Reg, RW */ 45 + #define TTC_CLK_CNTRL_OFFSET 0x00 /* Clock Control Reg, RW */ 46 + #define TTC_CNT_CNTRL_OFFSET 0x0C /* Counter Control Reg, RW */ 47 + #define TTC_COUNT_VAL_OFFSET 0x18 /* Counter Value Reg, RO */ 48 + #define TTC_INTR_VAL_OFFSET 0x24 /* Interval Count Reg, RW */ 49 + #define TTC_ISR_OFFSET 0x54 /* Interrupt Status Reg, RO */ 50 + #define TTC_IER_OFFSET 0x60 /* Interrupt Enable Reg, RW */ 51 51 52 - #define XTTCPS_CNT_CNTRL_DISABLE_MASK 0x1 52 + #define TTC_CNT_CNTRL_DISABLE_MASK 0x1 53 53 54 54 /* 55 55 * Setup the timers to use pre-scaling, using a fixed value for now that will ··· 62 62 #define CNT_CNTRL_RESET (1 << 4) 63 63 64 64 /** 65 - * struct xttcps_timer - This definition defines local timer structure 65 + * struct ttc_timer - This definition defines local timer structure 66 66 * 67 67 * @base_addr: Base address of timer 68 68 * @clk: Associated clock source 69 69 * @clk_rate_change_nb Notifier block for clock rate changes 70 70 */ 71 - struct xttcps_timer { 71 + struct ttc_timer { 72 72 void __iomem *base_addr; 73 73 struct clk *clk; 74 74 struct notifier_block clk_rate_change_nb; 75 75 }; 76 76 77 - #define to_xttcps_timer(x) \ 78 - container_of(x, struct xttcps_timer, clk_rate_change_nb) 77 + #define to_ttc_timer(x) \ 78 + container_of(x, struct ttc_timer, clk_rate_change_nb) 79 79 80 - struct xttcps_timer_clocksource { 81 - struct xttcps_timer xttc; 80 + struct ttc_timer_clocksource { 81 + struct ttc_timer ttc; 82 82 struct clocksource cs; 83 83 }; 84 84 85 - #define to_xttcps_timer_clksrc(x) \ 86 - container_of(x, struct xttcps_timer_clocksource, cs) 85 + #define to_ttc_timer_clksrc(x) \ 86 + container_of(x, struct ttc_timer_clocksource, cs) 87 87 88 - struct xttcps_timer_clockevent { 89 - struct xttcps_timer xttc; 88 + struct ttc_timer_clockevent { 89 + struct ttc_timer ttc; 90 90 struct clock_event_device ce; 91 91 }; 92 92 93 - #define to_xttcps_timer_clkevent(x) \ 94 - container_of(x, struct xttcps_timer_clockevent, ce) 93 + #define to_ttc_timer_clkevent(x) \ 94 + container_of(x, struct ttc_timer_clockevent, ce) 95 95 96 96 /** 97 - * xttcps_set_interval - Set the timer interval value 97 + * ttc_set_interval - Set the timer interval value 98 98 * 99 99 * @timer: Pointer to the timer instance 100 100 * @cycles: Timer interval ticks 101 101 **/ 102 - static void xttcps_set_interval(struct xttcps_timer *timer, 102 + static void ttc_set_interval(struct ttc_timer *timer, 103 103 unsigned long cycles) 104 104 { 105 105 u32 ctrl_reg; 106 106 107 107 /* Disable the counter, set the counter value and re-enable counter */ 108 - ctrl_reg = __raw_readl(timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); 109 - ctrl_reg |= XTTCPS_CNT_CNTRL_DISABLE_MASK; 110 - __raw_writel(ctrl_reg, timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); 108 + ctrl_reg = __raw_readl(timer->base_addr + TTC_CNT_CNTRL_OFFSET); 109 + ctrl_reg |= TTC_CNT_CNTRL_DISABLE_MASK; 110 + __raw_writel(ctrl_reg, timer->base_addr + TTC_CNT_CNTRL_OFFSET); 111 111 112 - __raw_writel(cycles, timer->base_addr + XTTCPS_INTR_VAL_OFFSET); 112 + __raw_writel(cycles, timer->base_addr + TTC_INTR_VAL_OFFSET); 113 113 114 114 /* 115 115 * Reset the counter (0x10) so that it starts from 0, one-shot 116 116 * mode makes this needed for timing to be right. 117 117 */ 118 118 ctrl_reg |= CNT_CNTRL_RESET; 119 - ctrl_reg &= ~XTTCPS_CNT_CNTRL_DISABLE_MASK; 120 - __raw_writel(ctrl_reg, timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); 119 + ctrl_reg &= ~TTC_CNT_CNTRL_DISABLE_MASK; 120 + __raw_writel(ctrl_reg, timer->base_addr + TTC_CNT_CNTRL_OFFSET); 121 121 } 122 122 123 123 /** 124 - * xttcps_clock_event_interrupt - Clock event timer interrupt handler 124 + * ttc_clock_event_interrupt - Clock event timer interrupt handler 125 125 * 126 126 * @irq: IRQ number of the Timer 127 - * @dev_id: void pointer to the xttcps_timer instance 127 + * @dev_id: void pointer to the ttc_timer instance 128 128 * 129 129 * returns: Always IRQ_HANDLED - success 130 130 **/ 131 - static irqreturn_t xttcps_clock_event_interrupt(int irq, void *dev_id) 131 + static irqreturn_t ttc_clock_event_interrupt(int irq, void *dev_id) 132 132 { 133 - struct xttcps_timer_clockevent *xttce = dev_id; 134 - struct xttcps_timer *timer = &xttce->xttc; 133 + struct ttc_timer_clockevent *ttce = dev_id; 134 + struct ttc_timer *timer = &ttce->ttc; 135 135 136 136 /* Acknowledge the interrupt and call event handler */ 137 - __raw_readl(timer->base_addr + XTTCPS_ISR_OFFSET); 137 + __raw_readl(timer->base_addr + TTC_ISR_OFFSET); 138 138 139 - xttce->ce.event_handler(&xttce->ce); 139 + ttce->ce.event_handler(&ttce->ce); 140 140 141 141 return IRQ_HANDLED; 142 142 } 143 143 144 144 /** 145 - * __xttc_clocksource_read - Reads the timer counter register 145 + * __ttc_clocksource_read - Reads the timer counter register 146 146 * 147 147 * returns: Current timer counter register value 148 148 **/ 149 - static cycle_t __xttc_clocksource_read(struct clocksource *cs) 149 + static cycle_t __ttc_clocksource_read(struct clocksource *cs) 150 150 { 151 - struct xttcps_timer *timer = &to_xttcps_timer_clksrc(cs)->xttc; 151 + struct ttc_timer *timer = &to_ttc_timer_clksrc(cs)->ttc; 152 152 153 153 return (cycle_t)__raw_readl(timer->base_addr + 154 - XTTCPS_COUNT_VAL_OFFSET); 154 + TTC_COUNT_VAL_OFFSET); 155 155 } 156 156 157 157 /** 158 - * xttcps_set_next_event - Sets the time interval for next event 158 + * ttc_set_next_event - Sets the time interval for next event 159 159 * 160 160 * @cycles: Timer interval ticks 161 161 * @evt: Address of clock event instance 162 162 * 163 163 * returns: Always 0 - success 164 164 **/ 165 - static int xttcps_set_next_event(unsigned long cycles, 165 + static int ttc_set_next_event(unsigned long cycles, 166 166 struct clock_event_device *evt) 167 167 { 168 - struct xttcps_timer_clockevent *xttce = to_xttcps_timer_clkevent(evt); 169 - struct xttcps_timer *timer = &xttce->xttc; 168 + struct ttc_timer_clockevent *ttce = to_ttc_timer_clkevent(evt); 169 + struct ttc_timer *timer = &ttce->ttc; 170 170 171 - xttcps_set_interval(timer, cycles); 171 + ttc_set_interval(timer, cycles); 172 172 return 0; 173 173 } 174 174 175 175 /** 176 - * xttcps_set_mode - Sets the mode of timer 176 + * ttc_set_mode - Sets the mode of timer 177 177 * 178 178 * @mode: Mode to be set 179 179 * @evt: Address of clock event instance 180 180 **/ 181 - static void xttcps_set_mode(enum clock_event_mode mode, 181 + static void ttc_set_mode(enum clock_event_mode mode, 182 182 struct clock_event_device *evt) 183 183 { 184 - struct xttcps_timer_clockevent *xttce = to_xttcps_timer_clkevent(evt); 185 - struct xttcps_timer *timer = &xttce->xttc; 184 + struct ttc_timer_clockevent *ttce = to_ttc_timer_clkevent(evt); 185 + struct ttc_timer *timer = &ttce->ttc; 186 186 u32 ctrl_reg; 187 187 188 188 switch (mode) { 189 189 case CLOCK_EVT_MODE_PERIODIC: 190 - xttcps_set_interval(timer, 191 - DIV_ROUND_CLOSEST(clk_get_rate(xttce->xttc.clk), 190 + ttc_set_interval(timer, 191 + DIV_ROUND_CLOSEST(clk_get_rate(ttce->ttc.clk), 192 192 PRESCALE * HZ)); 193 193 break; 194 194 case CLOCK_EVT_MODE_ONESHOT: 195 195 case CLOCK_EVT_MODE_UNUSED: 196 196 case CLOCK_EVT_MODE_SHUTDOWN: 197 197 ctrl_reg = __raw_readl(timer->base_addr + 198 - XTTCPS_CNT_CNTRL_OFFSET); 199 - ctrl_reg |= XTTCPS_CNT_CNTRL_DISABLE_MASK; 198 + TTC_CNT_CNTRL_OFFSET); 199 + ctrl_reg |= TTC_CNT_CNTRL_DISABLE_MASK; 200 200 __raw_writel(ctrl_reg, 201 - timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); 201 + timer->base_addr + TTC_CNT_CNTRL_OFFSET); 202 202 break; 203 203 case CLOCK_EVT_MODE_RESUME: 204 204 ctrl_reg = __raw_readl(timer->base_addr + 205 - XTTCPS_CNT_CNTRL_OFFSET); 206 - ctrl_reg &= ~XTTCPS_CNT_CNTRL_DISABLE_MASK; 205 + TTC_CNT_CNTRL_OFFSET); 206 + ctrl_reg &= ~TTC_CNT_CNTRL_DISABLE_MASK; 207 207 __raw_writel(ctrl_reg, 208 - timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); 208 + timer->base_addr + TTC_CNT_CNTRL_OFFSET); 209 209 break; 210 210 } 211 211 } 212 212 213 - static int xttcps_rate_change_clocksource_cb(struct notifier_block *nb, 213 + static int ttc_rate_change_clocksource_cb(struct notifier_block *nb, 214 214 unsigned long event, void *data) 215 215 { 216 216 struct clk_notifier_data *ndata = data; 217 - struct xttcps_timer *xttcps = to_xttcps_timer(nb); 218 - struct xttcps_timer_clocksource *xttccs = container_of(xttcps, 219 - struct xttcps_timer_clocksource, xttc); 217 + struct ttc_timer *ttc = to_ttc_timer(nb); 218 + struct ttc_timer_clocksource *ttccs = container_of(ttc, 219 + struct ttc_timer_clocksource, ttc); 220 220 221 221 switch (event) { 222 222 case POST_RATE_CHANGE: ··· 236 236 * one unregister call, but only trigger one clocksource switch 237 237 * for the cost of another HW timer used by the OS. 238 238 */ 239 - clocksource_unregister(&xttccs->cs); 240 - clocksource_register_hz(&xttccs->cs, 239 + clocksource_unregister(&ttccs->cs); 240 + clocksource_register_hz(&ttccs->cs, 241 241 ndata->new_rate / PRESCALE); 242 242 /* fall through */ 243 243 case PRE_RATE_CHANGE: ··· 247 247 } 248 248 } 249 249 250 - static void __init xttc_setup_clocksource(struct clk *clk, void __iomem *base) 250 + static void __init ttc_setup_clocksource(struct clk *clk, void __iomem *base) 251 251 { 252 - struct xttcps_timer_clocksource *ttccs; 252 + struct ttc_timer_clocksource *ttccs; 253 253 int err; 254 254 255 255 ttccs = kzalloc(sizeof(*ttccs), GFP_KERNEL); 256 256 if (WARN_ON(!ttccs)) 257 257 return; 258 258 259 - ttccs->xttc.clk = clk; 259 + ttccs->ttc.clk = clk; 260 260 261 - err = clk_prepare_enable(ttccs->xttc.clk); 261 + err = clk_prepare_enable(ttccs->ttc.clk); 262 262 if (WARN_ON(err)) { 263 263 kfree(ttccs); 264 264 return; 265 265 } 266 266 267 - ttccs->xttc.clk_rate_change_nb.notifier_call = 268 - xttcps_rate_change_clocksource_cb; 269 - ttccs->xttc.clk_rate_change_nb.next = NULL; 270 - if (clk_notifier_register(ttccs->xttc.clk, 271 - &ttccs->xttc.clk_rate_change_nb)) 267 + ttccs->ttc.clk_rate_change_nb.notifier_call = 268 + ttc_rate_change_clocksource_cb; 269 + ttccs->ttc.clk_rate_change_nb.next = NULL; 270 + if (clk_notifier_register(ttccs->ttc.clk, 271 + &ttccs->ttc.clk_rate_change_nb)) 272 272 pr_warn("Unable to register clock notifier.\n"); 273 273 274 - ttccs->xttc.base_addr = base; 275 - ttccs->cs.name = "xttcps_clocksource"; 274 + ttccs->ttc.base_addr = base; 275 + ttccs->cs.name = "ttc_clocksource"; 276 276 ttccs->cs.rating = 200; 277 - ttccs->cs.read = __xttc_clocksource_read; 277 + ttccs->cs.read = __ttc_clocksource_read; 278 278 ttccs->cs.mask = CLOCKSOURCE_MASK(16); 279 279 ttccs->cs.flags = CLOCK_SOURCE_IS_CONTINUOUS; 280 280 ··· 283 283 * with no interrupt and it rolls over at 0xFFFF. Pre-scale 284 284 * it by 32 also. Let it start running now. 285 285 */ 286 - __raw_writel(0x0, ttccs->xttc.base_addr + XTTCPS_IER_OFFSET); 286 + __raw_writel(0x0, ttccs->ttc.base_addr + TTC_IER_OFFSET); 287 287 __raw_writel(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN, 288 - ttccs->xttc.base_addr + XTTCPS_CLK_CNTRL_OFFSET); 288 + ttccs->ttc.base_addr + TTC_CLK_CNTRL_OFFSET); 289 289 __raw_writel(CNT_CNTRL_RESET, 290 - ttccs->xttc.base_addr + XTTCPS_CNT_CNTRL_OFFSET); 290 + ttccs->ttc.base_addr + TTC_CNT_CNTRL_OFFSET); 291 291 292 292 err = clocksource_register_hz(&ttccs->cs, 293 - clk_get_rate(ttccs->xttc.clk) / PRESCALE); 293 + clk_get_rate(ttccs->ttc.clk) / PRESCALE); 294 294 if (WARN_ON(err)) { 295 295 kfree(ttccs); 296 296 return; 297 297 } 298 298 } 299 299 300 - static int xttcps_rate_change_clockevent_cb(struct notifier_block *nb, 300 + static int ttc_rate_change_clockevent_cb(struct notifier_block *nb, 301 301 unsigned long event, void *data) 302 302 { 303 303 struct clk_notifier_data *ndata = data; 304 - struct xttcps_timer *xttcps = to_xttcps_timer(nb); 305 - struct xttcps_timer_clockevent *xttcce = container_of(xttcps, 306 - struct xttcps_timer_clockevent, xttc); 304 + struct ttc_timer *ttc = to_ttc_timer(nb); 305 + struct ttc_timer_clockevent *ttcce = container_of(ttc, 306 + struct ttc_timer_clockevent, ttc); 307 307 308 308 switch (event) { 309 309 case POST_RATE_CHANGE: ··· 317 317 * cores. 318 318 */ 319 319 local_irq_save(flags); 320 - clockevents_update_freq(&xttcce->ce, 320 + clockevents_update_freq(&ttcce->ce, 321 321 ndata->new_rate / PRESCALE); 322 322 local_irq_restore(flags); 323 323 ··· 330 330 } 331 331 } 332 332 333 - static void __init xttc_setup_clockevent(struct clk *clk, 333 + static void __init ttc_setup_clockevent(struct clk *clk, 334 334 void __iomem *base, u32 irq) 335 335 { 336 - struct xttcps_timer_clockevent *ttcce; 336 + struct ttc_timer_clockevent *ttcce; 337 337 int err; 338 338 339 339 ttcce = kzalloc(sizeof(*ttcce), GFP_KERNEL); 340 340 if (WARN_ON(!ttcce)) 341 341 return; 342 342 343 - ttcce->xttc.clk = clk; 343 + ttcce->ttc.clk = clk; 344 344 345 - err = clk_prepare_enable(ttcce->xttc.clk); 345 + err = clk_prepare_enable(ttcce->ttc.clk); 346 346 if (WARN_ON(err)) { 347 347 kfree(ttcce); 348 348 return; 349 349 } 350 350 351 - ttcce->xttc.clk_rate_change_nb.notifier_call = 352 - xttcps_rate_change_clockevent_cb; 353 - ttcce->xttc.clk_rate_change_nb.next = NULL; 354 - if (clk_notifier_register(ttcce->xttc.clk, 355 - &ttcce->xttc.clk_rate_change_nb)) 351 + ttcce->ttc.clk_rate_change_nb.notifier_call = 352 + ttc_rate_change_clockevent_cb; 353 + ttcce->ttc.clk_rate_change_nb.next = NULL; 354 + if (clk_notifier_register(ttcce->ttc.clk, 355 + &ttcce->ttc.clk_rate_change_nb)) 356 356 pr_warn("Unable to register clock notifier.\n"); 357 357 358 - ttcce->xttc.base_addr = base; 359 - ttcce->ce.name = "xttcps_clockevent"; 358 + ttcce->ttc.base_addr = base; 359 + ttcce->ce.name = "ttc_clockevent"; 360 360 ttcce->ce.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; 361 - ttcce->ce.set_next_event = xttcps_set_next_event; 362 - ttcce->ce.set_mode = xttcps_set_mode; 361 + ttcce->ce.set_next_event = ttc_set_next_event; 362 + ttcce->ce.set_mode = ttc_set_mode; 363 363 ttcce->ce.rating = 200; 364 364 ttcce->ce.irq = irq; 365 365 ttcce->ce.cpumask = cpu_possible_mask; ··· 369 369 * is prescaled by 32 using the interval interrupt. Leave it 370 370 * disabled for now. 371 371 */ 372 - __raw_writel(0x23, ttcce->xttc.base_addr + XTTCPS_CNT_CNTRL_OFFSET); 372 + __raw_writel(0x23, ttcce->ttc.base_addr + TTC_CNT_CNTRL_OFFSET); 373 373 __raw_writel(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN, 374 - ttcce->xttc.base_addr + XTTCPS_CLK_CNTRL_OFFSET); 375 - __raw_writel(0x1, ttcce->xttc.base_addr + XTTCPS_IER_OFFSET); 374 + ttcce->ttc.base_addr + TTC_CLK_CNTRL_OFFSET); 375 + __raw_writel(0x1, ttcce->ttc.base_addr + TTC_IER_OFFSET); 376 376 377 - err = request_irq(irq, xttcps_clock_event_interrupt, 377 + err = request_irq(irq, ttc_clock_event_interrupt, 378 378 IRQF_DISABLED | IRQF_TIMER, 379 379 ttcce->ce.name, ttcce); 380 380 if (WARN_ON(err)) { ··· 383 383 } 384 384 385 385 clockevents_config_and_register(&ttcce->ce, 386 - clk_get_rate(ttcce->xttc.clk) / PRESCALE, 1, 0xfffe); 386 + clk_get_rate(ttcce->ttc.clk) / PRESCALE, 1, 0xfffe); 387 387 } 388 388 389 389 /** 390 - * xttcps_timer_init - Initialize the timer 390 + * ttc_timer_init - Initialize the timer 391 391 * 392 392 * Initializes the timer hardware and register the clock source and clock event 393 393 * timers with Linux kernal timer framework 394 394 */ 395 - static void __init xttcps_timer_init(struct device_node *timer) 395 + static void __init ttc_timer_init(struct device_node *timer) 396 396 { 397 397 unsigned int irq; 398 398 void __iomem *timer_baseaddr; ··· 427 427 BUG(); 428 428 } 429 429 430 - xttc_setup_clocksource(clk, timer_baseaddr); 431 - xttc_setup_clockevent(clk, timer_baseaddr + 4, irq); 430 + ttc_setup_clocksource(clk, timer_baseaddr); 431 + ttc_setup_clockevent(clk, timer_baseaddr + 4, irq); 432 432 433 433 pr_info("%s #0 at %p, irq=%d\n", timer->name, timer_baseaddr, irq); 434 434 } 435 435 436 - CLOCKSOURCE_OF_DECLARE(ttc, "cdns,ttc", xttcps_timer_init); 436 + CLOCKSOURCE_OF_DECLARE(ttc, "cdns,ttc", ttc_timer_init);