soc: brcmstb: Split initialization
We may need access to family_id and product_id fairly early on boot for other parts of the code (e.g: biuctrl.c), so split the initialization between an early_init() and an arch_initcall() which allows us to do that. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
This commit is contained in:
parent
b4b32e3216
commit
5d4567ec3b
|
@ -66,13 +66,10 @@ static const struct of_device_id sun_top_ctrl_match[] = {
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
static int __init brcmstb_soc_device_init(void)
|
static int __init brcmstb_soc_device_early_init(void)
|
||||||
{
|
{
|
||||||
struct soc_device_attribute *soc_dev_attr;
|
|
||||||
struct soc_device *soc_dev;
|
|
||||||
struct device_node *sun_top_ctrl;
|
struct device_node *sun_top_ctrl;
|
||||||
void __iomem *sun_top_ctrl_base;
|
void __iomem *sun_top_ctrl_base;
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
sun_top_ctrl = of_find_matching_node(NULL, sun_top_ctrl_match);
|
sun_top_ctrl = of_find_matching_node(NULL, sun_top_ctrl_match);
|
||||||
if (!sun_top_ctrl)
|
if (!sun_top_ctrl)
|
||||||
|
@ -84,12 +81,19 @@ static int __init brcmstb_soc_device_init(void)
|
||||||
|
|
||||||
family_id = readl(sun_top_ctrl_base);
|
family_id = readl(sun_top_ctrl_base);
|
||||||
product_id = readl(sun_top_ctrl_base + 0x4);
|
product_id = readl(sun_top_ctrl_base + 0x4);
|
||||||
|
iounmap(sun_top_ctrl_base);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
early_initcall(brcmstb_soc_device_early_init);
|
||||||
|
|
||||||
|
static int __init brcmstb_soc_device_init(void)
|
||||||
|
{
|
||||||
|
struct soc_device_attribute *soc_dev_attr;
|
||||||
|
struct soc_device *soc_dev;
|
||||||
|
|
||||||
soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
|
soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
|
||||||
if (!soc_dev_attr) {
|
if (!soc_dev_attr)
|
||||||
ret = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
soc_dev_attr->family = kasprintf(GFP_KERNEL, "%x",
|
soc_dev_attr->family = kasprintf(GFP_KERNEL, "%x",
|
||||||
family_id >> 28 ?
|
family_id >> 28 ?
|
||||||
|
@ -107,14 +111,9 @@ static int __init brcmstb_soc_device_init(void)
|
||||||
kfree(soc_dev_attr->soc_id);
|
kfree(soc_dev_attr->soc_id);
|
||||||
kfree(soc_dev_attr->revision);
|
kfree(soc_dev_attr->revision);
|
||||||
kfree(soc_dev_attr);
|
kfree(soc_dev_attr);
|
||||||
ret = -ENODEV;
|
return -ENOMEM;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out:
|
|
||||||
iounmap(sun_top_ctrl_base);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
arch_initcall(brcmstb_soc_device_init);
|
arch_initcall(brcmstb_soc_device_init);
|
||||||
|
|
Loading…
Reference in New Issue