aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/smc91c92_cs.c
diff options
context:
space:
mode:
authorJaswinder Singh Rajput <jaswinderrajput@gmail.com>2009-03-30 10:49:54 -0400
committerJaswinder Singh Rajput <jaswinderrajput@gmail.com>2009-03-30 10:55:13 -0400
commit75bf758f906315820cada99c169bd89bab3f4ba2 (patch)
tree88086747f64b17e412dfc3dc3fb43f13ae5906bf /drivers/net/pcmcia/smc91c92_cs.c
parent4b6ece97e0b61306d4b8de6820f602e4cf5d8d6b (diff)
smc91c92_cs: use request_firmware
Added osi_load_firmware() instead of copying same thing twice Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Diffstat (limited to 'drivers/net/pcmcia/smc91c92_cs.c')
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c44
1 files changed, 32 insertions, 12 deletions
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 774232c13b31..48dbb35747d8 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -42,6 +42,7 @@
42#include <linux/ethtool.h> 42#include <linux/ethtool.h>
43#include <linux/mii.h> 43#include <linux/mii.h>
44#include <linux/jiffies.h> 44#include <linux/jiffies.h>
45#include <linux/firmware.h>
45 46
46#include <pcmcia/cs_types.h> 47#include <pcmcia/cs_types.h>
47#include <pcmcia/cs.h> 48#include <pcmcia/cs.h>
@@ -55,17 +56,18 @@
55#include <asm/system.h> 56#include <asm/system.h>
56#include <asm/uaccess.h> 57#include <asm/uaccess.h>
57 58
58/* Ositech Seven of Diamonds firmware */
59#include "ositech.h"
60
61/*====================================================================*/ 59/*====================================================================*/
62 60
63static const char *if_names[] = { "auto", "10baseT", "10base2"}; 61static const char *if_names[] = { "auto", "10baseT", "10base2"};
64 62
63/* Firmware name */
64#define FIRMWARE_NAME "ositech/Xilinx7OD.bin"
65
65/* Module parameters */ 66/* Module parameters */
66 67
67MODULE_DESCRIPTION("SMC 91c92 series PCMCIA ethernet driver"); 68MODULE_DESCRIPTION("SMC 91c92 series PCMCIA ethernet driver");
68MODULE_LICENSE("GPL"); 69MODULE_LICENSE("GPL");
70MODULE_FIRMWARE(FIRMWARE_NAME);
69 71
70#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0) 72#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)
71 73
@@ -771,6 +773,26 @@ static int osi_config(struct pcmcia_device *link)
771 return i; 773 return i;
772} 774}
773 775
776static int osi_load_firmware(struct pcmcia_device *link)
777{
778 const struct firmware *fw;
779 int i, err;
780
781 err = request_firmware(&fw, FIRMWARE_NAME, &link->dev);
782 if (err) {
783 pr_err("Failed to load firmware \"%s\"\n", FIRMWARE_NAME);
784 return err;
785 }
786
787 /* Download the Seven of Diamonds firmware */
788 for (i = 0; i < fw->size; i++) {
789 outb(fw->data[i], link->io.BasePort1 + 2);
790 udelay(50);
791 }
792 release_firmware(fw);
793 return err;
794}
795
774static int osi_setup(struct pcmcia_device *link, u_short manfid, u_short cardid) 796static int osi_setup(struct pcmcia_device *link, u_short manfid, u_short cardid)
775{ 797{
776 struct net_device *dev = link->priv; 798 struct net_device *dev = link->priv;
@@ -811,11 +833,9 @@ static int osi_setup(struct pcmcia_device *link, u_short manfid, u_short cardid)
811 (cardid == PRODID_OSITECH_SEVEN)) || 833 (cardid == PRODID_OSITECH_SEVEN)) ||
812 ((manfid == MANFID_PSION) && 834 ((manfid == MANFID_PSION) &&
813 (cardid == PRODID_PSION_NET100))) { 835 (cardid == PRODID_PSION_NET100))) {
814 /* Download the Seven of Diamonds firmware */ 836 rc = osi_load_firmware(link);
815 for (i = 0; i < sizeof(__Xilinx7OD); i++) { 837 if (rc)
816 outb(__Xilinx7OD[i], link->io.BasePort1+2); 838 goto free_cfg_mem;
817 udelay(50);
818 }
819 } else if (manfid == MANFID_OSITECH) { 839 } else if (manfid == MANFID_OSITECH) {
820 /* Make sure both functions are powered up */ 840 /* Make sure both functions are powered up */
821 set_bits(0x300, link->io.BasePort1 + OSITECH_AUI_PWR); 841 set_bits(0x300, link->io.BasePort1 + OSITECH_AUI_PWR);
@@ -862,10 +882,10 @@ static int smc91c92_resume(struct pcmcia_device *link)
862 (smc->cardid == PRODID_OSITECH_SEVEN)) || 882 (smc->cardid == PRODID_OSITECH_SEVEN)) ||
863 ((smc->manfid == MANFID_PSION) && 883 ((smc->manfid == MANFID_PSION) &&
864 (smc->cardid == PRODID_PSION_NET100))) { 884 (smc->cardid == PRODID_PSION_NET100))) {
865 /* Download the Seven of Diamonds firmware */ 885 i = osi_load_firmware(link);
866 for (i = 0; i < sizeof(__Xilinx7OD); i++) { 886 if (i) {
867 outb(__Xilinx7OD[i], link->io.BasePort1+2); 887 pr_err("smc91c92_cs: Failed to load firmware\n");
868 udelay(50); 888 return i;
869 } 889 }
870 } 890 }
871 if (link->open) { 891 if (link->open) {