mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-04-01 12:01:31 +00:00
QE UEC: Add MII Commands
Add MII commands to the UEC driver. Note that once a UEC device is selected, any device on its MDIO bus can be addressed. Signed-off-by: David Saada <david.saada@ecitele.com> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
This commit is contained in:
parent
81091f58f0
commit
d5d28fe4aa
1 changed files with 53 additions and 0 deletions
|
@ -29,6 +29,7 @@
|
||||||
#include "uccf.h"
|
#include "uccf.h"
|
||||||
#include "uec.h"
|
#include "uec.h"
|
||||||
#include "uec_phy.h"
|
#include "uec_phy.h"
|
||||||
|
#include "miiphy.h"
|
||||||
|
|
||||||
#if defined(CONFIG_QE)
|
#if defined(CONFIG_QE)
|
||||||
|
|
||||||
|
@ -125,6 +126,17 @@ static uec_info_t eth4_uec_info = {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define MAXCONTROLLERS (4)
|
||||||
|
|
||||||
|
static struct eth_device *devlist[MAXCONTROLLERS];
|
||||||
|
|
||||||
|
static int uec_miiphy_read(char *devname, unsigned char addr,
|
||||||
|
unsigned char reg, unsigned short *value);
|
||||||
|
static int uec_miiphy_write(char *devname, unsigned char addr,
|
||||||
|
unsigned char reg, unsigned short value);
|
||||||
|
u16 phy_read (struct uec_mii_info *mii_info, u16 regnum);
|
||||||
|
void phy_write (struct uec_mii_info *mii_info, u16 regnum, u16 val);
|
||||||
|
|
||||||
static int uec_mac_enable(uec_private_t *uec, comm_dir_e mode)
|
static int uec_mac_enable(uec_private_t *uec, comm_dir_e mode)
|
||||||
{
|
{
|
||||||
uec_t *uec_regs;
|
uec_t *uec_regs;
|
||||||
|
@ -1334,6 +1346,8 @@ int uec_initialize(int index)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
devlist[index] = dev;
|
||||||
|
|
||||||
uec->uec_info = uec_info;
|
uec->uec_info = uec_info;
|
||||||
|
|
||||||
sprintf(dev->name, "FSL UEC%d", index);
|
sprintf(dev->name, "FSL UEC%d", index);
|
||||||
|
@ -1356,6 +1370,45 @@ int uec_initialize(int index)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) \
|
||||||
|
&& !defined(BITBANGMII)
|
||||||
|
miiphy_register(dev->name, uec_miiphy_read, uec_miiphy_write);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) \
|
||||||
|
&& !defined(BITBANGMII)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read a MII PHY register.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* 0 on success
|
||||||
|
*/
|
||||||
|
static int uec_miiphy_read(char *devname, unsigned char addr,
|
||||||
|
unsigned char reg, unsigned short *value)
|
||||||
|
{
|
||||||
|
*value = uec_read_phy_reg(devlist[0], addr, reg);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write a MII PHY register.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* 0 on success
|
||||||
|
*/
|
||||||
|
static int uec_miiphy_write(char *devname, unsigned char addr,
|
||||||
|
unsigned char reg, unsigned short value)
|
||||||
|
{
|
||||||
|
uec_write_phy_reg(devlist[0], addr, reg, value);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* CONFIG_QE */
|
#endif /* CONFIG_QE */
|
||||||
|
|
Loading…
Add table
Reference in a new issue