Lines Matching +full:wr +full:- +full:hold

1 // SPDX-License-Identifier: GPL-2.0-only
5 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
18 (C) Copyright AudioScience Inc. 1998-2003
78 /* can't access SDRAM - test#1 */
80 /* can't access SDRAM - test#2 */
210 switch (phm->function) { in subsys_message()
215 phr->error = HPI_ERROR_INVALID_FUNC; in subsys_message()
223 struct hpi_hw_obj *phw = pao->priv; in control_message()
225 switch (phm->function) { in control_message()
227 if (pao->has_control_cache) { in control_message()
233 phr->error = in control_message()
235 phr->specific_error = err; in control_message()
237 phr->error = err; in control_message()
242 if (hpi_check_control_cache(phw->p_cache, phm, phr)) in control_message()
249 hpi_cmn_control_cache_sync_to_msg(phw->p_cache, phm, phr); in control_message()
262 switch (phm->function) { in adapter_message()
280 switch (phm->function) { in outstream_message()
288 phr->error = HPI_ERROR_INVALID_FUNC; in outstream_message()
300 switch (phm->function) { in instream_message()
308 phr->error = HPI_ERROR_INVALID_FUNC; in instream_message()
325 if (phm->object != HPI_OBJ_SUBSYSTEM) { in HPI_6000()
326 pao = hpi_find_adapter(phm->adapter_index); in HPI_6000()
328 hpi_init_response(phr, phm->object, phm->function, in HPI_6000()
331 phm->adapter_index); in HPI_6000()
336 if (pao->dsp_crashed >= 10) { in HPI_6000()
337 hpi_init_response(phr, phm->object, phm->function, in HPI_6000()
340 phm->adapter_index); in HPI_6000()
345 if (phm->function != HPI_SUBSYS_CREATE_ADAPTER) in HPI_6000()
346 hpi_init_response(phr, phm->object, phm->function, in HPI_6000()
349 switch (phm->type) { in HPI_6000()
351 switch (phm->object) { in HPI_6000()
357 phr->size = in HPI_6000()
382 phr->error = HPI_ERROR_INVALID_TYPE; in HPI_6000()
392 * NOTE - you cannot use this function AND the FindAdapters function at the
412 phr->error = HPI_ERROR_MEMORY_ALLOC; in subsys_create_adapter()
417 ao.pci = *phm->u.s.resource.r.pci; in subsys_create_adapter()
423 phr->error = HPI_ERROR_DSP_BOOTLOAD; in subsys_create_adapter()
424 phr->specific_error = err; in subsys_create_adapter()
426 phr->error = err; in subsys_create_adapter()
429 phr->u.s.data = os_error_code; in subsys_create_adapter()
437 phr->error = HPI_ERROR_BAD_ADAPTER; in subsys_create_adapter()
442 struct hpi_hw_obj *phw = pao->priv; in subsys_create_adapter()
443 phw->ado[dsp_index].pa_parent_adapter = pao; in subsys_create_adapter()
446 phr->u.s.adapter_type = ao.type; in subsys_create_adapter()
447 phr->u.s.adapter_index = ao.index; in subsys_create_adapter()
448 phr->error = 0; in subsys_create_adapter()
456 phr->error = 0; in adapter_delete()
467 struct hpi_hw_obj *phw = pao->priv; in create_adapter_obj()
470 /* BAR0 - 4K = HPI control and status registers on PCI2040 (HPI CSR) */ in create_adapter_obj()
471 /* BAR1 - 32K = HPI registers on DSP */ in create_adapter_obj()
472 phw->dw2040_HPICSR = pao->pci.ap_mem_base[0]; in create_adapter_obj()
473 phw->dw2040_HPIDSP = pao->pci.ap_mem_base[1]; in create_adapter_obj()
474 HPI_DEBUG_LOG(VERBOSE, "csr %p, dsp %p\n", phw->dw2040_HPICSR, in create_adapter_obj()
475 phw->dw2040_HPIDSP); in create_adapter_obj()
479 phw->ado[dsp_index].prHPI_control = in create_adapter_obj()
480 phw->dw2040_HPIDSP + (CONTROL + in create_adapter_obj()
483 phw->ado[dsp_index].prHPI_address = in create_adapter_obj()
484 phw->dw2040_HPIDSP + (ADDRESS + in create_adapter_obj()
486 phw->ado[dsp_index].prHPI_data = in create_adapter_obj()
487 phw->dw2040_HPIDSP + (DATA + DSP_SPACING * dsp_index); in create_adapter_obj()
489 phw->ado[dsp_index].prHPI_data_auto_inc = in create_adapter_obj()
490 phw->dw2040_HPIDSP + (DATA_AUTOINC + in create_adapter_obj()
494 phw->ado[dsp_index].prHPI_control, in create_adapter_obj()
495 phw->ado[dsp_index].prHPI_address, in create_adapter_obj()
496 phw->ado[dsp_index].prHPI_data, in create_adapter_obj()
497 phw->ado[dsp_index].prHPI_data_auto_inc); in create_adapter_obj()
499 phw->ado[dsp_index].pa_parent_adapter = pao; in create_adapter_obj()
502 phw->pCI2040HPI_error_count = 0; in create_adapter_obj()
503 pao->has_control_cache = 0; in create_adapter_obj()
508 phw->num_dsp = 1; in create_adapter_obj()
516 phw->message_buffer_address_on_dsp = 0L; in create_adapter_obj()
517 phw->response_buffer_address_on_dsp = 0L; in create_adapter_obj()
544 if (phw->num_dsp == 2) { in create_adapter_obj()
550 pao->type = hr0.u.ax.info.adapter_type; in create_adapter_obj()
551 pao->index = hr0.u.ax.info.adapter_index; in create_adapter_obj()
554 memset(&phw->control_cache[0], 0, in create_adapter_obj()
559 hpi_read_word(&phw->ado[0], in create_adapter_obj()
563 hpi_read_word(&phw->ado[0], in create_adapter_obj()
566 phw->p_cache = in create_adapter_obj()
569 &phw->control_cache[0] in create_adapter_obj()
571 if (phw->p_cache) in create_adapter_obj()
572 pao->has_control_cache = 1; in create_adapter_obj()
575 HPI_DEBUG_LOG(DEBUG, "get adapter info ASI%04X index %d\n", pao->type, in create_adapter_obj()
576 pao->index); in create_adapter_obj()
578 if (phw->p_cache) in create_adapter_obj()
579 phw->p_cache->adap_idx = pao->index; in create_adapter_obj()
586 struct hpi_hw_obj *phw = pao->priv; in delete_adapter_obj()
588 if (pao->has_control_cache) in delete_adapter_obj()
589 hpi_free_control_cache(phw->p_cache); in delete_adapter_obj()
592 iowrite32(0x0003000F, phw->dw2040_HPICSR + HPI_RESET); in delete_adapter_obj()
606 phr->u.ax.assert.p1 = in adapter_get_asserts()
608 phr->u.ax.assert.p2 = 0; in adapter_get_asserts()
609 phr->u.ax.assert.count = 1; /* assert count */ in adapter_get_asserts()
610 phr->u.ax.assert.dsp_index = -1; /* "dsp index" */ in adapter_get_asserts()
611 strcpy(phr->u.ax.assert.sz_message, "PCI2040 error"); in adapter_get_asserts()
612 phr->u.ax.assert.dsp_msg_addr = 0; in adapter_get_asserts()
615 phr->error = 0; in adapter_get_asserts()
624 /* LOW-LEVEL */
629 struct hpi_hw_obj *phw = pao->priv; in hpi6000_adapter_boot_load_dsp()
649 switch (pao->pci.pci_dev->subsystem_device) { in hpi6000_adapter_boot_load_dsp()
662 * set RST3-=1 to disconnect HAD8 to set DSP in little endian mode in hpi6000_adapter_boot_load_dsp()
666 iowrite32(dw2040_reset, phw->dw2040_HPICSR + HPI_RESET); in hpi6000_adapter_boot_load_dsp()
669 * note that bits 4..15 are read-only and so should always return zero, in hpi6000_adapter_boot_load_dsp()
673 delay = ioread32(phw->dw2040_HPICSR + HPI_RESET); in hpi6000_adapter_boot_load_dsp()
682 iowrite32(0x00000003, phw->dw2040_HPICSR + HPI_DATA_WIDTH); in hpi6000_adapter_boot_load_dsp()
683 /* set Bit30 and 29 - which will prevent Target aborts from being in hpi6000_adapter_boot_load_dsp()
686 iowrite32(0x60000000, phw->dw2040_HPICSR + INTERRUPT_MASK_SET); in hpi6000_adapter_boot_load_dsp()
692 iowrite32(dw2040_reset, phw->dw2040_HPICSR + HPI_RESET); in hpi6000_adapter_boot_load_dsp()
694 phw->ado[0].c_dsp_rev = 'B'; /* revB */ in hpi6000_adapter_boot_load_dsp()
695 phw->ado[1].c_dsp_rev = 'B'; /* revB */ in hpi6000_adapter_boot_load_dsp()
699 iowrite32(dw2040_reset, phw->dw2040_HPICSR + HPI_RESET); in hpi6000_adapter_boot_load_dsp()
701 iowrite32(dw2040_reset, phw->dw2040_HPICSR + HPI_RESET); in hpi6000_adapter_boot_load_dsp()
705 iowrite32(dw2040_reset, phw->dw2040_HPICSR + HPI_RESET); in hpi6000_adapter_boot_load_dsp()
710 for (dsp_index = 0; dsp_index < phw->num_dsp; dsp_index++) { in hpi6000_adapter_boot_load_dsp()
711 struct dsp_obj *pdo = &phw->ado[dsp_index]; in hpi6000_adapter_boot_load_dsp()
715 iowrite32(0x00010001, pdo->prHPI_control); in hpi6000_adapter_boot_load_dsp()
720 iowrite32(test_data, pdo->prHPI_address); in hpi6000_adapter_boot_load_dsp()
721 data = ioread32(pdo->prHPI_address); in hpi6000_adapter_boot_load_dsp()
772 * revB - because of bug 3.0.1 last HPI read in hpi6000_adapter_boot_load_dsp()
773 * (before HPI address issued) must be non-autoinc in hpi6000_adapter_boot_load_dsp()
795 00000000-0000FFFF 16Kx32 internal program in hpi6000_adapter_boot_load_dsp()
796 01800000-019FFFFF Internal peripheral in hpi6000_adapter_boot_load_dsp()
797 80000000-807FFFFF CE0 2Mx32 SDRAM running @ 100MHz in hpi6000_adapter_boot_load_dsp()
798 90000000-9000FFFF CE1 Async peripherals: in hpi6000_adapter_boot_load_dsp()
801 ------------ in hpi6000_adapter_boot_load_dsp()
803 0 - in hpi6000_adapter_boot_load_dsp()
804 1 - in hpi6000_adapter_boot_load_dsp()
805 2 - in hpi6000_adapter_boot_load_dsp()
808 5 EKEN = 1 <--!! C6713 specific, enables ECLKOUT in hpi6000_adapter_boot_load_dsp()
809 6 - in hpi6000_adapter_boot_load_dsp()
810 7 NOHOLD = 1 external HOLD disabled in hpi6000_adapter_boot_load_dsp()
812 9 HOLD = 0 HOLD input is low in hpi6000_adapter_boot_load_dsp()
819 /* EMIF CE0 setup - 2Mx32 Sync DRAM in hpi6000_adapter_boot_load_dsp()
820 31..28 Wr setup in hpi6000_adapter_boot_load_dsp()
821 27..22 Wr strobe in hpi6000_adapter_boot_load_dsp()
822 21..20 Wr hold in hpi6000_adapter_boot_load_dsp()
824 15..14 - in hpi6000_adapter_boot_load_dsp()
827 3 Wr hold MSB in hpi6000_adapter_boot_load_dsp()
828 2..0 Rd hold in hpi6000_adapter_boot_load_dsp()
833 31-21 0 in hpi6000_adapter_boot_load_dsp()
835 19-18 WR2DEAC = 1 in hpi6000_adapter_boot_load_dsp()
837 16-15 R2WDQM = 2 in hpi6000_adapter_boot_load_dsp()
838 14-12 RD2WR = 4 in hpi6000_adapter_boot_load_dsp()
839 11-10 RD2DEAC = 1 in hpi6000_adapter_boot_load_dsp()
841 8-7 THZP = 10b in hpi6000_adapter_boot_load_dsp()
842 6-5 TWR = 2-1 = 01b (tWR = 10ns) in hpi6000_adapter_boot_load_dsp()
844 3-1 TRAS = 5-1 = 100b (Tras=42ns = 5 ECLK) in hpi6000_adapter_boot_load_dsp()
846 (for Micron 2M32-7 operating at 100Mhz) in hpi6000_adapter_boot_load_dsp()
852 /* EMIF SDRAM control - set up for a 2Mx32 SDRAM (512x32x4 bank) in hpi6000_adapter_boot_load_dsp()
853 31 - - in hpi6000_adapter_boot_load_dsp()
862 11..0 - - in hpi6000_adapter_boot_load_dsp()
870 /*MIF CE1 setup - Async peripherals in hpi6000_adapter_boot_load_dsp()
872 31..28 Wr setup = 1 in hpi6000_adapter_boot_load_dsp()
873 27..22 Wr strobe = 3 30ns in hpi6000_adapter_boot_load_dsp()
874 21..20 Wr hold = 1 in hpi6000_adapter_boot_load_dsp()
879 3 Wr hold MSB =0 in hpi6000_adapter_boot_load_dsp()
880 2..0 Rd hold = 1 in hpi6000_adapter_boot_load_dsp()
936 error = hpi_dsp_code_open(boot_load_family, pao->pci.pci_dev, in hpi6000_adapter_boot_load_dsp()
1030 iowrite32(0x00030003, pdo->prHPI_control); in hpi6000_adapter_boot_load_dsp()
1033 /* wait for a non-zero value in hostcmd - in hpi6000_adapter_boot_load_dsp()
1045 } while (--timeout in hpi6000_adapter_boot_load_dsp()
1077 phw->num_dsp = 2; in hpi6000_adapter_boot_load_dsp()
1089 if (HPI_ADAPTER_FAMILY_ASI(pao->pci.pci_dev-> in hpi6000_adapter_boot_load_dsp()
1095 if (HPI_ADAPTER_FAMILY_ASI(pao->pci.pci_dev-> in hpi6000_adapter_boot_load_dsp()
1106 /* write to 24 bit Debug register (D31-D8) */ in hpi6000_adapter_boot_load_dsp()
1136 iowrite32(address, pdo->prHPI_address); in hpi_set_address()
1137 } while (hpi6000_check_PCI2040_error_flag(pdo->pa_parent_adapter, in hpi_set_address()
1139 && --timeout); in hpi_set_address()
1152 iowrite32(data, pdo->prHPI_data); in hpi_write_word()
1164 data = ioread32(pdo->prHPI_data); in hpi_read_word()
1168 /* write a block of 32bit words to the DSP HPI port using auto-inc mode */
1172 u16 length16 = length - 1; in hpi_write_block()
1180 iowrite32_rep(pdo->prHPI_data_auto_inc, pdata, length16); in hpi_write_block()
1183 /* must end with non auto-inc */ in hpi_write_block()
1184 iowrite32(*(pdata + length - 1), pdo->prHPI_data); in hpi_write_block()
1187 /** read a block of 32bit words from the DSP HPI port using auto-inc mode
1192 u16 length16 = length - 1; in hpi_read_block()
1200 ioread32_rep(pdo->prHPI_data_auto_inc, pdata, length16); in hpi_read_block()
1203 /* must end with non auto-inc */ in hpi_read_block()
1204 *(pdata + length - 1) = ioread32(pdo->prHPI_data); in hpi_read_block()
1210 struct hpi_hw_obj *phw = pao->priv; in hpi6000_dsp_block_write32()
1211 struct dsp_obj *pdo = &phw->ado[dsp_index]; in hpi6000_dsp_block_write32()
1230 && --time_out); in hpi6000_dsp_block_write32()
1236 local_count -= xfer_size; in hpi6000_dsp_block_write32()
1248 struct hpi_hw_obj *phw = pao->priv; in hpi6000_dsp_block_read32()
1249 struct dsp_obj *pdo = &phw->ado[dsp_index]; in hpi6000_dsp_block_read32()
1268 && --time_out); in hpi6000_dsp_block_read32()
1274 local_count -= xfer_size; in hpi6000_dsp_block_read32()
1286 struct hpi_hw_obj *phw = pao->priv; in hpi6000_message_response_sequence()
1287 struct dsp_obj *pdo = &phw->ado[dsp_index]; in hpi6000_message_response_sequence()
1297 pao->dsp_crashed++; in hpi6000_message_response_sequence()
1300 pao->dsp_crashed = 0; in hpi6000_message_response_sequence()
1303 if (phw->message_buffer_address_on_dsp == 0) { in hpi6000_message_response_sequence()
1309 phw->message_buffer_address_on_dsp = address; in hpi6000_message_response_sequence()
1311 && --timeout); in hpi6000_message_response_sequence()
1315 address = phw->message_buffer_address_on_dsp; in hpi6000_message_response_sequence()
1317 length = phm->size; in hpi6000_message_response_sequence()
1334 if (phw->response_buffer_address_on_dsp == 0) { in hpi6000_message_response_sequence()
1341 && --timeout); in hpi6000_message_response_sequence()
1342 phw->response_buffer_address_on_dsp = address; in hpi6000_message_response_sequence()
1347 address = phw->response_buffer_address_on_dsp; in hpi6000_message_response_sequence()
1353 } while (hpi6000_check_PCI2040_error_flag(pao, H6READ) && --timeout); in hpi6000_message_response_sequence()
1357 if (length > phr->size) in hpi6000_message_response_sequence()
1405 struct hpi_hw_obj *phw = pao->priv; in hpi6000_send_data()
1406 struct dsp_obj *pdo = &phw->ado[dsp_index]; in hpi6000_send_data()
1410 u32 *p_data = (u32 *)phm->u.d.u.data.pb_data; in hpi6000_send_data()
1416 while ((data_sent < (phm->u.d.u.data.data_size & ~3L)) in hpi6000_send_data()
1417 && --time_out) { in hpi6000_send_data()
1459 len -= blk_len; in hpi6000_send_data()
1478 struct hpi_hw_obj *phw = pao->priv; in hpi6000_get_data()
1479 struct dsp_obj *pdo = &phw->ado[dsp_index]; in hpi6000_get_data()
1483 u32 *p_data = (u32 *)phm->u.d.u.data.pb_data; in hpi6000_get_data()
1488 while (data_got < (phm->u.d.u.data.data_size & ~3L)) { in hpi6000_get_data()
1521 len -= blk_len; in hpi6000_get_data()
1536 iowrite32(0x00030003, pdo->prHPI_control); /* DSPINT */ in hpi6000_send_dsp_interrupt()
1542 struct hpi_hw_obj *phw = pao->priv; in hpi6000_send_host_command()
1543 struct dsp_obj *pdo = &phw->ado[dsp_index]; in hpi6000_send_host_command()
1551 } while (hpi6000_check_PCI2040_error_flag(pao, H6WRITE) && --timeout); in hpi6000_send_host_command()
1554 iowrite32(0x00040004, pdo->prHPI_control); in hpi6000_send_host_command()
1568 struct hpi_hw_obj *phw = pao->priv; in hpi6000_check_PCI2040_error_flag()
1571 hPI_error = ioread32(phw->dw2040_HPICSR + HPI_ERROR_REPORT); in hpi6000_check_PCI2040_error_flag()
1574 iowrite32(0L, phw->dw2040_HPICSR + HPI_ERROR_REPORT); in hpi6000_check_PCI2040_error_flag()
1575 phw->pCI2040HPI_error_count++; in hpi6000_check_PCI2040_error_flag()
1588 struct hpi_hw_obj *phw = pao->priv; in hpi6000_wait_dsp_ack()
1589 struct dsp_obj *pdo = &phw->ado[dsp_index]; in hpi6000_wait_dsp_ack()
1596 while (--timeout) { in hpi6000_wait_dsp_ack()
1597 hPIC = ioread32(pdo->prHPI_control); in hpi6000_wait_dsp_ack()
1606 while (--timeout) { in hpi6000_wait_dsp_ack()
1618 /* indicates bad read from DSP - in hpi6000_wait_dsp_ack()
1631 struct hpi_hw_obj *phw = pao->priv; in hpi6000_update_control_cache()
1632 struct dsp_obj *pdo = &phw->ado[dsp_index]; in hpi6000_update_control_cache()
1644 } while (hpi6000_check_PCI2040_error_flag(pao, H6READ) && --timeout); in hpi6000_update_control_cache()
1656 if (pdo->control_cache_address_on_dsp == 0) { in hpi6000_update_control_cache()
1666 && --timeout); in hpi6000_update_control_cache()
1671 pdo->control_cache_address_on_dsp = address; in hpi6000_update_control_cache()
1672 pdo->control_cache_length_on_dsp = length; in hpi6000_update_control_cache()
1674 address = pdo->control_cache_address_on_dsp; in hpi6000_update_control_cache()
1675 length = pdo->control_cache_length_on_dsp; in hpi6000_update_control_cache()
1679 (u32 *)&phw->control_cache[0], in hpi6000_update_control_cache()
1690 && --timeout); in hpi6000_update_control_cache()
1708 switch (phm->object) { in get_dsp_index()
1710 if (phm->obj_index < 2) in get_dsp_index()
1714 ret = phm->obj_index; in get_dsp_index()
1731 struct hpi_hw_obj *phw = pao->priv; in hw_message()
1732 u16 num_dsp = phw->num_dsp; in hw_message()
1740 if ((phm->function == HPI_ISTREAM_GROUP_ADD) in hw_message()
1741 || (phm->function == HPI_OSTREAM_GROUP_ADD)) { in hw_message()
1744 hm.obj_index = phm->u.d.u.stream.stream_index; in hw_message()
1745 hm.object = phm->u.d.u.stream.object_type; in hw_message()
1748 phr->error = HPI_ERROR_NO_INTERDSP_GROUPS; in hw_message()
1760 if (phr->error) /* something failed in the DSP */ in hw_message()
1763 switch (phm->function) { in hw_message()
1773 phr->u.ax.assert.dsp_index = 0; /* dsp 0 default */ in hw_message()
1775 if (!phr->u.ax.assert.count) { in hw_message()
1779 phr->u.ax.assert.dsp_index = 1; in hw_message()
1787 phr->error = HPI_ERROR_DSP_COMMUNICATION; in hw_message()
1788 phr->specific_error = error; in hw_message()
1790 phr->error = error; in hw_message()
1794 phr->size = sizeof(struct hpi_response_header); in hw_message()