
Hi, I'm operating on an at91rm9200-based board. The AT91RM9200 is connected to an ethernet PHY via MII interface. The current implementations of the MII-access functions in ether.c assume, that the phy's address is 00000. But the address of the PHY that I use (KS8721) is 00001 by default, so i cannot access the MII-registers with the this implementation. Apart from that a user could configure the address of the PHY on his board with pull-ups. I think we need to set the PHY address explicite when accessing it.
I suggest to introduce a new macro (e. g. CFG_PHY_ADDRESS) that can be set by the user in the board specific header file.
There are two ways to implement the usage of this macro. The first is that we use the macro directly in the functions at91rm9200_EmacWritePhy() and at91rm9200_EmacReadPhy() without changing any parameters. The advantage is that we can implement it very easy and very fast. The disadvantage is that we cannot change the address after compilation (which shouldn't be a problem in most cases).
The second way is to add a new parameter (e. g. phyadd) to the EmacWrite and EmacRead function. The PHY driver would be responsible to set the PHY address when calling these functions. The PHY address could be taken from CFG_PHY_ADDRESS (like above) or could be set dynamically (e. g. if we have more than one PHY connected). In addition to the EmacRead and EmacWrite interface itself, we need to change all drivers using this function and implement the new interface in this case.
Which of the suggested ways would you prefer?
Best Regards Mirco