Lines Matching refs:i2400m
386 int i2400m_is_boot_barker(struct i2400m *i2400m, in i2400m_is_boot_barker() argument
390 struct device *dev = i2400m_dev(i2400m); in i2400m_is_boot_barker()
400 if (i2400m->barker && in i2400m_is_boot_barker()
401 !memcmp(buf, i2400m->barker, sizeof(i2400m->barker->data))) in i2400m_is_boot_barker()
410 if (i2400m->barker == NULL) { in i2400m_is_boot_barker()
411 i2400m->barker = barker; in i2400m_is_boot_barker()
415 i2400m->sboot = 0; in i2400m_is_boot_barker()
417 i2400m->sboot = 1; in i2400m_is_boot_barker()
418 } else if (i2400m->barker != barker) { in i2400m_is_boot_barker()
422 le32_to_cpu(i2400m->barker->data[0]), in i2400m_is_boot_barker()
450 ssize_t __i2400m_bm_ack_verify(struct i2400m *i2400m, int opcode, in __i2400m_bm_ack_verify() argument
455 struct device *dev = i2400m_dev(i2400m); in __i2400m_bm_ack_verify()
458 i2400m, opcode, ack, ack_size); in __i2400m_bm_ack_verify()
466 result = i2400m_is_boot_barker(i2400m, ack, ack_size); in __i2400m_bm_ack_verify()
529 i2400m, opcode, ack, ack_size, (int) result); in __i2400m_bm_ack_verify()
580 ssize_t i2400m_bm_cmd(struct i2400m *i2400m, in i2400m_bm_cmd() argument
586 struct device *dev = i2400m_dev(i2400m); in i2400m_bm_cmd()
590 i2400m, cmd, cmd_size, ack, ack_size); in i2400m_bm_cmd()
592 BUG_ON(i2400m->boot_mode == 0); in i2400m_bm_cmd()
595 result = i2400m->bus_bm_cmd_send(i2400m, cmd, cmd_size, flags); in i2400m_bm_cmd()
608 result = i2400m->bus_bm_wait_for_ack(i2400m, ack, ack_size); in i2400m_bm_cmd()
617 result = __i2400m_bm_ack_verify(i2400m, opcode, ack, ack_size, flags); in i2400m_bm_cmd()
628 i2400m, cmd, cmd_size, ack, ack_size, (int) result); in i2400m_bm_cmd()
643 static int i2400m_download_chunk(struct i2400m *i2400m, const void *chunk, in i2400m_download_chunk() argument
649 struct device *dev = i2400m_dev(i2400m); in i2400m_download_chunk()
657 "direct %u do_csum %u)\n", i2400m, chunk, __chunk_len, in i2400m_download_chunk()
659 buf = i2400m->bm_cmd_buf; in i2400m_download_chunk()
668 ret = i2400m_bm_cmd(i2400m, &buf->cmd, sizeof(buf->cmd) + chunk_len, in i2400m_download_chunk()
673 "direct %u do_csum %u) = %d\n", i2400m, chunk, __chunk_len, in i2400m_download_chunk()
698 ssize_t i2400m_dnload_bcf(struct i2400m *i2400m, in i2400m_dnload_bcf() argument
702 struct device *dev = i2400m_dev(i2400m); in i2400m_dnload_bcf()
711 i2400m, bcf, bcf_len); in i2400m_dnload_bcf()
737 i2400m->fw_name, section, in i2400m_dnload_bcf()
743 ret = i2400m_bm_cmd(i2400m, bh, section_size, in i2400m_dnload_bcf()
747 "failed %d\n", i2400m->fw_name, section, in i2400m_dnload_bcf()
758 i2400m, bcf, bcf_len, (int) ret); in i2400m_dnload_bcf()
768 unsigned i2400m_boot_is_signed(struct i2400m *i2400m) in i2400m_boot_is_signed() argument
770 return likely(i2400m->sboot); in i2400m_boot_is_signed()
786 int i2400m_dnload_finalize(struct i2400m *i2400m, in i2400m_dnload_finalize() argument
791 struct device *dev = i2400m_dev(i2400m); in i2400m_dnload_finalize()
801 if (i2400m_boot_is_signed(i2400m) == 0) { in i2400m_dnload_finalize()
805 cmd_buf = i2400m->bm_cmd_buf; in i2400m_dnload_finalize()
811 ret = i2400m_bm_cmd(i2400m, cmd, sizeof(*cmd), in i2400m_dnload_finalize()
816 cmd_buf = i2400m->bm_cmd_buf; in i2400m_dnload_finalize()
827 ret = i2400m_bm_cmd(i2400m, &cmd_buf->cmd, in i2400m_dnload_finalize()
880 int i2400m_bootrom_init(struct i2400m *i2400m, enum i2400m_bri flags) in i2400m_bootrom_init() argument
883 struct device *dev = i2400m_dev(i2400m); in i2400m_bootrom_init()
886 int count = i2400m->bus_bm_retries; in i2400m_bootrom_init()
893 d_fnstart(4, dev, "(i2400m %p flags 0x%08x)\n", i2400m, flags); in i2400m_bootrom_init()
895 cmd = i2400m->bm_cmd_buf; in i2400m_bootrom_init()
905 i2400m_reset(i2400m, I2400M_RT_WARM); in i2400m_bootrom_init()
906 result = i2400m_bm_cmd(i2400m, NULL, 0, &ack, sizeof(ack), in i2400m_bootrom_init()
928 if (i2400m->barker != NULL) { in i2400m_bootrom_init()
931 le32_to_cpu(i2400m->barker->data[0])); in i2400m_bootrom_init()
937 result = i2400m_bm_cmd(i2400m, cmd, sizeof(*cmd), in i2400m_bootrom_init()
968 memcpy(cmd, i2400m->barker->data, sizeof(i2400m->barker->data)); in i2400m_bootrom_init()
969 result = i2400m_bm_cmd(i2400m, cmd, sizeof(*cmd), in i2400m_bootrom_init()
1003 i2400m, flags, result); in i2400m_bootrom_init()
1022 int i2400m_read_mac_addr(struct i2400m *i2400m) in i2400m_read_mac_addr() argument
1025 struct device *dev = i2400m_dev(i2400m); in i2400m_read_mac_addr()
1026 struct net_device *net_dev = i2400m->wimax_dev.net_dev; in i2400m_read_mac_addr()
1033 d_fnstart(5, dev, "(i2400m %p)\n", i2400m); in i2400m_read_mac_addr()
1034 cmd = i2400m->bm_cmd_buf; in i2400m_read_mac_addr()
1038 result = i2400m_bm_cmd(i2400m, cmd, sizeof(*cmd), in i2400m_read_mac_addr()
1045 if (i2400m->bus_bm_mac_addr_impaired == 1) { in i2400m_read_mac_addr()
1057 d_fnend(5, dev, "(i2400m %p) = %d\n", i2400m, result); in i2400m_read_mac_addr()
1070 int i2400m_dnload_init_nonsigned(struct i2400m *i2400m) in i2400m_dnload_init_nonsigned() argument
1074 struct device *dev = i2400m_dev(i2400m); in i2400m_dnload_init_nonsigned()
1075 d_fnstart(5, dev, "(i2400m %p)\n", i2400m); in i2400m_dnload_init_nonsigned()
1076 if (i2400m->bus_bm_pokes_table) { in i2400m_dnload_init_nonsigned()
1077 while (i2400m->bus_bm_pokes_table[i].address) { in i2400m_dnload_init_nonsigned()
1079 i2400m, in i2400m_dnload_init_nonsigned()
1080 &i2400m->bus_bm_pokes_table[i].data, in i2400m_dnload_init_nonsigned()
1081 sizeof(i2400m->bus_bm_pokes_table[i].data), in i2400m_dnload_init_nonsigned()
1082 i2400m->bus_bm_pokes_table[i].address, 1, 1); in i2400m_dnload_init_nonsigned()
1088 d_fnend(5, dev, "(i2400m %p) = %d\n", i2400m, ret); in i2400m_dnload_init_nonsigned()
1108 int i2400m_dnload_init_signed(struct i2400m *i2400m, in i2400m_dnload_init_signed() argument
1112 struct device *dev = i2400m_dev(i2400m); in i2400m_dnload_init_signed()
1119 d_fnstart(5, dev, "(i2400m %p bcf_hdr %p)\n", i2400m, bcf_hdr); in i2400m_dnload_init_signed()
1120 cmd_buf = i2400m->bm_cmd_buf; in i2400m_dnload_init_signed()
1126 ret = i2400m_bm_cmd(i2400m, &cmd_buf->cmd, sizeof(*cmd_buf), in i2400m_dnload_init_signed()
1130 d_fnend(5, dev, "(i2400m %p bcf_hdr %p) = %d\n", i2400m, bcf_hdr, ret); in i2400m_dnload_init_signed()
1142 int i2400m_dnload_init(struct i2400m *i2400m, in i2400m_dnload_init() argument
1146 struct device *dev = i2400m_dev(i2400m); in i2400m_dnload_init()
1148 if (i2400m_boot_is_signed(i2400m)) { in i2400m_dnload_init()
1150 result = i2400m_dnload_init_signed(i2400m, bcf_hdr); in i2400m_dnload_init()
1156 i2400m->fw_name, result); in i2400m_dnload_init()
1160 result = i2400m_dnload_init_nonsigned(i2400m); in i2400m_dnload_init()
1166 i2400m->fw_name, result); in i2400m_dnload_init()
1184 int i2400m_fw_hdr_check(struct i2400m *i2400m, in i2400m_fw_hdr_check() argument
1188 struct device *dev = i2400m_dev(i2400m); in i2400m_fw_hdr_check()
1205 i2400m->fw_name, index, offset, in i2400m_fw_hdr_check()
1213 i2400m->fw_name, index, offset, in i2400m_fw_hdr_check()
1221 i2400m->fw_name, index, offset, in i2400m_fw_hdr_check()
1229 i2400m->fw_name, index, offset, module_vendor); in i2400m_fw_hdr_check()
1236 i2400m->fw_name, index, offset, date); in i2400m_fw_hdr_check()
1253 int i2400m_fw_check(struct i2400m *i2400m, const void *bcf, size_t bcf_size) in i2400m_fw_check() argument
1256 struct device *dev = i2400m_dev(i2400m); in i2400m_fw_check()
1272 i2400m->fw_name, leftover, offset); in i2400m_fw_check()
1285 result = i2400m_fw_hdr_check(i2400m, bcf_hdr, headers, offset); in i2400m_fw_check()
1293 (void **) &i2400m->fw_hdrs, &slots, in i2400m_fw_check()
1294 sizeof(i2400m->fw_hdrs[0]), in i2400m_fw_check()
1299 i2400m->fw_hdrs[used_slots] = bcf_hdr; in i2400m_fw_check()
1304 i2400m->fw_name); in i2400m_fw_check()
1320 unsigned i2400m_bcf_hdr_match(struct i2400m *i2400m, in i2400m_bcf_hdr_match() argument
1323 u32 barker = le32_to_cpu(i2400m->barker->data[0]) in i2400m_bcf_hdr_match()
1337 const struct i2400m_bcf_hdr *i2400m_bcf_hdr_find(struct i2400m *i2400m) in i2400m_bcf_hdr_find() argument
1339 struct device *dev = i2400m_dev(i2400m); in i2400m_bcf_hdr_find()
1342 u32 barker = le32_to_cpu(i2400m->barker->data[0]); in i2400m_bcf_hdr_find()
1346 bcf_hdr = i2400m->fw_hdrs[0]; in i2400m_bcf_hdr_find()
1351 for (bcf_itr = i2400m->fw_hdrs; *bcf_itr != NULL; bcf_itr++, i++) { in i2400m_bcf_hdr_find()
1353 if (i2400m_bcf_hdr_match(i2400m, bcf_hdr)) { in i2400m_bcf_hdr_find()
1382 int i2400m_fw_dnload(struct i2400m *i2400m, const struct i2400m_bcf_hdr *bcf, in i2400m_fw_dnload() argument
1386 struct device *dev = i2400m_dev(i2400m); in i2400m_fw_dnload()
1387 int count = i2400m->bus_bm_retries; in i2400m_fw_dnload()
1392 i2400m, bcf, fw_size); in i2400m_fw_dnload()
1393 i2400m->boot_mode = 1; in i2400m_fw_dnload()
1402 ret = i2400m_bootrom_init(i2400m, flags); in i2400m_fw_dnload()
1420 bcf_hdr = i2400m_bcf_hdr_find(i2400m); in i2400m_fw_dnload()
1424 ret = i2400m_dnload_init(i2400m, bcf_hdr); in i2400m_fw_dnload()
1436 ret = i2400m_dnload_bcf(i2400m, bcf, bcf_size); in i2400m_fw_dnload()
1441 i2400m->fw_name, ret); in i2400m_fw_dnload()
1445 ret = i2400m_dnload_finalize(i2400m, bcf_hdr, bcf, ret); in i2400m_fw_dnload()
1451 i2400m->fw_name, ret); in i2400m_fw_dnload()
1456 i2400m->fw_name); in i2400m_fw_dnload()
1457 i2400m->boot_mode = 0; in i2400m_fw_dnload()
1466 i2400m, bcf, fw_size, ret); in i2400m_fw_dnload()
1477 int i2400m_fw_bootstrap(struct i2400m *i2400m, const struct firmware *fw, in i2400m_fw_bootstrap() argument
1481 struct device *dev = i2400m_dev(i2400m); in i2400m_fw_bootstrap()
1484 d_fnstart(5, dev, "(i2400m %p)\n", i2400m); in i2400m_fw_bootstrap()
1486 ret = i2400m_fw_check(i2400m, bcf, fw->size); in i2400m_fw_bootstrap()
1488 ret = i2400m_fw_dnload(i2400m, bcf, fw->size, flags); in i2400m_fw_bootstrap()
1491 i2400m->fw_name, ret); in i2400m_fw_bootstrap()
1492 kfree(i2400m->fw_hdrs); in i2400m_fw_bootstrap()
1493 i2400m->fw_hdrs = NULL; in i2400m_fw_bootstrap()
1494 d_fnend(5, dev, "(i2400m %p) = %d\n", i2400m, ret); in i2400m_fw_bootstrap()
1547 int i2400m_dev_bootstrap(struct i2400m *i2400m, enum i2400m_bri flags) in i2400m_dev_bootstrap() argument
1550 struct device *dev = i2400m_dev(i2400m); in i2400m_dev_bootstrap()
1555 d_fnstart(5, dev, "(i2400m %p)\n", i2400m); in i2400m_dev_bootstrap()
1558 spin_lock(&i2400m->rx_lock); in i2400m_dev_bootstrap()
1559 i2400m_fw = i2400m_fw_get(i2400m->fw_cached); in i2400m_dev_bootstrap()
1560 spin_unlock(&i2400m->rx_lock); in i2400m_dev_bootstrap()
1566 i2400m->fw_name); in i2400m_dev_bootstrap()
1567 ret = i2400m_fw_bootstrap(i2400m, i2400m_fw->fw, flags); in i2400m_dev_bootstrap()
1574 fw_name = i2400m->bus_fw_names[itr]; in i2400m_dev_bootstrap()
1586 i2400m->fw_name = fw_name; in i2400m_dev_bootstrap()
1587 ret = i2400m_fw_bootstrap(i2400m, fw, flags); in i2400m_dev_bootstrap()
1591 i2400m->fw_name = NULL; in i2400m_dev_bootstrap()
1594 d_fnend(5, dev, "(i2400m %p) = %d\n", i2400m, ret); in i2400m_dev_bootstrap()
1600 void i2400m_fw_cache(struct i2400m *i2400m) in i2400m_fw_cache() argument
1604 struct device *dev = i2400m_dev(i2400m); in i2400m_fw_cache()
1607 spin_lock(&i2400m->rx_lock); in i2400m_fw_cache()
1608 i2400m_fw = i2400m->fw_cached; in i2400m_fw_cache()
1609 spin_unlock(&i2400m->rx_lock); in i2400m_fw_cache()
1616 if (i2400m->fw_name == NULL) { in i2400m_fw_cache()
1626 result = request_firmware(&i2400m_fw->fw, i2400m->fw_name, dev); in i2400m_fw_cache()
1629 i2400m->fw_name, result); in i2400m_fw_cache()
1633 dev_info(dev, "firmware %s: cached\n", i2400m->fw_name); in i2400m_fw_cache()
1635 spin_lock(&i2400m->rx_lock); in i2400m_fw_cache()
1636 i2400m->fw_cached = i2400m_fw; in i2400m_fw_cache()
1637 spin_unlock(&i2400m->rx_lock); in i2400m_fw_cache()
1641 void i2400m_fw_uncache(struct i2400m *i2400m) in i2400m_fw_uncache() argument
1645 spin_lock(&i2400m->rx_lock); in i2400m_fw_uncache()
1646 i2400m_fw = i2400m->fw_cached; in i2400m_fw_uncache()
1647 i2400m->fw_cached = NULL; in i2400m_fw_uncache()
1648 spin_unlock(&i2400m->rx_lock); in i2400m_fw_uncache()