Received: by 10.223.176.46 with SMTP id f43csp1238315wra; Fri, 19 Jan 2018 08:43:58 -0800 (PST) X-Google-Smtp-Source: ACJfBovQf4MlgGelY3jyc+g+C3TKMhkmko4uxHFRHkyIG6T70whvB2Fo25Cj0Mw4kTQB+5ClxGzN X-Received: by 10.99.116.22 with SMTP id p22mr37100505pgc.4.1516380237954; Fri, 19 Jan 2018 08:43:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516380237; cv=none; d=google.com; s=arc-20160816; b=gb8xBf+8i2ReMTwlVKT0GBo/wqxVUwCFZMgVlqT4tMmjhoFWttCKn2gARtViPETH2O ch32ilelZQMfSAdzG5HddkYZS+Zbi/aaKKG7gi507AfG4/7dIqC3mxxYwZ5eJD1vbGr3 XOeUD+1Vt/VuV3l49dzXO4q9FWZyMilmFinqQg4uA8NaASr9cIfBSYUhZ3+Lb5CUeGAY dV6fo/spQuritkHmVQOUghZWc/RQ82vz45QZ0OPDpWBMijRK4n57SG9O1xUshl8PJ3nM hbo0VndJgIDHbmTwAGQrex/rBkC2lDrHl0LzLxUyZ9FY9bzbertOQfzsd4sx9x/QoJvT w9cg== 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=JbCAcztQinh1yUtvx1kCQOKQoNj3QlUeaXU4yd0iw/Y=; b=Wf3YeowdkphYCdTUfjmJv0prqfDuRNRVXAG/UAoFzMlZryjbqxP33MeIDCUU0dGYvJ DfXFI5QwY7gd+wf7VQNUSJp7JDT4c9EU+q8eCC54S872FXBADU4y5VobiI3GqGoH1H/e 4WjWHDQutBWE+0iDEOy78TwYdp/isSF4lM4L4Wli/RkLK0zimEznu1NkRzlHz9lHGELp uTTt90ntcg4bv7w9nX88RJ8gNxCqeuYQEd0couBp+KGWT82EMT1m7OLAcwSydNW1Lhgd N85TrfD5a2Gaq9cc3MVXMSAltC42VWpCHYRba+dNtA/1+AmcHuJhV70dTt06GS5Ho2iN 9lRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=BXOExu7k; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e26si8436840pga.404.2018.01.19.08.43.44; Fri, 19 Jan 2018 08:43:57 -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=fail header.i=@gmail.com header.s=20161025 header.b=BXOExu7k; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756005AbeASQmA (ORCPT + 99 others); Fri, 19 Jan 2018 11:42:00 -0500 Received: from mail-ot0-f195.google.com ([74.125.82.195]:42425 "EHLO mail-ot0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756058AbeASQlr (ORCPT ); Fri, 19 Jan 2018 11:41:47 -0500 Received: by mail-ot0-f195.google.com with SMTP id s3so1884019otc.9; Fri, 19 Jan 2018 08:41:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=JbCAcztQinh1yUtvx1kCQOKQoNj3QlUeaXU4yd0iw/Y=; b=BXOExu7kk2AGGvYOusV0VwZ9LB2pvOdyI/uupow1/+aAY33gw2eFaAYcxO/23UqK3e kOh68GmIODXxnzKF24ojjNydR3swFKP4FbLLe0p/42z6hvYliWp29VoAPHMMutJSKJNa LfENzqpYVOOit341vhs4l5qCeV8FTsYrtMtWJeK/RRqj+fgfvqQmOCOPKCl0ydwu3/BZ 9E/lMYtTAvzCwU7HUOX+L8FlAfNZ5Kcztep0/jznX2HQ4eO/t62eMXbsFPRq+hsh5/eU 3EliJBhjilB6JiouNQE39z1zcje0qSLHlxu5n9YgqKDsowGPfJPomDeCbJmJbwxUjrbe 878A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=JbCAcztQinh1yUtvx1kCQOKQoNj3QlUeaXU4yd0iw/Y=; b=eo6453V9aJF6Zx6feyqm3gAu63E42t0cXC2QbmlwJ8In9clHLgAq+xbZRi6yYx45yq MdyyI8ZHATqnLDrjgEnfh3b5kL+GMz4ab1XqutsTxerPeV+LZnidzHTBpXmjPQ3CwZl2 mQ3HFURKKb3sGZPdBpd9mWtqlQ5GyFePvsdUO0+9FnWat0aq0CdMJLaZgyFpEMOXyJsV ualTv59oodRkiycFpm3CCptP2oZr/ImvMz0Q6F1jryTwjYX7gaMWFpIxuDjYMO+Rxa+s jssnPJz8xINdzV3saP8xQsffhJSCydqlbRu//SlU0kQBcn7/KT/XcfbEodMQWmU5PS1N ABnw== X-Gm-Message-State: AKwxytdr+anYdKWEHh8CbsBur6m0igCLHx1Gq9RcbAT6b0uLwbnUlGYX abTox7qsHqg4/S9bGx9PgcZUN8P1kWdkNRN1LMk= X-Received: by 10.157.50.5 with SMTP id t5mr5672484otc.172.1516380106373; Fri, 19 Jan 2018 08:41:46 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.68.119 with HTTP; Fri, 19 Jan 2018 08:41:45 -0800 (PST) In-Reply-To: References: <5930d2df872116555cc553284b6c111dce29e298.1515766253.git.green.hu@gmail.com> From: Arnd Bergmann Date: Fri, 19 Jan 2018 17:41:45 +0100 X-Google-Sender-Auth: IrxurnUyHOPsANaLDJcHPXxeJKI Message-ID: Subject: Re: [PATCH v6 06/36] nds32: Kernel booting and initialization To: Greentime Hu 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 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. Arnd