Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp374767lqg; Fri, 1 Mar 2024 07:48:13 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVkKZo1+U72APlQQI9CAywLxIDk8EMrN0/0i+AByNTwrLUTONKMLGnGxRt2uFczspkRSO+5QaJOcCqxKN4dlsnf24kHbaewq+kHgv0RLg== X-Google-Smtp-Source: AGHT+IGoWMnOfelsYbthfhuyc/orBi1xZQei3ckGoVVEXIUWFMRga22I/i5qBxnFTDLXF5p2PvE/ X-Received: by 2002:a05:6358:e48d:b0:17b:8830:628c with SMTP id by13-20020a056358e48d00b0017b8830628cmr2261438rwb.2.1709308092929; Fri, 01 Mar 2024 07:48:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709308092; cv=pass; d=google.com; s=arc-20160816; b=Be4x+BJa1eHUEiVx5mRmg0V1tJbMEuxEKiv184TiTYQmxNCZ8dLFHouhnGKk/IFTWJ 1u8O1f57rkmBJxdAw4w9O/xBsQFJnuRZhgStegViX8elb8Wk5wYh5343WCxIXNBK6KzD 8kntPCOvdMOdX4FSIXNCEyD06ipfW/m+Z1UHSqbJUKK5kYum7gE1udDA2AwRHYkqjsc3 jr21t4XfbiVKw6ggKrKhwp8FtYAKpu3lY+l8awyS4sSm2wgUjpxvxzuFHz1shIThH8eK sCKh7j9ELUlmSRMYK/qrbmP28lgdfYspmDoIWIiKtnOpJCsEgIbOIsxnNaDJJ9rhyA/4 3h7g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:from:to:cc:subject:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=uE39Tdusc2iOYu8yciRGo5J13AkSfvwvY5k+yQjJTiM=; fh=va4913oJQYF/v0TVPabWfIhXxka6EvMZC7TBwTGa7aQ=; b=OF8qJoMODA52wvvCf0OgPREObOK6yj9Ho48mtpy4XOD91ozCjGfkkxCc8BoCe8Bymo ktm/3gc9XDYR9CrOUwDju7PCeF91NKQfqGND2F8j7H1gwHaWnLMSQrHLCgsgOn33cgSz UGgbVIP4W+XuiwJ30Lk6BkLWG6WXIaTaohNSibwj3k9lFs2yoDRUhJzSSLNpW5zEUpTh MwZag8sBU/lDh9NfWU2FlT2rnlxm2dR+PGT0zDvirpn1FhlERwhL3ytLFW2PmKgyCWAT eJqVs0Ja8V3ES4rnsKXSs7lYtEYiORscsDKTOM4L3jkuKpk5cflXp/1OOutaZtgONBuY cGcg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=gnZwGnhu; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-88638-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88638-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id js8-20020a0562142aa800b0069018ff9e6asi3784347qvb.591.2024.03.01.07.48.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 07:48:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88638-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=gnZwGnhu; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-88638-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88638-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 540B91C21E19 for ; Fri, 1 Mar 2024 15:48:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F33871723; Fri, 1 Mar 2024 15:47:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="gnZwGnhu" Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCC456EF1F; Fri, 1 Mar 2024 15:47:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709308064; cv=none; b=qUbe0nE1n+sVpRrFgABydTMgtDUzpXJVqxjEeyTKtMrT7oSfH2yEXwUHFD0K8Mk5kzRMD0QxF4QbrLm6A6y1jEHGmUQJmTdsCUBZloiovxVRHXemT+ggQUMak4qZxTkmKfe1BM7PT9QEf/F/I572tE2SBS8vDVUxUzrGlIYNAmQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709308064; c=relaxed/simple; bh=/lpcu1cwKToP1YTl3Vb9NOZDrttRJdM4V2OIwh/bNeU=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:Cc:To:From: References:In-Reply-To; b=keZvwJL6Q/t51SQg4uQwu+uibwAaFqnC3GZdC45RJ6OvdrgYZxxQiJdApzbgbq5pHkkQzhRnqpRTtsrnkO9ikknkdisNLPyhXwVG683nlgSlh88M3NZe4YCzdcKVTGe0aMEvGxAVHS3OFifcR9AOai+VKq2VsTGoPbW/tiWAwTY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=gnZwGnhu; arc=none smtp.client-ip=217.70.183.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id BDC736000D; Fri, 1 Mar 2024 15:47:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709308055; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uE39Tdusc2iOYu8yciRGo5J13AkSfvwvY5k+yQjJTiM=; b=gnZwGnhuFM4BkMTf3c2iQy2zn50vixMSBMJd1pZ/Uj585gJ7pwh7Rj/65XsyYXnpMcTQHD urBkPI0KQ73Hber0gd+u09Ddbmb0+a+todMeqWvN4hzfA04RUhlZ5vHV/ajeY7MO7Ob52o OgcyZbXgdDgVOuzBVzyjReeWYF0viu1xoCD9M7u6Z5H1gnweu9zhfCCCbC/WG1dGnJ66M+ uIV698Tbs/E0E2rlyjFlfqzzzA2O4hEg5xyY1bky16X2ad7VFBVXvNhaKiNor8AQaJDzpV kWc6TZWTcHnksWEwM5rsFy45QORQxBFeYpwzqXBzjo/7E8Y9nW4yRMHIO0Gc5Q== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 01 Mar 2024 16:47:34 +0100 Message-Id: Subject: Re: [PATCH v2 01/11] dt-bindings: i2c: nomadik: add mobileye,eyeq5-i2c bindings and example Cc: "Linus Walleij" , "Andi Shyti" , "Krzysztof Kozlowski" , "Conor Dooley" , "Thomas Bogendoerfer" , , , , , , "Gregory Clement" , "Vladimir Kondratiev" , "Thomas Petazzoni" , "Tawfik Bayouk" To: "Rob Herring" From: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: aerc 0.15.2 References: <20240229-mbly-i2c-v2-0-b32ed18c098c@bootlin.com> <20240229-mbly-i2c-v2-1-b32ed18c098c@bootlin.com> <20240301151146.GA2114576-robh@kernel.org> In-Reply-To: <20240301151146.GA2114576-robh@kernel.org> X-GND-Sasl: theo.lebrun@bootlin.com Hello, On Fri Mar 1, 2024 at 4:11 PM CET, Rob Herring wrote: > On Thu, Feb 29, 2024 at 07:10:49PM +0100, Th=C3=A9o Lebrun wrote: > > Add EyeQ5 bindings to the existing Nomadik I2C dt-bindings. Add the > > EyeQ5-specific property behind a conditional. Add an example for this > > compatible. > >=20 > > Signed-off-by: Th=C3=A9o Lebrun > > --- > > .../devicetree/bindings/i2c/st,nomadik-i2c.yaml | 48 ++++++++++++++= ++++++-- > > 1 file changed, 44 insertions(+), 4 deletions(-) > >=20 > > diff --git a/Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml = b/Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml > > index 16024415a4a7..2d9d5b276762 100644 > > --- a/Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml > > +++ b/Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml > > @@ -14,9 +14,6 @@ description: The Nomadik I2C host controller began it= s life in the ST > > maintainers: > > - Linus Walleij > > =20 > > -allOf: > > - - $ref: /schemas/i2c/i2c-controller.yaml# > > - > > # Need a custom select here or 'arm,primecell' will match on lots of n= odes > > select: > > properties: > > @@ -24,6 +21,7 @@ select: > > contains: > > enum: > > - st,nomadik-i2c > > + - mobileye,eyeq5-i2c > > required: > > - compatible > > =20 > > @@ -39,6 +37,10 @@ properties: > > - const: stericsson,db8500-i2c > > - const: st,nomadik-i2c > > - const: arm,primecell > > + # The variant found on Mobileye EyeQ5 > > Kind of obvious from the compatible string, but maybe you are keeping=20 > the existing style... I indeed kept the existing style. Ping me if you want this removed! > > + - items: > > + - const: mobileye,eyeq5-i2c > > + - const: arm,primecell > > =20 > > reg: > > maxItems: 1 > > @@ -55,7 +57,7 @@ properties: > > - items: > > - const: mclk > > - const: apb_pclk > > - # Clock name in DB8500 > > + # Clock name in DB8500 or EyeQ5 > > - items: > > - const: i2cclk > > - const: apb_pclk > > @@ -70,6 +72,16 @@ properties: > > minimum: 1 > > maximum: 400000 > > =20 > > + mobileye,olb: > > + $ref: /schemas/types.yaml#/definitions/phandle-array > > + items: > > + - items: > > + - description: Phandle to OLB system controller node. > > + - description: Platform-wide controller ID (integer starting= from zero). > > Rather than a made up ID, just store the shift value you ultimately=20 > need. Issue with storing the shift value is that you also need to know what value to put in that field. It's an enum mapping the I2C speed which isn't found in DT. > These properties are fragile because they break if anything that's not=20 > defined in DT changes whether that's register offset, bit offset,=20 > bitfield size or values. Or also if there are additional fields to=20 > access. My take is that it is better to have it all either in DT or in driver. Having a mix of both is a mess when debugging. If something breaks it is a driver bug; such bugs get fixed in driver code. That way DT doesn't know about it and doesn't have to be changed. Putting shifts in DT is an abstraction that ends up being unhelpful. You split hardware knowledge half in DT (register offset and/or mask), half in driver (value to put in the field). We'd rather have it all in driver code. Next hardware revision will be more complex with potentially fields split across registers. A shift value wouldn't cut it. A new compatible + made up ID allows accomodating for that. That way we have homogeneity across compatibles. Have a nice day, -- Th=C3=A9o Lebrun, Bootlin Embedded Linux and Kernel engineering https://bootlin.com