mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/3] ARM: introduce machine description
Date: Sat, 23 Nov 2013 16:02:13 +0100	[thread overview]
Message-ID: <20131123150213.GA29652@ns203013.ovh.net> (raw)
In-Reply-To: <20131122074245.GJ24559@pengutronix.de>

On 08:42 Fri 22 Nov     , Sascha Hauer wrote:
> On Thu, Nov 21, 2013 at 08:13:53AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > +static int arm_mach_early_init(void)
> > +{
> > +	arm_mach_only_one_machine();
> > +
> > +	if (machine_desc && machine_desc->init_early)
> > +		machine_desc->init_early();
> > +	
> > +	return 0;
> > +}
> > +pure_initcall(arm_mach_early_init);
> 
> Can we call of_arm_init() from here instead of a separate initcall?

I do not have dt board to test as I've moving for few days

if you can test the v2 on this it will be nice

I've test it on vexpress and at91 (I switch them all)

I was also thinking also to pass the archid to barebox via r1 as done on the
kernel

as on at91bootstrap we are already passing it

we could also use r2 to give dtb add if the first stage handle

so barebox could boot as a linux kernel too
> 
> > +
> > +static int arm_mach_console_init(void)
> > +{
> > +	if (!machine_desc)
> > +		return 0;
> > +
> > +	if (machine_desc->name)
> > +		barebox_set_model(machine_desc->name);
> > +
> > +	if (machine_desc->init_console)
> > +		machine_desc->init_console();
> > +
> > +	return 0;
> > +}
> > +console_initcall(arm_mach_console_init);
> > +
> > +static int arm_mach_machine_init(void)
> > +{
> > +	if (machine_desc && machine_desc->init_machine)
> > +		machine_desc->init_machine();
> > +
> > +	return 0;
> > +}
> > +device_initcall(arm_mach_machine_init);
> > +
> > +static int arm_mach_late_init(void)
> > +{
> > +	if (machine_desc && machine_desc->init_late)
> > +		machine_desc->init_late();
> 
> I think all these should return int. This way we could see if something
> goes wrong.
ok
> 
> > +
> > +	return 0;
> > +}
> > +late_initcall(arm_mach_late_init);
> > diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
> > new file mode 100644
> > index 0000000..4e0e771
> > --- /dev/null
> > +++ b/arch/arm/include/asm/mach/arch.h
> > @@ -0,0 +1,66 @@
> > +/*
> > + *  arch/arm/include/asm/mach/arch.h
> > + *
> > + *  Copyright (C) 2000 Russell King
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2 as
> > + * published by the Free Software Foundation.
> > + */
> > +
> > +#include <linux/types.h>
> > +#include <linux/stringify.h>
> > +
> > +#ifndef __ASM_MACH_ARCH_H__
> > +#define __ASM_MACH_ARCH_H__
> > +
> > +struct machine_desc {
> > +	unsigned int		nr;		/* architecture number	*/
> > +	const char		*name;		/* architecture name	*/
> > +	const char *const	*dt_compat;	/* array of device tree
> > +						 * 'compatible' strings	*/
> > +
> > +	void			(*init_early)(void);
> > +	void			(*init_console)(void);
> > +	void			(*init_time)(void);
> 
> I think init_time doesn't make sense in the context of barebox. What I'd
> like to have though is a init_soc which the boards set to some SoC
> specific function so that later code knows which SoC we're on.

here I've an issue some SoC need late_init and other init

so I was thinking to have soc_desc too
> 
> Can we stick the naming more to the existing barebox initcall levels
> instead of the Linux machine desc names? Something like:
> 
> soc_init
> pure_init
> core_init
> postcore_init
> console_init
> coredevice_init
> device_init
> late_init
with mmu_init and mem_init yes
> 
> (Where soc_init would be called on pure_initcall level, but after the
> of/machine desc has been parsed)
> 
> > +
> > +/*
> > + * Current machine - only accessible during boot.
> > + */
> 
> Can you drop the comments that don't make sense for barebox?
yeah

Best Regards,
J.
> 
> Sascha
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2013-11-23 15:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-21  7:12 [RFC] [PATCH 0/3] ARM: machine struct support Jean-Christophe PLAGNIOL-VILLARD
2013-11-21  7:13 ` [PATCH 1/3] ARM: introduce machine description Jean-Christophe PLAGNIOL-VILLARD
2013-11-21  7:13   ` [PATCH 2/3] at91: detect SoC earlier Jean-Christophe PLAGNIOL-VILLARD
2013-11-21  7:13   ` [PATCH 3/3] AT91: usb-a926x: switch to machine description Jean-Christophe PLAGNIOL-VILLARD
2013-11-21  8:05   ` [PATCH 1/3] ARM: introduce " Alexander Aring
2013-11-22  7:42   ` Sascha Hauer
2013-11-23 15:02     ` Jean-Christophe PLAGNIOL-VILLARD [this message]

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=20131123150213.GA29652@ns203013.ovh.net \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.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