drivers/soc/tegra/fuse/tegra-apbmisc.c

Source file repositories/reference/linux-study-clean/drivers/soc/tegra/fuse/tegra-apbmisc.c

File Facts

System
Linux kernel
Corpus path
drivers/soc/tegra/fuse/tegra-apbmisc.c
Extension
.c
Size
8297 bytes
Lines
353
Domain
Driver Families
Bucket
drivers/soc
Inferred role
Driver Families: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (IS_ENABLED(CONFIG_ARM) && soc_is_tegra()) {
			/* APBMISC registers (chip revision, ...) */
			apbmisc.start = 0x70000800;
			apbmisc.end = 0x70000863;
			apbmisc.flags = IORESOURCE_MEM;

			/* strapping options */
			if (of_machine_is_compatible("nvidia,tegra124")) {
				straps.start = 0x7000e864;
				straps.end = 0x7000e867;
			} else {
				straps.start = 0x70000008;
				straps.end = 0x7000000b;
			}

			straps.flags = IORESOURCE_MEM;

			pr_warn("Using APBMISC region %pR\n", &apbmisc);
			pr_warn("Using strapping options registers %pR\n",
				&straps);
		} else {
			/*
			 * At this point we're not running on Tegra, so play
			 * nice with multi-platform kernels.
			 */
			return;
		}
	} else {
		/*
		 * Extract information from the device tree if we've found a
		 * matching node.
		 */
		if (of_address_to_resource(np, 0, &apbmisc) < 0) {
			pr_err("failed to get APBMISC registers\n");
			goto put;
		}

		if (of_address_to_resource(np, 1, &straps) < 0) {
			pr_err("failed to get strapping options registers\n");
			goto put;
		}
	}

	tegra_init_apbmisc_resources(&apbmisc, &straps);
	long_ram_code = of_property_read_bool(np, "nvidia,long-ram-code");

put:
	of_node_put(np);
}

#ifdef CONFIG_ACPI
static const struct acpi_device_id apbmisc_acpi_match[] = {
	{ "NVDA2010" },
	{ /* sentinel */ }
};

void tegra_acpi_init_apbmisc(void)
{
	struct resource *resources[2] = { NULL };
	struct resource_entry *rentry;
	struct acpi_device *adev = NULL;
	struct list_head resource_list;
	int rcount = 0;
	int ret;

	adev = acpi_dev_get_first_match_dev(apbmisc_acpi_match[0].id, NULL, -1);
	if (!adev)
		return;

	INIT_LIST_HEAD(&resource_list);

	ret = acpi_dev_get_memory_resources(adev, &resource_list);
	if (ret < 0) {
		pr_err("failed to get APBMISC memory resources");
		goto out_put_acpi_dev;
	}

	/*
	 * Get required memory resources.
	 *
	 * resources[0]: apbmisc.
	 * resources[1]: straps.
	 */
	resource_list_for_each_entry(rentry, &resource_list) {
		if (rcount >= ARRAY_SIZE(resources))
			break;

		resources[rcount++] = rentry->res;
	}

Annotation

Implementation Notes