tpm: drop 'locality' from struct tpm_vendor_specific
Dropped the field 'locality' from struct tpm_vendor_specific migrated it to the private structures of st33zp24, tpm_i2c_infineon and tpm_tis. Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
This commit is contained in:
parent
6e599f6f26
commit
56671c893e
|
@ -136,7 +136,7 @@ static int check_locality(struct tpm_chip *chip)
|
||||||
if (status && (data &
|
if (status && (data &
|
||||||
(TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) ==
|
(TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) ==
|
||||||
(TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID))
|
(TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID))
|
||||||
return chip->vendor.locality;
|
return tpm_dev->locality;
|
||||||
|
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
} /* check_locality() */
|
} /* check_locality() */
|
||||||
|
@ -153,11 +153,11 @@ static int request_locality(struct tpm_chip *chip)
|
||||||
struct st33zp24_dev *tpm_dev;
|
struct st33zp24_dev *tpm_dev;
|
||||||
u8 data;
|
u8 data;
|
||||||
|
|
||||||
if (check_locality(chip) == chip->vendor.locality)
|
|
||||||
return chip->vendor.locality;
|
|
||||||
|
|
||||||
tpm_dev = (struct st33zp24_dev *)TPM_VPRIV(chip);
|
tpm_dev = (struct st33zp24_dev *)TPM_VPRIV(chip);
|
||||||
|
|
||||||
|
if (check_locality(chip) == tpm_dev->locality)
|
||||||
|
return tpm_dev->locality;
|
||||||
|
|
||||||
data = TPM_ACCESS_REQUEST_USE;
|
data = TPM_ACCESS_REQUEST_USE;
|
||||||
ret = tpm_dev->ops->send(tpm_dev->phy_id, TPM_ACCESS, &data, 1);
|
ret = tpm_dev->ops->send(tpm_dev->phy_id, TPM_ACCESS, &data, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -168,7 +168,7 @@ static int request_locality(struct tpm_chip *chip)
|
||||||
/* Request locality is usually effective after the request */
|
/* Request locality is usually effective after the request */
|
||||||
do {
|
do {
|
||||||
if (check_locality(chip) >= 0)
|
if (check_locality(chip) >= 0)
|
||||||
return chip->vendor.locality;
|
return tpm_dev->locality;
|
||||||
msleep(TPM_TIMEOUT);
|
msleep(TPM_TIMEOUT);
|
||||||
} while (time_before(jiffies, stop));
|
} while (time_before(jiffies, stop));
|
||||||
|
|
||||||
|
@ -566,7 +566,7 @@ int st33zp24_probe(void *phy_id, const struct st33zp24_phy_ops *ops,
|
||||||
chip->vendor.timeout_c = msecs_to_jiffies(TIS_SHORT_TIMEOUT);
|
chip->vendor.timeout_c = msecs_to_jiffies(TIS_SHORT_TIMEOUT);
|
||||||
chip->vendor.timeout_d = msecs_to_jiffies(TIS_SHORT_TIMEOUT);
|
chip->vendor.timeout_d = msecs_to_jiffies(TIS_SHORT_TIMEOUT);
|
||||||
|
|
||||||
chip->vendor.locality = LOCALITY0;
|
tpm_dev->locality = LOCALITY0;
|
||||||
|
|
||||||
if (irq) {
|
if (irq) {
|
||||||
/* INTERRUPT Setup */
|
/* INTERRUPT Setup */
|
||||||
|
|
|
@ -25,6 +25,7 @@ struct st33zp24_dev {
|
||||||
struct tpm_chip *chip;
|
struct tpm_chip *chip;
|
||||||
void *phy_id;
|
void *phy_id;
|
||||||
const struct st33zp24_phy_ops *ops;
|
const struct st33zp24_phy_ops *ops;
|
||||||
|
int locality;
|
||||||
int irq;
|
int irq;
|
||||||
u32 intrs;
|
u32 intrs;
|
||||||
int io_lpcpd;
|
int io_lpcpd;
|
||||||
|
|
|
@ -131,7 +131,6 @@ enum tpm2_startup_types {
|
||||||
struct tpm_chip;
|
struct tpm_chip;
|
||||||
|
|
||||||
struct tpm_vendor_specific {
|
struct tpm_vendor_specific {
|
||||||
int locality;
|
|
||||||
unsigned long timeout_a, timeout_b, timeout_c, timeout_d; /* jiffies */
|
unsigned long timeout_a, timeout_b, timeout_c, timeout_d; /* jiffies */
|
||||||
bool timeout_adjusted;
|
bool timeout_adjusted;
|
||||||
unsigned long duration[3]; /* jiffies */
|
unsigned long duration[3]; /* jiffies */
|
||||||
|
|
|
@ -66,6 +66,7 @@ enum i2c_chip_type {
|
||||||
/* Structure to store I2C TPM specific stuff */
|
/* Structure to store I2C TPM specific stuff */
|
||||||
struct tpm_inf_dev {
|
struct tpm_inf_dev {
|
||||||
struct i2c_client *client;
|
struct i2c_client *client;
|
||||||
|
int locality;
|
||||||
u8 buf[TPM_BUFSIZE + sizeof(u8)]; /* max. buffer size + addr */
|
u8 buf[TPM_BUFSIZE + sizeof(u8)]; /* max. buffer size + addr */
|
||||||
struct tpm_chip *chip;
|
struct tpm_chip *chip;
|
||||||
enum i2c_chip_type chip_type;
|
enum i2c_chip_type chip_type;
|
||||||
|
@ -288,7 +289,7 @@ static int check_locality(struct tpm_chip *chip, int loc)
|
||||||
|
|
||||||
if ((buf & (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) ==
|
if ((buf & (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) ==
|
||||||
(TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) {
|
(TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) {
|
||||||
chip->vendor.locality = loc;
|
tpm_dev.locality = loc;
|
||||||
return loc;
|
return loc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +338,7 @@ static u8 tpm_tis_i2c_status(struct tpm_chip *chip)
|
||||||
u8 i = 0;
|
u8 i = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (iic_tpm_read(TPM_STS(chip->vendor.locality), &buf, 1) < 0)
|
if (iic_tpm_read(TPM_STS(tpm_dev.locality), &buf, 1) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
@ -351,7 +352,7 @@ static void tpm_tis_i2c_ready(struct tpm_chip *chip)
|
||||||
{
|
{
|
||||||
/* this causes the current command to be aborted */
|
/* this causes the current command to be aborted */
|
||||||
u8 buf = TPM_STS_COMMAND_READY;
|
u8 buf = TPM_STS_COMMAND_READY;
|
||||||
iic_tpm_write_long(TPM_STS(chip->vendor.locality), &buf, 1);
|
iic_tpm_write_long(TPM_STS(tpm_dev.locality), &buf, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t get_burstcount(struct tpm_chip *chip)
|
static ssize_t get_burstcount(struct tpm_chip *chip)
|
||||||
|
@ -365,7 +366,7 @@ static ssize_t get_burstcount(struct tpm_chip *chip)
|
||||||
stop = jiffies + chip->vendor.timeout_d;
|
stop = jiffies + chip->vendor.timeout_d;
|
||||||
do {
|
do {
|
||||||
/* Note: STS is little endian */
|
/* Note: STS is little endian */
|
||||||
if (iic_tpm_read(TPM_STS(chip->vendor.locality)+1, buf, 3) < 0)
|
if (iic_tpm_read(TPM_STS(tpm_dev.locality)+1, buf, 3) < 0)
|
||||||
burstcnt = 0;
|
burstcnt = 0;
|
||||||
else
|
else
|
||||||
burstcnt = (buf[2] << 16) + (buf[1] << 8) + buf[0];
|
burstcnt = (buf[2] << 16) + (buf[1] << 8) + buf[0];
|
||||||
|
@ -419,7 +420,7 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
|
||||||
if (burstcnt > (count - size))
|
if (burstcnt > (count - size))
|
||||||
burstcnt = count - size;
|
burstcnt = count - size;
|
||||||
|
|
||||||
rc = iic_tpm_read(TPM_DATA_FIFO(chip->vendor.locality),
|
rc = iic_tpm_read(TPM_DATA_FIFO(tpm_dev.locality),
|
||||||
&(buf[size]), burstcnt);
|
&(buf[size]), burstcnt);
|
||||||
if (rc == 0)
|
if (rc == 0)
|
||||||
size += burstcnt;
|
size += burstcnt;
|
||||||
|
@ -477,7 +478,7 @@ out:
|
||||||
* so we sleep rather than keeping the bus busy
|
* so we sleep rather than keeping the bus busy
|
||||||
*/
|
*/
|
||||||
usleep_range(SLEEP_DURATION_RESET_LOW, SLEEP_DURATION_RESET_HI);
|
usleep_range(SLEEP_DURATION_RESET_LOW, SLEEP_DURATION_RESET_HI);
|
||||||
release_locality(chip, chip->vendor.locality, 0);
|
release_locality(chip, tpm_dev.locality, 0);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,7 +517,7 @@ static int tpm_tis_i2c_send(struct tpm_chip *chip, u8 *buf, size_t len)
|
||||||
if (burstcnt > (len - 1 - count))
|
if (burstcnt > (len - 1 - count))
|
||||||
burstcnt = len - 1 - count;
|
burstcnt = len - 1 - count;
|
||||||
|
|
||||||
rc = iic_tpm_write(TPM_DATA_FIFO(chip->vendor.locality),
|
rc = iic_tpm_write(TPM_DATA_FIFO(tpm_dev.locality),
|
||||||
&(buf[count]), burstcnt);
|
&(buf[count]), burstcnt);
|
||||||
if (rc == 0)
|
if (rc == 0)
|
||||||
count += burstcnt;
|
count += burstcnt;
|
||||||
|
@ -539,7 +540,7 @@ static int tpm_tis_i2c_send(struct tpm_chip *chip, u8 *buf, size_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write last byte */
|
/* write last byte */
|
||||||
iic_tpm_write(TPM_DATA_FIFO(chip->vendor.locality), &(buf[count]), 1);
|
iic_tpm_write(TPM_DATA_FIFO(tpm_dev.locality), &(buf[count]), 1);
|
||||||
wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, &status);
|
wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, &status);
|
||||||
if ((status & TPM_STS_DATA_EXPECT) != 0) {
|
if ((status & TPM_STS_DATA_EXPECT) != 0) {
|
||||||
rc = -EIO;
|
rc = -EIO;
|
||||||
|
@ -547,7 +548,7 @@ static int tpm_tis_i2c_send(struct tpm_chip *chip, u8 *buf, size_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* go and do it */
|
/* go and do it */
|
||||||
iic_tpm_write(TPM_STS(chip->vendor.locality), &sts, 1);
|
iic_tpm_write(TPM_STS(tpm_dev.locality), &sts, 1);
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
out_err:
|
out_err:
|
||||||
|
@ -556,7 +557,7 @@ out_err:
|
||||||
* so we sleep rather than keeping the bus busy
|
* so we sleep rather than keeping the bus busy
|
||||||
*/
|
*/
|
||||||
usleep_range(SLEEP_DURATION_RESET_LOW, SLEEP_DURATION_RESET_HI);
|
usleep_range(SLEEP_DURATION_RESET_LOW, SLEEP_DURATION_RESET_HI);
|
||||||
release_locality(chip, chip->vendor.locality, 0);
|
release_locality(chip, tpm_dev.locality, 0);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -623,7 +624,7 @@ static int tpm_tis_i2c_init(struct device *dev)
|
||||||
|
|
||||||
return tpm_chip_register(chip);
|
return tpm_chip_register(chip);
|
||||||
out_release:
|
out_release:
|
||||||
release_locality(chip, chip->vendor.locality, 1);
|
release_locality(chip, tpm_dev.locality, 1);
|
||||||
tpm_dev.client = NULL;
|
tpm_dev.client = NULL;
|
||||||
out_err:
|
out_err:
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -695,7 +696,7 @@ static int tpm_tis_i2c_remove(struct i2c_client *client)
|
||||||
struct tpm_chip *chip = tpm_dev.chip;
|
struct tpm_chip *chip = tpm_dev.chip;
|
||||||
|
|
||||||
tpm_chip_unregister(chip);
|
tpm_chip_unregister(chip);
|
||||||
release_locality(chip, chip->vendor.locality, 1);
|
release_locality(chip, tpm_dev.locality, 1);
|
||||||
tpm_dev.client = NULL;
|
tpm_dev.client = NULL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -96,6 +96,7 @@ struct tpm_info {
|
||||||
struct priv_data {
|
struct priv_data {
|
||||||
void __iomem *iobase;
|
void __iomem *iobase;
|
||||||
u16 manufacturer_id;
|
u16 manufacturer_id;
|
||||||
|
int locality;
|
||||||
int irq;
|
int irq;
|
||||||
bool irq_tested;
|
bool irq_tested;
|
||||||
wait_queue_head_t int_queue;
|
wait_queue_head_t int_queue;
|
||||||
|
@ -149,7 +150,7 @@ static int check_locality(struct tpm_chip *chip, int l)
|
||||||
if ((ioread8(priv->iobase + TPM_ACCESS(l)) &
|
if ((ioread8(priv->iobase + TPM_ACCESS(l)) &
|
||||||
(TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) ==
|
(TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) ==
|
||||||
(TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID))
|
(TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID))
|
||||||
return chip->vendor.locality = l;
|
return priv->locality = l;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +212,7 @@ static u8 tpm_tis_status(struct tpm_chip *chip)
|
||||||
struct priv_data *priv = chip->vendor.priv;
|
struct priv_data *priv = chip->vendor.priv;
|
||||||
|
|
||||||
return ioread8(priv->iobase +
|
return ioread8(priv->iobase +
|
||||||
TPM_STS(chip->vendor.locality));
|
TPM_STS(priv->locality));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tpm_tis_ready(struct tpm_chip *chip)
|
static void tpm_tis_ready(struct tpm_chip *chip)
|
||||||
|
@ -220,7 +221,7 @@ static void tpm_tis_ready(struct tpm_chip *chip)
|
||||||
|
|
||||||
/* this causes the current command to be aborted */
|
/* this causes the current command to be aborted */
|
||||||
iowrite8(TPM_STS_COMMAND_READY,
|
iowrite8(TPM_STS_COMMAND_READY,
|
||||||
priv->iobase + TPM_STS(chip->vendor.locality));
|
priv->iobase + TPM_STS(priv->locality));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_burstcount(struct tpm_chip *chip)
|
static int get_burstcount(struct tpm_chip *chip)
|
||||||
|
@ -234,9 +235,9 @@ static int get_burstcount(struct tpm_chip *chip)
|
||||||
stop = jiffies + chip->vendor.timeout_d;
|
stop = jiffies + chip->vendor.timeout_d;
|
||||||
do {
|
do {
|
||||||
burstcnt = ioread8(priv->iobase +
|
burstcnt = ioread8(priv->iobase +
|
||||||
TPM_STS(chip->vendor.locality) + 1);
|
TPM_STS(priv->locality) + 1);
|
||||||
burstcnt += ioread8(priv->iobase +
|
burstcnt += ioread8(priv->iobase +
|
||||||
TPM_STS(chip->vendor.locality) +
|
TPM_STS(priv->locality) +
|
||||||
2) << 8;
|
2) << 8;
|
||||||
if (burstcnt)
|
if (burstcnt)
|
||||||
return burstcnt;
|
return burstcnt;
|
||||||
|
@ -258,8 +259,7 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
|
||||||
burstcnt = get_burstcount(chip);
|
burstcnt = get_burstcount(chip);
|
||||||
for (; burstcnt > 0 && size < count; burstcnt--)
|
for (; burstcnt > 0 && size < count; burstcnt--)
|
||||||
buf[size++] = ioread8(priv->iobase +
|
buf[size++] = ioread8(priv->iobase +
|
||||||
TPM_DATA_FIFO(chip->vendor.
|
TPM_DATA_FIFO(priv->locality));
|
||||||
locality));
|
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
@ -307,7 +307,7 @@ static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count)
|
||||||
|
|
||||||
out:
|
out:
|
||||||
tpm_tis_ready(chip);
|
tpm_tis_ready(chip);
|
||||||
release_locality(chip, chip->vendor.locality, 0);
|
release_locality(chip, priv->locality, 0);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len)
|
||||||
burstcnt = get_burstcount(chip);
|
burstcnt = get_burstcount(chip);
|
||||||
for (; burstcnt > 0 && count < len - 1; burstcnt--) {
|
for (; burstcnt > 0 && count < len - 1; burstcnt--) {
|
||||||
iowrite8(buf[count], priv->iobase +
|
iowrite8(buf[count], priv->iobase +
|
||||||
TPM_DATA_FIFO(chip->vendor.locality));
|
TPM_DATA_FIFO(priv->locality));
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len)
|
||||||
|
|
||||||
/* write last byte */
|
/* write last byte */
|
||||||
iowrite8(buf[count],
|
iowrite8(buf[count],
|
||||||
priv->iobase + TPM_DATA_FIFO(chip->vendor.locality));
|
priv->iobase + TPM_DATA_FIFO(priv->locality));
|
||||||
wait_for_tpm_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c,
|
wait_for_tpm_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c,
|
||||||
&priv->int_queue, false);
|
&priv->int_queue, false);
|
||||||
status = tpm_tis_status(chip);
|
status = tpm_tis_status(chip);
|
||||||
|
@ -372,7 +372,7 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len)
|
||||||
|
|
||||||
out_err:
|
out_err:
|
||||||
tpm_tis_ready(chip);
|
tpm_tis_ready(chip);
|
||||||
release_locality(chip, chip->vendor.locality, 0);
|
release_locality(chip, priv->locality, 0);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,10 +383,10 @@ static void disable_interrupts(struct tpm_chip *chip)
|
||||||
|
|
||||||
intmask =
|
intmask =
|
||||||
ioread32(priv->iobase +
|
ioread32(priv->iobase +
|
||||||
TPM_INT_ENABLE(chip->vendor.locality));
|
TPM_INT_ENABLE(priv->locality));
|
||||||
intmask &= ~TPM_GLOBAL_INT_ENABLE;
|
intmask &= ~TPM_GLOBAL_INT_ENABLE;
|
||||||
iowrite32(intmask,
|
iowrite32(intmask,
|
||||||
priv->iobase + TPM_INT_ENABLE(chip->vendor.locality));
|
priv->iobase + TPM_INT_ENABLE(priv->locality));
|
||||||
devm_free_irq(&chip->dev, priv->irq, chip);
|
devm_free_irq(&chip->dev, priv->irq, chip);
|
||||||
priv->irq = 0;
|
priv->irq = 0;
|
||||||
chip->flags &= ~TPM_CHIP_FLAG_IRQ;
|
chip->flags &= ~TPM_CHIP_FLAG_IRQ;
|
||||||
|
@ -410,7 +410,7 @@ static int tpm_tis_send_main(struct tpm_chip *chip, u8 *buf, size_t len)
|
||||||
|
|
||||||
/* go and do it */
|
/* go and do it */
|
||||||
iowrite8(TPM_STS_GO,
|
iowrite8(TPM_STS_GO,
|
||||||
priv->iobase + TPM_STS(chip->vendor.locality));
|
priv->iobase + TPM_STS(priv->locality));
|
||||||
|
|
||||||
if (chip->flags & TPM_CHIP_FLAG_IRQ) {
|
if (chip->flags & TPM_CHIP_FLAG_IRQ) {
|
||||||
ordinal = be32_to_cpu(*((__be32 *) (buf + 6)));
|
ordinal = be32_to_cpu(*((__be32 *) (buf + 6)));
|
||||||
|
@ -430,7 +430,7 @@ static int tpm_tis_send_main(struct tpm_chip *chip, u8 *buf, size_t len)
|
||||||
return len;
|
return len;
|
||||||
out_err:
|
out_err:
|
||||||
tpm_tis_ready(chip);
|
tpm_tis_ready(chip);
|
||||||
release_locality(chip, chip->vendor.locality, 0);
|
release_locality(chip, priv->locality, 0);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,7 +516,7 @@ static int probe_itpm(struct tpm_chip *chip)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
tpm_tis_ready(chip);
|
tpm_tis_ready(chip);
|
||||||
release_locality(chip, chip->vendor.locality, 0);
|
release_locality(chip, priv->locality, 0);
|
||||||
|
|
||||||
itpm = true;
|
itpm = true;
|
||||||
|
|
||||||
|
@ -530,7 +530,7 @@ static int probe_itpm(struct tpm_chip *chip)
|
||||||
out:
|
out:
|
||||||
itpm = rem_itpm;
|
itpm = rem_itpm;
|
||||||
tpm_tis_ready(chip);
|
tpm_tis_ready(chip);
|
||||||
release_locality(chip, chip->vendor.locality, 0);
|
release_locality(chip, priv->locality, 0);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -569,7 +569,7 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
interrupt = ioread32(priv->iobase +
|
interrupt = ioread32(priv->iobase +
|
||||||
TPM_INT_STATUS(chip->vendor.locality));
|
TPM_INT_STATUS(priv->locality));
|
||||||
|
|
||||||
if (interrupt == 0)
|
if (interrupt == 0)
|
||||||
return IRQ_NONE;
|
return IRQ_NONE;
|
||||||
|
@ -589,8 +589,8 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id)
|
||||||
/* Clear interrupts handled with TPM_EOI */
|
/* Clear interrupts handled with TPM_EOI */
|
||||||
iowrite32(interrupt,
|
iowrite32(interrupt,
|
||||||
priv->iobase +
|
priv->iobase +
|
||||||
TPM_INT_STATUS(chip->vendor.locality));
|
TPM_INT_STATUS(priv->locality));
|
||||||
ioread32(priv->iobase + TPM_INT_STATUS(chip->vendor.locality));
|
ioread32(priv->iobase + TPM_INT_STATUS(priv->locality));
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,18 +613,18 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
|
||||||
priv->irq = irq;
|
priv->irq = irq;
|
||||||
|
|
||||||
original_int_vec = ioread8(priv->iobase +
|
original_int_vec = ioread8(priv->iobase +
|
||||||
TPM_INT_VECTOR(chip->vendor.locality));
|
TPM_INT_VECTOR(priv->locality));
|
||||||
iowrite8(irq,
|
iowrite8(irq,
|
||||||
priv->iobase + TPM_INT_VECTOR(chip->vendor.locality));
|
priv->iobase + TPM_INT_VECTOR(priv->locality));
|
||||||
|
|
||||||
/* Clear all existing */
|
/* Clear all existing */
|
||||||
iowrite32(ioread32(priv->iobase +
|
iowrite32(ioread32(priv->iobase +
|
||||||
TPM_INT_STATUS(chip->vendor.locality)),
|
TPM_INT_STATUS(priv->locality)),
|
||||||
priv->iobase + TPM_INT_STATUS(chip->vendor.locality));
|
priv->iobase + TPM_INT_STATUS(priv->locality));
|
||||||
|
|
||||||
/* Turn on */
|
/* Turn on */
|
||||||
iowrite32(intmask | TPM_GLOBAL_INT_ENABLE,
|
iowrite32(intmask | TPM_GLOBAL_INT_ENABLE,
|
||||||
priv->iobase + TPM_INT_ENABLE(chip->vendor.locality));
|
priv->iobase + TPM_INT_ENABLE(priv->locality));
|
||||||
|
|
||||||
priv->irq_tested = false;
|
priv->irq_tested = false;
|
||||||
|
|
||||||
|
@ -641,7 +641,7 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
|
||||||
*/
|
*/
|
||||||
if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) {
|
if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) {
|
||||||
iowrite8(original_int_vec,
|
iowrite8(original_int_vec,
|
||||||
priv->iobase + TPM_INT_VECTOR(chip->vendor.locality));
|
priv->iobase + TPM_INT_VECTOR(priv->locality));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -659,7 +659,7 @@ static void tpm_tis_probe_irq(struct tpm_chip *chip, u32 intmask)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
original_int_vec = ioread8(priv->iobase +
|
original_int_vec = ioread8(priv->iobase +
|
||||||
TPM_INT_VECTOR(chip->vendor.locality));
|
TPM_INT_VECTOR(priv->locality));
|
||||||
|
|
||||||
if (!original_int_vec) {
|
if (!original_int_vec) {
|
||||||
if (IS_ENABLED(CONFIG_X86))
|
if (IS_ENABLED(CONFIG_X86))
|
||||||
|
@ -679,11 +679,10 @@ MODULE_PARM_DESC(interrupts, "Enable interrupts");
|
||||||
static void tpm_tis_remove(struct tpm_chip *chip)
|
static void tpm_tis_remove(struct tpm_chip *chip)
|
||||||
{
|
{
|
||||||
struct priv_data *priv = chip->vendor.priv;
|
struct priv_data *priv = chip->vendor.priv;
|
||||||
void __iomem *reg = priv->iobase +
|
void __iomem *reg = priv->iobase + TPM_INT_ENABLE(priv->locality);
|
||||||
TPM_INT_ENABLE(chip->vendor.locality);
|
|
||||||
|
|
||||||
iowrite32(~TPM_GLOBAL_INT_ENABLE & ioread32(reg), reg);
|
iowrite32(~TPM_GLOBAL_INT_ENABLE & ioread32(reg), reg);
|
||||||
release_locality(chip, chip->vendor.locality, 1);
|
release_locality(chip, priv->locality, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
|
static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
|
||||||
|
@ -724,12 +723,12 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
|
||||||
|
|
||||||
/* Take control of the TPM's interrupt hardware and shut it off */
|
/* Take control of the TPM's interrupt hardware and shut it off */
|
||||||
intmask = ioread32(priv->iobase +
|
intmask = ioread32(priv->iobase +
|
||||||
TPM_INT_ENABLE(chip->vendor.locality));
|
TPM_INT_ENABLE(priv->locality));
|
||||||
intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT |
|
intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT |
|
||||||
TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT;
|
TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT;
|
||||||
intmask &= ~TPM_GLOBAL_INT_ENABLE;
|
intmask &= ~TPM_GLOBAL_INT_ENABLE;
|
||||||
iowrite32(intmask,
|
iowrite32(intmask,
|
||||||
priv->iobase + TPM_INT_ENABLE(chip->vendor.locality));
|
priv->iobase + TPM_INT_ENABLE(priv->locality));
|
||||||
|
|
||||||
if (request_locality(chip, 0) != 0) {
|
if (request_locality(chip, 0) != 0) {
|
||||||
rc = -ENODEV;
|
rc = -ENODEV;
|
||||||
|
@ -763,7 +762,7 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
|
||||||
/* Figure out the capabilities */
|
/* Figure out the capabilities */
|
||||||
intfcaps =
|
intfcaps =
|
||||||
ioread32(priv->iobase +
|
ioread32(priv->iobase +
|
||||||
TPM_INTF_CAPS(chip->vendor.locality));
|
TPM_INTF_CAPS(priv->locality));
|
||||||
dev_dbg(dev, "TPM interface capabilities (0x%x):\n",
|
dev_dbg(dev, "TPM interface capabilities (0x%x):\n",
|
||||||
intfcaps);
|
intfcaps);
|
||||||
if (intfcaps & TPM_INTF_BURST_COUNT_STATIC)
|
if (intfcaps & TPM_INTF_BURST_COUNT_STATIC)
|
||||||
|
@ -847,17 +846,17 @@ static void tpm_tis_reenable_interrupts(struct tpm_chip *chip)
|
||||||
/* reenable interrupts that device may have lost or
|
/* reenable interrupts that device may have lost or
|
||||||
BIOS/firmware may have disabled */
|
BIOS/firmware may have disabled */
|
||||||
iowrite8(priv->irq, priv->iobase +
|
iowrite8(priv->irq, priv->iobase +
|
||||||
TPM_INT_VECTOR(chip->vendor.locality));
|
TPM_INT_VECTOR(priv->locality));
|
||||||
|
|
||||||
intmask =
|
intmask =
|
||||||
ioread32(priv->iobase + TPM_INT_ENABLE(chip->vendor.locality));
|
ioread32(priv->iobase + TPM_INT_ENABLE(priv->locality));
|
||||||
|
|
||||||
intmask |= TPM_INTF_CMD_READY_INT
|
intmask |= TPM_INTF_CMD_READY_INT
|
||||||
| TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT
|
| TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT
|
||||||
| TPM_INTF_STS_VALID_INT | TPM_GLOBAL_INT_ENABLE;
|
| TPM_INTF_STS_VALID_INT | TPM_GLOBAL_INT_ENABLE;
|
||||||
|
|
||||||
iowrite32(intmask,
|
iowrite32(intmask,
|
||||||
priv->iobase + TPM_INT_ENABLE(chip->vendor.locality));
|
priv->iobase + TPM_INT_ENABLE(priv->locality));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tpm_tis_resume(struct device *dev)
|
static int tpm_tis_resume(struct device *dev)
|
||||||
|
|
Loading…
Reference in New Issue