Exemplo n.º 1
0
static int read_MII(struct net_device *dev, int phy, int reg)
{
	int timedout = 20;
	u32 smir = smirOpCode | (phy << smirPhyAdBit) |
	    (reg << smirRegAdBit);

	// wait for last operation to complete
	while ((GT64240_READ(GT64240_ETH_SMI_REG)) & smirBusy) {
		// snooze for 1 msec and check again
		gt64240_delay(1);

		if (--timedout == 0) {
			printk("%s: read_MII busy timeout!!\n", dev->name);
			return -1;
		}
	}

	GT64240_WRITE(GT64240_ETH_SMI_REG, smir);

	timedout = 20;
	// wait for read to complete
	while (!
	       ((smir =
		 GT64240_READ(GT64240_ETH_SMI_REG)) & smirReadValid)) {
		// snooze for 1 msec and check again
		gt64240_delay(1);

		if (--timedout == 0) {
			printk("%s: read_MII timeout!!\n", dev->name);
			return -1;
		}
	}

	return (int) (smir & smirDataMask);
}
Exemplo n.º 2
0
// These routines work, just disabled to avoid compile warnings
static void write_MII(struct net_device *dev, int phy, int reg, int data)
{
	u32 smir = (phy << smirPhyAdBit) | (reg << smirRegAdBit) | data;
	int timedout = 20;

	// wait for last operation to complete
	while (GT64240_READ(GT64240_ETH_SMI_REG) & smirBusy) {
		// snooze for 1 msec and check again
		gt64240_delay(1);

		if (--timedout == 0) {
			printk("%s: write_MII busy timeout!!\n",
			       dev->name);
			return;
		}
	}

	GT64240_WRITE(GT64240_ETH_SMI_REG, smir);
}
Exemplo n.º 3
0
// These routines work, just disabled to avoid compile warnings
static int write_MII(struct net_device *dev, u32 reg, u16 data)
{
	struct gt64240_private *gp = (struct gt64240_private *) dev->priv;
	int timedout = 20;
	u32 smir =
	    (gp->phy_addr << smirPhyAdBit) | (reg << smirRegAdBit) | data;

	// wait for last operation to complete
	while (GT64240_READ(GT64240_ETH_SMI_REG) & smirBusy) {
		// snooze for 1 msec and check again
		gt64240_delay(1);

		if (--timedout == 0) {
			printk("%s: write_MII busy timeout!!\n",
			       dev->name);
			return -1;
		}
	}

	GT64240_WRITE(GT64240_ETH_SMI_REG, smir);
	return 0;
}