From: Andrew Lunn <andrew@lunn.ch>
To: Mengyuan Lou <mengyuanlou@net-swift.com>
Cc: netdev@vger.kernel.org, jiawenwu@trustnetic.com
Subject: Re: [PATCH net-next 1/5] net: txgbe: Identify PHY and SFP module
Date: Tue, 8 Nov 2022 21:52:51 +0100 [thread overview]
Message-ID: <Y2rBo3KI2LmjS55y@lunn.ch> (raw)
In-Reply-To: <20221108111907.48599-2-mengyuanlou@net-swift.com>
> +/**
> + * txgbe_identify_sfp_module - Identifies SFP modules
> + * @hw: pointer to hardware structure
> + *
> + * Searches for and identifies the SFP module and assigns appropriate PHY type.
> + **/
> +static int txgbe_identify_sfp_module(struct txgbe_hw *hw)
> +{
> + u8 oui_bytes[3] = {0, 0, 0};
> + u8 comp_codes_10g = 0;
> + u8 comp_codes_1g = 0;
> + int status = -EFAULT;
> + u32 vendor_oui = 0;
> + u8 identifier = 0;
> + u8 cable_tech = 0;
> + u8 cable_spec = 0;
> +
> + /* LAN ID is needed for I2C access */
> + txgbe_init_i2c(hw);
> +
> + status = txgbe_read_i2c_eeprom(hw, TXGBE_SFF_IDENTIFIER, &identifier);
> + if (status != 0)
> + goto err_read_i2c_eeprom;
> +
> + if (identifier != TXGBE_SFF_IDENTIFIER_SFP) {
> + hw->phy.type = txgbe_phy_sfp_unsupported;
> + status = -ENODEV;
> + } else {
> + status = txgbe_read_i2c_eeprom(hw, TXGBE_SFF_1GBE_COMP_CODES,
> + &comp_codes_1g);
> + if (status != 0)
> + goto err_read_i2c_eeprom;
> +
> + status = txgbe_read_i2c_eeprom(hw, TXGBE_SFF_10GBE_COMP_CODES,
> + &comp_codes_10g);
> + if (status != 0)
> + goto err_read_i2c_eeprom;
> +
> + status = txgbe_read_i2c_eeprom(hw, TXGBE_SFF_CABLE_TECHNOLOGY,
> + &cable_tech);
> + if (status != 0)
> + goto err_read_i2c_eeprom;
> +
> + /* ID Module
> + * =========
> + * 1 SFP_DA_CORE
> + * 2 SFP_SR/LR_CORE
> + * 3 SFP_act_lmt_DA_CORE
> + * 4 SFP_1g_cu_CORE
> + * 5 SFP_1g_sx_CORE
> + * 6 SFP_1g_lx_CORE
> + */
So it looks like you have Linux driving the SFP, not firmware. In that
case, please throw all this code away. Implement a standard Linux I2C
bus master driver, and make use of driver/net/phy/sfp*.[ch].
Andrew
next prev parent reply other threads:[~2022-11-08 20:52 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-08 11:19 [PATCH net-next 0/5] net: WangXun ethernet drivers Mengyuan Lou
2022-11-08 11:19 ` [PATCH net-next 1/5] net: txgbe: Identify PHY and SFP module Mengyuan Lou
2022-11-08 20:52 ` Andrew Lunn [this message]
2022-11-09 6:32 ` Jiawen Wu
2022-11-09 13:26 ` Andrew Lunn
2022-11-14 9:34 ` Jiawen Wu
2022-11-14 13:25 ` Andrew Lunn
2022-11-29 8:20 ` Jiawen Wu
2022-11-14 15:34 ` Alexander Lobakin
2022-11-14 20:18 ` Andrew Lunn
2022-11-08 11:19 ` [PATCH net-next 2/5] net: txgbe: Initialize service task Mengyuan Lou
2022-11-08 23:55 ` Jakub Kicinski
2022-11-09 2:16 ` Jiawen Wu
2022-11-09 2:36 ` Andrew Lunn
2022-11-14 15:39 ` Alexander Lobakin
2022-11-08 11:19 ` [PATCH net-next 3/5] net: txgbe: Support to setup link Mengyuan Lou
2022-11-08 21:03 ` Andrew Lunn
2022-11-14 15:48 ` Alexander Lobakin
2022-11-14 20:20 ` Andrew Lunn
2022-11-08 11:19 ` [PATCH net-next 4/5] net: ngbe: Initialize phy information Mengyuan Lou
2022-11-08 21:10 ` Andrew Lunn
2022-11-11 3:13 ` mengyuanlou
2022-11-11 3:28 ` Andrew Lunn
2022-11-14 16:16 ` Alexander Lobakin
2022-11-08 11:19 ` [PATCH net-next 5/5] net: ngbe: Initialize service task Mengyuan Lou
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=Y2rBo3KI2LmjS55y@lunn.ch \
--to=andrew@lunn.ch \
--cc=jiawenwu@trustnetic.com \
--cc=mengyuanlou@net-swift.com \
--cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).