mbox series

[v2,0/6] crypto - wire up Atmel SHA204A as RNG in DT and ACPI mode

Message ID 20190524162651.28189-1-ard.biesheuvel@linaro.org
Headers show
Series crypto - wire up Atmel SHA204A as RNG in DT and ACPI mode | expand

Message

Ard Biesheuvel May 24, 2019, 4:26 p.m. UTC
The Socionext SynQuacer based 96boards DeveloperBox platform does not
incorporate a random number generator, but it does have a 96boards low
speed connector which supports extension boards such as the Secure96,
which has a TPM and some crypto accelerators, one of which incorporates
a random number generator.

This series implements support for the RNG part, which is one of several
functions of the Atmel SHA204A I2C crypto accelerator, and wires it up so
both DT and ACPI based boot methods can use the device.

v2:
- update DT binding patches so the SHA204A and ECC508A module bindings are
  in trivial-devices.yaml.
- add acks from Linus and Mika

Assuming Rob is ok now with the DT binding patches, can we please take
this through the crypto tree?

Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Tudor Ambarus <tudor.ambarus@microchip.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>

Ard Biesheuvel (6):
  i2c: acpi: permit bus speed to be discovered after enumeration
  crypto: atmel-ecc: add support for ACPI probing on non-AT91 platforms
  crypto: atmel-ecc: factor out code that can be shared
  crypto: atmel-i2c: add support for SHA204A random number generator
  dt-bindings: add Atmel SHA204A I2C crypto processor
  dt-bindings: move Atmel ECC508A I2C crypto processor to
    trivial-devices

 Documentation/devicetree/bindings/crypto/atmel-crypto.txt |  13 -
 Documentation/devicetree/bindings/trivial-devices.yaml    |   4 +
 drivers/crypto/Kconfig                                    |  19 +-
 drivers/crypto/Makefile                                   |   2 +
 drivers/crypto/atmel-ecc.c                                | 403 ++------------------
 drivers/crypto/atmel-ecc.h                                | 116 ------
 drivers/crypto/atmel-i2c.c                                | 364 ++++++++++++++++++
 drivers/crypto/atmel-i2c.h                                | 196 ++++++++++
 drivers/crypto/atmel-sha204a.c                            | 171 +++++++++
 drivers/i2c/i2c-core-acpi.c                               |   6 +-
 10 files changed, 781 insertions(+), 513 deletions(-)
 delete mode 100644 drivers/crypto/atmel-ecc.h
 create mode 100644 drivers/crypto/atmel-i2c.c
 create mode 100644 drivers/crypto/atmel-i2c.h
 create mode 100644 drivers/crypto/atmel-sha204a.c

Comments

Linus Walleij May 24, 2019, 9:52 p.m. UTC | #1
On Fri, May 24, 2019 at 6:27 PM Ard Biesheuvel
<ard.biesheuvel@linaro.org> wrote:

> The Atmel/Microchip EC508A is a I2C device that could be wired into
> any platform, and is being used on the Linaro/96boards Secure96
> mezzanine adapter. This means it could be found on any platform, even
> on ones that use ACPI enumeration (via PRP0001 devices). So update the
> code to enable this use case.
>
> This involves tweaking the bus rate discovery code to take ACPI probing
> into account, which records the maximum bus rate as a property of the
> slave device. For the atmel-ecc code, this means that the effective bus
> rate should never exceed the maximum rate, unless we are dealing with
> buggy firmware. Nonetheless, let's just use the existing plumbing to
> discover the bus rate and keep the existing logic intact.
>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Looks good to me.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
Herbert Xu May 30, 2019, 1:44 p.m. UTC | #2
On Fri, May 24, 2019 at 06:26:45PM +0200, Ard Biesheuvel wrote:
> The Socionext SynQuacer based 96boards DeveloperBox platform does not
> incorporate a random number generator, but it does have a 96boards low
> speed connector which supports extension boards such as the Secure96,
> which has a TPM and some crypto accelerators, one of which incorporates
> a random number generator.
> 
> This series implements support for the RNG part, which is one of several
> functions of the Atmel SHA204A I2C crypto accelerator, and wires it up so
> both DT and ACPI based boot methods can use the device.
> 
> v2:
> - update DT binding patches so the SHA204A and ECC508A module bindings are
>   in trivial-devices.yaml.
> - add acks from Linus and Mika
> 
> Assuming Rob is ok now with the DT binding patches, can we please take
> this through the crypto tree?
> 
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: Tudor Ambarus <tudor.ambarus@microchip.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> 
> Ard Biesheuvel (6):
>   i2c: acpi: permit bus speed to be discovered after enumeration
>   crypto: atmel-ecc: add support for ACPI probing on non-AT91 platforms
>   crypto: atmel-ecc: factor out code that can be shared
>   crypto: atmel-i2c: add support for SHA204A random number generator
>   dt-bindings: add Atmel SHA204A I2C crypto processor
>   dt-bindings: move Atmel ECC508A I2C crypto processor to
>     trivial-devices
> 
>  Documentation/devicetree/bindings/crypto/atmel-crypto.txt |  13 -
>  Documentation/devicetree/bindings/trivial-devices.yaml    |   4 +
>  drivers/crypto/Kconfig                                    |  19 +-
>  drivers/crypto/Makefile                                   |   2 +
>  drivers/crypto/atmel-ecc.c                                | 403 ++------------------
>  drivers/crypto/atmel-ecc.h                                | 116 ------
>  drivers/crypto/atmel-i2c.c                                | 364 ++++++++++++++++++
>  drivers/crypto/atmel-i2c.h                                | 196 ++++++++++
>  drivers/crypto/atmel-sha204a.c                            | 171 +++++++++
>  drivers/i2c/i2c-core-acpi.c                               |   6 +-
>  10 files changed, 781 insertions(+), 513 deletions(-)
>  delete mode 100644 drivers/crypto/atmel-ecc.h
>  create mode 100644 drivers/crypto/atmel-i2c.c
>  create mode 100644 drivers/crypto/atmel-i2c.h
>  create mode 100644 drivers/crypto/atmel-sha204a.c

All applied.  Thanks.