linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/4] x86/platform/intel-mid: Fix RTC / WDT handling
@ 2017-01-19 19:24 Andy Shevchenko
  2017-01-19 19:24 ` [PATCH v4 1/4] x86/ioapic: Return suitable error code in mp_map_gsi_to_irq() Andy Shevchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Andy Shevchenko @ 2017-01-19 19:24 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H . Peter Anvin, linux-kernel, x86
  Cc: Andy Shevchenko

Current RTC approach breaks some platforms. Rewrite it completely and
make avaiable only for intended platforms.

Tested on Intel Merrifield, ASuS T100TA (normal and acpi=off cases).

Since v3:
- move to arch_initcall()
- do the same for watchdog registration code (new patch 4)

Since v2:
- add mp_map_gsi_to_irq() fix to the series as patch 1
- add patch 3
- rewrite RTC approach as another platform code for Intel MID

Andy Shevchenko (4):
  x86/ioapic: Return suitable error code in mp_map_gsi_to_irq()
  x86/platform/intel-mid: Allocate RTC interrupt for Merrifield
  x86/platform/intel-mid: Don't shadow error code of mp_map_gsi_to_irq()
  x86/platform/intel-mid: Move watchdog registration to arch_initcall()

 arch/x86/kernel/apic/io_apic.c                     |  4 +-
 arch/x86/platform/intel-mid/device_libs/Makefile   |  1 +
 .../intel-mid/device_libs/platform_mrfld_rtc.c     | 48 ++++++++++++++++++++++
 .../intel-mid/device_libs/platform_mrfld_wdt.c     | 12 +++---
 arch/x86/platform/intel-mid/sfi.c                  | 14 -------
 5 files changed, 57 insertions(+), 22 deletions(-)
 create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_mrfld_rtc.c

-- 
2.11.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v4 1/4] x86/ioapic: Return suitable error code in mp_map_gsi_to_irq()
  2017-01-19 19:24 [PATCH v4 0/4] x86/platform/intel-mid: Fix RTC / WDT handling Andy Shevchenko
@ 2017-01-19 19:24 ` Andy Shevchenko
  2017-01-20  9:10   ` [tip:x86/platform] " tip-bot for Andy Shevchenko
  2017-01-19 19:24 ` [PATCH v4 2/4] x86/platform/intel-mid: Allocate RTC interrupt for Merrifield Andy Shevchenko
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2017-01-19 19:24 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H . Peter Anvin, linux-kernel, x86
  Cc: Andy Shevchenko

mp_map_gsi_to_irq() in some cases might return legacy -1, which would be
wrongly interpreted as -EPERM.

Correct those cases to return proper error code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/x86/kernel/apic/io_apic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 945e512a112a..f62c38d325da 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1107,12 +1107,12 @@ int mp_map_gsi_to_irq(u32 gsi, unsigned int flags, struct irq_alloc_info *info)
 
 	ioapic = mp_find_ioapic(gsi);
 	if (ioapic < 0)
-		return -1;
+		return -ENODEV;
 
 	pin = mp_find_ioapic_pin(ioapic, gsi);
 	idx = find_irq_entry(ioapic, pin, mp_INT);
 	if ((flags & IOAPIC_MAP_CHECK) && idx < 0)
