Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 291617
b: refs/heads/master
c: ba56833
h: refs/heads/master
i:
  291615: e96031c
v: v3
  • Loading branch information
Vladimir Ermakov authored and David S. Miller committed Mar 19, 2012
1 parent 5b567f1 commit 2400a28
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dc72d99dabb870ca5bd6d9fff674be853bb4a88d
refs/heads/master: ba568335b089e0a27829e3a6117a7e1bf957ad07
6 changes: 4 additions & 2 deletions trunk/drivers/net/ethernet/freescale/fs_enet/fec.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
#define FEC_ECNTRL_ETHER_EN 0x00000002
#define FEC_ECNTRL_RESET 0x00000001

/* RMII mode enabled only when MII_MODE bit is set too. */
#define FEC_RCNTRL_RMII_MODE (0x00000100 | \
FEC_RCNTRL_MII_MODE | FEC_RCNTRL_FCE)
#define FEC_RCNTRL_FCE 0x00000020
#define FEC_RCNTRL_BC_REJ 0x00000010
#define FEC_RCNTRL_PROM 0x00000008
#define FEC_RCNTRL_MII_MODE 0x00000004
Expand All @@ -33,8 +37,6 @@
#define FEC_TCNTRL_HBC 0x00000002
#define FEC_TCNTRL_GTS 0x00000001



/*
* Delay to wait for FEC reset command to complete (in us)
*/
Expand Down
20 changes: 18 additions & 2 deletions trunk/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,16 +790,20 @@ static int fs_init_phy(struct net_device *dev)
{
struct fs_enet_private *fep = netdev_priv(dev);
struct phy_device *phydev;
phy_interface_t iface;

fep->oldlink = 0;
fep->oldspeed = 0;
fep->oldduplex = -1;

iface = fep->fpi->use_rmii ?
PHY_INTERFACE_MODE_RMII : PHY_INTERFACE_MODE_MII;

phydev = of_phy_connect(dev, fep->fpi->phy_node, &fs_adjust_link, 0,
PHY_INTERFACE_MODE_MII);
iface);
if (!phydev) {
phydev = of_phy_connect_fixed_link(dev, &fs_adjust_link,
PHY_INTERFACE_MODE_MII);
iface);
}
if (!phydev) {
dev_err(&dev->dev, "Could not attach to PHY\n");
Expand Down Expand Up @@ -1007,6 +1011,7 @@ static int __devinit fs_enet_probe(struct platform_device *ofdev)
struct fs_platform_info *fpi;
const u32 *data;
const u8 *mac_addr;
const char *phy_connection_type;
int privsize, len, ret = -ENODEV;

match = of_match_device(fs_enet_match, &ofdev->dev);
Expand Down Expand Up @@ -1035,6 +1040,13 @@ static int __devinit fs_enet_probe(struct platform_device *ofdev)
NULL)))
goto out_free_fpi;

if (of_device_is_compatible(ofdev->dev.of_node, "fsl,mpc5125-fec")) {
phy_connection_type = of_get_property(ofdev->dev.of_node,
"phy-connection-type", NULL);
if (phy_connection_type && !strcmp("rmii", phy_connection_type))
fpi->use_rmii = 1;
}

privsize = sizeof(*fep) +
sizeof(struct sk_buff **) *
(fpi->rx_ring + fpi->tx_ring);
Expand Down Expand Up @@ -1150,6 +1162,10 @@ static struct of_device_id fs_enet_match[] = {
.compatible = "fsl,mpc5121-fec",
.data = (void *)&fs_fec_ops,
},
{
.compatible = "fsl,mpc5125-fec",
.data = (void *)&fs_fec_ops,
},
#else
{
.compatible = "fsl,pq1-fec-enet",
Expand Down
9 changes: 6 additions & 3 deletions trunk/drivers/net/ethernet/freescale/fs_enet/mac-fec.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,11 @@ static void restart(struct net_device *dev)
FW(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */
#else
/*
* Only set MII mode - do not touch maximum frame length
* Only set MII/RMII mode - do not touch maximum frame length
* configured before.
*/
FS(fecp, r_cntrl, FEC_RCNTRL_MII_MODE);
FS(fecp, r_cntrl, fpi->use_rmii ?
FEC_RCNTRL_RMII_MODE : FEC_RCNTRL_MII_MODE);
#endif
/*
* adjust to duplex mode
Expand Down Expand Up @@ -381,7 +382,9 @@ static void stop(struct net_device *dev)

/* shut down FEC1? that's where the mii bus is */
if (fpi->has_phy) {
FS(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */
FS(fecp, r_cntrl, fpi->use_rmii ?
FEC_RCNTRL_RMII_MODE :
FEC_RCNTRL_MII_MODE); /* MII/RMII enable */
FS(fecp, ecntrl, FEC_ECNTRL_PINMUX | FEC_ECNTRL_ETHER_EN);
FW(fecp, ievent, FEC_ENET_MII);
FW(fecp, mii_speed, feci->mii_speed);
Expand Down

0 comments on commit 2400a28

Please sign in to comment.