Skip to content

Commit 3c756aa

Browse files
Ard Biesheuvelherbertx
authored andcommitted
crypto: atmel-ecc - add support for ACPI probing on non-AT91 platforms
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 <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 4befedc commit 3c756aa

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

drivers/crypto/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,6 @@ config CRYPTO_DEV_ATMEL_SHA
521521

522522
config CRYPTO_DEV_ATMEL_ECC
523523
tristate "Support for Microchip / Atmel ECC hw accelerator"
524-
depends on ARCH_AT91 || COMPILE_TEST
525524
depends on I2C
526525
select CRYPTO_ECDH
527526
select CRC16

drivers/crypto/atmel-ecc.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -657,11 +657,14 @@ static int atmel_ecc_probe(struct i2c_client *client,
657657
return -ENODEV;
658658
}
659659

660-
ret = of_property_read_u32(client->adapter->dev.of_node,
661-
"clock-frequency", &bus_clk_rate);
662-
if (ret) {
663-
dev_err(dev, "of: failed to read clock-frequency property\n");
664-
return ret;
660+
clk_rate = i2c_acpi_find_bus_speed(&client->adapter->dev);
661+
if (!clk_rate) {
662+
ret = device_property_read_u32(&client->adapter->dev,
663+
"clock-frequency", &bus_clk_rate);
664+
if (ret) {
665+
dev_err(dev, "failed to read clock-frequency property\n");
666+
return ret;
667+
}
665668
}
666669

667670
if (bus_clk_rate > 1000000L) {

0 commit comments

Comments
 (0)