From patchwork Wed Oct 23 16:19:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13847429 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B33D81AC447; Wed, 23 Oct 2024 16:20:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729700442; cv=none; b=SuSkaOKoJzxVJe3BAAX0U6IObigYaZfgmrUTHSHcMxmr+p0kK730eEY4SIrno9Zwr65uQs7f0M7s09FLo6mWsCqVNWh7fh8mAWdKLiO67w2JDBi1GpE1NhaFOt0pdhVoLRsO93eFuYqL1ayjCidc66fY1icRovRfmkNHiVScG5E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729700442; c=relaxed/simple; bh=gBl7DR7/4Q21fYO8RAaj9Q46FwcU5IzTAIvDAxxJFsM=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZLQTPDsKWvEnYh0UCV3GKtvzq2xkeH9HH8XAcx8gdvZRS2RYQjHJ79Tez67ldV1b9ZJC2A/R7PYLJoe9Wgo44Mi7gPRdnuII9vAkbYbdDECyOM4x5jT/GtmtbEDtMs/5HZfL/AP+IyMov1cMlEq3UrJs/L+IFSm7BWMsg68pNRA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CbreQ603; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CbreQ603" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-37d50fad249so5479815f8f.1; Wed, 23 Oct 2024 09:20:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729700439; x=1730305239; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=TcciO8mXdvJnEbC5HZRbN2ooSLL7ubOPVPChVSqLDxw=; b=CbreQ603D59h73mBAx8L1KXUQmYe1xjChS+yFY8Yl2Jzes4hBBODuDASgz252BbFRY tlc/ScHel3CZhy/uvuWq7qkG/71HPLbVBYUaVe5+1wmEBnD6w/qnOuo+YoMigGz+BZ0+ r1kk5j9afRjCKd6g8do+RXN28cTK3VadUNuCvGAKN2vt+h/4sA1xXkV1Ok6LYU+csJpm t9k7zPmZuNaaNUnaidXX26LxQftEnt5D3niEcvuHPKxxPJOzXxnKEKidnMw0DD9wMcPn CdZpmS26Xieaet+H9Yxx1RVubLm6s1V6hXUhGmQ0I3uIa5wV25nvIqxGaET+TgYxy36u gawQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729700439; x=1730305239; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TcciO8mXdvJnEbC5HZRbN2ooSLL7ubOPVPChVSqLDxw=; b=DYvVkIuVbWI538smhIcCINr5d6DWhJnA+aIPyWJtQiYigZhjett22dNWP/eqE+YDdC eybbgrjx8wdMpjj934pDbJq7C5SEe1nxlfxiiPh7Mksa/OgBz+5tw19vrQiS7RklNUpx yQT9ZUklJY9bfE4ot2i0Wlm8yHu+zb1uqQsAj3N7IQs3MD4Bqfifp0N+XYe/vJxljEGg QxiZqGZ5bVxwp+hN14+l3n4LUH28uxzJ8f+JGCRfmvyYS833kRnPkmWWasiutfXs63zl ujeZkJ88jJ0Tzs1shZ8SunVUN/1gE7ENOqemtJfEewRsel9jnSoDQl5EDVV6jsXC8Y2v GqNA== X-Forwarded-Encrypted: i=1; AJvYcCUtOtfR8T1WcZwG6lmocfVHwdLQcqVOxeHkfbAShM6UvFHEUpWslTn1GHuuEIr7/Sn1qtswi6Hn//FE@vger.kernel.org, AJvYcCVSw0uvr1Qlt0OsqwFiZYxX+cRJsDveaY0qqNQILIwnVj3Bm9BV/vz77IPjZ4Ki9+BtEvJvFV2+@vger.kernel.org, AJvYcCXTq+aWNIQ+1BV+ZWj1A9835bm2O21rJfdZHyzPBawopsAGeE0UifTOd3NcmUDsHTAcWuuILYfTFG8Zfqxh@vger.kernel.org X-Gm-Message-State: AOJu0Yzy9me9P6cHPOXQpZYjS0opYV7tBjTwPiauGWZjeIpHEsyFRJHx DO4XqfnpsqbAhyafSJddmMLAYfigVUxrryRHL1/7gu68LDwDfE/d X-Google-Smtp-Source: AGHT+IGqs5WTa5lgrEZft78ZOevHZ2oYPkSEpx4GfNUrtswgxUJ8sI1HnqKCKf20+OlzgSGbMgfeYQ== X-Received: by 2002:adf:fd0e:0:b0:37d:49a1:40c7 with SMTP id ffacd0b85a97d-37efcf1b51amr2191616f8f.28.1729700438757; Wed, 23 Oct 2024 09:20:38 -0700 (PDT) Received: from localhost.localdomain (93-34-91-161.ip49.fastwebnet.it. [93.34.91.161]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-37ee0ba7dffsm9249993f8f.116.2024.10.23.09.20.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:20:38 -0700 (PDT) From: Christian Marangi To: Christian Marangi , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiner Kallweit , Russell King , Matthias Brugger , AngeloGioacchino Del Regno , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [net-next RFC PATCH v2 1/3] dt-bindings: net: dsa: Add Airoha AN8855 Gigabit Switch documentation Date: Wed, 23 Oct 2024 18:19:50 +0200 Message-ID: <20241023161958.12056-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241023161958.12056-1-ansuelsmth@gmail.com> References: <20241023161958.12056-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Add Airoha AN8855 5 port Gigabit Switch documentation. The switch node requires an additional mdio node to describe each internal PHY relative offset as the PHY address for the switch match the one for the PHY ports. On top of internal PHY address, the switch base PHY address is added. Also the switch base PHY address can be configured and changed after the first initialization. On reset, the switch PHY address is ALWAYS 1. This can be configured with the use of "airoha,base_smi_address". Calibration values might be stored in switch EFUSE and internal PHY might need to be calibrated, in such case, airoha,ext_surge needs to be enabled and relative NVMEM cells needs to be defined in nvmem-layout node. Signed-off-by: Christian Marangi --- .../bindings/net/dsa/airoha,an8855.yaml | 253 ++++++++++++++++++ 1 file changed, 253 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/dsa/airoha,an8855.yaml diff --git a/Documentation/devicetree/bindings/net/dsa/airoha,an8855.yaml b/Documentation/devicetree/bindings/net/dsa/airoha,an8855.yaml new file mode 100644 index 000000000000..5982b4c39536 --- /dev/null +++ b/Documentation/devicetree/bindings/net/dsa/airoha,an8855.yaml @@ -0,0 +1,253 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/dsa/airoha,an8855.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Airoha AN8855 Gigabit switch + +maintainers: + - Christian Marangi + +description: + Airoha AN8855 is a 5-port Gigabit Switch. + + The switch node requires an additional mdio node to describe each internal + PHY relative offset as the PHY address for the switch match the one for + the PHY ports. On top of internal PHY address, the switch base PHY address + is added. + + Also the switch base PHY address can be configured and changed after the + first initialization. On reset, the switch PHY address is ALWAYS 1. + +properties: + compatible: + const: airoha,an8855 + + reg: + maxItems: 1 + + reset-gpios: + description: + GPIO to be used to reset the whole device + maxItems: 1 + + airoha,base_smi_address: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + Configure and change the base switch PHY address to a new address on + the bus. + On reset, the switch PHY address is ALWAYS 1. + default: 1 + maximum: 31 + + airoha,ext_surge: + $ref: /schemas/types.yaml#/definitions/flag + description: + Calibrate the internal PHY with the calibration values stored in EFUSE + for the r50Ohm values. + + '#nvmem-cell-cells': + const: 0 + + nvmem-layout: + $ref: /schemas/nvmem/layouts/nvmem-layout.yaml + description: + NVMEM Layout for exposed EFUSE. (for example to propagate calibration + value for r50Ohm for internal PHYs) + + mdio: + $ref: /schemas/net/mdio.yaml# + unevaluatedProperties: false + description: + Define the relative address of the internal PHY for each port. + + Each reg for the PHY is relative to the switch base PHY address. + +$ref: dsa.yaml# + +required: + - compatible + - reg + +unevaluatedProperties: false + +examples: + - | + #include + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + switch@1 { + compatible = "airoha,an8855"; + reg = <1>; + reset-gpios = <&pio 39 0>; + + airoha,ext_surge; + + #nvmem-cell-cells = <0>; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + shift_sel_port0_tx_a: shift-sel-port0-tx-a@c { + reg = <0xc 0x4>; + }; + + shift_sel_port0_tx_b: shift-sel-port0-tx-b@10 { + reg = <0x10 0x4>; + }; + + shift_sel_port0_tx_c: shift-sel-port0-tx-c@14 { + reg = <0x14 0x4>; + }; + + shift_sel_port0_tx_d: shift-sel-port0-tx-d@18 { + reg = <0x18 0x4>; + }; + + shift_sel_port1_tx_a: shift-sel-port1-tx-a@1c { + reg = <0x1c 0x4>; + }; + + shift_sel_port1_tx_b: shift-sel-port1-tx-b@20 { + reg = <0x20 0x4>; + }; + + shift_sel_port1_tx_c: shift-sel-port1-tx-c@24 { + reg = <0x24 0x4>; + }; + + shift_sel_port1_tx_d: shift-sel-port1-tx-d@28 { + reg = <0x28 0x4>; + }; + + shift_sel_port2_tx_a: shift-sel-port2-tx-a@2c { + reg = <0x2c 0x4>; + }; + + shift_sel_port2_tx_b: shift-sel-port2-tx-b@30 { + reg = <0x30 0x4>; + }; + + shift_sel_port2_tx_c: shift-sel-port2-tx-c@34 { + reg = <0x34 0x4>; + }; + + shift_sel_port2_tx_d: shift-sel-port2-tx-d@38 { + reg = <0x38 0x4>; + }; + + shift_sel_port3_tx_a: shift-sel-port3-tx-a@4c { + reg = <0x4c 0x4>; + }; + + shift_sel_port3_tx_b: shift-sel-port3-tx-b@50 { + reg = <0x50 0x4>; + }; + + shift_sel_port3_tx_c: shift-sel-port3-tx-c@54 { + reg = <0x54 0x4>; + }; + + shift_sel_port3_tx_d: shift-sel-port3-tx-d@58 { + reg = <0x58 0x4>; + }; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + phy-mode = "internal"; + phy-handle = <&internal_phy0>; + }; + + port@1 { + reg = <1>; + label = "lan2"; + phy-mode = "internal"; + phy-handle = <&internal_phy1>; + }; + + port@2 { + reg = <2>; + label = "lan3"; + phy-mode = "internal"; + phy-handle = <&internal_phy2>; + }; + + port@3 { + reg = <3>; + label = "lan4"; + phy-mode = "internal"; + phy-handle = <&internal_phy3>; + }; + + port@5 { + reg = <5>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + internal_phy0: phy@0 { + reg = <0>; + + nvmem-cells = <&shift_sel_port0_tx_a>, + <&shift_sel_port0_tx_b>, + <&shift_sel_port0_tx_c>, + <&shift_sel_port0_tx_d>; + nvmem-cell-names = "tx_a", "tx_b", "tx_c", "tx_d"; + }; + + internal_phy1: phy@1 { + reg = <1>; + + nvmem-cells = <&shift_sel_port1_tx_a>, + <&shift_sel_port1_tx_b>, + <&shift_sel_port1_tx_c>, + <&shift_sel_port1_tx_d>; + nvmem-cell-names = "tx_a", "tx_b", "tx_c", "tx_d"; + }; + + internal_phy2: phy@2 { + reg = <2>; + + nvmem-cells = <&shift_sel_port2_tx_a>, + <&shift_sel_port2_tx_b>, + <&shift_sel_port2_tx_c>, + <&shift_sel_port2_tx_d>; + nvmem-cell-names = "tx_a", "tx_b", "tx_c", "tx_d"; + }; + + internal_phy3: phy@3 { + reg = <3>; + + nvmem-cells = <&shift_sel_port3_tx_a>, + <&shift_sel_port3_tx_b>, + <&shift_sel_port3_tx_c>, + <&shift_sel_port3_tx_d>; + nvmem-cell-names = "tx_a", "tx_b", "tx_c", "tx_d"; + }; + }; + }; + };