diff options
-rw-r--r-- | arch/x86/platform/intel-mid/device_libs/platform_wdt.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_wdt.c b/arch/x86/platform/intel-mid/device_libs/platform_wdt.c index de734134bc8d..4f96cd009962 100644 --- a/arch/x86/platform/intel-mid/device_libs/platform_wdt.c +++ b/arch/x86/platform/intel-mid/device_libs/platform_wdt.c | |||
@@ -14,7 +14,9 @@ | |||
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/platform_data/intel-mid_wdt.h> | 16 | #include <linux/platform_data/intel-mid_wdt.h> |
17 | |||
17 | #include <asm/intel-mid.h> | 18 | #include <asm/intel-mid.h> |
19 | #include <asm/intel_scu_ipc.h> | ||
18 | #include <asm/io_apic.h> | 20 | #include <asm/io_apic.h> |
19 | 21 | ||
20 | #define TANGIER_EXT_TIMER0_MSI 15 | 22 | #define TANGIER_EXT_TIMER0_MSI 15 |
@@ -50,14 +52,34 @@ static struct intel_mid_wdt_pdata tangier_pdata = { | |||
50 | .probe = tangier_probe, | 52 | .probe = tangier_probe, |
51 | }; | 53 | }; |
52 | 54 | ||
53 | static int __init register_mid_wdt(void) | 55 | static int wdt_scu_status_change(struct notifier_block *nb, |
56 | unsigned long code, void *data) | ||
54 | { | 57 | { |
55 | if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_TANGIER) { | 58 | if (code == SCU_DOWN) { |
56 | wdt_dev.dev.platform_data = &tangier_pdata; | 59 | platform_device_unregister(&wdt_dev); |
57 | return platform_device_register(&wdt_dev); | 60 | return 0; |
58 | } | 61 | } |
59 | 62 | ||
60 | return -ENODEV; | 63 | return platform_device_register(&wdt_dev); |
61 | } | 64 | } |
62 | 65 | ||
66 | static struct notifier_block wdt_scu_notifier = { | ||
67 | .notifier_call = wdt_scu_status_change, | ||
68 | }; | ||
69 | |||
70 | static int __init register_mid_wdt(void) | ||
71 | { | ||
72 | if (intel_mid_identify_cpu() != INTEL_MID_CPU_CHIP_TANGIER) | ||
73 | return -ENODEV; | ||
74 | |||
75 | wdt_dev.dev.platform_data = &tangier_pdata; | ||
76 | |||
77 | /* | ||
78 | * We need to be sure that the SCU IPC is ready before watchdog device | ||
79 | * can be registered: | ||
80 | */ | ||
81 | intel_scu_notifier_add(&wdt_scu_notifier); | ||
82 | |||
83 | return 0; | ||
84 | } | ||
63 | rootfs_initcall(register_mid_wdt); | 85 | rootfs_initcall(register_mid_wdt); |