aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/dm9000.c
AgeCommit message (Collapse)Author
2009-04-16dm9000: convert to net_device_opsAlexander Beregalov
Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-04-02workqueue: add to_delayed_work() helper functionJean Delvare
It is a fairly common operation to have a pointer to a work and to need a pointer to the delayed work it is contained in. In particular, all delayed works which want to rearm themselves will have to do that. So it would seem fair to offer a helper function for this operation. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Ingo Molnar <mingo@elte.hu> Cc: "David S. Miller" <davem@davemloft.net> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Greg KH <greg@kroah.com> Cc: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-03-22dm9000: locking bugfixDavid Brownell
This fixes a locking bug in the dm9000 driver. It calls request_irq() without setting IRQF_DISABLED ... which is correct for handlers that support IRQ sharing, since that behavior is not guaranteed for shared IRQs. However, its IRQ handler then wrongly assumes that IRQs are blocked. So the fix just uses the right spinlock primitives in the IRQ handler. NOTE: this is a classic example of the type of bug which lockdep currently masks by forcibly setting IRQF_DISABLED on IRQ handlers that did not request that flag. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-11-16dm9000: Fix build error.David S. Miller
Reported by Stephen Rothwell: drivers/net/dm9000.c:1450: error: expected ')' before ';' token drivers/net/dm9000.c:1455: error: expected ';' before '}' token Signed-off-by: David S. Miller <davem@davemloft.net>
2008-11-12netdevice: safe convert to netdev_priv() #part-2Wang Chen
We have some reasons to kill netdev->priv: 1. netdev->priv is equal to netdev_priv(). 2. netdev_priv() wraps the calculation of netdev->priv's offset, obviously netdev_priv() is more flexible than netdev->priv. But we cann't kill netdev->priv, because so many drivers reference to it directly. This patch is a safe convert for netdev->priv to netdev_priv(netdev). Since all of the netdev->priv is only for read. But it is too big to be sent in one mail. I split it to 4 parts and make every part smaller than 100,000 bytes, which is max size allowed by vger. Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-10-27net: convert print_mac to %pMJohannes Berg
This converts pretty much everything to print_mac. There were a few things that had conflicts which I have just dropped for now, no harm done. I've built an allyesconfig with this and looked at the files that weren't built very carefully, but it's a huge patch. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-10-22netdev: DM9000: remove BLACKFIN hacking in DM9000 netdev driverBryan Wu
remove integer casting in the read/write IO accessors, because Blackfin now provides those functions Tested-by: Javier Herrero <jherrero@hvsistemas.es> Signed-off-by: Bryan Wu <cooloney@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-08-07dm9000: Support MAC address setting through platform data.Laurent Pinchart
The dm9000 driver reads the chip's MAC address from the attached EEPROM. When no EEPROM is present, or when the MAC address is invalid, it falls back to reading the address from the chip. This patch lets platform code set the desired MAC address through platform data. Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-07-22DM9000: Remove magic numbersBen Dooks
Remove magic numbers for items that we already have defined in the register header file. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-06-24DM9000: Remove DEFAULT_TRIGGER for request_irq() flags.Ben Dooks
Currently all but one user (AT91SAM9261EK) of the dm9000 driver passes their IRQ flags through the resources attached to the platform device. This means we can remove the use of DEFAULT_TRIGGER as the blackfin machines all seem to have their triggers set properly. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-06-24DM9000: Add missing msleep() in EEPROM wait code.Ben Dooks
The msleep() call in the code that checks for the EEPROM controller's busy status was missing. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-06-24DM9000: Allow the use of the NSR register to get link status.Ben Dooks
The DM9000's internal PHY reports a copy of the link status in the NSR register of the chip. Reading the status when polling for link status is faster as it eliminates the need to sleep, but does not print as much information. Add an platform flag to force this behaviour, and a Kconfig option to allow it to be forced to the faster method always. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-06-24DM9000: Use NSR to determine link-status on internal PHYBen Dooks
The DM9000_NSR register contains a copy of the internal PHY's link status which we can use to determine if the link is up or down. This eliminates the more costly (and sleeping) PHY read when using the DM9000's own PHY. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-06-24DM9000: Cleanup source code - remove forward declerationsBen Dooks
Cleanup the source code by moving the code around to avoid having to declare the functions before they are used. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-06-24DM9000: Cleanup source codeBen Dooks
Cleanup bits of the DM9000 driver to make the code neater and easier to read. This is includes removing some old definitions, re-indenting areas, etc. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-06-24DM9000: Cleanups after the resource changesBen Dooks
Remove the now extraneous checks in dm9000_release_board() now that the two-resource case is removed. Also remove the check on pdev->num_resources, as we check the return data from platform_get_resource() to ensure we have not only the right number but the right type of resources as well. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-06-24DM9000: Add support for DM9000A and DM9000B chipsBen Dooks
Add support for both the DM9000A and DM9000B versions of the DM9000 networking chip. This includes adding support for the Link-Change IRQ which is used instead of polling the PHY every 2 seconds. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-06-24DM9000: Remove the 2 resources probe scheme.Laurent Pinchart
The dm9000 driver accepts either 2 or 3 resources to describe the platform devices. The 2 resources case abuses the ioresource mechanism by passing ioremap()ed memory through the platform device resources. This patch removes that case and converts boards that were using it to the 3 resources scheme. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-05-25Merge branch 'master' of ↵David S. Miller
master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 Conflicts: drivers/net/cpmac.c net/mac80211/mlme.c
2008-05-22[netdrvr] dm9000: use delayed work to update mii phy state fixAndrew Morton
use cancel_delayed_work_sync() Cc: Ben Dooks <ben-linux@fluff.org> Cc: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Cc: Jeff Garzik <jeff@garzik.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-05-15Merge branch 'master' of ↵David S. Miller
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 Conflicts: drivers/net/wireless/iwlwifi/iwl-4965-rs.c drivers/net/wireless/rt2x00/rt61pci.c
2008-05-13[netdrvr] Trim trailing whitespace for several driversJeff Garzik
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-05-13DM9000: Use delayed work to update MII PHY stateBen Dooks
Periodically check the MII PHY status to ensure that the network layer's link status is updated and the user informed of any changes. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-05-13DM9000: Update and fix driver debugging messagesEnrico Scholz
There was a missing newline in a dev_dbg() message. Values read from/written into PHY registers might be for interest too, so I added new dbg messages there. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-05-13DM9000: Add __devinit and __devexit attributes to probe and removeEnrico Scholz
There were missing __dev* annotations for the dm9000_probe() and dm9000_drv_remove() functions. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-25net drivers: fix platform driver hotplug/coldplugKay Sievers
Since 43cc71eed1250755986da4c0f9898f9a635cb3bf, the platform modalias is prefixed with "platform:". Add MODULE_ALIAS() to the hotpluggable network platform drivers, to re-enable auto loading. NOTE: didn't change drivers/net/fs_enet/fs_enet-main.c "old binding" support. That looks problematic in the first place (it even uses the ancient "struct device_driver" binding scheme for platform_bus!) and I suspect it will vanish soonish when arch/powerpc rules the world. Also, drivers/net/ne.c would have needed more thought to sort out. [akpm@linux-foundation.org: fix sgiseeq.c] [dbrownell@users.sourceforge.net: more drivers, registration fixes] Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Cc: Scott Wood <scottwood@freescale.com> Cc: Vitaly Bordug <vitb@kernel.crashing.org> Cc: Dale Farnsworth <dale@farnsworth.org> Cc: Ben Dooks <ben-linux@fluff.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Andrew Victor <andrew@sanpeople.com> Cc: Bryan Wu <bryan.wu@analog.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-03-30dm9000 trivial annotationAl Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-03-25dm9000: Support promisc and all-multi modesPeter Korsgaard
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000: Show the MAC address source after printing MACBen Dooks
Show whether the MAC address was read from the EEPROM or the onboard PAR registers. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000: Update retry count whilst identifying chipBen Dooks
Reading the ID register does not always return the correct ID from the device, so we retry several times to see if we get a correct value. These failures seem to be excaserbated by the speed of the access to the chip (possibly time between issuing the address and then the data cycle). Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000: Add support for MII ioctl() callsBen Dooks
Add entry to handle the MII ioctl() calls via the generic_mii_ioctl call. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000: Add platform flag for no attached EEPROMBen Dooks
Allow the platform data to specify to the DM9000 driver that there is no posibility of an attached EEPROM on the device, so default all reads to 0xff and ignore any write operations. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000: Remove redudant use of "& 0xff"Ben Dooks
The writing of the data should implicitly truncate the data to 8bits, so do not bother with the ands in the code. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000: Remove cal_CRC() and use ether_crc_le insteadBen Dooks
Remove the cal_CRC as this is basically wrappering the ether_crc_le function, and is only being used by the multicast hash table functions. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000: Fix delays used by EEPROM read and writeBen Dooks
The code was using a delay of 8ms, when it should have been using the EEPROM status flag from the device to indicate the EEPROM transaction had finished. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000: Use netif_msg to enable debugging optionsBen Dooks
Use the netif_msg_*() macros to enable the debugging based on the board's msg_enable field. The output still goes via the dev_dbg() macros, so will be tagged and output as appropriate. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000: Remove unnecessary changelog in header commentBen Dooks
We have a perfectly good version control system, so we do not need to duplicate change comments in the header for this code. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000: Ensure spinlock held whilst accessing EEPROM registersBen Dooks
Ensure we hold the spinlock whilst the registers and being modified even though we hold the overall lock. This should protect against an interrupt happening whilst we are using the device. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000: Remove EEPROM initialisation code.Ben Dooks
Remove the old hack to program an initial EEPROM setting into the DM9000 as we now have ethtool support for reading and writing the EEPROM. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000: Add ethtool control of msg_enable valueBen Dooks
Allow the msg_enable value to be read and written by the ethtool interface. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000: Add ethtool support for reading and writing EEPROMBen Dooks
Add ethtool support to access the configuration EEPROM connected to the DM9000. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000: Add mutex to protect accessBen Dooks
Add a mutex to serialise access to the chip functions from entries such as the ethtool and the MII code. This should reduce the amount of time the spinlock is held to protect the address register. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000: Remove barely used SROM array read.Ben Dooks
The srom array in the board data is only being used in the device probe routines. The probe also only uses the first 6 bytes of an array we spend 512ms reading 128 bytes from. Change to reading the MAC area directly to the MAC address structure. As a side product, we rename the read_srom_word to dm9000_read_eeprom to bring it into line with the rest of the driver. No change is made to the delay in this function, which will be dealt with in a later patch. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000: Use msleep() instead of udelay()Ben Dooks
We can use sleeping functions when reading and writing the PHY registers, so let us sleep instead of busy waiting for the PHY. Note, this also fixes a bug reading the PHY where only 100uS was being used instead of 150uS Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000: Do not sleep with spinlock and IRQs heldBen Dooks
The phy read and write routines call udelay() with the board lock held, and with the posibility of IRQs being disabled. Since these delays can be up to 500usec, and are only required as we have to save the chip's address register. To improve the behaviour, hold the lock whilst we are writing and then restore the state before the delay and then repeat the process once the delay has happened. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000: Add initial ethtool supportBen Dooks
Add support for ethtool operations for the DM9000. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000: Remove old timer based poll routinesBen Dooks
Remove the timer based MII phy polling, as this is currently broken with the new EEPROM code that now uses mutexes to protect the phy access. This will need to be replaced in the future by some form of mutex safe mechanism for reading the MII phy status. The replacement has not been done here as changing this patch, which is early in the sequence has quite a knock-on effect. Once this series is merged, then a new presentation of an patch to poll the MII link status can be added. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000: Pass IRQ flags via platform resourcesBen Dooks
Use the flags in the IRQ resource to specify the type of IRQ being requested, so that systems which do not have level-based interrupts, or change the interrupt in some other way can specify this without making an #ifdef mess in the driver. This is specifically designed to undo the change in commit 4e4fc05a2b6e7bd2e0facd96e0c18dceb34d9349 which hardwires the type for everyone but blackfin to IRQT_RISING, which breaks all a number of Simtec boards which use (and setup in the bootloader) active low IRQs. Note, although there where originally objections due to the use of IORESOURCE_IRQ and IRQT_ flags not sharing the same definition, at least <include/linux/interrupt.h> notes these are the same. Signed-off-by: Ben Dooks <ben-linux@fluff.org> CC: Daniel Mack <daniel@caiaq.de> CC: Bryan Wu <bryan.wu@analog.com> CC: Alex Landau <landau.alex@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000 update debugging macros to use debug levelBen Dooks
Change the debug macros to use the compiler to elide any unnecessary debug level, and to allow device configurable debug control. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-02-11DM9000 use dev_xxx() instead of printk for output.Ben Dooks
Move to using dev_dbg() and friends for the output of information to the user. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>