From patchwork Tue Jan 30 08:34:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Schenker X-Patchwork-Id: 193891 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1080634dyb; Tue, 30 Jan 2024 00:43:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IFrMI82fez/584h1vGTxIR/9Ks0jtbzA5n1gOpeJI6+F+tyOh0ieyERGsKzSmBFqEtkzun4 X-Received: by 2002:ac8:5cc9:0:b0:42a:5add:97f4 with SMTP id s9-20020ac85cc9000000b0042a5add97f4mr9656175qta.92.1706604235423; Tue, 30 Jan 2024 00:43:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706604235; cv=pass; d=google.com; s=arc-20160816; b=eSDh7Xd9WlHWH6wWw/tbknfpDm8YLeCDFw6MUugaPwcRr1vFjhtk9mw2W++xRyg2YA IV+YEvZm9QW3otNY0zYPm87eYMvW78wTPceBKxnyzFLSlk5Q4Biu6bF/6ODZILjsqbw2 hpi1EW2bTv+ImxHtaOHBkw3EWAaJharaje3OxwTE45olDWITMHqIp5PA0q7VTwHys3/p O3Ec929zFNSOG9TTPOGFdip3YFk54anet3UhFDQMzn8eDDj8K4itWBy7XOm7oIuM77Ez lo6c18HksTpaWmp5TfoEgvSValHLAABcAPm/4dX5bMyL4yYgL/zxBNFT2TRdheuFxmAa Nu5A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xjEnnpToDpnkPo7C57ictu6n2bz1iYQhoNEnUFbdWv4=; fh=4AwUuFK6+JBoipKrrqX+Vn2hTt7TLD5YPiM1D7Zw/hM=; b=O5ScIw/rV/uPMzgbjTfuP4TrDkE6WcaE0leXwgcndqE02b6iDqzLpWFqbCwSU7c2Cs o2GwW/NRmHZzusJMQ3A64V7gYQ802xMXivCxDamRExbKOCVFIXDGpAjHktplVjlLXab/ OYV1d624ajMBaioMAiaHB+NFj1faRznlWuUVXoYkZ0Qx6w6kvvT7xXJ56p8q9IiZRExu fKKnMePmfffSngei3+ntVF1kSndjmxXApf/qNDRjdCiyUrz25T7/xuYSzj5weBfiPbbS nQioZ3j/8i24L59OgX9r3SDfPp853KgmHcvSZQyf8rnWfYmJFQAeTv2V07J/9udgmMUU P9oQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@pschenker.ch header.s=20220412 header.b=cKk37AcR; arc=pass (i=1 spf=pass spfdomain=pschenker.ch dkim=pass dkdomain=pschenker.ch dmarc=pass fromdomain=pschenker.ch); spf=pass (google.com: domain of linux-kernel+bounces-44162-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44162-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=pschenker.ch Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c17-20020ac87d91000000b0042b08e0de54si432053qtd.138.2024.01.30.00.43.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 00:43:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44162-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@pschenker.ch header.s=20220412 header.b=cKk37AcR; arc=pass (i=1 spf=pass spfdomain=pschenker.ch dkim=pass dkdomain=pschenker.ch dmarc=pass fromdomain=pschenker.ch); spf=pass (google.com: domain of linux-kernel+bounces-44162-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44162-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=pschenker.ch 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 2D6F71C241AC for ; Tue, 30 Jan 2024 08:43:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 62DEF59165; Tue, 30 Jan 2024 08:41:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=pschenker.ch header.i=@pschenker.ch header.b="cKk37AcR" Received: from smtp-1909.mail.infomaniak.ch (smtp-1909.mail.infomaniak.ch [185.125.25.9]) (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 76ED757895 for ; Tue, 30 Jan 2024 08:41:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.25.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706604111; cv=none; b=m9apUzwQsRsl/1XzBEmU2A96blesyryWgDiXTK25JeN7bWsJK9GxK2gvAsOocvhwrJM6wvHSdODNfuPBtY+K7zQ+d1JpjHS24DSQl12bQSzXmmHz+W3IIAq/G9FIeRqAe96ZnX6vhbTRcJL3Sd5u5Fc3br2TsPNj1y28QOicV80= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706604111; c=relaxed/simple; bh=rEPPzbtp7T8BNnKZfxSdq728QVo3IoiRwZKsrO9GbLY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=A1My0hxCNsauwPnkP9BGMzFH53n/9618j8kqEednFUkmCdjwvDbbKZ/3FF+wdYpDTYa1qCaOPAmbW80BiAUwd8D2ORikqix0INgzys6pIoNT6/OWEQnjJNXVuvy/bA1MGqGtQNbB1GQcPFC71pKC3uPXH5cBP/TtOdnu3/kqTFY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pschenker.ch; spf=pass smtp.mailfrom=pschenker.ch; dkim=pass (1024-bit key) header.d=pschenker.ch header.i=@pschenker.ch header.b=cKk37AcR; arc=none smtp.client-ip=185.125.25.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pschenker.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pschenker.ch Received: from smtp-3-0000.mail.infomaniak.ch (smtp-3-0000.mail.infomaniak.ch [10.4.36.107]) by smtp-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4TPJPD0pzpzZ47; Tue, 30 Jan 2024 09:34:24 +0100 (CET) Received: from unknown by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4TPJPC3HYmzDMG; Tue, 30 Jan 2024 09:34:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=pschenker.ch; s=20220412; t=1706603664; bh=rEPPzbtp7T8BNnKZfxSdq728QVo3IoiRwZKsrO9GbLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cKk37AcR+LkM+OY/V2qGKlAait3MxrdmdgByMTkEdbfr99RxEMu8M/R4x8WxHfCaC 2L6byxE/05zxqe/oyBOyVkvbEimN1BRjxkDHP9my9UHwbLent+DJq4CE/UKZLGmCil tJ62wAf/wT7ZszYYt9YEFuE7CU3FIBb/PCmQuLT8= From: Philippe Schenker To: netdev@vger.kernel.org Cc: Paolo Abeni , linux-kernel@vger.kernel.org, Marek Vasut , Vladimir Oltean , Woojung Huh , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andrew Lunn , UNGLinuxDriver@microchip.com, devicetree@vger.kernel.org, "David S . Miller" , Florian Fainelli , stefan.portmann@impulsing.ch, Eric Dumazet , Jakub Kicinski , Philippe Schenker , Arun Ramadoss Subject: [PATCH net-next v3 2/2] net: dsa: Add KSZ8567 switch support Date: Tue, 30 Jan 2024 09:34:19 +0100 Message-Id: <20240130083419.135763-2-dev@pschenker.ch> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240130083419.135763-1-dev@pschenker.ch> References: <20240130083419.135763-1-dev@pschenker.ch> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Infomaniak-Routing: alpha X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789504242606258409 X-GMAIL-MSGID: 1789504242606258409 From: Philippe Schenker This commit introduces support for the KSZ8567, a robust 7-port Ethernet switch. The KSZ8567 features two RGMII/MII/RMII interfaces, each capable of gigabit speeds, complemented by five 10/100 Mbps MAC/PHYs. Signed-off-by: Philippe Schenker Acked-by: Arun Ramadoss Reviewed-by: Andrew Lunn Reviewed-by: Florian Fainelli --- Changes in v3: - Move KSZ8567_CHIP_ID also next to KSZ9567 in microchip-ksz.h - Fix 80 chars warning. - Add Arun's Acked-by. Thanks! Changes in v2: - Move the definition of KSZ8567 next to similar KSZ9567 drivers/net/dsa/microchip/ksz9477_i2c.c | 4 ++ drivers/net/dsa/microchip/ksz_common.c | 43 ++++++++++++++++++++- drivers/net/dsa/microchip/ksz_common.h | 1 + drivers/net/dsa/microchip/ksz_spi.c | 5 +++ include/linux/platform_data/microchip-ksz.h | 1 + 5 files changed, 53 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/microchip/ksz9477_i2c.c b/drivers/net/dsa/microchip/ksz9477_i2c.c index cac4a607e54a..82bebee4615c 100644 --- a/drivers/net/dsa/microchip/ksz9477_i2c.c +++ b/drivers/net/dsa/microchip/ksz9477_i2c.c @@ -103,6 +103,10 @@ static const struct of_device_id ksz9477_dt_ids[] = { .compatible = "microchip,ksz8563", .data = &ksz_switch_chips[KSZ8563] }, + { + .compatible = "microchip,ksz8567", + .data = &ksz_switch_chips[KSZ8567] + }, { .compatible = "microchip,ksz9567", .data = &ksz_switch_chips[KSZ9567] diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index 245dfb7a7a31..6ae08de54061 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -1476,6 +1476,39 @@ const struct ksz_chip_data ksz_switch_chips[] = { .gbit_capable = {true, true, true}, }, + [KSZ8567] = { + .chip_id = KSZ8567_CHIP_ID, + .dev_name = "KSZ8567", + .num_vlans = 4096, + .num_alus = 4096, + .num_statics = 16, + .cpu_ports = 0x7F, /* can be configured as cpu port */ + .port_cnt = 7, /* total port count */ + .port_nirqs = 3, + .num_tx_queues = 4, + .tc_cbs_supported = true, + .tc_ets_supported = true, + .ops = &ksz9477_dev_ops, + .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, true}, + .supports_rmii = {false, false, false, false, + false, true, true}, + .supports_rgmii = {false, false, false, false, + false, true, true}, + .internal_phy = {true, true, true, true, + true, false, false}, + .gbit_capable = {false, false, false, false, false, + true, true}, + }, + [KSZ9567] = { .chip_id = KSZ9567_CHIP_ID, .dev_name = "KSZ9567", @@ -2649,6 +2682,7 @@ static void ksz_port_teardown(struct dsa_switch *ds, int port) switch (dev->chip_id) { case KSZ8563_CHIP_ID: + case KSZ8567_CHIP_ID: case KSZ9477_CHIP_ID: case KSZ9563_CHIP_ID: case KSZ9567_CHIP_ID: @@ -2705,7 +2739,8 @@ static enum dsa_tag_protocol ksz_get_tag_protocol(struct dsa_switch *ds, dev->chip_id == KSZ9563_CHIP_ID) proto = DSA_TAG_PROTO_KSZ9893; - if (dev->chip_id == KSZ9477_CHIP_ID || + if (dev->chip_id == KSZ8567_CHIP_ID || + dev->chip_id == KSZ9477_CHIP_ID || dev->chip_id == KSZ9896_CHIP_ID || dev->chip_id == KSZ9897_CHIP_ID || dev->chip_id == KSZ9567_CHIP_ID) @@ -2813,6 +2848,7 @@ static int ksz_max_mtu(struct dsa_switch *ds, int port) case KSZ8830_CHIP_ID: return KSZ8863_HUGE_PACKET_SIZE - VLAN_ETH_HLEN - ETH_FCS_LEN; case KSZ8563_CHIP_ID: + case KSZ8567_CHIP_ID: case KSZ9477_CHIP_ID: case KSZ9563_CHIP_ID: case KSZ9567_CHIP_ID: @@ -2839,6 +2875,7 @@ static int ksz_validate_eee(struct dsa_switch *ds, int port) switch (dev->chip_id) { case KSZ8563_CHIP_ID: + case KSZ8567_CHIP_ID: case KSZ9477_CHIP_ID: case KSZ9563_CHIP_ID: case KSZ9567_CHIP_ID: @@ -3183,6 +3220,7 @@ static int ksz_switch_detect(struct ksz_device *dev) case KSZ9896_CHIP_ID: case KSZ9897_CHIP_ID: case KSZ9567_CHIP_ID: + case KSZ8567_CHIP_ID: case LAN9370_CHIP_ID: case LAN9371_CHIP_ID: case LAN9372_CHIP_ID: @@ -3220,6 +3258,7 @@ static int ksz_cls_flower_add(struct dsa_switch *ds, int port, switch (dev->chip_id) { case KSZ8563_CHIP_ID: + case KSZ8567_CHIP_ID: case KSZ9477_CHIP_ID: case KSZ9563_CHIP_ID: case KSZ9567_CHIP_ID: @@ -3239,6 +3278,7 @@ static int ksz_cls_flower_del(struct dsa_switch *ds, int port, switch (dev->chip_id) { case KSZ8563_CHIP_ID: + case KSZ8567_CHIP_ID: case KSZ9477_CHIP_ID: case KSZ9563_CHIP_ID: case KSZ9567_CHIP_ID: @@ -4142,6 +4182,7 @@ static int ksz_parse_drive_strength(struct ksz_device *dev) case KSZ8794_CHIP_ID: case KSZ8765_CHIP_ID: case KSZ8563_CHIP_ID: + case KSZ8567_CHIP_ID: case KSZ9477_CHIP_ID: case KSZ9563_CHIP_ID: case KSZ9567_CHIP_ID: diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h index 15612101a155..060c5de9aa05 100644 --- a/drivers/net/dsa/microchip/ksz_common.h +++ b/drivers/net/dsa/microchip/ksz_common.h @@ -187,6 +187,7 @@ struct ksz_device { /* List of supported models */ enum ksz_model { KSZ8563, + KSZ8567, KSZ8795, KSZ8794, KSZ8765, diff --git a/drivers/net/dsa/microchip/ksz_spi.c b/drivers/net/dsa/microchip/ksz_spi.c index 6f6d878e742c..c8166fb440ab 100644 --- a/drivers/net/dsa/microchip/ksz_spi.c +++ b/drivers/net/dsa/microchip/ksz_spi.c @@ -164,6 +164,10 @@ static const struct of_device_id ksz_dt_ids[] = { .compatible = "microchip,ksz8563", .data = &ksz_switch_chips[KSZ8563] }, + { + .compatible = "microchip,ksz8567", + .data = &ksz_switch_chips[KSZ8567] + }, { .compatible = "microchip,ksz9567", .data = &ksz_switch_chips[KSZ9567] @@ -204,6 +208,7 @@ static const struct spi_device_id ksz_spi_ids[] = { { "ksz9893" }, { "ksz9563" }, { "ksz8563" }, + { "ksz8567" }, { "ksz9567" }, { "lan9370" }, { "lan9371" }, diff --git a/include/linux/platform_data/microchip-ksz.h b/include/linux/platform_data/microchip-ksz.h index f177416635a2..8c659db4da6b 100644 --- a/include/linux/platform_data/microchip-ksz.h +++ b/include/linux/platform_data/microchip-ksz.h @@ -33,6 +33,7 @@ enum ksz_chip_id { KSZ9897_CHIP_ID = 0x00989700, KSZ9893_CHIP_ID = 0x00989300, KSZ9563_CHIP_ID = 0x00956300, + KSZ8567_CHIP_ID = 0x00856700, KSZ9567_CHIP_ID = 0x00956700, LAN9370_CHIP_ID = 0x00937000, LAN9371_CHIP_ID = 0x00937100,