summaryrefslogtreecommitdiffstats
path: root/src/drivers/net/velocity.c
diff options
context:
space:
mode:
authorMichael Brown2018-04-19 13:38:55 +0200
committerMichael Brown2018-04-19 13:43:06 +0200
commit6804a8c89b8c31c3ef4e7e8ab03b82ebee41dd45 (patch)
treeceb234f68817ac16268c97b55771c0e0d16c9e7c /src/drivers/net/velocity.c
parent[velocity] Fix usage of mii_read() and mii_write() (diff)
downloadipxe-6804a8c89b8c31c3ef4e7e8ab03b82ebee41dd45.tar.gz
ipxe-6804a8c89b8c31c3ef4e7e8ab03b82ebee41dd45.tar.xz
ipxe-6804a8c89b8c31c3ef4e7e8ab03b82ebee41dd45.zip
[mii] Separate concepts of MII interface and MII device
We currently have no generic concept of a PHY address, since all existing implementations simply hardcode the PHY address within the MII access methods. A bit-bashing MII interface will need to be provided with an explicit PHY address in order to generate the correct waveform. Allow for this by separating out the concept of a MII device (i.e. a specific PHY address attached to a particular MII interface). Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/net/velocity.c')
-rw-r--r--src/drivers/net/velocity.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/drivers/net/velocity.c b/src/drivers/net/velocity.c
index 129fc136..0a2a3ac1 100644
--- a/src/drivers/net/velocity.c
+++ b/src/drivers/net/velocity.c
@@ -100,13 +100,15 @@ static int velocity_autopoll_start ( struct velocity_nic *vlc ) {
/**
* Read from MII register
*
- * @v mii MII interface
+ * @v mdio MII interface
+ * @v phy PHY address
* @v reg Register address
* @ret value Data read, or negative error
*/
-static int velocity_mii_read ( struct mii_interface *mii, unsigned int reg ) {
+static int velocity_mii_read ( struct mii_interface *mdio,
+ unsigned int phy __unused, unsigned int reg ) {
struct velocity_nic *vlc =
- container_of ( mii, struct velocity_nic, mii );
+ container_of ( mdio, struct velocity_nic, mdio );
int timeout = VELOCITY_TIMEOUT_US;
int result;
@@ -140,15 +142,17 @@ static int velocity_mii_read ( struct mii_interface *mii, unsigned int reg ) {
/**
* Write to MII register
*
- * @v mii MII interface
+ * @v mdio MII interface
+ * @v phy PHY address
* @v reg Register address
* @v data Data to write
* @ret rc Return status code
*/
-static int velocity_mii_write ( struct mii_interface *mii, unsigned int reg,
+static int velocity_mii_write ( struct mii_interface *mdio,
+ unsigned int phy __unused, unsigned int reg,
unsigned int data) {
struct velocity_nic *vlc =
- container_of ( mii, struct velocity_nic, mii );
+ container_of ( mdio, struct velocity_nic, mdio );
int timeout = VELOCITY_TIMEOUT_US;
DBGC2 ( vlc, "VELOCITY %p MII write reg %d data 0x%04x\n",
@@ -747,7 +751,8 @@ static int velocity_probe ( struct pci_device *pci ) {
netdev->hw_addr[5] = readb ( vlc->regs + VELOCITY_MAC5 );
/* Initialise and reset MII interface */
- mii_init ( &vlc->mii, &velocity_mii_operations );
+ mdio_init ( &vlc->mdio, &velocity_mii_operations );
+ mii_init ( &vlc->mii, &vlc->mdio, 0 );
if ( ( rc = mii_reset ( &vlc->mii ) ) != 0 ) {
DBGC ( vlc, "VELOCITY %p could not reset MII: %s\n",
vlc, strerror ( rc ) );