kernels/linux-2.4.0/drivers/net/dmfe.c
/*
   Process op-mode
   AUTO mode : PHY controller in Auto-negotiation Mode
   Force mode: PHY controller in force mode with HUB
   N-way force capability with SWITCH
 */
Process op-mode
AUTO mode : PHY controller in Auto-negotiation Mode
Force mode: PHY controller in force mode with HUB
N-way force capability with SWITCH
Process op - mode AUTO mode : PHY controller in Auto - negotiation Mode Force mode : PHY controller in force mode with HUB N - way force capability with SWITCH
static void dmfe_process_mode(struct dmfe_board_info *db)
{
	u16 phy_reg;
	db->cr6_data &= ~CR6_FDM;	
	if (db->op_mode & 0x4)
		db->cr6_data |= CR6_FDM;
	if (!(db->media_mode & DMFE_AUTO)) {	
		phy_reg = phy_read(db->ioaddr, db->phy_addr, 5, db->chip_id);
		if (phy_reg & 0x1) {
			phy_reg = phy_read(db->ioaddr, db->phy_addr, 4, db->chip_id) & ~0x1e0;
			switch (db->op_mode) {
			case DMFE_10MHF:
				phy_reg |= 0x20;
				break;
			case DMFE_10MFD:
				phy_reg |= 0x40;
				break;
			case DMFE_100MHF:
				phy_reg |= 0x80;
				break;
			case DMFE_100MFD:
				phy_reg |= 0x100;
				break;
			}
			phy_write(db->ioaddr, db->phy_addr, 4, phy_reg, db->chip_id);
		} else {
			switch (db->op_mode) {
			case DMFE_10MHF:
				phy_reg = 0x0;
				break;
			case DMFE_10MFD:
				phy_reg = 0x100;
				break;
			case DMFE_100MHF:
				phy_reg = 0x2000;
				break;
			case DMFE_100MFD:
				phy_reg = 0x2100;
				break;
			}
			phy_write(db->ioaddr, db->phy_addr, 0, phy_reg, db->chip_id);
		}
	}
}
static void dmfe_process_mode ( struct dmfe_board_info * db ) { u16 phy_reg ; db -> cr6_data &= ~ CR6_FDM ; if ( db -> op_mode & 0x4 ) db -> cr6_data |= CR6_FDM ; if ( ! ( db -> media_mode & DMFE_AUTO ) ) { phy_reg = phy_read ( db -> ioaddr , db -> phy_addr , 5 , db -> chip_id ) ; if ( phy_reg & 0x1 ) { phy_reg = phy_read ( db -> ioaddr , db -> phy_addr , 4 , db -> chip_id ) & ~ 0x1e0 ; switch ( db -> op_mode ) { case DMFE_10MHF : phy_reg |= 0x20 ; break ; case DMFE_10MFD : phy_reg |= 0x40 ; break ; case DMFE_100MHF : phy_reg |= 0x80 ; break ; case DMFE_100MFD : phy_reg |= 0x100 ; break ; } phy_write ( db -> ioaddr , db -> phy_addr , 4 , phy_reg , db -> chip_id ) ; } else { switch ( db -> op_mode ) { case DMFE_10MHF : phy_reg = 0x0 ; break ; case DMFE_10MFD : phy_reg = 0x100 ; break ; case DMFE_100MHF : phy_reg = 0x2000 ; break ; case DMFE_100MFD : phy_reg = 0x2100 ; break ; } phy_write ( db -> ioaddr , db -> phy_addr , 0 , phy_reg , db -> chip_id ) ; } } }
Process op-mode
AUTO mode : PHY controller in Auto-negotiation Mode
Force mode: PHY controller in force mode with HUB
N-way force capability with SWITCH
Process op - mode AUTO mode : PHY controller in Auto - negotiation Mode Force mode : PHY controller in force mode with HUB N - way force capability with SWITCH
/* Full Duplex Mode Check */ /* Clear Full Duplex Bit */ /* Force Mode Check */ /* User force the media type */ /* printk("Nway phy_reg5 %x ",phy_reg); */ /* parter own the N-Way capability */ /* parter without the N-Way capability */