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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60726C433FE for ; Thu, 20 Jan 2022 14:57:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348756AbiATO5C (ORCPT ); Thu, 20 Jan 2022 09:57:02 -0500 Received: from mail-vk1-f178.google.com ([209.85.221.178]:42639 "EHLO mail-vk1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232592AbiATO5A (ORCPT ); Thu, 20 Jan 2022 09:57:00 -0500 Received: by mail-vk1-f178.google.com with SMTP id m57so3726299vkf.9; Thu, 20 Jan 2022 06:56:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1L35cmAx7uCLqrcryWAZKBNOGx+ekbrBkpQCXHRgWJQ=; b=oEJ0SaQXI4alA5reStSBMsu+rR77UWNbxgSB4YjV2zNu21QyT0ULxYvpB741T+zCrx Ce1vo+XVBj/Fvs9g2XlKGZ4B8yBTLAVPOvi8oE/zCvlvF+UGuxIBftD+EblhAiV0KZeS zNThkrRGwyxQ3b7t7Rg6QB6SB3HHMdUTRftK2GiVVkcCXpY6y4wa7ums24QlsUJhoEoo tUp6yEZRg6DGXmVIUXku1zblaZXROtR8buqyBkLBQBICj+HtDvFafMD6DmS0EiwIITj7 9VoLrKfQxhFgL++SDeFjoKSFP4spgjg/YQfkQ17ItqaEvi9fb8bu1A2Zv+Bbbb9iuku4 Or8A== X-Gm-Message-State: AOAM533Ypntc+0G3BNd3a388YHlSJcm29LRBHvLOoXxyNjO2kWEupfKY 3mORqfYZCwEdv++xk1jB4eFw04uyN8Hp0w== X-Google-Smtp-Source: ABdhPJwtBz5xu6kkUSgMDWT3reX8oOw/ICTZRv6mefGmvRx9v+0CD6OCOR52cNTnIgrnTf+RyXzN5A== X-Received: by 2002:a05:6122:208c:: with SMTP id i12mr14370747vkd.2.1642690619315; Thu, 20 Jan 2022 06:56:59 -0800 (PST) Received: from mail-ua1-f50.google.com (mail-ua1-f50.google.com. [209.85.222.50]) by smtp.gmail.com with ESMTPSA id ba16sm474926vkb.39.2022.01.20.06.56.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Jan 2022 06:56:58 -0800 (PST) Received: by mail-ua1-f50.google.com with SMTP id n15so9789369uaq.5; Thu, 20 Jan 2022 06:56:57 -0800 (PST) X-Received: by 2002:a05:6102:3581:: with SMTP id h1mr14235247vsu.5.1642690617601; Thu, 20 Jan 2022 06:56:57 -0800 (PST) MIME-Version: 1.0 References: <20220117110755.3433142-1-conor.dooley@microchip.com> <20220117110755.3433142-4-conor.dooley@microchip.com> <889dab52-95eb-f36d-0af9-beea958a97e7@microchip.com> In-Reply-To: <889dab52-95eb-f36d-0af9-beea958a97e7@microchip.com> From: Geert Uytterhoeven Date: Thu, 20 Jan 2022 15:56:46 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 03/14] dt-bindings: i2c: add bindings for microchip mpfs i2c To: Conor Dooley Cc: Linus Walleij , Bartosz Golaszewski , Rob Herring , Jassi Brar , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alessandro Zummo , Alexandre Belloni , Mark Brown , Greg KH , Thierry Reding , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Lee Jones , "open list:GPIO SUBSYSTEM" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Kernel Mailing List , Linux I2C , Linux PWM List , linux-riscv , Linux Crypto Mailing List , linux-rtc@vger.kernel.org, linux-spi , USB list , Krzysztof Kozlowski , Bin Meng , Heiko Stuebner , Lewis Hanly , Daire.McNamara@microchip.com, Ivan.Griffin@microchip.com, Atish Patra Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-rtc@vger.kernel.org Hi Conor, On Thu, Jan 20, 2022 at 2:42 PM wrote: > On 20/01/2022 08:30, Geert Uytterhoeven wrote: > > On Mon, Jan 17, 2022 at 12:06 PM wrote: > >> From: Conor Dooley > >> > >> Add device tree bindings for the i2c controller on > >> the Microchip PolarFire SoC. > >> > >> Signed-off-by: Daire McNamara > >> Signed-off-by: Conor Dooley > > > > Thanks for your patch! > > > >> --- /dev/null > >> +++ b/Documentation/devicetree/bindings/i2c/microchip,mpfs-i2c.yaml > >> @@ -0,0 +1,55 @@ > >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > >> +%YAML 1.2 > >> +--- > >> +$id: http://devicetree.org/schemas/i2c/microchip,mpfs-i2c.yaml# > >> +$schema: http://devicetree.org/meta-schemas/core.yaml# > >> + > >> +title: Microchip MPFS I2C Controller Device Tree Bindings > >> + > >> +maintainers: > >> + - Daire McNamara > >> + > >> +allOf: > >> + - $ref: /schemas/i2c/i2c-controller.yaml# > >> + > >> +properties: > >> + compatible: > >> + enum: > >> + - microchip,mpfs-i2c # Microchip PolarFire SoC compatible SoCs > >> + - microchip,corei2c-rtl-v7 # Microchip Fabric based i2c IP core > > > > Wouldn't it be more logical to have: > > > > items: > > - const: microchip,mpfs-i2c # Microchip PolarFire SoC compatible SoCs > > - const: microchip,corei2c-rtl-v7 # Microchip Fabric based i2c IP core > > > > ? > This would be fine for mpfs-i2c since corei2c is a "superset" - but how > would that look for the fabric core? I don't think falling back from the > fabric core onto the "hard" one makes sense. This would mean the > following two entries: > > i2c2: i2c@44000000 { //fabric > compatible = "microchip,corei2c-rtl-v7"; > }; > i2c1: i2c@2010b000 { //"hard" mpfs peripheral > compatible = "microchip,mpfs-i2c", "microchip,corei2c-rtl-v7"; > }; Oops, I missed that you have both forms. But in se, they're the same IP core, just hard vs. soft? Then the below makes sense. > But this generates errors in dt_binding_check w/ your suggestion - so > how about the following (similar to ti,omap4-i2c.yaml): > > compatible: > oneOf: > - items: > - const: microchip,mpfs-i2c # Microchip PolarFire... > - const: microchip,corei2c-rtl-v7 # Microchip Fabric... > - const: microchip,corei2c-rtl-v7 # Microchip Fabric... > > Is there a prettier way than this duplication? I'm afraid not, and the above scheme is used a lot. > > If the IP core is reused, it can become: > > > > items: > > - enum: > > - microchip,mpfs-i2c # Microchip PolarFire SoC compatible SoCs > > - microchip,-i2c # ... > > - const: microchip,corei2c-rtl-v7 # Microchip Fabric based i2c IP core > > > > That way the driver can just match on the second (fallback) value, > > and no further driver changes will be needed (until v8 or later). Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds