From b7a940d9823dbf43bd250096e4a88542dccdeb9a Mon Sep 17 00:00:00 2001 From: jmcneill Date: Fri, 2 Jun 2017 00:09:56 +0000 Subject: [PATCH] Attach Tegra124 DVFS to /cpus/cpu0 now that another driver is claiming the /cpus node. --- sys/arch/arm/nvidia/files.tegra | 4 ++-- sys/arch/arm/nvidia/tegra124_cpu.c | 20 +++++++++++--------- sys/arch/evbarm/conf/TEGRA | 4 ++-- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/sys/arch/arm/nvidia/files.tegra b/sys/arch/arm/nvidia/files.tegra index 403c0aeedeb7..9e9f34706ba9 100644 --- a/sys/arch/arm/nvidia/files.tegra +++ b/sys/arch/arm/nvidia/files.tegra @@ -1,4 +1,4 @@ -# $NetBSD: files.tegra,v 1.39 2017/05/30 22:55:26 jmcneill Exp $ +# $NetBSD: files.tegra,v 1.40 2017/06/02 00:09:56 jmcneill Exp $ # # Configuration info for NVIDIA Tegra ARM Peripherals # @@ -21,7 +21,7 @@ file arch/arm/nvidia/tegra_cpufreq.c # Tegra T124 (32-bit K1) support file arch/arm/nvidia/soc_tegra124.c soc_tegra124 device tegra124cpu -attach tegra124cpu at fdt with tegra124_cpu +attach tegra124cpu at cpu with tegra124_cpu file arch/arm/nvidia/tegra124_cpu.c tegra124_cpu # Tegra T210 (X1) support diff --git a/sys/arch/arm/nvidia/tegra124_cpu.c b/sys/arch/arm/nvidia/tegra124_cpu.c index de6e2f83e7ab..ffc2ff2ec10d 100644 --- a/sys/arch/arm/nvidia/tegra124_cpu.c +++ b/sys/arch/arm/nvidia/tegra124_cpu.c @@ -1,4 +1,4 @@ -/* $NetBSD: tegra124_cpu.c,v 1.3 2017/04/29 23:00:42 jmcneill Exp $ */ +/* $NetBSD: tegra124_cpu.c,v 1.4 2017/06/02 00:09:56 jmcneill Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -30,7 +30,7 @@ #include "opt_multiprocessor.h" #include -__KERNEL_RCSID(0, "$NetBSD: tegra124_cpu.c,v 1.3 2017/04/29 23:00:42 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tegra124_cpu.c,v 1.4 2017/06/02 00:09:56 jmcneill Exp $"); #include #include @@ -70,7 +70,7 @@ static size_t tegra124_cpufreq_get_available(u_int *, size_t); static int tegra124_cpu_match(device_t, cfdata_t, void *); static void tegra124_cpu_attach(device_t, device_t, void *); -static void tegra124_cpu_init_cpufreq(device_t); +static int tegra124_cpu_init_cpufreq(device_t); CFATTACH_DECL_NEW(tegra124_cpu, 0, tegra124_cpu_match, tegra124_cpu_attach, NULL, NULL); @@ -125,7 +125,7 @@ tegra124_cpu_match(device_t parent, cfdata_t cf, void *aux) const char * const compatible[] = { "nvidia,tegra124", NULL }; struct fdt_attach_args *faa = aux; - if (OF_finddevice("/cpus") != faa->faa_phandle) + if (OF_finddevice("/cpus/cpu@0") != faa->faa_phandle) return 0; return of_match_compatible(OF_finddevice("/"), compatible); @@ -135,12 +135,12 @@ static void tegra124_cpu_attach(device_t parent, device_t self, void *aux) { aprint_naive("\n"); - aprint_normal(": CPU complex\n"); + aprint_normal(": DVFS\n"); - config_defer(self, tegra124_cpu_init_cpufreq); + config_finalize_register(self, tegra124_cpu_init_cpufreq); } -static void +static int tegra124_cpu_init_cpufreq(device_t dev) { tegra124_speedo_init(); @@ -153,14 +153,16 @@ tegra124_cpu_init_cpufreq(device_t dev) } if (tegra124_clk_pllx == NULL) { aprint_error_dev(dev, "couldn't find clock pll_x\n"); - return; + return 0; } if (tegra124_reg_vddcpu == NULL) { aprint_error_dev(dev, "couldn't find voltage regulator\n"); - return; + return 0; } tegra_cpufreq_register(&tegra124_cpufreq_func); + + return 0; } static void diff --git a/sys/arch/evbarm/conf/TEGRA b/sys/arch/evbarm/conf/TEGRA index 8a0b3b409773..17464c99dfed 100644 --- a/sys/arch/evbarm/conf/TEGRA +++ b/sys/arch/evbarm/conf/TEGRA @@ -1,5 +1,5 @@ # -# $NetBSD: TEGRA,v 1.22 2017/05/29 23:22:00 jmcneill Exp $ +# $NetBSD: TEGRA,v 1.23 2017/06/02 00:09:56 jmcneill Exp $ # # NVIDIA Tegra K1 (T124) # @@ -36,7 +36,7 @@ cpus* at fdt? pass 0 cpu* at cpus? # CPU frequency scaling -tegra124cpu* at fdt? +tegra124cpu* at cpu? fclock* at fdt? pass 4 fregulator* at fdt? pass 4