misc: atsha204a: bug fixes
v2 cover misc: atsha204a: bug fixes
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(-)
Signature · 1 line
2.34.1
PATCH v2 1/3 misc: atsha204a: return timeout from wakeup function
If the maximum number of wake-up attempts is exceeded, return -ETIMEDOUT.
--- drivers/misc/atsha204a-i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/atsha204a-i2c.c +2 -2
@@ -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)
Signature · 1 line
2.34.1
Re: [PATCH v2 1/3] misc: atsha204a: return timeout from wakeup function
Quoted 3 lines · On Tue, 11 Jan 2022 19:05:29 +0100 Adrian Fiergolski…
If the maximum number of wake-up attempts is exceeded, return
-ETIMEDOUT.Signed-off-by Adrian Fiergolski <[email protected]>
PATCH v2 2/3 misc: atsha204a: add delay after sending the message
In reply to Adrian FiergolskiOnce request is sent, and before receiving a response, the delay is required. This patch fixes missing delay for before first response try.
--- drivers/misc/atsha204a-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/atsha204a-i2c.c +1 -1
@@ -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 );
Signature · 1 line
2.34.1
Re: [PATCH v2 2/3] misc: atsha204a: add delay after sending the message
Quoted 4 lines · On Tue, 11 Jan 2022 19:05:30 +0100 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 <[email protected]>
PATCH v2 3/3 misc: atsha204a: fix i2c address readout from DTS
In reply to Adrian FiergolskiThis patch replaces use fdtdec_get_addr with simpler dev_read_addr(). fdtdec_get_addr doesn't work properly on ZynqMP-based (64bit) system. Although not confirmed, it could be related to the fact, that quoting the 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)".
--- drivers/misc/atsha204a-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/atsha204a-i2c.c +1 -1
@@ -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 =dev_read_addr (dev);if (addr ==FDT_ADDR_T_NONE ) {debug ("Can't get ATSHA204A I2C base address\n" );return -ENXIO ;
Signature · 1 line
2.34.1
Re: [PATCH v2 3/3] misc: atsha204a: fix i2c address readout from DTS
Quoted 7 lines · On Tue, 11 Jan 2022 19:05:31 +0100 Adrian Fiergolski…
This patch replaces use
fdtdec_get_addrwith simplerdev_read_addr().fdtdec_get_addrdoesn't work properly on ZynqMP-based (64bit) system. Although not confirmed, it could be related to the fact, that quoting the documentation, "This variant hard-codes the number of cells used to represent the address and size based onsizeof(fdt_addr_t)andsizeof(fdt_size_t)".Signed-off-by Adrian Fiergolski <[email protected]>