misc: atsha204a: Add support for atsha204 chip
PATCH 1/1 misc: atsha204a: Add support for atsha204 chip
atsha204 chip is predecessor of atsha204a chip. Current U-Boot driver atsha204a-i2c.c can use both atsha204 and atsha204a chips because it does not call specific functions to just one of these chips.
So just add compatible string for atsha204.
--- drivers/misc/atsha204a-i2c.c | 1 + 1 file changed, 1 insertion(+)
drivers/misc/atsha204a-i2c.c +1 -0
@@ -399,6 +399,7 @@ static int atsha204a_of_to_plat(struct udevice *dev) }static const struct udevice_id atsha204a_ids[] = { + { .compatible ="atmel,atsha204" }, { .compatible ="atmel,atsha204a" }, { } };
Signature · 1 line
2.20.1
Quoted 16 lines · Pali Rohár
atsha204 chip is predecessor of atsha204a chip. Current U-Boot driver
atsha204a-i2c.ccan use both atsha204 and atsha204a chips because it does not call specific functions to just one of these chips.So just add compatible string for atsha204.
Signed-off-by Pali Rohár <[email protected]>--- drivers/misc/atsha204a-i2c.c | 1 + 1 file changed, 1 insertion(+)drivers/misc/atsha204a-i2c.c +0
-0
drivers/misc/atsha204a-i2c.c static int atsha204a_of_to_plat(struct udevice *dev) · line 405
Quoted 7 lines
drivers/misc/atsha204a-i2c.c +1
-0@@ -399,6 +399,7 @@ static int atsha204a_of_to_plat(struct udevice *dev) }static const struct udevice_id atsha204a_ids[] = { + { .compatible ="atmel,atsha204" }, { .compatible ="atmel,atsha204a" }, { } };
Why do we need this new compatible here in the driver? A quick grep doesn't show this in any of the dts files, not in U-Boot and not in the Kernel.
Just checking...
Thanks,
Stefan
Quoted 12 lines · On Tuesday 05 April 2022 15:14:52 Stefan Roese wrote:
Quoted 11 lines · Pali Rohár
atsha204 chip is predecessor of atsha204a chip. Current U-Boot driver
atsha204a-i2c.ccan use both atsha204 and atsha204a chips because it does not call specific functions to just one of these chips.So just add compatible string for atsha204.
Signed-off-by Pali Rohár <[email protected]>--- drivers/misc/atsha204a-i2c.c | 1 + 1 file changed, 1 insertion(+)
Quoted 13 lines
drivers/misc/atsha204a-i2c.c static int atsha204a_of_to_plat(struct udevice *dev) · line 404
Quoted 11 lines
drivers/misc/atsha204a-i2c.c +1
-0@@ -399,6 +399,7 @@ static int atsha204a_of_to_plat(struct udevice *dev) }static const struct udevice_id atsha204a_ids[] = { + { .compatible ="atmel,atsha204" }, { .compatible ="atmel,atsha204a" }, { } };Why do we need this new compatible here in the driver?
They are different chips, so should have different compatible strings.
Quoted 3 lines
A quick grep
doesn't show this in any of the dts files, not in U-Boot and not in the Kernel.
Not yet. I'm preparing patches for a board which has atsha204 and will use this u-boot driver.
Quoted 4 lines
Just checking...
Thanks,
Stefan
Quoted 27 lines · Pali Rohár
Quoted 12 lines · On Tuesday 05 April 2022 15:14:52 Stefan Roese wrote:
Quoted 11 lines · Pali Rohár
atsha204 chip is predecessor of atsha204a chip. Current U-Boot driver
atsha204a-i2c.ccan use both atsha204 and atsha204a chips because it does not call specific functions to just one of these chips.So just add compatible string for atsha204.
Signed-off-by Pali Rohár <[email protected]>--- drivers/misc/atsha204a-i2c.c | 1 + 1 file changed, 1 insertion(+)Quoted 13 lines
drivers/misc/atsha204a-i2c.c static int atsha204a_of_to_plat(struct udevice *dev) · line 404
Quoted 11 lines
drivers/misc/atsha204a-i2c.c +1
-0@@ -399,6 +399,7 @@ static int atsha204a_of_to_plat(struct udevice *dev) }static const struct udevice_id atsha204a_ids[] = { + { .compatible ="atmel,atsha204" }, { .compatible ="atmel,atsha204a" }, { } };Why do we need this new compatible here in the driver?
Quoted 1 line
They are different chips,
Sure...
Quoted 1 line
so should have different compatible strings.
... but is this really necessary and "best practice"? If the driver can handle both chips without any changes, why do you need the new compatible here?
Don't get me wrong. I'm not blocking this change, just want to be sure that it's really necessary.
Thanks,
Stefan
Quoted 11 lines
Quoted 3 lines
A quick grep
doesn't show this in any of the dts files, not in U-Boot and not in the Kernel.Not yet. I'm preparing patches for a board which has atsha204 and will use this u-boot driver.
Quoted 4 lines
Just checking...
Thanks,
Stefan
Quoted 30 lines · On Tuesday 05 April 2022 15:52:17 Stefan Roese wrote:
Quoted 27 lines · Pali Rohár
Quoted 12 lines · On Tuesday 05 April 2022 15:14:52 Stefan Roese wrote:
Quoted 11 lines · Pali Rohár
atsha204 chip is predecessor of atsha204a chip. Current U-Boot driver
atsha204a-i2c.ccan use both atsha204 and atsha204a chips because it does not call specific functions to just one of these chips.So just add compatible string for atsha204.
Signed-off-by Pali Rohár <[email protected]>--- drivers/misc/atsha204a-i2c.c | 1 + 1 file changed, 1 insertion(+)Quoted 13 lines
drivers/misc/atsha204a-i2c.c static int atsha204a_of_to_plat(struct udevice *dev) · line 404
Quoted 11 lines
drivers/misc/atsha204a-i2c.c +1
-0@@ -399,6 +399,7 @@ static int atsha204a_of_to_plat(struct udevice *dev) }static const struct udevice_id atsha204a_ids[] = { + { .compatible ="atmel,atsha204" }, { .compatible ="atmel,atsha204a" }, { } };Why do we need this new compatible here in the driver?
Quoted 1 line
They are different chips,
Quoted 7 lines
Sure...
Quoted 1 line
so should have different compatible strings.
... but is this really necessary and "best practice"? If the driver can handle both chips without any changes, why do you need the new compatible here?
Well, currently it can handle both of them.
But if driver is going to be extended to support e.g. SHA command (Calculate a SHA256 digest) then this command should be issued only for atsha204a. atsha204 does not support it.
Similarly, if other DTS-based system is going to implement that SHA command, it would mean that U-Boot DTS file would not be compatible with that other system.
Also it is a good idea to have DTS files and its compatible strings universal and not u-boot specific. So it could be used also by other projects (e.g. linux kernel).
And if we mix now two chips which are similar (and supports lot of common operations) we would not be able in future to extend drivers in backward compatible manner.
Just to note, I'm not going to implement atsha204a specific commands (which are not available in atsha204; like SHA command) because I do not need them (right now).
Quoted 2 lines
Don't get me wrong. I'm not blocking this change, just want to be sure that it's really necessary.
In case U-Boot driver has compatible string something like "atsha204-common" which could say that driver is using only functions which are available in all chip family then there would not be need for it. But if driver has chip specific name, I think the best is not to mask one chip by another which does not have 1:1 SW API compatibility.
Quoted 15 lines
Thanks,
StefanQuoted 11 lines
Quoted 3 lines
A quick grep
doesn't show this in any of the dts files, not in U-Boot and not in the Kernel.Not yet. I'm preparing patches for a board which has atsha204 and will use this u-boot driver.
Quoted 4 lines
Just checking...
Thanks,
Stefan
Hello Pali,
Quoted 61 lines · Pali Rohár
Quoted 30 lines · On Tuesday 05 April 2022 15:52:17 Stefan Roese wrote:
Quoted 27 lines · Pali Rohár
Quoted 12 lines · On Tuesday 05 April 2022 15:14:52 Stefan Roese wrote:
Quoted 11 lines · Pali Rohár
atsha204 chip is predecessor of atsha204a chip. Current U-Boot driver
atsha204a-i2c.ccan use both atsha204 and atsha204a chips because it does not call specific functions to just one of these chips.So just add compatible string for atsha204.
Signed-off-by Pali Rohár <[email protected]>--- drivers/misc/atsha204a-i2c.c | 1 + 1 file changed, 1 insertion(+)Quoted 13 lines
drivers/misc/atsha204a-i2c.c static int atsha204a_of_to_plat(struct udevice *dev) · line 404
Quoted 11 lines
drivers/misc/atsha204a-i2c.c +1
-0@@ -399,6 +399,7 @@ static int atsha204a_of_to_plat(struct udevice *dev) }static const struct udevice_id atsha204a_ids[] = { + { .compatible ="atmel,atsha204" }, { .compatible ="atmel,atsha204a" }, { } };Why do we need this new compatible here in the driver?
Quoted 1 line
They are different chips,
Quoted 7 lines
Sure...
Quoted 1 line
so should have different compatible strings.
... but is this really necessary and "best practice"? If the driver can handle both chips without any changes, why do you need the new compatible here?
Well, currently it can handle both of them.
But if driver is going to be extended to support e.g. SHA command (Calculate a SHA256 digest) then this command should be issued only for atsha204a. atsha204 does not support it.
Similarly, if other DTS-based system is going to implement that SHA command, it would mean that U-Boot DTS file would not be compatible with that other system.
Also it is a good idea to have DTS files and its compatible strings universal and not u-boot specific. So it could be used also by other projects (e.g. linux kernel).
And if we mix now two chips which are similar (and supports lot of common operations) we would not be able in future to extend drivers in backward compatible manner.
Just to note, I'm not going to implement atsha204a specific commands (which are not available in atsha204; like SHA command) because I do not need them (right now).
Quoted 8 lines
Quoted 2 lines
Don't get me wrong. I'm not blocking this change, just want to be sure that it's really necessary.
In case U-Boot driver has compatible string something like "atsha204-common" which could say that driver is using only functions which are available in all chip family then there would not be need for it. But if driver has chip specific name, I think the best is not to mask one chip by another which does not have 1:1 SW API compatibility.
From my side this is full okay to add here a new compatibility string to differ between the two chips, and to see in DTS immediately which chip is on the board. Also later if the driver really supports features the other chip does not have, you do not need to change DTS anymore.
I would love to see this patch first in linux. Do you plan to sent similiar change to linux?
And not forget, please add a documentation for the compatible string in u-boot:/doc/device-tree-bindings/
Thanks!
bye,
Heiko
Quoted 16 lines
Quoted 16 lines
Thanks,
StefanQuoted 11 lines
Quoted 3 lines
A quick grep
doesn't show this in any of the dts files, not in U-Boot and not in the Kernel.Not yet. I'm preparing patches for a board which has atsha204 and will use this u-boot driver.
Quoted 4 lines
Just checking...
Thanks,
Stefan
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: [email protected]
Quoted 73 lines · On Thursday 21 April 2022 06:11:11 Heiko Schocher wrote:
Hello Pali,
Quoted 61 lines · Pali Rohár
Quoted 30 lines · On Tuesday 05 April 2022 15:52:17 Stefan Roese wrote:
Quoted 27 lines · Pali Rohár
Quoted 12 lines · On Tuesday 05 April 2022 15:14:52 Stefan Roese wrote:
Quoted 11 lines · Pali Rohár
atsha204 chip is predecessor of atsha204a chip. Current U-Boot driver
atsha204a-i2c.ccan use both atsha204 and atsha204a chips because it does not call specific functions to just one of these chips.So just add compatible string for atsha204.
Signed-off-by Pali Rohár <[email protected]>--- drivers/misc/atsha204a-i2c.c | 1 + 1 file changed, 1 insertion(+)Quoted 13 lines
drivers/misc/atsha204a-i2c.c static int atsha204a_of_to_plat(struct udevice *dev) · line 404
Quoted 11 lines
drivers/misc/atsha204a-i2c.c +1
-0@@ -399,6 +399,7 @@ static int atsha204a_of_to_plat(struct udevice *dev) }static const struct udevice_id atsha204a_ids[] = { + { .compatible ="atmel,atsha204" }, { .compatible ="atmel,atsha204a" }, { } };Why do we need this new compatible here in the driver?
Quoted 1 line
They are different chips,
Quoted 7 lines
Sure...
Quoted 1 line
so should have different compatible strings.
... but is this really necessary and "best practice"? If the driver can handle both chips without any changes, why do you need the new compatible here?
Well, currently it can handle both of them.
But if driver is going to be extended to support e.g. SHA command (Calculate a SHA256 digest) then this command should be issued only for atsha204a. atsha204 does not support it.
Similarly, if other DTS-based system is going to implement that SHA command, it would mean that U-Boot DTS file would not be compatible with that other system.
Also it is a good idea to have DTS files and its compatible strings universal and not u-boot specific. So it could be used also by other projects (e.g. linux kernel).
And if we mix now two chips which are similar (and supports lot of common operations) we would not be able in future to extend drivers in backward compatible manner.
Just to note, I'm not going to implement atsha204a specific commands (which are not available in atsha204; like SHA command) because I do not need them (right now).
Quoted 8 lines
Quoted 2 lines
Don't get me wrong. I'm not blocking this change, just want to be sure that it's really necessary.
In case U-Boot driver has compatible string something like "atsha204-common" which could say that driver is using only functions which are available in all chip family then there would not be need for it. But if driver has chip specific name, I think the best is not to mask one chip by another which does not have 1:1 SW API compatibility.
Quoted 7 lines
From my side this is full okay to add here a new compatibility string to differ between the two chips, and to see in DTS immediately which chip is on the board. Also later if the driver really supports features the other chip does not have, you do not need to change DTS anymore.
I would love to see this patch first in linux. Do you plan to sent similiar change to linux?
Hello! We are not using Linux kernel driver for atsha cryptochips (I was told that it decrease lifetime) but I can send also similar change to Linux.
Quoted 2 lines
And not forget, please add a documentation for the compatible string in u-boot:/doc/device-tree-bindings/
Currently I do not see any information about atsha in u-boot/doc/device-tree-bindings.
Quoted 25 lines
Thanks!
bye,
HeikoQuoted 16 lines
Quoted 16 lines
Thanks,
StefanQuoted 11 lines
Quoted 3 lines
A quick grep
doesn't show this in any of the dts files, not in U-Boot and not in the Kernel.Not yet. I'm preparing patches for a board which has atsha204 and will use this u-boot driver.
Quoted 4 lines
Just checking...
Thanks,
StefanSignature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: [email protected]
Quoted 79 lines · On Thursday 21 April 2022 11:40:47 Pali Rohár wrote:
Quoted 78 lines · On Thursday 21 April 2022 06:11:11 Heiko Schocher wrote:
Hello Pali,
Quoted 61 lines · Pali Rohár
Quoted 30 lines · On Tuesday 05 April 2022 15:52:17 Stefan Roese wrote:
Quoted 27 lines · Pali Rohár
Quoted 12 lines · On Tuesday 05 April 2022 15:14:52 Stefan Roese wrote:
Quoted 11 lines · Pali Rohár
atsha204 chip is predecessor of atsha204a chip. Current U-Boot driver
atsha204a-i2c.ccan use both atsha204 and atsha204a chips because it does not call specific functions to just one of these chips.So just add compatible string for atsha204.
Signed-off-by Pali Rohár <[email protected]>--- drivers/misc/atsha204a-i2c.c | 1 + 1 file changed, 1 insertion(+)Quoted 13 lines
drivers/misc/atsha204a-i2c.c static int atsha204a_of_to_plat(struct udevice *dev) · line 404
Quoted 11 lines
drivers/misc/atsha204a-i2c.c +1
-0@@ -399,6 +399,7 @@ static int atsha204a_of_to_plat(struct udevice *dev) }static const struct udevice_id atsha204a_ids[] = { + { .compatible ="atmel,atsha204" }, { .compatible ="atmel,atsha204a" }, { } };Why do we need this new compatible here in the driver?
Quoted 1 line
They are different chips,
Quoted 7 lines
Sure...
Quoted 1 line
so should have different compatible strings.
... but is this really necessary and "best practice"? If the driver can handle both chips without any changes, why do you need the new compatible here?
Well, currently it can handle both of them.
But if driver is going to be extended to support e.g. SHA command (Calculate a SHA256 digest) then this command should be issued only for atsha204a. atsha204 does not support it.
Similarly, if other DTS-based system is going to implement that SHA command, it would mean that U-Boot DTS file would not be compatible with that other system.
Also it is a good idea to have DTS files and its compatible strings universal and not u-boot specific. So it could be used also by other projects (e.g. linux kernel).
And if we mix now two chips which are similar (and supports lot of common operations) we would not be able in future to extend drivers in backward compatible manner.
Just to note, I'm not going to implement atsha204a specific commands (which are not available in atsha204; like SHA command) because I do not need them (right now).
Quoted 8 lines
Quoted 2 lines
Don't get me wrong. I'm not blocking this change, just want to be sure that it's really necessary.
In case U-Boot driver has compatible string something like "atsha204-common" which could say that driver is using only functions which are available in all chip family then there would not be need for it. But if driver has chip specific name, I think the best is not to mask one chip by another which does not have 1:1 SW API compatibility.
From my side this is full okay to add here a new compatibility string to differ between the two chips, and to see in DTS immediately which chip is on the board. Also later if the driver really supports features the other chip does not have, you do not need to change DTS anymore.
Quoted 6 lines
Quoted 2 lines
I would love to see this patch first in linux. Do you plan to sent similiar change to linux?
Hello! We are not using Linux kernel driver for atsha cryptochips (I was told that it decrease lifetime) but I can send also similar change to Linux.
Now I sent patch to Linux:
https://lore.kernel.org/linux-crypto/[email protected]/T/#u
Quoted 31 lines
Quoted 2 lines
And not forget, please add a documentation for the compatible string in u-boot:/doc/device-tree-bindings/
Currently I do not see any information about atsha in u-boot/doc/device-tree-bindings.
Quoted 25 lines
Thanks!
bye,
HeikoQuoted 16 lines
Quoted 16 lines
Thanks,
StefanQuoted 11 lines
Quoted 3 lines
A quick grep
doesn't show this in any of the dts files, not in U-Boot and not in the Kernel.Not yet. I'm preparing patches for a board which has atsha204 and will use this u-boot driver.
Quoted 4 lines
Just checking...
Thanks,
StefanSignature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: [email protected]
Hello Pali,
Quoted 79 lines · Pali Rohár
Quoted 78 lines · On Thursday 21 April 2022 06:11:11 Heiko Schocher wrote:
Hello Pali,
Quoted 61 lines · Pali Rohár
Quoted 30 lines · On Tuesday 05 April 2022 15:52:17 Stefan Roese wrote:
Quoted 27 lines · Pali Rohár
Quoted 12 lines · On Tuesday 05 April 2022 15:14:52 Stefan Roese wrote:
Quoted 11 lines · Pali Rohár
atsha204 chip is predecessor of atsha204a chip. Current U-Boot driver
atsha204a-i2c.ccan use both atsha204 and atsha204a chips because it does not call specific functions to just one of these chips.So just add compatible string for atsha204.
Signed-off-by Pali Rohár <[email protected]>--- drivers/misc/atsha204a-i2c.c | 1 + 1 file changed, 1 insertion(+)Quoted 13 lines
drivers/misc/atsha204a-i2c.c static int atsha204a_of_to_plat(struct udevice *dev) · line 404
Quoted 11 lines
drivers/misc/atsha204a-i2c.c +1
-0@@ -399,6 +399,7 @@ static int atsha204a_of_to_plat(struct udevice *dev) }static const struct udevice_id atsha204a_ids[] = { + { .compatible ="atmel,atsha204" }, { .compatible ="atmel,atsha204a" }, { } };Why do we need this new compatible here in the driver?
Quoted 1 line
They are different chips,
Quoted 7 lines
Sure...
Quoted 1 line
so should have different compatible strings.
... but is this really necessary and "best practice"? If the driver can handle both chips without any changes, why do you need the new compatible here?
Well, currently it can handle both of them.
But if driver is going to be extended to support e.g. SHA command (Calculate a SHA256 digest) then this command should be issued only for atsha204a. atsha204 does not support it.
Similarly, if other DTS-based system is going to implement that SHA command, it would mean that U-Boot DTS file would not be compatible with that other system.
Also it is a good idea to have DTS files and its compatible strings universal and not u-boot specific. So it could be used also by other projects (e.g. linux kernel).
And if we mix now two chips which are similar (and supports lot of common operations) we would not be able in future to extend drivers in backward compatible manner.
Just to note, I'm not going to implement atsha204a specific commands (which are not available in atsha204; like SHA command) because I do not need them (right now).
Quoted 8 lines
Quoted 2 lines
Don't get me wrong. I'm not blocking this change, just want to be sure that it's really necessary.
In case U-Boot driver has compatible string something like "atsha204-common" which could say that driver is using only functions which are available in all chip family then there would not be need for it. But if driver has chip specific name, I think the best is not to mask one chip by another which does not have 1:1 SW API compatibility.
From my side this is full okay to add here a new compatibility string to differ between the two chips, and to see in DTS immediately which chip is on the board. Also later if the driver really supports features the other chip does not have, you do not need to change DTS anymore.
Quoted 6 lines
Quoted 2 lines
I would love to see this patch first in linux. Do you plan to sent similiar change to linux?
Hello! We are not using Linux kernel driver for atsha cryptochips (I was told that it decrease lifetime) but I can send also similar change to Linux.
See it, thanks!
Quoted 5 lines
Quoted 2 lines
And not forget, please add a documentation for the compatible string in u-boot:/doc/device-tree-bindings/
Currently I do not see any information about atsha in u-boot/doc/device-tree-bindings.
So please add one, thanks!
bye,
Heiko
Quoted 26 lines
Quoted 26 lines
Thanks!
bye,
HeikoQuoted 16 lines
Quoted 16 lines
Thanks,
StefanQuoted 11 lines
Quoted 3 lines
A quick grep
doesn't show this in any of the dts files, not in U-Boot and not in the Kernel.Not yet. I'm preparing patches for a board which has atsha204 and will use this u-boot driver.
Quoted 4 lines
Just checking...
Thanks,
StefanSignature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: [email protected]
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: [email protected]
Quoted 11 lines · On Friday 22 April 2022 05:59:28 Heiko Schocher wrote:
Hello Pali,
Quoted 6 lines · Pali Rohár
Quoted 2 lines · On Thursday 21 April 2022 06:11:11 Heiko Schocher wrote:
And not forget, please add a documentation for the compatible string in u-boot:/doc/device-tree-bindings/
Currently I do not see any information about atsha in u-boot/doc/device-tree-bindings.
So please add one, thanks!
Hello! Here is the patch for bindings:
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Heiko Schocher
Reviewed-byHello Pali,
Quoted 82 lines · Heiko Schocher
Hello Pali,
Quoted 79 lines · Pali Rohár
Quoted 78 lines · On Thursday 21 April 2022 06:11:11 Heiko Schocher wrote:
Hello Pali,
Quoted 61 lines · Pali Rohár
Quoted 30 lines · On Tuesday 05 April 2022 15:52:17 Stefan Roese wrote:
Quoted 27 lines · Pali Rohár
Quoted 12 lines · On Tuesday 05 April 2022 15:14:52 Stefan Roese wrote:
Quoted 11 lines · Pali Rohár
atsha204 chip is predecessor of atsha204a chip. Current U-Boot driver
atsha204a-i2c.ccan use both atsha204 and atsha204a chips because it does not call specific functions to just one of these chips.So just add compatible string for atsha204.
Signed-off-by Pali Rohár <[email protected]>--- drivers/misc/atsha204a-i2c.c | 1 + 1 file changed, 1 insertion(+)Quoted 13 lines
drivers/misc/atsha204a-i2c.c static int atsha204a_of_to_plat(struct udevice *dev) · line 404
Quoted 11 lines
drivers/misc/atsha204a-i2c.c +1
-0@@ -399,6 +399,7 @@ static int atsha204a_of_to_plat(struct udevice *dev) }static const struct udevice_id atsha204a_ids[] = { + { .compatible ="atmel,atsha204" }, { .compatible ="atmel,atsha204a" }, { } };Why do we need this new compatible here in the driver?
Quoted 1 line
They are different chips,
Quoted 7 lines
Sure...
Quoted 1 line
so should have different compatible strings.
... but is this really necessary and "best practice"? If the driver can handle both chips without any changes, why do you need the new compatible here?
Well, currently it can handle both of them.
But if driver is going to be extended to support e.g. SHA command (Calculate a SHA256 digest) then this command should be issued only for atsha204a. atsha204 does not support it.
Similarly, if other DTS-based system is going to implement that SHA command, it would mean that U-Boot DTS file would not be compatible with that other system.
Also it is a good idea to have DTS files and its compatible strings universal and not u-boot specific. So it could be used also by other projects (e.g. linux kernel).
And if we mix now two chips which are similar (and supports lot of common operations) we would not be able in future to extend drivers in backward compatible manner.
Just to note, I'm not going to implement atsha204a specific commands (which are not available in atsha204; like SHA command) because I do not need them (right now).
Quoted 8 lines
Quoted 2 lines
Don't get me wrong. I'm not blocking this change, just want to be sure that it's really necessary.
In case U-Boot driver has compatible string something like "atsha204-common" which could say that driver is using only functions which are available in all chip family then there would not be need for it. But if driver has chip specific name, I think the best is not to mask one chip by another which does not have 1:1 SW API compatibility.
From my side this is full okay to add here a new compatibility string to differ between the two chips, and to see in DTS immediately which chip is on the board. Also later if the driver really supports features the other chip does not have, you do not need to change DTS anymore.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I would love to see this patch first in linux. Do you plan to sent similiar change to linux?
Hello! We are not using Linux kernel driver for atsha cryptochips (I was told that it decrease lifetime) but I can send also similar change to Linux.
See it, thanks!
Will apply soon, as it is accepted in linux.
bye,
Heiko
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: [email protected]
Hello Pali.
Quoted 92 lines · Heiko Schocher
Hello Pali,
Quoted 89 lines · Heiko Schocher
Hello Pali,
Quoted 85 lines · Pali Rohár
Quoted 73 lines · On Thursday 21 April 2022 06:11:11 Heiko Schocher wrote:
Hello Pali,
Quoted 61 lines · Pali Rohár
Quoted 30 lines · On Tuesday 05 April 2022 15:52:17 Stefan Roese wrote:
Quoted 27 lines · Pali Rohár
Quoted 12 lines · On Tuesday 05 April 2022 15:14:52 Stefan Roese wrote:
Quoted 11 lines · Pali Rohár
atsha204 chip is predecessor of atsha204a chip. Current U-Boot driver
atsha204a-i2c.ccan use both atsha204 and atsha204a chips because it does not call specific functions to just one of these chips.So just add compatible string for atsha204.
Signed-off-by Pali Rohár <[email protected]>--- drivers/misc/atsha204a-i2c.c | 1 + 1 file changed, 1 insertion(+)Quoted 13 lines
drivers/misc/atsha204a-i2c.c static int atsha204a_of_to_plat(struct udevice *dev) · line 404
Quoted 11 lines
drivers/misc/atsha204a-i2c.c +1
-0@@ -399,6 +399,7 @@ static int atsha204a_of_to_plat(struct udevice *dev) }static const struct udevice_id atsha204a_ids[] = { + { .compatible ="atmel,atsha204" }, { .compatible ="atmel,atsha204a" }, { } };Why do we need this new compatible here in the driver?
Quoted 1 line
They are different chips,
Quoted 7 lines
Sure...
Quoted 1 line
so should have different compatible strings.
... but is this really necessary and "best practice"? If the driver can handle both chips without any changes, why do you need the new compatible here?
Well, currently it can handle both of them.
But if driver is going to be extended to support e.g. SHA command (Calculate a SHA256 digest) then this command should be issued only for atsha204a. atsha204 does not support it.
Similarly, if other DTS-based system is going to implement that SHA command, it would mean that U-Boot DTS file would not be compatible with that other system.
Also it is a good idea to have DTS files and its compatible strings universal and not u-boot specific. So it could be used also by other projects (e.g. linux kernel).
And if we mix now two chips which are similar (and supports lot of common operations) we would not be able in future to extend drivers in backward compatible manner.
Just to note, I'm not going to implement atsha204a specific commands (which are not available in atsha204; like SHA command) because I do not need them (right now).
Quoted 8 lines
Quoted 2 lines
Don't get me wrong. I'm not blocking this change, just want to be sure that it's really necessary.
In case U-Boot driver has compatible string something like "atsha204-common" which could say that driver is using only functions which are available in all chip family then there would not be need for it. But if driver has chip specific name, I think the best is not to mask one chip by another which does not have 1:1 SW API compatibility.
Quoted 7 lines
From my side this is full okay to add here a new compatibility string to differ between the two chips, and to see in DTS immediately which chip is on the board. Also later if the driver really supports features the other chip does not have, you do not need to change DTS anymore.
I would love to see this patch first in linux. Do you plan to sent similiar change to linux?
Hello! We are not using Linux kernel driver for atsha cryptochips (I was told that it decrease lifetime) but I can send also similar change to Linux.
Quoted 5 lines
Quoted 1 line
See it, thanks!
Reviewed-by Heiko Schocher <[email protected]>Will apply soon, as it is accepted in linux.
applied to u-boot-i2c master
Thanks!
bye,
Heiko
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: [email protected]