Commit | Line | Data |
---|---|---|
b886d83c | 1 | // SPDX-License-Identifier: GPL-2.0-only |
910a26f6 AS |
2 | /* |
3 | * Intel Merrifield legacy RTC initialization file | |
4 | * | |
5 | * (C) Copyright 2017 Intel Corporation | |
6 | * | |
7 | * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> | |
910a26f6 AS |
8 | */ |
9 | ||
10 | #include <linux/init.h> | |
11 | ||
12 | #include <asm/hw_irq.h> | |
13 | #include <asm/intel-mid.h> | |
14 | #include <asm/io_apic.h> | |
15 | #include <asm/time.h> | |
16 | #include <asm/x86_init.h> | |
17 | ||
18 | static int __init mrfld_legacy_rtc_alloc_irq(void) | |
19 | { | |
20 | struct irq_alloc_info info; | |
21 | int ret; | |
22 | ||
23 | if (!x86_platform.legacy.rtc) | |
24 | return -ENODEV; | |
25 | ||
26 | ioapic_set_alloc_attr(&info, NUMA_NO_NODE, 1, 0); | |
27 | ret = mp_map_gsi_to_irq(RTC_IRQ, IOAPIC_MAP_ALLOC, &info); | |
28 | if (ret < 0) { | |
29 | pr_info("Failed to allocate RTC interrupt. Disabling RTC\n"); | |
30 | x86_platform.legacy.rtc = 0; | |
31 | return ret; | |
32 | } | |
33 | ||
34 | return 0; | |
35 | } | |
36 | ||
37 | static int __init mrfld_legacy_rtc_init(void) | |
38 | { | |
39 | if (intel_mid_identify_cpu() != INTEL_MID_CPU_CHIP_TANGIER) | |
40 | return -ENODEV; | |
41 | ||
42 | return mrfld_legacy_rtc_alloc_irq(); | |
43 | } | |
44 | arch_initcall(mrfld_legacy_rtc_init); |