Lines Matching +full:tegra20 +full:- +full:car

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2013-2022, NVIDIA CORPORATION. All rights reserved.
11 #include <linux/nvmem-consumer.h>
12 #include <linux/nvmem-provider.h>
39 { .compatible = "nvidia,tegra20-car", },
40 { .compatible = "nvidia,tegra30-car", },
41 { .compatible = "nvidia,tegra114-car", },
42 { .compatible = "nvidia,tegra124-car", },
43 { .compatible = "nvidia,tegra132-car", },
44 { .compatible = "nvidia,tegra210-car", },
55 { .compatible = "nvidia,tegra234-efuse", .data = &tegra234_fuse_soc },
58 { .compatible = "nvidia,tegra194-efuse", .data = &tegra194_fuse_soc },
61 { .compatible = "nvidia,tegra186-efuse", .data = &tegra186_fuse_soc },
64 { .compatible = "nvidia,tegra210-efuse", .data = &tegra210_fuse_soc },
67 { .compatible = "nvidia,tegra132-efuse", .data = &tegra124_fuse_soc },
70 { .compatible = "nvidia,tegra124-efuse", .data = &tegra124_fuse_soc },
73 { .compatible = "nvidia,tegra114-efuse", .data = &tegra114_fuse_soc },
76 { .compatible = "nvidia,tegra30-efuse", .data = &tegra30_fuse_soc },
79 { .compatible = "nvidia,tegra20-efuse", .data = &tegra20_fuse_soc },
92 buffer[i] = fuse->read(fuse, offset + i * 4); in tegra_fuse_read()
99 .name = "tsensor-cpu1",
105 .name = "tsensor-cpu2",
111 .name = "tsensor-cpu0",
117 .name = "xusb-pad-calibration",
123 .name = "tsensor-cpu3",
129 .name = "sata-calibration",
135 .name = "tsensor-gpu",
141 .name = "tsensor-mem0",
147 .name = "tsensor-mem1",
153 .name = "tsensor-pllx",
159 .name = "tsensor-common",
165 .name = "gpu-gcplex-config-fuse",
171 .name = "tsensor-realignment",
177 .name = "gpu-calibration",
183 .name = "xusb-pad-calibration-ext",
189 .name = "gpu-pdi0",
195 .name = "gpu-pdi1",
205 fuse->base = (void __iomem *)base; in tegra_fuse_restore()
206 fuse->clk = NULL; in tegra_fuse_restore()
211 void __iomem *base = fuse->base; in tegra_fuse_probe()
216 err = devm_add_action(&pdev->dev, tegra_fuse_restore, (void __force *)base); in tegra_fuse_probe()
222 fuse->phys = res->start; in tegra_fuse_probe()
223 fuse->base = devm_ioremap_resource(&pdev->dev, res); in tegra_fuse_probe()
224 if (IS_ERR(fuse->base)) { in tegra_fuse_probe()
225 err = PTR_ERR(fuse->base); in tegra_fuse_probe()
229 fuse->clk = devm_clk_get(&pdev->dev, "fuse"); in tegra_fuse_probe()
230 if (IS_ERR(fuse->clk)) { in tegra_fuse_probe()
231 if (PTR_ERR(fuse->clk) != -EPROBE_DEFER) in tegra_fuse_probe()
232 dev_err(&pdev->dev, "failed to get FUSE clock: %ld", in tegra_fuse_probe()
233 PTR_ERR(fuse->clk)); in tegra_fuse_probe()
235 return PTR_ERR(fuse->clk); in tegra_fuse_probe()
239 fuse->dev = &pdev->dev; in tegra_fuse_probe()
241 err = devm_pm_runtime_enable(&pdev->dev); in tegra_fuse_probe()
245 if (fuse->soc->probe) { in tegra_fuse_probe()
246 err = fuse->soc->probe(fuse); in tegra_fuse_probe()
252 nvmem.dev = &pdev->dev; in tegra_fuse_probe()
254 nvmem.id = -1; in tegra_fuse_probe()
262 nvmem.size = fuse->soc->info->size; in tegra_fuse_probe()
267 fuse->nvmem = devm_nvmem_register(&pdev->dev, &nvmem); in tegra_fuse_probe()
268 if (IS_ERR(fuse->nvmem)) { in tegra_fuse_probe()
269 err = PTR_ERR(fuse->nvmem); in tegra_fuse_probe()
270 dev_err(&pdev->dev, "failed to register NVMEM device: %d\n", in tegra_fuse_probe()
275 fuse->rst = devm_reset_control_get_optional(&pdev->dev, "fuse"); in tegra_fuse_probe()
276 if (IS_ERR(fuse->rst)) { in tegra_fuse_probe()
277 err = PTR_ERR(fuse->rst); in tegra_fuse_probe()
278 dev_err(&pdev->dev, "failed to get FUSE reset: %pe\n", in tegra_fuse_probe()
279 fuse->rst); in tegra_fuse_probe()
287 err = pm_runtime_resume_and_get(&pdev->dev); in tegra_fuse_probe()
291 err = reset_control_reset(fuse->rst); in tegra_fuse_probe()
292 pm_runtime_put(&pdev->dev); in tegra_fuse_probe()
295 dev_err(&pdev->dev, "failed to reset FUSE: %d\n", err); in tegra_fuse_probe()
309 err = clk_prepare_enable(fuse->clk); in tegra_fuse_runtime_resume()
320 clk_disable_unprepare(fuse->clk); in tegra_fuse_runtime_suspend()
330 * Critical for RAM re-repair operation, which must occur on resume in tegra_fuse_suspend()
333 if (fuse->soc->clk_suspend_on) in tegra_fuse_suspend()
345 if (fuse->soc->clk_suspend_on) in tegra_fuse_resume()
361 .name = "tegra-fuse",
372 unsigned int offset = fuse->soc->info->spare + spare * 4; in tegra_fuse_read_spare()
374 return fuse->read_early(fuse, offset) & 1; in tegra_fuse_read_spare()
379 return fuse->read_early(fuse, offset); in tegra_fuse_read_early()
384 if (!fuse->read || !fuse->clk) in tegra_fuse_readl()
385 return -EPROBE_DEFER; in tegra_fuse_readl()
387 if (IS_ERR(fuse->clk)) in tegra_fuse_readl()
388 return PTR_ERR(fuse->clk); in tegra_fuse_readl()
390 *value = fuse->read(fuse, offset); in tegra_fuse_readl()
447 * platform type is silicon and all other non-zero values indicate in platform_show()
476 attr->family = kasprintf(GFP_KERNEL, "Tegra"); in tegra_soc_device_register()
477 attr->revision = kasprintf(GFP_KERNEL, "%s", in tegra_soc_device_register()
479 attr->soc_id = kasprintf(GFP_KERNEL, "%u", tegra_get_chip_id()); in tegra_soc_device_register()
480 attr->custom_attr_group = fuse->soc->soc_attr_group; in tegra_soc_device_register()
484 kfree(attr->soc_id); in tegra_soc_device_register()
485 kfree(attr->revision); in tegra_soc_device_register()
486 kfree(attr->family); in tegra_soc_device_register()
505 * Fall back to legacy initialization for 32-bit ARM only. All in tegra_init_fuse()
506 * 64-bit ARM device tree files for Tegra are required to have in tegra_init_fuse()
509 * This is for backwards-compatibility with old device trees in tegra_init_fuse()
521 case TEGRA20: in tegra_init_fuse()
522 fuse->soc = &tegra20_fuse_soc; in tegra_init_fuse()
528 fuse->soc = &tegra30_fuse_soc; in tegra_init_fuse()
534 fuse->soc = &tegra114_fuse_soc; in tegra_init_fuse()
540 fuse->soc = &tegra124_fuse_soc; in tegra_init_fuse()
551 * nice with multi-platform kernels. in tegra_init_fuse()
562 return -ENXIO; in tegra_init_fuse()
565 fuse->soc = match->data; in tegra_init_fuse()
577 return -ENXIO; in tegra_init_fuse()
581 fuse->base = ioremap(regs.start, resource_size(&regs)); in tegra_init_fuse()
582 if (!fuse->base) { in tegra_init_fuse()
584 return -ENXIO; in tegra_init_fuse()
587 fuse->soc->init(fuse); in tegra_init_fuse()
596 if (fuse->soc->lookups) { in tegra_init_fuse()
597 size_t size = sizeof(*fuse->lookups) * fuse->soc->num_lookups; in tegra_init_fuse()
599 fuse->lookups = kmemdup(fuse->soc->lookups, size, GFP_KERNEL); in tegra_init_fuse()
600 if (fuse->lookups) in tegra_init_fuse()
601 nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups); in tegra_init_fuse()