116 lines
3.8 KiB
Diff
116 lines
3.8 KiB
Diff
--- a/drivers/char/tpm/tpm_tis_spi.c
|
|
+++ b/drivers/char/tpm/tpm_tis_spi.c
|
|
@@ -61,6 +61,7 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len,
|
|
u8 transfer_len;
|
|
|
|
spi_bus_lock(phy->spi_device->master);
|
|
+ printk(KERN_INFO "in: %x - out: %x - addr: 0x%x - len:%d\n", in, out, addr, len);
|
|
|
|
while (len) {
|
|
transfer_len = min_t(u16, len, MAX_SPI_FRAMESIZE);
|
|
@@ -79,9 +80,14 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len,
|
|
spi_message_init(&m);
|
|
spi_message_add_tail(&spi_xfer, &m);
|
|
ret = spi_sync_locked(phy->spi_device, &m);
|
|
- if (ret < 0)
|
|
+ if (ret < 0) {
|
|
goto exit;
|
|
+ }
|
|
|
|
+ printk(KERN_INFO "phy->iobuf: 0x%x 0x%x 0x%x 0x%x\n", phy->iobuf[0],
|
|
+ phy->iobuf[1],
|
|
+ phy->iobuf[2],
|
|
+ phy->iobuf[3]);
|
|
if ((phy->iobuf[3] & 0x01) == 0) {
|
|
// handle SPI wait states
|
|
phy->iobuf[0] = 0;
|
|
@@ -91,10 +97,12 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len,
|
|
spi_message_init(&m);
|
|
spi_message_add_tail(&spi_xfer, &m);
|
|
ret = spi_sync_locked(phy->spi_device, &m);
|
|
- if (ret < 0)
|
|
+ if (ret < 0){
|
|
goto exit;
|
|
- if (phy->iobuf[0] & 0x01)
|
|
+ }
|
|
+ if (phy->iobuf[0] & 0x01) {
|
|
break;
|
|
+ }
|
|
}
|
|
|
|
if (i == TPM_RETRY) {
|
|
@@ -108,8 +116,10 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len,
|
|
spi_xfer.delay_usecs = 5;
|
|
|
|
if (in) {
|
|
+ printk(KERN_INFO "in => read\n");
|
|
spi_xfer.tx_buf = NULL;
|
|
} else if (out) {
|
|
+ printk(KERN_INFO "out => write\n");
|
|
spi_xfer.rx_buf = NULL;
|
|
memcpy(phy->iobuf, out, transfer_len);
|
|
out += transfer_len;
|
|
@@ -118,10 +128,14 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len,
|
|
spi_message_init(&m);
|
|
spi_message_add_tail(&spi_xfer, &m);
|
|
ret = spi_sync_locked(phy->spi_device, &m);
|
|
- if (ret < 0)
|
|
+ if (ret < 0) {
|
|
+ printk(KERN_INFO "==> spi_sync_locked error\n");
|
|
goto exit;
|
|
+ }
|
|
|
|
if (in) {
|
|
+ printk(KERN_INFO "transfer_len: %d - phy->iobuf: 0x%x\n", transfer_len,
|
|
+ phy->iobuf[0]);
|
|
memcpy(in, phy->iobuf, transfer_len);
|
|
in += transfer_len;
|
|
}
|
|
@@ -130,6 +144,7 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len,
|
|
}
|
|
|
|
exit:
|
|
+ printk(KERN_INFO "exit - spi_bus_unlock\n****\n");
|
|
spi_bus_unlock(phy->spi_device->master);
|
|
return ret;
|
|
}
|
|
@@ -137,12 +152,14 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len,
|
|
static int tpm_tis_spi_read_bytes(struct tpm_tis_data *data, u32 addr,
|
|
u16 len, u8 *result)
|
|
{
|
|
+ printk(KERN_INFO "read bytes : addr: 0x%04x - len: %d\n", addr, len);
|
|
return tpm_tis_spi_transfer(data, addr, len, result, NULL);
|
|
}
|
|
|
|
static int tpm_tis_spi_write_bytes(struct tpm_tis_data *data, u32 addr,
|
|
u16 len, const u8 *value)
|
|
{
|
|
+ printk(KERN_INFO "write bytes : addr: 0x%04x - len: %d\n", addr, len);
|
|
return tpm_tis_spi_transfer(data, addr, len, NULL, value);
|
|
}
|
|
|
|
@@ -151,6 +168,7 @@ static int tpm_tis_spi_read16(struct tpm_tis_data *data, u32 addr, u16 *result)
|
|
__le16 result_le;
|
|
int rc;
|
|
|
|
+ printk(KERN_INFO "read16 : addr: 0x%04x - len: %d\n", addr, sizeof(u16));
|
|
rc = data->phy_ops->read_bytes(data, addr, sizeof(u16),
|
|
(u8 *)&result_le);
|
|
if (!rc)
|
|
@@ -164,6 +182,7 @@ static int tpm_tis_spi_read32(struct tpm_tis_data *data, u32 addr, u32 *result)
|
|
__le32 result_le;
|
|
int rc;
|
|
|
|
+ printk(KERN_INFO "read32 : addr: 0x%04x - len: %d\n", addr, sizeof(u32));
|
|
rc = data->phy_ops->read_bytes(data, addr, sizeof(u32),
|
|
(u8 *)&result_le);
|
|
if (!rc)
|
|
@@ -177,6 +196,7 @@ static int tpm_tis_spi_write32(struct tpm_tis_data *data, u32 addr, u32 value)
|
|
__le32 value_le;
|
|
int rc;
|
|
|
|
+ printk(KERN_INFO "write32 : addr: 0x%04x - val: 0x%04x\n", addr, value);
|
|
value_le = cpu_to_le32(value);
|
|
rc = data->phy_ops->write_bytes(data, addr, sizeof(u32),
|
|
(u8 *)&value_le);
|