Lines Matching full:conf
77 void (*write_data)(struct altera_cvp_conf *conf,
87 void (*switch_clk)(struct altera_cvp_conf *conf);
88 int (*clear_state)(struct altera_cvp_conf *conf);
95 static int altera_read_config_byte(struct altera_cvp_conf *conf, in altera_read_config_byte() argument
98 return pci_read_config_byte(conf->pci_dev, conf->vsec_offset + where, in altera_read_config_byte()
102 static int altera_read_config_dword(struct altera_cvp_conf *conf, in altera_read_config_dword() argument
105 return pci_read_config_dword(conf->pci_dev, conf->vsec_offset + where, in altera_read_config_dword()
109 static int altera_write_config_dword(struct altera_cvp_conf *conf, in altera_write_config_dword() argument
112 return pci_write_config_dword(conf->pci_dev, conf->vsec_offset + where, in altera_write_config_dword()
118 struct altera_cvp_conf *conf = mgr->priv; in altera_cvp_state() local
121 altera_read_config_dword(conf, VSE_CVP_STATUS, &status); in altera_cvp_state()
132 static void altera_cvp_write_data_iomem(struct altera_cvp_conf *conf, u32 val) in altera_cvp_write_data_iomem() argument
134 writel(val, conf->map); in altera_cvp_write_data_iomem()
137 static void altera_cvp_write_data_config(struct altera_cvp_conf *conf, u32 val) in altera_cvp_write_data_config() argument
139 pci_write_config_dword(conf->pci_dev, conf->vsec_offset + VSE_CVP_DATA, in altera_cvp_write_data_config()
144 static void altera_cvp_dummy_write(struct altera_cvp_conf *conf) in altera_cvp_dummy_write() argument
150 altera_read_config_dword(conf, VSE_CVP_MODE_CTRL, &val); in altera_cvp_dummy_write()
153 altera_write_config_dword(conf, VSE_CVP_MODE_CTRL, val); in altera_cvp_dummy_write()
156 conf->write_data(conf, 0); /* dummy data, could be any value */ in altera_cvp_dummy_write()
159 static int altera_cvp_wait_status(struct altera_cvp_conf *conf, u32 status_mask, in altera_cvp_wait_status() argument
170 altera_read_config_dword(conf, VSE_CVP_STATUS, &val); in altera_cvp_wait_status()
183 struct altera_cvp_conf *conf = mgr->priv; in altera_cvp_chk_error() local
188 ret = altera_read_config_dword(conf, VSE_CVP_STATUS, &val); in altera_cvp_chk_error()
203 static int altera_cvp_v2_clear_state(struct altera_cvp_conf *conf) in altera_cvp_v2_clear_state() argument
209 ret = altera_read_config_dword(conf, VSE_CVP_PROG_CTRL, &val); in altera_cvp_v2_clear_state()
211 dev_err(&conf->pci_dev->dev, in altera_cvp_v2_clear_state()
217 ret = altera_write_config_dword(conf, VSE_CVP_PROG_CTRL, val); in altera_cvp_v2_clear_state()
219 dev_err(&conf->pci_dev->dev, in altera_cvp_v2_clear_state()
224 return altera_cvp_wait_status(conf, VSE_CVP_STATUS_CFG_RDY, 0, in altera_cvp_v2_clear_state()
225 conf->priv->poll_time_us); in altera_cvp_v2_clear_state()
232 struct altera_cvp_conf *conf = mgr->priv; in altera_cvp_v2_wait_for_credit() local
237 ret = altera_read_config_byte(conf, VSE_CVP_TX_CREDITS, &val); in altera_cvp_v2_wait_for_credit()
239 dev_err(&conf->pci_dev->dev, in altera_cvp_v2_wait_for_credit()
245 if (val - (u8)conf->sent_packets) in altera_cvp_v2_wait_for_credit()
250 dev_err(&conf->pci_dev->dev, in altera_cvp_v2_wait_for_credit()
252 val, conf->sent_packets); in altera_cvp_v2_wait_for_credit()
260 dev_err(&conf->pci_dev->dev, "Timeout waiting for credit\n"); in altera_cvp_v2_wait_for_credit()
264 static int altera_cvp_send_block(struct altera_cvp_conf *conf, in altera_cvp_send_block() argument
271 conf->write_data(conf, *data++); in altera_cvp_send_block()
278 conf->write_data(conf, *data & mask); in altera_cvp_send_block()
287 struct altera_cvp_conf *conf = mgr->priv; in altera_cvp_teardown() local
292 altera_read_config_dword(conf, VSE_CVP_PROG_CTRL, &val); in altera_cvp_teardown()
294 altera_write_config_dword(conf, VSE_CVP_PROG_CTRL, val); in altera_cvp_teardown()
298 altera_write_config_dword(conf, VSE_CVP_PROG_CTRL, val); in altera_cvp_teardown()
305 if (conf->priv->switch_clk) in altera_cvp_teardown()
306 conf->priv->switch_clk(conf); in altera_cvp_teardown()
309 ret = altera_cvp_wait_status(conf, VSE_CVP_STATUS_CFG_RDY, 0, in altera_cvp_teardown()
310 conf->priv->poll_time_us); in altera_cvp_teardown()
321 struct altera_cvp_conf *conf = mgr->priv; in altera_cvp_write_init() local
334 conf->numclks = 8; /* ratio for all compressed images */ in altera_cvp_write_init()
336 conf->numclks = 4; /* for uncompressed and encrypted images */ in altera_cvp_write_init()
338 conf->numclks = 1; /* for uncompressed and unencrypted images */ in altera_cvp_write_init()
341 altera_read_config_dword(conf, VSE_CVP_STATUS, &val); in altera_cvp_write_init()
359 altera_read_config_dword(conf, VSE_CVP_MODE_CTRL, &val); in altera_cvp_write_init()
361 altera_write_config_dword(conf, VSE_CVP_MODE_CTRL, val); in altera_cvp_write_init()
364 altera_read_config_dword(conf, VSE_CVP_MODE_CTRL, &val); in altera_cvp_write_init()
366 altera_write_config_dword(conf, VSE_CVP_MODE_CTRL, val); in altera_cvp_write_init()
372 if (conf->priv->switch_clk) in altera_cvp_write_init()
373 conf->priv->switch_clk(conf); in altera_cvp_write_init()
375 if (conf->priv->clear_state) { in altera_cvp_write_init()
376 ret = conf->priv->clear_state(conf); in altera_cvp_write_init()
383 conf->sent_packets = 0; in altera_cvp_write_init()
386 altera_read_config_dword(conf, VSE_CVP_PROG_CTRL, &val); in altera_cvp_write_init()
389 altera_write_config_dword(conf, VSE_CVP_PROG_CTRL, val); in altera_cvp_write_init()
392 ret = altera_cvp_wait_status(conf, VSE_CVP_STATUS_CFG_RDY, in altera_cvp_write_init()
394 conf->priv->poll_time_us); in altera_cvp_write_init()
404 if (conf->priv->switch_clk) in altera_cvp_write_init()
405 conf->priv->switch_clk(conf); in altera_cvp_write_init()
416 altera_read_config_dword(conf, VSE_CVP_PROG_CTRL, &val); in altera_cvp_write_init()
418 altera_write_config_dword(conf, VSE_CVP_PROG_CTRL, val); in altera_cvp_write_init()
421 if (conf->priv->switch_clk) { in altera_cvp_write_init()
422 altera_read_config_dword(conf, VSE_CVP_MODE_CTRL, &val); in altera_cvp_write_init()
424 val |= conf->numclks << VSE_CVP_MODE_CTRL_NUMCLKS_OFF; in altera_cvp_write_init()
425 altera_write_config_dword(conf, VSE_CVP_MODE_CTRL, val); in altera_cvp_write_init()
433 struct altera_cvp_conf *conf = mgr->priv; in altera_cvp_write() local
445 if (conf->priv->wait_credit) { in altera_cvp_write()
446 status = conf->priv->wait_credit(mgr, done); in altera_cvp_write()
448 dev_err(&conf->pci_dev->dev, in altera_cvp_write()
454 len = min(conf->priv->block_size, remaining); in altera_cvp_write()
455 altera_cvp_send_block(conf, data, len); in altera_cvp_write()
459 conf->sent_packets++; in altera_cvp_write()
486 struct altera_cvp_conf *conf = mgr->priv; in altera_cvp_write_complete() local
495 altera_read_config_dword(conf, VSE_UNCOR_ERR_STATUS, &val); in altera_cvp_write_complete()
502 altera_read_config_dword(conf, VSE_CVP_MODE_CTRL, &val); in altera_cvp_write_complete()
505 altera_write_config_dword(conf, VSE_CVP_MODE_CTRL, val); in altera_cvp_write_complete()
509 ret = altera_cvp_wait_status(conf, mask, mask, in altera_cvp_write_complete()
510 conf->priv->user_time_us); in altera_cvp_write_complete()
578 struct altera_cvp_conf *conf; in altera_cvp_probe() local
610 conf = devm_kzalloc(&pdev->dev, sizeof(*conf), GFP_KERNEL); in altera_cvp_probe()
611 if (!conf) in altera_cvp_probe()
614 conf->vsec_offset = offset; in altera_cvp_probe()
637 conf->pci_dev = pdev; in altera_cvp_probe()
638 conf->write_data = altera_cvp_write_data_iomem; in altera_cvp_probe()
640 if (conf->vsec_offset == V1_VSEC_OFFSET) in altera_cvp_probe()
641 conf->priv = &cvp_priv_v1; in altera_cvp_probe()
643 conf->priv = &cvp_priv_v2; in altera_cvp_probe()
645 conf->map = pci_iomap(pdev, CVP_BAR, 0); in altera_cvp_probe()
646 if (!conf->map) { in altera_cvp_probe()
648 conf->write_data = altera_cvp_write_data_config; in altera_cvp_probe()
651 snprintf(conf->mgr_name, sizeof(conf->mgr_name), "%s @%s", in altera_cvp_probe()
654 mgr = fpga_mgr_register(&pdev->dev, conf->mgr_name, in altera_cvp_probe()
655 &altera_cvp_ops, conf); in altera_cvp_probe()
666 if (conf->map) in altera_cvp_probe()
667 pci_iounmap(pdev, conf->map); in altera_cvp_probe()
678 struct altera_cvp_conf *conf = mgr->priv; in altera_cvp_remove() local
682 if (conf->map) in altera_cvp_remove()
683 pci_iounmap(pdev, conf->map); in altera_cvp_remove()