@@ -60,6 +60,18 @@ static inline int tpm_read8(struct tpm_chip *chip, u32 addr, u8 *result)
return priv->phy_ops->read_bytes(chip, addr, 1, result);
}
+static inline int tpm_tis_common_read16(struct tpm_chip *chip, u32 addr,
+ u16 *result)
+{
+ struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
+ int rc;
+
+ rc = priv->phy_ops->read_bytes(chip, addr, sizeof(u16), (u8 *)result);
+ if (!rc)
+ *result = le16_to_cpu(*result);
+ return rc;
+}
+
static inline int tpm_read16(struct tpm_chip *chip, u32 addr, u16 *result)
{
struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
@@ -67,6 +79,18 @@ static inline int tpm_read16(struct tpm_chip *chip, u32 addr, u16 *result)
return priv->phy_ops->read16(chip, addr, result);
}
+static inline int tpm_tis_common_read32(struct tpm_chip *chip, u32 addr,
+ u32 *result)
+{
+ struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
+ int rc;
+
+ rc = priv->phy_ops->read_bytes(chip, addr, sizeof(u32), (u8 *)result);
+ if (!rc)
+ *result = le32_to_cpu(*result);
+ return rc;
+}
+
static inline int tpm_read32(struct tpm_chip *chip, u32 addr, u32 *result)
{
struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
@@ -89,6 +113,16 @@ static inline int tpm_write8(struct tpm_chip *chip, u32 addr, u8 value)
return priv->phy_ops->write_bytes(chip, addr, 1, &value);
}
+static inline int tpm_tis_common_write32(struct tpm_chip *chip, u32 addr,
+ u32 value)
+{
+ struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
+
+ value = cpu_to_le32(value);
+ return priv->phy_ops->write_bytes(chip, addr, sizeof(u32),
+ (u8 *)&value);
+}
+
static inline int tpm_write32(struct tpm_chip *chip, u32 addr, u32 value)
{
struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);