-		return -1;
+		return -ENODEV;
 
 	return mp_map_pin_to_irq(gsi, idx, ioapic, pin, flags, info);
 }
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v4 2/4] x86/platform/intel-mid: Allocate RTC interrupt for Merrifield
  2017-01-19 19:24 [PATCH v4 0/4] x86/platform/intel-mid: Fix RTC / WDT handling Andy Shevchenko
  2017-01-19 19:24 ` [PATCH v4 1/4] x86/ioapic: Return suitable error code in mp_map_gsi_to_irq() Andy Shevchenko
@ 2017-01-19 19:24 ` Andy Shevchenko
  2017-01-20  9:10   ` [tip:x86/platform] " tip-bot for Andy Shevchenko
  2017-01-19 19:24 ` [PATCH v4 3/4] x86/platform/intel-mid: Don't shadow error code of mp_map_gsi_to_irq() Andy Shevchenko
  2017-01-19 19:24 ` [PATCH v4 4/4] x86/platform/intel-mid: Move watchdog registration to arch_initcall() Andy Shevchenko
  3 siblings, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2017-01-19 19:24 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H . Peter Anvin, linux-kernel, x86
  Cc: Andy Shevchenko, Luis R . Rodriguez

Legacy RTC requires interrupt line 8 to be dedicated for it. On
Intel MID platforms the legacy PIC is absent and in order to make RTC
work we need to allocate interrupt separately.

Current solution brought by the commit:

  de1c2540aa4f ("x86/platform/intel-mid: Enable RTC on Intel Merrifield")

does it in a wrong place, and since it's done unconditionally for all
x86 devices, some of them, e.g. PNP based, might get it wrong -- at the
beginning x86_platform.legacy.rtc flag is set for all x86 devices.

Move intel_mid_legacy_rtc_init() to its own module and call it before x86 RTC
CMOS initialization.

Cc: Luis R. Rodriguez <mcgrof@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/x86/platform/intel-mid/device_libs/Makefile   |  1 +
 .../intel-mid/device_libs/platform_mrfld_rtc.c     | 48 ++++++++++++++++++++++
 arch/x86/platform/intel-mid/sfi.c                  | 14 -------
 3 files changed, 49 insertions(+), 14 deletions(-)
 create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_mrfld_rtc.c

diff --git a/arch/x86/platform/intel-mid/device_libs/Makefile b/arch/x86/platform/intel-mid/device_libs/Makefile
index d4af7785844e..a7dbec4dce27 100644
--- a/arch/x86/platform/intel-mid/device_libs/Makefile
+++ b/arch/x86/platform/intel-mid/device_libs/Makefile
@@ -26,4 +26,5 @@ obj-$(subst m,y,$(CONFIG_GPIO_PCA953X)) += platform_pcal9555a.o
 obj-$(subst m,y,$(CONFIG_GPIO_PCA953X)) += platform_tca6416.o
 # MISC Devices
 obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o
+obj-$(subst m,y,$(CONFIG_RTC_DRV_CMOS)) += platform_mrfld_rtc.o
 obj-$(subst m,y,$(CONFIG_INTEL_MID_WATCHDOG)) += platform_mrfld_wdt.o
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mrfld_rtc.c b/arch/x86/platform/intel-mid/device_libs/platform_mrfld_rtc.c
new file mode 100644
index 000000000000..3135416df037
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_mrfld_rtc.c
@@ -0,0 +1,48 @@
+/*
+ * Intel Merrifield legacy RTC initialization file
+ *
+ * (C) Copyright 2017 Intel Corporation
+ *
+ * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/init.h>
+
+#include <asm/hw_irq.h>
+#include <asm/intel-mid.h>
+#include <asm/io_apic.h>
+#include <asm/time.h>
+#include <asm/x86_init.h>
+
+static int __init mrfld_legacy_rtc_alloc_irq(void)
+{
+	struct irq_alloc_info info;
+	int ret;
+
+	if (!x86_platform.legacy.rtc)
+		return -ENODEV;
+
+	ioapic_set_alloc_attr(&info, NUMA_NO_NODE, 1, 0);
+	ret = mp_map_gsi_to_irq(RTC_IRQ, IOAPIC_MAP_ALLOC, &info);
+	if (ret < 0) {
+		pr_info("Failed to allocate RTC interrupt. Disabling RTC\n");
+		x86_platform.legacy.rtc = 0;
+		return ret;
+	}
+
+	return 0;
+}
+
+static int __init mrfld_legacy_rtc_init(void)
+{
+	if (intel_mid_identify_cpu() != INTEL_MID_CPU_CHIP_TANGIER)
+		return -ENODEV;
+
+	return mrfld_legacy_rtc_alloc_irq();
+}
+arch_initcall(mrfld_legacy_rtc_init);
diff --git a/arch/x86/platform/intel-mid/sfi.c b/arch/x86/platform/intel-mid/sfi.c
index e4d4cabbb370..19b43e3a9f0f 100644
--- a/arch/x86/platform/intel-mid/sfi.c
+++ b/arch/x86/platform/intel-mid/sfi.c
@@ -41,7 +41,6 @@
 #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
@@ -540,21 +539,8 @@ 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;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v4 3/4] x86/platform/intel-mid: Don't shadow error code of mp_map_gsi_to_irq()
  2017-01-19 19:24 [PATCH v4 0/4] x86/platform/intel-mid: Fix RTC / WDT handling Andy Shevchenko
  2017-01-19 19:24 ` [PATCH v4 1/4] x86/ioapic: Return suitable error code in mp_map_gsi_to_irq() Andy Shevchenko
  2017-01-19 19:24 ` [PATCH v4 2/4] x86/platform/intel-mid: Allocate RTC interrupt for Merrifield Andy Shevchenko
@ 2017-01-19 19:24 ` Andy Shevchenko
  2017-01-20  9:11   ` [tip:x86/platform] " tip-bot for Andy Shevchenko
  2017-01-19 19:24 ` [PATCH v4 4/4] x86/platform/intel-mid: Move watchdog registration to arch_initcall() Andy Shevchenko
  3 siblings, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2017-01-19 19:24 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H . Peter Anvin, linux-kernel, x86
  Cc: Andy Shevchenko

