diff --git a/drivers/net/designware.c b/drivers/net/designware.c index 8006527..966f64f 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -213,12 +213,34 @@ rx_descs_init(dev); } +/* Get PHY out of power saving mode. If this is needed elsewhere then + * consider making it part of phy-core and adding a resume method to + * the phy device ops. */ +static int phy_resume(struct phy_device *phydev) +{ + int bmcr; + + bmcr = phy_read(phydev, MII_BMCR); + if (bmcr < 0) + return bmcr; + if (bmcr & BMCR_PDOWN) { + bmcr &= ~BMCR_PDOWN; + return phy_write(phydev, MII_BMCR, bmcr); + } + return 0; +} + static int dwc_ether_init(struct eth_device *dev) { struct dw_eth_dev *priv = dev->priv; struct eth_mac_regs *mac_p = priv->mac_regs_p; struct eth_dma_regs *dma_p = priv->dma_regs_p; + /* Before we reset the mac, we must insure the PHY is not powered down + * as the dw controller needs all clock domains to be running, including + * the PHY clock, to come out of a mac reset. */ + phy_resume(dev->phydev); + if (mac_reset(dev) < 0) return -1; @@ -275,6 +297,8 @@ if (ret) return ret; + dwc_ether_init(dev); + descs_init(dev); /* @@ -468,7 +492,6 @@ edev->priv = priv; edev->parent = dev; - edev->init = dwc_ether_init; edev->open = dwc_ether_open; edev->send = dwc_ether_send; edev->recv = dwc_ether_rx; diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c index 78ccb85..5418034 100644 --- a/drivers/net/fec_imx.c +++ b/drivers/net/fec_imx.c @@ -259,7 +259,7 @@ writel((mac[0] << 24) + (mac[1] << 16) + (mac[2] << 8) + mac[3], fec->regs + FEC_PADDR1); writel((mac[4] << 24) + (mac[5] << 16) + 0x8808, fec->regs + FEC_PADDR2); - return 0; + return 0; } static int fec_init(struct eth_device *dev) @@ -647,13 +647,14 @@ #endif static int fec_probe(struct device_d *dev) { - struct fec_platform_data *pdata = (struct fec_platform_data *)dev->platform_data; - struct eth_device *edev; + struct fec_platform_data *pdata = (struct fec_platform_data *)dev->platform_data; + struct eth_device *edev; struct fec_priv *fec; void *base; int ret; enum fec_type type; int phy_reset; + u32 msec = 1; ret = dev_get_drvdata(dev, (const void **)&type); if (ret) @@ -684,6 +685,8 @@ phy_reset = of_get_named_gpio(dev->device_node, "phy-reset-gpios", 0); if (gpio_is_valid(phy_reset)) { + of_property_read_u32(dev->device_node, "phy-reset-duration", &msec); + ret = gpio_request(phy_reset, "phy-reset"); if (ret) goto err_free; @@ -692,7 +695,7 @@ if (ret) goto err_free; - udelay(10); + mdelay(msec); gpio_set_value(phy_reset, 1); } @@ -775,7 +778,7 @@ }, { .compatible = "fsl,imx6q-fec", .data = (void *)FEC_TYPE_IMX6, - }, { + }, { .compatible = "fsl,imx6sx-fec", .data = (void *)FEC_TYPE_IMX6, }, { diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c index 47d5e4a8..9ec0178 100644 --- a/drivers/net/rtl8169.c +++ b/drivers/net/rtl8169.c @@ -51,10 +51,12 @@ int chipset; volatile struct bufdesc *tx_desc; + dma_addr_t tx_desc_phys; void *tx_buf; unsigned int cur_tx; volatile struct bufdesc *rx_desc; + dma_addr_t rx_desc_phys; void *rx_buf; unsigned int cur_rx; @@ -228,10 +230,10 @@ priv->cur_rx = priv->cur_tx = 0; priv->tx_desc = dma_alloc_coherent(NUM_TX_DESC * - sizeof(struct bufdesc), DMA_ADDRESS_BROKEN); + sizeof(struct bufdesc), &priv->tx_desc_phys); priv->tx_buf = malloc(NUM_TX_DESC * PKT_BUF_SIZE); priv->rx_desc = dma_alloc_coherent(NUM_RX_DESC * - sizeof(struct bufdesc), DMA_ADDRESS_BROKEN); + sizeof(struct bufdesc), &priv->rx_desc_phys); priv->rx_buf = malloc(NUM_RX_DESC * PKT_BUF_SIZE); dma_sync_single_for_device((unsigned long)priv->rx_buf, NUM_RX_DESC * PKT_BUF_SIZE, DMA_FROM_DEVICE); @@ -275,9 +277,9 @@ /* Set DMA burst size and Interframe Gap Time */ RTL_W32(priv, TxConfig, (6 << TxDMAShift) | (3 << TxInterFrameGapShift)); - RTL_W32(priv, TxDescStartAddrLow, virt_to_phys(priv->tx_desc)); + RTL_W32(priv, TxDescStartAddrLow, priv->tx_desc_phys); RTL_W32(priv, TxDescStartAddrHigh, 0); - RTL_W32(priv, RxDescStartAddrLow, virt_to_phys(priv->rx_desc)); + RTL_W32(priv, RxDescStartAddrLow, priv->rx_desc_phys); RTL_W32(priv, RxDescStartAddrHigh, 0); /* RTL-8169sc/8110sc or later version */ diff --git a/drivers/net/tap.c b/drivers/net/tap.c index ca53f12..4277956 100644 --- a/drivers/net/tap.c +++ b/drivers/net/tap.c @@ -29,7 +29,7 @@ char *name; }; -int tap_eth_send (struct eth_device *edev, void *packet, int length) +static int tap_eth_send(struct eth_device *edev, void *packet, int length) { struct tap_priv *priv = edev->priv; @@ -37,7 +37,7 @@ return 0; } -int tap_eth_rx (struct eth_device *edev) +static int tap_eth_rx(struct eth_device *edev) { struct tap_priv *priv = edev->priv; int length; @@ -50,12 +50,12 @@ return 0; } -int tap_eth_open(struct eth_device *edev) +static int tap_eth_open(struct eth_device *edev) { return 0; } -void tap_eth_halt (struct eth_device *edev) +static void tap_eth_halt(struct eth_device *edev) { /* nothing to do here */ } @@ -70,7 +70,7 @@ return 0; } -int tap_probe(struct device_d *dev) +static int tap_probe(struct device_d *dev) { struct eth_device *edev; struct tap_priv *priv; @@ -99,14 +99,15 @@ eth_register(edev); - return 0; + return 0; + out: free(priv); return ret; } static struct driver_d tap_driver = { - .name = "tap", - .probe = tap_probe, + .name = "tap", + .probe = tap_probe, }; device_platform_driver(tap_driver); diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index 4c53a14..3ca27ff 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c @@ -158,7 +158,7 @@ u16 size; u16 offset; bool split_head; - unsigned char ax_skb[RX_FIXUP_SIZE]; + unsigned char ax_skb[RX_FIXUP_SIZE] __aligned(2); }; struct asix_common_private { @@ -424,7 +424,7 @@ return 0; } -int asix_rx_fixup_internal(struct usbnet *dev, void *buf, int len, +static int asix_rx_fixup_internal(struct usbnet *dev, void *buf, int len, struct asix_rx_fixup_info *rx) { int offset = 0;