Пример #1
0
static __u32 robo_read32(__u8 page, __u8 reg)
{
	robo_reg(page, reg, REG_MII_ADDR_READ);

	return mdio_read(robo.phy_addr, REG_MII_DATA0) +
		(mdio_read(robo.phy_addr, REG_MII_DATA0 + 1) << 16);
}
Пример #2
0
static __u32 robo_read32(__u8 page, __u8 reg)
{
	robo_reg(page, reg, REG_MII_ADDR_READ);
	
	return mdio_read(ROBO_PHY_ADDR, REG_MII_DATA0) +
		(mdio_read(ROBO_PHY_ADDR, REG_MII_DATA0 + 1) << 16);
}
Пример #3
0
static void robo_write16(__u8 page, __u8 reg, __u16 val16)
{
	/* write data */
	mdio_write(ROBO_PHY_ADDR, REG_MII_DATA0, val16);

	robo_reg(page, reg, REG_MII_ADDR_WRITE);
}
Пример #4
0
static void robo_write32(__u8 page, __u8 reg, __u32 val32)
{
	/* write data */
	mdio_write(ROBO_PHY_ADDR, REG_MII_DATA0, val32 & 65535);
	mdio_write(ROBO_PHY_ADDR, REG_MII_DATA0 + 1, val32 >> 16);
	
	robo_reg(page, reg, REG_MII_ADDR_WRITE);
}
Пример #5
0
static void robo_read(__u8 page, __u8 reg, __u16 *val, int count)
{
	int i;
	
	robo_reg(page, reg, REG_MII_ADDR_READ);
	
	for (i = 0; i < count; i++)
		val[i] = mdio_read(ROBO_PHY_ADDR, REG_MII_DATA0 + i);
}
Пример #6
0
static void robo_write(robo_t *robo, u8 page, u8 reg, u16 *val, int count)
{
	int i;

	for (i = 0; i < count; i++)
		mdio_write(robo, ROBO_PHY_ADDR, REG_MII_DATA0 + i, val[i]);

	robo_reg(robo, page, reg, REG_MII_ADDR_WRITE);
}
Пример #7
0
static void robo_write16(robo_t *robo, u8 page, u8 reg, u16 val16)
{
#ifdef BCM5301X
	robo_write(robo, page, reg, &val16, 1);
#else
	/* write data */
	mdio_write(robo, ROBO_PHY_ADDR, REG_MII_DATA0, val16);

	robo_reg(robo, page, reg, REG_MII_ADDR_WRITE);
#endif
}
Пример #8
0
static void robo_write32(robo_t *robo, u8 page, u8 reg, u32 val32)
{
#ifdef BCM5301X
	robo_write(robo, page, reg, (u16 *) &val32, 2);
#else
	/* write data */
	mdio_write(robo, ROBO_PHY_ADDR, REG_MII_DATA0, (u16 )(val32 & 0xFFFF));
	mdio_write(robo, ROBO_PHY_ADDR, REG_MII_DATA0 + 1, (u16 )(val32 >> 16));
	
	robo_reg(robo, page, reg, REG_MII_ADDR_WRITE);
#endif
}
Пример #9
0
static u16 robo_read16(robo_t *robo, u8 page, u8 reg)
{
#ifdef BCM5301X
	u16 val16;

	robo_read(robo, page, reg, &val16, 1);
	return val16;
#else
	robo_reg(robo, page, reg, REG_MII_ADDR_READ);
	
	return mdio_read(robo, ROBO_PHY_ADDR, REG_MII_DATA0);
#endif
}
Пример #10
0
static u32 robo_read32(robo_t *robo, u8 page, u8 reg)
{
#ifdef BCM5301X
	u32 val32;

	robo_read(robo, page, reg, (u16 *) &val32, 2);
	return val32;
#else
	robo_reg(robo, page, reg, REG_MII_ADDR_READ);
	
	return ((u32 )mdio_read(robo, ROBO_PHY_ADDR, REG_MII_DATA0)) |
		((u32 )mdio_read(robo, ROBO_PHY_ADDR, REG_MII_DATA0 + 1) << 16);
#endif
}
Пример #11
0
static void robo_write16(robo_t *robo, u8 page, u8 reg, u16 val16)
{
#ifdef BCM5301X
        int args[5];

        args[0] = page << 16;
        args[0] |= reg;
        args[1] = 2;
        args[2] = val16;
        robo->ifr.ifr_data = (caddr_t) args;

        ioctl(robo->fd, SIOCSETCROBOWR, (caddr_t)&robo->ifr);

#else
	/* write data */
	mdio_write(robo, ROBO_PHY_ADDR, REG_MII_DATA0, val16);

	robo_reg(robo, page, reg, REG_MII_ADDR_WRITE);
#endif
}
Пример #12
0
static void robo_write(robo_t *robo, u8 page, u8 reg, u16 *val, int count)
{
#ifdef BCM5301X
	int args[5];

	args[0] = (page << 16) | (reg & 0xffff);
	args[1] = count * 2;
	memcpy(&args[2], val, count * 2);

	robo->ifr.ifr_data = (caddr_t) args;

	ioctl(robo->fd, SIOCSETCROBOWR, (caddr_t)&robo->ifr);
#else
	int i;

	for (i = 0; i < count; i++)
		mdio_write(robo, ROBO_PHY_ADDR, REG_MII_DATA0 + i, val[i]);

	robo_reg(robo, page, reg, REG_MII_ADDR_WRITE);
#endif
}
Пример #13
0
static u16 robo_read16(robo_t *robo, u8 page, u8 reg)
{

#ifdef BCM5301X
        int args[5];

	args[0] = page << 16;
	args[0] |= reg;
	args[1] = 2;
	args[2] = 0;
        robo->ifr.ifr_data = (caddr_t) args;

        if (ioctl(robo->fd, SIOCGETCROBORD, (caddr_t)&robo->ifr) < 0)
                return 0;

        return args[2];
#else
	robo_reg(robo, page, reg, REG_MII_ADDR_READ);
	
	return mdio_read(robo, ROBO_PHY_ADDR, REG_MII_DATA0);
#endif
}
Пример #14
0
static void robo_read(robo_t *robo, u8 page, u8 reg, u16 *val, int count)
{
	int i;

#ifdef BCM5301X
        int args[5];

        args[0] = page << 16;
        args[0] |= reg & 0xffff;
        args[1] = count * 2; // convert to bytes
        args[2] = 0;

        robo->ifr.ifr_data = (caddr_t) args;

	if (ioctl(robo->fd, SIOCGETCROBORD, (caddr_t)&robo->ifr) >= 0) 
		memcpy(val, &args[2], count * 2);
#else
	robo_reg(robo, page, reg, REG_MII_ADDR_READ);

	for (i = 0; i < count; i++)
		val[i] = mdio_read(robo, ROBO_PHY_ADDR, REG_MII_DATA0 + i);
#endif
}
Пример #15
0
static void robo_write32(robo_t *robo, u8 page, u8 reg, u32 val32)
{
#ifdef BCM5301X
        int args[5];

        args[0] = page << 16;
        args[0] |= reg;
        args[1] = 4;    // len
        args[2] = val32;    // value

        robo->ifr.ifr_data = (caddr_t) args;
        ioctl(robo->fd, SIOCSETCROBOWR, (caddr_t)&robo->ifr);

//        printf("rd32: 0x%16x\n", args[2]);

#else
	/* write data */
	mdio_write(robo, ROBO_PHY_ADDR, REG_MII_DATA0, (u16 )(val32 & 0xFFFF));
	mdio_write(robo, ROBO_PHY_ADDR, REG_MII_DATA0 + 1, (u16 )(val32 >> 16));
	
	robo_reg(robo, page, reg, REG_MII_ADDR_WRITE);
#endif
}
Пример #16
0
static u32 robo_read32(robo_t *robo, u8 page, u8 reg)
{
#ifdef BCM5301X
        int args[5];

        args[0] = page << 16;
        args[0] |= reg;
        args[1] = 4;	// len
        args[2] = 0;	// value

        robo->ifr.ifr_data = (caddr_t) args;
        if (ioctl(robo->fd, SIOCGETCROBORD, (caddr_t)&robo->ifr) < 0)
                return 0;

//        printf("rd32: 0x%16x\n", args[2]);
        return args[2];

#else
	robo_reg(robo, page, reg, REG_MII_ADDR_READ);
	
	return ((u32 )mdio_read(robo, ROBO_PHY_ADDR, REG_MII_DATA0)) |
		((u32 )mdio_read(robo, ROBO_PHY_ADDR, REG_MII_DATA0 + 1) << 16);
#endif
}
Пример #17
0
static void robo_read(robo_t *robo, u8 page, u8 reg, u16 *val, int count)
{
#ifdef BCM5301X
	int args[5];

	args[0] = (page << 16) | (reg & 0xffff);
	args[1] = count * 2;
	args[2] = 0;

	robo->ifr.ifr_data = (caddr_t) args;

	if (ioctl(robo->fd, SIOCGETCROBORD, (caddr_t)&robo->ifr) < 0)
		return;

	memcpy(val, &args[2], count * 2);
#else
	int i;
	
	robo_reg(robo, page, reg, REG_MII_ADDR_READ);
	
	for (i = 0; i < count; i++)
		val[i] = mdio_read(robo, ROBO_PHY_ADDR, REG_MII_DATA0 + i);
#endif
}
Пример #18
0
static __u16 robo_read16(__u8 page, __u8 reg)
{
	robo_reg(page, reg, REG_MII_ADDR_READ);
	
	return mdio_read(ROBO_PHY_ADDR, REG_MII_DATA0);
}
Пример #19
0
static __u16 robo_read16(__u8 page, __u8 reg)
{
	robo_reg(page, reg, REG_MII_ADDR_READ);

	return mdio_read(robo.phy_addr, REG_MII_DATA0);
}