From mboxrd@z Thu Jan 1 00:00:00 1970 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 2C9DDC433EF for ; Mon, 20 Jun 2022 12:14:19 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2A6A3820B3; Mon, 20 Jun 2022 14:14:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=semihalf.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=semihalf.com header.i=@semihalf.com header.b="hQf6TjMw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8CBF981DD6; Mon, 20 Jun 2022 14:14:15 +0200 (CEST) Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9B554820E2 for ; Mon, 20 Jun 2022 14:14:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=semihalf.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pan@semihalf.com Received: by mail-yb1-xb2c.google.com with SMTP id n144so14561243ybf.12 for ; Mon, 20 Jun 2022 05:14:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=6FPrPjyGVVB0amPycN5X+PUvu7I5ZWaDWhY3VtWuaPQ=; b=hQf6TjMwwvqqhQlyaIxq6mz1ZULF0Dh0TElwz6hjAolynfk+CrNtcjxW5aRyXUHzk3 uky+iQBnD269sFbW/FMSX9HKyMjZizKnV5kiszC3ttR3BU8lWYesRagU6ulGjLiIavBS yxIZuo41toIXANd/UzammKgc41omhDVbykOJZBfqewqBo7qE3lfYIueYKQ8yoFptjZGH rOi/zRQ3ou2tgjVKR6IWZbWAaH6Ep1iKP56xexmnZei1F9kDOICdOLBLu7DpJCX76hoY Mjow0gcP4kdQkcF1wADQvcmJMynsOC0x785qijg/81UGWeheVcCsiD4uypChlSpC7LZ/ r/zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=6FPrPjyGVVB0amPycN5X+PUvu7I5ZWaDWhY3VtWuaPQ=; b=ebfpee386y+LaBZ+UYa2Uhsiq6I93tHlArSchJhL5FvdzzseH7PCbMAxNQDMPgSubL Rj8QPbfppXM880+4eAIH1I/EvrP446Txkpg7aK8Myo+aqsOwKRcfzoqvCJv445yrUKSj fgV/0gDRDa4DipcUP/nUOJZpFh+31yY+V1R0BDIYI3RTkdkW2QHVKheng3p1lx+Tp8un i6E48QRT0WTb6GMCGdpRjF9djC6mnpElm3wI10Eroja/Pv6cHwTVeGNkzV+KJe9k+P9s pIw+sCAtS9EYweqhZtSC0IJ1+pLpY+HceN2zpqv2FNMDZ3ojfyuhXSq9uJSqoXXJ6b8l N+DQ== X-Gm-Message-State: AJIora/C3JHNCiU4pWoUg7h+T4rVV1Fm4ZuvMSpNNV9S75Xdf+eYDLFh AUl2kXKg3GM8epZN2Sg2cNlD0EwGonmg/QkfCzajpQ== X-Google-Smtp-Source: AGRyM1vbhbZ1PFYkRXdnKGukw35RbU0UqUm+66pa2SEpf5QaGW+eyqPzCFm6rPe4WXcE1wDNp6c73Zuuo4PsZWCt3LE= X-Received: by 2002:a25:38d6:0:b0:668:b5f1:7587 with SMTP id f205-20020a2538d6000000b00668b5f17587mr17411934yba.169.1655727244303; Mon, 20 Jun 2022 05:14:04 -0700 (PDT) MIME-Version: 1.0 References: <20220617104726.158688-1-pan@semihalf.com> <20220617104726.158688-9-pan@semihalf.com> In-Reply-To: From: =?UTF-8?Q?Pawe=C5=82_Anikiel?= Date: Mon, 20 Jun 2022 14:13:53 +0200 Message-ID: Subject: Re: [PATCH v3 08/11] socfpga: arria10: Replace delays with busy waiting in cm_full_cfg To: "Chee, Tien Fong" Cc: "Vasut, Marek" , "simon.k.r.goldschmidt@gmail.com" , "michal.simek@xilinx.com" , "u-boot@lists.denx.de" , "sjg@chromium.org" , "festevam@denx.de" , "jagan@amarulasolutions.com" , "andre.przywara@arm.com" , "Armstrong, Neil" , "pbrobinson@gmail.com" , "tharvey@gateworks.com" , "paul.liu@linaro.org" , "christianshewitt@gmail.com" , "adrian.fiergolski@fastree3d.com" , "marek.behun@nic.cz" , "Denk, Wolfgang" , "Lim, Elly Siew Chin" , "upstream@semihalf.com" , "amstan@chromium.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Mon, Jun 20, 2022 at 10:40 AM Chee, Tien Fong wrote: > > Hi, > > > -----Original Message----- > > From: Pawe=C5=82 Anikiel > > Sent: Friday, 17 June, 2022 6:47 PM > > To: Vasut, Marek ; simon.k.r.goldschmidt@gmail.com; > > Chee, Tien Fong ; michal.simek@xilinx.com > > Cc: u-boot@lists.denx.de; sjg@chromium.org; festevam@denx.de; > > jagan@amarulasolutions.com; andre.przywara@arm.com; Armstrong, Neil > > ; pbrobinson@gmail.com; > > tharvey@gateworks.com; paul.liu@linaro.org; christianshewitt@gmail.com; > > adrian.fiergolski@fastree3d.com; marek.behun@nic.cz; Denk, Wolfgang > > ; Lim, Elly Siew Chin ; > > upstream@semihalf.com; amstan@chromium.org; Pawe=C5=82 Anikiel > > > > Subject: [PATCH v3 08/11] socfpga: arria10: Replace delays with busy wa= iting > > in cm_full_cfg > > > > Using udelay while the clocks aren't fully configured causes the timer = system > > to save the wrong clock rate. Use sdelay and wait_on_value instead (the > > values used in these functions were found experimentally). > > > > Signed-off-by: Pawe=C5=82 Anikiel > > --- > > arch/arm/mach-socfpga/clock_manager_arria10.c | 31 +++++++++++++----- > > - > > 1 file changed, 22 insertions(+), 9 deletions(-) > > > > diff --git a/arch/arm/mach-socfpga/clock_manager_arria10.c > > b/arch/arm/mach-socfpga/clock_manager_arria10.c > > index 58d5d3fd8a..b48a2b47bc 100644 > > --- a/arch/arm/mach-socfpga/clock_manager_arria10.c > > +++ b/arch/arm/mach-socfpga/clock_manager_arria10.c > > Did you try to call timer_init() after cm_basic_init() in board_init_f? I= f that's working, then no change is required to fix this clock issue. Seems like timer_init() isn't implemented on Arria 10 (it defaults to the return 0 stub). I also tried dm_timer_init(), no luck. I did some code digging, the clock rate is read by clk_get_rate(), and the timer rate is set by dw_apb_timer_probe() (drivers/timer/dw-apb-timer.c:77), and there doesn't seem to be a good way of updating that value later. The only other function I could find that sets the timer rate is timer_pre_probe() from drivers/timer/timer-uclass.c, which very much looks like what we need, but it's static and the name suggests it shouldn't be called manually anyway. Regards, Pawe=C5=82