[PATCH V4 10/12] boot_constraint: Add support for Hisilicon platforms

Viresh Kumar viresh.kumar at linaro.org
Wed Dec 13 02:13:19 PST 2017


On 13-12-17, 10:47, Greg Kroah-Hartman wrote:
> On Sun, Oct 29, 2017 at 07:18:58PM +0530, Viresh Kumar wrote:
> > +static const struct of_device_id machines[] __initconst = {
> > +	{ .compatible = "hisilicon,hi3660", .data = &hikey3660_constraints },
> > +	{ .compatible = "hisilicon,hi3798cv200", .data = &hikey3798cv200_constraints },
> > +	{ .compatible = "hisilicon,hi6220", .data = &hikey6220_constraints },
> > +	{ }
> > +};
> > +
> > +static int __init hikey_constraints_init(void)
> > +{
> > +	const struct hikey_machine_constraints *constraints;
> > +	const struct of_device_id *match;
> > +	struct device_node *np;
> > +
> > +	if (!boot_constraint_earlycon_enabled())
> > +		return 0;
> > +
> > +	np = of_find_node_by_path("/");
> 
> What is this for?

We need to match the above list of "machines" with the root node and "np" here
points to the root node.. and ...

> > +	if (!np)
> > +		return -ENODEV;
> > +
> > +	match = of_match_node(machines, np);

Its used here.

> > +	of_node_put(np);

> > +/*
> > + * The amba-pl011 driver registers itself from arch_initcall level. Setup the
> > + * serial boot constraints before that in order not to miss any boot messages.
> > + */
> > +postcore_initcall_sync(hikey_constraints_init);
> 
> Now you have to worry about the bootconstraints earlycon being called
> before/after your code.

For boot-constraints to work for any device, it is extremely important to add
the constraint before the device is probed by its driver, otherwise the driver
would end up re-configuring the resources. There is no other way then having
this order dependency here.

> That's another linking order dependancy you
> just created.  It feels more complex for something so "simple" as
> looking for the earlycon flag...

-- 
viresh



More information about the linux-arm-kernel mailing list