static void
dm9000_read_eeprom(board_info_t *db, int offset, u8 *to)
{
+ unsigned long flags;
+
mutex_lock(&db->addr_lock);
+ spin_lock_irqsave(&db->lock, flags);
+
iow(db, DM9000_EPAR, offset);
iow(db, DM9000_EPCR, EPCR_ERPRR);
+
+ spin_unlock_irqrestore(&db->lock, flags);
+
mdelay(8); /* according to the datasheet 200us should be enough,
but it doesn't work */
+
+ spin_lock_irqsave(&db->lock, flags);
+
iow(db, DM9000_EPCR, 0x0);
to[0] = ior(db, DM9000_EPDRL);
to[1] = ior(db, DM9000_EPDRH);
+ spin_unlock_irqrestore(&db->lock, flags);
+
mutex_unlock(&db->addr_lock);
}
static void
dm9000_write_eeprom(board_info_t *db, int offset, u8 *data)
{
+ unsigned long flags;
+
mutex_lock(&db->addr_lock);
+ spin_lock_irqsave(&db->lock, flags);
iow(db, DM9000_EPAR, offset);
iow(db, DM9000_EPDRH, data[1]);
iow(db, DM9000_EPDRL, data[0]);
iow(db, DM9000_EPCR, EPCR_WEP | EPCR_ERPRW);
+ spin_unlock_irqrestore(&db->lock, flags);
+
mdelay(8); /* same shit */
+
+ spin_lock_irqsave(&db->lock, flags);
iow(db, DM9000_EPCR, 0);
+ spin_unlock_irqrestore(&db->lock, flags);
mutex_unlock(&db->addr_lock);
}