H A D | c8sectpfe-core.c | 316 "Timeout waiting for idle irq on tsin%d\n", c8sectpfe_stop_feed() 425 static void free_input_block(struct c8sectpfei *fei, struct channel_info *tsin) free_input_block() argument 427 if (!fei || !tsin) free_input_block() 430 if (tsin->back_buffer_busaddr) free_input_block() 431 if (!dma_mapping_error(fei->dev, tsin->back_buffer_busaddr)) free_input_block() 432 dma_unmap_single(fei->dev, tsin->back_buffer_busaddr, free_input_block() 435 kfree(tsin->back_buffer_start); free_input_block() 437 if (tsin->pid_buffer_busaddr) free_input_block() 438 if (!dma_mapping_error(fei->dev, tsin->pid_buffer_busaddr)) free_input_block() 439 dma_unmap_single(fei->dev, tsin->pid_buffer_busaddr, free_input_block() 442 kfree(tsin->pid_buffer_start); free_input_block() 448 struct channel_info *tsin) configure_memdma_and_inputblock() 454 if (!fei || !tsin) configure_memdma_and_inputblock() 457 dev_dbg(fei->dev, "%s:%d Configuring channel=%p tsin=%d\n" configure_memdma_and_inputblock() 458 , __func__, __LINE__, tsin, tsin->tsin_id); configure_memdma_and_inputblock() 460 init_completion(&tsin->idle_completion); configure_memdma_and_inputblock() 462 tsin->back_buffer_start = kzalloc(FEI_BUFFER_SIZE + configure_memdma_and_inputblock() 465 if (!tsin->back_buffer_start) { configure_memdma_and_inputblock() 471 tsin->back_buffer_aligned = tsin->back_buffer_start configure_memdma_and_inputblock() 474 tsin->back_buffer_aligned = (void *) configure_memdma_and_inputblock() 475 (((uintptr_t) tsin->back_buffer_aligned) & ~0x1F); configure_memdma_and_inputblock() 477 tsin->back_buffer_busaddr = dma_map_single(fei->dev, configure_memdma_and_inputblock() 478 (void *)tsin->back_buffer_aligned, configure_memdma_and_inputblock() 482 if (dma_mapping_error(fei->dev, tsin->back_buffer_busaddr)) { configure_memdma_and_inputblock() 493 tsin->pid_buffer_start = kzalloc(2048, GFP_KERNEL); configure_memdma_and_inputblock() 495 if (!tsin->pid_buffer_start) { configure_memdma_and_inputblock() 507 tsin->pid_buffer_aligned = tsin->pid_buffer_start + configure_memdma_and_inputblock() 510 tsin->pid_buffer_aligned = (void *) configure_memdma_and_inputblock() 511 (((uintptr_t) tsin->pid_buffer_aligned) & ~0x3ff); configure_memdma_and_inputblock() 513 tsin->pid_buffer_busaddr = dma_map_single(fei->dev, configure_memdma_and_inputblock() 514 tsin->pid_buffer_aligned, configure_memdma_and_inputblock() 518 if (dma_mapping_error(fei->dev, tsin->pid_buffer_busaddr)) { configure_memdma_and_inputblock() 526 tsin->pid_buffer_busaddr, configure_memdma_and_inputblock() 530 snprintf(tsin_pin_name, MAX_NAME, "tsin%d-%s", tsin->tsin_id, configure_memdma_and_inputblock() 531 (tsin->serial_not_parallel ? "serial" : "parallel")); configure_memdma_and_inputblock() 533 tsin->pstate = pinctrl_lookup_state(fei->pinctrl, tsin_pin_name); configure_memdma_and_inputblock() 534 if (IS_ERR(tsin->pstate)) { configure_memdma_and_inputblock() 537 ret = PTR_ERR(tsin->pstate); configure_memdma_and_inputblock() 541 ret = pinctrl_select_state(fei->pinctrl, tsin->pstate); configure_memdma_and_inputblock() 551 tmp |= BIT(tsin->tsin_id); configure_memdma_and_inputblock() 554 if (tsin->serial_not_parallel) configure_memdma_and_inputblock() 557 if (tsin->invert_ts_clk) configure_memdma_and_inputblock() 560 if (tsin->async_not_sync) configure_memdma_and_inputblock() 565 writel(tmp, fei->io + C8SECTPFE_IB_IP_FMT_CFG(tsin->tsin_id)); configure_memdma_and_inputblock() 570 fei->io + C8SECTPFE_IB_SYNCLCKDRP_CFG(tsin->tsin_id)); configure_memdma_and_inputblock() 572 writel(TS_PKT_SIZE, fei->io + C8SECTPFE_IB_PKT_LEN(tsin->tsin_id)); configure_memdma_and_inputblock() 576 tsin->fifo = (tsin->tsin_id * FIFO_LEN); configure_memdma_and_inputblock() 578 writel(tsin->fifo, fei->io + C8SECTPFE_IB_BUFF_STRT(tsin->tsin_id)); configure_memdma_and_inputblock() 579 writel(tsin->fifo + FIFO_LEN - 1, configure_memdma_and_inputblock() 580 fei->io + C8SECTPFE_IB_BUFF_END(tsin->tsin_id)); configure_memdma_and_inputblock() 582 writel(tsin->fifo, fei->io + C8SECTPFE_IB_READ_PNT(tsin->tsin_id)); configure_memdma_and_inputblock() 583 writel(tsin->fifo, fei->io + C8SECTPFE_IB_WRT_PNT(tsin->tsin_id)); configure_memdma_and_inputblock() 585 writel(tsin->pid_buffer_busaddr, configure_memdma_and_inputblock() 586 fei->io + PIDF_BASE(tsin->tsin_id)); configure_memdma_and_inputblock() 589 tsin->tsin_id, readl(fei->io + PIDF_BASE(tsin->tsin_id)), configure_memdma_and_inputblock() 590 &tsin->pid_buffer_busaddr); configure_memdma_and_inputblock() 603 writel(tmp, fei->io + C8SECTPFE_IB_PID_SET(tsin->tsin_id)); configure_memdma_and_inputblock() 606 tsin->tsin_id, configure_memdma_and_inputblock() 607 readl(fei->io + C8SECTPFE_IB_WRT_PNT(tsin->tsin_id)), configure_memdma_and_inputblock() 608 readl(fei->io + C8SECTPFE_IB_READ_PNT(tsin->tsin_id)), configure_memdma_and_inputblock() 609 readl(fei->io + C8SECTPFE_IB_BUFF_STRT(tsin->tsin_id)), configure_memdma_and_inputblock() 610 readl(fei->io + C8SECTPFE_IB_BUFF_END(tsin->tsin_id))); configure_memdma_and_inputblock() 613 tsin->irec = fei->io + DMA_MEMDMA_OFFSET + DMA_DMEM_OFFSET + configure_memdma_and_inputblock() 619 tsin->irec += (tsin->tsin_id * DMA_PRDS_SIZE); configure_memdma_and_inputblock() 621 writel(tsin->fifo, tsin->irec + DMA_PRDS_MEMBASE); configure_memdma_and_inputblock() 623 writel(tsin->fifo + FIFO_LEN - 1, tsin->irec + DMA_PRDS_MEMTOP); configure_memdma_and_inputblock() 625 writel((188 + 7)&~7, tsin->irec + DMA_PRDS_PKTSIZE); configure_memdma_and_inputblock() 627 writel(0x1, tsin->irec + DMA_PRDS_TPENABLE); configure_memdma_and_inputblock() 631 writel(tsin->back_buffer_busaddr, tsin->irec + DMA_PRDS_BUSBASE_TP(0)); configure_memdma_and_inputblock() 633 tmp = tsin->back_buffer_busaddr + FEI_BUFFER_SIZE - 1; configure_memdma_and_inputblock() 634 writel(tmp, tsin->irec + DMA_PRDS_BUSTOP_TP(0)); configure_memdma_and_inputblock() 636 writel(tsin->back_buffer_busaddr, tsin->irec + DMA_PRDS_BUSWP_TP(0)); configure_memdma_and_inputblock() 637 writel(tsin->back_buffer_busaddr, tsin->irec + DMA_PRDS_BUSRP_TP(0)); configure_memdma_and_inputblock() 640 tasklet_init(&tsin->tsklet, channel_swdemux_tsklet, configure_memdma_and_inputblock() 641 (unsigned long) tsin); configure_memdma_and_inputblock() 646 free_input_block(fei, tsin); configure_memdma_and_inputblock() 672 struct channel_info *tsin; c8sectpfe_probe() local 751 dev_err(dev, "More tsin declared than exist on SoC!\n"); c8sectpfe_probe() 759 dev_err(dev, "Error getting tsin pins\n"); c8sectpfe_probe() 776 tsin = fei->channel_data[index]; for_each_child_of_node() 778 tsin->fei = fei; for_each_child_of_node() 780 ret = of_property_read_u32(child, "tsin-num", &tsin->tsin_id); for_each_child_of_node() 787 if (tsin->tsin_id > fei->hw_stats.num_ib) { for_each_child_of_node() 789 "tsin-num %d specified greater than number\n\t" for_each_child_of_node() 791 tsin->tsin_id, fei->hw_stats.num_ib); for_each_child_of_node() 796 tsin->invert_ts_clk = of_property_read_bool(child, for_each_child_of_node() 799 tsin->serial_not_parallel = of_property_read_bool(child, for_each_child_of_node() 802 tsin->async_not_sync = of_property_read_bool(child, for_each_child_of_node() 806 &tsin->dvb_card); for_each_child_of_node() 817 tsin->i2c_adapter = for_each_child_of_node() 819 if (!tsin->i2c_adapter) { for_each_child_of_node() 826 tsin->rst_gpio = of_get_named_gpio(child, "rst-gpio", 0); for_each_child_of_node() 828 ret = gpio_is_valid(tsin->rst_gpio); for_each_child_of_node() 831 "reset gpio for tsin%d not valid (gpio=%d)\n", for_each_child_of_node() 832 tsin->tsin_id, tsin->rst_gpio); for_each_child_of_node() 836 ret = devm_gpio_request_one(dev, tsin->rst_gpio, for_each_child_of_node() 839 dev_err(dev, "Can't request tsin%d reset gpio\n" for_each_child_of_node() 846 gpio_direction_output(tsin->rst_gpio, 0); for_each_child_of_node() 848 gpio_direction_output(tsin->rst_gpio, 1); for_each_child_of_node() 852 tsin->demux_mapping = index; for_each_child_of_node() 858 tsin->tsin_id, tsin->invert_ts_clk, for_each_child_of_node() 859 tsin->serial_not_parallel, tsin->async_not_sync, for_each_child_of_node() 860 tsin->dvb_card); for_each_child_of_node() 944 struct channel_info *tsin; configure_channels() local 947 /* iterate round each tsin and configure memdma descriptor and IB hw */ for_each_child_of_node() 950 tsin = fei->channel_data[index]; for_each_child_of_node() 967 tsin = fei->channel_data[index]; 968 free_input_block(fei, tsin); 447 configure_memdma_and_inputblock(struct c8sectpfei *fei, struct channel_info *tsin) configure_memdma_and_inputblock() argument
|