Skip to contentSkip to conversation

3C359: use request_firmware

PATCH New Jaswinder Singh 1 participant 1 message Jul 30, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 3C359: use request_firmware

---
 drivers/net/tokenring/3c359.c           |   36 +-
 drivers/net/tokenring/3c359_microcode.h | 1581 -------------------------------
 firmware/3com/3C359.bin.ihex            | 1573 ++++++++++++++++++++++++++++++
 firmware/Makefile                       |    1 +
 firmware/WHENCE                         |   26 +
 5 files changed, 1625 insertions(+), 1592 deletions(-)
 delete mode 100644 drivers/net/tokenring/3c359_microcode.h
 create mode 100644 firmware/3com/3C359.bin.ihex
drivers/net/tokenring/3c359.c +25 -11
index 45208a0..b4bcaed 100644
@@ -62,6 +62,7 @@
 #include <linux/pci.h>
 #include <linux/spinlock.h>
 #include <linux/bitops.h>
+#include <linux/firmware.h>
 
 #include <net/checksum.h>
 
@@ -73,8 +74,10 @@
 static char version[] __devinitdata  = 
 "3c359.c v1.2.0 2/17/01 - Mike Phillips ([email protected])" ; 
 
+#define FIRMWARE_NAME		"3com/3C359.bin"
 MODULE_AUTHOR("Mike Phillips <[email protected]>") ; 
 MODULE_DESCRIPTION("3Com 3C359 Velocity XL Token Ring Adapter Driver \n") ;
+MODULE_FIRMWARE(FIRMWARE_NAME);
 
 /* Module paramters */
 
@@ -114,8 +117,6 @@ MODULE_PARM_DESC(message_level, "3c359: Level of reported messages \n") ;
  *	will be stuck with 1555 lines of hex #'s in the code.
  */
 
-#include "3c359_microcode.h" 
-
 static struct pci_device_id xl_pci_tbl[] =
 {
 	{PCI_VENDOR_ID_3COM,PCI_DEVICE_ID_3COM_3C359, PCI_ANY_ID, PCI_ANY_ID, },
@@ -384,7 +385,8 @@ static int __devinit xl_init(struct net_device *dev)
  */
 
 static int xl_hw_reset(struct net_device *dev) 
-{ 
+{
+	const struct firmware *fw;
 	struct xl_private *xl_priv = netdev_priv(dev);
 	u8 __iomem *xl_mmio = xl_priv->xl_mmio ; 
 	unsigned long t ; 
@@ -460,22 +462,34 @@ static int xl_hw_reset(struct net_device *dev)
 		 * to get the start position for the code
 		 */
 
-		start = (0xFFFF - (mc_size) + 1 ) ; /* Looks strange but ensures compiler only uses 16 bit unsigned int for this */ 
-		
+		i = request_firmware(&fw, FIRMWARE_NAME, &xl_priv->pdev->dev);
+		if (i) {
+			printk(KERN_ERR "Failed to load firmware \"%s\"\n",
+			       FIRMWARE_NAME);
+			return i;
+		}
+
+		/* Looks strange but ensures compiler only uses
+		   16 bit unsigned int for this */
+		start = (0xFFFF - (fw->size) + 1) ;
+
 		printk(KERN_INFO "3C359: Uploading Microcode: "); 
-		
-		for (i = start, j = 0; j < mc_size; i++, j++) { 
+
+		for (i = start, j = 0; j < fw->size; i++, j++) {
 			writel(MEM_BYTE_WRITE | 0XD0000 | i, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 
-			writeb(microcode[j],xl_mmio + MMIO_MACDATA) ; 
+			writeb(fw->data[j], xl_mmio + MMIO_MACDATA);
 			if (j % 1024 == 0)
 				printk(".");
 		}
 		printk("\n") ; 
 
-		for (i=0;i < 16; i++) { 
-			writel( (MEM_BYTE_WRITE | 0xDFFF0) + i, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 
-			writeb(microcode[mc_size - 16 + i], xl_mmio + MMIO_MACDATA) ; 
+		for (i = 0; i < 16; i++) {
+			writel((MEM_BYTE_WRITE | 0xDFFF0) + i,
+			       xl_mmio + MMIO_MAC_ACCESS_CMD);
+			writeb(fw->data[fw->size - 16 + i],
+			       xl_mmio + MMIO_MACDATA);
 		}
+		release_firmware(fw);
 
 		/*
 		 * Have to write the start address of the upload to FFF4, but
drivers/net/tokenring/3c359_microcode.h deleted +0 -1581

1,581 lines not on this page · raw message

firmware/3com/3C359.bin.ihex new file +1573 -0

1,343 lines not on this page · raw message

firmware/Makefile +1 -0
index 0b30a2f..a11e607 100644

Lines of this file are not shown. View the raw message.

firmware/WHENCE +26 -0
index e51859f..fe02eec 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.5.5.1

Part of the diff is not shown here. View the raw message.