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 45EACC433F5 for ; Tue, 10 May 2022 04:44:56 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 560F584176; Tue, 10 May 2022 06:44:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1652157894; bh=0p1QmwxVwVZ1tborwjvG7Yw907v/ZP2Cjic0yN45S9A=; h=Subject:From:To:Cc:References:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Reply-To:From; b=eM7i2UjNVu6CyGMpuTTOvQQgHOn0rH0F49NxjFsAmAs9HUwj35NF6u11JSyKjqbJi /EbNhM9K2RiZ8RMcHDemcCacqxLIjLvih3S25eEDo9L3bBQ75+Jr7cVIGr5LCzo8jp QesSOrPNp25jI3yoQrQr7nUACespuwSg+Lg6VqdyDobsIndACKFjBIX69k+9zYb/E1 8B5emxZLf0WcTSe/nCxH8ux117qqJzntLKKrm61IeeONhGxLPiZAOMFmbDcBp00+KY pUyfaUtkeP6l6C31QooQF2+CqRPcgQou0aAzRtOyHm+jJh8ms0Ld20U93q3CoFw98+ QgBSXQS5baBJA== Received: from [192.168.1.107] (87-97-104-197.pool.digikabel.hu [87.97.104.197]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: hs@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 1F4E983EF2; Tue, 10 May 2022 06:44:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1652157893; bh=0p1QmwxVwVZ1tborwjvG7Yw907v/ZP2Cjic0yN45S9A=; h=Subject:From:To:Cc:Reply-To:References:Date:In-Reply-To:From; b=NdyuVEpwQWGXfb1Qu7t5LRkC6MCSWTSI/hxBqBmh+yxQIBzUXowvSyRwBU2MZsUcr eqXpn/tSYf/jJOx1CYmS3KOyxVpVpeKSn5aD+UbriTyslgr8Bps1lvd5YLvEOcPaBl eKH3ZDIhCmxuRDQ+jLHOHprj6axio0n90J/+xb5mff10MeUHeTTHu9iMPviiwJSEH9 bzBZVN9dRitIp9QJUU57NFv9WKrN7QXfKa/HKwx8k9sTjsIQGRLciioHOAvLvCuh+Q Ja99lvb1mv2aM0/IZDaXduDNhcnYEq6BUrgM2LN/MPtvh4sgFmr0NNdLEzTXuWhrxO daupFJJ/EyDfw== Subject: Re: [PATCH] misc: atsha204a: Add support for atsha204 chip From: Heiko Schocher To: =?UTF-8?Q?Pali_Roh=c3=a1r?= Cc: Stefan Roese , Adrian Fiergolski , =?UTF-8?Q?Marek_Beh=c3=ban?= , Wolfgang Denk , Simon Glass , u-boot@lists.denx.de References: <20220405124908.32019-1-pali@kernel.org> <8865d906-d91d-2938-1f31-645854265874@denx.de> <20220405132843.kccajblmkek2jdph@pali> <7b861fa6-a3d8-956a-1b0d-31cb7c81e760@denx.de> <20220405141010.fjmajcxeh232t74a@pali> <690d1fb5-edf9-900c-b9e1-93c176adc5fe@denx.de> <20220421094047.kaac3g42g2rv2vx6@pali> <6428771c-bda8-7517-29ac-4eb581e76a22@denx.de> Message-ID: Date: Tue, 10 May 2022 06:45:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <6428771c-bda8-7517-29ac-4eb581e76a22@denx.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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: , Reply-To: hs@denx.de 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 Hello Pali, On 22.04.22 05:59, Heiko Schocher wrote: > Hello Pali, > > On 21.04.22 11:40, Pali Rohár wrote: >> On Thursday 21 April 2022 06:11:11 Heiko Schocher wrote: >>> Hello Pali, >>> >>> On 05.04.22 16:10, Pali Rohár wrote: >>>> 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. >>> >>> 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. > > See it, thanks! Reviewed-by: Heiko Schocher Will apply soon, as it is accepted in linux. bye, Heiko -- 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: hs@denx.de