From patchwork Fri Feb 9 05:03:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Angelo Daros de Luca X-Patchwork-Id: 198748 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp637040dyd; Thu, 8 Feb 2024 21:08:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IG4BXjvF5ihEG6uNKCkc5GUroS1QT18qVgVTiwBNdEyLzwVzgea/GInsB0mj4RKgwM3O3gY X-Received: by 2002:a05:620a:1465:b0:785:ab77:fe6c with SMTP id j5-20020a05620a146500b00785ab77fe6cmr556216qkl.6.1707455289096; Thu, 08 Feb 2024 21:08:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707455289; cv=pass; d=google.com; s=arc-20160816; b=h8x/lb+eX1Xy+wKlkT9oD57BlhP97oqByT9R8eBJSKHe4bYBi754wyZLzPoiFnXsJS EZd1Lf0cNTVGFTobnIqQg2XSwqQ49Dg0JBHimIPZ4SGSLuO+kNwoTqa3FNkAPG3QTHHQ JKQU9gFOYbsVgwtvSZ3ISKqLYQZW2wgT+V5ncuNMSwXHed2pyWZt5zi+uybbI0iPFz+o FwlmAYJhQPotu+mXELDZOjbH+I5EgxZ1q892i4RKGdi8JTQNnNDDpNW2E0I7FhZtM8jz flJ3SEHUt4BPwlGvWUgjCFSg/KgLZLTOXQ9CiWPsW5PYyPik7DEhC2K+ch5AnzhQJkCS 81eg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=SDHXEFZTikwmhTjEOcrYXugCCX9uf2Y9+WgX2fGJ5fM=; fh=WlIcPJKoN4C1bXntIzEeyprqkLGKXSka4/Zqnw/9y7Q=; b=oWStWnG2S08lWfqbpbj6UamvL/cPiaVleSJZY19gfgZRJbrE9pCkxF0yVTW/3vbhXG GBm+MUq8FAppJJlW0iGYvDHFf5VLvliq5+7QyelLzZmPkee51igpecghVGyRpwTi/OMT V33A0fEi3MrhVmhcLoIB5XsBiUtNLlJL4yP1PH4bLWXqf0GyhMZOIxEU/mY5wzbe9Dpf JYupqozQ4DGS+M7RMhmH55Apb9Zz7ysSBhbs8t7aH/hjg1nL0fExA4R/rrN8AIHUxP0A YZ1ZjOYRLNGEpiX67SSNk3rR7n5AtFgMdJ74S7Vwb4UtlcrmRrJClDAT3HCaXUilGJF4 Ds9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZRerSew7; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-59013-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59013-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCXTq1AzpaPIYYW66JrULyC1h1wsvn/btRnvUvKzFw6n1BCc3F8BXRBmHnBF9qjvzaRJtK5tuL+M/WEyLYNGGw6zZXD87w== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s13-20020a05620a030d00b007855e8d19b2si1202727qkm.711.2024.02.08.21.08.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 21:08:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59013-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZRerSew7; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-59013-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59013-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 BDEF61C23F6B for ; Fri, 9 Feb 2024 05:08:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 46E345733B; Fri, 9 Feb 2024 05:05:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZRerSew7" Received: from mail-oi1-f182.google.com (mail-oi1-f182.google.com [209.85.167.182]) (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 A835E59B4F; Fri, 9 Feb 2024 05:05:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707455103; cv=none; b=fBpI+4sbYYRuvvrMMp3jKX5OXcbfdilydFurjHv7tXq5c2HmxXRHhZz7hXTGiNR217E9thgVw3z6vkLPTZghYpKXkELeqOfWi+TuSmAg0jyXI966BFZfic1EZdi/2X3S3ESbdrsUk/aXuaQWQaWGza3jZTEVGY42J+du5R3m1h4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707455103; c=relaxed/simple; bh=M7tyFdeNP+I/FIJPD2qDtWuHiq0EsHeuC0IL9G2yMh0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Y3yPFssEyosngVS5k34/vIYnhYkTIc1UXJforaiw3JZUd1p3ZmYwxfu/5sUPBIN0/QEu/Uf53w8yESh/fK9mxejqX3xOIOx7dQBzFjL3ba1hJg9fYXFD70xrJ16MddHVO4JLlmyZ0aS4PRhIuydm7QOsaVCksUQUKnSNX7h1HIo= 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=ZRerSew7; arc=none smtp.client-ip=209.85.167.182 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 Received: by mail-oi1-f182.google.com with SMTP id 5614622812f47-3be61772d9aso241473b6e.3; Thu, 08 Feb 2024 21:05:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707455101; x=1708059901; darn=vger.kernel.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=SDHXEFZTikwmhTjEOcrYXugCCX9uf2Y9+WgX2fGJ5fM=; b=ZRerSew7++2x9QlAgcNRq8in/JPCg5LJOMi0w/jcIxuhq7z6FMg7n5mZcIJBu0bULU lpsADMUCRfh2ixxNTHelIPAtrYpueDR69XvitL10IGKKnEc0MiKs43rt+SXfDWx2oTIE lgxmt/FvptpqfgN1GGZneUpOPINQp1Sm9RRpE48/696tW0DaQubJPELa1bZh5789rzz3 9T0WOkZHR+VG4kryayUcMRU10RRhBQ9N2T6PbNpa1jwZk7d+6f/HkCACR8LcDuoJJJ4M t6xoAGMP1V+D3kmwIp842GYv7QUJG4i0fEg/ydM1zmeSZnu8CHuEDvBac9HxmwvuV+HV u5CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707455101; x=1708059901; 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=SDHXEFZTikwmhTjEOcrYXugCCX9uf2Y9+WgX2fGJ5fM=; b=M2Nk/JjQK6hWa8obdODD2fgF/XFAPqFQ7dBv5jpBQSsZ4wSTSI6mmZwsezfw3FOOr4 lUqR0OMJP7aXb6T6D3WrgbA1/rkqoh/pNkI7LlKe7TUEUpgjzgtiMTfBhKAQT5M8TMK+ 9Esqy6zzlAXXVKzmZID04ybwOzypoAQsQPAEHdEhBuEcb1+gzRU3Ul/05NxxOtgu5oeU pcbVxAjekuoB0rKDqha+p44vwyob1cIGztbNG5FjmHx8TkwLonD7tssLJxkTs3P5wt48 4uimZAw6BtIXkMj773WBtl5nG24jV/uN/K5ty5LUTEG/vFcyaupncq9M795VS9FCRv7b 1QZA== X-Gm-Message-State: AOJu0Ywnyi2USWoi756GS3dfCLtJ3aBdpK60ynOXf4huATFhz6vfRHX5 tLtDwMSPVMvtuUdlKxyP//HfkKNg7rN4O2NyylkAZDMfpJcQbSfU X-Received: by 2002:a05:6358:63a3:b0:176:40fb:cf3a with SMTP id k35-20020a05635863a300b0017640fbcf3amr416821rwh.14.1707455100607; Thu, 08 Feb 2024 21:05:00 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWihVBS7XcTeXmlU9rvmESkZkdvtCSiV0nw5marxBf4aT8zTFoVMPTeE08n4n+m001X5cQQvvJvF8vHyyyyhZb5lQOpUdetw1ADe22AI8FZ8jRgnLyYjO0jzu/pFOjXmZNGv48/ZN/vRs6w+MSr1mpvjiFDMpioHB60c2h3xZKV+PfufVang8c+4/r/Ppe/RQHt0WHbLaeahkzX91xQvd9LPp/VhRtDlHEdc30anySrzSOWkzmCMt5JTiErWhU/sGDQhoh4kWDN8fsQL/F/WZmgXzRtUXpBrMyeY57Ho0uH3pKnd1k7Hpzy7n6NoPGyykWwTFNh3t4z2TxmyWRWAym3oYlR8Mp2+9ncv9Jj7xv9ib6ecak= Received: from tresc054937.tre-sc.gov.br ([2804:3b0:4104:200:2be:43ff:febc:c2fb]) by smtp.gmail.com with ESMTPSA id d1-20020a634f01000000b005cda7a1d72dsm793616pgb.74.2024.02.08.21.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 21:04:59 -0800 (PST) From: Luiz Angelo Daros de Luca Date: Fri, 09 Feb 2024 02:03:46 -0300 Subject: [PATCH net-next v6 10/11] net: dsa: realtek: use the same mii bus driver for both interfaces Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240209-realtek_reverse-v6-10-0662f8cbc7b5@gmail.com> References: <20240209-realtek_reverse-v6-0-0662f8cbc7b5@gmail.com> In-Reply-To: <20240209-realtek_reverse-v6-0-0662f8cbc7b5@gmail.com> To: Linus Walleij , =?utf-8?q?Alvin_=C5=A0ipraga?= , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Luiz Angelo Daros de Luca X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=9959; i=luizluca@gmail.com; h=from:subject:message-id; bh=M7tyFdeNP+I/FIJPD2qDtWuHiq0EsHeuC0IL9G2yMh0=; b=owEBbQGS/pANAwAIAbsR27rRBztWAcsmYgBlxbJMjzq0uQmWyt8tZZPhBrnuIICvjI32pWo4z vS/JgGFePiJATMEAAEIAB0WIQQRByhHhc1bOhL6L/i7Edu60Qc7VgUCZcWyTAAKCRC7Edu60Qc7 Vj9hB/4uFxPhmqzchHSPq7jIWj48SrRURhjbstYj2iAVwsIfbtFT+e7Fz63wjKYuHZZKNEMqgSs EaKpAfrFfblY+xLihebrVBFhR2JUmaGROpHk0WvT0vbl9JlSfbvTsR8QBmFeaYGDX3hYk4ogJ0u b4ClP2sAiDJqZgpVtWvLU8YKcnsnFaeVAO8K1l5vW6JGao31puCO06XIahc4vfBq8Ck/+3HYX4g dt5qZu9o6JKZRm9m3MUTcBriY5ML15cQLzMCfAXPfaYU0Q5gUzRunNsN8zi8rK/xkuK+tTryuWo fLn8Hidx0ygy1u5uD2DJqfPYIiX7zNbjgvgxd5mNlqhhGePP X-Developer-Key: i=luizluca@gmail.com; a=openpgp; fpr=1107284785CD5B3A12FA2FF8BB11DBBAD1073B56 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790396637019547589 X-GMAIL-MSGID: 1790396637019547589 The realtek-mdio will now use this driver instead of the generic DSA driver ("dsa user smi"), which should not be used with OF[1]. With a single ds_ops for both interfaces, the ds_ops in realtek_priv is no longer necessary. Now, the realtek_variant.ds_ops can be used directly. The realtek_priv.setup_interface() has been removed as we can directly call the new common function. [1] https://lkml.kernel.org/netdev/20220630200423.tieprdu5fpabflj7@bang-olufsen.dk/T/ Signed-off-by: Luiz Angelo Daros de Luca Reviewed-by: Vladimir Oltean Reviewed-by: Linus Walleij --- drivers/net/dsa/realtek/realtek-mdio.c | 1 - drivers/net/dsa/realtek/realtek-smi.c | 2 -- drivers/net/dsa/realtek/realtek.h | 5 +--- drivers/net/dsa/realtek/rtl8365mb.c | 49 ++++---------------------------- drivers/net/dsa/realtek/rtl8366rb.c | 52 ++++------------------------------ drivers/net/dsa/realtek/rtl83xx.c | 2 +- 6 files changed, 14 insertions(+), 97 deletions(-) diff --git a/drivers/net/dsa/realtek/realtek-mdio.c b/drivers/net/dsa/realtek/realtek-mdio.c index 04c65452da0d..04b758e5a680 100644 --- a/drivers/net/dsa/realtek/realtek-mdio.c +++ b/drivers/net/dsa/realtek/realtek-mdio.c @@ -131,7 +131,6 @@ int realtek_mdio_probe(struct mdio_device *mdiodev) priv->bus = mdiodev->bus; priv->mdio_addr = mdiodev->addr; priv->write_reg_noack = realtek_mdio_write; - priv->ds_ops = priv->variant->ds_ops_mdio; ret = rtl83xx_register_switch(priv); if (ret) { diff --git a/drivers/net/dsa/realtek/realtek-smi.c b/drivers/net/dsa/realtek/realtek-smi.c index bf02276b74d0..88590ae95a75 100644 --- a/drivers/net/dsa/realtek/realtek-smi.c +++ b/drivers/net/dsa/realtek/realtek-smi.c @@ -352,8 +352,6 @@ int realtek_smi_probe(struct platform_device *pdev) } priv->write_reg_noack = realtek_smi_write_reg_noack; - priv->setup_interface = rtl83xx_setup_user_mdio; - priv->ds_ops = priv->variant->ds_ops_smi; ret = rtl83xx_register_switch(priv); if (ret) { diff --git a/drivers/net/dsa/realtek/realtek.h b/drivers/net/dsa/realtek/realtek.h index e9e28b189509..864bb9a88f14 100644 --- a/drivers/net/dsa/realtek/realtek.h +++ b/drivers/net/dsa/realtek/realtek.h @@ -62,7 +62,6 @@ struct realtek_priv { spinlock_t lock; /* Locks around command writes */ struct dsa_switch *ds; - const struct dsa_switch_ops *ds_ops; struct irq_domain *irqdomain; bool leds_disabled; @@ -73,7 +72,6 @@ struct realtek_priv { struct rtl8366_mib_counter *mib_counters; const struct realtek_ops *ops; - int (*setup_interface)(struct dsa_switch *ds); int (*write_reg_noack)(void *ctx, u32 addr, u32 data); int vlan_enabled; @@ -115,8 +113,7 @@ struct realtek_ops { }; struct realtek_variant { - const struct dsa_switch_ops *ds_ops_smi; - const struct dsa_switch_ops *ds_ops_mdio; + const struct dsa_switch_ops *ds_ops; const struct realtek_ops *ops; unsigned int clk_delay; u8 cmd_read; diff --git a/drivers/net/dsa/realtek/rtl8365mb.c b/drivers/net/dsa/realtek/rtl8365mb.c index 60f826a5a00a..778a962727ab 100644 --- a/drivers/net/dsa/realtek/rtl8365mb.c +++ b/drivers/net/dsa/realtek/rtl8365mb.c @@ -828,17 +828,6 @@ static int rtl8365mb_phy_write(struct realtek_priv *priv, int phy, int regnum, return 0; } -static int rtl8365mb_dsa_phy_read(struct dsa_switch *ds, int phy, int regnum) -{ - return rtl8365mb_phy_read(ds->priv, phy, regnum); -} - -static int rtl8365mb_dsa_phy_write(struct dsa_switch *ds, int phy, int regnum, - u16 val) -{ - return rtl8365mb_phy_write(ds->priv, phy, regnum, val); -} - static const struct rtl8365mb_extint * rtl8365mb_get_port_extint(struct realtek_priv *priv, int port) { @@ -2017,12 +2006,10 @@ static int rtl8365mb_setup(struct dsa_switch *ds) if (ret) goto out_teardown_irq; - if (priv->setup_interface) { - ret = priv->setup_interface(ds); - if (ret) { - dev_err(priv->dev, "could not set up MDIO bus\n"); - goto out_teardown_irq; - } + ret = rtl83xx_setup_user_mdio(ds); + if (ret) { + dev_err(priv->dev, "could not set up MDIO bus\n"); + goto out_teardown_irq; } /* Start statistics counter polling */ @@ -2116,28 +2103,7 @@ static int rtl8365mb_detect(struct realtek_priv *priv) return 0; } -static const struct dsa_switch_ops rtl8365mb_switch_ops_smi = { - .get_tag_protocol = rtl8365mb_get_tag_protocol, - .change_tag_protocol = rtl8365mb_change_tag_protocol, - .setup = rtl8365mb_setup, - .teardown = rtl8365mb_teardown, - .phylink_get_caps = rtl8365mb_phylink_get_caps, - .phylink_mac_config = rtl8365mb_phylink_mac_config, - .phylink_mac_link_down = rtl8365mb_phylink_mac_link_down, - .phylink_mac_link_up = rtl8365mb_phylink_mac_link_up, - .port_stp_state_set = rtl8365mb_port_stp_state_set, - .get_strings = rtl8365mb_get_strings, - .get_ethtool_stats = rtl8365mb_get_ethtool_stats, - .get_sset_count = rtl8365mb_get_sset_count, - .get_eth_phy_stats = rtl8365mb_get_phy_stats, - .get_eth_mac_stats = rtl8365mb_get_mac_stats, - .get_eth_ctrl_stats = rtl8365mb_get_ctrl_stats, - .get_stats64 = rtl8365mb_get_stats64, - .port_change_mtu = rtl8365mb_port_change_mtu, - .port_max_mtu = rtl8365mb_port_max_mtu, -}; - -static const struct dsa_switch_ops rtl8365mb_switch_ops_mdio = { +static const struct dsa_switch_ops rtl8365mb_switch_ops = { .get_tag_protocol = rtl8365mb_get_tag_protocol, .change_tag_protocol = rtl8365mb_change_tag_protocol, .setup = rtl8365mb_setup, @@ -2146,8 +2112,6 @@ static const struct dsa_switch_ops rtl8365mb_switch_ops_mdio = { .phylink_mac_config = rtl8365mb_phylink_mac_config, .phylink_mac_link_down = rtl8365mb_phylink_mac_link_down, .phylink_mac_link_up = rtl8365mb_phylink_mac_link_up, - .phy_read = rtl8365mb_dsa_phy_read, - .phy_write = rtl8365mb_dsa_phy_write, .port_stp_state_set = rtl8365mb_port_stp_state_set, .get_strings = rtl8365mb_get_strings, .get_ethtool_stats = rtl8365mb_get_ethtool_stats, @@ -2167,8 +2131,7 @@ static const struct realtek_ops rtl8365mb_ops = { }; const struct realtek_variant rtl8365mb_variant = { - .ds_ops_smi = &rtl8365mb_switch_ops_smi, - .ds_ops_mdio = &rtl8365mb_switch_ops_mdio, + .ds_ops = &rtl8365mb_switch_ops, .ops = &rtl8365mb_ops, .clk_delay = 10, .cmd_read = 0xb9, diff --git a/drivers/net/dsa/realtek/rtl8366rb.c b/drivers/net/dsa/realtek/rtl8366rb.c index a0c365325b4a..54eff9cd0c03 100644 --- a/drivers/net/dsa/realtek/rtl8366rb.c +++ b/drivers/net/dsa/realtek/rtl8366rb.c @@ -1033,12 +1033,10 @@ static int rtl8366rb_setup(struct dsa_switch *ds) if (ret) dev_info(priv->dev, "no interrupt support\n"); - if (priv->setup_interface) { - ret = priv->setup_interface(ds); - if (ret) { - dev_err(priv->dev, "could not set up MDIO bus\n"); - return -ENODEV; - } + ret = rtl83xx_setup_user_mdio(ds); + if (ret) { + dev_err(priv->dev, "could not set up MDIO bus\n"); + return -ENODEV; } return 0; @@ -1785,17 +1783,6 @@ static int rtl8366rb_phy_write(struct realtek_priv *priv, int phy, int regnum, return ret; } -static int rtl8366rb_dsa_phy_read(struct dsa_switch *ds, int phy, int regnum) -{ - return rtl8366rb_phy_read(ds->priv, phy, regnum); -} - -static int rtl8366rb_dsa_phy_write(struct dsa_switch *ds, int phy, int regnum, - u16 val) -{ - return rtl8366rb_phy_write(ds->priv, phy, regnum, val); -} - static int rtl8366rb_reset_chip(struct realtek_priv *priv) { int timeout = 10; @@ -1861,35 +1848,9 @@ static int rtl8366rb_detect(struct realtek_priv *priv) return 0; } -static const struct dsa_switch_ops rtl8366rb_switch_ops_smi = { - .get_tag_protocol = rtl8366_get_tag_protocol, - .setup = rtl8366rb_setup, - .phylink_get_caps = rtl8366rb_phylink_get_caps, - .phylink_mac_link_up = rtl8366rb_mac_link_up, - .phylink_mac_link_down = rtl8366rb_mac_link_down, - .get_strings = rtl8366_get_strings, - .get_ethtool_stats = rtl8366_get_ethtool_stats, - .get_sset_count = rtl8366_get_sset_count, - .port_bridge_join = rtl8366rb_port_bridge_join, - .port_bridge_leave = rtl8366rb_port_bridge_leave, - .port_vlan_filtering = rtl8366rb_vlan_filtering, - .port_vlan_add = rtl8366_vlan_add, - .port_vlan_del = rtl8366_vlan_del, - .port_enable = rtl8366rb_port_enable, - .port_disable = rtl8366rb_port_disable, - .port_pre_bridge_flags = rtl8366rb_port_pre_bridge_flags, - .port_bridge_flags = rtl8366rb_port_bridge_flags, - .port_stp_state_set = rtl8366rb_port_stp_state_set, - .port_fast_age = rtl8366rb_port_fast_age, - .port_change_mtu = rtl8366rb_change_mtu, - .port_max_mtu = rtl8366rb_max_mtu, -}; - -static const struct dsa_switch_ops rtl8366rb_switch_ops_mdio = { +static const struct dsa_switch_ops rtl8366rb_switch_ops = { .get_tag_protocol = rtl8366_get_tag_protocol, .setup = rtl8366rb_setup, - .phy_read = rtl8366rb_dsa_phy_read, - .phy_write = rtl8366rb_dsa_phy_write, .phylink_get_caps = rtl8366rb_phylink_get_caps, .phylink_mac_link_up = rtl8366rb_mac_link_up, .phylink_mac_link_down = rtl8366rb_mac_link_down, @@ -1928,8 +1889,7 @@ static const struct realtek_ops rtl8366rb_ops = { }; const struct realtek_variant rtl8366rb_variant = { - .ds_ops_smi = &rtl8366rb_switch_ops_smi, - .ds_ops_mdio = &rtl8366rb_switch_ops_mdio, + .ds_ops = &rtl8366rb_switch_ops, .ops = &rtl8366rb_ops, .clk_delay = 10, .cmd_read = 0xa9, diff --git a/drivers/net/dsa/realtek/rtl83xx.c b/drivers/net/dsa/realtek/rtl83xx.c index ceb8418dfab7..80f2c38ae55a 100644 --- a/drivers/net/dsa/realtek/rtl83xx.c +++ b/drivers/net/dsa/realtek/rtl83xx.c @@ -232,7 +232,7 @@ int rtl83xx_register_switch(struct realtek_priv *priv) ds->priv = priv; ds->dev = priv->dev; - ds->ops = priv->ds_ops; + ds->ops = priv->variant->ds_ops; ds->num_ports = priv->num_ports; priv->ds = ds;