summaryrefslogtreecommitdiff
path: root/drivers/net/dm9000x.c
AgeCommit message (Collapse)Author
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini
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>
2016-01-14Fix GCC format-security errors and convert sprintfs.Ben Whitten
With format-security errors turned on, GCC picks up the use of sprintf with a format parameter not being a string literal. Simple uses of sprintf are also converted to use strcpy. Signed-off-by: Ben Whitten <ben.whitten@gmail.com> Acked-by: Wolfgang Denk <wd@denx.de> Reviewed-by: Tom Rini <trini@konsulko.com>
2015-05-20net: Remove all calls to net_random_ethaddr()Joe Hershberger
Remove the calls to net_random_ethaddr() that some boards and some drivers are calling. This is now implemented inside of net/eth.c Enable the feature for all boards that previously enabled it. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-By: Michael Walle <michael@walle.cc> (for the lsxl board part) Series-changes: 2 -Fixed bfin build errors
2015-04-18net: cosmetic: Fix var naming net <-> eth driversJoe Hershberger
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 Hershberger
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-05-12net: rename and refactor eth_rand_ethaddr() functionMasahiro Yamada
Some functions in include/net.h are ported from include/linux/etherdevice.h of Linux Kernel. For ex. is_zero_ether_addr() is_multicast_ether_addr() is_broadcast_ether_addr() is_valid_ether_addr(); So, we should use the same function name as that of Linux Kernel, eth_rand_addr(), for consistency. Besides, eth_rand_addr() has been implemented as an inline function. So it should not be surrounded by #ifdef CONFIG_RANDOM_MACADDR. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2013-11-22net: dm9000: random mac address supportAndrew Ruder
When an unprogrammed EEPROM is attached to a dm9000, the dm9000 will come up with a invalid MAC address of ff:ff:ff:ff:ff:ff. Add code that gets enabled if CONFIG_RANDOM_MACADDR is enabled that generates a random (and valid) locally administered MAC address that allows the system to network boot until a real MAC address can be configured. Signed-off-by: Andrew Ruder <andrew.ruder@elecsyscorp.com>
2013-10-14Coding Style cleanup: replace leading SPACEs by TABsWolfgang Denk
Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Drop changes for PEP 4 following python tools] Signed-off-by: Tom Rini <trini@ti.com>
2013-07-24Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk
Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
2012-05-22drivers/net/dm9000x.c: Fix compile warningJoe Hershberger
Fix this: dm9000x.c: In function 'dm9000_initialize': dm9000x.c:636:12: warning: assignment from incompatible pointer type Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Cc: Joe Hershberger <joe.hershberger@gmail.com>
2011-10-17DM9000:Add a byte swap macro for dm9000 io operation.Jason Jin
commit a45dde2293c816138e53c26eca6fd0322583f9a6 changed the dm9000 direct register access to standard IO. This should work on the ColdFire platform as there are corresponding macros for the LE devices. But the hardware settings on some ColdFire boards had swapped the byte order which make the original macros such as out_le16 cannot work. To avoid changing the common io access code on ColdFire platform, the DM9000_BYTE_SWAPPED define was added to make the dm9000 use __raw* IO access on some ColdFire boards. Signed-off-by: Jason Jin <Jason.jin@freescale.com>
2011-04-20Remove instances of phy_read/writeAndy Fleming
There were a few files which were already using phy_read and phy_write for their PHY function names. It's only a few places, and the name seems most appropriate for the high-level abstraction, so let's rename the other versions to something more specific. Also, uec_phy.c had a marvell_init function which I renamed to not conflict with the one in marvell.c Lastly, uec_phy.c was putting a space between the phy writing function names, and the open paren, so I fixed that Signed-off-by: Andy Fleming <afleming@freescale.com> Acked-by: Detlev Zundel <dzu@denx.de>
2010-07-12net: dm9000x: re-add casts to I/O pointers to fix gcc warningsMike Frysinger
The DM9000 in/out helper functions were casting the register address when it was accessing things directly (pre commit a45dde2293c816138e53c). But when it was changed to using the in/out helpers, those casts were dropped because those functions don't take pointers. Even more recently, those functions were then changed to use the read/write helpers, but the casts were not re-added. This is necessary because the read/write helpers do take pointers. Otherwise we get a lot of warnings like: dm9000x.c: In function 'dm9000_inblk_8bit': dm9000x.c:172: warning: passing argument 1 of 'readb' makes pointer from integer without a cast Signed-off-by: Mike Frysinger <vapier@gentoo.org> Tested-by: Thomas Weber <weber@corscience.de> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2010-05-26dm9000x.c: fix compile problemsWolfgang Denk
Use readX() / writeX() accessors instead of inX() / outX(). Suggested-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-05-03net: dm9000x: use standard I/O accessorsMike Frysinger
The current dm9000x driver accesses its memory mapped registers directly instead of using the standard I/O accessors. This can cause problems on Blackfin systems as the accesses can get out of order. So convert the direct volatile dereferences to use the normal in/out macros. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-12-13net: dm9000x: fix debug outputThomas Weber
commit 60f61e6d7655400bb785a2ef637581679941f6d1 breaks compile with gcc by introducing __func__ instead of constant string "func" in the macro call but missed to change the macro. Signed-off-by: Thomas Weber <weber@corscience.de> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-10-29Fix DM9000 MAC address handlingBen Warren
Proper behavior is to pull MAC address from NVRAM in the initialization() an stuff it in dev->address, then program the device from dev->address in the init() function. Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-06-15Convert DM9000 driver for CONFIG_NET_MULTIRemy Bohmer
All drivers need to be converted to CONFIG_NET_MULTI. This patch converts the dm9000 driver. Signed-off-by: Thomas Smits <ts.smits@gmail.com> Signed-off-by: Remy Bohmer <linux@bohmer.net> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-06-08Add config option for disabling DM9000-SROM support.Remy Bohmer
Some boards do not have SROM support for the DM9000 network adapter. Instead of listing these board names in the driver code, make this option configurable from the board config file. It also removes a build warning for the at91sam9261ek board: 'dm9000x.c:545: warning: 'read_srom_word' defined but not used' And it repaires the trizepsiv board build which was broken around the same routines Signed-off-by: Remy Bohmer <linux@bohmer.net> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2009-04-28dm9000 EEPROM reading bugfixDavid Brownell
Make the U-Boot dm9000 driver read addresses from EEPROM just like Linux does ... read six bytes, instead of reading twelve bytes and then discarding every other one. Using the right Ethernet address is a big win. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Acked-by: Ben Warren <biggerbadderben@gmail.com>
2009-03-20drivers/net/: get mac address from environmentMike Frysinger
The environment is the canonical storage location of the mac address, so we're killing off the global data location and moving everything to querying the env directly. The drivers that get converted here: 3c589 4xx_enet dc2114x dm9000x enc28j60 fsl_mcdmafec ks8695eth mcffec rtl8019 rtl8169 s3c4510b_eth xilinx_emac xilinx_emaclite Signed-off-by: Mike Frysinger <vapier@gentoo.org> CC: Ben Warren <biggerbadderben@gmail.com> CC: Rolf Offermanns <rof@sysgo.de> CC: Stefan Roese <sr@denx.de> CC: Sascha Hauer <saschahauer@web.de> CC: TsiChung Liew <Tsi-Chung.Liew@freescale.com> CC: Greg Ungerer <greg.ungerer@opengear.com> CC: Xue Ligong <lgxue@hotmail.com> CC: Masami Komiya <mkomiya@sonare.it> CC: Curt Brune <curt@cucy.com> CC: Michal SIMEK <monstr@monstr.eu>
2008-10-18rename CFG_ macros to CONFIG_SYSJean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2008-08-26dm9000 remove dead external phy support, gpio fixAndrew Dyer
dm9000 has code to detect and initialize external phy parts, but later on in the code the part is forced to use the internal phy unconditionally. Remove the unused/untested code. change the GPIO initialization so that only the GPIO used as an internal phy reset (hardwired in the chip) is set as an output. The remaining GPIO need to be handled by board specific code to prevent possible drive conflicts. Set as inputs for safety. replace a few magic numbers with defines Signed-off-by: Andrew Dyer <adyer@righthandtech.com> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-08-18Fix dm9000 receive status and len little endian issueTsiChung Liew
The received status and len was in little endian format and caused the ethernet unable to proceed further. Add __le16_to_cpu() in dm9000_rx_status_8/16/32bit(). Signed-off-by: TsiChung Liew <Tsi-Chung.Liew@freescale.com> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-06-09net: Conditional COBJS inclusion of network driversShinya Kuribayashi
Replace COBJS-y with appropriate driver config names. Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-06-08Merge branch 'master' of git://git.denx.de/u-bootBen Warren
2008-06-05DM9000 fix status check fail 0x6d error for trizeps boardRemy Bohmer
According to the Application Notes of the DM9000, only the 2 bits 0:1 of the status byte need to be checked to identify a valid packet in the fifo But, The several different Application Notes do not all speak the same language on these bits. They do not disagree, but only 1 Application Note noted explicitly that only these 2 bits need to be checked. Even the datasheets do not mention anything about these 2 bits. Because the old code, and the kernel check the whole byte, I left this piece untouched. However, I tested all board/DM9000[A|E|EP] devices with this 2 bit check, so it should work. Notice, that the 2nd iteration through this receive loop (when a 2nd packet is in the fifo) is much shorter now, compared to the older U-boot driver code, so that we can maybe run into a hardware condition now that was never seen before, or maybe was seen very unfrequently. Additionaly added a cleanup of a stack variable. Signed-off-by: Remy Bohmer <linux@bohmer.net> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-06-04Fix order for reading rx-status registers in 32bit mode of DM9000Remy Bohmer
A last minute cleanup before submitting the DM9000A patch series yesterday introduced a bug in reading the rx-status registers in 32bit mode only. This patch repairs this. Signed-off-by: Remy Bohmer <linux@bohmer.net> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-06-04DM9000: Some minor code cleanupsRemy Bohmer
Some lines of the U-boot DM9000x driver are longer than 80 characters, or need some other minor cleanup. Signed-off-by: Remy Bohmer <linux@bohmer.net> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-06-04DM9000: Make driver work properly for DM9000ARemy Bohmer
The DM9000A network controller does not work with the U-boot DM9000x driver. Analysis showed that many incoming packets are lost. The DM9000A Application Notes V1.20 (section 5.6.1) recommend that the poll to check for a valid rx packet be done on the interrupt status register, not directly by performing the dummy read and the rx status check as is currently the case in the u-boot driver. When the recommended poll is done as suggested the driver starts working correctly on 10Mbit/HD, but on 100MBit/FD packets come in faster so that there can be more than 1 package in the fifo at the same time. The driver must perform the rx-status check in a loop and read and handle all packages until there is no more left _after_ the interrupt RX flag is set. This change has been tested with DM9000A, DM9000E, DM9000EP. Signed-off-by: Remy Bohmer <linux@bohmer.net> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-06-04DM9000: Improve eth_reset() routineRemy Bohmer
According to the application notes of the DM9000 v1.22 chapter 5.2 bullet 2, the reset procedure must be done twice to properly reset the DM9000 by means of software. This errata is not needed anymore for the DM9000A, but it does not bother it. This change has been tested with DM9000A, DM9000E, DM9000EP. Signed-off-by: Remy Bohmer <linux@bohmer.net> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-06-04DM9000: improve eth_send() routineRemy Bohmer
The eth_send routine of the U-boot DM9000x driver does not match the DM9000 or DM9000A application notes/programming guides. This change improves the stability of the DM9000A network controller. This change has been tested with DM9000A, DM9000E, DM9000EP. Signed-off-by: Remy Bohmer <linux@bohmer.net> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-06-04DM9000: repair debug loggingRemy Bohmer
It seems that the debugging code of the DM9000x driver in U-boot has not been compiled for a long time, because it cannot compile... Also rearranged some loglines to get more useful info while debugging. Signed-off-by: Remy Bohmer <linux@bohmer.net> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-06-04DM9000: Add data bus-width auto detection.Remy Bohmer
The U-boot DM9000x driver contains a compile time bus-width definition for the databus connected to the network controller. This compile check makes the code unclear, inflexible and is unneccessary. It can be asked to the network controller what its bus-width is by reading bits 6 and 7 of the interrupt status register. The linux kernel already uses a runtime mechanism to determine this bus-width, so the implementation below looks somewhat like that implementation. This change has been tested with DM9000A, DM9000E, DM9000EP. Signed-off-by: Remy Bohmer <linux@bohmer.net> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2008-05-24Merging Stelian Pop AT91 patchesJean-Christophe PLAGNIOL-VILLARD
Merge branch 'testing-V2' Conflicts: board/atmel/at91cap9adk/Makefile Fixing copyright board/atmel/at91sam9260ek/Makefile Fixing copyright board/atmel/at91sam9260ek/u-boot.lds Delete no more needed ld script Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2008-05-21Big white-space cleanup.Wolfgang Denk
This commit gets rid of a huge amount of silly white-space issues. Especially, all sequences of SPACEs followed by TAB characters get removed (unless they appear in print statements). Also remove all embedded "vim:" and "vi:" statements which hide indentation problems. Signed-off-by: Wolfgang Denk <wd@denx.de>
2008-05-10AT91SAM9261EK supportStelian Pop
This patch adds support for the AT91SAM9261 chip and the AT91SAM9261EK board. Signed-off-by: Stelian Pop <stelian@popies.net> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2007-11-25drivers/net : move net drivers to drivers/netJean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>