diff options
Diffstat (limited to 'drivers/watchdog/intel_scu_watchdog.c')
| -rw-r--r-- | drivers/watchdog/intel_scu_watchdog.c | 80 |
1 files changed, 37 insertions, 43 deletions
diff --git a/drivers/watchdog/intel_scu_watchdog.c b/drivers/watchdog/intel_scu_watchdog.c index 1abdc0454c5..0caab6241eb 100644 --- a/drivers/watchdog/intel_scu_watchdog.c +++ b/drivers/watchdog/intel_scu_watchdog.c @@ -22,6 +22,8 @@ * */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/compiler.h> #include <linux/module.h> #include <linux/kernel.h> @@ -46,7 +48,7 @@ #include <linux/atomic.h> #include <asm/intel_scu_ipc.h> #include <asm/apb_timer.h> -#include <asm/mrst.h> +#include <asm/intel-mid.h> #include "intel_scu_watchdog.h" @@ -96,15 +98,14 @@ static struct intel_scu_watchdog_dev watchdog_device; static void watchdog_fire(void) { if (force_boot) { - printk(KERN_CRIT PFX "Initiating system reboot.\n"); + pr_crit("Initiating system reboot\n"); emergency_restart(); - printk(KERN_CRIT PFX "Reboot didn't ?????\n"); + pr_crit("Reboot didn't ?????\n"); } else { - printk(KERN_CRIT PFX "Immediate Reboot Disabled\n"); - printk(KERN_CRIT PFX - "System will reset when watchdog timer times out!\n"); + pr_crit("Immediate Reboot Disabled\n"); + pr_crit("System will reset when watchdog timer times out!\n"); } } @@ -112,8 +113,8 @@ static int check_timer_margin(int new_margin) { if ((new_margin < MIN_TIME_CYCLE) || (new_margin > MAX_TIME - timer_set)) { - pr_debug("Watchdog timer: value of new_margin %d is out of the range %d to %d\n", - new_margin, MIN_TIME_CYCLE, MAX_TIME - timer_set); + pr_debug("value of new_margin %d is out of the range %d to %d\n", + new_margin, MIN_TIME_CYCLE, MAX_TIME - timer_set); return -EINVAL; } return 0; @@ -156,14 +157,14 @@ static irqreturn_t watchdog_timer_interrupt(int irq, void *dev_id) int int_status; int_status = ioread32(watchdog_device.timer_interrupt_status_addr); - pr_debug("Watchdog timer: irq, int_status: %x\n", int_status); + pr_debug("irq, int_status: %x\n", int_status); if (int_status != 0) return IRQ_NONE; /* has the timer been started? If not, then this is spurious */ if (watchdog_device.timer_started == 0) { - pr_debug("Watchdog timer: spurious interrupt received\n"); + pr_debug("spurious interrupt received\n"); return IRQ_HANDLED; } @@ -210,7 +211,6 @@ static int intel_scu_set_heartbeat(u32 t) int ipc_ret; int retry_count; u32 soft_value; - u32 hw_pre_value; u32 hw_value; watchdog_device.timer_set = t; @@ -220,16 +220,15 @@ static int intel_scu_set_heartbeat(u32 t) (watchdog_device.timer_set - timer_margin) * watchdog_device.timer_tbl_ptr->freq_hz; - pr_debug("Watchdog timer: set_heartbeat: timer freq is %d\n", - watchdog_device.timer_tbl_ptr->freq_hz); - pr_debug("Watchdog timer: set_heartbeat: timer_set is %x (hex)\n", - watchdog_device.timer_set); - pr_debug("Watchdog timer: set_hearbeat: timer_margin is %x (hex)\n", - timer_margin); - pr_debug("Watchdog timer: set_heartbeat: threshold is %x (hex)\n", - watchdog_device.threshold); - pr_debug("Watchdog timer: set_heartbeat: soft_threshold is %x (hex)\n", - watchdog_device.soft_threshold); + pr_debug("set_heartbeat: timer freq is %d\n", + watchdog_device.timer_tbl_ptr->freq_hz); + pr_debug("set_heartbeat: timer_set is %x (hex)\n", + watchdog_device.timer_set); + pr_debug("set_hearbeat: timer_margin is %x (hex)\n", timer_margin); + pr_debug("set_heartbeat: threshold is %x (hex)\n", + watchdog_device.threshold); + pr_debug("set_heartbeat: soft_threshold is %x (hex)\n", + watchdog_device.soft_threshold); /* Adjust thresholds by FREQ_ADJUSTMENT factor, to make the */ /* watchdog timing come out right. */ @@ -264,7 +263,7 @@ static int intel_scu_set_heartbeat(u32 t) if (MAX_RETRY < retry_count++) { /* Unable to set timer value */ - pr_err("Watchdog timer: Unable to set timer\n"); + pr_err("Unable to set timer\n"); return -ENODEV; } @@ -273,8 +272,7 @@ static int intel_scu_set_heartbeat(u32 t) watchdog_device.timer_load_count_addr); /* read count value before starting timer */ - hw_pre_value = ioread32(watchdog_device.timer_load_count_addr); - hw_pre_value = hw_pre_value & 0xFFFF0000; + ioread32(watchdog_device.timer_load_count_addr); /* Start the timer */ iowrite32(0x00000003, watchdog_device.timer_control_addr); @@ -321,18 +319,17 @@ static int intel_scu_release(struct inode *inode, struct file *file) */ if (!test_and_clear_bit(0, &watchdog_device.driver_open)) { - pr_debug("Watchdog timer: intel_scu_release, without open\n"); + pr_debug("intel_scu_release, without open\n"); return -ENOTTY; } if (!watchdog_device.timer_started) { /* Just close, since timer has not been started */ - pr_debug("Watchdog timer: closed, without starting timer\n"); + pr_debug("closed, without starting timer\n"); return 0; } - printk(KERN_CRIT PFX - "Unexpected close of /dev/watchdog!\n"); + pr_crit("Unexpected close of /dev/watchdog!\n"); /* Since the timer was started, prevent future reopens */ watchdog_device.driver_closed = 1; @@ -446,7 +443,7 @@ static int __init intel_scu_watchdog_init(void) * * If it isn't an intel MID device then it doesn't have this watchdog */ - if (!mrst_identify_cpu()) + if (!intel_mid_identify_cpu()) return -ENODEV; /* Check boot parameters to verify that their initial values */ @@ -454,9 +451,8 @@ static int __init intel_scu_watchdog_init(void) /* Check value of timer_set boot parameter */ if ((timer_set < MIN_TIME_CYCLE) || (timer_set > MAX_TIME - MIN_TIME_CYCLE)) { - pr_err("Watchdog timer: value of timer_set %x (hex) " - "is out of range from %x to %x (hex)\n", - timer_set, MIN_TIME_CYCLE, MAX_TIME - MIN_TIME_CYCLE); + pr_err("value of timer_set %x (hex) is out of range from %x to %x (hex)\n", + timer_set, MIN_TIME_CYCLE, MAX_TIME - MIN_TIME_CYCLE); return -EINVAL; } @@ -467,19 +463,18 @@ static int __init intel_scu_watchdog_init(void) watchdog_device.timer_tbl_ptr = sfi_get_mtmr(sfi_mtimer_num-1); if (watchdog_device.timer_tbl_ptr == NULL) { - pr_debug("Watchdog timer - Intel SCU watchdog: timer is not available\n"); + pr_debug("timer is not available\n"); return -ENODEV; } /* make sure the timer exists */ if (watchdog_device.timer_tbl_ptr->phys_addr == 0) { - pr_debug("Watchdog timer - Intel SCU watchdog - timer %d does not have valid physical memory\n", - sfi_mtimer_num); + pr_debug("timer %d does not have valid physical memory\n", + sfi_mtimer_num); return -ENODEV; } if (watchdog_device.timer_tbl_ptr->irq == 0) { - pr_debug("Watchdog timer: timer %d invalid irq\n", - sfi_mtimer_num); + pr_debug("timer %d invalid irq\n", sfi_mtimer_num); return -ENODEV; } @@ -487,7 +482,7 @@ static int __init intel_scu_watchdog_init(void) 20); if (tmp_addr == NULL) { - pr_debug("Watchdog timer: timer unable to ioremap\n"); + pr_debug("timer unable to ioremap\n"); return -ENOMEM; } @@ -512,7 +507,7 @@ static int __init intel_scu_watchdog_init(void) ret = register_reboot_notifier(&watchdog_device.intel_scu_notifier); if (ret) { - pr_err("Watchdog timer: cannot register notifier %d)\n", ret); + pr_err("cannot register notifier %d)\n", ret); goto register_reboot_error; } @@ -522,8 +517,8 @@ static int __init intel_scu_watchdog_init(void) ret = misc_register(&watchdog_device.miscdev); if (ret) { - pr_err("Watchdog timer: cannot register miscdev %d err =%d\n", - WATCHDOG_MINOR, ret); + pr_err("cannot register miscdev %d err =%d\n", + WATCHDOG_MINOR, ret); goto misc_register_error; } @@ -532,7 +527,7 @@ static int __init intel_scu_watchdog_init(void) IRQF_SHARED, "watchdog", &watchdog_device.timer_load_count_addr); if (ret) { - pr_err("Watchdog timer: error requesting irq %d\n", ret); + pr_err("error requesting irq %d\n", ret); goto request_irq_error; } /* Make sure timer is disabled before returning */ @@ -567,5 +562,4 @@ module_exit(intel_scu_watchdog_exit); MODULE_AUTHOR("Intel Corporation"); MODULE_DESCRIPTION("Intel SCU Watchdog Device Driver"); MODULE_LICENSE("GPL"); -MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); MODULE_VERSION(WDT_VER); |
