intel_scu_mip: fix UMIP write corruption problem
authorShijie Zhang <shijie.zhang@intel.com>
Fri, 6 Apr 2012 17:51:07 +0000 (01:51 +0800)
committerbuildbot <buildbot@intel.com>
Tue, 10 Apr 2012 11:56:36 +0000 (04:56 -0700)
BZ: 30789

Before sending UMIP write command, the data to be written into UMIP
should be prepared and copied into intel_mip_base, or the UMIP content
won't get updated.

Change-Id: Ief737144e9fd0efa03ba4773baee1eddbf130e1a
Signed-off-by: Shijie Zhang <shijie.zhang@intel.com>
Reviewed-on: http://android.intel.com:8080/42671
Reviewed-by: Yang, Bin <bin.yang@intel.com>
Reviewed-by: Pallala, Ramakrishna <ramakrishna.pallala@intel.com>
Reviewed-by: Du, Alek <alek.du@intel.com>
Tested-by: Kallappa Manjanna, MadhukumarX <madhukumarx.kallappa.manjanna@intel.com>
Tested-by: Wang, Zhifeng <zhifeng.wang@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/platform/x86/intel_scu_mip.c

index 58aa881..336a3c9 100644 (file)
@@ -27,7 +27,6 @@ static int read_mip(u8 *data, int len, int offset, int issigned)
 {
        int ret;
        u32 sptr, dptr, cmd, cmdid, data_off;
-       int retry = 10000;
 
        if (!intel_mip_base)
                return -ENODEV;
@@ -44,7 +43,7 @@ static int read_mip(u8 *data, int len, int offset, int issigned)
        do {
                ret = intel_scu_ipc_raw_cmd(cmd, 0, NULL, 0, &data_off, 1,
                                dptr, sptr);
-       } while (ret == -EIO && --retry != 0);
+       } while (ret == -EIO);
 
        if (!ret)
                memcpy(data, intel_mip_base + data_off, len);
@@ -67,7 +66,7 @@ EXPORT_SYMBOL(intel_scu_ipc_read_mip);
 int intel_scu_ipc_write_umip(u8 *data, int len, int offset)
 {
        int ret, offset_align;
-       int retry = 10000, len_align = 0;
+       int len_align = 0;
        u32 dptr, sptr, cmd;
        u8 *buf = NULL;
 
@@ -102,9 +101,10 @@ int intel_scu_ipc_write_umip(u8 *data, int len, int offset)
        cmd = IPC_CMD_UMIP_WR << 12 | IPCMSG_MIP_ACCESS;
 
        do {
+               memcpy(intel_mip_base, buf, len_align);
                ret = intel_scu_ipc_raw_cmd(cmd, 0, NULL, 0, NULL, 0,
                                dptr, sptr);
-       } while (ret == -EIO && --retry != 0);
+       } while (ret == -EIO);
 
 fail:
        if (buf && len_align != len)