Exemple #1
0
/**
 * read_phy_reg - MII interface  to read  @reg_addr register of phy at @phy_addr
 * return positive and zero value if success, or negative value if fail
 * may be used by other standard ethernet phy
 */
unsigned short read_phy_reg_ksz8041(ec_priv_t * ecp, unsigned short reg_addr)
{
	u32 op_reg;

	do {
		op_reg = getl(MAC_CSR10);
	} while (op_reg & MII_MNG_SB);

	putl(MII_MNG_SB | MII_MNG_OPCODE(MII_OP_READ) | MII_MNG_REGADD(reg_addr) |
		MII_MNG_PHYADD(ASOC_ETHERNET_PHY_ADDR), MAC_CSR10);

	do {
		op_reg = getl(MAC_CSR10);
	} while (op_reg & MII_MNG_SB);

	return (u16)MII_MNG_DATA(op_reg);
}
Exemple #2
0
static uint16_t owl_mdio_read(struct eth_device *dev, uint8_t phyreg)
{
	struct owl_mac_info *owl_info = dev->priv;
	int phyaddr = owl_info->phy_addr;
	u32 op_reg;

	do{
		op_reg = readl(MAC_CSR10);
	}while(op_reg & MII_MNG_SB);

	writel(MII_MNG_SB | MII_MNG_OPCODE(MII_OP_READ) | MII_MNG_REGADD(phyreg) | MII_MNG_PHYADD(phyaddr), MAC_CSR10);

	do{
		op_reg = readl(MAC_CSR10);
	}while(op_reg & MII_MNG_SB);

	return (uint16_t)MII_MNG_DATA(op_reg);
}
Exemple #3
0
/**
 * read_phy_reg - MII interface  to read  @reg_addr register of phy at @phy_addr
 * return positive and zero value if success, or negative value if fail
 * may be used by other standard ethernet phy
 */
unsigned short read_phy_reg_sr8201g(ec_priv_t * ecp, unsigned short reg_addr)
{
	u32 op_reg;
	u32 phy_addr;
	if((ecp->phy_addr)!=0xFF)
		phy_addr=ecp->phy_addr;
	else
		phy_addr=ASOC_ETHERNET_PHY_ADDR;

	do {
		op_reg = getl(MAC_CSR10);
	} while (op_reg & MII_MNG_SB);

	putl(MII_MNG_SB | MII_MNG_OPCODE(MII_OP_READ) | MII_MNG_REGADD(reg_addr) |
		MII_MNG_PHYADD(phy_addr), MAC_CSR10);

	do {
		op_reg = getl(MAC_CSR10);
	} while (op_reg & MII_MNG_SB);

	return (u16)MII_MNG_DATA(op_reg);
}