Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp831919imu; Tue, 11 Dec 2018 08:14:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vl3SZ8Id7G5CO1c47qZlQvBFh4kGI1udcMkQgnDReUF6Z9I2dmF8LNVfBSVVZc91vhCwIO X-Received: by 2002:a65:58ca:: with SMTP id e10mr13781177pgu.99.1544544858096; Tue, 11 Dec 2018 08:14:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544544858; cv=none; d=google.com; s=arc-20160816; b=hHyfU2uqJvRMQ802hnoEXaBed80q42xgPsS0s2E75WwLRD5S47TmtzX9J7ghSVQ5Hc aScJk62eRFyYrTLLA8ODPdvuvg4G0PCPcSb1pzzExOOk80907s1nLZpTUtH8fw6uX3LZ Wj7cWTJspOTbqLKT+MR8XRBmvNzguUhzL/xlNTKUaFD28xlDpHWouMQPcmPFnFXjkEKG TtS86QdApfnl7neV9XGRL5BY8U5C3ICMZSng4R+jBRAkKsxFN8lOzm0xrmuPLVBCphs2 5zRHQ3TfAfZX4kzXoYUJ3wDn+Ardv1kN5dB8ClW4w/gUSQlaPjToq3vWmaji1TrPZQcU TFpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=p1q3Mn1kgWqisX7xOg+J5CG27nNy/XVZWdVweEMUzPM=; b=ctuDOX0pMb6q1mZ0q5FA0WYCY4CZXaA5Gk6z6avR3gl4iQgPZWZoEONJya6gahtV3j DayOW35fUioYKZbVxpQYZo+n4uw+2pxLscCFpLko8/BkXfCfsqfAQrOmDjQuG7uyId71 1ViwhMGVva6Z0USu1Qv55UUjZz40bqVR3eLnu6wXxQbcVmPwBq7fT0fISn45VIHnpIp2 Fd/oqYzmUGTV6WwhNNVAoYeOFUm8OBkJ5X4Zpqzx0DOm1QrsbWXp7gMLRoT2b6CZnWKM zjwqGptHVWhnBl/ptws+HTYoyMbxr0XanLz85EG6dPmodiXr46VeRU0yLXuxl1O2GHrP R4Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lixom-net.20150623.gappssmtp.com header.s=20150623 header.b=aPvw8m7Q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7si12783378plt.212.2018.12.11.08.14.03; Tue, 11 Dec 2018 08:14:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@lixom-net.20150623.gappssmtp.com header.s=20150623 header.b=aPvw8m7Q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730412AbeLKQMO (ORCPT + 99 others); Tue, 11 Dec 2018 11:12:14 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:39337 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729620AbeLKQML (ORCPT ); Tue, 11 Dec 2018 11:12:11 -0500 Received: by mail-lf1-f66.google.com with SMTP id n18so11192674lfh.6 for ; Tue, 11 Dec 2018 08:12:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lixom-net.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=p1q3Mn1kgWqisX7xOg+J5CG27nNy/XVZWdVweEMUzPM=; b=aPvw8m7QLfwOwfhmq1KD1ujsgPwrc/hTCwX+VFWqxbLeuUHEt5pcb+a6enF7cTnEjz 6lvWA/ltlBK8sFIaYbHL94OB2NMvCXlwUL/tRDlRcriKLnwFseAgF48XU0AI4z3qTED1 VUFdNIUonkMf2jKLAwa+OEN6ld67xfSJZwium2LrqLJJMERZCtPhmNO+alLpaWjmdasE 5EOai/6myw6KgpWs1Q5gNW4O++BF2QrE6e83COIkhMtgEW3Kp36yKCd0mKbwJ2voWaK8 DbtZd2J0KzdNfFvHSH8Bf6yweJFOwvKg6tGlQWmOEbcLE1rD9ae6VcFVlNkUezpgaNNP hu8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=p1q3Mn1kgWqisX7xOg+J5CG27nNy/XVZWdVweEMUzPM=; b=bkcmvQDRaBSLzkfxY8g/g6KebayyWISq5sJ63jbWD8/7Gx33naYhbVnhITJSIcsQrK IHEPlktVKLQ0PQlVYBN0hXzCCGwBlRDaW206g2dZMkhvMKUTitfUlgJi1In0yqGNk0bM xSL4CzPRPnS99IXo5Cpvmd4QgXbCsMXQJWy30BBXj+eMUVvJmBj8ErHxYkJ+IoMcr/RD 9ppRX0ZOjY7zxMeFkPttuc+JkPO6KZdcxKFGJpvSnzPEH+PQLY2trMJxFd7ShV2NqVGW 7P9wkSkDJvrKBktQkbCfda0HtyEAqo/cq4KxcMMh2UJePknU1GFlaBMO3fUKmxCCZdFM 03ug== X-Gm-Message-State: AA+aEWbWjxZwyCAheR3ncBzzZdd6uUfeCgJc0YFFruUC6DZZUkSUPthR qhCvjbGbxjmxbUjPEfXjFneLvA== X-Received: by 2002:a19:9e11:: with SMTP id h17mr10425348lfe.73.1544544728590; Tue, 11 Dec 2018 08:12:08 -0800 (PST) Received: from localhost (h85-30-9-151.cust.a3fiber.se. [85.30.9.151]) by smtp.gmail.com with ESMTPSA id z9sm2686311lfj.79.2018.12.11.08.12.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Dec 2018 08:12:07 -0800 (PST) Date: Tue, 11 Dec 2018 07:41:09 -0800 From: Olof Johansson To: Sean Wang Cc: Linus Walleij , Matthias Brugger , arm@kernel.org, Manivannan Sadhasivam , robh+dt@kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, amit.kucheria@linaro.org Subject: Re: [PATCH v3 1/4] dt-bindings: pinctrl: Add devicetree bindings for MT6797 SoC Pinctrl Message-ID: <20181211154109.trgger4syzsvpio6@localhost> References: <20181107174844.5381-1-manivannan.sadhasivam@linaro.org> <20181107174844.5381-2-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 07, 2018 at 01:42:59PM -0800, Sean Wang wrote: > Hi Olof, > > I'm a guy from MediaTek. > Thanks for your input and we will get these bad things to be better. > > On Fri, Dec 7, 2018 at 10:42 AM Olof Johansson wrote: > > > > On Wed, Dec 5, 2018 at 4:01 AM Linus Walleij wrote: > > > > > > On Mon, Dec 3, 2018 at 2:08 AM Matthias Brugger wrote: > > > > On 15/11/2018 11:04, Linus Walleij wrote: > > > > > On Wed, Nov 7, 2018 at 6:49 PM Manivannan Sadhasivam > > > > > wrote: > > > > > > > > > >> Add devicetree bindings for Mediatek MT6797 SoC Pin Controller. > > > > >> > > > > >> Signed-off-by: Manivannan Sadhasivam > > > > > > > > > > Patch applied. > > > > > > > > > > > > > Could you provide a stable tree for me, so that I can take the dts parts? > > > > I just realized that my build is broken because of the missing dt-bindings > > > > header file. > > > > > > Since I pulled other changes on top it is too late for me to put that > > > in an immutable branch and merge into my tree separately, > > > you would have to pull in the whole "devel" branch from the > > > pin control tree. > > > > > > What we sometimes do is simply apply the *EXACT* same patch > > > to two git trees. Git will cope with that as long as they are > > > absolutely *IDENTICAL*. (The patch will appear twice in the > > > git log with different hashes but they will merge without > > > problems, a bit unelegant but it works.) > > > > > > So in your situation I would extract this patch from the pinctrl > > > tree: > > > https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git/commit/?h=devel&id=95d2f00657ad4c2c3eacd8a871a7aa022c3fe7d9 > > > and apply it with some notice to the maintainers about > > > the situation. > > > > > > ARM SoC folks: agreed? > > > > So, applying the patches in parallel is fine, but this made me look at > > the actual patches and file contents, and they seem to be a bit messy. > > > > I've also noticed the messy thing so we've changed these doable SoCs > to using generic pinctrl bindings like MT7622 and MT7629 to get rid of > the big header. And for the other SoCs, they still tend to keep vendor > binding because of historical reasons, the related board makers > preferences and it is indeed a little hard to change what these people > used to. Yeah, changing bindings means that downstream DT files will need updates, which can be awkward. But it's worth paying attention to moving forward. > > > This feedback is more to the MT maintainers/developers than you, Linus > > (obviously): > > > > These header files are huge, and they're inconsistent in the way they > > define these constants: > > > > include/dt-bindings/pinctrl/mt7623-pinfunc.h: > > #define MT7623_PIN_21_PCM_TX_FUNC_GPIO21 (MTK_PIN_NO(21) | 0) > > #define MT7623_PIN_21_PCM_TX_FUNC_PCM_TX (MTK_PIN_NO(21) | 1) > > #define MT7623_PIN_21_PCM_TX_FUNC_MRG_TX (MTK_PIN_NO(21) | 2) > > #define MT7623_PIN_21_PCM_TX_FUNC_MRG_RX (MTK_PIN_NO(21) | 3) > > #define MT7623_PIN_21_PCM_TX_FUNC_PCM_RX (MTK_PIN_NO(21) | 4) > > #define MT7623_PIN_21_PCM_TX_FUNC_CONN_DSP_JMS (MTK_PIN_NO(21) | 5) > > #define MT7623_PIN_21_PCM_TX_FUNC_AP_PCM_TX (MTK_PIN_NO(21) | 6) > > > > include/dt-bindings/pinctrl/mt6397-pinfunc.h: > > #define MT6397_PIN_24_ROW4__FUNC_GPIO24 (MTK_PIN_NO(24) | 0) > > #define MT6397_PIN_24_ROW4__FUNC_ROW4 (MTK_PIN_NO(24) | 1) > > #define MT6397_PIN_24_ROW4__FUNC_EINT22_1X (MTK_PIN_NO(24) | 2) > > #define MT6397_PIN_24_ROW4__FUNC_SCL2_3X (MTK_PIN_NO(24) | 3) > > #define MT6397_PIN_24_ROW4__FUNC_TEST_IN15 (MTK_PIN_NO(24) | 6) > > #define MT6397_PIN_24_ROW4__FUNC_TEST_OUT15 (MTK_PIN_NO(24) | 7) > > > > include/dt-bindings/pinctrl/mt6797-pinfunc.h: > > #define MT6797_GPIO34__FUNC_GPIO34 (MTK_PIN_NO(34) | 0) > > #define MT6797_GPIO34__FUNC_CMFLASH (MTK_PIN_NO(34) | 1) > > #define MT6797_GPIO34__FUNC_CLKM0 (MTK_PIN_NO(34) | 2) > > #define MT6797_GPIO34__FUNC_UDI_NTRST (MTK_PIN_NO(34) | 3) > > #define MT6797_GPIO34__FUNC_SCP_JTAG_TRSTN (MTK_PIN_NO(34) | 4) > > #define MT6797_GPIO34__FUNC_CONN_MCU_TRST_B (MTK_PIN_NO(34) | 5) > > #define MT6797_GPIO34__FUNC_MD_UTXD0 (MTK_PIN_NO(34) | 6) > > #define MT6797_GPIO34__FUNC_C2K_DM_JTINTP (MTK_PIN_NO(34) | 7) > > > > So, is it a pin or a GPIO and why does 6797 use different naming > > scheme? > > They all stand for the pin and list all the functions which the pin > can be switched to. > > MT6797 is the first mtk pinctrl driver not contributed by mediatek people, > we will try to fix these confusing things and should be careful > keeping the naming be uniform in the future. > > > Why do some of them have __FUNC and some _FUNC?Why do some > > have the non-gpio function as part of the name and some do not? > > > > ditto, we will try to fix and keep the naming be uniform Sounds good! > > Also, "pin 24 row 4 func row4"? Seems to have very limited value to > > describe it in that manner, it's just overly verbose without adding > > information. > > All the function names for a pin totally are same (copied) with > hardware document describes. That means it's default function of the > pin the hardware provides. Yeah, I can see how that happens. Also, often the hardware documents don't aggregate in the same way that our software does, so they won't notice inconsistencies between versions in the same way (nobody really tries to make one document with pin names between different chip families on the hardware side). > > Some other SoCs tend to use a pinctrl specifier that is two-cell > function> instead of trying to pack them into one integer. > > I'm not the initial developer for the vendor binding. but I guessed > the initial thought trying to pack them into one integer can decrease > the risk of inconsistency between pin and function, especially > there're more than some hundred pins and functions present on SoC. Yeah, I can see that benefit, but it can also be caught with our new schemas and/or by drivers in some cases. Having a binding that's a natural way of describing the hardware without encoding it tends to be preferred. > > That seems > > a lot more practical, especially since the base GPIO function seems to > > generically be '0'. So the pin number would go in the first cell, and > > the function in the second. > > > > Finally, I don't see how the header file is used in the code at all? > > > > The main idea behind the dt bindings header files is that they would > > provide shared constants between the DT and the driver in the kernel. > > If the constants are never used (i.e. they're just register values, > > like today), then there's no need to merge the dt header with the > > driver at all, it should go with the DT contents instead. > > Yes, it should be better to go with DT contents, not be the interface > between DT and driver. These pin names are totally the same with these > pin names shown on the schematic diagram, so it works more like > providing an easy to remember text to allow people configure its pin > easier while crossing reference schematic diagram. You can still have symbols for the pin numbers if you want, but if you build your header file a bit more elabroate you can easily expose the pin and function names through sysfs instead, which helps debugging. > > So, for > > example, if you used something like a format of > > properties, the header file could contain both the string > > representation of the function for debug, as well as the values, all > > derived from one place. Today all you have string representations for > > is "func0".."func15" through mtk_gpio_functions[]. Seems like an > > improvement all around? -Olof