summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2015-05-20 15:57:55 -0400
committerTom Rini <trini@konsulko.com>2015-05-20 15:57:55 -0400
commit3238639d40732fe78fd62ae5e080465552e882fc (patch)
treeb9f0f8565adf69504faf56fc7032068573e5fabe /drivers
parentcb0892b968e52fe0d09b4d51119d8f913685ed3c (diff)
parent76ec988b062ed880ab23d0e0d4e9e6c137b55cc3 (diff)
downloadu-boot-imx-3238639d40732fe78fd62ae5e080465552e882fc.zip
u-boot-imx-3238639d40732fe78fd62ae5e080465552e882fc.tar.gz
u-boot-imx-3238639d40732fe78fd62ae5e080465552e882fc.tar.bz2
Merge git://git.denx.de/u-boot-net
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/bcm-sf2-eth.c6
-rw-r--r--drivers/net/designware.c4
-rw-r--r--drivers/net/dm9000x.c6
-rw-r--r--drivers/net/ftmac110.c3
-rw-r--r--drivers/net/greth.c10
-rw-r--r--drivers/net/lan91c96.c7
-rw-r--r--drivers/net/macb.c9
-rw-r--r--drivers/net/phy/phy.c16
-rw-r--r--drivers/net/phy/realtek.c102
9 files changed, 121 insertions, 42 deletions
diff --git a/drivers/net/bcm-sf2-eth.c b/drivers/net/bcm-sf2-eth.c
index 51d5146..eab4c1f 100644
--- a/drivers/net/bcm-sf2-eth.c
+++ b/drivers/net/bcm-sf2-eth.c
@@ -154,12 +154,6 @@ static int bcm_sf2_eth_open(struct eth_device *dev, bd_t *bt)
debug("Enabling BCM SF2 Ethernet.\n");
- /* Set MAC address from env */
- if (bcm_sf2_eth_write_hwaddr(dev) != 0) {
- error("%s: MAC set error when opening !\n", __func__);
- return -1;
- }
-
eth->enable_mac();
/* enable tx and rx DMA */
diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 07281a6..ae51cf3 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -243,10 +243,6 @@ static int _dw_eth_init(struct dw_eth_dev *priv, u8 *enetaddr)
mdelay(100);
};
- /* Soft reset above clears HW address registers.
- * So we have to set it here once again */
- _dw_write_hwaddr(priv, enetaddr);
-
rx_descs_init(priv);
tx_descs_init(priv);
diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
index ccd2131..3c41cec 100644
--- a/drivers/net/dm9000x.c
+++ b/drivers/net/dm9000x.c
@@ -343,13 +343,7 @@ static int dm9000_init(struct eth_device *dev, bd_t *bd)
printf("MAC: %pM\n", dev->enetaddr);
if (!is_valid_ethaddr(dev->enetaddr)) {
-#ifdef CONFIG_RANDOM_MACADDR
- printf("Bad MAC address (uninitialized EEPROM?), randomizing\n");
- net_random_ethaddr(dev->enetaddr);
- printf("MAC: %pM\n", dev->enetaddr);
-#else
printf("WARNING: Bad MAC address (uninitialized EEPROM?)\n");
-#endif
}
/* fill device MAC address registers */
diff --git a/drivers/net/ftmac110.c b/drivers/net/ftmac110.c
index 4bae9ad..4f17015 100644
--- a/drivers/net/ftmac110.c
+++ b/drivers/net/ftmac110.c
@@ -424,9 +424,6 @@ int ftmac110_initialize(bd_t *bis)
dev->send = ftmac110_send;
dev->recv = ftmac110_recv;
- if (!eth_getenv_enetaddr_by_index("eth", card_nr, dev->enetaddr))
- net_random_ethaddr(dev->enetaddr);
-
/* allocate tx descriptors (it must be 16 bytes aligned) */
chip->txd = dma_alloc_coherent(
sizeof(struct ftmac110_desc) * CFG_TXDES_NUM, &chip->txd_dma);
diff --git a/drivers/net/greth.c b/drivers/net/greth.c
index a93b37a..9bc8a8d 100644
--- a/drivers/net/greth.c
+++ b/drivers/net/greth.c
@@ -12,6 +12,7 @@
#include <common.h>
#include <command.h>
+#include <errno.h>
#include <net.h>
#include <netdev.h>
#include <malloc.h>
@@ -653,13 +654,8 @@ int greth_initialize(bd_t * bis)
}
}
} else {
- /* HW Address not found in environment, Set default HW address */
- addr[0] = GRETH_HWADDR_0; /* MSB */
- addr[1] = GRETH_HWADDR_1;
- addr[2] = GRETH_HWADDR_2;
- addr[3] = GRETH_HWADDR_3;
- addr[4] = GRETH_HWADDR_4;
- addr[5] = GRETH_HWADDR_5; /* LSB */
+ /* No ethaddr set */
+ return -EINVAL;
}
/* set and remember MAC address */
diff --git a/drivers/net/lan91c96.c b/drivers/net/lan91c96.c
index 495c088..c4dd01e 100644
--- a/drivers/net/lan91c96.c
+++ b/drivers/net/lan91c96.c
@@ -725,12 +725,6 @@ static int smc_get_ethaddr(bd_t *bd, struct eth_device *dev)
static int get_rom_mac(struct eth_device *dev, unsigned char *v_rom_mac)
{
-#ifdef HARDCODE_MAC /* used for testing or to supress run time warnings */
- char hw_mac_addr[] = { 0x02, 0x80, 0xad, 0x20, 0x31, 0xb8 };
-
- memcpy (v_rom_mac, hw_mac_addr, 6);
- return (1);
-#else
int i;
SMC_SELECT_BANK(dev, 1);
for (i=0; i<6; i++)
@@ -738,7 +732,6 @@ static int get_rom_mac(struct eth_device *dev, unsigned char *v_rom_mac)
v_rom_mac[i] = SMC_inb(dev, LAN91C96_IA0 + i);
}
return (1);
-#endif
}
/* Structure to detect the device IDs */
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 4e1a7fe..f949161 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -525,7 +525,6 @@ static int macb_phy_init(struct macb_device *macb)
return 1;
}
-static int macb_write_hwaddr(struct eth_device *dev);
static int macb_init(struct eth_device *netdev, bd_t *bd)
{
struct macb_device *macb = to_macb(netdev);
@@ -594,14 +593,6 @@ static int macb_init(struct eth_device *netdev, bd_t *bd)
#endif /* CONFIG_RMII */
}
- /* update the ethaddr */
- if (is_valid_ethaddr(netdev->enetaddr)) {
- macb_write_hwaddr(netdev);
- } else {
- printf("%s: mac address is not valid\n", netdev->name);
- return -1;
- }
-
if (!macb_phy_init(macb))
return -1;
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index f5221a3..c8d08e8 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -21,6 +21,8 @@
#include <linux/err.h>
#include <linux/compiler.h>
+DECLARE_GLOBAL_DATA_PTR;
+
/* Generic PHY support and helper functions */
/**
@@ -494,6 +496,20 @@ int phy_register(struct phy_driver *drv)
INIT_LIST_HEAD(&drv->list);
list_add_tail(&drv->list, &phy_drivers);
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+ if (drv->probe)
+ drv->probe += gd->reloc_off;
+ if (drv->config)
+ drv->config += gd->reloc_off;
+ if (drv->startup)
+ drv->startup += gd->reloc_off;
+ if (drv->shutdown)
+ drv->shutdown += gd->reloc_off;
+ if (drv->readext)
+ drv->readext += gd->reloc_off;
+ if (drv->writeext)
+ drv->writeext += gd->reloc_off;
+#endif
return 0;
}
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index ee97079..79452a8 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -29,6 +29,19 @@
/* RTL8211x PHY Interrupt Status Register */
#define MIIM_RTL8211x_PHY_INSR 0x13
+/* RTL8211F PHY Status Register */
+#define MIIM_RTL8211F_PHY_STATUS 0x1a
+#define MIIM_RTL8211F_AUTONEG_ENABLE 0x1000
+#define MIIM_RTL8211F_PHYSTAT_SPEED 0x0030
+#define MIIM_RTL8211F_PHYSTAT_GBIT 0x0020
+#define MIIM_RTL8211F_PHYSTAT_100 0x0010
+#define MIIM_RTL8211F_PHYSTAT_DUPLEX 0x0008
+#define MIIM_RTL8211F_PHYSTAT_SPDDONE 0x0800
+#define MIIM_RTL8211F_PHYSTAT_LINK 0x0004
+
+#define MIIM_RTL8211F_PAGE_SELECT 0x1f
+#define MIIM_RTL8211F_TX_DELAY 0x100
+
/* RealTek RTL8211x */
static int rtl8211x_config(struct phy_device *phydev)
{
@@ -48,6 +61,29 @@ static int rtl8211x_config(struct phy_device *phydev)
return 0;
}
+static int rtl8211f_config(struct phy_device *phydev)
+{
+ u16 reg;
+
+ phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET);
+
+ if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
+ /* enable TXDLY */
+ phy_write(phydev, MDIO_DEVAD_NONE,
+ MIIM_RTL8211F_PAGE_SELECT, 0xd08);
+ reg = phy_read(phydev, MDIO_DEVAD_NONE, 0x11);
+ reg |= MIIM_RTL8211F_TX_DELAY;
+ phy_write(phydev, MDIO_DEVAD_NONE, 0x11, reg);
+ /* restore to default page 0 */
+ phy_write(phydev, MDIO_DEVAD_NONE,
+ MIIM_RTL8211F_PAGE_SELECT, 0x0);
+ }
+
+ genphy_config_aneg(phydev);
+
+ return 0;
+}
+
static int rtl8211x_parse_status(struct phy_device *phydev)
{
unsigned int speed;
@@ -105,6 +141,51 @@ static int rtl8211x_parse_status(struct phy_device *phydev)
return 0;
}
+static int rtl8211f_parse_status(struct phy_device *phydev)
+{
+ unsigned int speed;
+ unsigned int mii_reg;
+ int i = 0;
+
+ phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_PAGE_SELECT, 0xa43);
+ mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_PHY_STATUS);
+
+ phydev->link = 1;
+ while (!(mii_reg & MIIM_RTL8211F_PHYSTAT_LINK)) {
+ if (i > PHY_AUTONEGOTIATE_TIMEOUT) {
+ puts(" TIMEOUT !\n");
+ phydev->link = 0;
+ break;
+ }
+
+ if ((i++ % 1000) == 0)
+ putc('.');
+ udelay(1000);
+ mii_reg = phy_read(phydev, MDIO_DEVAD_NONE,
+ MIIM_RTL8211F_PHY_STATUS);
+ }
+
+ if (mii_reg & MIIM_RTL8211F_PHYSTAT_DUPLEX)
+ phydev->duplex = DUPLEX_FULL;
+ else
+ phydev->duplex = DUPLEX_HALF;
+
+ speed = (mii_reg & MIIM_RTL8211F_PHYSTAT_SPEED);
+
+ switch (speed) {
+ case MIIM_RTL8211F_PHYSTAT_GBIT:
+ phydev->speed = SPEED_1000;
+ break;
+ case MIIM_RTL8211F_PHYSTAT_100:
+ phydev->speed = SPEED_100;
+ break;
+ default:
+ phydev->speed = SPEED_10;
+ }
+
+ return 0;
+}
+
static int rtl8211x_startup(struct phy_device *phydev)
{
/* Read the Status (2x to make sure link is right) */
@@ -114,6 +195,15 @@ static int rtl8211x_startup(struct phy_device *phydev)
return 0;
}
+static int rtl8211f_startup(struct phy_device *phydev)
+{
+ /* Read the Status (2x to make sure link is right) */
+ genphy_update_link(phydev);
+ rtl8211f_parse_status(phydev);
+
+ return 0;
+}
+
/* Support for RTL8211B PHY */
static struct phy_driver RTL8211B_driver = {
.name = "RealTek RTL8211B",
@@ -147,10 +237,22 @@ static struct phy_driver RTL8211DN_driver = {
.shutdown = &genphy_shutdown,
};
+/* Support for RTL8211F PHY */
+static struct phy_driver RTL8211F_driver = {
+ .name = "RealTek RTL8211F",
+ .uid = 0x1cc916,
+ .mask = 0xffffff,
+ .features = PHY_GBIT_FEATURES,
+ .config = &rtl8211f_config,
+ .startup = &rtl8211f_startup,
+ .shutdown = &genphy_shutdown,
+};
+
int phy_realtek_init(void)
{
phy_register(&RTL8211B_driver);
phy_register(&RTL8211E_driver);
+ phy_register(&RTL8211F_driver);
phy_register(&RTL8211DN_driver);
return 0;