tpm: baseline for TPM2

This patch adds a flag called 'tpm2' to struct tpm_chip, which tells
whether the given device uses TPM2 protocol or not. This variable is
also exported through sysfs so that the user space software knows which
protocol to use.

To make basic transmit functionality working I got TPM2 upgraded
tpm_calc_ordinal_durations() function from Will Arthur and squashed
it into this same patch.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Will Arthur <will.c.arthur@intel.com>
tpm: TPM2 support for tpm_do_selftest()

Implemented TPM2 support for tpm_do_selftest().

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
tpm: TPM2 support for tpm_pcr_read_dev()

Implemented TPM2 support for tpm_pcr_read_dev() and 'pcrs' sysfs
file.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
tpm: TPM2 support for tpm_getcap

This patch adds TPM2 protocol support for tpm_getcap(). A new
parameter 'property_id' was added to the function definition
in order to select a property.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
tpm: TPM2 support for tpm_pcr_extend()

Implemented TPM2 protocol support for tpm_pcr_extend().

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
tpm: TPM2 support for tpm_get_random().

Implemented TPM2 support for tpm_get_random().

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
tpm: TPM2 support for tpm_startup()

This patch implements TPM2 support for tpm_startup().

Signed-off-by: Will Arthur <will.c.arthur@intel.com>
tpm: TPM2 support for tpm_gen_interrupt().

This patch adds TPM2 support for tpm_gen_interrupt().

Signed-off-by: Will Arthur <will.c.arthur@intel.com>
tpm: enable TPM2 in the existing TIS driver

Added support for extended STS register.  This allows driver
to access the bits for detecting TPM 1.2 vs 2.0 and for
sending cancel and resetEstBit commands.

Signed-off-by: Will Arthur <will.c.arthur@intel.com>
tpm: workaround for selftest when firmware does not execute TPM2_Startup

This patch adds a workaround to tpm_do_selftest() for the situation
when firmware does not execute TPM2_Startup. This does not happen
usually in production hardware but is sometimes case with development
hardware.

Signed-off-by: Will Arthur <will.c.arthur@intel.com>
tpm: update tpm_get_timeouts() to support TPM v2.0

Encapsulated TPM1 v1.0 commands to the following internal helpers:

- tpm1_get_timeouts()
- tpm1_get_durations()

When the chip uses TPM v1.0 tpm_get_timeouts() calls these functions
to get the needed data. For TPM v2.0 constants defined in the TPM PTP
specification are simply assigned to the corresponding fields of the
struct tpm_chip instance.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>