Lines Matching refs:fuse
30 static u32 tegra20_fuse_read_early(struct tegra_fuse *fuse, unsigned int offset) in tegra20_fuse_read_early() argument
32 return readl_relaxed(fuse->base + FUSE_BEGIN + offset); in tegra20_fuse_read_early()
37 struct tegra_fuse *fuse = args; in apb_dma_complete() local
39 complete(&fuse->apbdma.wait); in apb_dma_complete()
42 static u32 tegra20_fuse_read(struct tegra_fuse *fuse, unsigned int offset) in tegra20_fuse_read() argument
50 err = pm_runtime_resume_and_get(fuse->dev); in tegra20_fuse_read()
54 mutex_lock(&fuse->apbdma.lock); in tegra20_fuse_read()
56 fuse->apbdma.config.src_addr = fuse->phys + FUSE_BEGIN + offset; in tegra20_fuse_read()
58 err = dmaengine_slave_config(fuse->apbdma.chan, &fuse->apbdma.config); in tegra20_fuse_read()
62 dma_desc = dmaengine_prep_slave_single(fuse->apbdma.chan, in tegra20_fuse_read()
63 fuse->apbdma.phys, in tegra20_fuse_read()
70 dma_desc->callback_param = fuse; in tegra20_fuse_read()
72 reinit_completion(&fuse->apbdma.wait); in tegra20_fuse_read()
75 dma_async_issue_pending(fuse->apbdma.chan); in tegra20_fuse_read()
76 time_left = wait_for_completion_timeout(&fuse->apbdma.wait, in tegra20_fuse_read()
80 dmaengine_terminate_all(fuse->apbdma.chan); in tegra20_fuse_read()
82 value = *fuse->apbdma.virt; in tegra20_fuse_read()
85 mutex_unlock(&fuse->apbdma.lock); in tegra20_fuse_read()
86 pm_runtime_put(fuse->dev); in tegra20_fuse_read()
99 struct tegra_fuse *fuse = data; in tegra20_fuse_release_channel() local
101 dma_release_channel(fuse->apbdma.chan); in tegra20_fuse_release_channel()
102 fuse->apbdma.chan = NULL; in tegra20_fuse_release_channel()
107 struct tegra_fuse *fuse = data; in tegra20_fuse_free_coherent() local
109 dma_free_coherent(fuse->dev, sizeof(u32), fuse->apbdma.virt, in tegra20_fuse_free_coherent()
110 fuse->apbdma.phys); in tegra20_fuse_free_coherent()
111 fuse->apbdma.virt = NULL; in tegra20_fuse_free_coherent()
112 fuse->apbdma.phys = 0x0; in tegra20_fuse_free_coherent()
115 static int tegra20_fuse_probe(struct tegra_fuse *fuse) in tegra20_fuse_probe() argument
123 fuse->apbdma.chan = dma_request_channel(mask, dma_filter, NULL); in tegra20_fuse_probe()
124 if (!fuse->apbdma.chan) in tegra20_fuse_probe()
127 err = devm_add_action_or_reset(fuse->dev, tegra20_fuse_release_channel, in tegra20_fuse_probe()
128 fuse); in tegra20_fuse_probe()
132 fuse->apbdma.virt = dma_alloc_coherent(fuse->dev, sizeof(u32), in tegra20_fuse_probe()
133 &fuse->apbdma.phys, in tegra20_fuse_probe()
135 if (!fuse->apbdma.virt) in tegra20_fuse_probe()
138 err = devm_add_action_or_reset(fuse->dev, tegra20_fuse_free_coherent, in tegra20_fuse_probe()
139 fuse); in tegra20_fuse_probe()
143 fuse->apbdma.config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; in tegra20_fuse_probe()
144 fuse->apbdma.config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; in tegra20_fuse_probe()
145 fuse->apbdma.config.src_maxburst = 1; in tegra20_fuse_probe()
146 fuse->apbdma.config.dst_maxburst = 1; in tegra20_fuse_probe()
147 fuse->apbdma.config.direction = DMA_DEV_TO_MEM; in tegra20_fuse_probe()
148 fuse->apbdma.config.device_fc = false; in tegra20_fuse_probe()
150 init_completion(&fuse->apbdma.wait); in tegra20_fuse_probe()
151 mutex_init(&fuse->apbdma.lock); in tegra20_fuse_probe()
152 fuse->read = tegra20_fuse_read; in tegra20_fuse_probe()
182 static void __init tegra20_fuse_init(struct tegra_fuse *fuse) in tegra20_fuse_init() argument
184 fuse->read_early = tegra20_fuse_read_early; in tegra20_fuse_init()
187 fuse->soc->speedo_init(&tegra_sku_info); in tegra20_fuse_init()