From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>, netdev@vger.kernel.org
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, bryan.whitehead@microchip.com,
UNGLinuxDriver@microchip.com, linux@armlinux.org.uk,
maxime.chevallier@bootlin.com, rdunlap@infradead.org,
andrew@lunn.ch, Steen.Hegelund@microchip.com,
daniel.machon@microchip.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next V2 1/5] net: lan743x: Add SFP support check flag
Date: Wed, 11 Sep 2024 18:44:58 +0200 [thread overview]
Message-ID: <e542d2fc-0587-45a3-bc58-ee0a078a626a@wanadoo.fr> (raw)
In-Reply-To: <20240911161054.4494-2-Raju.Lakkaraju@microchip.com>
Le 11/09/2024 à 18:10, Raju Lakkaraju a écrit :
> Support for SFP in the PCI11x1x devices is indicated by the "is_sfp_support_en"
> flag in the STRAP register. This register is loaded at power up from the
> PCI11x1x EEPROM contents (which specify the board configuration).
>
> Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
> ---
> Change List:
> ============
> V1 -> V2:
> - Change variable name from "chip_rev" to "fpga_rev"
> V0 -> V1:
> - No changes
>
> drivers/net/ethernet/microchip/lan743x_main.c | 34 +++++++++++++++----
> drivers/net/ethernet/microchip/lan743x_main.h | 3 ++
> 2 files changed, 30 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
> index 4dc5adcda6a3..20a42a2c7b0e 100644
> --- a/drivers/net/ethernet/microchip/lan743x_main.c
> +++ b/drivers/net/ethernet/microchip/lan743x_main.c
> @@ -28,9 +28,9 @@
>
> #define RFE_RD_FIFO_TH_3_DWORDS 0x3
>
> -static void pci11x1x_strap_get_status(struct lan743x_adapter *adapter)
> +static int pci11x1x_strap_get_status(struct lan743x_adapter *adapter)
> {
> - u32 chip_rev;
> + u32 fpga_rev;
> u32 cfg_load;
> u32 hw_cfg;
> u32 strap;
> @@ -41,7 +41,7 @@ static void pci11x1x_strap_get_status(struct lan743x_adapter *adapter)
> if (ret < 0) {
> netif_err(adapter, drv, adapter->netdev,
> "Sys Lock acquire failed ret:%d\n", ret);
> - return;
> + return ret;
> }
>
> cfg_load = lan743x_csr_read(adapter, ETH_SYS_CONFIG_LOAD_STARTED_REG);
> @@ -55,10 +55,15 @@ static void pci11x1x_strap_get_status(struct lan743x_adapter *adapter)
> adapter->is_sgmii_en = true;
> else
> adapter->is_sgmii_en = false;
> +
> + if ((strap & STRAP_SFP_USE_EN_) && (strap & STRAP_SFP_EN_))
> + adapter->is_sfp_support_en = true;
> + else
> + adapter->is_sfp_support_en = false;
> } else {
> - chip_rev = lan743x_csr_read(adapter, FPGA_REV);
> - if (chip_rev) {
> - if (chip_rev & FPGA_SGMII_OP)
> + fpga_rev = lan743x_csr_read(adapter, FPGA_REV);
> + if (fpga_rev) {
> + if (fpga_rev & FPGA_SGMII_OP)
> adapter->is_sgmii_en = true;
> else
> adapter->is_sgmii_en = false;
> @@ -66,8 +71,21 @@ static void pci11x1x_strap_get_status(struct lan743x_adapter *adapter)
> adapter->is_sgmii_en = false;
> }
> }
> +
> + if (adapter->is_pci11x1x && !adapter->is_sgmii_en &&
> + adapter->is_sfp_support_en) {
> + netif_err(adapter, drv, adapter->netdev,
> + "Invalid eeprom cfg: sfp enabled with sgmii disabled");
> + return -EINVAL;
> + }
> +
> netif_dbg(adapter, drv, adapter->netdev,
> "SGMII I/F %sable\n", adapter->is_sgmii_en ? "En" : "Dis");
> + netif_dbg(adapter, drv, adapter->netdev,
> + "SFP support %sable\n", adapter->is_sfp_support_en ?
> + "En" : "Dis");
Hi,
Maybe using str_enable_disable() or str_enabled_disabled()?
CJ
> +
> + return 0;
> }
>
> static bool is_pci11x1x_chip(struct lan743x_adapter *adapter)
> @@ -3470,7 +3488,9 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter,
> adapter->max_tx_channels = PCI11X1X_MAX_TX_CHANNELS;
> adapter->used_tx_channels = PCI11X1X_USED_TX_CHANNELS;
> adapter->max_vector_count = PCI11X1X_MAX_VECTOR_COUNT;
> - pci11x1x_strap_get_status(adapter);
> + ret = pci11x1x_strap_get_status(adapter);
> + if (ret < 0)
> + return ret;
> spin_lock_init(&adapter->eth_syslock_spinlock);
> mutex_init(&adapter->sgmii_rw_lock);
> pci11x1x_set_rfe_rd_fifo_threshold(adapter);
> diff --git a/drivers/net/ethernet/microchip/lan743x_main.h b/drivers/net/ethernet/microchip/lan743x_main.h
> index 8ef897c114d3..f7e96496600b 100644
> --- a/drivers/net/ethernet/microchip/lan743x_main.h
> +++ b/drivers/net/ethernet/microchip/lan743x_main.h
> @@ -36,6 +36,8 @@
>
> #define STRAP_READ (0x0C)
> #define STRAP_READ_USE_SGMII_EN_ BIT(22)
> +#define STRAP_SFP_USE_EN_ BIT(31)
> +#define STRAP_SFP_EN_ BIT(15)
> #define STRAP_READ_SGMII_EN_ BIT(6)
> #define STRAP_READ_SGMII_REFCLK_ BIT(5)
> #define STRAP_READ_SGMII_2_5G_ BIT(4)
> @@ -1079,6 +1081,7 @@ struct lan743x_adapter {
> u8 max_tx_channels;
> u8 used_tx_channels;
> u8 max_vector_count;
> + bool is_sfp_support_en;
>
> #define LAN743X_ADAPTER_FLAG_OTP BIT(0)
> u32 flags;
next prev parent reply other threads:[~2024-09-11 16:45 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-11 16:10 [PATCH net-next V2 0/5] Add support to SFP for PCI11x1x chips Raju Lakkaraju
2024-09-11 16:10 ` [PATCH net-next V2 1/5] net: lan743x: Add SFP support check flag Raju Lakkaraju
2024-09-11 16:44 ` Christophe JAILLET [this message]
2024-09-12 6:12 ` Raju Lakkaraju
2024-09-11 17:06 ` Andrew Lunn
2024-09-12 6:29 ` Raju Lakkaraju
2024-09-12 14:52 ` Andrew Lunn
2024-09-12 15:36 ` Ronnie.Kunin
2024-09-12 15:58 ` Andrew Lunn
2024-09-12 16:36 ` Ronnie.Kunin
2024-09-16 18:41 ` Russell King (Oracle)
2024-09-16 18:30 ` Russell King (Oracle)
2024-09-11 16:10 ` [PATCH net-next V2 2/5] net: lan743x: Add support to software-nodes for sfp Raju Lakkaraju
2024-09-11 16:54 ` Christophe JAILLET
2024-09-12 6:32 ` Raju Lakkaraju
2024-09-16 19:31 ` Russell King (Oracle)
2024-09-16 20:37 ` Andrew Lunn
2024-09-11 17:17 ` Andrew Lunn
2024-09-12 6:38 ` Raju Lakkaraju
2024-09-12 15:19 ` Andrew Lunn
2024-09-16 19:34 ` Russell King (Oracle)
2024-09-14 17:37 ` kernel test robot
2024-09-11 16:10 ` [PATCH net-next V2 3/5] net: lan743x: Register the platform device for sfp pluggable module Raju Lakkaraju
2024-09-15 2:16 ` kernel test robot
2024-09-11 16:10 ` [PATCH net-next V2 4/5] net: lan743x: Implement phylink pcs Raju Lakkaraju
2024-09-11 17:24 ` Maxime Chevallier
2024-09-12 6:46 ` Raju Lakkaraju
2024-09-11 17:26 ` Andrew Lunn
2024-09-12 6:53 ` Raju Lakkaraju
2024-09-12 15:28 ` Andrew Lunn
2024-09-12 16:04 ` Ronnie.Kunin
2024-09-12 16:13 ` Andrew Lunn
2024-09-12 18:51 ` Ronnie.Kunin
2024-09-12 19:37 ` Andrew Lunn
2024-09-13 8:54 ` Raju Lakkaraju - I30499
2024-09-13 13:19 ` Andrew Lunn
2024-09-13 14:23 ` Ronnie.Kunin
2024-09-13 15:03 ` Andrew Lunn
2024-09-13 22:53 ` Ronnie.Kunin
2024-09-14 14:39 ` Andrew Lunn
2024-09-11 16:10 ` [PATCH net-next V2 5/5] net: lan743x: Add Support for 2.5G SFP with 2500Base-X Interface Raju Lakkaraju
2024-09-11 17:31 ` Andrew Lunn
2024-09-11 20:01 ` Maxime Chevallier
2024-09-12 7:01 ` Raju Lakkaraju
2024-09-12 11:49 ` Maxime Chevallier
2024-09-12 7:04 ` Raju Lakkaraju
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=e542d2fc-0587-45a3-bc58-ee0a078a626a@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=Raju.Lakkaraju@microchip.com \
--cc=Steen.Hegelund@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=bryan.whitehead@microchip.com \
--cc=daniel.machon@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rdunlap@infradead.org \
/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
all inboxes | Powered by JetHome®