From patchwork Wed Jan 6 21:32:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 12002339 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEED2C433E0 for ; Wed, 6 Jan 2021 21:33:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8D8E423124 for ; Wed, 6 Jan 2021 21:33:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726461AbhAFVcy (ORCPT ); Wed, 6 Jan 2021 16:32:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726064AbhAFVcx (ORCPT ); Wed, 6 Jan 2021 16:32:53 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5992DC061575; Wed, 6 Jan 2021 13:32:13 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id y19so9746516lfa.13; Wed, 06 Jan 2021 13:32:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=swjzxgNgdFwMaW1XS6NoCIl7n4hzVMa78pM5N63kujo=; b=d9nXQ7cwe0rN31o6hBKHcOHt6N+RlUdysFXNTAcH5jzZhb5vimJOjJ4ZqqWJiuoeo8 xIP49r4cl9lk0aBdfbeVKXM7jvilZu91vHf2U8+BHSu5eeXLHPV3e9mX9XjM2snaZGtB BKkBIzTC56fQRHN71n9Uf/Ierp3QVp9lsD70PVZcXyPB3yYjcxBfoFFjs6FNuU6Xt6EI 7rMMYcx+0ojhmCkt2zTjiVNy4axs+ofB/GTRdeHwOm1RJmEZOrxjyPIVVQ0NEWQeUlDn LCsYxp6W39W884RT+q4jfi0wblyvAWi+suOBHw65YNvo3VTyFcslTrCRwFQwUbXJh7v5 A5ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=swjzxgNgdFwMaW1XS6NoCIl7n4hzVMa78pM5N63kujo=; b=RKrD3529hAuw32nMqakfEEm9Hg/+3di1L9GWf9M2zT44ei886r4H7uH0JUeoAd40d+ +lehsv7oZ2W/NH0ZeEpSs7HWzB9hV5eALylJk7f8ghmAlZ7aJP0iWrnvWEk96gJG4owv /+OS5GAxb/O3UoM8w6dHXJXSpSBa5jLnlEV0VSuewQYyaD7+T3xBC+LlnR2l22EBWEaw ZFjVqWf1v3PAqs/11L2RQ9qPQM0Z9lx74hrKO4TUW1GunltqrhT5Qw7gao/29JKjcNfB GEkc3pC3kEhqTNIV5oVxtRCGl6PM8Cwvb7a1AcAlK7S8mScgS77M9Y2ZDLmV2tJH9lac sfsw== X-Gm-Message-State: AOAM531gayscnTItPi9GsPL0KY6995KqOA4I1Ny+ZcoyX2KjP5XH5Ge+ ybXf6UcA3AOSPkqjFOqLceI= X-Google-Smtp-Source: ABdhPJxEdUvb47WxwP6dptf6PJ+Rgo4TJm5/70lNY5xAsvTKwieFuDW0cwL5DcRd6p0HOoVKJR3xGg== X-Received: by 2002:a2e:92d6:: with SMTP id k22mr2645127ljh.219.1609968731773; Wed, 06 Jan 2021 13:32:11 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id d21sm623436lfe.19.2021.01.06.13.32.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jan 2021 13:32:11 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: "David S . Miller" , Jakub Kicinski , Rob Herring Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , netdev@vger.kernel.org, devicetree@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH V2 net-next 1/3] dt-bindings: net: convert Broadcom Starfighter 2 binding to the json-schema Date: Wed, 6 Jan 2021 22:32:00 +0100 Message-Id: <20210106213202.17459-1-zajec5@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Rafał Miłecki This helps validating DTS files. Only the current (not deprecated one) binding was converted. Minor changes: 1. Dropped dsa/dsa.txt references 2. Updated node name to match dsa.yaml requirement 3. Fixed 2 typos in examples The new binding was validated using the dt_binding_check. Signed-off-by: Rafał Miłecki --- V2: "compatible" based "clocks" and "clock-names" validation Include "clocks" and "clock-names" in the example NOTE: This patch purposefully doesn't add *global* "clocks" and "clock-names" requirement. It's to prepare YAML for the next patch that follows (the one adding "brcm,bcm4908-switch"). --- .../bindings/net/brcm,bcm7445-switch-v4.0.txt | 101 +--------- .../devicetree/bindings/net/dsa/brcm,sf2.yaml | 172 ++++++++++++++++++ 2 files changed, 175 insertions(+), 98 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml diff --git a/Documentation/devicetree/bindings/net/brcm,bcm7445-switch-v4.0.txt b/Documentation/devicetree/bindings/net/brcm,bcm7445-switch-v4.0.txt index 97ca62b0e14d..d0935d2afef8 100644 --- a/Documentation/devicetree/bindings/net/brcm,bcm7445-switch-v4.0.txt +++ b/Documentation/devicetree/bindings/net/brcm,bcm7445-switch-v4.0.txt @@ -1,108 +1,13 @@ * Broadcom Starfighter 2 integrated swich -Required properties: +See dsa/brcm,bcm7445-switch-v4.0.yaml for the documentation. -- compatible: should be one of - "brcm,bcm7445-switch-v4.0" - "brcm,bcm7278-switch-v4.0" - "brcm,bcm7278-switch-v4.8" -- reg: addresses and length of the register sets for the device, must be 6 - pairs of register addresses and lengths -- interrupts: interrupts for the devices, must be two interrupts -- #address-cells: must be 1, see dsa/dsa.txt -- #size-cells: must be 0, see dsa/dsa.txt - -Deprecated binding required properties: +*Deprecated* binding required properties: - dsa,mii-bus: phandle to the MDIO bus controller, see dsa/dsa.txt - dsa,ethernet: phandle to the CPU network interface controller, see dsa/dsa.txt - #address-cells: must be 2, see dsa/dsa.txt -Subnodes: - -The integrated switch subnode should be specified according to the binding -described in dsa/dsa.txt. - -Optional properties: - -- reg-names: litteral names for the device base register addresses, when present - must be: "core", "reg", "intrl2_0", "intrl2_1", "fcb", "acb" - -- interrupt-names: litternal names for the device interrupt lines, when present - must be: "switch_0" and "switch_1" - -- brcm,num-gphy: specify the maximum number of integrated gigabit PHYs in the - switch - -- brcm,num-rgmii-ports: specify the maximum number of RGMII interfaces supported - by the switch - -- brcm,fcb-pause-override: boolean property, if present indicates that the switch - supports Failover Control Block pause override capability - -- brcm,acb-packets-inflight: boolean property, if present indicates that the switch - Admission Control Block supports reporting the number of packets in-flight in a - switch queue - -- resets: a single phandle and reset identifier pair. See - Documentation/devicetree/bindings/reset/reset.txt for details. - -- reset-names: If the "reset" property is specified, this property should have - the value "switch" to denote the switch reset line. - -- clocks: when provided, the first phandle is to the switch's main clock and - is valid for both BCM7445 and BCM7278. The second phandle is only applicable - to BCM7445 and is to support dividing the switch core clock. - -- clock-names: when provided, the first phandle must be "sw_switch", and the - second must be named "sw_switch_mdiv". - -Port subnodes: - -Optional properties: - -- brcm,use-bcm-hdr: boolean property, if present, indicates that the switch - port has Broadcom tags enabled (per-packet metadata) - -Example: - -switch_top@f0b00000 { - compatible = "simple-bus"; - #size-cells = <1>; - #address-cells = <1>; - ranges = <0 0xf0b00000 0x40804>; - - ethernet_switch@0 { - compatible = "brcm,bcm7445-switch-v4.0"; - #size-cells = <0>; - #address-cells = <1>; - reg = <0x0 0x40000 - 0x40000 0x110 - 0x40340 0x30 - 0x40380 0x30 - 0x40400 0x34 - 0x40600 0x208>; - reg-names = "core", "reg", intrl2_0", "intrl2_1", - "fcb, "acb"; - interrupts = <0 0x18 0 - 0 0x19 0>; - brcm,num-gphy = <1>; - brcm,num-rgmii-ports = <2>; - brcm,fcb-pause-override; - brcm,acb-packets-inflight; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - label = "gphy"; - reg = <0>; - }; - }; - }; -}; - Example using the old DSA DeviceTree binding: switch_top@f0b00000 { @@ -132,7 +37,7 @@ switch_top@f0b00000 { switch@0 { reg = <0 0>; #size-cells = <0>; - #address-cells <1>; + #address-cells = <1>; port@0 { label = "gphy"; diff --git a/Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml b/Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml new file mode 100644 index 000000000000..9de69243cf79 --- /dev/null +++ b/Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml @@ -0,0 +1,172 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/dsa/brcm,sf2.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Broadcom Starfighter 2 integrated swich + +maintainers: + - Florian Fainelli + +properties: + compatible: + items: + - enum: + - brcm,bcm7278-switch-v4.0 + - brcm,bcm7278-switch-v4.8 + - brcm,bcm7445-switch-v4.0 + + reg: + minItems: 6 + maxItems: 6 + + reg-names: + items: + - const: core + - const: reg + - const: intrl2_0 + - const: intrl2_1 + - const: fcb + - const: acb + + interrupts: + minItems: 2 + maxItems: 2 + + interrupt-names: + items: + - const: switch_0 + - const: switch_1 + + resets: + maxItems: 1 + + reset-names: + const: switch + + clocks: + minItems: 1 + maxItems: 2 + items: + - description: switch's main clock + - description: dividing of the switch core clock + + clock-names: + minItems: 1 + maxItems: 2 + items: + - const: sw_switch + - const: sw_switch_mdiv + + brcm,num-gphy: + $ref: /schemas/types.yaml#/definitions/uint32 + description: maximum number of integrated gigabit PHYs in the switch + + brcm,num-rgmii-ports: + $ref: /schemas/types.yaml#/definitions/uint32 + description: maximum number of RGMII interfaces supported by the switch + + brcm,fcb-pause-override: + description: if present indicates that the switch supports Failover Control + Block pause override capability + type: boolean + + brcm,acb-packets-inflight: + description: if present indicates that the switch Admission Control Block + supports reporting the number of packets in-flight in a switch queue + type: boolean + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + ports: + type: object + + properties: + brcm,use-bcm-hdr: + description: if present, indicates that the switch port has Broadcom + tags enabled (per-packet metadata) + type: boolean + +required: + - reg + - interrupts + - "#address-cells" + - "#size-cells" + +allOf: + - $ref: "dsa.yaml#" + - if: + properties: + compatible: + contains: + enum: + - brcm,bcm7278-switch-v4.0 + - brcm,bcm7278-switch-v4.8 + then: + properties: + clocks: + minItems: 1 + maxItems: 1 + clock-names: + minItems: 1 + maxItems: 1 + required: + - clocks + - clock-names + - if: + properties: + compatible: + contains: + const: brcm,bcm7445-switch-v4.0 + then: + properties: + clocks: + minItems: 2 + maxItems: 2 + clock-names: + minItems: 2 + maxItems: 2 + required: + - clocks + - clock-names + +additionalProperties: false + +examples: + - | + switch@f0b00000 { + compatible = "brcm,bcm7445-switch-v4.0"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xf0b00000 0x40000>, + <0xf0b40000 0x110>, + <0xf0b40340 0x30>, + <0xf0b40380 0x30>, + <0xf0b40400 0x34>, + <0xf0b40600 0x208>; + reg-names = "core", "reg", "intrl2_0", "intrl2_1", + "fcb", "acb"; + interrupts = <0 0x18 0>, + <0 0x19 0>; + clocks = <&sw_switch>, <&sw_switch_mdiv>; + clock-names = "sw_switch", "sw_switch_mdiv"; + brcm,num-gphy = <1>; + brcm,num-rgmii-ports = <2>; + brcm,fcb-pause-override; + brcm,acb-packets-inflight; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + label = "gphy"; + reg = <0>; + }; + }; + }; From patchwork Wed Jan 6 21:32:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 12002343 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDB90C433E6 for ; Wed, 6 Jan 2021 21:33:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA9162313B for ; Wed, 6 Jan 2021 21:33:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726509AbhAFVc4 (ORCPT ); Wed, 6 Jan 2021 16:32:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726064AbhAFVcz (ORCPT ); Wed, 6 Jan 2021 16:32:55 -0500 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC320C061757; Wed, 6 Jan 2021 13:32:14 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id h22so9951183lfu.2; Wed, 06 Jan 2021 13:32:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DxQVW7PQ5S5o2lJGdzNoJm9D05fMsgmKVvz50QNBlkw=; b=CHVZOkWyRWRjOVhGD9hMNYvPgdv5m5DgzDop9/oN0+B5p6RzvXeJiv3zBUdhRbUBF9 JrS+KrcmSaRQUU0JVB9q5fgXeUdT3CCi6Srh1bXismuotPoOV0xr8/wCm62nRC5Et9I6 hzzjfkuruekBBn8hBLXOy60ovryzHLuxV9pWTkr4lYZ6PWBYOTtp/oSx7MSeOe329KrC t1xtq649vxeCCwF/C8RksCV9U4MWZxwYeFPdlrkHGH+RvL2xNImIqWxNNXmA+OAMc/fl 64tMFLGhxOlsk7FPlAAmowkzkdUcnnOFaZ3fFbR51q/z1u7jrfR+OcdhR7WdW2/KnYGb 1Nnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DxQVW7PQ5S5o2lJGdzNoJm9D05fMsgmKVvz50QNBlkw=; b=F+TKWxrMdLqGbMoHE+OgR/7zm9oyUq751M7FJMrWfg7O/yCKjAX5f5UgjYXaaoxn33 mBpVa9611VQfyOjL314uRnnAsxOnAzbxt6jis+LhRO7BDv9h6xZQUQm5PbA8+t3vQfdp vxkVAIdBL21gOjMF3mFWv41nHvpcXpQmPCLr5hLSmTo9BDJ/6lJFR3fV7wwavThY7CP3 7+HAMahO0UxjXEbZdYNyIwaKlwsQzbFDNnetQaJ0K8LxL11FcVKXIKMC+37C33ZucN3v 5twOh2S+TkEX6RF75/S8TBpD9eP5FWo2OATy7miOOSuduWsY+kcuIbEf09zA1WHd6lyl NCaw== X-Gm-Message-State: AOAM533kK1VN7KqGaTHwLD7j+AOwPla4edSFOGjYS1IjxAni7Cv2/GYL vea/ePVX1WxrIiWrwXDnkho= X-Google-Smtp-Source: ABdhPJzqpQCfBfMWHjLSEHXOWjxaefdAjPyeXKqK8cqZjSj4pXrWfofAE7WarEFgZQ9B//szBXMvOQ== X-Received: by 2002:ac2:4886:: with SMTP id x6mr2544764lfc.76.1609968733482; Wed, 06 Jan 2021 13:32:13 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id d21sm623436lfe.19.2021.01.06.13.32.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jan 2021 13:32:12 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: "David S . Miller" , Jakub Kicinski , Rob Herring Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , netdev@vger.kernel.org, devicetree@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH V2 net-next 2/3] dt-bindings: net: dsa: sf2: add BCM4908 switch binding Date: Wed, 6 Jan 2021 22:32:01 +0100 Message-Id: <20210106213202.17459-2-zajec5@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210106213202.17459-1-zajec5@gmail.com> References: <20210106213202.17459-1-zajec5@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Rafał Miłecki BCM4908 family SoCs have integrated Starfighter 2 switch. Signed-off-by: Rafał Miłecki Acked-by: Florian Fainelli --- Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml b/Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml index 9de69243cf79..d730fe5a4355 100644 --- a/Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml +++ b/Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml @@ -13,6 +13,7 @@ properties: compatible: items: - enum: + - brcm,bcm4908-switch - brcm,bcm7278-switch-v4.0 - brcm,bcm7278-switch-v4.8 - brcm,bcm7445-switch-v4.0 From patchwork Wed Jan 6 21:32:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 12002341 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F04E5C433E9 for ; Wed, 6 Jan 2021 21:33:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D56BC23124 for ; Wed, 6 Jan 2021 21:33:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726660AbhAFVc6 (ORCPT ); Wed, 6 Jan 2021 16:32:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726590AbhAFVc5 (ORCPT ); Wed, 6 Jan 2021 16:32:57 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28E9AC061786; Wed, 6 Jan 2021 13:32:17 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id a12so9877296lfl.6; Wed, 06 Jan 2021 13:32:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cUyPtv9RelnVLv7TBLtDBEn/rAq48kBEL0GnWIKlkM4=; b=Megf+SofWs4/3tHyDAJ7NaGU5pf2BZHWocacvgOyzvG6nc+fCBMPDm6iHXAUGuxJIg JoOWZfzmSdLd9pjzyp2UeHb2F0tlvOtB5V1N54Bgd9FlxUILzIzPLH1pTBvE1u+ptR1D F5+2p2RnBjTvvMnNUQjfgmoG1ygGrroMrHznuKEK373173XtDrIF0IRjMnFF7kltaPK7 JRCCPDM67guO/ioxfK0J/xqHLH8IsmuxLN6MdyK9Wq03f9Jp9+Tl2AZhI+TNQCEiEG3X +12EEh4o0ieJ6K96+yoWWXqYumtUF+PW/bCSlt4MXr4sXM2yfan5qRWXUbUp66P5U43X B52w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cUyPtv9RelnVLv7TBLtDBEn/rAq48kBEL0GnWIKlkM4=; b=g2+MLvKtiLL0/KYaG+VxzRBD0JtHZEFiQ1l3Z9XXLy3R8i1622MWbUFEhd/rQVBUMN 6zCW4jFewAdyMdCh+qO50va85OKH9Uf7lDe/andJRhXccBnLE79f1H8o0cSzagUcS7bM 4hz+4z977L7iEVutscm6DGqayXkihSYGUPQqAjNvBTVWrC6wu1paj7GLPK9QVuwry8JN cnXNOG7MSn6icj2ufiYbmkOmYKBohSk84AtMf04jGq8c1u7Yw2OcsbGvCit1s3Jr5MA0 1XXlLrFQ+3LIx+ThiRqrQTop67nN+K+/si71arxaKfR52Yzi2arOUBvfZzCJlz+S3MQc BZYw== X-Gm-Message-State: AOAM531TC2yejA82qsJgi3LUWXU8Mww8Qyc/qQWSeX0QUkFW0jX8WIhR lJtx8UGDct9k7Y2l8dhFOdA= X-Google-Smtp-Source: ABdhPJzjo37PGpbqgtYNq6mH1pj7ag/MAMONTjPW7dZdUW1/IwQpo+BuXGlJleLDg7/vmPU2HInUog== X-Received: by 2002:a2e:8714:: with SMTP id m20mr2603362lji.320.1609968735694; Wed, 06 Jan 2021 13:32:15 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id d21sm623436lfe.19.2021.01.06.13.32.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jan 2021 13:32:15 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: "David S . Miller" , Jakub Kicinski , Rob Herring Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , netdev@vger.kernel.org, devicetree@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH V2 net-next 3/3] net: dsa: bcm_sf2: support BCM4908's integrated switch Date: Wed, 6 Jan 2021 22:32:02 +0100 Message-Id: <20210106213202.17459-3-zajec5@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210106213202.17459-1-zajec5@gmail.com> References: <20210106213202.17459-1-zajec5@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Rafał Miłecki BCM4908 family SoCs come with integrated Starfighter 2 switch. Its registers layout it a mix of BCM7278 and BCM7445. It has 5 integrated PHYs and 8 ports. It also supports RGMII and SerDes. Signed-off-by: Rafał Miłecki Acked-by: Florian Fainelli --- drivers/net/dsa/b53/b53_common.c | 14 +++++++++++++ drivers/net/dsa/b53/b53_priv.h | 1 + drivers/net/dsa/bcm_sf2.c | 36 +++++++++++++++++++++++++++++--- drivers/net/dsa/bcm_sf2_regs.h | 1 + 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c index 288b5a5c3e0d..85dddd87bcfc 100644 --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c @@ -2459,6 +2459,20 @@ static const struct b53_chip_data b53_switch_chips[] = { .jumbo_pm_reg = B53_JUMBO_PORT_MASK, .jumbo_size_reg = B53_JUMBO_MAX_SIZE, }, + /* Starfighter 2 */ + { + .chip_id = BCM4908_DEVICE_ID, + .dev_name = "BCM4908", + .vlans = 4096, + .enabled_ports = 0x1bf, + .arl_bins = 4, + .arl_buckets = 256, + .cpu_port = 8, /* TODO: ports 4, 5, 8 */ + .vta_regs = B53_VTA_REGS, + .duplex_reg = B53_DUPLEX_STAT_GE, + .jumbo_pm_reg = B53_JUMBO_PORT_MASK, + .jumbo_size_reg = B53_JUMBO_MAX_SIZE, + }, { .chip_id = BCM7445_DEVICE_ID, .dev_name = "BCM7445", diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h index 7c67409bb186..6d0c724763c7 100644 --- a/drivers/net/dsa/b53/b53_priv.h +++ b/drivers/net/dsa/b53/b53_priv.h @@ -64,6 +64,7 @@ struct b53_io_ops { #define B53_INVALID_LANE 0xff enum { + BCM4908_DEVICE_ID = 0x4908, BCM5325_DEVICE_ID = 0x25, BCM5365_DEVICE_ID = 0x65, BCM5389_DEVICE_ID = 0x89, diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index 1e9a0adda2d6..65c8a044f222 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -105,7 +105,8 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port) b53_brcm_hdr_setup(ds, port); if (port == 8) { - if (priv->type == BCM7445_DEVICE_ID) + if (priv->type == BCM4908_DEVICE_ID || + priv->type == BCM7445_DEVICE_ID) offset = CORE_STS_OVERRIDE_IMP; else offset = CORE_STS_OVERRIDE_IMP2; @@ -715,7 +716,8 @@ static void bcm_sf2_sw_mac_link_down(struct dsa_switch *ds, int port, u32 reg, offset; if (port != core_readl(priv, CORE_IMP0_PRT_ID)) { - if (priv->type == BCM7445_DEVICE_ID) + if (priv->type == BCM4908_DEVICE_ID || + priv->type == BCM7445_DEVICE_ID) offset = CORE_STS_OVERRIDE_GMIIP_PORT(port); else offset = CORE_STS_OVERRIDE_GMIIP2_PORT(port); @@ -742,7 +744,8 @@ static void bcm_sf2_sw_mac_link_up(struct dsa_switch *ds, int port, bcm_sf2_sw_mac_link_set(ds, port, interface, true); if (port != core_readl(priv, CORE_IMP0_PRT_ID)) { - if (priv->type == BCM7445_DEVICE_ID) + if (priv->type == BCM4908_DEVICE_ID || + priv->type == BCM7445_DEVICE_ID) offset = CORE_STS_OVERRIDE_GMIIP_PORT(port); else offset = CORE_STS_OVERRIDE_GMIIP2_PORT(port); @@ -1135,6 +1138,30 @@ struct bcm_sf2_of_data { unsigned int num_cfp_rules; }; +static const u16 bcm_sf2_4908_reg_offsets[] = { + [REG_SWITCH_CNTRL] = 0x00, + [REG_SWITCH_STATUS] = 0x04, + [REG_DIR_DATA_WRITE] = 0x08, + [REG_DIR_DATA_READ] = 0x0c, + [REG_SWITCH_REVISION] = 0x10, + [REG_PHY_REVISION] = 0x14, + [REG_SPHY_CNTRL] = 0x24, + [REG_CROSSBAR] = 0xc8, + [REG_RGMII_0_CNTRL] = 0xe0, + [REG_RGMII_1_CNTRL] = 0xec, + [REG_RGMII_2_CNTRL] = 0xf8, + [REG_LED_0_CNTRL] = 0x40, + [REG_LED_1_CNTRL] = 0x4c, + [REG_LED_2_CNTRL] = 0x58, +}; + +static const struct bcm_sf2_of_data bcm_sf2_4908_data = { + .type = BCM4908_DEVICE_ID, + .core_reg_align = 0, + .reg_offsets = bcm_sf2_4908_reg_offsets, + .num_cfp_rules = 0, /* FIXME */ +}; + /* Register offsets for the SWITCH_REG_* block */ static const u16 bcm_sf2_7445_reg_offsets[] = { [REG_SWITCH_CNTRL] = 0x00, @@ -1183,6 +1210,9 @@ static const struct bcm_sf2_of_data bcm_sf2_7278_data = { }; static const struct of_device_id bcm_sf2_of_match[] = { + { .compatible = "brcm,bcm4908-switch", + .data = &bcm_sf2_4908_data + }, { .compatible = "brcm,bcm7445-switch-v4.0", .data = &bcm_sf2_7445_data }, diff --git a/drivers/net/dsa/bcm_sf2_regs.h b/drivers/net/dsa/bcm_sf2_regs.h index d8a5e6269c0e..1d2d55c9f8aa 100644 --- a/drivers/net/dsa/bcm_sf2_regs.h +++ b/drivers/net/dsa/bcm_sf2_regs.h @@ -17,6 +17,7 @@ enum bcm_sf2_reg_offs { REG_SWITCH_REVISION, REG_PHY_REVISION, REG_SPHY_CNTRL, + REG_CROSSBAR, REG_RGMII_0_CNTRL, REG_RGMII_1_CNTRL, REG_RGMII_2_CNTRL,