From: Vladimir Oltean <olteanv@gmail.com>
To: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Cc: netdev@vger.kernel.org, linus.walleij@linaro.org, andrew@lunn.ch,
vivien.didelot@gmail.com, f.fainelli@gmail.com,
alsi@bang-olufsen.dk, arinc.unal@arinc9.com,
frank-w@public-files.de
Subject: Re: [PATCH net-next v3 09/11] net: dsa: realtek: rtl8365mb: use DSA CPU port
Date: Mon, 3 Jan 2022 21:08:03 +0200 [thread overview]
Message-ID: <20220103190803.pjqcoekzjwvqerp5@skbuf> (raw)
In-Reply-To: <20211231043306.12322-10-luizluca@gmail.com>
On Fri, Dec 31, 2021 at 01:33:04AM -0300, Luiz Angelo Daros de Luca wrote:
> Instead of a fixed CPU port, assume that DSA is correct.
>
> Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
> Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
> drivers/net/dsa/realtek/rtl8365mb.c | 23 ++++++++++++++---------
> 1 file changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/dsa/realtek/rtl8365mb.c b/drivers/net/dsa/realtek/rtl8365mb.c
> index b22f50a9d1ef..168e857a4e34 100644
> --- a/drivers/net/dsa/realtek/rtl8365mb.c
> +++ b/drivers/net/dsa/realtek/rtl8365mb.c
> @@ -103,14 +103,13 @@
>
> /* Chip-specific data and limits */
> #define RTL8365MB_CHIP_ID_8365MB_VC 0x6367
> -#define RTL8365MB_CPU_PORT_NUM_8365MB_VC 6
> #define RTL8365MB_LEARN_LIMIT_MAX_8365MB_VC 2112
>
> /* Family-specific data and limits */
> #define RTL8365MB_PHYADDRMAX 7
> #define RTL8365MB_NUM_PHYREGS 32
> #define RTL8365MB_PHYREGMAX (RTL8365MB_NUM_PHYREGS - 1)
> -#define RTL8365MB_MAX_NUM_PORTS (RTL8365MB_CPU_PORT_NUM_8365MB_VC + 1)
> +#define RTL8365MB_MAX_NUM_PORTS 7
>
> /* Chip identification registers */
> #define RTL8365MB_CHIP_ID_REG 0x1300
> @@ -1833,9 +1832,18 @@ static int rtl8365mb_setup(struct dsa_switch *ds)
> dev_info(priv->dev, "no interrupt support\n");
>
> /* Configure CPU tagging */
> - ret = rtl8365mb_cpu_config(priv);
> - if (ret)
> - goto out_teardown_irq;
> + for (i = 0; i < priv->num_ports; i++) {
> + if (!(dsa_is_cpu_port(priv->ds, i)))
> + continue;
dsa_switch_for_each_cpu_port
> + priv->cpu_port = i;
> + mb->cpu.mask = BIT(priv->cpu_port);
> + mb->cpu.trap_port = priv->cpu_port;
> + ret = rtl8365mb_cpu_config(priv);
> + if (ret)
> + goto out_teardown_irq;
> +
> + break;
> + }
>
> /* Configure ports */
> for (i = 0; i < priv->num_ports; i++) {
> @@ -1967,8 +1975,7 @@ static int rtl8365mb_detect(struct realtek_priv *priv)
> "found an RTL8365MB-VC switch (ver=0x%04x)\n",
> chip_ver);
>
> - priv->cpu_port = RTL8365MB_CPU_PORT_NUM_8365MB_VC;
> - priv->num_ports = priv->cpu_port + 1;
> + priv->num_ports = RTL8365MB_MAX_NUM_PORTS;
>
> mb->priv = priv;
> mb->chip_id = chip_id;
> @@ -1979,8 +1986,6 @@ static int rtl8365mb_detect(struct realtek_priv *priv)
> mb->jam_size = ARRAY_SIZE(rtl8365mb_init_jam_8365mb_vc);
>
> mb->cpu.enable = 1;
> - mb->cpu.mask = BIT(priv->cpu_port);
> - mb->cpu.trap_port = priv->cpu_port;
> mb->cpu.insert = RTL8365MB_CPU_INSERT_TO_ALL;
> mb->cpu.position = RTL8365MB_CPU_POS_AFTER_SA;
> mb->cpu.rx_length = RTL8365MB_CPU_RXLEN_64BYTES;
> --
> 2.34.0
>
next prev parent reply other threads:[~2022-01-03 19:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-31 4:32 [PATCH net-next 00/13 v3] net: dsa: realtek: MDIO interface and RTL8367S Luiz Angelo Daros de Luca
2021-12-31 4:32 ` [PATCH net-next v3 01/11] net: dsa: realtek-smi: move to subdirectory Luiz Angelo Daros de Luca
2022-01-01 17:45 ` Florian Fainelli
2022-01-03 17:59 ` Vladimir Oltean
2021-12-31 4:32 ` [PATCH net-next v3 02/11] net: dsa: realtek: rename realtek_smi to realtek_priv Luiz Angelo Daros de Luca
2022-01-02 16:48 ` Florian Fainelli
2022-01-03 19:07 ` Vladimir Oltean
2022-01-05 0:22 ` Luiz Angelo Daros de Luca
2021-12-31 4:32 ` [PATCH net-next v3 03/11] net: dsa: realtek: remove direct calls to realtek-smi Luiz Angelo Daros de Luca
2021-12-31 4:32 ` [PATCH net-next v3 04/11] net: dsa: realtek: convert subdrivers into modules Luiz Angelo Daros de Luca
2021-12-31 4:33 ` [PATCH net-next v3 05/11] net: dsa: realtek: use phy_read in ds->ops Luiz Angelo Daros de Luca
2021-12-31 4:33 ` [PATCH net-next v3 06/11] net: dsa: realtek: add new mdio interface for drivers Luiz Angelo Daros de Luca
2021-12-31 4:33 ` [PATCH net-next v3 07/11] net: dsa: realtek: rtl8365mb: rename extport to extint, add "realtek,ext-int" Luiz Angelo Daros de Luca
2021-12-31 4:33 ` [PATCH net-next v3 08/11] net: dsa: realtek: rtl8365mb: use GENMASK(n-1,0) instead of BIT(n)-1 Luiz Angelo Daros de Luca
2021-12-31 4:33 ` [PATCH net-next v3 09/11] net: dsa: realtek: rtl8365mb: use DSA CPU port Luiz Angelo Daros de Luca
2022-01-03 19:08 ` Vladimir Oltean [this message]
2021-12-31 4:33 ` [PATCH net-next v3 10/11] net: dsa: realtek: rtl8365mb: add RTL8367S support Luiz Angelo Daros de Luca
2021-12-31 4:33 ` [PATCH net-next v3 11/11] net: dsa: realtek: rtl8365mb: multiple cpu ports, non cpu extint Luiz Angelo Daros de Luca
2022-01-01 2:30 ` [PATCH net-next 00/13 v3] net: dsa: realtek: MDIO interface and RTL8367S Jakub Kicinski
2022-01-01 18:49 ` Luiz Angelo Daros de Luca
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220103190803.pjqcoekzjwvqerp5@skbuf \
--to=olteanv@gmail.com \
--cc=alsi@bang-olufsen.dk \
--cc=andrew@lunn.ch \
--cc=arinc.unal@arinc9.com \
--cc=f.fainelli@gmail.com \
--cc=frank-w@public-files.de \
--cc=linus.walleij@linaro.org \
--cc=luizluca@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox