aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/setup-common.c27
-rw-r--r--arch/x86/platform/intel-mid/device_libs/Makefile1
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_wdt.c72
3 files changed, 73 insertions, 27 deletions
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index aa0f5edd8570..d4d418376f99 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -728,33 +728,6 @@ static int powerpc_debugfs_init(void)
728arch_initcall(powerpc_debugfs_init); 728arch_initcall(powerpc_debugfs_init);
729#endif 729#endif
730 730
731#ifdef CONFIG_BOOKE_WDT
732extern u32 booke_wdt_enabled;
733extern u32 booke_wdt_period;
734
735/* Checks wdt=x and wdt_period=xx command-line option */
736notrace int __init early_parse_wdt(char *p)
737{
738 if (p && strncmp(p, "0", 1) != 0)
739 booke_wdt_enabled = 1;
740
741 return 0;
742}
743early_param("wdt", early_parse_wdt);
744
745int __init early_parse_wdt_period(char *p)
746{
747 unsigned long ret;
748 if (p) {
749 if (!kstrtol(p, 0, &ret))
750 booke_wdt_period = ret;
751 }
752
753 return 0;
754}
755early_param("wdt_period", early_parse_wdt_period);
756#endif /* CONFIG_BOOKE_WDT */
757
758void ppc_printk_progress(char *s, unsigned short hex) 731void ppc_printk_progress(char *s, unsigned short hex)
759{ 732{
760 pr_info("%s\n", s); 733 pr_info("%s\n", s);
diff --git a/arch/x86/platform/intel-mid/device_libs/Makefile b/arch/x86/platform/intel-mid/device_libs/Makefile
index 097e7a7940d8..af9307f2cc28 100644
--- a/arch/x86/platform/intel-mid/device_libs/Makefile
+++ b/arch/x86/platform/intel-mid/device_libs/Makefile
@@ -20,3 +20,4 @@ obj-$(subst m,y,$(CONFIG_DRM_MEDFIELD)) += platform_tc35876x.o
20obj-$(subst m,y,$(CONFIG_SERIAL_MRST_MAX3110)) += platform_max3111.o 20obj-$(subst m,y,$(CONFIG_SERIAL_MRST_MAX3110)) += platform_max3111.o
21# MISC Devices 21# MISC Devices
22obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o 22obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o
23obj-$(subst m,y,$(CONFIG_INTEL_MID_WATCHDOG)) += platform_wdt.o
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_wdt.c b/arch/x86/platform/intel-mid/device_libs/platform_wdt.c
new file mode 100644
index 000000000000..973cf3bfa9fd
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_wdt.c
@@ -0,0 +1,72 @@
1/*
2 * platform_wdt.c: Watchdog platform library file
3 *
4 * (C) Copyright 2014 Intel Corporation
5 * Author: David Cohen <david.a.cohen@linux.intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#include <linux/init.h>
14#include <linux/interrupt.h>
15#include <linux/platform_device.h>
16#include <linux/platform_data/intel-mid_wdt.h>
17#include <asm/intel-mid.h>
18#include <asm/io_apic.h>
19
20#define TANGIER_EXT_TIMER0_MSI 15
21
22static struct platform_device wdt_dev = {
23 .name = "intel_mid_wdt",
24 .id = -1,
25};
26
27static int tangier_probe(struct platform_device *pdev)
28{
29 int ioapic;
30 int irq;
31 struct intel_mid_wdt_pdata *pdata = pdev->dev.platform_data;
32 struct io_apic_irq_attr irq_attr = { 0 };
33
34 if (!pdata)
35 return -EINVAL;
36
37 irq = pdata->irq;
38 ioapic = mp_find_ioapic(irq);
39 if (ioapic >= 0) {
40 int ret;
41 irq_attr.ioapic = ioapic;
42 irq_attr.ioapic_pin = irq;
43 irq_attr.trigger = 1;
44 /* irq_attr.polarity = 0; -> Active high */
45 ret = io_apic_set_pci_routing(NULL, irq, &irq_attr);
46 if (ret)
47 return ret;
48 } else {
49 dev_warn(&pdev->dev, "cannot find interrupt %d in ioapic\n",
50 irq);
51 return -EINVAL;
52 }
53
54 return 0;
55}
56
57static struct intel_mid_wdt_pdata tangier_pdata = {
58 .irq = TANGIER_EXT_TIMER0_MSI,
59 .probe = tangier_probe,
60};
61
62static int __init register_mid_wdt(void)
63{
64 if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_TANGIER) {
65 wdt_dev.dev.platform_data = &tangier_pdata;
66 return platform_device_register(&wdt_dev);
67 }
68
69 return -ENODEV;
70}
71
72rootfs_initcall(register_mid_wdt);