When call mp_map_gsi_to_irq() and return its error code do not shadow it.
Note that 0 is not an error.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c b/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c
index 3f1f1c77d090..8a10a56f2840 100644
--- a/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c
+++ b/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c
@@ -28,9 +28,9 @@ static struct platform_device wdt_dev = {
 
 static int tangier_probe(struct platform_device *pdev)
 {
-	int gsi;
 	struct irq_alloc_info info;
 	struct intel_mid_wdt_pdata *pdata = pdev->dev.platform_data;
+	int gsi, irq;
 
 	if (!pdata)
 		return -EINVAL;
@@ -38,10 +38,10 @@ static int tangier_probe(struct platform_device *pdev)
 	/* IOAPIC builds identity mapping between GSI and IRQ on MID */
 	gsi = pdata->irq;
 	ioapic_set_alloc_attr(&info, cpu_to_node(0), 1, 0);
-	if (mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC, &info) <= 0) {
-		dev_warn(&pdev->dev, "cannot find interrupt %d in ioapic\n",
-			 gsi);
-		return -EINVAL;
+	irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC, &info);
+	if (irq < 0) {
+		dev_warn(&pdev->dev, "cannot find interrupt %d in ioapic\n", gsi);
+		return irq;
 	}
 
 	return 0;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v4 4/4] x86/platform/intel-mid: Move watchdog registration to arch_initcall()
  2017-01-19 19:24 [PATCH v4 0/4] x86/platform/intel-mid: Fix RTC / WDT handling Andy Shevchenko
                   ` (2 preceding siblings ...)
  2017-01-19 19:24 ` [PATCH v4 3/4] x86/platform/intel-mid: Don't shadow error code of mp_map_gsi_to_irq() Andy Shevchenko
@ 2017-01-19 19:24 ` Andy Shevchenko
  2017-01-20  9:11   ` [tip:x86/platform] " tip-bot for Andy Shevchenko
  3 siblings, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2017-01-19 19:24 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H . Peter Anvin, linux-kernel, x86
  Cc: Andy Shevchenko

There is no need to choose a random initcall level for certainly
architecture dependent code.

Move watchdog registration to arch_initcall() from rootfs_initcall().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c b/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c
index 8a10a56f2840..86edd1e941eb 100644
--- a/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c
+++ b/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c
@@ -82,4 +82,4 @@ static int __init register_mid_wdt(void)
 
 	return 0;
 }
