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_disable_unprepare(ahub->clk_apbif); in tegra30_ahub_runtime_suspend()
49 clk_disable_unprepare(ahub->clk_d_audio); in tegra30_ahub_runtime_suspend()
69 ret = clk_prepare_enable(ahub->clk_d_audio); in tegra30_ahub_runtime_resume()
74 ret = clk_prepare_enable(ahub->clk_apbif); in tegra30_ahub_runtime_resume()
77 clk_disable(ahub->clk_d_audio); in tegra30_ahub_runtime_resume()
81 regcache_cache_only(ahub->regmap_apbif, false); in tegra30_ahub_runtime_resume()
82 regcache_cache_only(ahub->regmap_ahub, false); in tegra30_ahub_runtime_resume()
95 channel = find_first_zero_bit(ahub->rx_usage, in tegra30_ahub_allocate_rx_fifo()
100 __set_bit(channel, ahub->rx_usage); in tegra30_ahub_allocate_rx_fifo()
104 *fiforeg = ahub->apbif_addr + TEGRA30_AHUB_CHANNEL_RXFIFO + in tegra30_ahub_allocate_rx_fifo()
107 pm_runtime_get_sync(ahub->dev); in tegra30_ahub_allocate_rx_fifo()
133 ahub->soc_data->set_audio_cif(ahub->regmap_apbif, reg, &cif_conf); in tegra30_ahub_allocate_rx_fifo()
135 pm_runtime_put(ahub->dev); in tegra30_ahub_allocate_rx_fifo()
146 pm_runtime_get_sync(ahub->dev); in tegra30_ahub_enable_rx_fifo()
154 pm_runtime_put(ahub->dev); in tegra30_ahub_enable_rx_fifo()
165 pm_runtime_get_sync(ahub->dev); in tegra30_ahub_disable_rx_fifo()
173 pm_runtime_put(ahub->dev); in tegra30_ahub_disable_rx_fifo()
183 __clear_bit(channel, ahub->rx_usage); in tegra30_ahub_free_rx_fifo()
197 channel = find_first_zero_bit(ahub->tx_usage, in tegra30_ahub_allocate_tx_fifo()
202 __set_bit(channel, ahub->tx_usage); in tegra30_ahub_allocate_tx_fifo()
206 *fiforeg = ahub->apbif_addr + TEGRA30_AHUB_CHANNEL_TXFIFO + in tegra30_ahub_allocate_tx_fifo()
209 pm_runtime_get_sync(ahub->dev); in tegra30_ahub_allocate_tx_fifo()
235 ahub->soc_data->set_audio_cif(ahub->regmap_apbif, reg, &cif_conf); in tegra30_ahub_allocate_tx_fifo()
237 pm_runtime_put(ahub->dev); in tegra30_ahub_allocate_tx_fifo()
248 pm_runtime_get_sync(ahub->dev); in tegra30_ahub_enable_tx_fifo()
256 pm_runtime_put(ahub->dev); in tegra30_ahub_enable_tx_fifo()
267 pm_runtime_get_sync(ahub->dev); in tegra30_ahub_disable_tx_fifo()
275 pm_runtime_put(ahub->dev); in tegra30_ahub_disable_tx_fifo()
285 __clear_bit(channel, ahub->tx_usage); in tegra30_ahub_free_tx_fifo()
297 pm_runtime_get_sync(ahub->dev); in tegra30_ahub_set_rx_cif_source()
303 pm_runtime_put(ahub->dev); in tegra30_ahub_set_rx_cif_source()
314 pm_runtime_get_sync(ahub->dev); in tegra30_ahub_unset_rx_cif_source()
320 pm_runtime_put(ahub->dev); in tegra30_ahub_unset_rx_cif_source()
476 .name = "ahub",
502 { .compatible = "nvidia,tegra124-ahub", .data = &soc_data_tegra124 },
503 { .compatible = "nvidia,tegra114-ahub", .data = &soc_data_tegra114 },
504 { .compatible = "nvidia,tegra30-ahub", .data = &soc_data_tegra30 },
518 if (ahub) in tegra30_ahub_probe()
527 * The AHUB hosts a register bus: the "configlink". For this to in tegra30_ahub_probe()
551 ahub = devm_kzalloc(&pdev->dev, sizeof(struct tegra30_ahub), in tegra30_ahub_probe()
553 if (!ahub) in tegra30_ahub_probe()
555 dev_set_drvdata(&pdev->dev, ahub); in tegra30_ahub_probe()
557 ahub->soc_data = soc_data; in tegra30_ahub_probe()
558 ahub->dev = &pdev->dev; in tegra30_ahub_probe()
560 ahub->clk_d_audio = devm_clk_get(&pdev->dev, "d_audio"); in tegra30_ahub_probe()
561 if (IS_ERR(ahub->clk_d_audio)) { in tegra30_ahub_probe()
562 dev_err(&pdev->dev, "Can't retrieve ahub d_audio clock\n"); in tegra30_ahub_probe()
563 ret = PTR_ERR(ahub->clk_d_audio); in tegra30_ahub_probe()
567 ahub->clk_apbif = devm_clk_get(&pdev->dev, "apbif"); in tegra30_ahub_probe()
568 if (IS_ERR(ahub->clk_apbif)) { in tegra30_ahub_probe()
569 dev_err(&pdev->dev, "Can't retrieve ahub apbif clock\n"); in tegra30_ahub_probe()
570 ret = PTR_ERR(ahub->clk_apbif); in tegra30_ahub_probe()
579 ahub->apbif_addr = res0->start; in tegra30_ahub_probe()
581 ahub->regmap_apbif = devm_regmap_init_mmio(&pdev->dev, regs_apbif, in tegra30_ahub_probe()
583 if (IS_ERR(ahub->regmap_apbif)) { in tegra30_ahub_probe()
585 ret = PTR_ERR(ahub->regmap_apbif); in tegra30_ahub_probe()
588 regcache_cache_only(ahub->regmap_apbif, true); in tegra30_ahub_probe()
594 ahub->regmap_ahub = devm_regmap_init_mmio(&pdev->dev, regs_ahub, in tegra30_ahub_probe()
596 if (IS_ERR(ahub->regmap_ahub)) { in tegra30_ahub_probe()
597 dev_err(&pdev->dev, "ahub regmap init failed\n"); in tegra30_ahub_probe()
598 ret = PTR_ERR(ahub->regmap_ahub); in tegra30_ahub_probe()
601 regcache_cache_only(ahub->regmap_ahub, true); in tegra30_ahub_probe()
622 if (!ahub) in tegra30_ahub_remove()
635 regcache_mark_dirty(ahub->regmap_ahub); in tegra30_ahub_suspend()
636 regcache_mark_dirty(ahub->regmap_apbif); in tegra30_ahub_suspend()
650 ret = regcache_sync(ahub->regmap_ahub); in tegra30_ahub_resume()
651 ret |= regcache_sync(ahub->regmap_apbif); in tegra30_ahub_resume()
740 MODULE_DESCRIPTION("Tegra30 AHUB driver");