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.

ACPI: GTDT: Generate platform devices for MMIO timers

In preparation for the MMIO timer support code becoming an actual
driver, mimic what is done for the SBSA watchdog and expose
a synthetic device for each MMIO timer block.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Tested-by: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Link: https://lore.kernel.org/r/20250807160243.1970533-2-maz@kernel.org

authored by

Marc Zyngier and committed by
Daniel Lezcano
5669d92f bee33f22

+25 -4
+25 -4
drivers/acpi/arm64/gtdt.c
··· 388 388 return 0; 389 389 } 390 390 391 - static int __init gtdt_sbsa_gwdt_init(void) 391 + static int __init gtdt_platform_timer_init(void) 392 392 { 393 393 void *platform_timer; 394 394 struct acpi_table_header *table; 395 - int ret, timer_count, gwdt_count = 0; 395 + int ret, timer_count, gwdt_count = 0, mmio_timer_count = 0; 396 396 397 397 if (acpi_disabled) 398 398 return 0; ··· 414 414 goto out_put_gtdt; 415 415 416 416 for_each_platform_timer(platform_timer) { 417 + ret = 0; 418 + 417 419 if (is_non_secure_watchdog(platform_timer)) { 418 420 ret = gtdt_import_sbsa_gwdt(platform_timer, gwdt_count); 419 421 if (ret) 420 - break; 422 + continue; 421 423 gwdt_count++; 424 + } else if (is_timer_block(platform_timer)) { 425 + struct arch_timer_mem atm = {}; 426 + struct platform_device *pdev; 427 + 428 + ret = gtdt_parse_timer_block(platform_timer, &atm); 429 + if (ret) 430 + continue; 431 + 432 + pdev = platform_device_register_data(NULL, "gtdt-arm-mmio-timer", 433 + gwdt_count, &atm, 434 + sizeof(atm)); 435 + if (IS_ERR(pdev)) { 436 + pr_err("Can't register timer %d\n", gwdt_count); 437 + continue; 438 + } 439 + 440 + mmio_timer_count++; 422 441 } 423 442 } 424 443 425 444 if (gwdt_count) 426 445 pr_info("found %d SBSA generic Watchdog(s).\n", gwdt_count); 446 + if (mmio_timer_count) 447 + pr_info("found %d Generic MMIO timer(s).\n", mmio_timer_count); 427 448 428 449 out_put_gtdt: 429 450 acpi_put_table(table); 430 451 return ret; 431 452 } 432 453 433 - device_initcall(gtdt_sbsa_gwdt_init); 454 + device_initcall(gtdt_platform_timer_init);