Skip to contentSkip to conversation

intel_scu_ipc_utils: Support for reflashing Medfield firmware

PATCH In review Alan Cox 2 participants 2 messages Oct 25, 2010

Subsystems (4)
lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH 1/1 intel_scu_ipc_utils: Support for reflashing Medfield firmware

From: Sudha Krishnakumar <[email protected]>

Initial flashing support. This will change before any production release.

[Tidied up the bracketing and some oddments]

---

 arch/x86/include/asm/intel_scu_ipc.h     |    3 
 drivers/platform/x86/intel_scu_ipc.c     |  363 ++++++++++++++++++++++++++++++
 drivers/platform/x86/intel_scu_ipcutil.c |   28 +-
 3 files changed, 383 insertions(+), 11 deletions(-)
arch/x86/include/asm/intel_scu_ipc.h +3 -0
index 29f6679..9f21f27 100644
@@ -44,4 +44,7 @@ int intel_scu_ipc_i2c_cntrl(u32 addr, u32 *data);
 /* Update FW version */
 int intel_scu_ipc_fw_update(u8 *buffer, u32 length);
 
+/* Upgrade FW version on Medfield */
+int intel_scu_ipc_medfw_upgrade(void __user *arg);
+
 #endif
drivers/platform/x86/intel_scu_ipc.c +363 -0

387 lines not on this page · raw message

drivers/platform/x86/intel_scu_ipcutil.c +17 -11
index b93a032..0a77900 100644
@@ -33,6 +33,7 @@ static u32 major;
 #define INTE_SCU_IPC_REGISTER_WRITE	1
 #define INTE_SCU_IPC_REGISTER_UPDATE	2
 #define INTE_SCU_IPC_FW_UPDATE		0xA2
+#define INTE_SCU_IPC_MEDFIELD_FW_UPDATE	0xA3
 
 struct scu_ipc_data {
 	u32     count;  /* No. of registers */
@@ -88,18 +89,23 @@ static long scu_ipc_ioctl(struct file *fp, unsigned int cmd,
 	if (!capable(CAP_SYS_RAWIO))
 		return -EPERM;
 
-	if (cmd == INTE_SCU_IPC_FW_UPDATE) {
-			u8 *fwbuf = kmalloc(MAX_FW_SIZE, GFP_KERNEL);
-			if (fwbuf == NULL)
-				return -ENOMEM;
-			if (copy_from_user(fwbuf, (u8 *)arg, MAX_FW_SIZE)) {
-				kfree(fwbuf);
-				return -EFAULT;
-			}
-			ret = intel_scu_ipc_fw_update(fwbuf, MAX_FW_SIZE);
+	switch (cmd) {
+	case INTE_SCU_IPC_FW_UPDATE:
+	{
+		u8 *fwbuf = kmalloc(MAX_FW_SIZE, GFP_KERNEL);
+		if (fwbuf == NULL)
+			return -ENOMEM;
+		if (copy_from_user(fwbuf, (u8 *)arg, MAX_FW_SIZE)) {
 			kfree(fwbuf);
-			return ret;
-	} else {
+			return -EFAULT;
+		}
+		ret = intel_scu_ipc_fw_update(fwbuf, MAX_FW_SIZE);
+		kfree(fwbuf);
+		return ret;
+	}
+	case INTE_SCU_IPC_MEDFIELD_FW_UPDATE:
+		return intel_scu_ipc_medfw_upgrade(argp);
+	default:
 		if (copy_from_user(&data, argp, sizeof(struct scu_ipc_data)))
 			return -EFAULT;
 		ret = scu_reg_access(cmd, &data);
#1 lore raw

Just so I'm clear on this - will the driver be able to detect whether it's running on appropriate hardware so that it knows whether or not the flashing protocol it's using will work? If not, what's the failure mode for using the wrong protocol?

Signature · 1 line
Matthew Garrett | [email protected]