-rootfs_initcall(register_mid_wdt);
+arch_initcall(register_mid_wdt);
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [tip:x86/platform] x86/ioapic: Return suitable error code in mp_map_gsi_to_irq()
  2017-01-19 19:24 ` [PATCH v4 1/4] x86/ioapic: Return suitable error code in mp_map_gsi_to_irq() Andy Shevchenko
@ 2017-01-20  9:10   ` tip-bot for Andy Shevchenko
  0 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Andy Shevchenko @ 2017-01-20  9:10 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: mingo, hpa, tglx, linux-kernel, andriy.shevchenko

Commit-ID:  358e96deaed3330a59d9dd6a7e419f4da08d6497
Gitweb:     http://git.kernel.org/tip/358e96deaed3330a59d9dd6a7e419f4da08d6497
Author:     Andy Shevchenko <andriy.shevchenko@linux.intel.com>
AuthorDate: Thu, 19 Jan 2017 21:24:22 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 20 Jan 2017 10:07:41 +0100

x86/ioapic: Return suitable error code in mp_map_gsi_to_irq()

mp_map_gsi_to_irq() in some cases might return legacy -1, which would be
wrongly interpreted as -EPERM.

Correct those cases to return proper error code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: http://lkml.kernel.org/r/20170119192425.189899-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 arch/x86/kernel/apic/io_apic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 945e512..f62c38d 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1107,12 +1107,12 @@ int mp_map_gsi_to_irq(u32 gsi, unsigned int flags, struct irq_alloc_info *info)
 
 	ioapic = mp_find_ioapic(gsi);
 	if (ioapic < 0)
-		return -1;
+		return -ENODEV;
 
 	pin = mp_find_ioapic_pin(ioapic, gsi);
 	idx = find_irq_entry(ioapic, pin, mp_INT);
 	if ((flags & IOAPIC_MAP_CHECK) && idx < 0)
-		return -1;
+		return -ENODEV;
 
 	return mp_map_pin_to_irq(gsi, idx, ioapic, pin, flags, info);
 }

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [tip:x86/platform] x86/platform/intel-mid: Allocate RTC interrupt for Merrifield
  2017-01-19 19:24 ` [PATCH v4 2/4] x86/platform/intel-mid: Allocate RTC interrupt for Merrifield Andy Shevchenko
@ 2017-01-20  9:10   ` tip-bot for Andy Shevchenko
  0 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Andy Shevchenko @ 2017-01-20  9:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: andriy.shevchenko, tglx, mingo, hpa, linux-kernel, mcgrof

Commit-ID:  910a26f6e952148a0c8815281737aaead640626c
Gitweb:     http://git.kernel.org/tip/910a26f6e952148a0c8815281737aaead640626c
Author:     Andy Shevchenko <andriy.shevchenko@linux.intel.com>
AuthorDate: Thu, 19 Jan 2017 21:24:23 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 20 Jan 2017 10:07:41 +0100

x86/platform/intel-mid: Allocate RTC interrupt for Merrifield

Legacy RTC requires interrupt line 8 to be dedicated for it. On
Intel MID platforms the legacy PIC is absent and in order to make RTC
work we need to allocate interrupt separately.

Current solution brought by commit de1c2540aa4f does it in a wrong place,
and since it's done unconditionally for all x86 devices, some of them,
e.g. PNP based, might get it wrong because they execute the MID specific
code due to x86_platform.legacy.rtc flag being set.

Move intel_mid_legacy_rtc_init() to its own module and call it before x86 RTC
CMOS initialization.

Fixes: de1c2540aa4f ("x86/platform/intel-mid: Enable RTC on Intel Merrifield")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Luis R . Rodriguez" <mcgrof@kernel.org>
Link: http://lkml.kernel.org/r/20170119192425.189899-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 arch/x86/platform/intel-mid/device_libs/Makefile   |  1 +
 .../intel-mid/device_libs/platform_mrfld_rtc.c     | 48 ++++++++++++++++++++++
 arch/x86/platform/intel-mid/sfi.c                  | 14 -------
 3 files changed, 49 insertions(+), 14 deletions(-)

