instrumentalisation du driver tpm spi infineon
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
--- a/drivers/char/tpm/tpm_tis_core.c
|
||||
+++ b/drivers/char/tpm/tpm_tis_core.c
|
||||
@@ -105,13 +105,17 @@ static int wait_startup(struct tpm_chip *chip, int l)
|
||||
u8 access;
|
||||
|
||||
rc = tpm_tis_read8(priv, TPM_ACCESS(l), &access);
|
||||
- if (rc < 0)
|
||||
+ if (rc < 0) {
|
||||
+ printk(KERN_INFO "[WAIT_STARTUP] read byte error (addr: 0x%x, rc: %d)\n", TPM_ACCESS(l), rc);
|
||||
return rc;
|
||||
+ }
|
||||
|
||||
+ printk(KERN_INFO "[WAIT_STARTUP] access: %x\n", access);
|
||||
if (access & TPM_ACCESS_VALID)
|
||||
return 0;
|
||||
tpm_msleep(TPM_TIMEOUT);
|
||||
} while (time_before(jiffies, stop));
|
||||
+ printk(KERN_INFO "[WAIT_STARTUP] timeout - return -1\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -861,7 +865,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
|
||||
u8 rid;
|
||||
int rc, probe;
|
||||
struct tpm_chip *chip;
|
||||
-
|
||||
+ printk(KERN_INFO "[INIT] start\n");
|
||||
chip = tpmm_chip_alloc(dev, &tpm_tis);
|
||||
if (IS_ERR(chip))
|
||||
return PTR_ERR(chip);
|
||||
@@ -894,6 +898,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
|
||||
}
|
||||
}
|
||||
|
||||
+ printk(KERN_INFO "[INIT] plop1\n");
|
||||
if (chip->ops->clk_enable != NULL)
|
||||
chip->ops->clk_enable(chip, true);
|
||||
|
||||
@@ -902,6 +907,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
+ printk(KERN_INFO "[INIT] plop2\n");
|
||||
/* Take control of the TPM's interrupt hardware and shut it off */
|
||||
rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask);
|
||||
if (rc < 0)
|
||||
@@ -912,6 +918,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
|
||||
intmask &= ~TPM_GLOBAL_INT_ENABLE;
|
||||
tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask);
|
||||
|
||||
+ printk(KERN_INFO "[INIT] plop3\n");
|
||||
rc = tpm_chip_start(chip);
|
||||
if (rc)
|
||||
goto out_err;
|
||||
@@ -920,12 +927,14 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
|
||||
if (rc)
|
||||
goto out_err;
|
||||
|
||||
+ printk(KERN_INFO "[INIT] plop4\n");
|
||||
rc = tpm_tis_read32(priv, TPM_DID_VID(0), &vendor);
|
||||
if (rc < 0)
|
||||
goto out_err;
|
||||
|
||||
priv->manufacturer_id = vendor;
|
||||
|
||||
+ printk(KERN_INFO "[INIT] plop5\n");
|
||||
rc = tpm_tis_read8(priv, TPM_RID(0), &rid);
|
||||
if (rc < 0)
|
||||
goto out_err;
|
||||
@@ -934,12 +943,14 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
|
||||
(chip->flags & TPM_CHIP_FLAG_TPM2) ? "2.0" : "1.2",
|
||||
vendor >> 16, rid);
|
||||
|
||||
+ printk(KERN_INFO "[INIT] plop6\n");
|
||||
probe = probe_itpm(chip);
|
||||
if (probe < 0) {
|
||||
rc = -ENODEV;
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
+ printk(KERN_INFO "[INIT] plop7\n");
|
||||
/* Figure out the capabilities */
|
||||
rc = tpm_tis_read32(priv, TPM_INTF_CAPS(priv->locality), &intfcaps);
|
||||
if (rc < 0)
|
||||
@@ -966,6 +977,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
|
||||
if (intfcaps & TPM_INTF_DATA_AVAIL_INT)
|
||||
dev_dbg(dev, "\tData Avail Int Support\n");
|
||||
|
||||
+ printk(KERN_INFO "[INIT] plop8\n");
|
||||
/* INTERRUPT Setup */
|
||||
init_waitqueue_head(&priv->read_queue);
|
||||
init_waitqueue_head(&priv->int_queue);
|
||||
@@ -991,6 +1003,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
|
||||
}
|
||||
}
|
||||
|
||||
+ printk(KERN_INFO "[INIT] plop9\n");
|
||||
rc = tpm_chip_register(chip);
|
||||
if (rc)
|
||||
goto out_err;
|
||||
@@ -1003,6 +1016,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
|
||||
if ((chip->ops != NULL) && (chip->ops->clk_enable != NULL))
|
||||
chip->ops->clk_enable(chip, false);
|
||||
|
||||
+ printk(KERN_INFO "[INIT] out_err\n");
|
||||
tpm_tis_remove(chip);
|
||||
|
||||
return rc;
|
||||
--- a/drivers/char/tpm/tpm_tis_spi.c
|
||||
+++ b/drivers/char/tpm/tpm_tis_spi.c
|
||||
@@ -197,6 +197,7 @@ static int tpm_tis_spi_probe(struct spi_device *dev)
|
||||
struct tpm_tis_spi_phy *phy;
|
||||
int irq;
|
||||
|
||||
+ printk(KERN_INFO "[PROBE] start\n");
|
||||
phy = devm_kzalloc(&dev->dev, sizeof(struct tpm_tis_spi_phy),
|
||||
GFP_KERNEL);
|
||||
if (!phy)
|
||||
@@ -214,6 +215,7 @@ static int tpm_tis_spi_probe(struct spi_device *dev)
|
||||
else
|
||||
irq = -1;
|
||||
|
||||
+ printk(KERN_INFO "[PROBE] end\n");
|
||||
return tpm_tis_core_init(&dev->dev, &phy->priv, irq, &tpm_spi_phy_ops,
|
||||
NULL);
|
||||
}
|
||||
@@ -4,5 +4,6 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
|
||||
|
||||
SRC_URI += " \
|
||||
file://0001-dtc-lexer-extern-yylloc.patch \
|
||||
file://0002-printk-tpm-spi.patch \
|
||||
file://defconfig \
|
||||
"
|
||||
|
||||
Reference in New Issue
Block a user