RFC: au1000_etc.c phylib rewrite
Subsystems (3)
hello *,
I've started to rewrite the au1000_eth.c driver to make use of the new PHY framework in 2.6.x; see the attached patch for the current work in progress state;
I'm a bit unsure what to do about those workarounds/hacks that are in the original au1000_eth.c driver (e.g. for the broadcom dual PHY);
any comments/ideas? shall I continue work on this au1xxx-eth phylib-rewrite, or is it of no use?
regards,
hvr
drivers/net/Kconfig +1 -0
@@ -455,6 +455,7 @@ config MIPS_GT96100ETH config MIPS_AU1X00_ENET bool "MIPS AU1000 Ethernet support" depends on NET_ETHERNET && SOC_AU1X00 + select PHYLIB select CRC32 help If you have an Alchemy Semi AU1X00 based system
drivers/net/au1000_eth.c +154 -1009
1,355 lines not on this page · raw message
drivers/net/au1000_eth.h +9 -112
153 lines not on this page · raw message
Quoted 8 lines · Herbert Valerio Riedel
hello *,
I've started to rewrite the
au1000_eth.cdriver to make use of the new PHY framework in 2.6.x; see the attached patch for the current work in progress state;I'm a bit unsure what to do about those workarounds/hacks that are in the original
au1000_eth.cdriver (e.g. for the broadcom dual PHY);
Maybe you should dump that bcm dual phy support. I can't remember what board it was on and whether that board is even supported still.
Quoted 2 lines
any comments/ideas? shall I continue work on this au1xxx-eth phylib-rewrite, or is it of no use?
Seems like a good idea to me.
Pete
Quoted 2 lines · Pete Popov
Maybe you should dump that bcm dual phy support. I can't remember what board it was on and whether that board is even supported still.
XXS1500 definetly uses it, and is still supported last time I checked. If not, just drop me a line, and I'll check up on it, as I have the unit, and made use of both network links.
Signature · 3 lines
Robin Hugh Johnson E-Mail : [email protected] GnuPG FP : 11AC BA4F 4778 E3F6 E4ED F38E B27B 944E 3488 4E85
The Cogent CSB655 used the Broadcom Dual Phy. They eventually redesigned the board and switched to two single Broadcom phys, but they continued to control both phys through MAC0, which is the actual purpose of the dual-phy hack. I am a user of the CSB655, so I sort of care.
Will the new PHY framework allow a second PHY for a second MAC (MAC1) be controlled from the first MAC's (MAC0) mdio interface?
Yes, I acknowledge this was a bad design, but its what I am stuck with.
-Mark
Quoted 19 lines · Pete Popov
Quoted 8 lines · Herbert Valerio Riedel
hello *,
I've started to rewrite the
au1000_eth.cdriver to make use of the new PHY framework in 2.6.x; see the attached patch for the current work in progress state;I'm a bit unsure what to do about those workarounds/hacks that are in the original
au1000_eth.cdriver (e.g. for the broadcom dual PHY);Maybe you should dump that bcm dual phy support. I can't remember what board it was on and whether that board is even supported still.
Quoted 2 lines
any comments/ideas? shall I continue work on this au1xxx-eth phylib-rewrite, or is it of no use?
Seems like a good idea to me.
Pete
Quoted 7 lines · Mark Schank
The Cogent CSB655 used the Broadcom Dual Phy. They eventually redesigned the board and switched to two single Broadcom phys, but they continued to control both phys through MAC0, which is the actual purpose of the dual-phy hack. I am a user of the CSB655, so I sort of care.
Will the new PHY framework allow a second PHY for a second MAC (MAC1) be controlled from the first MAC's (MAC0) mdio interface?
should'nt be a problem (as opposed to the bosporus case... see below)... I assume the phy-addresses on which the boarcom dual phy is configured are the same for all Cogent CSB655 boards?
does this need to be autodetected dynamically at runtime, or can we rely on a compile time Kconfig-conditional to set a static phy-addr<->eth% d-phy mapping for this board-specific case? Or de we really need such a complex mii_probe() function to detect weird scenarios? :)
using static phy addr mappings would also allow for setting board-specific phy-irq assignments, which would then be handled by the phylib facilities, instead of polling the status of phy with a timer; (and in case we don't have any board-specific compile time setting, we can still fall back to search the phy-addresses for a PHY at runtime as the generic case)
while at it, what about that CONFIG_MIPS_BOSPORUS special case? why doesn't the 2nd MAC see any PHY? how is the 2nd MAC connected to the physical world?
#ifdef CONFIG_MIPS_BOSPORUS
/* This is a workaround for the Micrel/Kendin 5 port switch
The second MAC doesn't see a PHY connected... so we need to trick it into thinking we have one.
If this kernel is run on another Au1500 development board the stub will be found as well as the actual PHY. However, the last found PHY will be used... usually at Addr 31 (Db1500).
*/
Quoted 1 line
Yes, I acknowledge this was a bad design, but its what I am stuck with.
:-)
Signature · 1 line
Herbert Valerio Riedel <[email protected]>
Quoted 5 lines · Herbert Valerio Riedel
Quoted 3 lines · Mark Schank
The Cogent CSB655 used the Broadcom Dual Phy. They eventually redesigned the board and switched to two single Broadcom phys, but they continued to control both phys through MAC0, which is the actual purpose of the
dual-phy
Quoted 8 lines
Quoted 4 lines
hack. I am a user of the CSB655, so I sort of care.
Will the new PHY framework allow a second PHY for a second MAC (MAC1) be controlled from the first MAC's (MAC0) mdio interface?
should'nt be a problem (as opposed to the bosporus case... see below)... I assume the phy-addresses on which the boarcom dual phy is configured are the same for all Cogent CSB655 boards?
Dual PHY configuration:
MAC0 - phy addr 4
MAC1 - phy addr 3
Single PHY configuration:
MAC0 - phy addr 1
MAC1 - phy addr 0
Quoted 4 lines
does this need to be autodetected dynamically at runtime, or can we rely on a compile time Kconfig-conditional to set a static phy-addr<->eth% d-phy mapping for this board-specific case? Or de we really need such a complex
mii_probe()function to detect weird scenarios? :)
The compile time Kconfig-conditional should be okay. The driver need to handle the fact that the MAC1's phy is controlled by MAC0's mdio interface. This means that MAC0 controller can not be disabled when the associated eth% device is down, otherwise you lose the ability to control MAC1's phy.
Quoted 6 lines
using static phy addr mappings would also allow for setting board-specific phy-irq assignments, which would then be handled by the phylib facilities, instead of polling the status of phy with a timer; (and in case we don't have any board-specific compile time setting, we can still fall back to search the phy-addresses for a PHY at runtime as the generic case)
Will the phylib facilities handle the case where two phys share a single IRQ?
Quoted 3 lines
while at it, what about that
CONFIG_MIPS_BOSPORUSspecial case? why doesn't the 2nd MAC see any PHY? how is the 2nd MAC connected to the physical world?
I don't have first hand knowledge of this board, but I have worked with Kendin switches before. They have a special port that allows direct connection of a MAC into the switch port without the use of a phy. The MAC's MII is directly connected to the switch ports MII. So instead of this:
MAC <-> PHY <->PHY <-> Switch_Port
You have this:
MAC <-> Switch_PortSo the MAC talks to the physical world via the switch.
Quoted 16 lines
#ifdef
CONFIG_MIPS_BOSPORUS
/* This is a workaround for the Micrel/Kendin 5 port switch
The second MAC doesn't see a PHY connected... so we need to trick it into thinking we have one.If this kernel is run on another Au1500 development board the stub will be found as well as the actual PHY. However, the last found PHY will be used... usually at Addr 31 (Db1500).
*/Quoted 1 line
Yes, I acknowledge this was a bad design, but its what I am stuck with.
:-)
--
Herbert Valerio Riedel <[email protected]>
hello *
Quoted 15 lines · Mark Schank
Quoted 5 lines · Herbert Valerio Riedel
Quoted 3 lines · Mark Schank
The Cogent CSB655 used the Broadcom Dual Phy. They eventually redesigned the board and switched to two single Broadcom phys, but they continued to control both phys through MAC0, which is the actual purpose of the
dual-phy
Quoted 8 lines
Quoted 4 lines
hack. I am a user of the CSB655, so I sort of care.
Will the new PHY framework allow a second PHY for a second MAC (MAC1) be controlled from the first MAC's (MAC0) mdio interface?
should'nt be a problem (as opposed to the bosporus case... see below)... I assume the phy-addresses on which the boarcom dual phy is configured are the same for all Cogent CSB655 boards?
Quoted 6 lines
Dual PHY configuration:
MAC0 - phy addr 4
MAC1 - phy addr 3
Single PHY configuration:
MAC0 - phy addr 1
MAC1 - phy addr 0
while at it, does anyone happen to know what the phy-addr/MAC assignment on the XXS1500 is?
Quoted 10 lines
Quoted 4 lines
does this need to be autodetected dynamically at runtime, or can we rely on a compile time Kconfig-conditional to set a static phy-addr<->eth% d-phy mapping for this board-specific case? Or de we really need such a complex
mii_probe()function to detect weird scenarios? :)The compile time Kconfig-conditional should be okay. The driver need to handle the fact that the MAC1's phy is controlled by MAC0's mdio interface. This means that MAC0 controller can not be disabled when the associated eth% device is down, otherwise you lose the ability to control MAC1's phy.
...or at least, the MAC associated with the particular MII bus should be brought up if necessary before any mdio access (that's what I'm implementing right now)
but one thing that seems strange to me; CONFIG_BCM5222_DUAL_PHY doesn't seem to be defined anywhere; shouldn't that be at least defined in some Kconfig file, especially if the XXS1550 board is supposed to make use of it?
btw, is the CSB655 supported at all in the 2.6 linux-mips branch, I couldn't find any mention of it in Kconfig files either?
Quoted 8 lines
Quoted 6 lines
using static phy addr mappings would also allow for setting board-specific phy-irq assignments, which would then be handled by the phylib facilities, instead of polling the status of phy with a timer; (and in case we don't have any board-specific compile time setting, we can still fall back to search the phy-addresses for a PHY at runtime as the generic case)
Will the phylib facilities handle the case where two phys share a single IRQ?
afaics from the source, it doesn't handle the case of multiplexed phy notification irqs; although the interrupt is requested with the SA_SHIRQ flag, the first phy-interrupt-handler to be called already returns IRQ_HANDLED... doesn't feel right in some way ;-)
Quoted 8 lines
Quoted 3 lines
while at it, what about that
CONFIG_MIPS_BOSPORUSspecial case? why doesn't the 2nd MAC see any PHY? how is the 2nd MAC connected to the physical world?I don't have first hand knowledge of this board, but I have worked with Kendin switches before. They have a special port that allows direct connection of a MAC into the switch port without the use of a phy. The MAC's MII is directly connected to the switch ports MII. So instead of this:
Quoted 5 lines
MAC <-> PHY <->PHY <-> Switch_Port You have this: MAC <-> Switch_PortSo the MAC talks to the physical world via the switch.
thx; in the meantime, I've happened to find the board schematics and the switch data-sheet in order to understand the situation better
regards,
hvr
Herbert,
Quoted 2 lines
btw, is the CSB655 supported at all in the 2.6 linux-mips branch, I couldn't find any mention of it in
Kconfigfiles either?
The CSB655 makes use of some of these seeming "unused" options, but the board specific code for the CSB655 was never submitted back to linux-mips tree. I did not develop of any of this code, so I am not sure of the reason why it was not submitted back. I received the code when I purchased a CSB655/955 developers kit and have since ported portions of it forward to the 2.6.16 branch. I am willing to submit what I have done, but I don't want to step on the original developers toes. There were also several changes I had to make to generic MIPs and Linux code, and I am not sure of the proper way to handle them in the general linux-mips tree.
-Mark
Quoted 2 lines · Herbert Valerio Riedel
while at it, does anyone happen to know what the phy-addr/MAC assignment on the XXS1500 is?
Nope.
Quoted 4 lines
but one thing that seems strange to me;
CONFIG_BCM5222_DUAL_PHYdoesn't seem to be defined anywhere; shouldn't that be at least defined in someKconfigfile, especially if the XXS1550 board is supposed to make use of it?
Hmm, I do recall submitting a patch previously that added 'select BCM5222_DUAL_PHY' for the XXS1500 unit.
Signature · 3 lines
Robin Hugh Johnson E-Mail : [email protected] GnuPG FP : 11AC BA4F 4778 E3F6 E4ED F38E B27B 944E 3488 4E85
RFC: new WIP version of au1000_eth.c phylib conversion (was Re: RFC: au1000_etc.c phylib rewrite)
In reply to Herbert Valerio RiedelHello,
I've tried to adapt the PHY detection code to allow for dynamic runtime configuration (with fallback to search for the 2nd MAC PHY on the 1st MAC's MII bus), as well as selectable static PHY configuration through Kconfig (e.g. for supporting PHYs w/o MII connection)
e.g. for a MIPS BOSPORUS board, one would set something like through Kconfig (haven't bothered yet, to autoselect this when MIPS_BOSPORUS is defined):
CONFIG_MIPS_AU1X00_ENET=yCONFIG_MIPS_AU1X00_ENET_STATIC_PHY_CONFIG=yCONFIG_MIPS_AU1X00_ENET_ETH0_PHY_ADDR=5CONFIG_MIPS_AU1X00_ENET_ETH1_PHY_ON_MAC0=yCONFIG_MIPS_AU1X00_ENET_ETH1_PHY_ADDR=-1
the default dynamic runtime PHY search behaviour is now to find the lowest phy_addr containing a living PHY (which is not already claimed by another MAC) on the MAC's current MII bus, and if not found, try again on the first MAC's MII bus; and if that also fails eth initialization fails for the given MAC;
...well, if anyone has the time and hardware, testing would be greatly welcomed :-)
alas, this patch is rather big and I'd like to split it into smaller pieces, but imho it's an 'all or nothing' thing to convert to the PHY lib... :-/
Kconfig | 31 + au1000_eth.c | 1494 ++++++++++------------------------------------------------- au1000_eth.h | 132 ----- 3 files changed, 310 insertions(+), 1347 deletions(-)
regards,
hvr
drivers/net/Kconfig +31 -0
@@ -455,11 +455,42 @@ config MIPS_GT96100ETH config MIPS_AU1X00_ENET bool "MIPS AU1000 Ethernet support" depends on NET_ETHERNET && SOC_AU1X00 + select PHYLIB select CRC32 help If you have an Alchemy Semi AU1X00 based system say Y. Otherwise, say N. +config MIPS_AU1X00_ENET_STATIC_PHY_CONFIG + bool "Static PHY configuration" + depends on MIPS_AU1X00_ENET + default n + help + Say Y if you need to set a static PHY configuration. If you say N, the + driver will try to autodetect the PHY configuration. + +config MIPS_AU1X00_ENET_ETH0_PHY_ADDR + int "1st Ethernet's PHY address {-1,0..31}" + depends on MIPS_AU1X00_ENET_STATIC_PHY_CONFIG + help + Provide the PHY address of the first Dthernet device. + If the PHY has no PHY address, say "-1". + +config MIPS_AU1X00_ENET_ETH1_PHY_ON_MAC0 + bool "2nd Ethernet's PHY is attached to 1st MAC" + depends on MIPS_AU1X00_ENET_STATIC_PHY_CONFIG + default n + help + Say Y here, if the second Ethernet's PHY is attached to + the MII bus of the first MAC. + +config MIPS_AU1X00_ENET_ETH1_PHY_ADDR + int "2nd Ethernet's PHY address {-1,0..31}" + depends on MIPS_AU1X00_ENET_STATIC_PHY_CONFIG + help + Provide the PHY address of the second Ethernet device. + If the PHY has no PHY address, say "-1". + config SGI_IOC3_ETH bool "SGI IOC3 Ethernet" depends on NET_ETHERNET && PCI && SGI_IP27
drivers/net/au1000_eth.c +268 -1226
1,724 lines not on this page · raw message
drivers/net/au1000_eth.h +11 -121
158 lines not on this page · raw message
Re: RFC: new WIP version of au1000_eth.c phylib conversion (was Re: RFC: au1000_etc.c phylib rewrite)
Quoted 6 lines · Herbert Valerio Riedel
Hello,
I've tried to adapt the PHY detection code to allow for dynamic runtime configuration (with fallback to search for the 2nd MAC PHY on the 1st MAC's MII bus), as well as selectable static PHY configuration through
Kconfig(e.g. for supporting PHYs w/o MII connection)
Comments inline, below:
Quoted 5 lines
drivers/net/au1000_eth.c +0
-0@@ -9,6 +9,9 @@
[snip]
drivers/net/au1000_eth.c static unsigned char au1000_mac_addr[6] · line 142
Quoted 5 lines
drivers/net/au1000_eth.c +0
-5-/* FIXME -* All of the PHY code really should be detached from the MAC -* code. -*/ -
[snip]
Nothing to say so far, except seeing all those "-" signs was quite the thrill, since one of the goals of the phylib was to lead to reduced complexity. That said, it looked like there were about a dozen PHY-specific code blocks in there. I saw you submit one PHY driver. Were there others in there that could be ported?
[snip]
drivers/net/au1000_eth.c
Quoted 10 lines
+static int
mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum)
{drivers/net/au1000_eth.c +1
-1-int i, val; +struct net_device *const dev = bus->priv;/* beware: bus->phy_map [phy_addr].attached_dev == dev does _NOT_ hold always */
drivers/net/au1000_eth.c +1
-0+enable_mac (dev,0 );/* make sure MAC associated with this mii_bus is enabled */
drivers/net/au1000_eth.c +2
-0+return mdio_read (dev, phy_addr, regnum); +}
Why is attached_dev not always correct? I'm not sure if I'm not understanding the hardware (I'm unfamiliar with this NIC), or if you've misinterpreted the meaning of the attached_dev field. It's supposed to be a connection between the network device and a PHY, mainly used for allowing the PHY to signal state changes back to the ethernet device. Is it actually the case that there is one MAC being used for two PHYs at the same time? If so, how do you resolve which PHY's state gets used at any given moment?
The same question applies for the code in mdiobus_write()
[snip]
Quoted 15 lines
drivers/net/au1000_eth.c +1
-1-static int mii_probe (struct net_device * dev) +static int mdiobus_reset (struct mii_bus *bus){
drivers/net/au1000_eth.c +2
-10-struct au1000_private *aup = (struct au1000_private *) dev->priv; -int phy_addr; -#ifdef CONFIG_MIPS_BOSPORUS -int phy_found=0 ; -#endif +struct net_device *dev = bus->priv; -/* search for total of 32 possible mii phy addresses */ -for (phy_addr =0 ; phy_addr <32 ; phy_addr++) { -u16 mii_status; -u16 phy_id0, phy_id1; -int i; +enable_mac (dev,0 );/* make sure MAC associated with this mii_bus
Quoted 2 lines
is enabled */
Do you need to call enable_mac() every time? If it needs to be up, wouldn't it be easier to make sure it's up during bus initialization?
[snip]
Quoted 3 lines
aup->mac->control = control;drivers/net/au1000_eth.c +0
-0@@ -1685,57 +808,75 @@ static int au1000_init(struct net_device
[snip]
Quoted 13 lines
drivers/net/au1000_eth.c +13
-0+ +if (phydev->link && (aup->old_speed != phydev->speed)) { +// speed changed + +switch (phydev->speed) { +case 10 : +case 100 : +break ; +default : +printk (KERN_WARNING +"%s: Speed (%d) is not 10/100/1000 ??\n" , + dev->name, phydev->speed); +break ;
Quoted 1 line
}
Might want to change that to be "...not 10/100..." or add a case for 1000.
[snip]
Quoted 5 lines
drivers/net/au1000_eth.c +4
-0+spin_unlock_irqrestore (&aup->lock, flags); +if (status_change) { +phy_print_status (phydev); + }}
Stylistic issue (I've seen it a couple times, at least): don't use "{" and "}" if your block only has one line. ie:
if (status_change) phy_print_status(phydev);
Re: RFC: new WIP version of au1000_eth.c phylib conversion (was Re: RFC: au1000_etc.c phylib rewrite)
jfyi, yet another more recent snapshot is attached to this email...
Quoted 7 lines · Andy Fleming
Quoted 4 lines
I've tried to adapt the PHY detection code to allow for dynamic runtime configuration (with fallback to search for the 2nd MAC PHY on the 1st MAC's MII bus), as well as selectable static PHY configuration through
Kconfig(e.g. for supporting PHYs w/o MII connection)Comments inline, below:
Quoted 7 lines
[snip]
Nothing to say so far, except seeing all those "-" signs was quite the thrill, since one of the goals of the phylib was to lead to reduced complexity. That said, it looked like there were about a dozen PHY-specific code blocks in there. I saw you submit one PHY driver. Were there others in there that could be ported?
could well be, although I hope that most would work with the genphy driver out of the box; but I'm depending on other people here anyway to test it, since I don't have all kinds of evaluation boards available for testing myself... :-)
I submitted the SMSC phy driver, because that's a piece of hardware I had to play with...
Quoted 14 lines
[snip]
Review
Quoted 10 lines
+static int
mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum)
{(quoted diff) +1
-1- int i, val; + struct net_device *const dev = bus->priv; /* beware: bus->phy_map[phy_addr].attached_dev == dev does _NOT_ hold always */
(quoted diff) +1
-0+ enable_mac(dev, 0); /* make sure MAC associated with this mii_busis enabled */
(quoted diff) +2
-0+ return mdio_read(dev, phy_addr, regnum); +}
Quoted 7 lines
Why is
attached_devnot always correct? I'm not sure if I'm not understanding the hardware (I'm unfamiliar with this NIC), or if you've misinterpreted the meaning of theattached_devfield. It's supposed to be a connection between the network device and a PHY, mainly used for allowing the PHY to signal state changes back to the ethernet device. Is it actually the case that there is one MAC being used for two PHYs at the same time?
exactly; some au1xxxx based boards have so-called DualPHYs which provide two PHYs, but with only one MII interface...
Quoted 2 lines
If so, how do you resolve which
PHY's state gets used at any given moment?
the attached_dev points to the net_device for which the PHY state is relevant -- which might not be the net_device whose MII bus the PHY is attached to...
it's just that the net_device stored in the mii_bus->priv field points always to the "physical" net_device
and finally, each net_device has a pointer to its "logical" phy_dev
...does this answer your question? :-)
Quoted 16 lines
The same question applies for the code in
mdiobus_write()[snip]
Quoted 12 lines
(quoted diff) +1
-1-static int mii_probe (struct net_device * dev) +static int mdiobus_reset(struct mii_bus *bus){
(quoted diff) +1
-8- struct au1000_private *aup = (struct au1000_private *) dev->priv; - int phy_addr; -#ifdef CONFIG_MIPS_BOSPORUS - int phy_found=0; -#endif + struct net_device *dev = bus->priv; - /* search for total of 32 possible mii phy addresses */ - for (phy_addr = 0; phy_addr < 32; phy_addr++) { - u16 mii_status;
Quoted 8 lines
Quoted 5 lines
(quoted diff) +1
-2- u16 phy_id0, phy_id1; - int i; + enable_mac(dev, 0); /* make sure MAC associated with this mii_busis enabled */
Do you need to call
enable_mac()every time? If it needs to be up, wouldn't it be easier to make sure it's up during bus initialization?
it's actually a hack :-/ it's needed for the case where a PHY is attached to a MAC other than the state-associated one... as MAC can be powered down, when the eth is down, this allows to keep the MAC down if it's not needed, and also make sure it get's enabled again, in case something happened between mdiobus_reset and mdiobus_read/write
Quoted 3 lines
[snip]
Might want to change that to be "...not 10/100..." or add a case for 1000.
done...
Quoted 12 lines
[snip]
Quoted 5 lines
(quoted diff) +4
-0+ spin_unlock_irqrestore(&aup->lock, flags); + if (status_change) { + phy_print_status(phydev); + }}
Stylistic issue (I've seen it a couple times, at least): don't use "{" and "}" if your block only has one line.
ie:
Quoted 2 lines
if (status_change) phy_print_status(phydev);
you seem to have found one of the very few if(){single-line} cases I introduced... (and that particular one was even a placeholder which got bloated anyway :-))
regards,
hvr
drivers/net/Kconfig +0 -0
drivers/net/Kconfig +39 -0
@@ -455,11 +455,50 @@ config MIPS_AU1X00_ENET bool "MIPS AU1000 Ethernet support" depends on NET_ETHERNET && SOC_AU1X00 + select PHYLIB select CRC32 help If you have an Alchemy Semi AU1X00 based system say Y. Otherwise, say N. +config MIPS_AU1X00_ENET_STATIC_PHY_CONFIG + bool "Static PHY configuration" + depends on MIPS_AU1X00_ENET + default n + help + Say Y if you need to set a static PHY configuration. If you say N, the + driver will try to autodetect the PHY configuration. + +config MIPS_AU1X00_ENET_ETH0_PHY_ADDR + int "1st Ethernet's PHY address {-1,0..31}" + depends on MIPS_AU1X00_ENET_STATIC_PHY_CONFIG + help + Provide the PHY address of the first Dthernet device. + If the PHY has no PHY address, say "-1". + +config MIPS_AU1X00_ENET_ETH0_PHY_IRQ + int "1st Ethernet's PHY IRQ" + depends on MIPS_AU1X00_ENET_STATIC_PHY_CONFIG + +config MIPS_AU1X00_ENET_ETH1_PHY_ON_MAC0 + bool "2nd Ethernet's PHY is attached to 1st MAC" + depends on MIPS_AU1X00_ENET_STATIC_PHY_CONFIG + default n + help + Say Y here, if the second Ethernet's PHY is attached to + the MII bus of the first MAC. + +config MIPS_AU1X00_ENET_ETH1_PHY_ADDR + int "2nd Ethernet's PHY address {-1,0..31}" + depends on MIPS_AU1X00_ENET_STATIC_PHY_CONFIG + help + Provide the PHY address of the second Ethernet device. + If the PHY has no PHY address, say "-1". + +config MIPS_AU1X00_ENET_ETH1_PHY_IRQ + int "2nd Ethernet's PHY IRQ" + depends on MIPS_AU1X00_ENET_STATIC_PHY_CONFIG + config SGI_IOC3_ETH bool "SGI IOC3 Ethernet" depends on NET_ETHERNET && PCI && SGI_IP27
drivers/net/au1000_eth.c +332 -1247
1,833 lines not on this page · raw message
drivers/net/au1000_eth.h +11 -121
158 lines not on this page · raw message
Quoted 13 lines · Herbert Valerio Riedel
hello *
Quoted 10 lines · Mark Schank
Quoted 9 lines · Herbert Valerio Riedel
Quoted 3 lines · Mark Schank
The Cogent CSB655 used the Broadcom Dual Phy. They eventually redesigned the board and switched to two single Broadcom phys, but they continued to control both phys through MAC0, which is the actual purpose of the
dual-phy
Quoted 4 lines
hack. I am a user of the CSB655, so I sort of care.
Will the new PHY framework allow a second PHY for a second MAC (MAC1) be controlled from the first MAC's (MAC0) mdio interface?
That definitely isn't a problem (though it looks like you've probably figured that out). The original user (gianfar) has a similar setup, where all 2-4 NICs use TSEC0's MII interface to control the PHYs. It was actually one of the reasons for writing it in the first place--to more cleanly share that interface between several different device instances.
Quoted 46 lines
Quoted 11 lines
Quoted 4 lines
should'nt be a problem (as opposed to the bosporus case... see below)... I assume the phy-addresses on which the boarcom dual phy is configured are the same for all Cogent CSB655 boards?
Dual PHY configuration:
MAC0 - phy addr 4
MAC1 - phy addr 3
Single PHY configuration:
MAC0 - phy addr 1
MAC1 - phy addr 0while at it, does anyone happen to know what the phy-addr/MAC assignment on the XXS1500 is?
Quoted 11 lines
Quoted 5 lines
does this need to be autodetected dynamically at runtime, or can we rely on a compile time Kconfig-conditional to set a static phy-addr<-
Quoted 1 line
eth%
d-phy mapping for this board-specific case? Or de we really need such a complex
mii_probe()function to detect weird scenarios? :)The compile time Kconfig-conditional should be okay. The driver need to handle the fact that the MAC1's phy is controlled by MAC0's mdio interface. This means that MAC0 controller can not be disabled when the associated eth% device is down, otherwise you lose the ability to control MAC1's phy.
...or at least, the MAC associated with the particular MII bus should be brought up if necessary before any mdio access (that's what I'm implementing right now)
but one thing that seems strange to me;
CONFIG_BCM5222_DUAL_PHYdoesn't seem to be defined anywhere; shouldn't that be at least defined in someKconfigfile, especially if the XXS1550 board is supposed to make use of it?btw, is the CSB655 supported at all in the 2.6 linux-mips branch, I couldn't find any mention of it in
Kconfigfiles either?Quoted 7 lines
Quoted 6 lines
using static phy addr mappings would also allow for setting board-specific phy-irq assignments, which would then be handled by the phylib facilities, instead of polling the status of phy with a timer; (and in case we don't have any board-specific compile time setting, we can still fall back to search the phy-addresses for a PHY at runtime as the generic case)
Quoted 6 lines
Quoted 1 line
Will the phylib facilities handle the case where two phys share a single IRQ?
afaics from the source, it doesn't handle the case of multiplexed phy notification irqs; although the interrupt is requested with the
SA_SHIRQflag, the first phy-interrupt-handler to be called already returnsIRQ_HANDLED... doesn't feel right in some way ;-)
The PHY layer does handle multiplexed interrupts (I've got boards with 4 PHYs sharing the same IRQ). While I'm not sure returning IRQ_HANDLED is the perfect implementation, I'm not sure there are any options. I've worked pretty hard to ensure that PHY transactions don't occur in interrupt context so that it's possible to implement a driver that has an interrupt signal the end of a transaction. As such, reading the PHY interrupt status cannot happen in the interrupt handler, which means the interrupt handler doesn't have the ability to determine whether any particular invocation is handling the actual cause of the interrupt.
From what I've seen of the interrupt code, this is only an issue if a spurious interrupt starts troubling the same line the PHY is using. Does anyone disagree, or have some better suggestion for how to handle this?