diff --git a/arch/x86/platform/intel-mid/device_libs/Makefile b/arch/x86/platform/intel-mid/device_libs/Makefile
index d4af778..a7dbec4 100644
--- a/arch/x86/platform/intel-mid/device_libs/Makefile
+++ b/arch/x86/platform/intel-mid/device_libs/Makefile
@@ -26,4 +26,5 @@ obj-$(subst m,y,$(CONFIG_GPIO_PCA953X)) += platform_pcal9555a.o
 obj-$(subst m,y,$(CONFIG_GPIO_PCA953X)) += platform_tca6416.o
 # MISC Devices
 obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o
+obj-$(subst m,y,$(CONFIG_RTC_DRV_CMOS)) += platform_mrfld_rtc.o
 obj-$(subst m,y,$(CONFIG_INTEL_MID_WATCHDOG)) += platform_mrfld_wdt.o
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mrfld_rtc.c b/arch/x86/platform/intel-mid/device_libs/platform_mrfld_rtc.c
new file mode 100644
index 0000000..3135416
--- /dev/null
+++ b/arch/x86/platform/intel-mid/device_libs/platform_mrfld_rtc.c
@@ -0,0 +1,48 @@
+/*
+ * Intel Merrifield legacy RTC initialization file
+ *
+ * (C) Copyright 2017 Intel Corporation
+ *
+ * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/init.h>
+
+#include <asm/hw_irq.h>
+#include <asm/intel-mid.h>
+#include <asm/io_apic.h>
+#include <asm/time.h>
+#include <asm/x86_init.h>
+
+static int __init mrfld_legacy_rtc_alloc_irq(void)
+{
+	struct irq_alloc_info info;
+	int ret;
+
+	if (!x86_platform.legacy.rtc)
+		return -ENODEV;
+
+	ioapic_set_alloc_attr(&info, NUMA_NO_NODE, 1, 0);
+	ret = mp_map_gsi_to_irq(RTC_IRQ, IOAPIC_MAP_ALLOC, &info);
+	if (ret < 0) {
+		pr_info("Failed to allocate RTC interrupt. Disabling RTC\n");
+		x86_platform.legacy.rtc = 0;
+		return ret;
+	}
+
+	return 0;
+}
+
+static int __init mrfld_legacy_rtc_init(void)
+{
+	if (intel_mid_identify_cpu() != INTEL_MID_CPU_CHIP_TANGIER)
+		return -ENODEV;
+
+	return mrfld_legacy_rtc_alloc_irq();
+}
+arch_initcall(mrfld_legacy_rtc_init);
diff --git a/arch/x86/platform/intel-mid/sfi.c b/arch/x86/platform/intel-mid/sfi.c
index e4d4cab..19b43e3 100644
--- a/arch/x86/platform/intel-mid/sfi.c
+++ b/arch/x86/platform/intel-mid/sfi.c
@@ -41,7 +41,6 @@
 #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
@@ -540,21 +539,8 @@ 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;

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [tip:x86/platform] x86/platform/intel-mid: Don't shadow error code of mp_map_gsi_to_irq()
  2017-01-19 19:24 ` [PATCH v4 3/4] x86/platform/intel-mid: Don't shadow error code of mp_map_gsi_to_irq() Andy Shevchenko
@ 2017-01-20  9:11   ` tip-bot for Andy Shevchenko
  0 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Andy Shevchenko @ 2017-01-20  9:11 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, andriy.shevchenko, hpa, tglx, mingo

Commit-ID:  939533955d1f1d51e8e37d7d675646ce9d55534b
Gitweb:     http://git.kernel.org/tip/939533955d1f1d51e8e37d7d675646ce9d55534b
Author:     Andy Shevchenko <andriy.shevchenko@linux.intel.com>
AuthorDate: Thu, 19 Jan 2017 21:24:24 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 20 Jan 2017 10:07:41 +0100

x86/platform/intel-mid: Don't shadow error code of mp_map_gsi_to_irq()

When call mp_map_gsi_to_irq() and return its error code do not shadow it.
Note that 0 is not an error.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: http://lkml.kernel.org/r/20170119192425.189899-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c b/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c
index 3f1f1c7..8a10a56 100644
--- a/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c
+++ b/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c
@@ -28,9 +28,9 @@ static struct platform_device wdt_dev = {
 
 static int tangier_probe(struct platform_device *pdev)
 {
-	int gsi;
 	struct irq_alloc_info info;
 	struct intel_mid_wdt_pdata *pdata = pdev->dev.platform_data;
+	int gsi, irq;
 
 	if (!pdata)
 		return -EINVAL;
@@ -38,10 +38,10 @@ static int tangier_probe(struct platform_device *pdev)
 	/* IOAPIC builds identity mapping between GSI and IRQ on MID */
 	gsi = pdata->irq;
 	ioapic_set_alloc_attr(&info, cpu_to_node(0), 1, 0);
