aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/dm9000.c
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2008-02-04 19:02:20 -0500
committerJeff Garzik <jeff@garzik.org>2008-02-11 11:06:35 -0500
commitbb44fb70e069412c08e07f494b6b4e985f6331ac (patch)
tree7ddccf526057a699184d787d1cb135584f12c83f /drivers/net/dm9000.c
parent073d3f46e5ccc49ede1d3487ed1e71d63d71b750 (diff)
DM9000: Add platform flag for no attached EEPROM
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>
Diffstat (limited to 'drivers/net/dm9000.c')
-rw-r--r--drivers/net/dm9000.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index d0cd7f945fde..afd2cf509073 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -405,6 +405,9 @@ static int dm9000_get_eeprom(struct net_device *dev,
405 if ((len & 1) != 0 || (offset & 1) != 0) 405 if ((len & 1) != 0 || (offset & 1) != 0)
406 return -EINVAL; 406 return -EINVAL;
407 407
408 if (dm->flags & DM9000_PLATF_NO_EEPROM)
409 return -ENOENT;
410
408 ee->magic = DM_EEPROM_MAGIC; 411 ee->magic = DM_EEPROM_MAGIC;
409 412
410 for (i = 0; i < len; i += 2) 413 for (i = 0; i < len; i += 2)
@@ -426,6 +429,9 @@ static int dm9000_set_eeprom(struct net_device *dev,
426 if ((len & 1) != 0 || (offset & 1) != 0) 429 if ((len & 1) != 0 || (offset & 1) != 0)
427 return -EINVAL; 430 return -EINVAL;
428 431
432 if (dm->flags & DM9000_PLATF_NO_EEPROM)
433 return -ENOENT;
434
429 if (ee->magic != DM_EEPROM_MAGIC) 435 if (ee->magic != DM_EEPROM_MAGIC)
430 return -EINVAL; 436 return -EINVAL;
431 437
@@ -1100,6 +1106,12 @@ dm9000_read_eeprom(board_info_t *db, int offset, u8 *to)
1100{ 1106{
1101 unsigned long flags; 1107 unsigned long flags;
1102 1108
1109 if (db->flags & DM9000_PLATF_NO_EEPROM) {
1110 to[0] = 0xff;
1111 to[1] = 0xff;
1112 return;
1113 }
1114
1103 mutex_lock(&db->addr_lock); 1115 mutex_lock(&db->addr_lock);
1104 1116
1105 spin_lock_irqsave(&db->lock, flags); 1117 spin_lock_irqsave(&db->lock, flags);
@@ -1134,6 +1146,9 @@ dm9000_write_eeprom(board_info_t *db, int offset, u8 *data)
1134{ 1146{
1135 unsigned long flags; 1147 unsigned long flags;
1136 1148
1149 if (db->flags & DM9000_PLATF_NO_EEPROM)
1150 return;
1151
1137 mutex_lock(&db->addr_lock); 1152 mutex_lock(&db->addr_lock);
1138 1153
1139 spin_lock_irqsave(&db->lock, flags); 1154 spin_lock_irqsave(&db->lock, flags);