From patchwork Sun Sep 15 02:40:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 13804637 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 69566C35FE0 for ; Sun, 15 Sep 2024 02:42:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=s8H0C2vTO6YJOHoRuMwKYUWMxcFgHXbXgraoAXGvaeI=; b=UZ8VV001lBesyY Z4N3ith8HMeAo9AgvAW6mZhA1IlWjnD/LnI4LZRfaR9M2h29llfjCzd/hXAjuVPlpzoUVu48/ugTi RSVkxltQ0O7TcVOQUqUO2ePcN0PHCIKLr+8V5E4gYF058qabYwyETRx79gQig0l9AY93YUnFD0vQU KpgvrbRf5l39DBSio3kdn4vu1SaRs5w9b43Riuv06dOptq5FK9IKnGTeKPWEOLGV2dRVLm2AXQH8d 2BuZ6YeISRGulffZ6tVlDCO/PEpJYskLPPMFkZwsUDycJgxCih6YnoMmOoStbins6rLxp41nU/ktz mS7OMRkmXqpv5IUZHPDQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1spfDD-00000001VVk-0O0r; Sun, 15 Sep 2024 02:42:07 +0000 Received: from mail-yw1-x1129.google.com ([2607:f8b0:4864:20::1129]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1spfD9-00000001VUm-12Q8 for linux-riscv@lists.infradead.org; Sun, 15 Sep 2024 02:42:04 +0000 Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-6d49cec2a5dso16328587b3.3 for ; Sat, 14 Sep 2024 19:42:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tenstorrent.com; s=google; t=1726368122; x=1726972922; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=tMQRtPuaHxiDneHLGsqEiUQVCNL6uGmkw4AEy7QlmYA=; b=Uk3y5AHVoFAv1RClwVUfuZ+OFWZ90btsv/quDqybuFHYAuQvXk7Si9v9z71w+fFI/U I4rEX/6Xpce3LeC1A20HZuu3aHggZswXrsFJ0LM8R73cbkOq+v23ewnMfvT+uNJcmqmP r+/hcl6uJx25WqaKSI2dKqvYyevxKaWDVU9bw6h2xd4HC5GbSFmEb5ku9XZH4ZPKBu/k Wdr7KTqEIwM285tU925eIxX7HPmIUBsT9zboVVlwj2fcE0RMV+xbJboTbsPh+nUfrcJh pot3ayct8VCflZlf6wdg/4Tw8KG/xON+9HCOpDyl20LItXDUG2IaIZggGXOAeQjPz2jD Dwdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726368122; x=1726972922; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tMQRtPuaHxiDneHLGsqEiUQVCNL6uGmkw4AEy7QlmYA=; b=RRPybi0Xc5H+L6gi3TXnwola2nJa1YD+rOW69kHZXpKHCHyGRgPCWN7IShhPXOVxaW R96qJwiXmiaczZYiexJF+HudQbWKV5kpQT2vGLUv27n1/liaQLItczaDk0FUB0KxtZtR QGFq3i0oefy4fmNDiydFnrptNOL4QQhXs6fixPB84Eq8VEeFbQUH9dO2ABCttwrxY6L0 NwIF+FCs7lqU1O3xr8B5Ue8ra2TUWX9GPG1MFBKqxsZeNGRtFpw+/pWkYjx774StxIOs 7GdEOlNyNN4TqQP5QjqvWzM7ZiGYI6DBm7tkP0I8iJUn7/RtNYEHWomt31/SbopbC+Uk bL4w== X-Gm-Message-State: AOJu0YxWwG8vGquxbeemHe9OPVzVqMZRrObOjo0KYbVQ3jKsF1bz7nLD 1bD2w4oYaXPlPnjuSj+pRyA5nVyy5wAxG3GKYRgnDFR/damvkUe+Z979/TmvBBA= X-Google-Smtp-Source: AGHT+IHHNR7CGDPc0Pjeg9v8F+XBJ1eide8KNVapGjJQGi+bc28YRc4SOy1s7v6U0+ArPman2j0mTQ== X-Received: by 2002:a05:690c:4904:b0:6db:c6ea:6eb9 with SMTP id 00721157ae682-6dbcc5946a8mr59791137b3.45.1726368121924; Sat, 14 Sep 2024 19:42:01 -0700 (PDT) Received: from [127.0.1.1] ([216.139.163.245]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6dbe2e0d924sm4129097b3.41.2024.09.14.19.41.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Sep 2024 19:42:01 -0700 (PDT) From: Drew Fustini Date: Sat, 14 Sep 2024 19:40:49 -0700 Subject: [PATCH v2 1/8] dt-bindings: pinctrl: Add thead,th1520-pinctrl bindings MIME-Version: 1.0 Message-Id: <20240914-th1520-pinctrl-v2-1-3ba67dde882c@tenstorrent.com> References: <20240914-th1520-pinctrl-v2-0-3ba67dde882c@tenstorrent.com> In-Reply-To: <20240914-th1520-pinctrl-v2-0-3ba67dde882c@tenstorrent.com> To: Drew Fustini , Guo Ren , Fu Wei , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Emil Renner Berthing , Thomas Bonnefille , Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: linux-riscv@lists.infradead.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Drew Fustini X-Mailer: b4 0.14.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240914_194203_336819_1FA4DBE0 X-CRM114-Status: GOOD ( 19.84 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Emil Renner Berthing Add bindings for the pin controllers on the T-Head TH1520 RISC-V SoC. Tested-by: Thomas Bonnefille Signed-off-by: Emil Renner Berthing [dfustini: add thead,pad-group to select the pin controller instance] Signed-off-by: Drew Fustini Reviewed-by: Rob Herring (Arm) --- .../bindings/pinctrl/thead,th1520-pinctrl.yaml | 176 +++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 177 insertions(+) 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..21f86740a63d --- /dev/null +++ b/Documentation/devicetree/bindings/pinctrl/thead,th1520-pinctrl.yaml @@ -0,0 +1,176 @@ +# 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. + +properties: + compatible: + enum: + - thead,th1520-pinctrl + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + thead,pad-group: + description: | + Select the pad group that is associated with the pin controller instance. + + Base Address Name Group + 0xFF_FFF4_A000 PADCTRL_AOSYS 1 + 0xFF_E7F3_C000 PADCTRL1_APSYS 2 + 0xFF_EC00_7000 PADCTRL0_APSYS 3 + + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [1, 2, 3] + +required: + - compatible + - reg + - clocks + +patternProperties: + '-[0-9]+$': + type: object + additionalProperties: false + + patternProperties: + '-pins$': + type: object + allOf: + - $ref: /schemas/pinctrl/pincfg-node.yaml# + - $ref: /schemas/pinctrl/pinmux-node.yaml# + + additionalProperties: false + + description: + A pinctrl node should contain at least one subnode describing one + or more pads and their associated pinmux and pinconf settings. + + properties: + pins: + description: List of pads that properties in the node apply to. + + function: + enum: [ gpio, pwm, uart, ir, i2c, spi, qspi, sdio, audio, i2s, + gmac0, gmac1, dpu0, dpu1, isp, hdmi, bootsel, debug, + clock, jtag, iso7816, efuse, reset ] + description: The mux function to select for the given pins. + + bias-disable: true + + bias-pull-up: + oneOf: + - type: boolean + description: Enable the regular 48kOhm pull-up + - enum: [ 2100, 48000 ] + description: Enable the strong 2.1kOhm pull-up or regular 48kOhm pull-up + + bias-pull-down: + oneOf: + - type: boolean + - const: 44000 + description: Enable the regular 44kOhm pull-down + + drive-strength: + enum: [ 1, 2, 3, 5, 7, 8, 10, 12, 13, 15, 16, 18, 20, 21, 23, 25 ] + description: Drive strength in mA + + input-enable: true + + input-disable: true + + input-schmitt-enable: true + + input-schmitt-disable: true + + slew-rate: + maximum: 1 + + required: + - pins + +additionalProperties: false + +examples: + - | + padctrl0_apsys: pinctrl@ec007000 { + compatible = "thead,th1520-pinctrl"; + reg = <0xec007000 0x1000>; + clocks = <&apb_clk>; + thead,pad-group = <3>; + + uart0_pins: uart0-0 { + tx-pins { + pins = "UART0_TXD"; + function = "uart"; + bias-disable; + drive-strength = <3>; + input-disable; + input-schmitt-disable; + slew-rate = <0>; + }; + + rx-pins { + pins = "UART0_RXD"; + function = "uart"; + bias-disable; + drive-strength = <1>; + input-enable; + input-schmitt-enable; + slew-rate = <0>; + }; + }; + }; + + padctrl1_apsys: pinctrl@e7f3c000 { + compatible = "thead,th1520-pinctrl"; + reg = <0xe7f3c000 0x1000>; + clocks = <&apb_clk>; + thead,pad-group = <2>; + + i2c5_pins: i2c5-0 { + i2c-pins { + pins = "QSPI1_CSN0", /* I2C5_SCL */ + "QSPI1_D0_MOSI"; /* I2C5_SDA */ + function = "i2c"; + bias-pull-up = <2100>; + drive-strength = <7>; + input-enable; + input-schmitt-enable; + slew-rate = <0>; + }; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 878dcd23b331..a73953c0f080 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19700,6 +19700,7 @@ L: linux-riscv@lists.infradead.org S: Maintained T: git https://github.com/pdp7/linux.git F: Documentation/devicetree/bindings/clock/thead,th1520-clk-ap.yaml +F: Documentation/devicetree/bindings/pinctrl/thead,th1520-pinctrl.yaml F: arch/riscv/boot/dts/thead/ F: drivers/clk/thead/clk-th1520-ap.c F: include/dt-bindings/clock/thead,th1520-clk-ap.h