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 13031C433F5 for ; Wed, 5 Jan 2022 20:19:56 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DE75C83762; Wed, 5 Jan 2022 21:19:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="lgjTJ7Ui"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A8B8C83782; Wed, 5 Jan 2022 21:19:52 +0100 (CET) Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) (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 62EAB82F87 for ; Wed, 5 Jan 2022 21:19:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jbx6244@gmail.com Received: by mail-ed1-x52d.google.com with SMTP id j6so947031edw.12 for ; Wed, 05 Jan 2022 12:19:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=yJj1OkeSa3Sl3D5nd/8pxJwX98y/Dz6cAEupx2qRQGI=; b=lgjTJ7UiT/prBPNrw0cML4qXWe2uRwaoBog/uLpQRThtXEWo1HASUE+a4gYz5IHL+x D4ulqjTYigL4NwHUY1lMV/OsJIATijqAL81/UOe41wyJR6uaF8UuDk1dqxqO/8AmAXxS JzzJNhO0G3CfK97oYtuIVogOHKkS0BNgAzhBqQYm1WLLMJfD98GIvpVHcXG1KN7btKo+ a8Gq8NIUGar4qDuhBmf325KQXEc6l6EvUMt+clpuhwyRMoaJoUjTz9Aw1fWGj9Ba9dNg HFELFgLIANv1gMAXuKTvTIpY7kkvldSeGXO3rpuFByRopil5ZYdhOtiMOySiDJAbSQA/ uscw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=yJj1OkeSa3Sl3D5nd/8pxJwX98y/Dz6cAEupx2qRQGI=; b=6ufa2vUpkTFz0Rui+9oMOHc4YGmFsDHzA4cqdF2q2jxI9BkTH1JA5070zO+gtdZpbS 3r7/AKIljV1nxIc1uL6vcpFng3If+l3giVWpPbgfP0QfbnMc84AEVzvHnWVWbVUndNcj uxh/JQqydwonJIOBAlIMSM4/IroWamvWDVzwRel/N75ckVNGHScX1ZTgpxQU2Nb3moKw frIv+1whHJrgWsOvaifowFpdItSp9vLms+uPWeZzRfz+MzWArLicxP9rP2UMrjJeHzph msqB7Gpw6yDj2HTOlriKLuN9DPn8JvMUXLAoFb04kKq1y25KYhbMa089lvxH40tJZ+lr ouPg== X-Gm-Message-State: AOAM531u03DXx9AaRKNZ/r8ZgwO96zzAcoP0V4p5Ig4wEKAhOgTuBY6A uEktgQiodequMicLhGVevByTAU7ldK8Z5A== X-Google-Smtp-Source: ABdhPJyWoKueKpKRp/bsDYIwrbClX2gUrP+bdSfnGMhpbjx2MEJUm0D16wuLHEbvEgcETs+NhjQiUQ== X-Received: by 2002:a05:6402:6cd:: with SMTP id n13mr55116393edy.248.1641413986053; Wed, 05 Jan 2022 12:19:46 -0800 (PST) Received: from [192.168.2.2] (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id 21sm12485752ejx.83.2022.01.05.12.19.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 05 Jan 2022 12:19:45 -0800 (PST) Subject: Re: [PATCH v2] rockchip: timer: add OF_PLATDATA support for dw-apb-timer From: Johan Jonker To: Simon Glass Cc: Kever Yang , Philipp Tomsich , Marek Vasut , U-Boot Mailing List References: <20220105021533.21838-1-jbx6244@gmail.com> Message-ID: Date: Wed, 5 Jan 2022 21:19:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 at phobos.denx.de X-Virus-Status: Clean Hi, In addition of the previous message, when I compile with the opposite of OF_REAL (= !OF_PLATDATA) it generates an error in SPL. Like to know why OF_REAL doesn't work. For these couple of extra lines to increase build coverage inside does it matter a lot by adding another messy set of #if .... Let me know if that's OK to leave it as it is for version 3 with extra white space patch. Kind regards, Johan Jonker static int dw_apb_timer_of_to_plat(struct udevice *dev) { if (!IS_ENABLED(OF_PLATDATA)) { struct dw_apb_timer_priv *priv = dev_get_priv(dev); priv->regs = dev_read_addr(dev); } return 0; } arm-linux-gnueabihf-ld.bfd: drivers/timer/dw-apb-timer.o: in function `dw_apb_timer_of_to_plat': /drivers/timer/dw-apb-timer.c:95: undefined reference to `dev_read_addr' arm-linux-gnueabihf-ld.bfd: drivers/timer/dw-apb-timer.o: in function `dw_apb_timer_probe': /drivers/timer/dw-apb-timer.c:73: undefined reference to `clk_get_by_index' make[1]: *** [scripts/Makefile.spl:509: spl/u-boot-spl] Error 1 make: *** [Makefile:2011: spl/u-boot-spl] Error 2 On 1/5/22 5:40 PM, Johan Jonker wrote: > Hi Simon, > > Thanks you for your comments. > Shown below are the objdump results of the full U-boot binary > dw_apb_timer_of_to_plat() function. > Same goes for the dw_apb_timer_probe() function. > With if (IS_ENABLED(OF_REAL)) I don't get a useful timer result (boot > hangs after timer probe, because in full U-boot the reg value isn't > correct defined. Part of the init probe is missing. > > Could you try it yourself? > Please advise what options we have. > > Kind regards, > > Johan Jonker > > ========================================================================== > Patch version 1 with if (IS_ENABLED(OF_REAL)) {}: > > arm-linux-gnueabihf-objdump -d drivers/timer/dw-apb-timer.o > > ../dw-apb-timer-20220105-v1.asm > > > 00000000 : > 0: 2000 movs r0, #0 > 2: 4770 bx lr > > arm-linux-gnueabihf-objdump -d spl/drivers/timer/dw-apb-timer.o > > ../dw-apb-timer-20220105-spl-v1.asm > arm-linux-gnueabihf-objdump -d tpl/drivers/timer/dw-apb-timer.o > > ../dw-apb-timer-20220105-tpl-v1.asm > ========================================================================== > patch version 2 with #if CONFIG_IS_ENABLED(OF_REAL): > > arm-linux-gnueabihf-objdump -d drivers/timer/dw-apb-timer.o > ../dw-apb- > timer-20220105-v2.asm > > 00000000 : > 0: b538 push {r3, r4, r5, lr} > 2: 4605 mov r5, r0 > 4: f7ff fffe bl 0 > 8: 4604 mov r4, r0 > a: 4628 mov r0, r5 > c: f7ff fffe bl 0 > 10: 6020 str r0, [r4, #0] > 12: 2000 movs r0, #0 > 14: bd38 pop {r3, r4, r5, pc} > > arm-linux-gnueabihf-objdump -d spl/drivers/timer/dw-apb-timer.o > > ../dw-apb-timer-20220105-spl-v2.asm > arm-linux-gnueabihf-objdump -d tpl/drivers/timer/dw-apb-timer.o > > ../dw-apb-timer-20220105-tpl-v2.asm > > =========================================================================== > > On 1/5/22 3:03 PM, Simon Glass wrote: >> Hi Johan, >> >> On Tue, 4 Jan 2022 at 19:15, Johan Jonker wrote: >>> >>> The Rockchip rk3066 SoC has 3 dw-apb-timer nodes. >>> U-boot is compiled with OF_PLATDATA TPL/SPL options, >>> so add OF_PLATDATA support for the dw-apb-timer. >>> Also change driver name to be able to compile with >>> U-boot scripts. No reset OF_PLATDATA support was added, >>> because the rk3066 nodes don't need/have them. >>> >>> Signed-off-by: Johan Jonker >>> --- >>> >>> Changed V2: >>> replace if (IS_ENABLED(OF_REAL)) by #if CONFIG_IS_ENABLED(OF_REAL) >>> --- >>> drivers/timer/dw-apb-timer.c | 30 +++++++++++++++++++++++++----- >>> 1 file changed, 25 insertions(+), 5 deletions(-) >>> >> >> This seems OK but you have included unrelated changes (whitespace) >> which should go in a separate patch. > > OK > With whitespace did you mean this or something else? > > - .of_to_plat = dw_apb_timer_of_to_plat, > + .of_to_plat = dw_apb_timer_of_to_plat, > >> >> Can you use if() instead of #if for the CONFIG_IS_ENABLED(OF_REAL) ? > > See comments above. > Currently not it seems. > >> >> Regards, >> Simon >>