[PATCH 0/7 v2] [Disco SRU] Use gpiolib for chipselect in DW SPI driver

Ike Panhc ike.pan at canonical.com
Fri May 24 06:46:54 UTC 2019

BugLink: https://bugs.launchpad.net/bugs/1826142

[v2] Cherry-pick upstream 1723fdec too for error handling
     Ref: https://lists.ubuntu.com/archives/kernel-team/2019-May/100602.html

We have a TPM module but disco kernel can not initial it. The root cause is
DW SPI driver in disco only support chipselect from device-tree and for 5.1
mainline kernel it can be used with deivce-tree or ACPI. Most of ARM machines
support for ACPI only.

$ dmesg | grep tpm
[    20.820930] tpm tpm0: tpm_try_transmit: send(): error -5
[    21.577912] tpm tpm0: tpm_relinquish_locality: : error -1
[    21.582313] tpm_tis_spi spi_SMO0768:00: 1.2 TPM (device-id 0xFFFF, rev-id 255)
[    21.583438] tpm tpm0: tpm_try_transmit: send(): error -5
[    22.339157] tpm tpm0: tpm_relinquish_locality: : error -1
[    22.343419] tpm tpm0: A TPM error (-5) occurred attempting to determine the timeouts
[    22.348215] tpm_tis_spi: probe of spi-SMO0768:00 failed with error -5

With these patches tpm driver initial successfully.

$ dmesg | grep tpm
[   28.277541] tpm_tis_spi spi-SMO0768:00: 2.0 TPM (device-id 0x1B, rev-id 16)
[   28.288602] tpm tpm0: A TPM error (256) occurred attempting the selftest
[   28.295440] tpm tpm0: starting up the TPM manually
[   28.319036] tpm tpm0: A TPM error (2314) occurred attempting the self test

Reading first 2 patches for determining regression risk and find out only machines
with Designware MMIO SPI and device-tree have risk. Fortunately on mainline kernel
we have Jan Kotas tested and report several regressions e.g. default polarity.

Therefore, another 5 patches is needed to fix the regression on device-tree
machines with DW SPI and that's the only regression risk. Most of all patches in
5.1 kernel for DW SPI are cherry-picked.

Anders Roxell (1):
  spi: dw: fix warning unused variable 'ret'

Geert Uytterhoeven (1):
  spi: Add missing error handling for CS GPIOs

Linus Walleij (5):
  spi: Optionally use GPIO descriptors for CS GPIOs
  spi: dw: Convert to use CS GPIO descriptors
  spi: Support high CS when using descriptors
  spi: dw: Fix default polarity of native chipselect
  gpio: of: Fix logic inversion

 drivers/gpio/gpiolib-of.c |   2 +-
 drivers/spi/spi-dw-mmio.c |  22 --------
 drivers/spi/spi-dw.c      |  15 ++----
 drivers/spi/spi.c         | 111 ++++++++++++++++++++++++++++++++++----
 include/linux/spi/spi.h   |  23 ++++++--
 5 files changed, 124 insertions(+), 49 deletions(-)


More information about the kernel-team mailing list