From patchwork Fri Sep 2 10:16:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 12963999 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACAA8C38145 for ; Fri, 2 Sep 2022 10:16:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235291AbiIBKQW (ORCPT ); Fri, 2 Sep 2022 06:16:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232776AbiIBKQU (ORCPT ); Fri, 2 Sep 2022 06:16:20 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 195027F245 for ; Fri, 2 Sep 2022 03:16:17 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id k6-20020a05600c1c8600b003a54ecc62f6so1111478wms.5 for ; Fri, 02 Sep 2022 03:16:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=q69HqvdgQSKnmUI1UJMlA92uPSmPm3an+A2rTR/K01s=; b=NgckYZri6r+0q8l/qxMmZSK8lZIBzKr3J0P7UjVAir63jqITM8ZxbYadAWM5PLFeN3 WdJPUyaB9F1sUn/1meogWn8etCt4DD75beDAYrXZIB0WWO41noWntgi6zMHw08/kXeOl X666evp+CGF25WJE9/+PAZtB7zVljhhF5u6c8BKB5E/11pR9e7TXtNIaitskmH1aNGvm dDQskCEZ1QSgvC/TD+iLy89nUM0Xqhgf9enytpLqBYrT1fJfsvZCuSY5sybZdap6l+PT sj99GDtFJvqugQhqOA7S1o6rE0hV9TY+kyGH/EDP60cAEMLizc1BFu5VgA3mfvE4xsKX RyEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=q69HqvdgQSKnmUI1UJMlA92uPSmPm3an+A2rTR/K01s=; b=Eps3qRoERwf7acYIgtM+kVvKIh1HWCE2cQz1rgewjD+HgvVFB0zmR23l4KkIeOuxUb FJ5V1v8C7ImAQjrZd/iEo0Fun9bthJYwxVq3W44xub+lADQZti6EhXziv79I0HT4LeVS 3l0WxeiUaOZ8Se0bfUbxf/zwOkZ18dWSh1ZetNxhenhXqUjXnOBTBj3+nH6jPhZdRVDK ewejZsrKPo0UVgFi9ctePIBnHxQZkTgnkI8OUx7Dx0/fvZpGPegMUD2rSo87LUB9d0rD KwjAXjNLWVP99ME+2zwc8yskaLZzVYwyR93fRVYzkcSgoK61NfrzsElUBfXvOaKk0E9Y pkRg== X-Gm-Message-State: ACgBeo1KpvEuoVvbi3JlgOUZCY6202g8zM4aHEi1l3JVRj14BTrY2Rzh q4PR66zRlUBvNyrOr6dmUB1UiKykNGn5QQ== X-Google-Smtp-Source: AA6agR5sH7d3VJgf/TGFgTjPpImoVKlkt6FPpOHAfQWBeO1eCF+0QCsOyMKt87sxwfCZ2Ulkbol8cA== X-Received: by 2002:a05:600c:4e8c:b0:3a6:11e:cc08 with SMTP id f12-20020a05600c4e8c00b003a6011ecc08mr2287971wmq.198.1662113775414; Fri, 02 Sep 2022 03:16:15 -0700 (PDT) Received: from P-NTS-Evian.home (2a01cb058f8a18001c97b8d1b477d53f.ipv6.abo.wanadoo.fr. [2a01:cb05:8f8a:1800:1c97:b8d1:b477:d53f]) by smtp.gmail.com with ESMTPSA id a8-20020adfeec8000000b00226d1821abesm1140913wrp.56.2022.09.02.03.16.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 03:16:14 -0700 (PDT) From: Romain Naour To: netdev@vger.kernel.org Cc: pabeni@redhat.com, kuba@kernel.org, edumazet@google.com, davem@davemloft.net, olteanv@gmail.com, f.fainelli@gmail.com, vivien.didelot@gmail.com, andrew@lunn.ch, UNGLinuxDriver@microchip.com, woojung.huh@microchip.com, Romain Naour Subject: [PATCH v3: net-next 1/4] net: dsa: microchip: add KSZ9896 switch support Date: Fri, 2 Sep 2022 12:16:07 +0200 Message-Id: <20220902101610.109646-1-romain.naour@smile.fr> X-Mailer: git-send-email 2.34.3 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Romain Naour Add support for the KSZ9896 6-port Gigabit Ethernet Switch to the ksz9477 driver. Although the KSZ9896 is already listed in the device tree binding documentation since a1c0ed24fe9b (dt-bindings: net: dsa: document additional Microchip KSZ9477 family switches) the chip id (0x00989600) is not recognized by ksz_switch_detect() and rejected by the driver. The KSZ9896 is similar to KSZ9897 but has only one configurable MII/RMII/RGMII/GMII cpu port. Signed-off-by: Romain Naour --- It seems that the KSZ9896 support has been sent to the kernel netdev mailing list a while ago but no further patch was sent after the initial review: https://www.spinics.net/lists/netdev/msg554771.html The initial testing with the ksz9896 was done on a 5.10 kernel but due to recent changes in dsa microchip driver it was required to rework this initial version for 6.0-rc2 kernel and development tree net-next for the upcoming 6.1 kernel. v3: rebase onto net-next kernel tree Add gbit_capable setting for per-port Gbit detection v2: remove duplicated SoB line --- drivers/net/dsa/microchip/ksz_common.c | 31 ++++++++++++++++++++++++++ drivers/net/dsa/microchip/ksz_common.h | 2 ++ drivers/net/dsa/microchip/ksz_spi.c | 6 +++++ 3 files changed, 39 insertions(+) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index 37fb5ba2cd7a..02fb721c1090 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -965,6 +965,35 @@ const struct ksz_chip_data ksz_switch_chips[] = { .rd_table = &ksz9477_register_set, }, + [KSZ9896] = { + .chip_id = KSZ9896_CHIP_ID, + .dev_name = "KSZ9896", + .num_vlans = 4096, + .num_alus = 4096, + .num_statics = 16, + .cpu_ports = 0x3F, /* can be configured as cpu port */ + .port_cnt = 6, /* total physical port count */ + .ops = &ksz9477_dev_ops, + .phy_errata_9477 = true, + .mib_names = ksz9477_mib_names, + .mib_cnt = ARRAY_SIZE(ksz9477_mib_names), + .reg_mib_cnt = MIB_COUNTER_NUM, + .regs = ksz9477_regs, + .masks = ksz9477_masks, + .shifts = ksz9477_shifts, + .xmii_ctrl0 = ksz9477_xmii_ctrl0, + .xmii_ctrl1 = ksz9477_xmii_ctrl1, + .supports_mii = {false, false, false, false, + false, true}, + .supports_rmii = {false, false, false, false, + false, true}, + .supports_rgmii = {false, false, false, false, + false, true}, + .internal_phy = {true, true, true, true, + true, false}, + .gbit_capable = {true, true, true, true, true, true}, + }, + [KSZ9897] = { .chip_id = KSZ9897_CHIP_ID, .dev_name = "KSZ9897", @@ -1798,6 +1827,7 @@ static enum dsa_tag_protocol ksz_get_tag_protocol(struct dsa_switch *ds, proto = DSA_TAG_PROTO_KSZ9893; if (dev->chip_id == KSZ9477_CHIP_ID || + dev->chip_id == KSZ9896_CHIP_ID || dev->chip_id == KSZ9897_CHIP_ID || dev->chip_id == KSZ9567_CHIP_ID) proto = DSA_TAG_PROTO_KSZ9477; @@ -2159,6 +2189,7 @@ static int ksz_switch_detect(struct ksz_device *dev) switch (id32) { case KSZ9477_CHIP_ID: + case KSZ9896_CHIP_ID: case KSZ9897_CHIP_ID: case KSZ9567_CHIP_ID: case LAN9370_CHIP_ID: diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h index c01989c04d4e..6efd2cdbd0bb 100644 --- a/drivers/net/dsa/microchip/ksz_common.h +++ b/drivers/net/dsa/microchip/ksz_common.h @@ -130,6 +130,7 @@ enum ksz_model { KSZ8765, KSZ8830, KSZ9477, + KSZ9896, KSZ9897, KSZ9893, KSZ9567, @@ -147,6 +148,7 @@ enum ksz_chip_id { KSZ8765_CHIP_ID = 0x8765, KSZ8830_CHIP_ID = 0x8830, KSZ9477_CHIP_ID = 0x00947700, + KSZ9896_CHIP_ID = 0x00989600, KSZ9897_CHIP_ID = 0x00989700, KSZ9893_CHIP_ID = 0x00989300, KSZ9567_CHIP_ID = 0x00956700, diff --git a/drivers/net/dsa/microchip/ksz_spi.c b/drivers/net/dsa/microchip/ksz_spi.c index 44c2d9912406..bf7cb269118c 100644 --- a/drivers/net/dsa/microchip/ksz_spi.c +++ b/drivers/net/dsa/microchip/ksz_spi.c @@ -149,6 +149,10 @@ static const struct of_device_id ksz_dt_ids[] = { .compatible = "microchip,ksz9477", .data = &ksz_switch_chips[KSZ9477] }, + { + .compatible = "microchip,ksz9896", + .data = &ksz_switch_chips[KSZ9896] + }, { .compatible = "microchip,ksz9897", .data = &ksz_switch_chips[KSZ9897] @@ -200,6 +204,7 @@ static const struct spi_device_id ksz_spi_ids[] = { { "ksz8863" }, { "ksz8873" }, { "ksz9477" }, + { "ksz9896" }, { "ksz9897" }, { "ksz9893" }, { "ksz9563" }, @@ -229,6 +234,7 @@ static struct spi_driver ksz_spi_driver = { module_spi_driver(ksz_spi_driver); MODULE_ALIAS("spi:ksz9477"); +MODULE_ALIAS("spi:ksz9896"); MODULE_ALIAS("spi:ksz9897"); MODULE_ALIAS("spi:ksz9893"); MODULE_ALIAS("spi:ksz9563"); From patchwork Fri Sep 2 10:16:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 12964002 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FD76ECAAD5 for ; Fri, 2 Sep 2022 10:16:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235451AbiIBKQ1 (ORCPT ); Fri, 2 Sep 2022 06:16:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234836AbiIBKQU (ORCPT ); Fri, 2 Sep 2022 06:16:20 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DD208D3C9 for ; Fri, 2 Sep 2022 03:16:18 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id c131-20020a1c3589000000b003a84b160addso2349238wma.2 for ; Fri, 02 Sep 2022 03:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=Ppu2J88Gu1tHZo2MKLB/WRd5bJ+n6xSgR4rAOhTLsnA=; b=O93nkjE1jSw70oex0M0lRin5uM4AI7lLibEJgdvgM96cMrlfuj7yYFpX3HsowBPMKH 9PtSMhq6X6gAoEQdCAykN0cc1geOS7y8KkTgUy2Q+F6J4odf2Gk8EVL0jRq0nqVcsq0N PbilKtog6qI51cqomFMVRPSkKOCGRwQxYSYdIjvc9lk5GYwE2EGz+fuYsGNVh7n28cPc F1Il/79HAUBccDc2ukZnwM04WlO6GHxAhcDhYVge6a9naH35ogkJ5FoARmFKPSddFFmQ WSzk03AjwSBVSP8CkmhqKn2WTHK8Dd1M/5xhXcndpOEKmdIwC8B2zmXJXHf1Wyidka72 xsbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=Ppu2J88Gu1tHZo2MKLB/WRd5bJ+n6xSgR4rAOhTLsnA=; b=ibuvs0J7x/UpBbbxNO5IQIawRaFInQ6cr23/lDWdCp4na/55vrgnM9lYg0iGd7Ujxn vfWlTFrhXNOu2lvKngro0QOAdgLxyxmnan4hwWvFAhHGtFvu9ee1qA4J+i709dBqsXCA lQr7KKt0PcxR/oViL+KNCSKAptJ792BrjHr+PELkGjNTLgJB25kzIBdp5ARzoUTD40Rd ngleOHKsrswIDG4h7pZlglUn7X5Tr4oJJEOL0nBNWKJc+UqcCgWk4kw9RoKW7Hz88RU5 2sOIPQ2XZDdXTTdlic6gACBh+Pg5zpAkVP4Ycx4UqqdfpArAT1MBziKr6AsQ4+qPjsBg i8aQ== X-Gm-Message-State: ACgBeo35icR+DDd5A/zbfQDg7a3CKuf8szW4vcZeBU1RMqOT2f2TyefX Wfzvw94suIKdd4CKxG3sfP88He5/1x+ddw== X-Google-Smtp-Source: AA6agR5kxtkQ08cWtZrB+Hu9P0Zs9Gi+OnLVHsinnbSdXOQ62jUKfN/QX99G9/CWCN7L1c24bjd2ig== X-Received: by 2002:a05:600c:1c95:b0:3a5:c28a:df3e with SMTP id k21-20020a05600c1c9500b003a5c28adf3emr2355285wms.40.1662113776331; Fri, 02 Sep 2022 03:16:16 -0700 (PDT) Received: from P-NTS-Evian.home (2a01cb058f8a18001c97b8d1b477d53f.ipv6.abo.wanadoo.fr. [2a01:cb05:8f8a:1800:1c97:b8d1:b477:d53f]) by smtp.gmail.com with ESMTPSA id a8-20020adfeec8000000b00226d1821abesm1140913wrp.56.2022.09.02.03.16.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 03:16:15 -0700 (PDT) From: Romain Naour To: netdev@vger.kernel.org Cc: pabeni@redhat.com, kuba@kernel.org, edumazet@google.com, davem@davemloft.net, olteanv@gmail.com, f.fainelli@gmail.com, vivien.didelot@gmail.com, andrew@lunn.ch, UNGLinuxDriver@microchip.com, woojung.huh@microchip.com, Romain Naour Subject: [PATCH v3: net-next 2/4] net: dsa: microchip: add KSZ9896 to KSZ9477 I2C driver Date: Fri, 2 Sep 2022 12:16:08 +0200 Message-Id: <20220902101610.109646-2-romain.naour@smile.fr> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20220902101610.109646-1-romain.naour@smile.fr> References: <20220902101610.109646-1-romain.naour@smile.fr> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Romain Naour Add support for the KSZ9896 6-port Gigabit Ethernet Switch to the ksz9477 driver. The KSZ9896 supports both SPI (already in) and I2C. Signed-off-by: Romain Naour --- The KSZ9896 support i2c interface, it seems safe to enable as is but runtime testing is really needed (my KSZ9896 is wired with spi). v2: remove duplicated SoB line --- drivers/net/dsa/microchip/ksz9477_i2c.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/dsa/microchip/ksz9477_i2c.c b/drivers/net/dsa/microchip/ksz9477_i2c.c index 99966514d444..8fbc122e3384 100644 --- a/drivers/net/dsa/microchip/ksz9477_i2c.c +++ b/drivers/net/dsa/microchip/ksz9477_i2c.c @@ -91,6 +91,10 @@ static const struct of_device_id ksz9477_dt_ids[] = { .compatible = "microchip,ksz9477", .data = &ksz_switch_chips[KSZ9477] }, + { + .compatible = "microchip,ksz9896", + .data = &ksz_switch_chips[KSZ9896] + }, { .compatible = "microchip,ksz9897", .data = &ksz_switch_chips[KSZ9897] From patchwork Fri Sep 2 10:16:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 12964001 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD9C6C54EE9 for ; Fri, 2 Sep 2022 10:16:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235369AbiIBKQZ (ORCPT ); Fri, 2 Sep 2022 06:16:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231344AbiIBKQU (ORCPT ); Fri, 2 Sep 2022 06:16:20 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F05309F8EA for ; Fri, 2 Sep 2022 03:16:18 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id az24-20020a05600c601800b003a842e4983cso1151003wmb.0 for ; Fri, 02 Sep 2022 03:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=rr5tzsHQc3yLS16O/BYAtf4/ZFucy1qvPc1kp4CmIlU=; b=oeWU+dXxsvUkkT0FKo7qyPeq8TWbpyAmn2qQDrRGtoY64WkTQYWnwZKsuMk5r5rJbx F4uXQMbaz5nAZzvN3YRcuO0u4GV5BUas2+iOseifSTJjchhtKQk+CcdIBtqVi6zvFE97 2YRuGZfZ/2cGsnRdzvf76F4VijNwdHdD+MiLw1CM8k4LLhdhg+KiUdlWekUfTStO/i9L qejhosM9Nd15UXYhlmEHMBcXVonzZ9Ker/vt5J8Skp47vRAkvd1guA5L5jhrv0yJJQk3 zEF9eCEmN10Uga3bfyM88FduaEyXJGbtsklKfwftCF6ViRIN2AS5Gc8IXXKLudBhC1E+ VirQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=rr5tzsHQc3yLS16O/BYAtf4/ZFucy1qvPc1kp4CmIlU=; b=f/OqbEeSKU6nx4z2RmpEPYKQaPzzDOgZn4+lQYvedmKuLmXBYIJbky6hU/5fuAlwqG ODs4h9xTMztu/KkgVVlHioG+pYNm3M1xMH+PNQDl9QD0hgeO7Awr/Ev7KzvjOQ46/H+r eQXOIc2QtctFx1CPlgoqKOzgPMvlOGur3mXAU244BQn9NuPx4nQqgmsdYrPYM++DgD2O hCYfByPYIXKTuWQ77760RadU4JUag/fsig6mbO6AxPLSRtupj4XHjs96vOvEQQTvE/qJ rfCAQv+TtfWNQKlE94A6s5zn6rfsY3zdE8/txntuKNb0UZj13w9c6nOB5O1mERrzK9TW PSSA== X-Gm-Message-State: ACgBeo3fRvO3tL2SHRCzKTrYW2nVOqyXUXKJtRf3ycN0uTz/PkgL0W+1 OuTTPjWsyNnaaekmDWxwPz9FZKQuXpS7Bw== X-Google-Smtp-Source: AA6agR7bxsSfxiCMcdUIfCQSmvV8TjUg7HmC087vIouytECa4QBtLFhAVSfzEgDAtGfke1K6HaZumQ== X-Received: by 2002:a1c:e917:0:b0:3a6:85b2:e8d with SMTP id q23-20020a1ce917000000b003a685b20e8dmr2332591wmc.154.1662113777198; Fri, 02 Sep 2022 03:16:17 -0700 (PDT) Received: from P-NTS-Evian.home (2a01cb058f8a18001c97b8d1b477d53f.ipv6.abo.wanadoo.fr. [2a01:cb05:8f8a:1800:1c97:b8d1:b477:d53f]) by smtp.gmail.com with ESMTPSA id a8-20020adfeec8000000b00226d1821abesm1140913wrp.56.2022.09.02.03.16.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 03:16:16 -0700 (PDT) From: Romain Naour To: netdev@vger.kernel.org Cc: pabeni@redhat.com, kuba@kernel.org, edumazet@google.com, davem@davemloft.net, olteanv@gmail.com, f.fainelli@gmail.com, vivien.didelot@gmail.com, andrew@lunn.ch, UNGLinuxDriver@microchip.com, woojung.huh@microchip.com, Romain Naour , Oleksij Rempel Subject: [PATCH v3: net-next 3/4] net: dsa: microchip: ksz9477: remove 0x033C and 0x033D addresses from regmap_access_tables Date: Fri, 2 Sep 2022 12:16:09 +0200 Message-Id: <20220902101610.109646-3-romain.naour@smile.fr> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20220902101610.109646-1-romain.naour@smile.fr> References: <20220902101610.109646-1-romain.naour@smile.fr> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Romain Naour According to the KSZ9477S datasheet, there is no global register at 0x033C and 0x033D addresses. Signed-off-by: Romain Naour Cc: Oleksij Rempel Tested-by: Oleksij Rempel --- drivers/net/dsa/microchip/ksz_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index 02fb721c1090..a700631130e0 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -546,7 +546,8 @@ static const struct regmap_range ksz9477_valid_regs[] = { regmap_reg_range(0x0302, 0x031b), regmap_reg_range(0x0320, 0x032b), regmap_reg_range(0x0330, 0x0336), - regmap_reg_range(0x0338, 0x033e), + regmap_reg_range(0x0338, 0x033b), + regmap_reg_range(0x033e, 0x033e), regmap_reg_range(0x0340, 0x035f), regmap_reg_range(0x0370, 0x0370), regmap_reg_range(0x0378, 0x0378), From patchwork Fri Sep 2 10:16:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 12964000 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2924ECAAD5 for ; Fri, 2 Sep 2022 10:16:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235332AbiIBKQX (ORCPT ); Fri, 2 Sep 2022 06:16:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232171AbiIBKQV (ORCPT ); Fri, 2 Sep 2022 06:16:21 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E45FFA024D for ; Fri, 2 Sep 2022 03:16:19 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id v7-20020a1cac07000000b003a6062a4f81so3050811wme.1 for ; Fri, 02 Sep 2022 03:16:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=lIu1VMzuHOf4otgmn5PSYSFBtSwiOzrtNK3zHzV551E=; b=ESXd+mUFuCgJ8flokV92U0REiBHOwOVmS0EUCcGrX7avat0KNGPI5W4jdlTPpFgIHs LFlJsAvUh4IukHiqTpbmc6fz48G+IlTYajLFlOcd90wAfZawraN9lgs98+Xjg2l4D16p 68+R5m3dZezAZuID/jwvx/tLzARyx4I5CLtSI++VbO2D3dhQKIF2FwDm4leC2U42MCCL guUo5LfuS3a2xNtYQNz1RcLxtNNpVr27RJh9rlR8+n7Pu+gYiN0OP/G9w7H3y7uUizDZ XtcNgKqSkpEQBi4yTzOS1MmmRKAIoY77bZHnaDs1GBmNqM4sxYElZNf6umSa9pauGq7j BrCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=lIu1VMzuHOf4otgmn5PSYSFBtSwiOzrtNK3zHzV551E=; b=tbTxMO/y2MAnlZAZKGm5buAYQQGMh/mzdfpbvhv2JW4QB3xdm2cu0fUra1cAv2BIq8 Zcy2ha48S3bYTy0F6cwU+JP2aPC7fANFjY4WwflVA1etkeNNOwUmacIDrsfbDfRGs9K7 xgBX1o11EeGHCCmRj9OZuRdmxeIeVSovm18EGb0exch1Ufi3yQ34bd/OMGSLEuayfyet cu0flShWniiav++q/yTM7HqFbP5uUcOCtlLQdebEr9rMHBzvdFAeqvLfiGOOSdZB9+HA KkW49wd5zSCkVOcN11pX/Zw3FdInG4K2Wp2I2ylEToMw7hJLdxUrDIIcXb7mbTyFqsUu mHuw== X-Gm-Message-State: ACgBeo2PFyY3j9IJOCSzKrV9e22skaEBtMT5uW0nzm0yI5Eh/GoLgHps 8i4dMp352CR2wXxmGPW2OT7Mz6drEPMHFA== X-Google-Smtp-Source: AA6agR60z37ISZkEjTfLiQe/r/8jBFmd0kEd3HH07A9vu/SDAzr4hkuCL5NWJIT1qv9fBteLMfiDiA== X-Received: by 2002:a7b:c7d8:0:b0:3a6:34d2:1705 with SMTP id z24-20020a7bc7d8000000b003a634d21705mr2269043wmk.206.1662113778106; Fri, 02 Sep 2022 03:16:18 -0700 (PDT) Received: from P-NTS-Evian.home (2a01cb058f8a18001c97b8d1b477d53f.ipv6.abo.wanadoo.fr. [2a01:cb05:8f8a:1800:1c97:b8d1:b477:d53f]) by smtp.gmail.com with ESMTPSA id a8-20020adfeec8000000b00226d1821abesm1140913wrp.56.2022.09.02.03.16.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 03:16:17 -0700 (PDT) From: Romain Naour To: netdev@vger.kernel.org Cc: pabeni@redhat.com, kuba@kernel.org, edumazet@google.com, davem@davemloft.net, olteanv@gmail.com, f.fainelli@gmail.com, vivien.didelot@gmail.com, andrew@lunn.ch, UNGLinuxDriver@microchip.com, woojung.huh@microchip.com, Romain Naour Subject: [PATCH v3: net-next 4/4] net: dsa: microchip: add regmap_range for KSZ9896 chip Date: Fri, 2 Sep 2022 12:16:10 +0200 Message-Id: <20220902101610.109646-4-romain.naour@smile.fr> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20220902101610.109646-1-romain.naour@smile.fr> References: <20220902101610.109646-1-romain.naour@smile.fr> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Romain Naour Add register validation for KSZ9896. Signed-off-by: Romain Naour --- drivers/net/dsa/microchip/ksz_common.c | 215 +++++++++++++++++++++++++ 1 file changed, 215 insertions(+) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index a700631130e0..7389837ddd84 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -802,6 +802,219 @@ static const struct regmap_access_table ksz9477_register_set = { .n_yes_ranges = ARRAY_SIZE(ksz9477_valid_regs), }; +static const struct regmap_range ksz9896_valid_regs[] = { + regmap_reg_range(0x0000, 0x0003), + regmap_reg_range(0x0006, 0x0006), + regmap_reg_range(0x0010, 0x001f), + regmap_reg_range(0x0100, 0x0100), + regmap_reg_range(0x0103, 0x0107), + regmap_reg_range(0x010d, 0x010d), + regmap_reg_range(0x0110, 0x0113), + regmap_reg_range(0x0120, 0x0127), + regmap_reg_range(0x0201, 0x0201), + regmap_reg_range(0x0210, 0x0213), + regmap_reg_range(0x0300, 0x0300), + regmap_reg_range(0x0302, 0x030b), + regmap_reg_range(0x0310, 0x031b), + regmap_reg_range(0x0320, 0x032b), + regmap_reg_range(0x0330, 0x0336), + regmap_reg_range(0x0338, 0x033b), + regmap_reg_range(0x033e, 0x033e), + regmap_reg_range(0x0340, 0x035f), + regmap_reg_range(0x0370, 0x0370), + regmap_reg_range(0x0378, 0x0378), + regmap_reg_range(0x037c, 0x037d), + regmap_reg_range(0x0390, 0x0393), + regmap_reg_range(0x0400, 0x040e), + regmap_reg_range(0x0410, 0x042f), + + /* port 1 */ + regmap_reg_range(0x1000, 0x1001), + regmap_reg_range(0x1013, 0x1013), + regmap_reg_range(0x1017, 0x1017), + regmap_reg_range(0x101b, 0x101b), + regmap_reg_range(0x101f, 0x1020), + regmap_reg_range(0x1030, 0x1030), + regmap_reg_range(0x1100, 0x1115), + regmap_reg_range(0x111a, 0x111f), + regmap_reg_range(0x1122, 0x1127), + regmap_reg_range(0x112a, 0x112b), + regmap_reg_range(0x1136, 0x1139), + regmap_reg_range(0x113e, 0x113f), + regmap_reg_range(0x1400, 0x1401), + regmap_reg_range(0x1403, 0x1403), + regmap_reg_range(0x1410, 0x1417), + regmap_reg_range(0x1420, 0x1423), + regmap_reg_range(0x1500, 0x1507), + regmap_reg_range(0x1600, 0x1612), + regmap_reg_range(0x1800, 0x180f), + regmap_reg_range(0x1820, 0x1827), + regmap_reg_range(0x1830, 0x1837), + regmap_reg_range(0x1840, 0x184b), + regmap_reg_range(0x1900, 0x1907), + regmap_reg_range(0x1914, 0x1915), + regmap_reg_range(0x1a00, 0x1a03), + regmap_reg_range(0x1a04, 0x1a07), + regmap_reg_range(0x1b00, 0x1b01), + regmap_reg_range(0x1b04, 0x1b04), + + /* port 2 */ + regmap_reg_range(0x2000, 0x2001), + regmap_reg_range(0x2013, 0x2013), + regmap_reg_range(0x2017, 0x2017), + regmap_reg_range(0x201b, 0x201b), + regmap_reg_range(0x201f, 0x2020), + regmap_reg_range(0x2030, 0x2030), + regmap_reg_range(0x2100, 0x2115), + regmap_reg_range(0x211a, 0x211f), + regmap_reg_range(0x2122, 0x2127), + regmap_reg_range(0x212a, 0x212b), + regmap_reg_range(0x2136, 0x2139), + regmap_reg_range(0x213e, 0x213f), + regmap_reg_range(0x2400, 0x2401), + regmap_reg_range(0x2403, 0x2403), + regmap_reg_range(0x2410, 0x2417), + regmap_reg_range(0x2420, 0x2423), + regmap_reg_range(0x2500, 0x2507), + regmap_reg_range(0x2600, 0x2612), + regmap_reg_range(0x2800, 0x280f), + regmap_reg_range(0x2820, 0x2827), + regmap_reg_range(0x2830, 0x2837), + regmap_reg_range(0x2840, 0x284b), + regmap_reg_range(0x2900, 0x2907), + regmap_reg_range(0x2914, 0x2915), + regmap_reg_range(0x2a00, 0x2a03), + regmap_reg_range(0x2a04, 0x2a07), + regmap_reg_range(0x2b00, 0x2b01), + regmap_reg_range(0x2b04, 0x2b04), + + /* port 3 */ + regmap_reg_range(0x3000, 0x3001), + regmap_reg_range(0x3013, 0x3013), + regmap_reg_range(0x3017, 0x3017), + regmap_reg_range(0x301b, 0x301b), + regmap_reg_range(0x301f, 0x3020), + regmap_reg_range(0x3030, 0x3030), + regmap_reg_range(0x3100, 0x3115), + regmap_reg_range(0x311a, 0x311f), + regmap_reg_range(0x3122, 0x3127), + regmap_reg_range(0x312a, 0x312b), + regmap_reg_range(0x3136, 0x3139), + regmap_reg_range(0x313e, 0x313f), + regmap_reg_range(0x3400, 0x3401), + regmap_reg_range(0x3403, 0x3403), + regmap_reg_range(0x3410, 0x3417), + regmap_reg_range(0x3420, 0x3423), + regmap_reg_range(0x3500, 0x3507), + regmap_reg_range(0x3600, 0x3612), + regmap_reg_range(0x3800, 0x380f), + regmap_reg_range(0x3820, 0x3827), + regmap_reg_range(0x3830, 0x3837), + regmap_reg_range(0x3840, 0x384b), + regmap_reg_range(0x3900, 0x3907), + regmap_reg_range(0x3914, 0x3915), + regmap_reg_range(0x3a00, 0x3a03), + regmap_reg_range(0x3a04, 0x3a07), + regmap_reg_range(0x3b00, 0x3b01), + regmap_reg_range(0x3b04, 0x3b04), + + /* port 4 */ + regmap_reg_range(0x4000, 0x4001), + regmap_reg_range(0x4013, 0x4013), + regmap_reg_range(0x4017, 0x4017), + regmap_reg_range(0x401b, 0x401b), + regmap_reg_range(0x401f, 0x4020), + regmap_reg_range(0x4030, 0x4030), + regmap_reg_range(0x4100, 0x4115), + regmap_reg_range(0x411a, 0x411f), + regmap_reg_range(0x4122, 0x4127), + regmap_reg_range(0x412a, 0x412b), + regmap_reg_range(0x4136, 0x4139), + regmap_reg_range(0x413e, 0x413f), + regmap_reg_range(0x4400, 0x4401), + regmap_reg_range(0x4403, 0x4403), + regmap_reg_range(0x4410, 0x4417), + regmap_reg_range(0x4420, 0x4423), + regmap_reg_range(0x4500, 0x4507), + regmap_reg_range(0x4600, 0x4612), + regmap_reg_range(0x4800, 0x480f), + regmap_reg_range(0x4820, 0x4827), + regmap_reg_range(0x4830, 0x4837), + regmap_reg_range(0x4840, 0x484b), + regmap_reg_range(0x4900, 0x4907), + regmap_reg_range(0x4914, 0x4915), + regmap_reg_range(0x4a00, 0x4a03), + regmap_reg_range(0x4a04, 0x4a07), + regmap_reg_range(0x4b00, 0x4b01), + regmap_reg_range(0x4b04, 0x4b04), + + /* port 5 */ + regmap_reg_range(0x5000, 0x5001), + regmap_reg_range(0x5013, 0x5013), + regmap_reg_range(0x5017, 0x5017), + regmap_reg_range(0x501b, 0x501b), + regmap_reg_range(0x501f, 0x5020), + regmap_reg_range(0x5030, 0x5030), + regmap_reg_range(0x5100, 0x5115), + regmap_reg_range(0x511a, 0x511f), + regmap_reg_range(0x5122, 0x5127), + regmap_reg_range(0x512a, 0x512b), + regmap_reg_range(0x5136, 0x5139), + regmap_reg_range(0x513e, 0x513f), + regmap_reg_range(0x5400, 0x5401), + regmap_reg_range(0x5403, 0x5403), + regmap_reg_range(0x5410, 0x5417), + regmap_reg_range(0x5420, 0x5423), + regmap_reg_range(0x5500, 0x5507), + regmap_reg_range(0x5600, 0x5612), + regmap_reg_range(0x5800, 0x580f), + regmap_reg_range(0x5820, 0x5827), + regmap_reg_range(0x5830, 0x5837), + regmap_reg_range(0x5840, 0x584b), + regmap_reg_range(0x5900, 0x5907), + regmap_reg_range(0x5914, 0x5915), + regmap_reg_range(0x5a00, 0x5a03), + regmap_reg_range(0x5a04, 0x5a07), + regmap_reg_range(0x5b00, 0x5b01), + regmap_reg_range(0x5b04, 0x5b04), + + /* port 6 */ + regmap_reg_range(0x6000, 0x6001), + regmap_reg_range(0x6013, 0x6013), + regmap_reg_range(0x6017, 0x6017), + regmap_reg_range(0x601b, 0x601b), + regmap_reg_range(0x601f, 0x6020), + regmap_reg_range(0x6030, 0x6030), + regmap_reg_range(0x6100, 0x6115), + regmap_reg_range(0x611a, 0x611f), + regmap_reg_range(0x6122, 0x6127), + regmap_reg_range(0x612a, 0x612b), + regmap_reg_range(0x6136, 0x6139), + regmap_reg_range(0x613e, 0x613f), + regmap_reg_range(0x6300, 0x6301), + regmap_reg_range(0x6400, 0x6401), + regmap_reg_range(0x6403, 0x6403), + regmap_reg_range(0x6410, 0x6417), + regmap_reg_range(0x6420, 0x6423), + regmap_reg_range(0x6500, 0x6507), + regmap_reg_range(0x6600, 0x6612), + regmap_reg_range(0x6800, 0x680f), + regmap_reg_range(0x6820, 0x6827), + regmap_reg_range(0x6830, 0x6837), + regmap_reg_range(0x6840, 0x684b), + regmap_reg_range(0x6900, 0x6907), + regmap_reg_range(0x6914, 0x6915), + regmap_reg_range(0x6a00, 0x6a03), + regmap_reg_range(0x6a04, 0x6a07), + regmap_reg_range(0x6b00, 0x6b01), + regmap_reg_range(0x6b04, 0x6b04), +}; + +static const struct regmap_access_table ksz9896_register_set = { + .yes_ranges = ksz9896_valid_regs, + .n_yes_ranges = ARRAY_SIZE(ksz9896_valid_regs), +}; + const struct ksz_chip_data ksz_switch_chips[] = { [KSZ8563] = { .chip_id = KSZ8563_CHIP_ID, @@ -993,6 +1206,8 @@ const struct ksz_chip_data ksz_switch_chips[] = { .internal_phy = {true, true, true, true, true, false}, .gbit_capable = {true, true, true, true, true, true}, + .wr_table = &ksz9896_register_set, + .rd_table = &ksz9896_register_set, }, [KSZ9897] = {