Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1549787ybx; Thu, 31 Oct 2019 12:14:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/TfEB8H5JlvWWniSx90dEIg2Rer2BYNmoovE6NI7WUgk+r+uar/RRIDGha6fseBmPDcX1 X-Received: by 2002:a50:ff12:: with SMTP id a18mr8074853edu.200.1572549268964; Thu, 31 Oct 2019 12:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572549268; cv=none; d=google.com; s=arc-20160816; b=zNnNpZ7P9u8yzcfdZ0X4OTFJtuL8uAV6UrLbAx/ZtuWyxDufgjWN+P8maMLW5d+ZVz 4LABcFrgDzYbzrqMfNUZUw/Ox2Z4g95oEMUzYqT+LrJ0jJxusgtSSPcAS9lnoi0Bs603 CoECKQ9ZLXho+WbALh6cIu8+t0lkrxUKNNEUe7B3bQju2QEJEWfKXgpMxnfGrkMJJyyp 6OPO8Jz7rSLtzeqscAok4ZnoYr5ou1SBPssnCt8Z9KOEZIK9AtoyNEfb5VgmFPtfmUSm fObocbzrNgApLmGtV65ereIOUIrpNwjqnnT6cnMt/moBV2CtUSWTpcDbdxmbmk+Xdb2e 7nHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=paSV9vgyUGoOv0NZmUVSDldiOKcUIPf+to51bxQ8xLk=; b=Opjyd4htEtWm2QBB6In78Gaf8LjA2IJwMnWrxjPwcLI+uSqydqAvR15YbFAJDwScx5 e9G5pTXBbWWOW/ub2rsNqweTCozD6lPjNyYsR+FeSLUj3z6/c5/djs4a/kJwEn5oPbMr w61lZihL4U+unhH3u1yLL5O22crEfXhfl8evsKYIkGJ5Gw2/+atpYZnLdXrWgte3FsOL IT0AFXTayHZWajp+S/5WZGfVsTymce3A6X8RUcKNhnnzPkHP0kEDBEC0w9NHC1OJfk9K DuqFFSA6IWbmLXDlbHwpNG49i9ip5DHAG2E199rdcLHJNbnsLpMgPD0pY67IBd+ehV/a jmVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@megous.com header.s=mail header.b="hCM/GltD"; 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 o10si5690378edj.316.2019.10.31.12.14.05; Thu, 31 Oct 2019 12:14:28 -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="hCM/GltD"; 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 S1729453AbfJaTNA (ORCPT + 99 others); Thu, 31 Oct 2019 15:13:00 -0400 Received: from vps.xff.cz ([195.181.215.36]:46168 "EHLO vps.xff.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729296AbfJaTNA (ORCPT ); Thu, 31 Oct 2019 15:13:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1572549177; bh=FBhBhCbprAZVkPZ3QAQvStNaQNJCu5ZanEhE9s1mTjM=; h=Date:From:To:Cc:Subject:References:X-My-GPG-KeyId:From; b=hCM/GltDpo77xYTpaz5/dMejRWcp59srCsks7ySNzk7z79SyUnRSfnGdVP5DlrOpR 1ip+EBcUGDaNCK/biB6v8CbSlFIlqVZTyRqOaNPsSiM08tOHV1BKrSXrIv6dKpRsSJ jVyh+iOa7L3nh1tSDQgOAVE7UuRJ/AB0EBdoG/ys= Date: Thu, 31 Oct 2019 20:12:57 +0100 From: =?utf-8?Q?Ond=C5=99ej?= Jirman To: =?utf-8?B?Q2zDqW1lbnQgUMOpcm9u?= Cc: linux-sunxi , Yangtao Li , "Rafael J. Wysocki" , Viresh Kumar , Maxime Ripard , Chen-Yu Tsai , "open list:ALLWINNER CPUFREQ DRIVER" , "moderated list:ARM/Allwinner sunXi SoC support" , open list Subject: Re: [linux-sunxi] [PATCH] cpufreq: sun50i: Fix CPU speed bin detection Message-ID: <20191031191257.j7bpxx5xyot2ay2i@core.my.home> Mail-Followup-To: =?utf-8?B?Q2zDqW1lbnQgUMOpcm9u?= , linux-sunxi , Yangtao Li , "Rafael J. Wysocki" , Viresh Kumar , Maxime Ripard , Chen-Yu Tsai , "open list:ALLWINNER CPUFREQ DRIVER" , "moderated list:ARM/Allwinner sunXi SoC support" , open list References: <20191031181359.282617-1-megous@megous.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-My-GPG-KeyId: EBFBDDE11FB918D44D1F56C1F9F0A873BE9777ED Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Thu, Oct 31, 2019 at 07:55:43PM +0100, Cl?ment P?ron wrote: > Hi Ondrej, > > On Thu, 31 Oct 2019 at 19:14, Ondrej Jirman wrote: > > > > 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 > > Maybe have some defines will be more readable no ? > https://megous.com/git/linux/tree/drivers/soc/sunxi/sunxi-sid.c?h=h6-4.9-bsp#n213 Hmm, Alwwinner is really funny. Unused macros that just confuse things. #if defined(CONFIG_ARCH_SUN50IW6) #define TYPE_SB (0b001) #define TYPE_NB (0b010) #define TYPE_FB (0b011) #else #define TYPE_SB (0b001) #define TYPE_NB (0b011) #define TYPE_FB (0b111) #endif So for H6 they define special bin values and actually use different ones in code. Fun. I've sent out some testing program to Armbian forums, so hopefully, we'll collect some real efuse_values from real SoCs, to see what's really being used in the wild. If we see value 0b010, the BSP code is probably just wrong. Interestingly, TYPE_NB 0b010 would be interpreted as normal bin even with the current BSP code, and TYPE_FB would be misdetected as TYPE_NB. > #define SUN50I_NVEM_INVALID_CPU_OPP (0b000) > #define SUN50I_NVEM_LOW_CPU_OPP (0b001) > #define SUN50I_NVEM_NORMAL_CPU_OPP (0b011) > #define SUN50I_NVEM_HIGH_CPU_OPP (0b111) I'd rather not describe meanings just yet, until we get some real-world data from H6 owners. https://forum.armbian.com/topic/9368-orangepi-3-h6-allwiner-chip/?do=findComment&comment=88439 regards, o. > Regards, > Cl?ment > > > > > 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 > > > > -- > > You received this message because you are subscribed to the Google Groups "linux-sunxi" group. > > To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com. > > To view this discussion on the web, visit https://groups.google.com/d/msgid/linux-sunxi/20191031181359.282617-1-megous%40megous.com.