mx53 ethernet mdiobus_read or fec_enet_mdio_read

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

mx53 ethernet mdiobus_read or fec_enet_mdio_read

1,027 Views
yektaayduk
Contributor II

Dear Members,

I'm using Micrel  KSZ8051 and KSZ8031 ethernet Phy devices on my mx53 board.

Linux driver codes for these devices are existing ,but their .config_init  , .read_status implementations are calling phy_read and phy_write functions ,

which are calling at the end mdiobus_read and mdiobus_write functions  implemented  in /linux/drivers/net/phy/mdio_bus.c

For imx we have  fec_enet_mdio_read  and fec_enet_mdio_write functions  in /drivers/net/fec.c

My question is:  can we load and use  existing micrel kernel modules or should we reimplement them

using  fec_enet_mdio_read  and fec_enet_mdio_write functions ?

Also I couldn't find any  test for fec  in  BSP imx_test folder ?

Labels (2)
0 Kudos
2 Replies

567 Views
jimmychan
NXP TechSupport
NXP TechSupport

I look into the mx53_loco.c (as an example), there are just setting the IOMUX for the FEC pins and the GPIO pin for resetting the PHY. There is not using any driver for the PHY. If you need to use driver functions, I think you don't need to reimplement them to fec_enet_mdio_read and fec_enet_mdio_write functions .

0 Kudos

567 Views
yektaayduk
Contributor II

You are right ,re-implementation is not necessary .( But I didnt verified this  yet on my board )

I think the answer is function pointers :

If the the function  fec_enet_mii_probe  in /drivers/net/fec.c is called ,the standart linux phy acess functions mii_bus-> read  and mii_bus-> write  will be changed to  fec_enet_mdio_read and fec_enet_mdio_write functions .

in /drivers/net/fec.c :

static int fec_enet_mii_probe(struct net_device *dev)

{

...

  fep->mii_bus->name = "fec_enet_mii_bus";

  fep->mii_bus->read = fec_enet_mdio_read;

  fep->mii_bus->write = fec_enet_mdio_write;

  fep->mii_bus->reset = fec_enet_mdio_reset;

..

}

include/linux/phy.h :

struct mii_bus {

  const char *name;

  char id[MII_BUS_ID_SIZE];

  void *priv;

  int (*read)(struct mii_bus *bus, int phy_id, int regnum);

  int (*write)(struct mii_bus *bus, int phy_id, int regnum, u16 val);

  int (*reset)(struct mii_bus *bus);

..

}




0 Kudos