aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/slicoss
diff options
context:
space:
mode:
authormerge <null@invalid>2009-01-22 13:55:32 +0000
committerAndy Green <agreen@octopus.localdomain>2009-01-22 13:55:32 +0000
commitaa6f5ffbdba45aa8e19e5048648fc6c7b25376d3 (patch)
treefbb786d0ac6f8a774fd834e9ce951197e60fbffa /drivers/staging/slicoss
parentf2d78193eae5dccd3d588d2c8ea0866efc368332 (diff)
MERGE-via-pending-tracking-hist-MERGE-via-stable-tracking-MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040-1232632141
pending-tracking-hist top was MERGE-via-stable-tracking-MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040-1232632141 / fdf777a63bcb59e0dfd78bfe2c6242e01f6d4eb9 ... parent commitmessage: From: merge <null@invalid> MERGE-via-stable-tracking-hist-MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040 stable-tracking-hist top was MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040 / 90463bfd2d5a3c8b52f6e6d71024a00e052b0ced ... parent commitmessage: From: merge <null@invalid> MERGE-via-mokopatches-tracking-hist-fix-stray-endmenu-patch mokopatches-tracking-hist top was fix-stray-endmenu-patch / 3630e0be570de8057e7f8d2fe501ed353cdf34e6 ... parent commitmessage: From: Andy Green <andy@openmoko.com> fix-stray-endmenu.patch Signed-off-by: Andy Green <andy@openmoko.com>
Diffstat (limited to 'drivers/staging/slicoss')
-rw-r--r--drivers/staging/slicoss/slic.h34
-rw-r--r--drivers/staging/slicoss/slicoss.c91
2 files changed, 93 insertions, 32 deletions
diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index 0d5dc24c0b7..a8ea59d7ea1 100644
--- a/drivers/staging/slicoss/slic.h
+++ b/drivers/staging/slicoss/slic.h
@@ -41,6 +41,40 @@
#ifndef __SLIC_DRIVER_H__
#define __SLIC_DRIVER_H__
+/* firmware stuff */
+#define OASIS_UCODE_VERS_STRING "1.2"
+#define OASIS_UCODE_VERS_DATE "2006/03/27 15:10:37"
+#define OASIS_UCODE_HOSTIF_ID 3
+
+static s32 ONumSections = 0x2;
+static u32 OSectionSize[] = {
+ 0x00004000, 0x00010000,
+};
+
+static u32 OSectionStart[] = {
+ 0x00000000, 0x00008000,
+};
+
+#define MOJAVE_UCODE_VERS_STRING "1.2"
+#define MOJAVE_UCODE_VERS_DATE "2006/03/27 15:12:22"
+#define MOJAVE_UCODE_HOSTIF_ID 3
+
+static s32 MNumSections = 0x2;
+static u32 MSectionSize[] =
+{
+ 0x00008000, 0x00010000,
+};
+
+static u32 MSectionStart[] =
+{
+ 0x00000000, 0x00008000,
+};
+
+#define GB_RCVUCODE_VERS_STRING "1.2"
+#define GB_RCVUCODE_VERS_DATE "2006/03/27 15:12:15"
+static u32 OasisRcvUCodeLen = 512;
+static u32 GBRcvUCodeLen = 512;
+#define SECTION_SIZE 65536
struct slic_spinlock {
spinlock_t lock;
diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index 8fa9490b3e2..bf7da8f898a 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -94,6 +94,7 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
+#include <linux/firmware.h>
#include <linux/types.h>
#include <linux/dma-mapping.h>
#include <linux/mii.h>
@@ -105,15 +106,6 @@
#include <linux/uaccess.h>
#include "slicinc.h"
-#include "gbdownload.h"
-#include "gbrcvucode.h"
-#include "oasisrcvucode.h"
-
-#ifdef DEBUG_MICROCODE
-#include "oasisdbgdownload.h"
-#else
-#include "oasisdownload.h"
-#endif
#if SLIC_DUMP_ENABLED
#include "slicdump.h"
@@ -323,7 +315,7 @@ static void slic_init_adapter(struct net_device *netdev,
index, pslic_handle, adapter->pfree_slic_handles, pslic_handle->next);*/
adapter->pshmem = (struct slic_shmem *)
pci_alloc_consistent(adapter->pcidev,
- sizeof(struct slic_shmem *),
+ sizeof(struct slic_shmem),
&adapter->
phys_shmem);
/*
@@ -765,8 +757,7 @@ static int slic_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
#ifdef SLIC_USER_REQUEST_DUMP_ENABLED
case SIOCSLICDUMPCARD:
{
- struct adapter *adapter = (struct adapter *)
- dev->priv;
+ struct adapter *adapter = netdev_priv(dev);
struct sliccard *card;
ASSERT(adapter);
@@ -1432,7 +1423,7 @@ static void slic_init_cleanup(struct adapter *adapter)
DBG_MSG("adapter[%p] port %d pshmem[%p] FreeShmem ",
adapter, adapter->port, (void *) adapter->pshmem);
pci_free_consistent(adapter->pcidev,
- sizeof(struct slic_shmem *),
+ sizeof(struct slic_shmem),
adapter->pshmem, adapter->phys_shmem);
adapter->pshmem = NULL;
adapter->phys_shmem = (dma_addr_t) NULL;
@@ -1685,7 +1676,7 @@ static void slic_timer_ping(ulong dev)
struct sliccard *card;
ASSERT(dev);
- adapter = (struct adapter *)((struct net_device *) dev)->priv;
+ adapter = netdev_priv((struct net_device *)dev);
ASSERT(adapter);
card = adapter->card;
ASSERT(card);
@@ -2187,6 +2178,9 @@ static void slic_card_cleanup(struct sliccard *card)
static int slic_card_download_gbrcv(struct adapter *adapter)
{
+ const struct firmware *fw;
+ const char *file = "";
+ int ret;
__iomem struct slic_regs *slic_regs = adapter->slic_regs;
u32 codeaddr;
unsigned char *instruction = NULL;
@@ -2194,12 +2188,32 @@ static int slic_card_download_gbrcv(struct adapter *adapter)
switch (adapter->devid) {
case SLIC_2GB_DEVICE_ID:
- instruction = (unsigned char *)&OasisRcvUCode[0];
- rcvucodelen = OasisRcvUCodeLen;
+ file = "oasis_rcv.bin";
+ break;
+ case SLIC_1GB_DEVICE_ID:
+ file = "gb_rcv.bin";
+ break;
+ default:
+ ASSERT(0);
+ break;
+ }
+
+ ret = request_firmware(&fw, file, &adapter->pcidev->dev);
+ if (ret) {
+ printk(KERN_ERR "SLICOSS: Failed to load firmware %s\n", file);
+ return ret;
+ }
+
+ instruction = (unsigned char *)fw->data;
+ rcvucodelen = fw->size;
+ switch (adapter->devid) {
+ case SLIC_2GB_DEVICE_ID:
+ if (rcvucodelen != OasisRcvUCodeLen)
+ return -EINVAL;
break;
case SLIC_1GB_DEVICE_ID:
- instruction = (unsigned char *)&GBRcvUCode[0];
- rcvucodelen = GBRcvUCodeLen;
+ if (rcvucodelen != GBRcvUCodeLen)
+ return -EINVAL;
break;
default:
ASSERT(0);
@@ -2226,13 +2240,16 @@ static int slic_card_download_gbrcv(struct adapter *adapter)
}
/* download finished */
+ release_firmware(fw);
WRITE_REG(slic_regs->slic_rcv_wcs, SLIC_RCVWCS_FINISH, FLUSH);
-
return 0;
}
static int slic_card_download(struct adapter *adapter)
{
+ const struct firmware *fw;
+ const char *file = "";
+ int ret;
u32 section;
int thissectionsize;
int codeaddr;
@@ -2256,6 +2273,7 @@ static int slic_card_download(struct adapter *adapter)
case SLIC_2GB_DEVICE_ID:
/* DBG_MSG ("slicoss: %s devid==SLIC_2GB_DEVICE_ID sections[%x]\n",
__func__, (uint) ONumSections); */
+ file = "slic_oasis.bin";
numsects = ONumSections;
for (i = 0; i < numsects; i++) {
sectsize[i] = OSectionSize[i];
@@ -2265,6 +2283,7 @@ static int slic_card_download(struct adapter *adapter)
case SLIC_1GB_DEVICE_ID:
/* DBG_MSG ("slicoss: %s devid==SLIC_1GB_DEVICE_ID sections[%x]\n",
__func__, (uint) MNumSections); */
+ file = "slic_mojave.bin";
numsects = MNumSections;
for (i = 0; i < numsects; i++) {
sectsize[i] = MSectionSize[i];
@@ -2275,26 +2294,33 @@ static int slic_card_download(struct adapter *adapter)
ASSERT(0);
break;
}
+ ret = request_firmware(&fw, file, &adapter->pcidev->dev);
+ if (ret) {
+ printk(KERN_ERR "SLICOSS: Failed to load firmware %s\n", file);
+ return ret;
+ }
ASSERT(numsects <= 3);
for (section = 0; section < numsects; section++) {
switch (adapter->devid) {
case SLIC_2GB_DEVICE_ID:
- instruction = (u32 *) &OasisUCode[section][0];
+ instruction = (u32 *)(fw->data + (SECTION_SIZE *
+ section));
baseaddress = sectstart[section];
thissectionsize = sectsize[section] >> 3;
lastinstruct =
- (u32 *) &OasisUCode[section][sectsize[section] -
- 8];
+ (u32 *)(fw->data + (SECTION_SIZE * section) +
+ sectsize[section] - 8);
break;
case SLIC_1GB_DEVICE_ID:
- instruction = (u32 *) &MojaveUCode[section][0];
+ instruction = (u32 *)(fw->data + (SECTION_SIZE *
+ section));
baseaddress = sectstart[section];
thissectionsize = sectsize[section] >> 3;
lastinstruct =
- (u32 *) &MojaveUCode[section][sectsize[section]
- - 8];
+ (u32 *)(fw->data + (SECTION_SIZE * section) +
+ sectsize[section] - 8);
break;
default:
ASSERT(0);
@@ -2330,10 +2356,12 @@ static int slic_card_download(struct adapter *adapter)
for (section = 0; section < numsects; section++) {
switch (adapter->devid) {
case SLIC_2GB_DEVICE_ID:
- instruction = (u32 *)&OasisUCode[section][0];
+ instruction = (u32 *)fw->data + (SECTION_SIZE *
+ section);
break;
case SLIC_1GB_DEVICE_ID:
- instruction = (u32 *)&MojaveUCode[section][0];
+ instruction = (u32 *)fw->data + (SECTION_SIZE *
+ section);
break;
default:
ASSERT(0);
@@ -2375,13 +2403,13 @@ static int slic_card_download(struct adapter *adapter)
thissectionsize[%x] failure[%x]\n",
__func__, codeaddr, thissectionsize,
failure);
-
+ release_firmware(fw);
return -EIO;
}
}
}
/* DBG_MSG ("slicoss: Compare done\n");*/
-
+ release_firmware(fw);
/* Everything OK, kick off the card */
mdelay(10);
WRITE_REG(slic_regs->slic_wcs, SLIC_WCS_START, FLUSH);
@@ -2833,9 +2861,8 @@ static u32 slic_card_locate(struct adapter *adapter)
}
if (!physcard) {
/* no structure allocated for this physical card yet */
- physcard = kmalloc(sizeof(struct physcard *), GFP_ATOMIC);
+ physcard = kzalloc(sizeof(struct physcard), GFP_ATOMIC);
ASSERT(physcard);
- memset(physcard, 0, sizeof(struct physcard *));
DBG_MSG
("\n%s Allocate a PHYSICALcard:\n PHYSICAL_Card[%p]\n\
@@ -3136,7 +3163,7 @@ static void slic_timer_get_stats(ulong dev)
struct slic_shmem *pshmem;
ASSERT(dev);
- adapter = (struct adapter *)((struct net_device *)dev)->priv;
+ adapter = netdev_priv((struct net_device *)dev);
ASSERT(adapter);
card = adapter->card;
ASSERT(card);