Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 87EFDC433EF for ; Tue, 5 Apr 2022 14:10:34 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C47B583B10; Tue, 5 Apr 2022 16:10:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="jSQV5EJ+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3CA5A83ADC; Tue, 5 Apr 2022 16:10:30 +0200 (CEST) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8AFAB83B10 for ; Tue, 5 Apr 2022 16:10:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F3083B81C9B; Tue, 5 Apr 2022 14:10:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B3B0C385A1; Tue, 5 Apr 2022 14:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649167813; bh=6Fu3aJEYgCc1uLpi18NL+7W7cSx2fnC9AuPWiedFXIA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jSQV5EJ+QXQnXHwJcO9JdO1qge10tXdOdnVgIkTV4XyIsFa61RcDkEgnlMgHE4yrk YGlMD8knn3iCBUY0s2XpBzDYPT8BDZUOUp5/VlJnIajBoWloRbW/1MJAGMlbSKmIet GWyu/hb0ZCad+rRscaRkea6gZruFtybFwaL3YW54WBTV4hkdFlTZ9naBJUa6cGOI3Z v1WAJJ5gTCSjBxwxY91WrrcsIfarWIrFnfBCTLfrRrNr7nSII/Ir1aSPXNQgVrfsXf oiU0rZ9jbIEWZHAejkoUjRFtAsMn5RwgNjfJtu/oSYyEK5MXMKmlQtcemtrhZjsJTU W1wo0RQqfgCOg== Received: by pali.im (Postfix) id 87A9E7B2; Tue, 5 Apr 2022 16:10:10 +0200 (CEST) Date: Tue, 5 Apr 2022 16:10:10 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Stefan Roese Cc: Adrian Fiergolski , Marek =?utf-8?B?QmVow7pu?= , Wolfgang Denk , Simon Glass , u-boot@lists.denx.de Subject: Re: [PATCH] misc: atsha204a: Add support for atsha204 chip Message-ID: <20220405141010.fjmajcxeh232t74a@pali> References: <20220405124908.32019-1-pali@kernel.org> <8865d906-d91d-2938-1f31-645854265874@denx.de> <20220405132843.kccajblmkek2jdph@pali> <7b861fa6-a3d8-956a-1b0d-31cb7c81e760@denx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7b861fa6-a3d8-956a-1b0d-31cb7c81e760@denx.de> User-Agent: NeoMutt/20180716 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean 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 > > > > --- > > > > 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 >