Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

soc/tegra: fuse: Add tegra_acpi_init_apbmisc()

In preparation to ACPI support in Tegra fuse driver add function
tegra_acpi_init_apbmisc() to initialize tegra-apbmisc driver.
Also, document the reason of calling tegra_init_apbmisc() at early init.

Note that function tegra_acpi_init_apbmisc() is not placed in the __init
section, because it will be called during probe.

Signed-off-by: Kartik <kkartik@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>

authored by

Kartik and committed by
Thierry Reding
7b0c505e f0139d66

+73
+1
drivers/soc/tegra/fuse/fuse.h
··· 69 69 70 70 void tegra_init_revision(void); 71 71 void tegra_init_apbmisc(void); 72 + void tegra_acpi_init_apbmisc(void); 72 73 73 74 u32 __init tegra_fuse_read_spare(unsigned int spare); 74 75 u32 __init tegra_fuse_read_early(unsigned int offset);
+72
drivers/soc/tegra/fuse/tegra-apbmisc.c
··· 3 3 * Copyright (c) 2014-2023, NVIDIA CORPORATION. All rights reserved. 4 4 */ 5 5 6 + #include <linux/acpi.h> 6 7 #include <linux/export.h> 7 8 #include <linux/io.h> 8 9 #include <linux/kernel.h> 10 + #include <linux/mod_devicetable.h> 9 11 #include <linux/of.h> 10 12 #include <linux/of_address.h> 11 13 ··· 182 180 } 183 181 } 184 182 183 + /** 184 + * tegra_init_apbmisc - Initializes Tegra APBMISC and Strapping registers. 185 + * 186 + * This is called during early init as some of the old 32-bit ARM code needs 187 + * information from the APBMISC registers very early during boot. 188 + */ 185 189 void __init tegra_init_apbmisc(void) 186 190 { 187 191 struct resource apbmisc, straps; ··· 252 244 put: 253 245 of_node_put(np); 254 246 } 247 + 248 + #ifdef CONFIG_ACPI 249 + static const struct acpi_device_id apbmisc_acpi_match[] = { 250 + { "NVDA2010" }, 251 + { /* sentinel */ } 252 + }; 253 + 254 + void tegra_acpi_init_apbmisc(void) 255 + { 256 + struct resource *resources[2] = { NULL }; 257 + struct resource_entry *rentry; 258 + struct acpi_device *adev = NULL; 259 + struct list_head resource_list; 260 + int rcount = 0; 261 + int ret; 262 + 263 + adev = acpi_dev_get_first_match_dev(apbmisc_acpi_match[0].id, NULL, -1); 264 + if (!adev) 265 + return; 266 + 267 + INIT_LIST_HEAD(&resource_list); 268 + 269 + ret = acpi_dev_get_memory_resources(adev, &resource_list); 270 + if (ret < 0) { 271 + pr_err("failed to get APBMISC memory resources"); 272 + goto out_put_acpi_dev; 273 + } 274 + 275 + /* 276 + * Get required memory resources. 277 + * 278 + * resources[0]: apbmisc. 279 + * resources[1]: straps. 280 + */ 281 + resource_list_for_each_entry(rentry, &resource_list) { 282 + if (rcount >= ARRAY_SIZE(resources)) 283 + break; 284 + 285 + resources[rcount++] = rentry->res; 286 + } 287 + 288 + if (!resources[0]) { 289 + pr_err("failed to get APBMISC registers\n"); 290 + goto out_free_resource_list; 291 + } 292 + 293 + if (!resources[1]) { 294 + pr_err("failed to get strapping options registers\n"); 295 + goto out_free_resource_list; 296 + } 297 + 298 + tegra_init_apbmisc_resources(resources[0], resources[1]); 299 + 300 + out_free_resource_list: 301 + acpi_dev_free_resource_list(&resource_list); 302 + 303 + out_put_acpi_dev: 304 + acpi_dev_put(adev); 305 + } 306 + #else 307 + void tegra_acpi_init_apbmisc(void) 308 + { 309 + } 310 + #endif