Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E47DEC25B0E for ; Tue, 16 Aug 2022 21:34:20 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9FE638481B; Tue, 16 Aug 2022 23:34:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=walle.cc Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=walle.cc header.i=@walle.cc header.b="BZtvWg0I"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EBA7B8492B; Tue, 16 Aug 2022 23:34:16 +0200 (CEST) Received: from ssl.serverraum.org (ssl.serverraum.org [176.9.125.105]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7B10D8481B for ; Tue, 16 Aug 2022 23:34:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=walle.cc Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=michael@walle.cc Received: from ssl.serverraum.org (web.serverraum.org [172.16.0.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id C2A1F22238; Tue, 16 Aug 2022 23:34:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1660685653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QGAsYngZTijX1W0FCIsnYca4MH/MTFAosxkpiw6jfNE=; b=BZtvWg0IrYLb8FgtZQ7TzYzY2GImMvEeAv7HE2qF1DitZMQYtP7HPLUTC21E7plfRMorHB Llnh23nbbUvuWqhMq5kFSLoZjKk+Jxv/e9PUosGzQTBQU9zdBJxq1L+0RBYy51QV80vDgc 9gBVMAngDUt0tS+WEJrTKWvOcOUdZh4= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Tue, 16 Aug 2022 23:34:13 +0200 From: Michael Walle To: =?UTF-8?Q?Pali_Roh=C3=A1r?= Cc: Stefan Roese , u-boot@lists.denx.de Subject: Re: [PATCH] arm: kirkwood: 88f6281: Detect CONFIG_SYS_TCLK from SAR register In-Reply-To: <20220816200016.18288-1-pali@kernel.org> References: <20220816200016.18288-1-pali@kernel.org> User-Agent: Roundcube Webmail/1.4.13 Message-ID: <56f57c8a19d7d7f30fcbe442cecc4cc6@walle.cc> X-Sender: michael@walle.cc X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Am 2022-08-16 22:00, schrieb Pali Rohár: > Bit 21 in SAR register specifies if TCLK is running at 166 MHz or 200 > MHz. > This information is undocumented in public Marvell Kirkwood Functional > Specifications [2], but is available in Linux v3.15 kirkwood code [1]. > > Commit 8ac303d49f89 ("arm: kirkwood: Do not overwrite CONFIG_SYS_TCLK") > broke support for Marvell 88F6281 SoCs because it was expected that all > those SoCs have TCLK running at 200 MHz as specified in Marvell 88F6281 > Hardware Specifications [3]. > > Fix broken support for 88F6281 by detecting CONFIG_SYS_TCLK from SAR > register, like it was doing Linux v3.15. > > [1] - > https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/arm/mach-kirkwood/common.c?h=v3.15#n542 > [2] - > https://web.archive.org/web/20130730091033/http://www.marvell.com/embedded-processors/kirkwood/assets/FS_88F6180_9x_6281_OpenSource.pdf > [3] - > https://web.archive.org/web/20120620073511/http://www.marvell.com/embedded-processors/kirkwood/assets/HW_88F6281_OpenSource.pdf > > Fixes: 8ac303d49f89 ("arm: kirkwood: Do not overwrite CONFIG_SYS_TCLK") > Signed-off-by: Pali Rohár > --- > Michael, please test this patch, if it fixes your boards. Thanks, but this doesn't compile: In file included from lib/time.c:19: lib/time.c: In function ‘timer_get_boot_us’: ./arch/arm/include/asm/io.h:108:19: error: token "{" is not valid in preprocessor expressions 108 | #define readl(c) ({ u32 __v = __arch_getl(c); __iormb(); __v; }) | ^ ./arch/arm/include/asm/arch/kw88f6281.h:18:29: note: in expansion of macro ‘readl’ 18 | #define CONFIG_SYS_TCLK ((readl(CONFIG_SAR_REG) & BIT(21)) ? \ | ^~~~~ ./arch/arm/include/asm/arch/config.h:56:32: note: in expansion of macro ‘CONFIG_SYS_TCLK’ 56 | #define CONFIG_SYS_TIMER_RATE CONFIG_SYS_TCLK | ^~~~~~~~~~~~~~~ lib/time.c:50:5: note: in expansion of macro ‘CONFIG_SYS_TIMER_RATE’ 50 | #if CONFIG_SYS_TIMER_RATE == 1000000 | ^~~~~~~~~~~~~~~~~~~~~ ./arch/arm/include/asm/io.h:108:19: error: token "{" is not valid in preprocessor expressions 108 | #define readl(c) ({ u32 __v = __arch_getl(c); __iormb(); __v; }) | ^ ./arch/arm/include/asm/arch/kw88f6281.h:18:29: note: in expansion of macro ‘readl’ 18 | #define CONFIG_SYS_TCLK ((readl(CONFIG_SAR_REG) & BIT(21)) ? \ | ^~~~~ ./arch/arm/include/asm/arch/config.h:56:32: note: in expansion of macro ‘CONFIG_SYS_TCLK’ 56 | #define CONFIG_SYS_TIMER_RATE CONFIG_SYS_TCLK | ^~~~~~~~~~~~~~~ lib/time.c:52:7: note: in expansion of macro ‘CONFIG_SYS_TIMER_RATE’ 52 | #elif CONFIG_SYS_TIMER_RATE > 1000000 | ^~~~~~~~~~~~~~~~~~~~~ make[1]: *** [scripts/Makefile.build:257: lib/time.o] Fehler 1 -michael