Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1486191ybx; Thu, 31 Oct 2019 11:16:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwec+P+2MsT4YQXjVPXyjlWKxUgM97eNWL4mNgoIvwbVEVbbkZ96QAHpHyetweZulsWwLRC X-Received: by 2002:a17:906:615:: with SMTP id s21mr5658499ejb.276.1572545812049; Thu, 31 Oct 2019 11:16:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572545812; cv=none; d=google.com; s=arc-20160816; b=vEv4NplBgNQtvkSqdYTzp1nPewW09n5GOHOP3Wux98EowK5tAWpT6BqnzVlISi2tIn d6e+8mmUlPYafrDqcNrA6TzXDkkEyrhZijEtWd0CdAT5UoTfoOSQ9IRY6gWQH0+2Xii/ hKR/uI1jgT9S2NK/yHrNLvHxFFFDPDMWkTMrxGnhzZR23IL95GZmkQtZC1IGiW9EXg/y 8T4OmC2QJo0QMVlsY0rd4p5cdDr3QsdVqmC889ujv7tYurvJrIi3+8zKJ3jQQeK4JC/O eHpUHlpOEJOS79N1xfDb18G7m4ZdQwNo3TGM1qsfKiduRw6nAKmk5RbGOy15621PZYoM YkRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=lU4j4dk0AhpONJCSnYyxxA7+J2nFBkfTtA1rDmeXEl4=; b=Mhw8g36YRkwRQIH2+O1SjrJDFYLUQ9mjJzqnRpoxGDz+Vf2UXqUVoNzSUL1b0lARyi zoXgUDye7WJG5BlOPO7vKtuCXj1R/YTvDoR3D+1uBSVwt1D458qTaHehpe18dWVEljqV tVh3s/w12EYohExDyJSM81BOt2pc/0q6Z0yci/yBsjHb+KvMGgwBmlzaOFThsIrXYsuY pVI92lvoyifO0oCIj5YiLWbfK/IX1JOvTyY+jAnRLZij/6zMITbOgIIMJDR9aFweEjRb JgnbF1sHyQw+l1jCYncBeRQvf82Ac/RKbgIJm+63RcjTXvBrpnWvIYZeL83LtoV6rljp mymQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@megous.com header.s=mail header.b=QbLwWY74; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=megous.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si5497702edw.274.2019.10.31.11.16.27; Thu, 31 Oct 2019 11:16:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@megous.com header.s=mail header.b=QbLwWY74; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=megous.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729241AbfJaSOI (ORCPT + 99 others); Thu, 31 Oct 2019 14:14:08 -0400 Received: from vps.xff.cz ([195.181.215.36]:45420 "EHLO vps.xff.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726602AbfJaSOI (ORCPT ); Thu, 31 Oct 2019 14:14:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1572545646; bh=+8+aVOF3iSqGvzL1N7hB/tIOgnCmWN7n8SmI/voLyuw=; h=From:To:Cc:Subject:Date:From; b=QbLwWY74HjtrueocUL8/R6dmMGmMTLGX3Dtb/snOuodi4/KJ9dq9X1jj4qf9QgnL7 Ob52iOVQ/R+gj88YDgepIN76L1UZZbucbHXnbTQD/flG9XuTD2lC5Hr/uFx5h9P/Vm jaXcikK1Gat9slDGatNmvF4/K6ATPO5tww36z3PY= From: Ondrej Jirman To: linux-sunxi@googlegroups.com Cc: Ondrej Jirman , Yangtao Li , "Rafael J. Wysocki" , Viresh Kumar , Maxime Ripard , Chen-Yu Tsai , linux-pm@vger.kernel.org (open list:ALLWINNER CPUFREQ DRIVER), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] cpufreq: sun50i: Fix CPU speed bin detection Date: Thu, 31 Oct 2019 19:13:58 +0100 Message-Id: <20191031181359.282617-1-megous@megous.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I have failures to boot on Orange Pi 3, because this driver determined that my SoC is from the normal bin, but my SoC only works reliably with the OPP values for the slowest bin. Looking at BSP code, I found that efuse values have following meanings on H6: - 0b000 invalid (interpreted in vendor's BSP as normal bin) - 0b001 slowest bin - 0b011 normal bin - 0b111 fastest bin Let's play it safe and interpret 0 as the slowest bin, but fix detection of other bins to match vendor code. Fixes: f328584f7bff ("cpufreq: Add sun50i nvmem based CPU scaling driver") Signed-off-by: Ondrej Jirman --- See https://megous.com/git/linux/tree/drivers/soc/sunxi/sunxi-sid.c?h=h6-4.9-bsp#n484 and https://megous.com/git/linux/tree/drivers/cpufreq/sunxi-cpufreq.c?h=h6-4.9-bsp#n428 (1 is substracted from soc_bin number here!) drivers/cpufreq/sun50i-cpufreq-nvmem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/sun50i-cpufreq-nvmem.c b/drivers/cpufreq/sun50i-cpufreq-nvmem.c index df35ef3ef567..41dad03e245c 100644 --- a/drivers/cpufreq/sun50i-cpufreq-nvmem.c +++ b/drivers/cpufreq/sun50i-cpufreq-nvmem.c @@ -71,9 +71,12 @@ static int sun50i_cpufreq_get_efuse(u32 *versions) efuse_value = (*speedbin >> NVMEM_SHIFT) & NVMEM_MASK; switch (efuse_value) { case 0b0001: - *versions = 1; + *versions = 0; break; case 0b0011: + *versions = 1; + break; + case 0b0111: *versions = 2; break; default: -- 2.23.0