#include <linux/device.h>
#include <linux/fsi-occ.h>
#include <linux/jiffies.h>
#include <linux/module.h>
#include <asm/unaligned.h>
#define OCC_TIMEOUT_MS 1000
#define OCC_CMD_IN_PRG_WAIT_MS 50
#define OCB_DATA1 0x6B035
#define OCB_DATA3 0x6B075
#define OCC_SRAM_ADDR_CMD 0xFFFF6000
#define OCC_SRAM_ADDR_RESP 0xFFFF7000
#define OCC_DATA_ATTN 0x20010000
struct i2c_client *client;
#define to_p8_i2c_occ(x) container_of((x), struct p8_i2c_occ, occ)
static int p8_i2c_occ_getscom(struct i2c_client *client, u32 address, u8 *data)
msgs[0].addr = client->addr;
msgs[0].flags = client->flags & I2C_M_TEN;
msgs[0].len = sizeof(u32);
msgs[0].buf = (char *)&address;
msgs[1].addr = client->addr;
msgs[1].flags = (client->flags & I2C_M_TEN) | I2C_M_RD;
msgs[1].len = sizeof(u64);
msgs[1].buf = (char *)&buf;
rc = i2c_transfer(client->adapter, msgs, 2);
*(u64 *)data = be64_to_cpu(buf);