diff options
Diffstat (limited to 'drivers/staging/slicoss')
-rw-r--r-- | drivers/staging/slicoss/slic.h | 34 | ||||
-rw-r--r-- | drivers/staging/slicoss/slicoss.c | 77 |
2 files changed, 87 insertions, 24 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 @@ | |||
41 | #ifndef __SLIC_DRIVER_H__ | 41 | #ifndef __SLIC_DRIVER_H__ |
42 | #define __SLIC_DRIVER_H__ | 42 | #define __SLIC_DRIVER_H__ |
43 | 43 | ||
44 | /* firmware stuff */ | ||
45 | #define OASIS_UCODE_VERS_STRING "1.2" | ||
46 | #define OASIS_UCODE_VERS_DATE "2006/03/27 15:10:37" | ||
47 | #define OASIS_UCODE_HOSTIF_ID 3 | ||
48 | |||
49 | static s32 ONumSections = 0x2; | ||
50 | static u32 OSectionSize[] = { | ||
51 | 0x00004000, 0x00010000, | ||
52 | }; | ||
53 | |||
54 | static u32 OSectionStart[] = { | ||
55 | 0x00000000, 0x00008000, | ||
56 | }; | ||
57 | |||
58 | #define MOJAVE_UCODE_VERS_STRING "1.2" | ||
59 | #define MOJAVE_UCODE_VERS_DATE "2006/03/27 15:12:22" | ||
60 | #define MOJAVE_UCODE_HOSTIF_ID 3 | ||
61 | |||
62 | static s32 MNumSections = 0x2; | ||
63 | static u32 MSectionSize[] = | ||
64 | { | ||
65 | 0x00008000, 0x00010000, | ||
66 | }; | ||
67 | |||
68 | static u32 MSectionStart[] = | ||
69 | { | ||
70 | 0x00000000, 0x00008000, | ||
71 | }; | ||
72 | |||
73 | #define GB_RCVUCODE_VERS_STRING "1.2" | ||
74 | #define GB_RCVUCODE_VERS_DATE "2006/03/27 15:12:15" | ||
75 | static u32 OasisRcvUCodeLen = 512; | ||
76 | static u32 GBRcvUCodeLen = 512; | ||
77 | #define SECTION_SIZE 65536 | ||
44 | 78 | ||
45 | struct slic_spinlock { | 79 | struct slic_spinlock { |
46 | spinlock_t lock; | 80 | spinlock_t lock; |
diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index d256aef9c43..bf7da8f898a 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c | |||
@@ -94,6 +94,7 @@ | |||
94 | #include <linux/module.h> | 94 | #include <linux/module.h> |
95 | #include <linux/moduleparam.h> | 95 | #include <linux/moduleparam.h> |
96 | 96 | ||
97 | #include <linux/firmware.h> | ||
97 | #include <linux/types.h> | 98 | #include <linux/types.h> |
98 | #include <linux/dma-mapping.h> | 99 | #include <linux/dma-mapping.h> |
99 | #include <linux/mii.h> | 100 | #include <linux/mii.h> |
@@ -105,15 +106,6 @@ | |||
105 | 106 | ||
106 | #include <linux/uaccess.h> | 107 | #include <linux/uaccess.h> |
107 | #include "slicinc.h" | 108 | #include "slicinc.h" |
108 | #include "gbdownload.h" | ||
109 | #include "gbrcvucode.h" | ||
110 | #include "oasisrcvucode.h" | ||
111 | |||
112 | #ifdef DEBUG_MICROCODE | ||
113 | #include "oasisdbgdownload.h" | ||
114 | #else | ||
115 | #include "oasisdownload.h" | ||
116 | #endif | ||
117 | 109 | ||
118 | #if SLIC_DUMP_ENABLED | 110 | #if SLIC_DUMP_ENABLED |
119 | #include "slicdump.h" | 111 | #include "slicdump.h" |
@@ -2186,6 +2178,9 @@ static void slic_card_cleanup(struct sliccard *card) | |||
2186 | 2178 | ||
2187 | static int slic_card_download_gbrcv(struct adapter *adapter) | 2179 | static int slic_card_download_gbrcv(struct adapter *adapter) |
2188 | { | 2180 | { |
2181 | const struct firmware *fw; | ||
2182 | const char *file = ""; | ||
2183 | int ret; | ||
2189 | __iomem struct slic_regs *slic_regs = adapter->slic_regs; | 2184 | __iomem struct slic_regs *slic_regs = adapter->slic_regs; |
2190 | u32 codeaddr; | 2185 | u32 codeaddr; |
2191 | unsigned char *instruction = NULL; | 2186 | unsigned char *instruction = NULL; |
@@ -2193,12 +2188,32 @@ static int slic_card_download_gbrcv(struct adapter *adapter) | |||
2193 | 2188 | ||
2194 | switch (adapter->devid) { | 2189 | switch (adapter->devid) { |
2195 | case SLIC_2GB_DEVICE_ID: | 2190 | case SLIC_2GB_DEVICE_ID: |
2196 | instruction = (unsigned char *)&OasisRcvUCode[0]; | 2191 | file = "oasis_rcv.bin"; |
2197 | rcvucodelen = OasisRcvUCodeLen; | ||
2198 | break; | 2192 | break; |
2199 | case SLIC_1GB_DEVICE_ID: | 2193 | case SLIC_1GB_DEVICE_ID: |
2200 | instruction = (unsigned char *)&GBRcvUCode[0]; | 2194 | file = "gb_rcv.bin"; |
2201 | rcvucodelen = GBRcvUCodeLen; | 2195 | break; |
2196 | default: | ||
2197 | ASSERT(0); | ||
2198 | break; | ||
2199 | } | ||
2200 | |||
2201 | ret = request_firmware(&fw, file, &adapter->pcidev->dev); | ||
2202 | if (ret) { | ||
2203 | printk(KERN_ERR "SLICOSS: Failed to load firmware %s\n", file); | ||
2204 | return ret; | ||
2205 | } | ||
2206 | |||
2207 | instruction = (unsigned char *)fw->data; | ||
2208 | rcvucodelen = fw->size; | ||
2209 | switch (adapter->devid) { | ||
2210 | case SLIC_2GB_DEVICE_ID: | ||
2211 | if (rcvucodelen != OasisRcvUCodeLen) | ||
2212 | return -EINVAL; | ||
2213 | break; | ||
2214 | case SLIC_1GB_DEVICE_ID: | ||
2215 | if (rcvucodelen != GBRcvUCodeLen) | ||
2216 | return -EINVAL; | ||
2202 | break; | 2217 | break; |
2203 | default: | 2218 | default: |
2204 | ASSERT(0); | 2219 | ASSERT(0); |
@@ -2225,13 +2240,16 @@ static int slic_card_download_gbrcv(struct adapter *adapter) | |||
2225 | } | 2240 | } |
2226 | 2241 | ||
2227 | /* download finished */ | 2242 | /* download finished */ |
2243 | release_firmware(fw); | ||
2228 | WRITE_REG(slic_regs->slic_rcv_wcs, SLIC_RCVWCS_FINISH, FLUSH); | 2244 | WRITE_REG(slic_regs->slic_rcv_wcs, SLIC_RCVWCS_FINISH, FLUSH); |
2229 | |||
2230 | return 0; | 2245 | return 0; |
2231 | } | 2246 | } |
2232 | 2247 | ||
2233 | static int slic_card_download(struct adapter *adapter) | 2248 | static int slic_card_download(struct adapter *adapter) |
2234 | { | 2249 | { |
2250 | const struct firmware *fw; | ||
2251 | const char *file = ""; | ||
2252 | int ret; | ||
2235 | u32 section; | 2253 | u32 section; |
2236 | int thissectionsize; | 2254 | int thissectionsize; |
2237 | int codeaddr; | 2255 | int codeaddr; |
@@ -2255,6 +2273,7 @@ static int slic_card_download(struct adapter *adapter) | |||
2255 | case SLIC_2GB_DEVICE_ID: | 2273 | case SLIC_2GB_DEVICE_ID: |
2256 | /* DBG_MSG ("slicoss: %s devid==SLIC_2GB_DEVICE_ID sections[%x]\n", | 2274 | /* DBG_MSG ("slicoss: %s devid==SLIC_2GB_DEVICE_ID sections[%x]\n", |
2257 | __func__, (uint) ONumSections); */ | 2275 | __func__, (uint) ONumSections); */ |
2276 | file = "slic_oasis.bin"; | ||
2258 | numsects = ONumSections; | 2277 | numsects = ONumSections; |
2259 | for (i = 0; i < numsects; i++) { | 2278 | for (i = 0; i < numsects; i++) { |
2260 | sectsize[i] = OSectionSize[i]; | 2279 | sectsize[i] = OSectionSize[i]; |
@@ -2264,6 +2283,7 @@ static int slic_card_download(struct adapter *adapter) | |||
2264 | case SLIC_1GB_DEVICE_ID: | 2283 | case SLIC_1GB_DEVICE_ID: |
2265 | /* DBG_MSG ("slicoss: %s devid==SLIC_1GB_DEVICE_ID sections[%x]\n", | 2284 | /* DBG_MSG ("slicoss: %s devid==SLIC_1GB_DEVICE_ID sections[%x]\n", |
2266 | __func__, (uint) MNumSections); */ | 2285 | __func__, (uint) MNumSections); */ |
2286 | file = "slic_mojave.bin"; | ||
2267 | numsects = MNumSections; | 2287 | numsects = MNumSections; |
2268 | for (i = 0; i < numsects; i++) { | 2288 | for (i = 0; i < numsects; i++) { |
2269 | sectsize[i] = MSectionSize[i]; | 2289 | sectsize[i] = MSectionSize[i]; |
@@ -2274,26 +2294,33 @@ static int slic_card_download(struct adapter *adapter) | |||
2274 | ASSERT(0); | 2294 | ASSERT(0); |
2275 | break; | 2295 | break; |
2276 | } | 2296 | } |
2297 | ret = request_firmware(&fw, file, &adapter->pcidev->dev); | ||
2298 | if (ret) { | ||
2299 | printk(KERN_ERR "SLICOSS: Failed to load firmware %s\n", file); | ||
2300 | return ret; | ||
2301 | } | ||
2277 | 2302 | ||
2278 | ASSERT(numsects <= 3); | 2303 | ASSERT(numsects <= 3); |
2279 | 2304 | ||
2280 | for (section = 0; section < numsects; section++) { | 2305 | for (section = 0; section < numsects; section++) { |
2281 | switch (adapter->devid) { | 2306 | switch (adapter->devid) { |
2282 | case SLIC_2GB_DEVICE_ID: | 2307 | case SLIC_2GB_DEVICE_ID: |
2283 | instruction = (u32 *) &OasisUCode[section][0]; | 2308 | instruction = (u32 *)(fw->data + (SECTION_SIZE * |
2309 | section)); | ||
2284 | baseaddress = sectstart[section]; | 2310 | baseaddress = sectstart[section]; |
2285 | thissectionsize = sectsize[section] >> 3; | 2311 | thissectionsize = sectsize[section] >> 3; |
2286 | lastinstruct = | 2312 | lastinstruct = |
2287 | (u32 *) &OasisUCode[section][sectsize[section] - | 2313 | (u32 *)(fw->data + (SECTION_SIZE * section) + |
2288 | 8]; | 2314 | sectsize[section] - 8); |
2289 | break; | 2315 | break; |
2290 | case SLIC_1GB_DEVICE_ID: | 2316 | case SLIC_1GB_DEVICE_ID: |
2291 | instruction = (u32 *) &MojaveUCode[section][0]; | 2317 | instruction = (u32 *)(fw->data + (SECTION_SIZE * |
2318 | section)); | ||
2292 | baseaddress = sectstart[section]; | 2319 | baseaddress = sectstart[section]; |
2293 | thissectionsize = sectsize[section] >> 3; | 2320 | thissectionsize = sectsize[section] >> 3; |
2294 | lastinstruct = | 2321 | lastinstruct = |
2295 | (u32 *) &MojaveUCode[section][sectsize[section] | 2322 | (u32 *)(fw->data + (SECTION_SIZE * section) + |
2296 | - 8]; | 2323 | sectsize[section] - 8); |
2297 | break; | 2324 | break; |
2298 | default: | 2325 | default: |
2299 | ASSERT(0); | 2326 | ASSERT(0); |
@@ -2329,10 +2356,12 @@ static int slic_card_download(struct adapter *adapter) | |||
2329 | for (section = 0; section < numsects; section++) { | 2356 | for (section = 0; section < numsects; section++) { |
2330 | switch (adapter->devid) { | 2357 | switch (adapter->devid) { |
2331 | case SLIC_2GB_DEVICE_ID: | 2358 | case SLIC_2GB_DEVICE_ID: |
2332 | instruction = (u32 *)&OasisUCode[section][0]; | 2359 | instruction = (u32 *)fw->data + (SECTION_SIZE * |
2360 | section); | ||
2333 | break; | 2361 | break; |
2334 | case SLIC_1GB_DEVICE_ID: | 2362 | case SLIC_1GB_DEVICE_ID: |
2335 | instruction = (u32 *)&MojaveUCode[section][0]; | 2363 | instruction = (u32 *)fw->data + (SECTION_SIZE * |
2364 | section); | ||
2336 | break; | 2365 | break; |
2337 | default: | 2366 | default: |
2338 | ASSERT(0); | 2367 | ASSERT(0); |
@@ -2374,13 +2403,13 @@ static int slic_card_download(struct adapter *adapter) | |||
2374 | thissectionsize[%x] failure[%x]\n", | 2403 | thissectionsize[%x] failure[%x]\n", |
2375 | __func__, codeaddr, thissectionsize, | 2404 | __func__, codeaddr, thissectionsize, |
2376 | failure); | 2405 | failure); |
2377 | 2406 | release_firmware(fw); | |
2378 | return -EIO; | 2407 | return -EIO; |
2379 | } | 2408 | } |
2380 | } | 2409 | } |
2381 | } | 2410 | } |
2382 | /* DBG_MSG ("slicoss: Compare done\n");*/ | 2411 | /* DBG_MSG ("slicoss: Compare done\n");*/ |
2383 | 2412 | release_firmware(fw); | |
2384 | /* Everything OK, kick off the card */ | 2413 | /* Everything OK, kick off the card */ |
2385 | mdelay(10); | 2414 | mdelay(10); |
2386 | WRITE_REG(slic_regs->slic_wcs, SLIC_WCS_START, FLUSH); | 2415 | WRITE_REG(slic_regs->slic_wcs, SLIC_WCS_START, FLUSH); |