-	if (mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC, &info) <= 0) {
-		dev_warn(&pdev->dev, "cannot find interrupt %d in ioapic\n",
-			 gsi);
-		return -EINVAL;
+	irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC, &info);
+	if (irq < 0) {
+		dev_warn(&pdev->dev, "cannot find interrupt %d in ioapic\n", gsi);
+		return irq;
 	}
 
 	return 0;

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [tip:x86/platform] x86/platform/intel-mid: Move watchdog registration to arch_initcall()
  2017-01-19 19:24 ` [PATCH v4 4/4] x86/platform/intel-mid: Move watchdog registration to arch_initcall() Andy Shevchenko
@ 2017-01-20  9:11   ` tip-bot for Andy Shevchenko
  0 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Andy Shevchenko @ 2017-01-20  9:11 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, andriy.shevchenko, tglx, mingo, hpa

Commit-ID:  e2e2eabb68dfd00502bf8501b015862eb8b3f392
Gitweb:     http://git.kernel.org/tip/e2e2eabb68dfd00502bf8501b015862eb8b3f392
Author:     Andy Shevchenko <andriy.shevchenko@linux.intel.com>
AuthorDate: Thu, 19 Jan 2017 21:24:25 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 20 Jan 2017 10:07:42 +0100

x86/platform/intel-mid: Move watchdog registration to arch_initcall()

There is no need to choose a random initcall level for certainly
architecture dependent code.

Move watchdog registration to arch_initcall() from rootfs_initcall().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: http://lkml.kernel.org/r/20170119192425.189899-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c b/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c
index 8a10a56..86edd1e9 100644
--- a/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c
+++ b/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c
@@ -82,4 +82,4 @@ static int __init register_mid_wdt(void)
 
 	return 0;
 }
-rootfs_initcall(register_mid_wdt);
+arch_initcall(register_mid_wdt);

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-01-20  9:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-19 19:24 [PATCH v4 0/4] x86/platform/intel-mid: Fix RTC / WDT handling Andy Shevchenko
2017-01-19 19:24 ` [PATCH v4 1/4] x86/ioapic: Return suitable error code in mp_map_gsi_to_irq() Andy Shevchenko
2017-01-20  9:10   ` [tip:x86/platform] " tip-bot for Andy Shevchenko
2017-01-19 19:24 ` [PATCH v4 2/4] x86/platform/intel-mid: Allocate RTC interrupt for Merrifield Andy Shevchenko
2017-01-20  9:10   ` [tip:x86/platform] " tip-bot for Andy Shevchenko
2017-01-19 19:24 ` [PATCH v4 3/4] x86/platform/intel-mid: Don't shadow error code of mp_map_gsi_to_irq() Andy Shevchenko
2017-01-20  9:11   ` [tip:x86/platform] " tip-bot for Andy Shevchenko
2017-01-19 19:24 ` [PATCH v4 4/4] x86/platform/intel-mid: Move watchdog registration to arch_initcall() Andy Shevchenko
2017-01-20  9:11   ` [tip:x86/platform] " tip-bot for Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).