From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A57BC636C9 for ; Wed, 21 Jul 2021 17:28:30 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 00F0361248 for ; Wed, 21 Jul 2021 17:28:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 00F0361248 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=habemus.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B5F1282BDF; Wed, 21 Jul 2021 19:28:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=habemus.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 74BAB80612; Wed, 21 Jul 2021 18:59:45 +0200 (CEST) Received: from mta03.nroute.de (mta03.nroute.de [IPv6:2a04:4b07:21dc:7:30::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1C10980214 for ; Wed, 21 Jul 2021 18:59:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=habemus.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Richard.Forro@habemus.com Received: from mta03.nroute.de (localhost [127.0.0.1]) by mta03.nroute.de (Postfix) with ESMTP id 4GVMJF5rQ4z2xPh for ; Wed, 21 Jul 2021 18:59:41 +0200 (CEST) Received: from mta03.nroute.de ([127.0.0.1]) by mta03.nroute.de (mta03.nroute.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Twlp2T8aw1wm for ; Wed, 21 Jul 2021 18:59:41 +0200 (CEST) Received: from HB-TH-EXCH01.HB2006.local (pd95b3f92.dip0.t-ipconnect.de [217.91.63.146]) by mta03.nroute.de (Postfix) with ESMTPS id 4GVMJF0mtgz2xCk for ; Wed, 21 Jul 2021 18:59:41 +0200 (CEST) Received: from HB-TH-EXCH01.HB2006.local (192.168.128.112) by HB-TH-EXCH01.HB2006.local (192.168.128.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Wed, 21 Jul 2021 18:59:40 +0200 Received: from HB-TH-EXCH01.HB2006.local ([::1]) by HB-TH-EXCH01.HB2006.local ([::1]) with mapi id 15.01.2242.010; Wed, 21 Jul 2021 18:59:40 +0200 From: Richard Forro To: "u-boot@lists.denx.de" Subject: Bootcount device-model I2C EEPROM partition Thread-Topic: Bootcount device-model I2C EEPROM partition Thread-Index: Add+UbLdN0kv6XjUSoqyxMDjS04PDA== Date: Wed, 21 Jul 2021 16:59:40 +0000 Message-ID: Accept-Language: de-DE, en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.168.131.117] x-esetresult: clean, is OK x-esetid: 37303A29E1FAEB50677466 MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 21 Jul 2021 19:28:04 +0200 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean Hi, I'm implementing device-model backed bootcount which uses I2C EEPROM chip. = I've found following device tree, which I'm replicating: https://source.den= x.de/u-boot/u-boot/-/blob/master/arch/arm/dts/imx53-ppd.dts https://source.denx.de/u-boot/u-boot/-/blob/master/arch/arm/dts/imx53-ppd-u= boot.dtsi Here is the important code snippet from `imx53-ppd-uboot.dtsi`. As you can = see, the `bootcount` partition from eeprom is referenced as the `i2c-eeprom= ` device in `bootcount` device. / { bootcount { compatible =3D "u-boot,bootcount-i2c-eeprom"= ; i2c-eeprom =3D <&bootcount>; }; }; &eeprom { partitions { compatible =3D "fixed-partitions"; #address-cells =3D <1>; #size-cells =3D <1>; vpd@0 { reg =3D <0 800>; }; bootcount: bootcount@1022 { reg =3D <1022 2>; }; }; }; Here you can see my snippet from `imx7-colibri-u-boot.dtsi`, where that I h= ave to reference not the partition but the whole eeprom device, because oth= erwise I'll get following error: "bootcount: could not get backing device". / { bootcount { compatible =3D "u-boot,bootcount-i2c-eeprom"; i2c-eeprom =3D <&eeprom>; }; }; &eeprom { partitions { compatible =3D "fixed-partitions"; #address-cells =3D <1>; #size-cells =3D <1>; bootcount: bootcount@0 { reg =3D <0 2>; }; }; }; The question is what I'm missing? Why referencing the whole eeprom works, b= ut referencing a single partition not. Do you have any idea? Thank you very much Richard Forro P.S. there is no problem with the definition of eeprom inside the `imx7-col= ibri.dtsi` file. It is exactly the same as in `imx53-ppd.dts`. &i2c4 { pinctrl-names =3D "default", "gpio"; pinctrl-0 =3D <&pinctrl_i2c4>; pinctrl-1 =3D <&pinctrl_i2c4_gpio>; sda-gpios =3D <&gpio7 9 GPIO_ACTIVE_LOW>; scl-gpios =3D <&gpio7 8 GPIO_ACTIVE_LOW>; status =3D "okay"; eeprom: eeprom@50 { compatible =3D "atmel,24c02"; /* our at34c02d is semi-compa= tible */ reg =3D <0x50>; pagesize =3D <16>; }; };