Skip to contentSkip to conversation

x86/mrst: add SFI platform device parsing code

PATCH RESEND New Alan Cox 1 participant 1 message Sep 28, 2010

Subsystems (4)
lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH RESEND 1/1 x86/mrst: add SFI platform device parsing code

From: Feng Tang <[email protected]>

SFI provides a series of tables (differing between 0.7 and 0.8 firmware). These describe the platform devices present including SPI and I²C devices, as well as various sensors, keypads and other glue as well as interfaces provided via the SCU IPC mechanism (intel_scu_ipc.c)

This patch is a merge of the core elements and relevant fixes from the Intel development code by Feng, Alek, myself into a single coherent patch for upstream submission.

It provides the needed infrastructure to register I2C, SPI and platform devices described by the tables, as well as handlers for some of the hardware already supported in kernel. The 0.8 firmware also provides GPIO tables.

Devices are created at boot time or if they are SCU dependant at the point an SCU is discovered. The existing Linux device mechanisms will then handle the device binding. At an abstract level this is an SFI to Linux device translator.

Device/platform specific setup/glue is in this file. This is done so that the drivers for the generic I²C and SPI bus devices remain cross platform as they should.

(Updated from RFC version to correct the emc1403 name used by the firmware
and a wrongly used #define)

[Ingo - let me know if you only see this via the kernel list]

---

 arch/x86/Kconfig                     |    2 
 arch/x86/include/asm/mrst.h          |    6 
 arch/x86/kernel/mrst.c               |  700 ++++++++++++++++++++++++++++++++++
 drivers/platform/x86/intel_scu_ipc.c |    5 
 4 files changed, 713 insertions(+), 0 deletions(-)
arch/x86/Kconfig +2 -0
index 1e890bb..c25a9e1 100644
@@ -411,6 +411,8 @@ config X86_MRST
 	depends on X86_EXTENDED_PLATFORM
 	depends on X86_IO_APIC
 	select APB_TIMER
+	select I2C
+	select SPI
 	---help---
 	  Moorestown is Intel's Low Power Intel Architecture (LPIA) based Moblin
 	  Internet Device(MID) platform. Moorestown consists of two chips:
arch/x86/include/asm/mrst.h +6 -0
index 1635074..a05c7aa 100644
@@ -10,7 +10,11 @@
  */
 #ifndef _ASM_X86_MRST_H
 #define _ASM_X86_MRST_H
+
+#include <linux/sfi.h>
+
 extern int pci_mrst_init(void);
+
 int __init sfi_parse_mrtc(struct sfi_table_header *table);
 
 /*
@@ -42,4 +46,6 @@ extern enum mrst_timer_options mrst_timer_options;
 #define SFI_MTMR_MAX_NUM 8
 #define SFI_MRTC_MAX	8
 
+extern void intel_scu_devices_create(void);
+extern void intel_scu_devices_destroy(void);
 #endif /* _ASM_X86_MRST_H */
arch/x86/kernel/mrst.c +700 -0

715 lines not on this page · raw message

drivers/platform/x86/intel_scu_ipc.c +5 -0
index 41a9e34..ca35b0c 100644
@@ -26,6 +26,7 @@
 #include <linux/sfi.h>
 #include <asm/mrst.h>
 #include <asm/intel_scu_ipc.h>
+#include <asm/mrst.h>
 
 /* IPC defines the following message types */
 #define IPCMSG_WATCHDOG_TIMER 0xF8 /* Set Kernel Watchdog Threshold */
@@ -699,6 +700,9 @@ static int ipc_probe(struct pci_dev *dev, const struct pci_device_id *id)
 		iounmap(ipcdev.ipc_base);
 		return -ENOMEM;
 	}
+
+	intel_scu_devices_create();
+
 	return 0;
 }
 
@@ -720,6 +724,7 @@ static void ipc_remove(struct pci_dev *pdev)
 	iounmap(ipcdev.ipc_base);
 	iounmap(ipcdev.i2c_base);
 	ipcdev.pdev = NULL;
+	intel_scu_devices_destroy();
 }
 
 static const struct pci_device_id pci_ids[] = {