All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] misc: atsha204a: bug fixes
@ 2021-12-21 16:17 Adrian Fiergolski
  2021-12-21 16:17 ` [PATCH 1/3] misc: atsha204a: return timeout from wakeup function Adrian Fiergolski
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Adrian Fiergolski @ 2021-12-21 16:17 UTC (permalink / raw)
  To: u-boot; +Cc: marek.behun, tmshlvck, jbd, Adrian Fiergolski

Series of patches fixing atsha204a driver. Partially inspired by Enclustra's repo [1].

[1] https://github.com/enclustra-bsp/xilinx-uboot

Adrian Fiergolski (3):
  misc: atsha204a: return timeout from wakeup function
  misc: atsha204a: add delay after sending the message
  misc: atsha204a: fix i2c address readout from DTS

 drivers/misc/atsha204a-i2c.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/3] misc: atsha204a: return timeout from wakeup function
  2021-12-21 16:17 [PATCH 0/3] misc: atsha204a: bug fixes Adrian Fiergolski
@ 2021-12-21 16:17 ` Adrian Fiergolski
  2021-12-21 17:41   ` Marek Behún
  2021-12-21 16:17 ` [PATCH 2/3] misc: atsha204a: add delay after sending the message Adrian Fiergolski
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Adrian Fiergolski @ 2021-12-21 16:17 UTC (permalink / raw)
  To: u-boot; +Cc: marek.behun, tmshlvck, jbd, Adrian Fiergolski

If the maximum number of wake-up attempts is exceeded, return -ETIMEDOUT.

Signed-off-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
---
 drivers/misc/atsha204a-i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/atsha204a-i2c.c b/drivers/misc/atsha204a-i2c.c
index 715dabb279..9d069fb33c 100644
--- a/drivers/misc/atsha204a-i2c.c
+++ b/drivers/misc/atsha204a-i2c.c
@@ -240,10 +240,10 @@ int atsha204a_wakeup(struct udevice *dev)
 		}
 
 		debug("success\n");
-		break;
+		return 0;
 	}
 
-	return 0;
+	return -ETIMEDOUT;
 }
 
 int atsha204a_idle(struct udevice *dev)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] misc: atsha204a: add delay after sending the message
  2021-12-21 16:17 [PATCH 0/3] misc: atsha204a: bug fixes Adrian Fiergolski
  2021-12-21 16:17 ` [PATCH 1/3] misc: atsha204a: return timeout from wakeup function Adrian Fiergolski
@ 2021-12-21 16:17 ` Adrian Fiergolski
  2021-12-21 17:49   ` Marek Behún
  2021-12-21 16:17 ` [PATCH 3/3] misc: atsha204a: fix i2c address readout from DTS Adrian Fiergolski
  2021-12-21 17:00 ` [PATCH 0/3] misc: atsha204a: bug fixes Josh Datko
  3 siblings, 1 reply; 10+ messages in thread
From: Adrian Fiergolski @ 2021-12-21 16:17 UTC (permalink / raw)
  To: u-boot; +Cc: marek.behun, tmshlvck, jbd, Adrian Fiergolski

Once request is sent, and before receiving a response, the delay is required.
This patch fixes missing delay for before first response try.

Signed-off-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
---
 drivers/misc/atsha204a-i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/atsha204a-i2c.c b/drivers/misc/atsha204a-i2c.c
index 9d069fb33c..d264477927 100644
--- a/drivers/misc/atsha204a-i2c.c
+++ b/drivers/misc/atsha204a-i2c.c
@@ -280,6 +280,7 @@ static int atsha204a_transaction(struct udevice *dev, struct atsha204a_req *req,
 	}
 
 	do {
+		udelay(ATSHA204A_EXECTIME);
 		res = atsha204a_recv_resp(dev, resp);
 		if (!res || res == -EMSGSIZE || res == -EBADMSG)
 			break;
@@ -287,7 +288,6 @@ static int atsha204a_transaction(struct udevice *dev, struct atsha204a_req *req,
 		debug("ATSHA204A transaction polling for response "
 		      "(timeout = %d)\n", timeout);
 
-		udelay(ATSHA204A_EXECTIME);
 		timeout -= ATSHA204A_EXECTIME;
 	} while (timeout > 0);
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3] misc: atsha204a: fix i2c address readout from DTS
  2021-12-21 16:17 [PATCH 0/3] misc: atsha204a: bug fixes Adrian Fiergolski
  2021-12-21 16:17 ` [PATCH 1/3] misc: atsha204a: return timeout from wakeup function Adrian Fiergolski
  2021-12-21 16:17 ` [PATCH 2/3] misc: atsha204a: add delay after sending the message Adrian Fiergolski
@ 2021-12-21 16:17 ` Adrian Fiergolski
  2021-12-21 17:52   ` Marek Behún
  2021-12-21 17:00 ` [PATCH 0/3] misc: atsha204a: bug fixes Josh Datko
  3 siblings, 1 reply; 10+ messages in thread
