Lines Matching refs:omap_dmm
36 static struct dmm *omap_dmm; variable
267 list_add(&engine->idle_node, &omap_dmm->idle_head); in release_engine()
270 atomic_inc(&omap_dmm->engine_counter); in release_engine()
271 wake_up_interruptible(&omap_dmm->engine_queue); in release_engine()
314 ret = wait_event_interruptible(omap_dmm->engine_queue, in dmm_txn_init()
315 atomic_add_unless(&omap_dmm->engine_counter, -1, 0)); in dmm_txn_init()
481 txn = dmm_txn_init(omap_dmm, area->tcm); in fill()
564 list_add(&block->alloc_node, &omap_dmm->alloc_head); in tiler_reserve_2d()
588 list_add(&block->alloc_node, &omap_dmm->alloc_head); in tiler_reserve_1d()
601 dev_err(omap_dmm->dev, "failed to release block\n"); in tiler_release()
718 return omap_dmm->plat_data->cpu_cache_flags; in tiler_get_cpu_cache_flags()
723 return omap_dmm ? true : false; in dmm_is_available()
732 if (omap_dmm) { in omap_dmm_remove()
734 dmm_write(omap_dmm, 0x7e7e7e7e, DMM_PAT_IRQENABLE_CLR); in omap_dmm_remove()
735 free_irq(omap_dmm->irq, omap_dmm); in omap_dmm_remove()
739 list_for_each_entry_safe(block, _block, &omap_dmm->alloc_head, in omap_dmm_remove()
746 for (i = 0; i < omap_dmm->num_lut; i++) in omap_dmm_remove()
747 if (omap_dmm->tcm && omap_dmm->tcm[i]) in omap_dmm_remove()
748 omap_dmm->tcm[i]->deinit(omap_dmm->tcm[i]); in omap_dmm_remove()
749 kfree(omap_dmm->tcm); in omap_dmm_remove()
751 kfree(omap_dmm->engines); in omap_dmm_remove()
752 if (omap_dmm->refill_va) in omap_dmm_remove()
753 dma_free_wc(omap_dmm->dev, in omap_dmm_remove()
754 REFILL_BUFFER_SIZE * omap_dmm->num_engines, in omap_dmm_remove()
755 omap_dmm->refill_va, omap_dmm->refill_pa); in omap_dmm_remove()
756 if (omap_dmm->dummy_page) in omap_dmm_remove()
757 __free_page(omap_dmm->dummy_page); in omap_dmm_remove()
759 if (omap_dmm->dmm_workaround) in omap_dmm_remove()
760 dmm_workaround_uninit(omap_dmm); in omap_dmm_remove()
762 iounmap(omap_dmm->base); in omap_dmm_remove()
763 kfree(omap_dmm); in omap_dmm_remove()
764 omap_dmm = NULL; in omap_dmm_remove()
775 omap_dmm = kzalloc(sizeof(*omap_dmm), GFP_KERNEL); in omap_dmm_probe()
776 if (!omap_dmm) in omap_dmm_probe()
780 INIT_LIST_HEAD(&omap_dmm->alloc_head); in omap_dmm_probe()
781 INIT_LIST_HEAD(&omap_dmm->idle_head); in omap_dmm_probe()
783 init_waitqueue_head(&omap_dmm->engine_queue); in omap_dmm_probe()
795 omap_dmm->plat_data = match->data; in omap_dmm_probe()
805 omap_dmm->phys_base = mem->start; in omap_dmm_probe()
806 omap_dmm->base = ioremap(mem->start, SZ_2K); in omap_dmm_probe()
808 if (!omap_dmm->base) { in omap_dmm_probe()
813 omap_dmm->irq = platform_get_irq(dev, 0); in omap_dmm_probe()
814 if (omap_dmm->irq < 0) in omap_dmm_probe()
817 omap_dmm->dev = &dev->dev; in omap_dmm_probe()
825 if (!dmm_workaround_init(omap_dmm)) { in omap_dmm_probe()
826 omap_dmm->dmm_workaround = true; in omap_dmm_probe()
835 hwinfo = dmm_read(omap_dmm, DMM_PAT_HWINFO); in omap_dmm_probe()
836 omap_dmm->num_engines = (hwinfo >> 24) & 0x1F; in omap_dmm_probe()
837 omap_dmm->num_lut = (hwinfo >> 16) & 0x1F; in omap_dmm_probe()
838 omap_dmm->container_width = 256; in omap_dmm_probe()
839 omap_dmm->container_height = 128; in omap_dmm_probe()
841 atomic_set(&omap_dmm->engine_counter, omap_dmm->num_engines); in omap_dmm_probe()
844 pat_geom = dmm_read(omap_dmm, DMM_PAT_GEOMETRY); in omap_dmm_probe()
845 omap_dmm->lut_width = ((pat_geom >> 16) & 0xF) << 5; in omap_dmm_probe()
846 omap_dmm->lut_height = ((pat_geom >> 24) & 0xF) << 5; in omap_dmm_probe()
850 if (omap_dmm->lut_height != omap_dmm->container_height) in omap_dmm_probe()
851 omap_dmm->num_lut++; in omap_dmm_probe()
854 dmm_write(omap_dmm, 0x88888888, DMM_PAT_VIEW__0); in omap_dmm_probe()
855 dmm_write(omap_dmm, 0x88888888, DMM_PAT_VIEW__1); in omap_dmm_probe()
856 dmm_write(omap_dmm, 0x80808080, DMM_PAT_VIEW_MAP__0); in omap_dmm_probe()
857 dmm_write(omap_dmm, 0x80000000, DMM_PAT_VIEW_MAP_BASE); in omap_dmm_probe()
858 dmm_write(omap_dmm, 0x88888888, DMM_TILER_OR__0); in omap_dmm_probe()
859 dmm_write(omap_dmm, 0x88888888, DMM_TILER_OR__1); in omap_dmm_probe()
861 omap_dmm->dummy_page = alloc_page(GFP_KERNEL | __GFP_DMA32); in omap_dmm_probe()
862 if (!omap_dmm->dummy_page) { in omap_dmm_probe()
873 omap_dmm->dummy_pa = page_to_phys(omap_dmm->dummy_page); in omap_dmm_probe()
876 omap_dmm->refill_va = dma_alloc_wc(&dev->dev, in omap_dmm_probe()
877 REFILL_BUFFER_SIZE * omap_dmm->num_engines, in omap_dmm_probe()
878 &omap_dmm->refill_pa, GFP_KERNEL); in omap_dmm_probe()
879 if (!omap_dmm->refill_va) { in omap_dmm_probe()
886 omap_dmm->engines = kcalloc(omap_dmm->num_engines, in omap_dmm_probe()
887 sizeof(*omap_dmm->engines), GFP_KERNEL); in omap_dmm_probe()
888 if (!omap_dmm->engines) { in omap_dmm_probe()
893 for (i = 0; i < omap_dmm->num_engines; i++) { in omap_dmm_probe()
894 omap_dmm->engines[i].id = i; in omap_dmm_probe()
895 omap_dmm->engines[i].dmm = omap_dmm; in omap_dmm_probe()
896 omap_dmm->engines[i].refill_va = omap_dmm->refill_va + in omap_dmm_probe()
898 omap_dmm->engines[i].refill_pa = omap_dmm->refill_pa + in omap_dmm_probe()
900 init_completion(&omap_dmm->engines[i].compl); in omap_dmm_probe()
902 list_add(&omap_dmm->engines[i].idle_node, &omap_dmm->idle_head); in omap_dmm_probe()
905 omap_dmm->tcm = kcalloc(omap_dmm->num_lut, sizeof(*omap_dmm->tcm), in omap_dmm_probe()
907 if (!omap_dmm->tcm) { in omap_dmm_probe()
916 for (i = 0; i < omap_dmm->num_lut; i++) { in omap_dmm_probe()
917 omap_dmm->tcm[i] = sita_init(omap_dmm->container_width, in omap_dmm_probe()
918 omap_dmm->container_height); in omap_dmm_probe()
920 if (!omap_dmm->tcm[i]) { in omap_dmm_probe()
926 omap_dmm->tcm[i]->lut_id = i; in omap_dmm_probe()
932 containers[TILFMT_8BIT] = omap_dmm->tcm[0]; in omap_dmm_probe()
933 containers[TILFMT_16BIT] = omap_dmm->tcm[0]; in omap_dmm_probe()
934 containers[TILFMT_32BIT] = omap_dmm->tcm[0]; in omap_dmm_probe()
936 if (omap_dmm->container_height != omap_dmm->lut_height) { in omap_dmm_probe()
940 containers[TILFMT_PAGE] = omap_dmm->tcm[1]; in omap_dmm_probe()
941 omap_dmm->tcm[1]->y_offset = OMAP5_LUT_OFFSET; in omap_dmm_probe()
942 omap_dmm->tcm[1]->lut_id = 0; in omap_dmm_probe()
944 containers[TILFMT_PAGE] = omap_dmm->tcm[0]; in omap_dmm_probe()
949 .p1.x = omap_dmm->container_width - 1, in omap_dmm_probe()
950 .p1.y = omap_dmm->container_height - 1, in omap_dmm_probe()
953 ret = request_irq(omap_dmm->irq, omap_dmm_irq_handler, IRQF_SHARED, in omap_dmm_probe()
954 "omap_dmm_irq_handler", omap_dmm); in omap_dmm_probe()
958 omap_dmm->irq, ret); in omap_dmm_probe()
959 omap_dmm->irq = -1; in omap_dmm_probe()
969 dmm_write(omap_dmm, 0x7e7e7e7e, DMM_PAT_IRQENABLE_SET); in omap_dmm_probe()
972 for (i = 0; i < omap_dmm->num_lut; i++) { in omap_dmm_probe()
973 area.tcm = omap_dmm->tcm[i]; in omap_dmm_probe()
975 dev_err(omap_dmm->dev, "refill failed"); in omap_dmm_probe()
978 dev_info(omap_dmm->dev, "initialized all PAT entries\n"); in omap_dmm_probe()
1079 if (!omap_dmm) { in tiler_map_show()
1084 h_adj = omap_dmm->container_height / ydiv; in tiler_map_show()
1085 w_adj = omap_dmm->container_width / xdiv; in tiler_map_show()
1093 for (lut_idx = 0; lut_idx < omap_dmm->num_lut; lut_idx++) { in tiler_map_show()
1097 for (i = 0; i < omap_dmm->container_height; i++) { in tiler_map_show()
1104 list_for_each_entry(block, &omap_dmm->alloc_head, alloc_node) { in tiler_map_show()
1105 if (block->area.tcm == omap_dmm->tcm[lut_idx]) { in tiler_map_show()
1144 dev_dbg(omap_dmm->dev, "CONTAINER %d DUMP BEGIN\n", in tiler_map_show()
1147 dev_dbg(omap_dmm->dev, "%03d:%s\n", i, map[i]); in tiler_map_show()
1148 dev_dbg(omap_dmm->dev, "CONTAINER %d DUMP END\n", in tiler_map_show()
1167 if (!omap_dmm) in omap_dmm_resume()
1172 .p1.x = omap_dmm->container_width - 1, in omap_dmm_resume()
1173 .p1.y = omap_dmm->container_height - 1, in omap_dmm_resume()
1177 for (i = 0; i < omap_dmm->num_lut; i++) { in omap_dmm_resume()
1178 area.tcm = omap_dmm->tcm[i]; in omap_dmm_resume()