netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Dooks <ben-linux@fluff.org>
To: netdev@vger.kernel.org
Cc: jeff@garzik.org, akpm@linux-foundation.org, daniel@caiaq.de,
	laurentp@cse-semaphore.com, Ben Dooks <ben-linux@fluff.org>
Subject: [PATCH 10/24 for-2.6.25] DM9000: Remove barely used SROM array read.
Date: Tue, 05 Feb 2008 00:02:09 +0000	[thread overview]
Message-ID: <20080205000816.514984494@fluff.org.uk> (raw)
In-Reply-To: 20080205000159.432081941@fluff.org.uk

[-- Attachment #1: simtec/simtec-drivers-net-dm9000-remove-srom-read.patch --]
[-- Type: text/plain, Size: 2666 bytes --]

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>


Index: linux-2.6.24-quilt3/drivers/net/dm9000.c
===================================================================
--- linux-2.6.24-quilt3.orig/drivers/net/dm9000.c
+++ linux-2.6.24-quilt3/drivers/net/dm9000.c
@@ -132,7 +132,6 @@ typedef struct board_info {
 	struct resource *data_req;
 	struct resource *irq_res;
 
-	unsigned char srom[128];
 	spinlock_t lock;
 
 	struct mii_if_info mii;
@@ -166,7 +165,8 @@ static irqreturn_t dm9000_interrupt(int,
 static int dm9000_phy_read(struct net_device *dev, int phyaddr_unsused, int reg);
 static void dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg,
 			   int value);
-static u16 read_srom_word(board_info_t *, int);
+
+static void dm9000_read_eeprom(board_info_t *, int addr, unsigned char *to);
 static void dm9000_rx(struct net_device *);
 static void dm9000_hash_table(struct net_device *);
 
@@ -630,13 +630,9 @@ dm9000_probe(struct platform_device *pde
 	db->mii.mdio_read    = dm9000_phy_read;
 	db->mii.mdio_write   = dm9000_phy_write;
 
-	/* Read SROM content */
-	for (i = 0; i < 64; i++)
-		((u16 *) db->srom)[i] = read_srom_word(db, i);
-
-	/* Set Node Address */
-	for (i = 0; i < 6; i++)
-		ndev->dev_addr[i] = db->srom[i];
+	/* try reading the node address from the attached EEPROM */
+	for (i = 0; i < 6; i += 2)
+		dm9000_read_eeprom(db, i / 2, ndev->dev_addr+i);
 
 	if (!is_valid_ether_addr(ndev->dev_addr)) {
 		/* try reading from mac */
@@ -1001,17 +997,19 @@ dm9000_rx(struct net_device *dev)
 }
 
 /*
- *  Read a word data from SROM
+ *  Read a word data from EEPROM
  */
-static u16
-read_srom_word(board_info_t * db, int offset)
+static void
+dm9000_read_eeprom(board_info_t * db, int offset, unsigned char *to)
 {
 	iow(db, DM9000_EPAR, offset);
 	iow(db, DM9000_EPCR, EPCR_ERPRR);
 	mdelay(8);		/* according to the datasheet 200us should be enough,
 				   but it doesn't work */
 	iow(db, DM9000_EPCR, 0x0);
-	return (ior(db, DM9000_EPDRL) + (ior(db, DM9000_EPDRH) << 8));
+
+	to[0] = ior(db, DM9000_EPDRL);
+	to[1] = ior(db, DM9000_EPDRH);
 }
 
 #ifdef DM9000_PROGRAM_EEPROM

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

  parent reply	other threads:[~2008-02-05  0:08 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-05  0:01 [PATCH 00/24 for-2.6.25] DM9000 updates for 2.6.25 Ben Dooks
2008-02-05  0:02 ` [PATCH 01/24 for-2.6.25] DM9000: Fix endian-ness of data accesses. Patch from: Laurent Pinchart <laurentp@cse-semaphore.com> Ben Dooks
2008-02-05  0:13   ` [PATCH 01/24 for-2.6.25] DM9000: Fix endian-ness of data accesses Ben Dooks
2008-02-05 22:57   ` [PATCH 01/24 for-2.6.25] DM9000: Fix endian-ness of data accesses. Patch from: Laurent Pinchart <laurentp@cse-semaphore.com> Francois Romieu
2008-02-06 11:46   ` Jeff Garzik
2008-02-07 13:28     ` Laurent Pinchart
2008-02-07 14:54       ` Jeff Garzik
2008-02-07 13:30   ` Christoph Hellwig
2008-02-05  0:02 ` [PATCH 02/24 for-2.6.25] DM9000: Add platform data to specify external phy " Ben Dooks
2008-02-05  0:14   ` [PATCH 02/24 for-2.6.25] DM9000: Add platform data to specify external phy Ben Dooks
2008-02-05  0:02 ` [PATCH 03/24 for-2.6.25] DM9000 use dev_xxx() instead of printk for output Ben Dooks
2008-02-05  0:02 ` [PATCH 04/24 for-2.6.25] DM9000 update debugging macros to use debug level Ben Dooks
2008-02-05  0:02 ` [PATCH 05/24 for-2.6.25] DM9000: Pass IRQ flags via platform resources Ben Dooks
2008-02-05  0:02 ` [PATCH 06/24 for-2.6.25] DM9000: Remove old timer based poll routines Ben Dooks
2008-02-05  0:02 ` [PATCH 07/24 for-2.6.25] DM9000: Add initial ethtool support Ben Dooks
2008-02-05 22:50   ` Francois Romieu
2008-02-06 22:03     ` Ben Dooks
2008-02-06 21:52       ` Francois Romieu
2008-02-06 22:16         ` Ben Dooks
2008-02-05  0:02 ` [PATCH 08/24 for-2.6.25] DM9000: Do not sleep with spinlock and IRQs held Ben Dooks
2008-02-05  0:02 ` [PATCH 09/24 for-2.6.25] DM9000: Use msleep() instead of udelay() Ben Dooks
2008-02-05  0:02 ` Ben Dooks [this message]
2008-02-05  0:02 ` [PATCH 11/24 for-2.6.25] DM9000: Add mutex to protect access Ben Dooks
2008-02-05  0:02 ` [PATCH 12/24 for-2.6.25] DM9000: Add ethtool support for reading and writing EEPROM Ben Dooks
2008-02-05  0:02 ` [PATCH 13/24 for-2.6.25] DM9000: Add ethtool control of msg_enable value Ben Dooks
2008-02-05  0:02 ` [PATCH 14/24 for-2.6.25] DM9000: Remove EEPROM initialisation code Ben Dooks
2008-02-05  0:02 ` [PATCH 15/24 for-2.6.25] DM9000: Ensure spinlock held whilst accessing EEPROM registers Ben Dooks
2008-02-05  0:02 ` [PATCH 16/24 for-2.6.25] DM9000: Remove unnecessary changelog in header comment Ben Dooks
2008-02-05  0:02 ` [PATCH 17/24 for-2.6.25] DM9000: Use netif_msg to enable debugging options Ben Dooks
2008-02-05  0:02 ` [PATCH 18/24 for-2.6.25] DM9000: Fix delays used by EEPROM read and write Ben Dooks
2008-02-05  0:02 ` [PATCH 19/24 for-2.6.25] DM9000: Remove cal_CRC() and use ether_crc_le instead Ben Dooks
2008-02-05  0:02 ` [PATCH 20/24 for-2.6.25] DM9000: Remove redudant use of "& 0xff" Ben Dooks
2008-02-05  0:02 ` [PATCH 21/24 for-2.6.25] DM9000: Add platform flag for no attached EEPROM Ben Dooks
2008-02-05  0:02 ` [PATCH 22/24 for-2.6.25] DM9000: Add support for MII ioctl() calls Ben Dooks
2008-02-05  0:02 ` [PATCH 23/24 for-2.6.25] DM9000: Update retry count whilst identifying chip Ben Dooks
2008-02-05  0:02 ` [PATCH 24/24 for-2.6.25] DM9000: Show the MAC address source after printing MAC Ben Dooks
2008-02-05  0:19 ` [PATCH 00/24 for-2.6.25] DM9000 updates for 2.6.25 Andrew Morton
2008-02-05  1:44   ` Ben Dooks
2008-02-05  9:52 ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080205000816.514984494@fluff.org.uk \
    --to=ben-linux@fluff.org \
    --cc=akpm@linux-foundation.org \
    --cc=daniel@caiaq.de \
    --cc=jeff@garzik.org \
    --cc=laurentp@cse-semaphore.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).