aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/lan78xx.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-02-10net: lan78xx: fix build errors when linux/phy*.h is removed from net/dsa.hRussell King1-0/+1
drivers/net/usb/lan78xx.c:394:33: sparse: expected ; at end of declaration drivers/net/usb/lan78xx.c:394:33: sparse: Expected } at end of struct-union-enum-specifier drivers/net/usb/lan78xx.c:394:33: sparse: got interface drivers/net/usb/lan78xx.c:403:1: sparse: Expected ; at the end of type declaration drivers/net/usb/lan78xx.c:403:1: sparse: got } Add linux/phy.h to lan78xx.c Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-12-08lan78xx: add LAN7801 MAC only supportWoojung Huh1-2/+107
Add LAN7801 MAC only support with phy fixup functions. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-12-06Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller1-0/+1
2016-12-05net: usb: set error code when usb_alloc_urb failsPan Bian1-0/+1
In function lan78xx_probe(), variable ret takes the errno code on failures. However, when the call to usb_alloc_urb() fails, its value will keeps 0. 0 indicates success in the context, which is inconsistent with the execution result. This patch fixes the bug, assigning "-ENOMEM" to ret when usb_alloc_urb() returns a NULL pointer. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188771 Signed-off-by: Pan Bian <bianpan2016@163.com> Acked-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-11-18lan78xx: relocate mdix setting to phy driverWoojung Huh1-70/+3
Relocate mdix code to phy driver to be called at config_init(). Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-11-15net: usb: lan78xx: Utilize phy_ethtool_nway_resetFlorian Fainelli1-6/+1
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Acked-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-11-02lan78xx: Use irq_domain for phy interrupt from USB Int. EPWoojung Huh1-26/+189
To utilize phylib with interrupt fully than handling some of phy stuff in the MAC driver, create irq_domain for USB interrupt EP of phy interrupt and pass the irq number to phy_connect_direct() instead of PHY_IGNORE_INTERRUPT. Idea comes from drivers/gpio/gpio-dl2.c Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-20net: use core MTU range checking in USB NIC driversJarod Wilson1-5/+3
usbnet: - Remove stale new_mtu <= 0 check in usbnet.c - Set min_mtu = 0, max_mtu = 65535 (sub-drivers must set their own max_mtu and/or min_mtu as needed) r8152: - Set appropriate max_mtu for different variants (1500 or 9194) lan78xx: - Set max_mtu = 9000 asix_driver: - max_mtu = 16384 for ax88178 variant ax88179: - max_mtu = 4088 cdc_ncm: - max_mtu from hardware cdc-phonet: - min_mtu = 6, max_mtu = 65541 sierra_net: - max_mtu = 1500, call usbnet_change_mtu directly - sierra_net_change_mtu checked for MTU > 1500, then called usbnet_change_mtu, but if we set max_mtu to let the network core handle the range check, then we can simply call usbnet_change_mtu directly smsc75xx: - max_mtu = 9000 CC: netdev@vger.kernel.org CC: Woojung Huh <woojung.huh@microchip.com> CC: Microchip Linux Driver Support <UNGLinuxDriver@microchip.com> CC: Hayes Wang <hayeswang@realtek.com> CC: Oliver Neukum <oneukum@suse.com> CC: Steve Glendinning <steve.glendinning@shawell.net> Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-12net: usb: lan78xx: use new api ethtool_{get|set}_link_ksettingsPhilippe Reynes1-30/+40
The ethtool api {get|set}_settings is deprecated. We move this driver to new api {get|set}_link_ksettings. Signed-off-by: Philippe Reynes <tremyfr@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-09-06lan78xx: mark symbols static where possibleBaoyou Xie1-11/+13
We get a few warnings when building kernel with W=1: drivers/net/usb/lan78xx.c:1182:6: warning: no previous prototype for 'lan78xx_defer_kevent' [-Wmissing-prototypes] drivers/net/usb/lan78xx.c:1409:5: warning: no previous prototype for 'lan78xx_nway_reset' [-Wmissing-prototypes] drivers/net/usb/lan78xx.c:2000:5: warning: no previous prototype for 'lan78xx_set_mac_addr' [-Wmissing-prototypes] .... In fact, these functions are only used in the file in which they are declared and don't need a declaration, but can be made static. so this patch marks these functions with 'static'. Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-08-13net: usb: lan78xx: don't print error when allocating urb failsWolfram Sang1-3/+1
kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Acked-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-05-04treewide: replace dev->trans_start update with helperFlorian Westphal1-2/+2
Replace all trans_start updates with netif_trans_update helper. change was done via spatch: struct net_device *d; @@ - d->trans_start = jiffies + netif_trans_update(d) Compile tested only. Cc: user-mode-linux-devel@lists.sourceforge.net Cc: linux-xtensa@linux-xtensa.org Cc: linux1394-devel@lists.sourceforge.net Cc: linux-rdma@vger.kernel.org Cc: netdev@vger.kernel.org Cc: MPT-FusionLinux.pdl@broadcom.com Cc: linux-scsi@vger.kernel.org Cc: linux-can@vger.kernel.org Cc: linux-parisc@vger.kernel.org Cc: linux-omap@vger.kernel.org Cc: linux-hams@vger.kernel.org Cc: linux-usb@vger.kernel.org Cc: linux-wireless@vger.kernel.org Cc: linux-s390@vger.kernel.org Cc: devel@driverdev.osuosl.org Cc: b.a.t.m.a.n@lists.open-mesh.org Cc: linux-bluetooth@vger.kernel.org Signed-off-by: Florian Westphal <fw@strlen.de> Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com> Acked-by: Mugunthan V N <mugunthanvnm@ti.com> Acked-by: Antonio Quartulli <a@unstable.cc> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-04-28lan78xx: workaround of forced 100 Full/Half duplex mode errorWoojung Huh1-1/+28
At forced 100 Full & Half duplex mode, chip may fail to set mode correctly when cable is switched between long(~50+m) and short one. As workaround, set to 10 before setting to 100 at forced 100 F/H mode. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-04-28lan78xx: fix statistics counter errorWoojung Huh1-5/+10
Fix rx_bytes, tx_bytes and tx_frames error in netdev.stats. - rx_bytes counted bytes excluding size of struct ethhdr. - tx_packets didn't count multiple packets in a single urb - tx_bytes included 8 bytes of extra commands. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-03-20Revert "lan78xx: add ndo_get_stats64"David S. Miller1-49/+0
This reverts commit a59f8c5b048dc938fb958c91c282c865cd845705. There are several bugs in this new code, for example: 1) Uses sleeping locks in get_stats64, which is not allowed, as the operation can be invoked in an atomic context. 2) Uses PM fields without CONFIG_PM or similar guards. 3) Does not synchronize HW stats when the device runtime suspends. Therefore this is being reverted until a correct version is implemented. Signed-off-by: David S. Miller <davem@davemloft.net>
2016-03-18lan78xx: add ndo_get_stats64Woojung Huh1-0/+49
Add lan78xx_get_stats64 of ndo_get_stats64 to report all statistics counters including errors from HW statistics. Read from HW when auto suspend is disabled, use saved counter when auto suspend is enabled because periodic call to ndo_get_stats64 prevents USB auto suspend. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-03-18lan78xx: handle statistics counter rolloverWoojung Huh1-13/+239
Update to handle statistics counter rollover. Check statistics counter periodically and compensate it when counter value rolls over at max (20 or 32bits). Simple mechanism adjusts monitoring timer to allow USB auto suspend. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-02-29lan78xx: add ethtool set & get pause functionsWoojung.Huh@microchip.com1-3/+77
Add ethtool operations of set_pauseram and get_pauseparm. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-02-29lan78xx: remove unnecessary codeWoojung.Huh@microchip.com1-6/+1
It is not required after commit cd772de358d6 ("phy: keep pause flags in phy driver features") Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-02-29lan78xx: replace devid to chipid & chiprevWoojung.Huh@microchip.com1-9/+11
Replace devid to chipid & chiprev for easy access. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-01-28lan78xx: throttle TX path at slower than SuperSpeed USBWoojung.Huh@microchip.com1-1/+3
Throttle TX path only at slower than SuperSpeed USB. SuperSpeed USB has enough bandwidth to maintain GigE. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-01-28lan78xx: Add to handle mux control per chip idWoojung.Huh@microchip.com1-27/+71
Depends on chip, some EEPROM pins are muxed with LED function. Disable & restore LED function to access EEPROM. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-01-28lan78xx: change to use updated phy-ignore-interruptsWoojung.Huh@microchip.com1-16/+14
Update lan78xx to use patch of commit 4f2aaf7dd95b ("Merge branch 'fix-phy-ignore-interrupts'"). Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-01-11Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller1-1/+54
Conflicts: drivers/net/bonding/bond_main.c drivers/net/ethernet/mellanox/mlxsw/spectrum.h drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c The bond_main.c and mellanox switch conflicts were cases of overlapping changes. Signed-off-by: David S. Miller <davem@davemloft.net>
2016-01-07net: lan78xx: Fix to write to OTP(One Time Programmable) per magic number.Woojung.Huh@microchip.com1-1/+54
This patch fixes a bug writing to EEPROM in lan78xx_ethtool_set_eeprom() when asked to write to OTP. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-01-07mdio: Move allocation of interrupts into coreAndrew Lunn1-10/+1
Have mdio_alloc() create the array of interrupt numbers, and initialize it to POLLING. This is what most MDIO drivers want, so allowing code to be removed from the drivers. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-09-28lan78xx: Return 0 when lan78xx_suspend() has no error.Woojung.Huh@microchip.com1-1/+1
lan78xx_suspend() may return non-zero from lan78xx_write_reg() in some scenario. Fix to return 0 when lan78xx_suspend() has no error. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-09-22usbnet: remove invalid checkAndrzej Hajda1-5/+0
skb->len is always non-negative. The problem has been detected using proposed semantic patch scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576 Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-09-17lan78xx: Remove not defined MAC_CR_GMII_EN_ bit from MAC_CR.Woojung.Huh@microchip.com1-3/+0
Remove not defined MAC_CR_GMII_EN_ bit from MAC_CR. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-09-17lan78xx: Create lan78xx_get_mdix_status() and lan78xx_set_mdix_status() for MDIX control.Woojung.Huh@microchip.com1-38/+52
Create lan78xx_get_mdix_status() and lan78xx_set_mdix_status() for MDIX control. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-09-17lan78xx: Remove phy defines in lan78xx.h and use defines in include/linux/microchipphy.hWoojung.Huh@microchip.com1-40/+40
Remove phy defines in lan78xx.h and use defines in include/linux/microchipphy.h. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-09-17lan78xx: Update to use phylib instead of mii_if_info.Woojung.Huh@microchip.com1-362/+256
Update to use phylib instead of mii_if_info. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-09-17lan78xx: Check device ready bit (PMT_CTL_READY_) after reset the PHYWoojung.Huh@microchip.com1-1/+1
Check device ready bit (PMT_CTL_READY_) after reset the PHY. Device may not be ready even if PHY_RST_ is cleared depends on configuration. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-09-06lan78xx: Fix ladv/radv error handling in lan78xx_link_reset()Geert Uytterhoeven1-6/+5
net/usb/lan78xx.c: In function ‘lan78xx_link_reset’: net/usb/lan78xx.c:1107: warning: comparison is always false due to limited range of data type net/usb/lan78xx.c:1111: warning: comparison is always false due to limited range of data type Assigning return values that can be negative error codes to "u16" variables makes them positive, ignoring the errors. Hence use "int" instead. Drop the "unlikely"s (unlikely considered harmful) and propagate the actual error values instead of overriding them to -EIO while we're at it. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-08-12lan78xx: Remove BUG_ON()Woojung.Huh@microchip.com1-31/+0
Removing BUG_ON() Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-08-12lan78xx: Fix Smatch WarningsWoojung.Huh@microchip.com1-11/+7
lan78xx.c:2282 tx_complete() warn: variable dereferenced before check 'skb' (see line 2249) lan78xx.c:2885 lan78xx_bh() info: ignoring unreachable code. lan78xx.c:3159 lan78xx_probe() info: ignoring unreachable code. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-07-31Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driverWoojung.Huh@microchip.com1-0/+3530
Repost patch of driver for LAN7800 family of USB 2.0 & USB 3.0 to Gigabit Ethernet. - remove module param which can be configurable by standard mechanism. - remove other module parms except msg_level per review comment. - update to handle byte swap for statistics structure correctly. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>