| .. | .. |
|---|
| 54 | 54 | return container_of(data, struct tpm_tis_tcg_phy, priv); |
|---|
| 55 | 55 | } |
|---|
| 56 | 56 | |
|---|
| 57 | +#ifdef CONFIG_PREEMPT_RT_FULL |
|---|
| 58 | +/* |
|---|
| 59 | + * Flushes previous write operations to chip so that a subsequent |
|---|
| 60 | + * ioread*()s won't stall a cpu. |
|---|
| 61 | + */ |
|---|
| 62 | +static inline void tpm_tis_flush(void __iomem *iobase) |
|---|
| 63 | +{ |
|---|
| 64 | + ioread8(iobase + TPM_ACCESS(0)); |
|---|
| 65 | +} |
|---|
| 66 | +#else |
|---|
| 67 | +#define tpm_tis_flush(iobase) do { } while (0) |
|---|
| 68 | +#endif |
|---|
| 69 | + |
|---|
| 70 | +static inline void tpm_tis_iowrite8(u8 b, void __iomem *iobase, u32 addr) |
|---|
| 71 | +{ |
|---|
| 72 | + iowrite8(b, iobase + addr); |
|---|
| 73 | + tpm_tis_flush(iobase); |
|---|
| 74 | +} |
|---|
| 75 | + |
|---|
| 76 | +static inline void tpm_tis_iowrite32(u32 b, void __iomem *iobase, u32 addr) |
|---|
| 77 | +{ |
|---|
| 78 | + iowrite32(b, iobase + addr); |
|---|
| 79 | + tpm_tis_flush(iobase); |
|---|
| 80 | +} |
|---|
| 81 | + |
|---|
| 57 | 82 | static int interrupts = -1; |
|---|
| 58 | 83 | module_param(interrupts, int, 0444); |
|---|
| 59 | 84 | MODULE_PARM_DESC(interrupts, "Enable interrupts"); |
|---|
| .. | .. |
|---|
| 173 | 198 | struct tpm_tis_tcg_phy *phy = to_tpm_tis_tcg_phy(data); |
|---|
| 174 | 199 | |
|---|
| 175 | 200 | while (len--) |
|---|
| 176 | | - iowrite8(*value++, phy->iobase + addr); |
|---|
| 201 | + tpm_tis_iowrite8(*value++, phy->iobase, addr); |
|---|
| 177 | 202 | |
|---|
| 178 | 203 | return 0; |
|---|
| 179 | 204 | } |
|---|
| .. | .. |
|---|
| 200 | 225 | { |
|---|
| 201 | 226 | struct tpm_tis_tcg_phy *phy = to_tpm_tis_tcg_phy(data); |
|---|
| 202 | 227 | |
|---|
| 203 | | - iowrite32(value, phy->iobase + addr); |
|---|
| 228 | + tpm_tis_iowrite32(value, phy->iobase, addr); |
|---|
| 204 | 229 | |
|---|
| 205 | 230 | return 0; |
|---|
| 206 | 231 | } |
|---|