Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp920674lqo; Fri, 17 May 2024 05:56:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUSnZLtGPRgzTxW5HB4iD8LMas6c5roDjidQv5dP7DndqU7fG2ge7QWnrdWQBgi2VWxwhNd+L1pM8JaH2J5DgvPjUv/o5iSwBvYQ3DSmA== X-Google-Smtp-Source: AGHT+IGfX5JAjhzphlisacD1qcpwS+xIZ26q/8PR2GeXqA9ME5DQObRSQ7SCbRMH52qcRXyUKKHJ X-Received: by 2002:a05:6358:248c:b0:192:6f25:2101 with SMTP id e5c5f4694b2df-193bb4ff3c0mr2260771755d.1.1715950564193; Fri, 17 May 2024 05:56:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715950564; cv=pass; d=google.com; s=arc-20160816; b=xupBBr0VWtRhCRWKNltpbFr23waCO5z8UApFA2Ib3pZnbwlYVkpNCcQ1oGqTkpx9Dd u2fDjCCy9xzDiw3w/VvKKq/7SauA/iy6zGz5BVj8UcrvUvSEGqclXKh7Om/EsckaqX/h oZG4jMBYwDI9bzwjJUxyTqB6RcUitHeYlTuyFrCzQDpdJtyCQev1Bej4urKsC+Bs/AcU m1TVMrhkKUXeY2iy21lZTxMZ6a5p412Ur0tyNr8X+IKmLRPgt+Z+/qrXW42X3L244dMJ e7gd/Bq6fnm/3OO2/vGGwUT0y/yr0+PeVFH4s5hkEFpq9Q0B+Im1l3bBfZ6B/N6uekf3 yc6w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:from :dkim-signature; bh=zW5wTM7Wxxl+jny7CjNrz3i10lwRcwO9dJoFnZU/wW8=; fh=pXh/eUR1LHIluaACy2QTgLQcCMGsvg+0yP8Gupx/hJg=; b=Ne2HFWtKW5ocwJnFW3nVM0Y4GbP5vLUlqjnowHZVqiMrJd5dzZk0kCjFneIlUtWf1g oG0Z9p6KVyaAhHcJt1wxn1kOATJid3PCLx88NgwzBQZfcXghDvUN3wSquSK2ElzOofB1 8CrZ4lcjCgJoReVYD6EzT1Xf5WO816q5onU7VVHyxc2xY+Pk1gLV3hd5AP04q17Nj5Og 70GrFAu8vg6GNj8luKGoG7Zzu3/Db5p4CE/hjv/WvdTicmXZGgNjXqmrW1ojXkgZMBEJ XRBXmZWENlDLovEkFZfcubE0My/KxsOmROO6zdSX+bmfvEN9BVKbj+odWI5WGkrmy8g7 l3hg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=bA+wAUc3; arc=pass (i=1 spf=pass spfdomain=canonical.com dkim=pass dkdomain=canonical.com dmarc=pass fromdomain=canonical.com); spf=pass (google.com: domain of linux-kernel+bounces-182119-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182119-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-65b42622825si2413438a12.38.2024.05.17.05.56.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 05:56:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182119-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=bA+wAUc3; arc=pass (i=1 spf=pass spfdomain=canonical.com dkim=pass dkdomain=canonical.com dmarc=pass fromdomain=canonical.com); spf=pass (google.com: domain of linux-kernel+bounces-182119-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182119-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 02060282A09 for ; Fri, 17 May 2024 12:55:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4CFDE4F1F9; Fri, 17 May 2024 12:55:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=canonical.com header.i=@canonical.com header.b="bA+wAUc3" Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) (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 C05E653E0D for ; Fri, 17 May 2024 12:55:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.188.122 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715950510; cv=none; b=ucimYSx833rcfIltJj0WjYFImgjIKfkTf8cgvq9ctqeR+xcv2B7PqsjGDNyD9fUK+AF3e3pzjkcOkMqfrARrSvY8bHUf+BwpgCTpG1KfBp6ahqwsoURuh1VZJ9OmKWkPmoJZpVFxnUWccCrDnjbg5gXqMsQG5GZisJ7uG9VPriA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715950510; c=relaxed/simple; bh=XYXVIrGk8WONF2AJBpCrV0JwFIgC5Y4oslQEkZhhPno=; h=From:In-Reply-To:References:Mime-Version:Date:Message-ID:Subject: To:Cc:Content-Type; b=g8wVBW7TzZ9K5J8S9hXKnQiX21mIknPY7eN0s/UxHuyhs6FGMEVPFY+JsjMQeFY7FLcCWPBsD/l8+jzI24N2tZRVXPE0D8CD/MUgeEQZTw6kKgqjLcNEJFeV/a1pow+fBHytc9aF6sgZk4upqTrns5ekAYtSPc0zciJArf5sWRo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=canonical.com; spf=pass smtp.mailfrom=canonical.com; dkim=pass (2048-bit key) header.d=canonical.com header.i=@canonical.com header.b=bA+wAUc3; arc=none smtp.client-ip=185.125.188.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=canonical.com Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id A499B41204 for ; Fri, 17 May 2024 12:48:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1715950099; bh=zW5wTM7Wxxl+jny7CjNrz3i10lwRcwO9dJoFnZU/wW8=; h=From:In-Reply-To:References:Mime-Version:Date:Message-ID:Subject: To:Cc:Content-Type; b=bA+wAUc3PPzoStlPejsbvERe1ZgHqEGl3ls8aiBAnMxHPU0U+QoXnl58eWDDCzHly xS10zCtCQvu4fC81t4Eoo9BznS5DHF0V2NJuWkPC2oD7jLzFms3yKqjwH546PkGGaq DGJnXBmSW95/XSDbfmwKpd/rH0psmsG1RFH6pMevHGj7CqAo9UHTvmeQ+G1zsGTuZe P2ZH3Fl3EBeN7d7US5CWFFi3vXuNCO6aR6gzyUIB8TBnuFzSpainEV6R/POK+5Tbzo cdyuSqSZ90ITJMT+QqjecZ9XQqX5rAVBL0V9Z231QPRwLPMUyc6eqCFY91ogNcwizk 0mTE8bmu0EPjQ== Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-43d1e3e7730so110004191cf.2 for ; Fri, 17 May 2024 05:48:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715950098; x=1716554898; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zW5wTM7Wxxl+jny7CjNrz3i10lwRcwO9dJoFnZU/wW8=; b=MzI0m2wyPZ8bZ2b8hkrWqOsHjPi0jmMH1N5ZaHux09qhf9asI8VRwz0qlR0EVQJrmP +sKIDWIdgWeeR3lAvTDL6R1kpt7Pv/OPeLyFBJZZRXOSp/5EzaYIQN6wg5ZXe/qzZLAK 11wLCdH/+UYnEEwRkyjBMLy8ptrrG4zm+ynQxu0FLOCGwjD+TZlt/ijLBs0zRHSn9PLO votD0DZH0MNekmbwtipURejjBLitgOjqTsoG+Dx3OfM7rugd2+WkVgK3fAq8+0cuaPj1 MjnWbsNYp2vgleecft7OdLAjsGCnnvMPOieqWvIKUBckwIAA6x7CHTsvRhoeG2934ahT eK4Q== X-Gm-Message-State: AOJu0Yx+kaoftCPM40O/WNLOEpWRufaF4P2ucwSe7OMcSwGWHSaZnp1W /jyI8MHrSrJSzjWHj5srjJl+nFQm72BTUzz/TymbsptxUmWkDQjZYRY2ukqOXNuu8Wo6ortnrOW hdGZ6V5h9sLBRFDVVOoYwYf1L9S28AcVXwouTpknsB6EaKrGlNs8yKcPpwc8cZu2HXjabGhcfdb GU227yOqkh8bMRhbTepe9lxvFw/JSiW1KcKqseKqU56+GBm9ysf7v5 X-Received: by 2002:a05:622a:8b:b0:43a:d430:b678 with SMTP id d75a77b69052e-43dfdb170a3mr219093471cf.32.1715950098388; Fri, 17 May 2024 05:48:18 -0700 (PDT) X-Received: by 2002:a05:622a:8b:b0:43a:d430:b678 with SMTP id d75a77b69052e-43dfdb170a3mr219093261cf.32.1715950098054; Fri, 17 May 2024 05:48:18 -0700 (PDT) Received: from 348282803490 named unknown by gmailapi.google.com with HTTPREST; Fri, 17 May 2024 07:48:17 -0500 From: Emil Renner Berthing In-Reply-To: <20240115173657.GA999912-robh@kernel.org> References: <20240103132852.298964-1-emil.renner.berthing@canonical.com> <20240103132852.298964-2-emil.renner.berthing@canonical.com> <20240115173657.GA999912-robh@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Date: Fri, 17 May 2024 07:48:17 -0500 Message-ID: Subject: Re: [PATCH v2 1/8] dt-bindings: pinctrl: Add thead,th1520-pinctrl bindings To: Rob Herring , Emil Renner Berthing Cc: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, Linus Walleij , Krzysztof Kozlowski , Conor Dooley , Jisheng Zhang , Guo Ren , Fu Wei , Paul Walmsley , Palmer Dabbelt , Drew Fustini Content-Type: text/plain; charset="UTF-8" Rob Herring wrote: > On Wed, Jan 03, 2024 at 02:28:38PM +0100, Emil Renner Berthing wrote: > > Add bindings for the pin controllers on the T-Head TH1520 RISC-V SoC. > > > > Signed-off-by: Emil Renner Berthing > > --- > > .../pinctrl/thead,th1520-pinctrl.yaml | 372 ++++++++++++++++++ > > 1 file changed, 372 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/pinctrl/thead,th1520-pinctrl.yaml > > > > diff --git a/Documentation/devicetree/bindings/pinctrl/thead,th1520-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/thead,th1520-pinctrl.yaml > > new file mode 100644 > > index 000000000000..d3ad7a7cfdd1 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/pinctrl/thead,th1520-pinctrl.yaml > > @@ -0,0 +1,372 @@ > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > +%YAML 1.2 > > +--- > > +$id: http://devicetree.org/schemas/pinctrl/thead,th1520-pinctrl.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: T-Head TH1520 SoC pin controller > > + > > +maintainers: > > + - Emil Renner Berthing > > + > > +description: | > > + Pinmux and pinconf controller in the T-Head TH1520 RISC-V SoC. > > + > > + The TH1520 has 3 groups of pads each controlled from different memory ranges. > > + Confusingly the memory ranges are named > > + PADCTRL_AOSYS -> PAD Group 1 > > + PADCTRL1_APSYS -> PAD Group 2 > > + PADCTRL0_APSYS -> PAD Group 3 > > + > > + Each pad can be muxed individually to up to 6 different functions. For most > > + pads only a few of those 6 configurations are valid though, and a few pads in > > + group 1 does not support muxing at all. > > + > > + Pinconf is fairly regular except for a few pads in group 1 that either can't > > + be configured or has some special functions. The rest have configurable drive > > + strength, input enable, schmitt trigger, slew rate, pull-up and pull-down in > > + addition to a special strong pull up. > > + > > + Certain pads in group 1 can be muxed to AUDIO_PA0 - AUDIO_PA30 functions and > > + are then meant to be used by the audio co-processor. Each such pad can then > > + be further muxed to either audio GPIO or one of 4 functions such as UART, I2C > > + and I2S. If the audio pad is muxed to one of the 4 functions then pinconf is > > + also configured in different registers. All of this is done from a different > > + AUDIO_IOCTRL memory range and is left to the audio co-processor for now. > > It is still not clear to me if each instance is a different programming > model or the same with just different connections. The latter should > be the same compatible string. That needs to be answered in *this* > patch, not a reply. Hi Rob, Sorry for the late response. I honestly don't know exactly what you mean by differenty programming models and what the difference is, so I'll need a bit of help with what you want me to write here. Any driver for the TH1520 SoC (not just Linux) would need some way to discern between the 3 pin controllers so they know how many pins to control and what pinmux settings are valid. Basically they'd need the data in the three th1520_group{1,2,3}_pins arrays in the driver and a way to know which of them to use. https://lore.kernel.org/linux-riscv/20240103132852.298964-3-emil.renner.berthing@canonical.com/ Another solution would be to just have one compatible value, and then let the driver figure out which of the 3 pin controllers it's probing from the base physical memory address. That would work fine. A third solution would be to encode the data in those three arrays into the device tree, but I thought we didn't want to encode register information in device trees. /Emil