Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

SFP link/speed detection - NicheStack

Hi,

I am using NiosII + ucOSii + NicheStack in a webserver application. Instead of a regular MDIO-accessible PHY device I am using a SFP cage compatible with any standard SFP module (i2c accessible, various vendors).

When NicheStack is started it warns about not finding a PHY on mdio, assumes default link and speed (100 Mbps) and then operates correctly.


> SFP1 Link status changed: UP. Starting NicheStack...
InterNiche Portable TCP/IP, v3.1
Copyright 1996-2008 by InterNiche Technologies. All rights reserved.
prep_tse_mac 0
MAC Address: 00:07:ED:12:34:56
(*) Static IP Address is 172.16.100.50
prepped 1 interface, initializing...
INFO    : TSE MAC 0 found at address 0x0c013000
WARNING : MAC Groups->pmac_info MDIO is not used, unable to run PHY detection
INFO    : PCS - Configuring PCS operating mode
INFO    : PCS - PCS SGMII mode enabled
Created "Inet main" task (Prio: 2)
Created "clock tick" task (Prio: 3)
WARNING : MAC Group - MDIO not enabled! Speed = 100, Duplex = Full
OK, x=1, CMD_CONFIG=0x00000000
MAC post-initialization: CMD_CONFIG=0x04000203
 RX descriptor chain desc (1 depth) created
mctest init called
IP address of et1 : 172.16.100.50
Created "web server" task (Prio: 11)

Is there a possiblity to add a generic driver for SFP devices? The alt_tse_phy_add_profile method only seems to work if vendor/revision/OUI/model are precisely known. I want my application to accept/recognize any SFP module, as the register interface (i2c accessible) is JEDEC-standardized so from an operation point of view it wouldn't matter who produced it.

The functions for getting link/speed indication over i2c I already have.

What is the way to create a driver in such a case?

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The driver is built with PHYs using MDIO in mind, so to support the SFP modules I think you will have to make your own driver. You can probably make a copy of the existing TSE driver and modify yourself the functions that detect the PHY and its speed.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Skimming altera_avalon_tse.c, it's not immediately obvious how to exactly accomplish it, but it looks like you want to declare your own instance of 'alt_tse_system_phy' with your own 'tse_phy_cfg' function, and register that via alt_tse_system_add_sys().

    Search altera_avalon_tse.c for that printf "MDIO not enabled! Speed = " and you'll find the if() else() clause where the existing software would have liked to run your user-supplied function tse_phy_cfg().

    Good luck.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Skimming altera_avalon_tse.c, it's not immediately obvious how to exactly accomplish it, but it looks like you want to declare your own instance of 'alt_tse_system_phy' with your own 'tse_phy_cfg' function, and register that via alt_tse_system_add_sys().

    Search altera_avalon_tse.c for that printf "MDIO not enabled! Speed = " and you'll find the if() else() clause where the existing software would have liked to run your user-supplied function tse_phy_cfg().

    Good luck.

    --- Quote End ---

    This I also had in mind, but it is not the ideal solution cause I have to touch BSP files --> can create problems later the BSP gets regenerated with a later release of stack. I was hoping for a non-intrusive way, but seems there's no such way... I'll go with it then.

    Thanks!