FreeBSD/sys/mips/cavium/octe/ethernet-mdio.c
/**
 * Perform an MII write. Called by the generic MII routines
 *
 * @param dev      Device to perform write for
 * @param phy_id   The MII phy id
 * @param location Register location to write
 * @param val      Value to write
 */
Perform an MII write. Called by the generic MII routines
@param dev      Device to perform write for
@param phy_id   The MII phy id
@param location Register location to write
@param val      Value to write
Perform an MII write . Called by the generic MII routines @param dev Device to perform write for @param phy_id The MII phy id @param location Register location to write @param val Value to write
void cvm_oct_mdio_write(struct ifnet *ifp, int phy_id, int location, int val)
{
	cvmx_smi_cmd_t          smi_cmd;
	cvmx_smi_wr_dat_t       smi_wr;
	MDIO_LOCK();
	smi_wr.u64 = 0;
	smi_wr.s.dat = val;
	cvmx_write_csr(CVMX_SMI_WR_DAT, smi_wr.u64);
	smi_cmd.u64 = 0;
	smi_cmd.s.phy_op = 0;
	smi_cmd.s.phy_adr = phy_id;
	smi_cmd.s.reg_adr = location;
	cvmx_write_csr(CVMX_SMI_CMD, smi_cmd.u64);
	do {
		cvmx_wait(1000);
		smi_wr.u64 = cvmx_read_csr(CVMX_SMI_WR_DAT);
	} while (smi_wr.s.pending);
	MDIO_UNLOCK();
}
void cvm_oct_mdio_write ( struct ifnet * ifp , int phy_id , int location , int val ) { cvmx_smi_cmd_t smi_cmd ; cvmx_smi_wr_dat_t smi_wr ; MDIO_LOCK ( ) ; smi_wr . u64 = 0 ; smi_wr . s . dat = val ; cvmx_write_csr ( CVMX_SMI_WR_DAT , smi_wr . u64 ) ; smi_cmd . u64 = 0 ; smi_cmd . s . phy_op = 0 ; smi_cmd . s . phy_adr = phy_id ; smi_cmd . s . reg_adr = location ; cvmx_write_csr ( CVMX_SMI_CMD , smi_cmd . u64 ) ; do { cvmx_wait ( 1000 ) ; smi_wr . u64 = cvmx_read_csr ( CVMX_SMI_WR_DAT ) ; } while ( smi_wr . s . pending ) ; MDIO_UNLOCK ( ) ; }
Perform an MII write.
Perform an MII write .