diff options
Diffstat (limited to 'drivers/clocksource/sh_tmu.c')
-rw-r--r-- | drivers/clocksource/sh_tmu.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c index fc9ff1e5b770..8e44e14ec4c2 100644 --- a/drivers/clocksource/sh_tmu.c +++ b/drivers/clocksource/sh_tmu.c | |||
@@ -107,13 +107,12 @@ static void sh_tmu_start_stop_ch(struct sh_tmu_priv *p, int start) | |||
107 | 107 | ||
108 | static int sh_tmu_enable(struct sh_tmu_priv *p) | 108 | static int sh_tmu_enable(struct sh_tmu_priv *p) |
109 | { | 109 | { |
110 | struct sh_timer_config *cfg = p->pdev->dev.platform_data; | ||
111 | int ret; | 110 | int ret; |
112 | 111 | ||
113 | /* enable clock */ | 112 | /* enable clock */ |
114 | ret = clk_enable(p->clk); | 113 | ret = clk_enable(p->clk); |
115 | if (ret) { | 114 | if (ret) { |
116 | pr_err("sh_tmu: cannot enable clock \"%s\"\n", cfg->clk); | 115 | dev_err(&p->pdev->dev, "cannot enable clock\n"); |
117 | return ret; | 116 | return ret; |
118 | } | 117 | } |
119 | 118 | ||
@@ -229,7 +228,7 @@ static int sh_tmu_register_clocksource(struct sh_tmu_priv *p, | |||
229 | cs->disable = sh_tmu_clocksource_disable; | 228 | cs->disable = sh_tmu_clocksource_disable; |
230 | cs->mask = CLOCKSOURCE_MASK(32); | 229 | cs->mask = CLOCKSOURCE_MASK(32); |
231 | cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; | 230 | cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; |
232 | pr_info("sh_tmu: %s used as clock source\n", cs->name); | 231 | dev_info(&p->pdev->dev, "used as clock source\n"); |
233 | clocksource_register(cs); | 232 | clocksource_register(cs); |
234 | return 0; | 233 | return 0; |
235 | } | 234 | } |
@@ -277,13 +276,11 @@ static void sh_tmu_clock_event_mode(enum clock_event_mode mode, | |||
277 | 276 | ||
278 | switch (mode) { | 277 | switch (mode) { |
279 | case CLOCK_EVT_MODE_PERIODIC: | 278 | case CLOCK_EVT_MODE_PERIODIC: |
280 | pr_info("sh_tmu: %s used for periodic clock events\n", | 279 | dev_info(&p->pdev->dev, "used for periodic clock events\n"); |
281 | ced->name); | ||
282 | sh_tmu_clock_event_start(p, 1); | 280 | sh_tmu_clock_event_start(p, 1); |
283 | break; | 281 | break; |
284 | case CLOCK_EVT_MODE_ONESHOT: | 282 | case CLOCK_EVT_MODE_ONESHOT: |
285 | pr_info("sh_tmu: %s used for oneshot clock events\n", | 283 | dev_info(&p->pdev->dev, "used for oneshot clock events\n"); |
286 | ced->name); | ||
287 | sh_tmu_clock_event_start(p, 0); | 284 | sh_tmu_clock_event_start(p, 0); |
288 | break; | 285 | break; |
289 | case CLOCK_EVT_MODE_UNUSED: | 286 | case CLOCK_EVT_MODE_UNUSED: |
@@ -324,13 +321,13 @@ static void sh_tmu_register_clockevent(struct sh_tmu_priv *p, | |||
324 | ced->set_next_event = sh_tmu_clock_event_next; | 321 | ced->set_next_event = sh_tmu_clock_event_next; |
325 | ced->set_mode = sh_tmu_clock_event_mode; | 322 | ced->set_mode = sh_tmu_clock_event_mode; |
326 | 323 | ||
327 | pr_info("sh_tmu: %s used for clock events\n", ced->name); | 324 | dev_info(&p->pdev->dev, "used for clock events\n"); |
328 | clockevents_register_device(ced); | 325 | clockevents_register_device(ced); |
329 | 326 | ||
330 | ret = setup_irq(p->irqaction.irq, &p->irqaction); | 327 | ret = setup_irq(p->irqaction.irq, &p->irqaction); |
331 | if (ret) { | 328 | if (ret) { |
332 | pr_err("sh_tmu: failed to request irq %d\n", | 329 | dev_err(&p->pdev->dev, "failed to request irq %d\n", |
333 | p->irqaction.irq); | 330 | p->irqaction.irq); |
334 | return; | 331 | return; |
335 | } | 332 | } |
336 | } | 333 | } |
@@ -379,26 +376,31 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev) | |||
379 | /* map memory, let mapbase point to our channel */ | 376 | /* map memory, let mapbase point to our channel */ |
380 | p->mapbase = ioremap_nocache(res->start, resource_size(res)); | 377 | p->mapbase = ioremap_nocache(res->start, resource_size(res)); |
381 | if (p->mapbase == NULL) { | 378 | if (p->mapbase == NULL) { |
382 | pr_err("sh_tmu: failed to remap I/O memory\n"); | 379 | dev_err(&p->pdev->dev, "failed to remap I/O memory\n"); |
383 | goto err0; | 380 | goto err0; |
384 | } | 381 | } |
385 | 382 | ||
386 | /* setup data for setup_irq() (too early for request_irq()) */ | 383 | /* setup data for setup_irq() (too early for request_irq()) */ |
387 | p->irqaction.name = cfg->name; | 384 | p->irqaction.name = dev_name(&p->pdev->dev); |
388 | p->irqaction.handler = sh_tmu_interrupt; | 385 | p->irqaction.handler = sh_tmu_interrupt; |
389 | p->irqaction.dev_id = p; | 386 | p->irqaction.dev_id = p; |
390 | p->irqaction.irq = irq; | 387 | p->irqaction.irq = irq; |
391 | p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL; | 388 | p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | \ |
389 | IRQF_IRQPOLL | IRQF_NOBALANCING; | ||
392 | 390 | ||
393 | /* get hold of clock */ | 391 | /* get hold of clock */ |
394 | p->clk = clk_get(&p->pdev->dev, cfg->clk); | 392 | p->clk = clk_get(&p->pdev->dev, "tmu_fck"); |
395 | if (IS_ERR(p->clk)) { | 393 | if (IS_ERR(p->clk)) { |
396 | pr_err("sh_tmu: cannot get clock \"%s\"\n", cfg->clk); | 394 | dev_warn(&p->pdev->dev, "using deprecated clock lookup\n"); |
397 | ret = PTR_ERR(p->clk); | 395 | p->clk = clk_get(&p->pdev->dev, cfg->clk); |
398 | goto err1; | 396 | if (IS_ERR(p->clk)) { |
397 | dev_err(&p->pdev->dev, "cannot get clock\n"); | ||
398 | ret = PTR_ERR(p->clk); | ||
399 | goto err1; | ||
400 | } | ||
399 | } | 401 | } |
400 | 402 | ||
401 | return sh_tmu_register(p, cfg->name, | 403 | return sh_tmu_register(p, (char *)dev_name(&p->pdev->dev), |
402 | cfg->clockevent_rating, | 404 | cfg->clockevent_rating, |
403 | cfg->clocksource_rating); | 405 | cfg->clocksource_rating); |
404 | err1: | 406 | err1: |
@@ -410,11 +412,10 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev) | |||
410 | static int __devinit sh_tmu_probe(struct platform_device *pdev) | 412 | static int __devinit sh_tmu_probe(struct platform_device *pdev) |
411 | { | 413 | { |
412 | struct sh_tmu_priv *p = platform_get_drvdata(pdev); | 414 | struct sh_tmu_priv *p = platform_get_drvdata(pdev); |
413 | struct sh_timer_config *cfg = pdev->dev.platform_data; | ||
414 | int ret; | 415 | int ret; |
415 | 416 | ||
416 | if (p) { | 417 | if (p) { |
417 | pr_info("sh_tmu: %s kept as earlytimer\n", cfg->name); | 418 | dev_info(&pdev->dev, "kept as earlytimer\n"); |
418 | return 0; | 419 | return 0; |
419 | } | 420 | } |
420 | 421 | ||