intel_scu_ipc: Utility driver for intel scu ipc
PATCH 1/1 intel_scu_ipc: Utility driver for intel scu ipc
From: Sreedhara DS <[email protected]>
This driver implements ioctl and interfaces with intel scu ipc driver. It is used to access pmic/msic registers from user space and firmware update utility.
---
drivers/platform/x86/Kconfig | 9 ++ drivers/platform/x86/Makefile | 1 drivers/platform/x86/intel_scu_ipc.c | 4 - drivers/platform/x86/intel_scu_ipcutil.c | 133 ++++++++++++++++++++++++++++++ 4 files changed, 145 insertions(+), 2 deletions(-) create mode 100644 drivers/platform/x86/intel_scu_ipcutil.c
drivers/platform/x86/Kconfig +9 -0
@@ -576,6 +576,15 @@ config INTEL_SCU_IPC some embedded Intel x86 platforms. This is not needed for PC-type machines. +config INTEL_SCU_IPC_UTIL + tristate "Intel SCU IPC utility driver" + depends on INTEL_SCU_IPC + default y + ---help--- + The IPC Util driver provides an interface with the SCU enabling + low level access for debug work and updating the firmware. Say + N unless you will be doing this on an Intel MID platform. + config GPIO_INTEL_PMIC bool "Intel PMIC GPIO support" depends on INTEL_SCU_IPC && GPIOLIB
drivers/platform/x86/Makefile +1 -0
@@ -28,6 +28,7 @@ obj-$(CONFIG_TOPSTAR_LAPTOP) += topstar-laptop.o obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o obj-$(CONFIG_TOSHIBA_BT_RFKILL) += toshiba_bluetooth.o obj-$(CONFIG_INTEL_SCU_IPC) += intel_scu_ipc.o +obj-$(CONFIG_INTEL_SCU_IPC_UTIL)+= intel_scu_ipcutil.o obj-$(CONFIG_RAR_REGISTER) += intel_rar_register.o obj-$(CONFIG_INTEL_IPS) += intel_ips.o obj-$(CONFIG_GPIO_INTEL_PMIC) += intel_pmic_gpio.o
drivers/platform/x86/intel_scu_ipc.c +2 -2
@@ -496,7 +496,7 @@ int intel_scu_ipc_i2c_cntrl(u32 addr, u32 *data) "intel_scu_ipc: I2C INVALID_CMD = 0x%x\n", cmd);mutex_unlock (&ipclock); -return -1 ; +return -EIO ; }mutex_unlock (&ipclock);return 0 ;
@@ -641,7 +641,7 @@ update_end:if (status ==IPC_FW_UPDATE_SUCCESS )return 0 ; -return -1 ; +return -EIO ; }EXPORT_SYMBOL (intel_scu_ipc_fw_update);
drivers/platform/x86/intel_scu_ipcutil.c new file +133 -0
133 lines not on this page · raw message
Matthew Garrett
AppliedApplied to -next, thanks.
Signature · 1 line
Matthew Garrett | [email protected]
Hi,
seen this a bit late..., one question:
Quoted 5 lines · On Friday 22 October 2010 16:43:55 Alan Cox wrote:
From: Sreedhara DS <[email protected]>
This driver implements ioctl and interfaces with intel scu ipc driver. It is used to access pmic/msic registers from user space and firmware update utility.
Why is an ioctl used for updating the firmware?
Why isn't request_firmware(..) via:/lib/firmware/...
used?
Then the firmware could be maintained here:
http://git.kernel.org/?p=linux/kernel/git/dwmw2/linux-firmware.git;a=summary
and no further userspace tools for firmware updating are needed.
Thanks,
Thomas
Quoted 4 lines
Signed-off-by Sreedhara DS <[email protected]>[Extensive clean up and debug]Signed-off-by Alan Cox <[email protected]>
...
Quoted 29 lines
drivers/platform/x86/intel_scu_ipcutil.c new file +29
-0+/** +* scu_ipc_ioctl - control ioctls for the SCU +* @fp: file handle of the SCU device +* @cmd: ioctl coce +* @arg: pointer to user passed structure +* +* Support the I/O and firmware flashing interfaces of the SCU +*/ +static long scu_ipc_ioctl (struct file *fp,unsigned int cmd, +unsigned long arg) +{ +int ret; +struct scu_ipc_data data; +void __user *argp = (void __user *)arg; + +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 ); +kfree (fwbuf); +return ret;
Quoted 7 lines
Quoted 3 lines
This driver implements ioctl and interfaces with intel scu ipc driver. It is used to access pmic/msic registers from user space and firmware update utility.
Why is an ioctl used for updating the firmware?
Why isn'trequest_firmware(..)via:/lib/firmware/...
used?
Because you would then still need an ioctl to say "go do the upload"
This firmware is flashed into the device, it isn't loaded into memory and then used by the device. It's not the kind of thing you want to get wrong or automate behind someone's back.
Alan