From: Tudor Ambarus <tudor.ambarus@microchip.com>
To: Linus Walleij <linus.walleij@linaro.org>, wsa@the-dreams.de
Cc: linux-i2c@vger.kernel.org, linux-crypto@vger.kernel.org,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
Herbert Xu <herbert@gondor.apana.org.au>
Subject: Re: [PATCH 2/9] crypto: atmel-ecc: Silently ignore missing clock frequency
Date: Mon, 11 Jun 2018 12:46:23 +0300 [thread overview]
Message-ID: <e33b8860-2ff4-da8f-8500-ad24ab6c1e4e@microchip.com> (raw)
In-Reply-To: <20180605134950.6605-2-linus.walleij@linaro.org>
Hi, Linus, Wolfram,
On 06/05/2018 04:49 PM, Linus Walleij wrote:
> The Atmel ECC driver contains a check for the I2C bus clock
> frequency, so as to check that the I2C adapter in use
> satisfies the device specs.
>
> If the device is connected to a device tree node that does not
> contain a clock frequency setting, such as an I2C mux or gate,
> this blocks the probe. Make the probe continue silently if
> no clock frequency can be found, assuming all is safe.
I don't think it's safe. We use bus_clk_rate to compute the ecc508's
wake token. If you can't wake the device, it will ignore all your
commands.
My proposal was to introduce a bus_freq_hz member in the i2c_adapter
structure (https://patchwork.kernel.org/patch/10307637/), but I haven't
received feedback yet, Wolfram?
I would say first to check the bus_freq_hz from adapter (if it will be
accepted) else to look into dt and, in the last case, if nowhere
provided, to block the probe.
Thanks,
ta
>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> drivers/crypto/atmel-ecc.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/crypto/atmel-ecc.c b/drivers/crypto/atmel-ecc.c
> index e66f18a0ddd0..145ab3a39a56 100644
> --- a/drivers/crypto/atmel-ecc.c
> +++ b/drivers/crypto/atmel-ecc.c
> @@ -657,14 +657,13 @@ static int atmel_ecc_probe(struct i2c_client *client,
> return -ENODEV;
> }
>
> + /*
> + * Silently assume all is fine if there is no
> + * "clock-frequency" property.
> + */
> ret = of_property_read_u32(client->adapter->dev.of_node,
> "clock-frequency", &bus_clk_rate);
> - if (ret) {
> - dev_err(dev, "of: failed to read clock-frequency property\n");
> - return ret;
> - }
> -
> - if (bus_clk_rate > 1000000L) {
> + if (!ret && (bus_clk_rate > 1000000L)) {
> dev_err(dev, "%d exceeds maximum supported clock frequency (1MHz)\n",
> bus_clk_rate);
> return -EINVAL;
>
next parent reply other threads:[~2018-06-11 9:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20180605134950.6605-1-linus.walleij@linaro.org>
[not found] ` <20180605134950.6605-2-linus.walleij@linaro.org>
2018-06-11 9:46 ` Tudor Ambarus [this message]
2018-06-28 8:47 ` [PATCH 2/9] crypto: atmel-ecc: Silently ignore missing clock frequency Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e33b8860-2ff4-da8f-8500-ad24ab6c1e4e@microchip.com \
--to=tudor.ambarus@microchip.com \
--cc=herbert@gondor.apana.org.au \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).