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 8CA5FEB64DD for ; Mon, 14 Aug 2023 19:19:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229457AbjHNTSv (ORCPT ); Mon, 14 Aug 2023 15:18:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230156AbjHNTSo (ORCPT ); Mon, 14 Aug 2023 15:18:44 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25ECEE5F for ; Mon, 14 Aug 2023 12:18:43 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fe4a89e8c4so43067685e9.3 for ; Mon, 14 Aug 2023 12:18:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692040721; x=1692645521; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=72S2n2lYPlrUM7ALoHtN9DEXfa2PT84mmokJwTNUvmk=; b=TBb8grKi7j+lELjw3Ihzgfgf18E8CY0MRN/h+FGwbfymfjb1yxo0fCAIWwB3UbsQS6 WeInwfinusQ9UEdLRBDby+avB+k8ncrYk8BPtFAE3wm91XzJ+Y0QINjEx0+ZpE5aUmbD wNv/jMgiaquqemZkBlLIPNTqifydMmomZnZ/XBH8h3szl4XBkwm+NGiyOdfW79HFDpLN vrWKQbPRWL56kFUcNlLgUOBopKfYTvm82ecGOVEHj7x+H4QOU3Gp16iIlmK+7ppa1SNt J7uqcXY1w4KEnFqY9pJg3V8ONHQAkdWHPwj+ArDmjBgX8zC+LcZzQB6oBkO10zcibY61 BfWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692040721; x=1692645521; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=72S2n2lYPlrUM7ALoHtN9DEXfa2PT84mmokJwTNUvmk=; b=KoQs6WxwkqhYO5+Bc3gfH4RxTI+GygqHC61+IavjHo8OPny/5HAsknY6/f8kKGCHP8 mCRG5MMZLUrNIM6Cxz212tltCLnSPsGEDl02lV5kZWqDhz7vkqjP0N40NItNUP9mP/jK yNPiU1LvC948tbeqz67kk7cls4mQSRnis5Z035kxMvlL3Dz1uvs4jai5wJ01afsegqIG jX6ks6sUqFI22XI0V/3RfWL/u9kumMOLeXzb5wF1dUMagc22W+T/mq3tLroI7NHHyFx5 9FekWQhMP33V84odb/TpeGXcrZHCf8PiXuningCmbYoQd/jmjJzEvYYcLep3zCjVrgaB SOkg== X-Gm-Message-State: AOJu0YzxZOr18VbUMrPB0+P8x8WiZ6Z0FEVFIdYY1ACLfJN3O4nDXQSw Ymr95ye7dSSgt39niiC/zlVSMA== X-Google-Smtp-Source: AGHT+IEeFPxWx2KSxTh6FCCps3OOKBDVdbRhF6OY2QRxepJQgs6kH8Obt3EcA9VGUfe6+GdUAdjj4w== X-Received: by 2002:adf:db0a:0:b0:314:2e95:1ec9 with SMTP id s10-20020adfdb0a000000b003142e951ec9mr7902967wri.10.1692040721649; Mon, 14 Aug 2023 12:18:41 -0700 (PDT) Received: from [192.168.1.20] ([178.197.214.188]) by smtp.gmail.com with ESMTPSA id 11-20020a05600c234b00b003fbca942499sm18034835wmq.14.2023.08.14.12.18.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Aug 2023 12:18:41 -0700 (PDT) Message-ID: Date: Mon, 14 Aug 2023 21:18:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [PATCH v3 1/2] gpio: dt-bindings: add parsing of loongson gpio offset Content-Language: en-US To: Yinbo Zhu , Bartosz Golaszewski Cc: Conor Dooley , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Jianmin Lv , wanghongliang@loongson.cn, loongson-kernel@lists.loongnix.cn References: <20230807074043.31288-1-zhuyinbo@loongson.cn> <20230807074043.31288-2-zhuyinbo@loongson.cn> <20230808-amount-urban-9a6eb09852ca@spud> <536a9062-65b2-5518-5c50-1a61e23870ee@loongson.cn> <20230809-circus-photo-6911d2e18f96@spud> <80325b72-e7b3-08cc-f726-513de75de94c@loongson.cn> From: Krzysztof Kozlowski In-Reply-To: <80325b72-e7b3-08cc-f726-513de75de94c@loongson.cn> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On 14/08/2023 05:39, Yinbo Zhu wrote: > > > 在 2023/8/11 下午10:25, Bartosz Golaszewski 写道: >> On Thu, Aug 10, 2023 at 8:19 AM Yinbo Zhu wrote: >>> >>> >>> >>> 在 2023/8/9 下午11:39, Conor Dooley 写道: >>>> On Wed, Aug 09, 2023 at 03:47:55PM +0800, Yinbo Zhu wrote: >>>>> 在 2023/8/8 下午8:05, Conor Dooley 写道: >>>>>> On Mon, Aug 07, 2023 at 03:40:42PM +0800, Yinbo Zhu wrote: >>>> >>>>>>> + loongson,gpio-ctrl-mode: >>>>>>> + $ref: /schemas/types.yaml#/definitions/uint32 >>>>>>> + description: >>>>>>> + This option indicate this GPIO control mode, where '0' represents >>>>>>> + bit control mode and '1' represents byte control mode. >>>>>> >>>>>> How is one supposed to know which of these modes to use? >>>>> >>>>> >>>>> Byte mode is to access by byte, such as gpio3, the base address of the >>>>> gpio controller is offset by 3 bytes as the access address of gpio3. >>>>> >>>>> The bit mode is the normal mode that like other platform gpio and it is >>>>> to access by bit. >>>>> >>>>> If both modes are supported, it is recommended to prioritize using byte >>>>> mode that according to spec. >>>> >>>> So, sounds like this property should instead be a boolean that notes >>>> whether the hardware supports the mode or not, rather than the current >>>> enum used to determine software policy. >>> >>> >>> okay, I got it, I will use boolean, >>> >> >> Why do you want to put it into device-tree so badly? This is not the >> first driver that would have of_match_data for different variants >> where you can have a structure that would keep offsets for different >> models. It's not like you will have hundreds of "compatible" chips >> anyway, most likely just a few? > > > Using this ways that put offset property into device-tree that can be > compatible with future GPIO chips without the need to modify drivers, That's not an argument for putting into DT. > such as more 2K chips in the future, but use of_match_data and data > field of_device_id, which every time a new SoC is released, the GPIO > driver needs to be modified once, which is not friendly to us. Sorry, "friendly" is again hardly an argument what should or should not be in DT. Best regards, Krzysztof