]> git.baikalelectronics.ru Git - kernel.git/commitdiff
platform/x86: Add Elkhart Lake SCU/PMC support
authorMika Westerberg <mika.westerberg@linux.intel.com>
Tue, 28 Apr 2020 08:51:12 +0000 (11:51 +0300)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 5 May 2020 17:26:16 +0000 (20:26 +0300)
Intel Elkhart Lake exposes SCU/PMC as an ACPI device that only supports
IPC functionality so add a platform driver supporting it. Interrupt is
optional so we let intel_scu_ipc_probe() to decide based on the passed
platform data whether it uses interrupt or polling.

Co-developed-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Co-developed-by: Rajmohan Mani <rajmohan.mani@intel.com>
Signed-off-by: Rajmohan Mani <rajmohan.mani@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/platform/x86/Kconfig
drivers/platform/x86/Makefile
drivers/platform/x86/intel_scu_pltdrv.c [new file with mode: 0644]

index 64231676144338515c8356c241399748d614bd8f..4a888b5270e35ea2411d8c5cbbfb5c32cd01d99a 100644 (file)
@@ -1356,6 +1356,15 @@ config INTEL_SCU_PCI
            Broxton
            Apollo Lake
 
+config INTEL_SCU_PLATFORM
+       tristate "Intel SCU platform driver"
+       depends on ACPI
+       select INTEL_SCU
+       help
+         This driver is used to bridge the communications between kernel
+         and SCU (sometimes called PMC as well). The driver currently
+         supports Intel Elkhart Lake and compatible platforms.
+
 config INTEL_SCU_IPC_UTIL
        tristate "Intel SCU IPC utility driver"
        depends on INTEL_SCU
index 04db27a25946236ece9a85dc0af5d5d047bbe84e..70284a52f24f0045a28c7034fa0faf4fc4ac1ef0 100644 (file)
@@ -141,6 +141,7 @@ obj-$(CONFIG_INTEL_PMC_CORE)                += intel_pmc_core.o intel_pmc_core_pltdrv.o
 obj-$(CONFIG_INTEL_PUNIT_IPC)          += intel_punit_ipc.o
 obj-$(CONFIG_INTEL_SCU_IPC)            += intel_scu_ipc.o
 obj-$(CONFIG_INTEL_SCU_PCI)            += intel_scu_pcidrv.o
+obj-$(CONFIG_INTEL_SCU_PLATFORM)       += intel_scu_pltdrv.o
 obj-$(CONFIG_INTEL_SCU_IPC_UTIL)       += intel_scu_ipcutil.o
 obj-$(CONFIG_INTEL_TELEMETRY)          += intel_telemetry_core.o \
                                           intel_telemetry_pltdrv.o \
diff --git a/drivers/platform/x86/intel_scu_pltdrv.c b/drivers/platform/x86/intel_scu_pltdrv.c
new file mode 100644 (file)
index 0000000..56ec6ae
--- /dev/null
@@ -0,0 +1,60 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Platform driver for the Intel SCU.
+ *
+ * Copyright (C) 2019, Intel Corporation
+ * Authors: Divya Sasidharan <divya.s.sasidharan@intel.com>
+ *         Mika Westerberg <mika.westerberg@linux.intel.com>
+ *         Rajmohan Mani <rajmohan.mani@intel.com>
+ */
+
+#include <linux/err.h>
+#include <linux/errno.h>
+#include <linux/ioport.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+#include <asm/intel_scu_ipc.h>
+
+static int intel_scu_platform_probe(struct platform_device *pdev)
+{
+       struct intel_scu_ipc_data scu_data = {};
+       struct intel_scu_ipc_dev *scu;
+       const struct resource *res;
+
+       scu_data.irq = platform_get_irq_optional(pdev, 0);
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!res)
+               return -ENOMEM;
+
+       scu_data.mem = *res;
+
+       scu = devm_intel_scu_ipc_register(&pdev->dev, &scu_data);
+       if (IS_ERR(scu))
+               return PTR_ERR(scu);
+
+       platform_set_drvdata(pdev, scu);
+       return 0;
+}
+
+static const struct acpi_device_id intel_scu_acpi_ids[] = {
+       { "INTC1026" },
+       {}
+};
+MODULE_DEVICE_TABLE(acpi, intel_scu_acpi_ids);
+
+static struct platform_driver intel_scu_platform_driver = {
+       .probe = intel_scu_platform_probe,
+       .driver = {
+               .name = "intel_scu",
+               .acpi_match_table = intel_scu_acpi_ids,
+       },
+};
+module_platform_driver(intel_scu_platform_driver);
+
+MODULE_AUTHOR("Divya Sasidharan <divya.s.sasidharan@intel.com>");
+MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com");
+MODULE_AUTHOR("Rajmohan Mani <rajmohan.mani@intel.com>");
+MODULE_DESCRIPTION("Intel SCU platform driver");
+MODULE_LICENSE("GPL v2");