diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ar231x.c | 6 | ||||
-rw-r--r-- | drivers/net/designware_tegra186.c | 5 | ||||
-rw-r--r-- | drivers/net/macb.c | 55 | ||||
-rw-r--r-- | drivers/net/phy/ar8327.c | 7 | ||||
-rw-r--r-- | drivers/net/phy/at803x.c | 7 | ||||
-rw-r--r-- | drivers/net/phy/davicom.c | 7 | ||||
-rw-r--r-- | drivers/net/phy/dp83867.c | 6 | ||||
-rw-r--r-- | drivers/net/phy/lxt.c | 7 | ||||
-rw-r--r-- | drivers/net/phy/marvell.c | 7 | ||||
-rw-r--r-- | drivers/net/phy/micrel.c | 7 | ||||
-rw-r--r-- | drivers/net/phy/mv88e6xxx/port.c | 8 | ||||
-rw-r--r-- | drivers/net/phy/national.c | 6 | ||||
-rw-r--r-- | drivers/net/phy/phy.c | 6 | ||||
-rw-r--r-- | drivers/net/phy/realtek.c | 7 | ||||
-rw-r--r-- | drivers/net/phy/smsc.c | 6 | ||||
-rw-r--r-- | drivers/net/usb/asix.c | 31 |
16 files changed, 76 insertions, 102 deletions
diff --git a/drivers/net/ar231x.c b/drivers/net/ar231x.c index 48d41b8cb2..6d1a90684c 100644 --- a/drivers/net/ar231x.c +++ b/drivers/net/ar231x.c @@ -424,8 +424,4 @@ static struct driver_d ar231x_eth_driver = { .probe = ar231x_eth_probe, }; -static int ar231x_eth_driver_init(void) -{ - return platform_driver_register(&ar231x_eth_driver); -} -device_initcall(ar231x_eth_driver_init); +device_platform_driver(ar231x_eth_driver); diff --git a/drivers/net/designware_tegra186.c b/drivers/net/designware_tegra186.c index 5348f65c41..f3b37be3ce 100644 --- a/drivers/net/designware_tegra186.c +++ b/drivers/net/designware_tegra186.c @@ -213,9 +213,8 @@ static int eqos_init_tegra186(struct device_d *dev, struct eqos *eqos) priv->rst = reset_control_get(dev, "eqos"); if (IS_ERR(priv->rst)) { - ret = PTR_ERR(priv->rst); - dev_err(dev, "reset_get_by_name(rst) failed: %s\n", strerror(-ret)); - return ret; + dev_err(dev, "reset_get_by_name(rst) failed: %pe\n", priv->rst); + return PTR_ERR(priv->rst); } phy_reset = of_get_named_gpio(dev->device_node, "phy-reset-gpios", 0); diff --git a/drivers/net/macb.c b/drivers/net/macb.c index e3e039f679..188dbf2d8c 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -144,8 +144,6 @@ static void reclaim_rx_buffers(struct macb_device *macb, { unsigned int i; - dev_dbg(macb->dev, "%s\n", __func__); - i = macb->rx_tail; while (i > new_tail) { macb->rx_ring[i].addr &= ~MACB_BIT(RX_USED); @@ -170,8 +168,6 @@ static int gem_recv(struct eth_device *edev) int length; u32 status; - dev_dbg(macb->dev, "%s\n", __func__); - for (;;) { barrier(); if (!(macb->rx_ring[macb->rx_tail].addr & MACB_BIT(RX_USED))) @@ -206,8 +202,6 @@ static int macb_recv(struct eth_device *edev) int wrapped = 0; u32 status; - dev_dbg(macb->dev, "%s\n", __func__); - for (;;) { barrier(); if (!(macb->rx_ring[rx_tail].addr & MACB_BIT(RX_USED))) @@ -264,9 +258,38 @@ static int macb_recv(struct eth_device *edev) return 0; } +static int macb_set_tx_clk(struct macb_device *macb, int speed) +{ + int rate; + int rate_rounded; + + if (!macb->txclk) { + dev_dbg(macb->dev, "txclk not available\n"); + return 0; + } + + switch (speed) { + case SPEED_100: + rate = 25000000; + break; + case SPEED_1000: + rate = 125000000; + break; + default: + return -EINVAL; + } + + rate_rounded = clk_round_rate(macb->txclk, rate); + if (rate_rounded <= 0) + return -EINVAL; + + return clk_set_rate(macb->txclk, rate_rounded); +} + static void macb_adjust_link(struct eth_device *edev) { struct macb_device *macb = edev->priv; + int err; u32 reg; reg = macb_readl(macb, NCFGR); @@ -282,14 +305,16 @@ static void macb_adjust_link(struct eth_device *edev) reg |= GEM_BIT(GBE); macb_or_gem_writel(macb, NCFGR, reg); + + err = macb_set_tx_clk(macb, edev->phydev->speed); + if (err) + dev_warn(macb->dev, "cannot set txclk\n"); } static int macb_open(struct eth_device *edev) { struct macb_device *macb = edev->priv; - dev_dbg(macb->dev, "%s\n", __func__); - /* Enable TX and RX */ macb_writel(macb, NCR, MACB_BIT(TE) | MACB_BIT(RE)); @@ -340,7 +365,7 @@ static int gmac_init_dummy_tx_queues(struct macb_device *macb) MACB_BIT(TX_LAST) | MACB_BIT(TX_USED); for (i = 1; i < num_queues; i++) - gem_writel_queue_TBQP(macb, &macb->gem_q1_descs[0], i - 1); + gem_writel_queue_TBQP(macb, (ulong)macb->gem_q1_descs, i - 1); return 0; } @@ -350,8 +375,6 @@ static void macb_init(struct macb_device *macb) unsigned long paddr, val = 0; int i; - dev_dbg(macb->dev, "%s\n", __func__); - /* * macb_halt should have been called at some point before now, * so we'll assume the controller is idle. @@ -441,8 +464,6 @@ static int macb_phy_read(struct mii_bus *bus, int addr, int reg) int value; uint64_t start; - dev_dbg(macb->dev, "%s\n", __func__); - netctl = macb_readl(macb, NCR); netctl |= MACB_BIT(MPE); macb_writel(macb, NCR, netctl); @@ -478,8 +499,6 @@ static int macb_phy_write(struct mii_bus *bus, int addr, int reg, u16 value) unsigned long netctl; unsigned long frame; - dev_dbg(macb->dev, "%s\n", __func__); - netctl = macb_readl(macb, NCR); netctl |= MACB_BIT(MPE); macb_writel(macb, NCR, netctl); @@ -510,8 +529,6 @@ static int macb_get_ethaddr(struct eth_device *edev, unsigned char *adr) u8 addr[6]; int i; - dev_dbg(macb->dev, "%s\n", __func__); - /* Check all 4 address register for vaild address */ for (i = 0; i < 4; i++) { bottom = macb_or_gem_readl(macb, SA1B + i * 8); @@ -537,8 +554,6 @@ static int macb_set_ethaddr(struct eth_device *edev, const unsigned char *adr) { struct macb_device *macb = edev->priv; - dev_dbg(macb->dev, "%s\n", __func__); - /* set hardware address */ macb_or_gem_writel(macb, SA1B, adr[0] | adr[1] << 8 | adr[2] << 16 | adr[3] << 24); macb_or_gem_writel(macb, SA1T, adr[4] | adr[5] << 8); @@ -742,6 +757,8 @@ static int macb_probe(struct device_d *dev) macb->txclk = clk_get(dev, "tx_clk"); if (!IS_ERR(macb->txclk)) clk_enable(macb->txclk); + else + macb->txclk = NULL; macb->rxclk = clk_get(dev, "rx_clk"); if (!IS_ERR(macb->rxclk)) diff --git a/drivers/net/phy/ar8327.c b/drivers/net/phy/ar8327.c index 5f3a2e2cf2..f13d574b30 100644 --- a/drivers/net/phy/ar8327.c +++ b/drivers/net/phy/ar8327.c @@ -268,9 +268,4 @@ static struct phy_driver ar8327n_driver[] = { .aneg_done = &ar8327n_aneg_done, }}; -static int atheros_phy_init(void) -{ - return phy_drivers_register(ar8327n_driver, - ARRAY_SIZE(ar8327n_driver)); -} -fs_initcall(atheros_phy_init); +device_phy_drivers(ar8327n_driver); diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index de053a36fb..016ed97020 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -243,9 +243,4 @@ static struct phy_driver at803x_driver[] = { .read_status = &genphy_read_status, } }; -static int atheros_phy_init(void) -{ - return phy_drivers_register(at803x_driver, - ARRAY_SIZE(at803x_driver)); -} -fs_initcall(atheros_phy_init); +device_phy_drivers(at803x_driver); diff --git a/drivers/net/phy/davicom.c b/drivers/net/phy/davicom.c index febaffa52c..794e5f2c96 100644 --- a/drivers/net/phy/davicom.c +++ b/drivers/net/phy/davicom.c @@ -127,9 +127,4 @@ static struct phy_driver dm91xx_driver[] = { .features = PHY_BASIC_FEATURES, } }; -static int dm9161_init(void) -{ - return phy_drivers_register(dm91xx_driver, - ARRAY_SIZE(dm91xx_driver)); -} -fs_initcall(dm9161_init); +device_phy_drivers(dm91xx_driver); diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c index 929a407b09..8131e8c9d6 100644 --- a/drivers/net/phy/dp83867.c +++ b/drivers/net/phy/dp83867.c @@ -311,8 +311,4 @@ static struct phy_driver dp83867_driver[] = { }, }; -static int dp83867_phy_init(void) -{ - return phy_drivers_register(dp83867_driver, ARRAY_SIZE(dp83867_driver)); -} -fs_initcall(dp83867_phy_init); +device_phy_drivers(dp83867_driver); diff --git a/drivers/net/phy/lxt.c b/drivers/net/phy/lxt.c index b661ae7316..9b023c8c40 100644 --- a/drivers/net/phy/lxt.c +++ b/drivers/net/phy/lxt.c @@ -19,9 +19,4 @@ static struct phy_driver lxt97x_driver[] = { .features = PHY_BASIC_FEATURES, } }; -static int lxt97x_phy_init(void) -{ - return phy_drivers_register(lxt97x_driver, - ARRAY_SIZE(lxt97x_driver)); -} -fs_initcall(lxt97x_phy_init); +device_phy_drivers(lxt97x_driver); diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index af39ed68fd..3bf0fef34b 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -733,9 +733,4 @@ static struct phy_driver marvell_drivers[] = { }, }; -static int __init marvell_phy_init(void) -{ - return phy_drivers_register(marvell_drivers, - ARRAY_SIZE(marvell_drivers)); -} -fs_initcall(marvell_phy_init); +device_phy_drivers(marvell_drivers); diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 4655430573..4e46370241 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -537,9 +537,4 @@ static struct phy_driver ksphy_driver[] = { .read_status = ksz8873mll_read_status, } }; -static int ksphy_init(void) -{ - return phy_drivers_register(ksphy_driver, - ARRAY_SIZE(ksphy_driver)); -} -fs_initcall(ksphy_init); +device_phy_drivers(ksphy_driver); diff --git a/drivers/net/phy/mv88e6xxx/port.c b/drivers/net/phy/mv88e6xxx/port.c index 52f95d622c..3f10719d9a 100644 --- a/drivers/net/phy/mv88e6xxx/port.c +++ b/drivers/net/phy/mv88e6xxx/port.c @@ -547,11 +547,7 @@ static struct phy_driver mv88e6xxx_port_driver = { .read_status = mv88e6xxx_port_read_status, }; -static int __init mv88e6xxx_port_driver_register(void) -{ - return phy_driver_register(&mv88e6xxx_port_driver); -} -fs_initcall(mv88e6xxx_port_driver_register); +device_phy_driver(mv88e6xxx_port_driver); int mv88e6xxx_port_probe(struct mv88e6xxx_chip *chip) { @@ -660,4 +656,4 @@ int mv88e6xxx_port_probe(struct mv88e6xxx_chip *chip) } return 0; -}
\ No newline at end of file +} diff --git a/drivers/net/phy/national.c b/drivers/net/phy/national.c index 83390b99ab..d74cd81933 100644 --- a/drivers/net/phy/national.c +++ b/drivers/net/phy/national.c @@ -84,8 +84,4 @@ static struct phy_driver dp83865_driver = { .config_init = ns_config_init, }; -static int ns_phy_init(void) -{ - return phy_driver_register(&dp83865_driver); -} -fs_initcall(ns_phy_init); +device_phy_driver(dp83865_driver); diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 57c2f8044f..622acbe40d 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -981,8 +981,4 @@ static struct phy_driver genphy_driver = { SUPPORTED_BNC, }; -static int generic_phy_register(void) -{ - return phy_driver_register(&genphy_driver); -} -device_initcall(generic_phy_register); +device_phy_driver(genphy_driver); diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 695a6c384d..9ba0495d41 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -196,9 +196,4 @@ static struct phy_driver realtek_drvs[] = { }, }; -static int __init realtek_phy_init(void) -{ - return phy_drivers_register(realtek_drvs, - ARRAY_SIZE(realtek_drvs)); -} -fs_initcall(realtek_phy_init); +device_phy_drivers(realtek_drvs); diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index d6705e4fe2..1e1f3d5274 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -135,8 +135,4 @@ static struct phy_driver smsc_phy_driver[] = { .config_init = lan87xx_config_init, } }; -static int __init smsc_init(void) -{ - return phy_drivers_register(smsc_phy_driver, ARRAY_SIZE(smsc_phy_driver)); -} -fs_initcall(smsc_init); +device_phy_drivers(smsc_phy_driver); diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index 3ca27ff027..1140be9d16 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c @@ -252,11 +252,19 @@ static int asix_mdio_read(struct mii_bus *bus, int phy_id, int loc) { struct usbnet *dev = bus->priv; __le16 res; + int ret; - asix_set_sw_mii(dev); - asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id, - (__u16)loc, 2, &res); - asix_set_hw_mii(dev); + ret = asix_set_sw_mii(dev); + if (ret < 0) + return ret; + + ret = asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id, (__u16)loc, 2, &res); + if (ret < 0) + return ret; + + ret = asix_set_hw_mii(dev); + if (ret < 0) + return ret; dev_dbg(&dev->edev.dev, "asix_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x\n", phy_id, loc, le16_to_cpu(res)); @@ -268,13 +276,22 @@ static int asix_mdio_write(struct mii_bus *bus, int phy_id, int loc, u16 val) { struct usbnet *dev = bus->priv; __le16 res = cpu_to_le16(val); + int ret; dev_dbg(&dev->edev.dev, "asix_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x\n", phy_id, loc, val); - asix_set_sw_mii(dev); - asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, (__u16)loc, 2, &res); - asix_set_hw_mii(dev); + ret = asix_set_sw_mii(dev); + if (ret < 0) + return ret; + + ret = asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, (__u16)loc, 2, &res); + if (ret < 0) + return ret; + + ret = asix_set_hw_mii(dev); + if (ret < 0) + return ret; return 0; } |