All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: linux-crypto@vger.kernel.org
Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Tudor Ambarus <tudor.ambarus@microchip.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: [PATCH v2 1/6] i2c: acpi: permit bus speed to be discovered after enumeration
Date: Fri, 24 May 2019 18:26:46 +0200	[thread overview]
Message-ID: <20190524162651.28189-2-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20190524162651.28189-1-ard.biesheuvel@linaro.org>

Currently, the I2C ACPI enumeration code only permits the max bus rate
to be discovered before enumerating the slaves on the bus. In some
cases, drivers for slave devices may require this information, e.g.,
some ATmel crypto drivers need to generate a so-called wake token
of a fixed duration, regardless of the bus rate.

So tweak the code so i2c_acpi_lookup_speed() is able to obtain this
information after enumeration as well.

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 drivers/i2c/i2c-core-acpi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c
index 272800692088..7240cc07abb4 100644
--- a/drivers/i2c/i2c-core-acpi.c
+++ b/drivers/i2c/i2c-core-acpi.c
@@ -115,8 +115,7 @@ static int i2c_acpi_do_lookup(struct acpi_device *adev,
 	struct list_head resource_list;
 	int ret;
 
-	if (acpi_bus_get_status(adev) || !adev->status.present ||
-	    acpi_device_enumerated(adev))
+	if (acpi_bus_get_status(adev) || !adev->status.present)
 		return -EINVAL;
 
 	if (acpi_match_device_ids(adev, i2c_acpi_ignored_device_ids) == 0)
@@ -151,6 +150,9 @@ static int i2c_acpi_get_info(struct acpi_device *adev,
 	lookup.info = info;
 	lookup.index = -1;
 
+	if (acpi_device_enumerated(adev))
+		return -EINVAL;
+
 	ret = i2c_acpi_do_lookup(adev, &lookup);
 	if (ret)
 		return ret;
-- 
2.20.1


WARNING: multiple messages have this Message-ID (diff)
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: linux-crypto@vger.kernel.org
Cc: devicetree@vger.kernel.org,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Tudor Ambarus <tudor.ambarus@microchip.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/6] i2c: acpi: permit bus speed to be discovered after enumeration
Date: Fri, 24 May 2019 18:26:46 +0200	[thread overview]
Message-ID: <20190524162651.28189-2-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20190524162651.28189-1-ard.biesheuvel@linaro.org>

Currently, the I2C ACPI enumeration code only permits the max bus rate
to be discovered before enumerating the slaves on the bus. In some
cases, drivers for slave devices may require this information, e.g.,
some ATmel crypto drivers need to generate a so-called wake token
of a fixed duration, regardless of the bus rate.

So tweak the code so i2c_acpi_lookup_speed() is able to obtain this
information after enumeration as well.

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 drivers/i2c/i2c-core-acpi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c
index 272800692088..7240cc07abb4 100644
--- a/drivers/i2c/i2c-core-acpi.c
+++ b/drivers/i2c/i2c-core-acpi.c
@@ -115,8 +115,7 @@ static int i2c_acpi_do_lookup(struct acpi_device *adev,
 	struct list_head resource_list;
 	int ret;
 
-	if (acpi_bus_get_status(adev) || !adev->status.present ||
-	    acpi_device_enumerated(adev))
+	if (acpi_bus_get_status(adev) || !adev->status.present)
 		return -EINVAL;
 
 	if (acpi_match_device_ids(adev, i2c_acpi_ignored_device_ids) == 0)
@@ -151,6 +150,9 @@ static int i2c_acpi_get_info(struct acpi_device *adev,
 	lookup.info = info;
 	lookup.index = -1;
 
+	if (acpi_device_enumerated(adev))
+		return -EINVAL;
+
 	ret = i2c_acpi_do_lookup(adev, &lookup);
 	if (ret)
 		return ret;
-- 
2.20.1

WARNING: multiple messages have this Message-ID (diff)
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: linux-crypto@vger.kernel.org
Cc: devicetree@vger.kernel.org,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Tudor Ambarus <tudor.ambarus@microchip.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/6] i2c: acpi: permit bus speed to be discovered after enumeration
Date: Fri, 24 May 2019 18:26:46 +0200	[thread overview]
Message-ID: <20190524162651.28189-2-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20190524162651.28189-1-ard.biesheuvel@linaro.org>

Currently, the I2C ACPI enumeration code only permits the max bus rate
to be discovered before enumerating the slaves on the bus. In some
cases, drivers for slave devices may require this information, e.g.,
some ATmel crypto drivers need to generate a so-called wake token
of a fixed duration, regardless of the bus rate.

So tweak the code so i2c_acpi_lookup_speed() is able to obtain this
information after enumeration as well.

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 drivers/i2c/i2c-core-acpi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c
index 272800692088..7240cc07abb4 100644
--- a/drivers/i2c/i2c-core-acpi.c
+++ b/drivers/i2c/i2c-core-acpi.c
@@ -115,8 +115,7 @@ static int i2c_acpi_do_lookup(struct acpi_device *adev,
 	struct list_head resource_list;
 	int ret;
 
-	if (acpi_bus_get_status(adev) || !adev->status.present ||
-	    acpi_device_enumerated(adev))
+	if (acpi_bus_get_status(adev) || !adev->status.present)
 		return -EINVAL;
 
 	if (acpi_match_device_ids(adev, i2c_acpi_ignored_device_ids) == 0)
@@ -151,6 +150,9 @@ static int i2c_acpi_get_info(struct acpi_device *adev,
 	lookup.info = info;
 	lookup.index = -1;
 
+	if (acpi_device_enumerated(adev))
+		return -EINVAL;
+
 	ret = i2c_acpi_do_lookup(adev, &lookup);
 	if (ret)
 		return ret;
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-05-24 16:27 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-24 16:26 [PATCH v2 0/6] crypto - wire up Atmel SHA204A as RNG in DT and ACPI mode Ard Biesheuvel
2019-05-24 16:26 ` Ard Biesheuvel
2019-05-24 16:26 ` Ard Biesheuvel
2019-05-24 16:26 ` Ard Biesheuvel [this message]
2019-05-24 16:26   ` [PATCH v2 1/6] i2c: acpi: permit bus speed to be discovered after enumeration Ard Biesheuvel
2019-05-24 16:26   ` Ard Biesheuvel
2019-05-24 16:26 ` [PATCH v2 2/6] crypto: atmel-ecc: add support for ACPI probing on non-AT91 platforms Ard Biesheuvel
2019-05-24 16:26   ` Ard Biesheuvel
2019-05-24 16:26   ` Ard Biesheuvel
2019-05-24 21:52   ` Linus Walleij
2019-05-24 21:52     ` Linus Walleij
2019-05-24 21:52     ` Linus Walleij
2019-05-24 16:26 ` [PATCH v2 3/6] crypto: atmel-ecc: factor out code that can be shared Ard Biesheuvel
2019-05-24 16:26   ` Ard Biesheuvel
2019-05-24 16:26   ` Ard Biesheuvel
2019-05-24 16:26 ` [PATCH v2 4/6] crypto: atmel-i2c: add support for SHA204A random number generator Ard Biesheuvel
2019-05-24 16:26   ` Ard Biesheuvel
2019-05-24 16:26   ` Ard Biesheuvel
2019-05-24 16:26 ` [PATCH v2 5/6] dt-bindings: add Atmel SHA204A I2C crypto processor Ard Biesheuvel
2019-05-24 16:26   ` Ard Biesheuvel
2019-05-24 16:26   ` Ard Biesheuvel
2019-05-24 19:42   ` Rob Herring
2019-05-24 19:42     ` Rob Herring
2019-05-24 19:42     ` Rob Herring
2019-05-24 16:26 ` [PATCH v2 6/6] dt-bindings: move Atmel ECC508A I2C crypto processor to trivial-devices Ard Biesheuvel
2019-05-24 16:26   ` Ard Biesheuvel
2019-05-24 16:26   ` Ard Biesheuvel
2019-05-24 19:43   ` Rob Herring
2019-05-24 19:43     ` Rob Herring
2019-05-24 19:43     ` Rob Herring
2019-05-30 13:44 ` [PATCH v2 0/6] crypto - wire up Atmel SHA204A as RNG in DT and ACPI mode Herbert Xu
2019-05-30 13:44   ` Herbert Xu
2019-05-30 13:44   ` Herbert Xu

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=20190524162651.28189-2-ard.biesheuvel@linaro.org \
    --to=ard.biesheuvel@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --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=mika.westerberg@linux.intel.com \
    --cc=tudor.ambarus@microchip.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.