2008-10-27 07:45:11     Reading Phy registers

Document created by Aaronwu Employee on Aug 8, 2013
Version 1Show Document
  • View in full screen mode

2008-10-27 07:45:11     Reading Phy registers

Joao Paulo Bodanese (BRAZIL)

Message: 64229   

 

Hi,

 

 

 

I need to read and printk the phy registers below. Anyone could help me which file do i have to modify?

 

 

Register 0h- Basic Control( Speed Select, Auto-negotiation Enable,

Power-Down, Disable Transmitter);

 

Register 1h - Basic Status (Link Status);

Register 15h - RXER Counter

Register 1Eh - Phy control 1(MDI/MDIX);

Register 1Fh - Phy Control 2 (Energy Detect, Auto-negotiation complete,

Operation Mode Indication);

 

 

 

Regards,

 

Joao Paulo

QuoteReplyEditDelete

 

 

2008-10-27 10:53:29     Re: Reading Phy registers

Robin Getz (UNITED STATES)

Message: 64232   

 

Joao Paulo:

 

I think the best thing to do would be to expose the raw phy registers in sys/class/net/eth0/phy or something like that. (during phy_driver_register())

 

The file is linux-2.6.x/drivers/net/phy/* just use the generic functions - phy_read()

 

-Robin

QuoteReplyEditDelete

 

 

2008-10-27 15:02:17     Re: Reading Phy registers

Joao Paulo Bodanese (BRAZIL)

Message: 64245   

 

Hi Robin,

 

We are using the phy Micrel KSZ8041TL. Doesn't exist support to this chip in linux-2.6.x/drivers/net/phy/

 

I am going to write my own module, but i think i need some informations like the scruct below (found in marvell.c)

 

static struct phy_driver m88e1101_driver = {

    .phy_id        = 0x01410c00,

    .phy_id_mask    = 0xffffff00,

    .name        = "Marvell 88E1101",

    .features    = PHY_GBIT_FEATURES,

    .flags        = PHY_HAS_INTERRUPT,

    .config_aneg    = &marvell_config_aneg,

    .read_status    = &genphy_read_status,

    .ack_interrupt    = &marvell_ack_interrupt,

    .config_intr    = &marvell_config_intr,

    .driver     = { .owner = THIS_MODULE,},

};

 

static int __init marvell_init(void)

{

    return phy_driver_register(&m88e1101_driver);

}

 

Any idea?

 

 

 

Regards,

 

João Paulo

 

 

 

 

 

 

 

 

 

 

QuoteReplyEditDelete

 

 

2008-10-27 15:06:10     Re: Reading Phy registers

Mike Frysinger (UNITED STATES)

Message: 64246   

 

have you tried the generic phy driver ?  what hardware exactly are you trying to hook this PHY up to ?

QuoteReplyEditDelete

 

 

2008-10-27 15:14:07     Re: Reading Phy registers

Joao Paulo Bodanese (BRAZIL)

Message: 64247   

 

Mike:

 

Do you mean phy_device.c ? No, i didn't tried yet.

 

 

 

The hardware is an IPBX based on Astfin.

 

 

 

Thanks

QuoteReplyEditDelete

 

 

2008-10-28 11:17:28     Re: Reading Phy registers

Joao Paulo Bodanese (BRAZIL)

Message: 64284   

 

I am writing a test code to read the phy register of the SMSC LAN83C185 (STAMP BF537) to validade first.

 

I've compiled smsc.c and run successfully.

 

In order to use the funcion phy_read(struct phy_device *phydev, u16 regnum), i have to pass the struct phy_device *phydev. To create this struct, it's necessary to call the function phy_device_create(struct mii_bus *bus, int addr, int phy_id).

 

My doubt is how fill the arguments mii_bus, addr and phy_id. I have not found any example using these modules.

 

 

 

Any ideia?

 

 

 

Thanks

 

 

QuoteReplyEditDelete

 

 

2008-10-28 16:48:33     Re: Reading Phy registers

Mike Frysinger (UNITED STATES)

Message: 64295   

 

i'm pretty sure the higher levels fill those in, not the phy driver

QuoteReplyEditDelete

 

 

2008-10-29 11:40:29     Re: Reading Phy registers

Joao Paulo Bodanese (BRAZIL)

Message: 64358   

 

Where is the exactly directory location of the file that control the Stamp Phy?

 

 

 

Thnks

QuoteReplyEditDelete

 

 

2008-10-29 11:45:04     Re: Reading Phy registers

Mike Frysinger (UNITED STATES)

Message: 64360   

 

all phy drivers live in drivers/net/phy/

QuoteReplyEditDelete

 

 

2008-10-29 12:07:54     Re: Reading Phy registers

Joao Paulo Bodanese (BRAZIL)

Message: 64362   

 

Mike,

 

By kernel configuration default, the directory drivers/net/phy/ is not compiled.

 

For this reason, i think exist other file that manage the phy...

 

You can verify in "Device Drivers -> Network Device Support -> Phy Device Support" is not checked.

 

 

 

Thanks

QuoteReplyEditDelete

 

 

2008-10-29 12:10:43     Re: Reading Phy registers

Mike Frysinger (UNITED STATES)

Message: 64363   

 

if it isnt checked, then the phy framework isnt being used.  there is no requirement that says the phy framework must be used ... there are plenty of drivers which do not use it.

 

QuoteReplyEditDelete

 

 

2008-10-29 16:59:47     Re: Reading Phy registers

Robin Getz (UNITED STATES)

Message: 64385   

 

Joao Paulo:

 

Normally chips with MAC/PHY do not use the phy lib - parts with standalone MAC that expose a MII or RMII interface, which connect to an external PHY do.

 

-Robin

Attachments

    Outcomes