2 * platform_wdt.c: Watchdog platform library file
4 * (C) Copyright 2014 Intel Corporation
5 * Author: David Cohen <david.a.cohen@linux.intel.com>
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
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>
20 #define TANGIER_EXT_TIMER0_MSI 15
22 static struct platform_device wdt_dev = {
23 .name = "intel_mid_wdt",
27 static int tangier_probe(struct platform_device *pdev)
31 struct intel_mid_wdt_pdata *pdata = pdev->dev.platform_data;
32 struct io_apic_irq_attr irq_attr = { 0 };
38 ioapic = mp_find_ioapic(irq);
41 irq_attr.ioapic = ioapic;
42 irq_attr.ioapic_pin = irq;
44 /* irq_attr.polarity = 0; -> Active high */
45 ret = io_apic_set_pci_routing(NULL, irq, &irq_attr);
49 dev_warn(&pdev->dev, "cannot find interrupt %d in ioapic\n",
57 static struct intel_mid_wdt_pdata tangier_pdata = {
58 .irq = TANGIER_EXT_TIMER0_MSI,
59 .probe = tangier_probe,
62 static int __init register_mid_wdt(void)
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);
72 rootfs_initcall(register_mid_wdt);