[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <003801d903cb$74c5ba20$5e512e60$@trustnetic.com>
Date: Tue, 29 Nov 2022 16:20:35 +0800
From: Jiawen Wu <jiawenwu@...stnetic.com>
To: "'Andrew Lunn'" <andrew@...n.ch>
Cc: "'Mengyuan Lou'" <mengyuanlou@...-swift.com>,
<netdev@...r.kernel.org>
Subject: RE: [PATCH net-next 1/5] net: txgbe: Identify PHY and SFP module
> The SFP driver is currently device tree only, but it should be easy to add support for a platform
device and
> platform data. That driver needs to be told about a standard Linux i2c master device, and
optionally a
> collection of GPIO which connect to the SFP socket.
>
> So you need to implement a standard Linux I2C bus master. Which basically means being able to send
> and receive an I2C message. Take a look at for example drivers/net/ethernet/mellanox/mlxsw/i2c.c .
> This driver however does not use it with the SFP driver, since the Mellanox devices have firmware
> controlling the SFP. But it will give you the idea how you can embed an I2C bus driver inside
another
> driver.
>
> For the GPIOs to the SFP socket, TX Enable, LOS, MODDEF etc, you want a standard Linux GPIO
driver.
> For an example, look at drivers/net/dsa/vitesse-vsc73xx-core.c.
>
> https://github.com/lunn/linux/blob/v5.0.7-rap/drivers/platform/x86/zii-rap.c
> contains an example of registering a bit-bang MDIO controller. zii_rap_mdio_gpiod_table would
become
> a list of SFP GPIOs. zii_rap_mdio_init() registers a platform devices which instantiaces an MDIO
bus. You
> would register a platform device which instantiates an SFP device.
>
> Once you have an SFP devices you need to extend phylink with a platform data binding. So you can
pass it
> your SFP device.
>
> This should all be reasonably simple code.
>
> Andrew
>
Hi Andrew,
I have encountered some difficulties.
When I register a platform device for SFP, then it matches the SFP driver by name. I found that SFP
driver needs to find I2C adapter by device node.
Which device node it needs? There was no device node when I created the I2C device. So it always
probe failed.
Could you please give me some guidance? Thanks.
Powered by blists - more mailing lists