aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/eth/smsc95xx.c
AgeCommit message (Collapse)AuthorFilesLines
2020-12-13dm: treewide: Rename dev_get_platdata() to dev_get_plat()Simon Glass1-3/+3
Rename this to be consistent with the change from 'platdata'. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-13dm: treewide: Rename 'platdata' variables to just 'plat'Simon Glass1-1/+1
We use 'priv' for private data but often use 'platdata' for platform data. We can't really use 'pdata' since that is ambiguous (it could mean private or platform data). Rename some of the latter variables to end with 'plat' for consistency. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-13dm: treewide: Rename auto_alloc_size members to be shorterSimon Glass1-2/+2
This construct is quite long-winded. In earlier days it made some sense since auto-allocation was a strange concept. But with driver model now used pretty universally, we can shorten this to 'auto'. This reduces verbosity and makes it easier to read. Coincidentally it also ensures that every declaration is on one line, thus making dtoc's job easier. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-17treewide: convert bd_t to struct bd_info by coccinelleMasahiro Yamada1-1/+1
The Linux coding style guide (Documentation/process/coding-style.rst) clearly says: It's a **mistake** to use typedef for structures and pointers. Besides, using typedef for structures is annoying when you try to make headers self-contained. Let's say you have the following function declaration in a header: void foo(bd_t *bd); This is not self-contained since bd_t is not defined. To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h> #include <asm/u-boot.h> void foo(bd_t *bd); Then, the include direcective pulls in more bloat needlessly. If you use 'struct bd_info' instead, it is enough to put a forward declaration as follows: struct bd_info; void foo(struct bd_info *bd); Right, typedef'ing bd_t is a mistake. I used coccinelle to generate this commit. The semantic patch that makes this change is as follows: <smpl> @@ typedef bd_t; @@ -bd_t +struct bd_info </smpl> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-05-18common: Drop linux/delay.h from common headerSimon Glass1-0/+1
Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18common: Drop log.h from common headerSimon Glass1-0/+1
Move this header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18common: Drop net.h from common headerSimon Glass1-0/+1
Move this header out of the common header. Network support is used in quite a few places but it still does not warrant blanket inclusion. Note that this net.h header itself has quite a lot in it. It could be split into the driver-mode support, functions, structures, checksumming, etc. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini1-2/+1
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2017-05-09net: smsc95xx: Correct free_pkt() implementationSimon Glass1-2/+2
On further review this returns the wrong packet length from the driver. It may not be noticed since protocols will take care of it. Fix it by subtracting the header length from the packet length returned. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-10-13net: smsc95xx: fix DM MAC address readingStephen Warren1-0/+16
eth-uclass.c expects DM-capable Ethernet adapters to implement ops-> read_rom_hwaddr(), or for some other mechanism to set pdata->enetaddr, or for the user to set environment variable $usbethaddr. Without any of these, it will refuse to initialize the device since no valid MAC address is known. Implement this function for the smsc95xx driver. With this feature implemented, there is no point smsc95xx_init_common() re-reading the MAC address from ROM, so ifdef out this code when DM_ETH is enabled. This allows (at least) the built-in Ethernet on the NVIDIA Harmony board to operate again. Fixes: 0990fcb77219 ("net: smsc95xx: Add driver-model support") Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-08-15net: smsc95xx: Use correct get_unaligned functionsChris Packham1-2/+2
The __get_unaligned_le* functions may not be declared on all platforms. Instead, get_unaligned_le* should be used. On many platforms both of these are the same function. Signed-off-by: Chris Packham <judge.packham@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-04-01smsc95xx: fix operation on 64-bit systemsStephen Warren1-2/+2
smsc95xx_read_reg() should calculate sizeof(*data) not sizeof(data) since data is a pointer, and the value pointed at is being transferred over USB, not the value of the pointer. This fixes operation of the driver in 64-bit builds, such as the Raspberry Pi 3. Reported-by: Eric Anholt <eric@anholt.net> Signed-off-by: Stephen Warren <swarren@wwwdotorg.org> Acked-by: Marek Vasut <marex@denx.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2015-11-12driver: usb: Fix pointer conversion warnings for hikeyPrabhakar Kushwaha1-4/+5
Fix below compilation warings happening for hikey_defconfig drivers/usb/eth/smsc95xx.c:698:56: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] debug("** %s(), len %d, buf %#x\n", __func__, length, (int)msg); ^ include/common.h:109:26: note: in definition of macro ‘debug_cond’ printf(pr_fmt(fmt), ##args); \ ^ drivers/usb/eth/smsc95xx.c:698:2: note: in expansion of macro ‘debug’ debug("** %s(), len %d, buf %#x\n", __func__, length, (int)msg); ^ drivers/usb/eth/smsc95xx.c:718:2: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘long unsigned int’ [-Wformat=] debug("Tx: len = %u, actual = %u, err = %d\n", ^ drivers/usb/eth/smsc95xx.c: In function ‘smsc95xx_recv’: drivers/usb/eth/smsc95xx.c:802:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] cur_buf_align = (int)buf_ptr - (int)recv_buf; ^ drivers/usb/eth/smsc95xx.c:802:34: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] cur_buf_align = (int)buf_ptr - (int)recv_buf; Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
2015-10-29Merge branch 'master' of git://git.denx.de/u-boot-netTom Rini1-19/+4
2015-10-29smsc95xx: Use zero length packets when RX fifo is emptyStefan Brüns1-16/+0
Using NAKs on empty RX fifo for bulk in transfers is the right choice for a interrupt driven model, but U-Boot uses polling and expects an immediate answer if there is no incoming packet. Using ZLP Bulk In Response (BIR) mode avoids unexpected timeouts in the host controller driver. As ZLP mode is reset default, there is no need to set it. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2015-10-28smsc95xx: Fetch whole burst with 1 URB, avoid framing errorsStefan Brüns1-3/+4
smsc95xx_recv() does not reassemble bursts spread over multiple URBs. If there is a lot of broadcast traffic, the fifo will fill up to the burst cap limit. Lowering the burst cap to the URB size ensures no packet spans multiple urbs. Caveat, lower limit for working burst cap is 5/33 HS/FS packets. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2015-10-23dm: Rename dev_get_parentdata() to dev_get_parent_priv()Simon Glass1-2/+2
The current name is inconsistent with other driver model data access functions. Rename it and fix up all users. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2015-09-11Move ALLOC_CACHE_ALIGN_BUFFER() to the new memalign.h headerSimon Glass1-0/+1
Now that we have a new header file for cache-aligned allocation, we should move the stack-based allocation macro there also. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-08-06net: smsc95xx: Add driver-model supportSimon Glass1-0/+142
Add support for driver model, so that CONFIG_DM_ETH can be defined and used with this driver. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-08-06net: smsc95xx: Prepare for conversion to driver modelSimon Glass1-122/+150
At present struct eth_device is passed around all over the place. This does not exist with driver model. Add explicit arguments instead, so that with driver model we can pass the correct things. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-08-06net: smsc95xx: Correct the error numbersSimon Glass1-22/+26
Instead of returning -1 on error, we should use a proper error number. Fix the code to conform to this. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-08-06net: smsc95xx: Rename AX_RX_URB_SIZE to RX_URB_SIZESimon Glass1-5/+5
The AX_ prefix comes from the Asix driver. Since this is not that, we should avoid this confusing prefix. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-08-06net: smsc95xx: Sort the include filesSimon Glass1-2/+3
Tidy up the include file order before adding more. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-18net: cosmetic: Fix var naming net <-> eth driversJoe Hershberger1-1/+2
Update the naming convention used in the network stack functions and variables that Ethernet drivers use to interact with it. This cleans up the temporary hacks that were added to this interface along with the DM support. This patch has a few remaining checkpatch.pl failures that would be out of the scope of this patch to fix (drivers that are in gross violation of checkpatch.pl). Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18net: cosmetic: Name ethaddr variables consistentlyJoe Hershberger1-1/+1
Use "_ethaddr" at the end of variables and drop CamelCase. Make constant values actually 'const'. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2014-09-16net: usb: Add SMSC copyright to smsc95xx driverSimon Glass1-0/+1
This driver was upstreamed without an SMSC copyright, even thought it seems that SMSC was the original author. See the kernel version for a code comparison: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=2f7ca802bdae2ca41022618391c70c2876d92190 It's not clear who actually moved this code, or whether the kernel was the original source, or somewhere else, but it probably should still have the SMSC copyright. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-06-25usb: eth: smsc95xx: add LAN9500A device IDIlya Ledvich1-0/+1
Add LAN9500A product ID (0x9e00) in order to support LAN9500A based dongles. Tested on cm_t335. Signed-off-by: Ilya Ledvich <ilya@compulab.co.il> Acked-by: Marek Vasut <marex@denx.de>
2013-10-20usb:smsx95xx LED activity for USB net driverSuriyan Ramasami1-0/+14
Add LED activity for SMSX95XX USB Ether driver. Signed-off-by: “Suriyan Ramasami" <suriyan.r@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
2013-08-19net: smsc95xx: Add support for another SMSC95xx variantStefan Roese1-0/+1
This patch adds support for the SMSC9500 with product id 0x9900 which is equipped in the "EXSYS USB 2.0" etherner USB adapter. Tested on omap3_beagle. Signed-off-by: Stefan Roese <sr@denx.de>
2013-07-24Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk1-16/+1
Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
2013-05-14OMAP5: Enable USB Ethernet support with LAN9730Lubomir Popov1-0/+1
Added the LAN9730 to list of supported devices. This chip is used in the sEVM, uEVM and som5_evb. Tested on the som5_evb with dhcp and ping. Signed-off-by: Lubomir Popov <lpopov@mm-sol.com>
2013-03-18usb: usbeth: smsc95xx: remove EEPROM loaded checkMichael Spang1-4/+0
[port of Linux kernel commit bcd218be5aeb by Steve Glendinning] The eeprom read & write commands currently check the E2P_CMD_LOADED_ bit is set before allowing any operations. This prevents any reading or writing unless a correctly programmed EEPROM is installed. Signed-off-by: Michael Spang <spang@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Marek Vasut <marex@denx.de>
2012-09-26net: introduce transparent driver private in ueth_dataLucas Stach1-14/+35
Avoid clutter in ueth_data. Individual drivers should not mess with structures belonging to the core like this. Signed-off-by: Lucas Stach <dev@lynxeye.de> Reviewed-by: Marek Vasut <marex@denx.de> Acked-by: Marek Vasut <marex@denx.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2012-07-18smsc95xx: align buffers to cache line sizeIlya Yanok1-4/+9
Align buffers passed to the USB code to cache line size so they can be DMAed safely. Signed-off-by: Ilya Yanok <ilya.yanok@cogentembedded.com>
2012-05-22drivers/usb/eth/smsc95xx.c: Fix GCC 4.6 warningAnatolij Gustschin1-2/+1
Fix: smsc95xx.c: In function 'smsc95xx_eth_get_info': smsc95xx.c:869:12: warning: assignment from incompatible pointer type [enabled by default] Signed-off-by: Anatolij Gustschin <agust@denx.de>
2011-11-22smsc95xx: Debug message cleanupWolfgang Grandegger1-7/+3
Cc: Simon Glass <sjg@chromium.org> Cc: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Wolfgang Grandegger <wg@denx.de> Acked-by: Mike Frysinger <vapier@gentoo.org> Acked-by: Simon Glass <sjg@chromium.org>
2011-11-22smsc95xx: Fix MAC address programmingWolfgang Grandegger1-3/+3
Commit 79ad54400932d6484178a372fb3b659e3437473b broke MAC address programming in the SMSC95xx register set. Cc: Marek Vasut <marek.vasut@gmail.com> Cc: Wolfgang Denk <wd@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Wolfgang Grandegger <wg@denx.de> Acked-by: Mike Frysinger <vapier@gentoo.org> Acked-by: Simon Glass <sjg@chromium.org>
2011-10-27GCC4.6: Squash warnings in smsc95xx.cMarek Vasut1-1/+1
smsc95xx.c: In function 'smsc95xx_write_hwaddr': smsc95xx.c:380:2: warning: dereferencing type-punned pointer will break strict-aliasing rules Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Cc: Wolfgang Denk <wd@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Mike Frysinger <vapier@gentoo.org>
2011-08-08Add support for SMSC95XX USB 2.0 10/100MBit Ethernet AdapterSimon Glass1-0/+879
The SMSC95XX is a USB hub with a built-in Ethernet adapter. This adds support for this, using the USB host network framework. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Eric Bénard <eric@eukrea.com>