5 #include <linux/kernel.h>
6 #include <linux/slab.h>
8 #include <linux/device.h>
9 #include <linux/module.h>
28 static const struct fw_info orinoco_fw[] = {
29 {
NULL,
"agere_sta_fw.bin",
"agere_ap_fw.bin", 0x00390000, 1000 },
30 {
NULL,
"prism_sta_fw.bin",
"prism_ap_fw.bin", 0, 1024 },
31 {
"symbol_sp24t_prim_fw",
"symbol_sp24t_sec_fw",
NULL, 0x00003100, 512 }
61 if (len <
sizeof(*hdr))
62 return "image too small";
64 return "format not recognised";
68 return "bad headersize";
70 return "bad block offset";
72 return "bad PDR offset";
74 return "bad PRI offset";
76 return "bad compat offset";
82 #if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP)
83 static inline const struct firmware *
87 return priv->cached_pri_fw;
89 return priv->cached_fw;
92 #define orinoco_cached_fw_get(priv, primary) (NULL)
107 const unsigned char *first_block;
119 firmware = fw->
ap_fw;
123 dev_dbg(dev,
"Attempting to download firmware %s\n", firmware);
127 dev_dbg(dev,
"Read PDA returned %d\n", err);
135 dev_err(dev,
"Cannot find firmware %s\n", firmware);
144 fw_err = validate_fw(hdr, fw_entry->
size);
146 dev_warn(dev,
"Invalid firmware image detected (%s). "
147 "Aborting download\n", fw_err);
154 dev_dbg(dev,
"Program init returned %d\n", err);
159 first_block = (fw_entry->
data +
162 end = fw_entry->
data + fw_entry->
size;
165 dev_dbg(dev,
"Program returned %d\n", err);
170 first_block = (fw_entry->
data +
176 dev_dbg(dev,
"Apply PDA returned %d\n", err);
181 err = hw->
ops->program_end(hw);
182 dev_dbg(dev,
"Program end returned %d\n", err);
187 dev_dbg(dev,
"hermes_present returned %d\n", hermes_present(hw));
206 const unsigned char *
image,
const void *
end,
211 const unsigned char *
ptr;
212 const unsigned char *first_block;
248 ptr = first_block + len;
264 ret = hw->
ops->init(hw);
267 if (secondary && ret != 0)
271 if (!hermes_present(hw))
303 ret = symbol_dl_image(priv, fw, fw_entry->
data,
304 fw_entry->
data + fw_entry->
size, 0);
309 dev_err(dev,
"Primary firmware download failed\n");
322 ret = symbol_dl_image(priv, fw, fw_entry->
data,
323 fw_entry->
data + fw_entry->
size, 1);
327 dev_err(dev,
"Secondary firmware download failed\n");
339 err = orinoco_dl_firmware(priv,
344 err = symbol_dl_firmware(priv,
356 #if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP)
371 priv->cached_pri_fw = fw_entry;
376 priv->cached_fw = fw_entry;
384 priv->cached_pri_fw =
NULL;
385 priv->cached_fw =
NULL;