From: Adrian Fiergolski @ 2021-12-21 16:17 UTC (permalink / raw)
  To: u-boot; +Cc: marek.behun, tmshlvck, jbd, Adrian Fiergolski

This patch replaces use fdtdec_get_addr with recommended fdtdec_get_addr_size_auto_parent.

Signed-off-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
---
 drivers/misc/atsha204a-i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/atsha204a-i2c.c b/drivers/misc/atsha204a-i2c.c
index d264477927..1008b914c2 100644
--- a/drivers/misc/atsha204a-i2c.c
+++ b/drivers/misc/atsha204a-i2c.c
@@ -388,7 +388,7 @@ static int atsha204a_of_to_plat(struct udevice *dev)
 	fdt_addr_t *priv = dev_get_priv(dev);
 	fdt_addr_t addr;
 
-	addr = fdtdec_get_addr(gd->fdt_blob, dev_of_offset(dev), "reg");
+	addr = fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, dev_of_offset(dev), "reg", 0, NULL, false);
 	if (addr == FDT_ADDR_T_NONE) {
 		debug("Can't get ATSHA204A I2C base address\n");
 		return -ENXIO;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/3] misc: atsha204a: bug fixes
  2021-12-21 16:17 [PATCH 0/3] misc: atsha204a: bug fixes Adrian Fiergolski
                   ` (2 preceding siblings ...)
  2021-12-21 16:17 ` [PATCH 3/3] misc: atsha204a: fix i2c address readout from DTS Adrian Fiergolski
@ 2021-12-21 17:00 ` Josh Datko
  2021-12-21 17:55   ` Marek Behún
  3 siblings, 1 reply; 10+ messages in thread
From: Josh Datko @ 2021-12-21 17:00 UTC (permalink / raw)
  To: Adrian Fiergolski; +Cc: u-boot, marek.behun, tmshlvck

Thanks everyone for including me — I don’t have any code comments but I will say that this i2c driver, with the exception of the i2c default address (which looks like is being set via the device tree anyway), should also work with the ATECC508, ATECC608A, ATECC608B (which is the one of those three recommended for new designs) as I believe the interface at this level was not changed.

So that might be a nice comment or add to documentation. Otherwise, I’m glad to see y’all supporting this.

Also, it’s been a while since I’ve been active on such mailing lists, so I can’t remember the reply etiquette exactly. Apologizes in advance for the naive top-post :)

Josh



> On Dec 21, 2021, at 9:17 AM, Adrian Fiergolski <adrian.fiergolski@fastree3d.com> wrote:
> 
> Series of patches fixing atsha204a driver. Partially inspired by Enclustra's repo [1].
> 
> [1] https://github.com/enclustra-bsp/xilinx-uboot
> 
> Adrian Fiergolski (3):
>  misc: atsha204a: return timeout from wakeup function
>  misc: atsha204a: add delay after sending the message
>  misc: atsha204a: fix i2c address readout from DTS
> 
> drivers/misc/atsha204a-i2c.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
> 
> -- 
> 2.34.1
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] misc: atsha204a: return timeout from wakeup function
  2021-12-21 16:17 ` [PATCH 1/3] misc: atsha204a: return timeout from wakeup function Adrian Fiergolski
@ 2021-12-21 17:41   ` Marek Behún
  0 siblings, 0 replies; 10+ messages in thread
From: Marek Behún @ 2021-12-21 17:41 UTC (permalink / raw)
  To: Adrian Fiergolski; +Cc: u-boot, tmshlvck, jbd

On Tue, 21 Dec 2021 17:17:20 +0100
Adrian Fiergolski <adrian.fiergolski@fastree3d.com> wrote:

> If the maximum number of wake-up attempts is exceeded, return -ETIMEDOUT.
> 
> Signed-off-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>

Reviewed-by: Marek Behún <marek.behun@nic.cz>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] misc: atsha204a: add delay after sending the message
  2021-12-21 16:17 ` [PATCH 2/3] misc: atsha204a: add delay after sending the message Adrian Fiergolski
@ 2021-12-21 17:49   ` Marek Behún
  0 siblings, 0 replies; 10+ messages in thread
