intel_scu_ipc_utils: Support for reflashing Medfield firmware
Subsystems (4)
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.
Signed-off-by Sudha Krishnakumar <[email protected]>
[Tidied up the bracketing and some oddments]
Signed-off-by Alan Cox <[email protected]>
---
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
@@ -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
@@ -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 0xA3struct 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);
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]