Received: by 10.223.176.46 with SMTP id f43csp2699009wra; Mon, 22 Jan 2018 01:50:56 -0800 (PST) X-Google-Smtp-Source: AH8x226V0EQ17iIgytcKiEz7+dxuaolIjqQeUDw4h1wephHyvC08V1tMuQhVUhqQq1IQBgWplxoJ X-Received: by 10.101.93.79 with SMTP id e15mr6791736pgt.129.1516614656510; Mon, 22 Jan 2018 01:50:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516614656; cv=none; d=google.com; s=arc-20160816; b=BPmfrlqmrA7UnX1rukMSTvSFWLXGE5Ko3KsWonDUAtz3ZVpMIUbyc1gXqsvfpRQ94N qhyHEj9k30zLRK9ZktaTD/LYb6r3yhJcYp4xhCGomg8m1Wf3H8wecesklY0fcXTmjnhC 2r1vLHsXulCxXpWCSL2qdARe5D0yOyzNdrpHfcl662fOLTyQtYbwspuV4ZN4MctlrWKY BEvs+gCVmVmg4wCXyrOd5aorWgXeAUQsFlywzbnD2SNQ0rTgTaFPPZ7y1baEAYJM8qOL A1UvHcqhzPKzfFOYLuTQESKAjIsMEnSAhBWE2A4ZsYe1QTb4XI9/IuvlFhcqV0esnkmX yVug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=AsT5ULeTkvAhbpr6mVKfzhAbxzlqt77kqchHj3kh1j0=; b=WT7pQrznqI2qP82altdp1CM1s327RjSL+OP4p46bs3zwdDGLrf27ShkWtykUtcE0iB ks4Ae0dwvxe7ITtRBVVEbC6NcwuGTjj/sk6YaTVazE2BvfKmgeYK8mjjM/eFCObgi6Bd h0xYTgihphNUPu5POiXevfltsMLQrkRad4AY8k48/o3QequWeER6Tj5dQ7jIK5sUY7jN DJC6KU3CmMqi/v7rKKqp1vhRYEfUmhljf1DsbLYwSsmudNksHGgw4vuC812Tfww/HZas hfhqV2TtnbTNWFpKLsCux2RloHrkMB/r29FUyq5A68yGCKBV8wZGTtPCqKHX35E0jKXt DC+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LGA1Wm+g; 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=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n13si5438568pgc.95.2018.01.22.01.50.41; Mon, 22 Jan 2018 01:50:56 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=LGA1Wm+g; 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=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751195AbeAVJuR (ORCPT + 99 others); Mon, 22 Jan 2018 04:50:17 -0500 Received: from mail-ua0-f193.google.com ([209.85.217.193]:44153 "EHLO mail-ua0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751020AbeAVJuM (ORCPT ); Mon, 22 Jan 2018 04:50:12 -0500 Received: by mail-ua0-f193.google.com with SMTP id x16so5387827uaj.11; Mon, 22 Jan 2018 01:50:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=AsT5ULeTkvAhbpr6mVKfzhAbxzlqt77kqchHj3kh1j0=; b=LGA1Wm+g/4wexS4iUiqiNa0vifMBcICRcYrQ1vuDwnCr7k8AfZ5UjaxHtsC3Te1ZFx E44FmGgueg0W1RDdZBT8TTl45ViWAmCyGEYsgwMf3Nbo3zFmfNfhuc1FhXZYyosKibTb 5AMaZMWkYdtFl/3CJr2g1FSopy53H9FcomsXoiNKS3P0tvn8xdDkwJHCCia92SMFeSs+ jXOCu4Z/z4yULICRMK3IklP6UaOV/HiznWk7UWoNOnzyKlBmvtfZyT26JYi0c9pHzIhm C0tXEkjOq2qgelxRcZMLz5dI9HlcUoNBmwnHYHm6ZHqg6RypZu8SeeVcQXEpitORi0Hp Dd3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=AsT5ULeTkvAhbpr6mVKfzhAbxzlqt77kqchHj3kh1j0=; b=Ked2Am+zv4qFzc+myHsNzwdqhUkDvl2Ky6646YhhSwyeVlxfNN+QSZPxO0W64djuWr i6jJA0I+tMsUgeICcRniulQm9/5TVIWb4pRO5pRe8zykhacKDS9jhV4ZKrSaTIDdTtmn T7OQS9UE9oen3FN2FIantIhIccJAhO/UlR5YJeZxVj4CUhiLcad0xydU7145q8ByHMKo npkGAIn86Rzd1sko8LZST89EkJ5r/DNbu3KIFGhuMVu9u2+hFZkG9CnuGyoBHqk1BMVe SP5wUO+MXRXHtkbsrashiSENp/F8Vq2C071rMJuvuWnTqa5PUIOow6urmP7OSiFzwj2p pxdw== X-Gm-Message-State: AKwxytfZWhoJFqT+eUFo5v5ykDn6foqNrp+D779vIwmPngbSCAsk7Sl0 OyauYFz8KdbhHkHEgn+c1O/hIrUzr1AvTxyj3o0= X-Received: by 10.159.46.18 with SMTP id t18mr4447150uaj.91.1516614611270; Mon, 22 Jan 2018 01:50:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.159.42.194 with HTTP; Mon, 22 Jan 2018 01:49:30 -0800 (PST) In-Reply-To: References: <5930d2df872116555cc553284b6c111dce29e298.1515766253.git.green.hu@gmail.com> From: Greentime Hu Date: Mon, 22 Jan 2018 17:49:30 +0800 Message-ID: Subject: Re: [PATCH v6 06/36] nds32: Kernel booting and initialization To: Arnd Bergmann Cc: Greentime , Linux Kernel Mailing List , linux-arch , Thomas Gleixner , Jason Cooper , Marc Zyngier , Rob Herring , Networking , Vincent Chen , DTML , Al Viro , David Howells , Will Deacon , Daniel Lezcano , linux-serial@vger.kernel.org, Geert Uytterhoeven , Linus Walleij , Mark Rutland , Greg KH , Guo Ren , Randy Dunlap , David Miller , Jonas Bonn , Stefan Kristiansson , Stafford Horne , Vincent Chen Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-01-20 0:41 GMT+08:00 Arnd Bergmann : > On Fri, Jan 19, 2018 at 5:34 PM, Greentime Hu wrote: >> Hi, Arnd: >> >> 2018-01-18 18:11 GMT+08:00 Arnd Bergmann : >>> On Mon, Jan 15, 2018 at 6:53 AM, Greentime Hu wrote: >>> >>> I had not looked at this patch in enough detail earlier, sorry about >>> that. It should be >>> easy enough to fix though. >>> >>>> +#ifdef CONFIG_VGA_CONSOLE >>>> +struct screen_info screen_info; >>>> +#endif >>> >>> I would assume that you can't ever have a VGA console. Just drop all >>> the references >>> here and instead send a patch to the fbdev maintainer to add the dependency >>> at CONFIG_VGA_CONSOLE to prevent selecting it with nds32. >> >> I found it can be built pass for now because we disable it in defconfig. >> Should I send the patch in v7 series? > > yes, I think that would be best. > >>>> + >>>> +extern void __init early_init_devtree(void *params); >>>> +extern void __init early_trap_init(void); >>> >>> similarly, these are declared in include/linux/of_fdt.h >>> >> >> early_trap_init is a nds32 function. I will move it to nds32.h > > Right, makes sense. > >>>> +void calibrate_delay(void) >>>> +{ >>>> + const int *val; >>>> + struct device_node *cpu = NULL; >>>> + cpu = of_find_compatible_node(NULL, NULL, "andestech,nds32v3"); >>>> + val = of_get_property(cpu, "clock-frequency", NULL); >>>> + if (!val || !*val) >>>> + panic("no cpu 'clock-frequency' parameter in device tree"); >>>> + loops_per_jiffy = be32_to_cpup(val) / HZ; >>>> + pr_cont("%lu.%02lu BogoMIPS (lpj=%lu)\n", >>>> + loops_per_jiffy / (500000 / HZ), >>>> + (loops_per_jiffy / (5000 / HZ)) % 100, loops_per_jiffy); >>>> +} >>> >>> This seems very odd to me: The 'clock-frequency' property in the >>> cpu node should refer to the actual frequency it is running at, but that >>> tends to be different from the bogomips as needed by the ndelay() >>> function. Can you explain what is going on here? >>> >> >> This implementation is referenced from openrisc. >> https://lkml.org/lkml/2017/11/17/228 > > It's correct on openrisc, because that has a reliable cycle counter, > and that gets used in its delay function: > > void __delay(unsigned long cycles) > { > cycles_t start = get_cycles(); > while ((get_cycles() - start) < cycles) > cpu_relax(); > } > > In my review comment that you cited, I assumed that nds32 had similar > hardware. > > However, as you explained earlier, the nds32 architecture does not provide > a cycle counter and the clocksource resolution is not high enough to > be a good replacement, so you have to use the traditional delay > calibration. > Hi, Arnd: Thank you for your explanation. Will it be ok if I code it like this? config GENERIC_CALIBRATE_DELAY def_bool y