Lines Matching full:ahub

3  * tegra30_ahub.c - Tegra30 AHUB driver
21 #define DRV_NAME "tegra30-ahub"
23 static struct tegra30_ahub *ahub; variable
27 regmap_write(ahub->regmap_apbif, reg, val); in tegra30_apbif_write()
34 regmap_read(ahub->regmap_apbif, reg, &val); in tegra30_apbif_read()
40 regmap_write(ahub->regmap_ahub, reg, val); in tegra30_audio_write()
45 regcache_cache_only(ahub->regmap_apbif, true); in tegra30_ahub_runtime_suspend()
46 regcache_cache_only(ahub->regmap_ahub, true); in tegra30_ahub_runtime_suspend()
48 clk_bulk_disable_unprepare(ahub->nclocks, ahub->clocks); in tegra30_ahub_runtime_suspend()
68 ret = reset_control_bulk_assert(ahub->nresets, ahub->resets); in tegra30_ahub_runtime_resume()
72 ret = clk_bulk_prepare_enable(ahub->nclocks, ahub->clocks); in tegra30_ahub_runtime_resume()
78 ret = reset_control_bulk_deassert(ahub->nresets, ahub->resets); in tegra30_ahub_runtime_resume()
82 regcache_cache_only(ahub->regmap_apbif, false); in tegra30_ahub_runtime_resume()
83 regcache_cache_only(ahub->regmap_ahub, false); in tegra30_ahub_runtime_resume()
84 regcache_mark_dirty(ahub->regmap_apbif); in tegra30_ahub_runtime_resume()
85 regcache_mark_dirty(ahub->regmap_ahub); in tegra30_ahub_runtime_resume()
87 ret = regcache_sync(ahub->regmap_apbif); in tegra30_ahub_runtime_resume()
91 ret = regcache_sync(ahub->regmap_ahub); in tegra30_ahub_runtime_resume()
98 clk_bulk_disable_unprepare(ahub->nclocks, ahub->clocks); in tegra30_ahub_runtime_resume()
111 channel = find_first_zero_bit(ahub->rx_usage, in tegra30_ahub_allocate_rx_fifo()
116 __set_bit(channel, ahub->rx_usage); in tegra30_ahub_allocate_rx_fifo()
120 *fiforeg = ahub->apbif_addr + TEGRA30_AHUB_CHANNEL_RXFIFO + in tegra30_ahub_allocate_rx_fifo()
123 pm_runtime_get_sync(ahub->dev); in tegra30_ahub_allocate_rx_fifo()
149 ahub->soc_data->set_audio_cif(ahub->regmap_apbif, reg, &cif_conf); in tegra30_ahub_allocate_rx_fifo()
151 pm_runtime_put(ahub->dev); in tegra30_ahub_allocate_rx_fifo()
162 pm_runtime_get_sync(ahub->dev); in tegra30_ahub_enable_rx_fifo()
170 pm_runtime_put(ahub->dev); in tegra30_ahub_enable_rx_fifo()
181 pm_runtime_get_sync(ahub->dev); in tegra30_ahub_disable_rx_fifo()
189 pm_runtime_put(ahub->dev); in tegra30_ahub_disable_rx_fifo()
199 __clear_bit(channel, ahub->rx_usage); in tegra30_ahub_free_rx_fifo()
213 channel = find_first_zero_bit(ahub->tx_usage, in tegra30_ahub_allocate_tx_fifo()
218 __set_bit(channel, ahub->tx_usage); in tegra30_ahub_allocate_tx_fifo()
222 *fiforeg = ahub->apbif_addr + TEGRA30_AHUB_CHANNEL_TXFIFO + in tegra30_ahub_allocate_tx_fifo()
225 pm_runtime_get_sync(ahub->dev); in tegra30_ahub_allocate_tx_fifo()
251 ahub->soc_data->set_audio_cif(ahub->regmap_apbif, reg, &cif_conf); in tegra30_ahub_allocate_tx_fifo()
253 pm_runtime_put(ahub->dev); in tegra30_ahub_allocate_tx_fifo()
264 pm_runtime_get_sync(ahub->dev); in tegra30_ahub_enable_tx_fifo()
272 pm_runtime_put(ahub->dev); in tegra30_ahub_enable_tx_fifo()
283 pm_runtime_get_sync(ahub->dev); in tegra30_ahub_disable_tx_fifo()
291 pm_runtime_put(ahub->dev); in tegra30_ahub_disable_tx_fifo()
301 __clear_bit(channel, ahub->tx_usage); in tegra30_ahub_free_tx_fifo()
313 pm_runtime_get_sync(ahub->dev); in tegra30_ahub_set_rx_cif_source()
319 pm_runtime_put(ahub->dev); in tegra30_ahub_set_rx_cif_source()
330 pm_runtime_get_sync(ahub->dev); in tegra30_ahub_unset_rx_cif_source()
336 pm_runtime_put(ahub->dev); in tegra30_ahub_unset_rx_cif_source()
481 .name = "ahub",
507 { .compatible = "nvidia,tegra124-ahub", .data = &soc_data_tegra124 },
508 { .compatible = "nvidia,tegra114-ahub", .data = &soc_data_tegra114 },
509 { .compatible = "nvidia,tegra30-ahub", .data = &soc_data_tegra30 },
524 ahub = devm_kzalloc(&pdev->dev, sizeof(struct tegra30_ahub), in tegra30_ahub_probe()
526 if (!ahub) in tegra30_ahub_probe()
528 dev_set_drvdata(&pdev->dev, ahub); in tegra30_ahub_probe()
530 BUILD_BUG_ON(sizeof(ahub->resets) != sizeof(tegra30_ahub_resets_data)); in tegra30_ahub_probe()
531 memcpy(ahub->resets, tegra30_ahub_resets_data, sizeof(ahub->resets)); in tegra30_ahub_probe()
533 ahub->nresets = soc_data->num_resets; in tegra30_ahub_probe()
534 ahub->soc_data = soc_data; in tegra30_ahub_probe()
535 ahub->dev = &pdev->dev; in tegra30_ahub_probe()
537 ahub->clocks[ahub->nclocks++].id = "apbif"; in tegra30_ahub_probe()
538 ahub->clocks[ahub->nclocks++].id = "d_audio"; in tegra30_ahub_probe()
540 ret = devm_clk_bulk_get(&pdev->dev, ahub->nclocks, ahub->clocks); in tegra30_ahub_probe()
544 ret = devm_reset_control_bulk_get_exclusive(&pdev->dev, ahub->nresets, in tegra30_ahub_probe()
545 ahub->resets); in tegra30_ahub_probe()
557 ahub->apbif_addr = res0->start; in tegra30_ahub_probe()
559 ahub->regmap_apbif = devm_regmap_init_mmio(&pdev->dev, regs_apbif, in tegra30_ahub_probe()
561 if (IS_ERR(ahub->regmap_apbif)) { in tegra30_ahub_probe()
563 ret = PTR_ERR(ahub->regmap_apbif); in tegra30_ahub_probe()
566 regcache_cache_only(ahub->regmap_apbif, true); in tegra30_ahub_probe()
574 ahub->regmap_ahub = devm_regmap_init_mmio(&pdev->dev, regs_ahub, in tegra30_ahub_probe()
576 if (IS_ERR(ahub->regmap_ahub)) { in tegra30_ahub_probe()
577 dev_err(&pdev->dev, "ahub regmap init failed\n"); in tegra30_ahub_probe()
578 ret = PTR_ERR(ahub->regmap_ahub); in tegra30_ahub_probe()
581 regcache_cache_only(ahub->regmap_ahub, true); in tegra30_ahub_probe()
590 ahub = NULL; in tegra30_ahub_probe()
599 ahub = NULL; in tegra30_ahub_remove()
685 MODULE_DESCRIPTION("Tegra30 AHUB driver");