Skip to contentSkip to conversation

x86/platform/intel-mid: Enable RTC on Intel Merrifield

PATCH New Andy Shevchenko 2 participants 2 messages Jan 13, 2017 – Jan 14, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/platform/intel-mid: Enable RTC on Intel Merrifield

Intel Merrifield has legacy RTC in contrast to the rest on Intel MID platforms.

Set legacy RTC flag explicitly in architecture initialization code and allocate interrupt for it.

---
 arch/x86/platform/intel-mid/mrfld.c |  1 +
 arch/x86/platform/intel-mid/sfi.c   | 14 ++++++++++++++
 2 files changed, 15 insertions(+)
arch/x86/platform/intel-mid/mrfld.c +1 -0
index e0607c77a1bd..ae7bdeb0e507 100644
@@ -91,6 +91,7 @@ static unsigned long __init tangier_calibrate_tsc(void)
 static void __init tangier_arch_setup(void)
 {
 	x86_platform.calibrate_tsc = tangier_calibrate_tsc;
+	x86_platform.legacy.rtc = 1;
 }
 
 /* tangier arch ops */
arch/x86/platform/intel-mid/sfi.c +14 -0
index 19b43e3a9f0f..e4d4cabbb370 100644
@@ -41,6 +41,7 @@
 #include <asm/intel_scu_ipc.h>
 #include <asm/apb_timer.h>
 #include <asm/reboot.h>
+#include <asm/time.h>
 
 #define	SFI_SIG_OEM0	"OEM0"
 #define MAX_IPCDEVS	24
@@ -539,8 +540,21 @@ static int __init sfi_parse_devs(struct sfi_table_header *table)
 	return 0;
 }
 
+static int __init intel_mid_legacy_rtc_init(void)
+{
+	struct irq_alloc_info info;
+
+	if (!x86_platform.legacy.rtc)
+		return -ENODEV;
+
+	ioapic_set_alloc_attr(&info, NUMA_NO_NODE, 1, 0);
+	return mp_map_gsi_to_irq(RTC_IRQ, IOAPIC_MAP_ALLOC, &info);
+}
+
 static int __init intel_mid_platform_init(void)
 {
+	intel_mid_legacy_rtc_init();
+
 	sfi_table_parse(SFI_SIG_GPIO, NULL, NULL, sfi_parse_gpio);
 	sfi_table_parse(SFI_SIG_DEVS, NULL, NULL, sfi_parse_devs);
 	return 0;
Signature · 1 line
2.11.0
#1 lore raw
x86/platform/intel-mid: Enable RTC on Intel Merrifield
Commit-ID:  de1c2540aa4f7796f31acf5432597bb0eb086250
Gitweb:     http://git.kernel.org/tip/de1c2540aa4f7796f31acf5432597bb0eb086250
Author:     Andy Shevchenko <[email protected]>
AuthorDate: Fri, 13 Jan 2017 18:43:55 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sat, 14 Jan 2017 08:30:45 +0100

x86/platform/intel-mid: Enable RTC on Intel Merrifield

Intel Merrifield has legacy RTC in contrast to the rest on Intel MID platforms.

Set legacy RTC flag explicitly in architecture initialization code and allocate interrupt for it.

---
 arch/x86/platform/intel-mid/mrfld.c |  1 +
 arch/x86/platform/intel-mid/sfi.c   | 14 ++++++++++++++
 2 files changed, 15 insertions(+)
arch/x86/platform/intel-mid/mrfld.c +1 -0
index e0607c7..ae7bdeb 100644
@@ -91,6 +91,7 @@ static unsigned long __init tangier_calibrate_tsc(void)
 static void __init tangier_arch_setup(void)
 {
 	x86_platform.calibrate_tsc = tangier_calibrate_tsc;
+	x86_platform.legacy.rtc = 1;
 }
 
 /* tangier arch ops */
arch/x86/platform/intel-mid/sfi.c +14 -0
index 19b43e3..e4d4cab 100644
@@ -41,6 +41,7 @@
 #include <asm/intel_scu_ipc.h>
 #include <asm/apb_timer.h>
 #include <asm/reboot.h>
+#include <asm/time.h>
 
 #define	SFI_SIG_OEM0	"OEM0"
 #define MAX_IPCDEVS	24
@@ -539,8 +540,21 @@ static int __init sfi_parse_devs(struct sfi_table_header *table)
 	return 0;
 }
 
+static int __init intel_mid_legacy_rtc_init(void)
+{
+	struct irq_alloc_info info;
+
+	if (!x86_platform.legacy.rtc)
+		return -ENODEV;
+
+	ioapic_set_alloc_attr(&info, NUMA_NO_NODE, 1, 0);
+	return mp_map_gsi_to_irq(RTC_IRQ, IOAPIC_MAP_ALLOC, &info);
+}
+
 static int __init intel_mid_platform_init(void)
 {
+	intel_mid_legacy_rtc_init();
+
 	sfi_table_parse(SFI_SIG_GPIO, NULL, NULL, sfi_parse_gpio);
 	sfi_table_parse(SFI_SIG_DEVS, NULL, NULL, sfi_parse_devs);
 	return 0;