From: Marek Behún @ 2021-12-21 17:49 UTC (permalink / raw)
  To: Adrian Fiergolski; +Cc: u-boot, tmshlvck, jbd

On Tue, 21 Dec 2021 17:17:21 +0100
Adrian Fiergolski <adrian.fiergolski@fastree3d.com> wrote:

> Once request is sent, and before receiving a response, the delay is required.
> This patch fixes missing delay for before first response try.
> 
> Signed-off-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>

Reviewed-by: Marek Behún <marek.behun@nic.cz>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] misc: atsha204a: fix i2c address readout from DTS
  2021-12-21 16:17 ` [PATCH 3/3] misc: atsha204a: fix i2c address readout from DTS Adrian Fiergolski
@ 2021-12-21 17:52   ` Marek Behún
  2022-01-11 17:56     ` Adrian Fiergolski
  0 siblings, 1 reply; 10+ messages in thread
From: Marek Behún @ 2021-12-21 17:52 UTC (permalink / raw)
  To: Adrian Fiergolski; +Cc: u-boot, tmshlvck, jbd

On Tue, 21 Dec 2021 17:17:22 +0100
Adrian Fiergolski <adrian.fiergolski@fastree3d.com> wrote:

> This patch replaces use fdtdec_get_addr with recommended fdtdec_get_addr_size_auto_parent.

And why is that required?

If at all, I would rather change it to simple dev_read_addr().

Marek

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/3] misc: atsha204a: bug fixes
  2021-12-21 17:00 ` [PATCH 0/3] misc: atsha204a: bug fixes Josh Datko
@ 2021-12-21 17:55   ` Marek Behún
  0 siblings, 0 replies; 10+ messages in thread
From: Marek Behún @ 2021-12-21 17:55 UTC (permalink / raw)
  To: Josh Datko; +Cc: Adrian Fiergolski, u-boot, tmshlvck

On Tue, 21 Dec 2021 10:00:14 -0700
Josh Datko <jbd@cryptotronix.com> wrote:

> Thanks everyone for including me — I don’t have any code comments but I will say that this i2c driver, with the exception of the i2c default address (which looks like is being set via the device tree anyway), should also work with the ATECC508, ATECC608A, ATECC608B (which is the one of those three recommended for new designs) as I believe the interface at this level was not changed.

We have been unable to get those, wich current chip crisis, and so we
couldn't test.

Marek

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] misc: atsha204a: fix i2c address readout from DTS
  2021-12-21 17:52   ` Marek Behún
@ 2022-01-11 17:56     ` Adrian Fiergolski
  0 siblings, 0 replies; 10+ messages in thread
From: Adrian Fiergolski @ 2022-01-11 17:56 UTC (permalink / raw)
  To: Marek Behún; +Cc: u-boot, tmshlvck, jbd

Hi Marek,

Thank you for your review.

On 21.12.2021 18:52, Marek Behún wrote:
> On Tue, 21 Dec 2021 17:17:22 +0100
> Adrian Fiergolski <adrian.fiergolski@fastree3d.com> wrote:
>
>> This patch replaces use fdtdec_get_addr with recommended fdtdec_get_addr_size_auto_parent.
> And why is that required?
I didn't debug why exactly, but it didn't work with my embedded system 
based on ZynqMP (64bit). I might guess it's related to the fact that, 
quoting documentation, "This variant hard-codes the number of cells used 
to represent the address and size based on sizeof(fdt_addr_t) and 
sizeof(fdt_size_t)".
> If at all, I would rather change it to simple dev_read_addr().

Good idea, it's much cleaner. I have just confirmed it works as well. I 
will share the new version of the patches.

Adrian


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-01-11 17:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-21 16:17 [PATCH 0/3] misc: atsha204a: bug fixes Adrian Fiergolski
2021-12-21 16:17 ` [PATCH 1/3] misc: atsha204a: return timeout from wakeup function Adrian Fiergolski
2021-12-21 17:41   ` Marek Behún
2021-12-21 16:17 ` [PATCH 2/3] misc: atsha204a: add delay after sending the message Adrian Fiergolski
2021-12-21 17:49   ` Marek Behún
2021-12-21 16:17 ` [PATCH 3/3] misc: atsha204a: fix i2c address readout from DTS Adrian Fiergolski
2021-12-21 17:52   ` Marek Behún
2022-01-11 17:56     ` Adrian Fiergolski
2021-12-21 17:00 ` [PATCH 0/3] misc: atsha204a: bug fixes Josh Datko
2021-12-21 17:55   ` Marek Behún

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.