u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: Stefan Roese <sr@denx.de>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
	Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH 07/10] board_f/r: Allow selection of CONFIG_TIMER_EARLY w/o CONFIG_TIMER
Date: Tue, 27 Sep 2022 19:54:52 -0600	[thread overview]
Message-ID: <CAPnjgZ2KmRUpd4t9_g_to44tw3ZBRjdXG3f2uT08_O-pjGAVnQ@mail.gmail.com> (raw)
In-Reply-To: <81bf9126-2451-1e87-c8f0-dbc2cec7843d@denx.de>

Hi Stefan,

On Mon, 26 Sept 2022 at 07:52, Stefan Roese <sr@denx.de> wrote:
>
> Hi Simon,
>
> On 25.09.22 16:15, Simon Glass wrote:
> > Hi Stefan,
> >
> > On Wed, 21 Sept 2022 at 08:06, Stefan Roese <sr@denx.de> wrote:
> >>
> >> The early timer functions provided via CONFIG_TIMER_EARLY don't need
> >> CONFIG_TIMER to be enabled, as they don't make use of the DM timer
> >> and uclass interface. This patch now allow the selection of
> >> CONFIG_TIMER_EARLY w/o CONFIG_TIMER, enabling this early timer
> >> functionality also for non CONFIG_TIMER drivers.
> >>
> >> With this change it's necessary to guard the dm_timer_init() call
> >> in initr_dm_devices() & initf_dm() additionally via CONFIG_TIMER.
> >>
> >> Signed-off-by: Stefan Roese <sr@denx.de>
> >> ---
> >>   common/board_f.c      | 2 +-
> >>   common/board_r.c      | 2 +-
> >>   drivers/timer/Kconfig | 1 -
> >>   3 files changed, 2 insertions(+), 3 deletions(-)
> >
> > I don't like this as it complicates the logic and also seems to be
> > adding a new feature to legacy code.
> >
> > Instead, let's enable the early timer only for driver model.
>
> Hmmm, not sure how this should work. Do you have this in mind (instead
> of this patch)?
>
> diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig
> index fd8745ffc2e0..30d6efe98f29 100644
> --- a/drivers/timer/Kconfig
> +++ b/drivers/timer/Kconfig
> @@ -39,7 +39,7 @@ config VPL_TIMER
>
>   config TIMER_EARLY
>          bool "Allow timer to be used early in U-Boot"
> -       depends on TIMER
> +       depends on DM
>          # initr_bootstage() requires a timer and is called before
> initr_dm()
>          # so only the early timer is available
>          default y if X86 && BOOTSTAGE
>
> This results in some compilation errors, like this:
>
> $ make stm32mp15_basic_defconfig
> $ make -sj
> /opt/kernel.org/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd:
> common/board_f.o: in function `initf_dm':
> /home/stefan/git/u-boot/u-boot-marvell/common/board_f.c:791: undefined
> reference to `dm_timer_init'
> /opt/kernel.org/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd:
> common/board_r.o: in function `initr_dm_devices':
> /home/stefan/git/u-boot/u-boot-marvell/common/board_r.c:258: undefined
> reference to `dm_timer_init'
> make: *** [Makefile:1790: u-boot] Error 1
>
> I might be missing something. Or it's not that easy and we still need
> my original implementation.

Well, given that TIMER depends on DM, I don't think you need to change that.

Also, TIMER_EARLY depends on TIMER (as it should), you should just be
able to check for IS_ENABLED(CONFIG_TIMER)

We can disable the early timer stuff for things that don't use CONFIG_TIMER

Regards,
Simon

  reply	other threads:[~2022-09-28  1:55 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 14:06 [PATCH 00/10] bootstage: Migrate from timer_get_boot_us() to timer_get_us() Stefan Roese
2022-09-21 14:06 ` [PATCH 01/10] arm: arch_timer: Add timer_early functions Stefan Roese
2022-09-25 14:15   ` Simon Glass
2022-09-21 14:06 ` [PATCH 02/10] arm: imx: syscounter: " Stefan Roese
2022-09-25 14:15   ` Simon Glass
2022-09-21 14:06 ` [PATCH 03/10] arm: armv8: generic_timer: " Stefan Roese
2022-09-25 14:15   ` Simon Glass
2022-09-21 14:06 ` [PATCH 04/10] timer: cadence-ttc: " Stefan Roese
2022-09-25 14:15   ` Simon Glass
2022-09-26 14:11     ` Stefan Roese
2022-09-28  1:54       ` Simon Glass
2022-09-30 12:02         ` Michal Simek
2022-09-30 13:45           ` Stefan Roese
2022-10-04 11:49             ` Michal Simek
2022-10-04 14:54               ` Stefan Roese
2022-10-04 16:29               ` Simon Glass
2022-10-05  6:59                 ` Michal Simek
2022-09-21 14:06 ` [PATCH 05/10] timer: omap-timer: " Stefan Roese
2022-09-21 14:06 ` [PATCH 06/10] timer: rockchip_timer: " Stefan Roese
2022-09-24  7:57   ` Kever Yang
2022-09-21 14:06 ` [PATCH 07/10] board_f/r: Allow selection of CONFIG_TIMER_EARLY w/o CONFIG_TIMER Stefan Roese
2022-09-25 14:15   ` Simon Glass
2022-09-26 13:52     ` Stefan Roese
2022-09-28  1:54       ` Simon Glass [this message]
2022-09-30  5:36         ` Stefan Roese
2022-09-30 13:28           ` Simon Glass
2022-09-30 13:52             ` Stefan Roese
2022-09-21 14:06 ` [PATCH 08/10] board_f/r: Don't call timer_init() when TIMER is enabled Stefan Roese
2022-09-21 14:06 ` [PATCH 09/10] bootstage: Migrate from timer_get_boot_us() to timer_get_us() Stefan Roese
2022-09-28 10:20   ` Simon Glass
2022-09-30 11:30   ` Michal Simek
2022-09-21 14:06 ` [PATCH 10/10] bootstage/timer: Treewide remove timer_get_boot_us() Stefan Roese
2022-09-25 14:15   ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPnjgZ2KmRUpd4t9_g_to44tw3ZBRjdXG3f2uT08_O-pjGAVnQ@mail.gmail.com \
    --to=sjg@chromium.org \
    --cc=sr@denx.de \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).