From: "Pali Rohár" <pali@kernel.org>
To: Stefan Roese <sr@denx.de>
Cc: "Adrian Fiergolski" <adrian.fiergolski@fastree3d.com>,
"Marek Behún" <marek.behun@nic.cz>, "Wolfgang Denk" <wd@denx.de>,
"Simon Glass" <sjg@chromium.org>,
u-boot@lists.denx.de
Subject: Re: [PATCH] misc: atsha204a: Add support for atsha204 chip
Date: Tue, 5 Apr 2022 16:10:10 +0200 [thread overview]
Message-ID: <20220405141010.fjmajcxeh232t74a@pali> (raw)
In-Reply-To: <7b861fa6-a3d8-956a-1b0d-31cb7c81e760@denx.de>
On Tuesday 05 April 2022 15:52:17 Stefan Roese wrote:
> On 4/5/22 15:28, Pali Rohár wrote:
> > On Tuesday 05 April 2022 15:14:52 Stefan Roese wrote:
> > > On 4/5/22 14:49, Pali Rohár wrote:
> > > > 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.
> > > >
> > > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > > ---
> > > > drivers/misc/atsha204a-i2c.c | 1 +
> > > > 1 file changed, 1 insertion(+)
> > > >
> > > > diff --git a/drivers/misc/atsha204a-i2c.c b/drivers/misc/atsha204a-i2c.c
> > > > index 63fe541dade3..8b0055f99893 100644
> > > > --- a/drivers/misc/atsha204a-i2c.c
> > > > +++ b/drivers/misc/atsha204a-i2c.c
> > > > @@ -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,
>
> Sure...
>
> > 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).
> 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.
> Thanks,
> Stefan
>
> > > 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.
> >
> > > Just checking...
> > >
> > > Thanks,
> > > Stefan
>
next prev parent reply other threads:[~2022-04-05 14:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-05 12:49 [PATCH] misc: atsha204a: Add support for atsha204 chip Pali Rohár
2022-04-05 13:14 ` Stefan Roese
2022-04-05 13:28 ` Pali Rohár
2022-04-05 13:52 ` Stefan Roese
2022-04-05 14:10 ` Pali Rohár [this message]
2022-04-21 4:11 ` Heiko Schocher
2022-04-21 9:40 ` Pali Rohár
2022-04-21 13:47 ` Pali Rohár
2022-04-22 3:59 ` Heiko Schocher
2022-04-28 19:00 ` Pali Rohár
2022-05-10 4:45 ` Heiko Schocher
2022-05-10 8:51 ` Heiko Schocher
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=20220405141010.fjmajcxeh232t74a@pali \
--to=pali@kernel.org \
--cc=adrian.fiergolski@fastree3d.com \
--cc=marek.behun@nic.cz \
--cc=sjg@chromium.org \
--cc=sr@denx.de \
--cc=u-boot@lists.denx.de \
--cc=wd@denx.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