diff options
author | Tom Rini <trini@konsulko.com> | 2015-10-29 16:30:33 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2015-10-29 16:30:33 -0400 |
commit | 0eb4cf9c14315e1976a116de75da6f420ac0e8dd (patch) | |
tree | 3933d354a6be71cbe66d583fec3f5b2479e596ee /drivers | |
parent | 446d37c1acc76680770400fd90e6c502e49d72df (diff) | |
parent | ac1d31380618f3f68bf7f05b73b6ab0cdeab0e9f (diff) | |
download | u-boot-0eb4cf9c14315e1976a116de75da6f420ac0e8dd.tar.gz |
Merge branch 'master' of git://git.denx.de/u-boot-net
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/core/uclass.c | 7 | ||||
-rw-r--r-- | drivers/net/designware.c | 12 | ||||
-rw-r--r-- | drivers/net/pch_gbe.c | 12 | ||||
-rw-r--r-- | drivers/net/phy/micrel.c | 40 | ||||
-rw-r--r-- | drivers/net/phy/phy.c | 14 | ||||
-rw-r--r-- | drivers/net/rtl8169.c | 10 | ||||
-rw-r--r-- | drivers/usb/eth/smsc95xx.c | 23 |
7 files changed, 85 insertions, 33 deletions
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index e800c28653..1af09472a2 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -523,22 +523,15 @@ int uclass_post_probe_device(struct udevice *dev) #if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE) int uclass_pre_remove_device(struct udevice *dev) { - struct uclass_driver *uc_drv; struct uclass *uc; int ret; uc = dev->uclass; - uc_drv = uc->uc_drv; if (uc->uc_drv->pre_remove) { ret = uc->uc_drv->pre_remove(dev); if (ret) return ret; } - if (uc_drv->per_device_auto_alloc_size) { - free(dev->uclass_priv); - dev->uclass_priv = NULL; - } - dev->seq = -1; return 0; } diff --git a/drivers/net/designware.c b/drivers/net/designware.c index 6433896eec..a6c39c39ff 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -613,6 +613,17 @@ static int designware_eth_probe(struct udevice *dev) return ret; } +static int designware_eth_remove(struct udevice *dev) +{ + struct dw_eth_dev *priv = dev_get_priv(dev); + + free(priv->phydev); + mdio_unregister(priv->bus); + mdio_free(priv->bus); + + return 0; +} + static const struct eth_ops designware_eth_ops = { .start = designware_eth_start, .send = designware_eth_send, @@ -653,6 +664,7 @@ U_BOOT_DRIVER(eth_designware) = { .ofdata_to_platdata = designware_eth_ofdata_to_platdata, .bind = designware_eth_bind, .probe = designware_eth_probe, + .remove = designware_eth_remove, .ops = &designware_eth_ops, .priv_auto_alloc_size = sizeof(struct dw_eth_dev), .platdata_auto_alloc_size = sizeof(struct eth_pdata), diff --git a/drivers/net/pch_gbe.c b/drivers/net/pch_gbe.c index 004fcf88c2..dfc01000fc 100644 --- a/drivers/net/pch_gbe.c +++ b/drivers/net/pch_gbe.c @@ -452,6 +452,17 @@ int pch_gbe_probe(struct udevice *dev) return pch_gbe_phy_init(dev); } +int pch_gbe_remove(struct udevice *dev) +{ + struct pch_gbe_priv *priv = dev_get_priv(dev); + + free(priv->phydev); + mdio_unregister(priv->bus); + mdio_free(priv->bus); + + return 0; +} + static const struct eth_ops pch_gbe_ops = { .start = pch_gbe_start, .send = pch_gbe_send, @@ -470,6 +481,7 @@ U_BOOT_DRIVER(eth_pch_gbe) = { .id = UCLASS_ETH, .of_match = pch_gbe_ids, .probe = pch_gbe_probe, + .remove = pch_gbe_remove, .ops = &pch_gbe_ops, .priv_auto_alloc_size = sizeof(struct pch_gbe_priv), .platdata_auto_alloc_size = sizeof(struct eth_pdata), diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 49f444ac4c..5e49666bbb 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -22,6 +22,44 @@ static struct phy_driver KSZ804_driver = { .shutdown = &genphy_shutdown, }; +static struct phy_driver KSZ8031_driver = { + .name = "Micrel KSZ8021/KSZ8031", + .uid = 0x221550, + .mask = 0xfffff0, + .features = PHY_BASIC_FEATURES, + .config = &genphy_config, + .startup = &genphy_startup, + .shutdown = &genphy_shutdown, +}; + +/** + * KSZ8051 + */ +#define MII_KSZ8051_PHY_OMSO 0x16 +#define MII_KSZ8051_PHY_OMSO_NAND_TREE_ON (1 << 5) + +static int ksz8051_config(struct phy_device *phydev) +{ + unsigned val; + + /* Disable NAND-tree */ + val = phy_read(phydev, MDIO_DEVAD_NONE, MII_KSZ8051_PHY_OMSO); + val &= ~MII_KSZ8051_PHY_OMSO_NAND_TREE_ON; + phy_write(phydev, MDIO_DEVAD_NONE, MII_KSZ8051_PHY_OMSO, val); + + return genphy_config(phydev); +} + +static struct phy_driver KSZ8051_driver = { + .name = "Micrel KSZ8051", + .uid = 0x221550, + .mask = 0xfffff0, + .features = PHY_BASIC_FEATURES, + .config = &ksz8051_config, + .startup = &genphy_startup, + .shutdown = &genphy_shutdown, +}; + static struct phy_driver KSZ8081_driver = { .name = "Micrel KSZ8081", .uid = 0x221560, @@ -282,6 +320,8 @@ static struct phy_driver ksz9031_driver = { int phy_micrel_init(void) { phy_register(&KSZ804_driver); + phy_register(&KSZ8031_driver); + phy_register(&KSZ8051_driver); phy_register(&KSZ8081_driver); #ifdef CONFIG_PHY_MICREL_KSZ9021 phy_register(&ksz9021_driver); diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index a6023f1033..d7364ffc34 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -671,8 +671,16 @@ static struct phy_device *get_phy_device_by_mask(struct mii_dev *bus, if (phydev) return phydev; } - printf("Phy %d not found\n", ffs(phy_mask) - 1); - return phy_device_create(bus, ffs(phy_mask) - 1, 0xffffffff, interface); + + debug("\n%s PHY: ", bus->name); + while (phy_mask) { + int addr = ffs(phy_mask) - 1; + debug("%d ", addr); + phy_mask &= ~(1 << addr); + } + debug("not found\n"); + + return NULL; } /** @@ -781,7 +789,7 @@ void phy_connect_dev(struct phy_device *phydev, struct eth_device *dev) { /* Soft Reset the PHY */ phy_reset(phydev); - if (phydev->dev) { + if (phydev->dev && phydev->dev != dev) { printf("%s:%d is connected to %s. Reconnecting to %s\n", phydev->bus->name, phydev->addr, phydev->dev->name, dev->name); diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c index ebd46b27e5..19422c4a2a 100644 --- a/drivers/net/rtl8169.c +++ b/drivers/net/rtl8169.c @@ -581,7 +581,8 @@ int rtl8169_eth_recv(struct udevice *dev, int flags, uchar **packetp) #else static int rtl_recv(struct eth_device *dev) { - return rtl_recv_common((pci_dev_t)dev->priv, dev->iobase, NULL); + return rtl_recv_common((pci_dev_t)(unsigned long)dev->priv, + dev->iobase, NULL); } #endif /* nCONFIG_DM_ETH */ @@ -666,8 +667,8 @@ int rtl8169_eth_send(struct udevice *dev, void *packet, int length) #else static int rtl_send(struct eth_device *dev, void *packet, int length) { - return rtl_send_common((pci_dev_t)dev->priv, dev->iobase, packet, - length); + return rtl_send_common((pci_dev_t)(unsigned long)dev->priv, + dev->iobase, packet, length); } #endif @@ -846,7 +847,8 @@ RESET - Finish setting up the ethernet interface ***************************************************************************/ static int rtl_reset(struct eth_device *dev, bd_t *bis) { - rtl8169_common_start((pci_dev_t)dev->priv, dev->enetaddr); + rtl8169_common_start((pci_dev_t)(unsigned long)dev->priv, + dev->enetaddr); return 0; } diff --git a/drivers/usb/eth/smsc95xx.c b/drivers/usb/eth/smsc95xx.c index d4b5ff465a..202e48285f 100644 --- a/drivers/usb/eth/smsc95xx.c +++ b/drivers/usb/eth/smsc95xx.c @@ -120,8 +120,9 @@ /* Some extra defines */ #define HS_USB_PKT_SIZE 512 #define FS_USB_PKT_SIZE 64 -#define DEFAULT_HS_BURST_CAP_SIZE (16 * 1024 + 5 * HS_USB_PKT_SIZE) -#define DEFAULT_FS_BURST_CAP_SIZE (6 * 1024 + 33 * FS_USB_PKT_SIZE) +/* 5/33 is lower limit for BURST_CAP to work */ +#define DEFAULT_HS_BURST_CAP_SIZE (5 * HS_USB_PKT_SIZE) +#define DEFAULT_FS_BURST_CAP_SIZE (33 * FS_USB_PKT_SIZE) #define DEFAULT_BULK_IN_DELAY 0x00002000 #define MAX_SINGLE_PACKET_SIZE 2048 #define EEPROM_MAC_OFFSET 0x01 @@ -135,7 +136,7 @@ #define USB_BULK_SEND_TIMEOUT 5000 #define USB_BULK_RECV_TIMEOUT 5000 -#define RX_URB_SIZE 2048 +#define RX_URB_SIZE DEFAULT_HS_BURST_CAP_SIZE #define PHY_CONNECT_TIMEOUT 5000 #define TURBO_MODE @@ -529,22 +530,6 @@ static int smsc95xx_init_common(struct usb_device *udev, struct ueth_data *dev, if (ret < 0) return ret; - ret = smsc95xx_read_reg(udev, HW_CFG, &read_buf); - if (ret < 0) - return ret; - debug("Read Value from HW_CFG : 0x%08x\n", read_buf); - - read_buf |= HW_CFG_BIR_; - ret = smsc95xx_write_reg(udev, HW_CFG, read_buf); - if (ret < 0) - return ret; - - ret = smsc95xx_read_reg(udev, HW_CFG, &read_buf); - if (ret < 0) - return ret; - debug("Read Value from HW_CFG after writing " - "HW_CFG_BIR_: 0x%08x\n", read_buf); - #ifdef TURBO_MODE if (dev->pusb_dev->speed == USB_SPEED_HIGH) { burst_cap = DEFAULT_HS_BURST_CAP_SIZE / HS_USB_PKT_SIZE; |