mirror of
https://abf.rosa.ru/djam/kernel-6.6.git
synced 2025-02-25 03:42:46 +00:00
48 lines
1.5 KiB
Diff
48 lines
1.5 KiB
Diff
From 97ffaa76a0bf3c9a6fd94d650e6ae0f7caa05bd6 Mon Sep 17 00:00:00 2001
|
|
From: Alexey Sheplyakov <asheplyakov@basealt.ru>
|
|
Date: Mon, 23 May 2022 19:28:42 +0400
|
|
Subject: [PATCH 606/631] efi-rtc: avoid calling efi.get_time on Baikal-M SoC
|
|
|
|
Old versions of Baikal-M UEFI (before SDK-M 4.4) do NOT provide
|
|
get_time at the runtime (not even as a stub), hence calling it
|
|
results in an Oops.
|
|
|
|
Signed-off-by: Alexey Sheplyakov <asheplyakov@basealt.ru>
|
|
X-DONTUPSTREAM
|
|
X-legacy
|
|
X-feature-Baikal-M
|
|
---
|
|
drivers/rtc/rtc-efi.c | 10 ++++++++++
|
|
1 file changed, 10 insertions(+)
|
|
|
|
diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c
|
|
index dc6b0f4a54e2..8668988acc9f 100644
|
|
--- a/drivers/rtc/rtc-efi.c
|
|
+++ b/drivers/rtc/rtc-efi.c
|
|
@@ -17,6 +17,7 @@
|
|
#include <linux/platform_device.h>
|
|
#include <linux/rtc.h>
|
|
#include <linux/efi.h>
|
|
+#include <linux/of.h>
|
|
|
|
#define EFI_ISDST (EFI_TIME_ADJUST_DAYLIGHT|EFI_TIME_IN_DAYLIGHT)
|
|
|
|
@@ -260,6 +261,15 @@ static int __init efi_rtc_probe(struct platform_device *dev)
|
|
efi_time_t eft;
|
|
efi_time_cap_t cap;
|
|
|
|
+#ifdef CONFIG_OF
|
|
+ /* efi.get_time is not always safe to call since some UEFI
|
|
+ * implementations do not privde get_time at runtime. */
|
|
+ if (of_device_is_compatible(of_root, "baikal,baikal-m") ||
|
|
+ of_device_is_compatible(of_root, "baikal,bm1000")) {
|
|
+ dev_err(&dev->dev, "Baikal-M UEFI has no get_time\n");
|
|
+ return -ENODEV;
|
|
+ }
|
|
+#endif
|
|
/* First check if the RTC is usable */
|
|
if (efi.get_time(&eft, &cap) != EFI_SUCCESS)
|
|
return -ENODEV;
|
|
--
|
|
2.40.1
|
|
|