9
0
Fork 0

arm: imx6: move imx6_init_lowlevel to single initcall

Instead of repeating the same lowlevel init for every board
move it to it's own initcall.

Avoids code bloat and shaves off almost 1.5kB of uncompressed
barebox size for a default imx_v7_defconfig build.

For boards wherethe hostname setup was done in  the postcore
initcall we move this to a device initcall to get it out of
the way.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Lucas Stach 2014-06-24 08:33:14 +02:00 committed by Sascha Hauer
parent 14552dddce
commit 691211c8bb
15 changed files with 17 additions and 163 deletions

View File

@ -29,6 +29,8 @@ static int nitrogen6x_devices_init(void)
imx6_bbu_internal_spi_i2c_register_handler("spiflash", "/dev/m25p0.barebox",
BBU_HANDLER_FLAG_DEFAULT);
barebox_set_hostname("nitrogen6x");
return 0;
}
device_initcall(nitrogen6x_devices_init);
@ -61,17 +63,3 @@ static int nitrogen6x_coredevices_init(void)
return 0;
}
coredevice_initcall(nitrogen6x_coredevices_init);
static int nitrogen6x_postcore_init(void)
{
if (!of_machine_is_compatible("fsl,imx6dl-nitrogen6x") &&
!of_machine_is_compatible("fsl,imx6q-nitrogen6x"))
return 0;
imx6_init_lowlevel();
barebox_set_hostname("nitrogen6x");
return 0;
}
postcore_initcall(nitrogen6x_postcore_init);

View File

@ -135,19 +135,8 @@ static int realq7_device_init(void)
break;
}
barebox_set_hostname("eDM-QMX6");
return 0;
}
device_initcall(realq7_device_init);
static int realq7_postcore_init(void)
{
if (!of_machine_is_compatible("dmo,imx6q-edmqmx6"))
return 0;
barebox_set_hostname("eDM-QMX6");
imx6_init_lowlevel();
return 0;
}
postcore_initcall(realq7_postcore_init);

View File

@ -72,19 +72,8 @@ static int riotboard_device_init(void)
imx6_bbu_internal_mmc_register_handler("emmc", "/dev/mmc3.barebox",
BBU_HANDLER_FLAG_DEFAULT);
barebox_set_hostname("riotboard");
return 0;
}
device_initcall(riotboard_device_init);
static int riotboard_lwl_init(void)
{
if (!of_machine_is_compatible("embest,riotboard"))
return 0;
barebox_set_hostname("riotboard");
imx6_init_lowlevel();
return 0;
}
postcore_initcall(riotboard_lwl_init);

View File

@ -147,8 +147,6 @@ static int arm2_console_init(void)
{
mxc_iomux_v3_setup_multiple_pads(arm2_pads, ARRAY_SIZE(arm2_pads));
imx6_init_lowlevel();
barebox_set_model("Freescale i.MX6 Armadillo2");
barebox_set_hostname("armadillo2");

View File

@ -179,20 +179,9 @@ static int sabrelite_coredevices_init(void)
phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK,
ksz9021rn_phy_fixup);
return 0;
}
coredevice_initcall(sabrelite_coredevices_init);
static int sabrelite_postcore_init(void)
{
if (!of_machine_is_compatible("fsl,imx6q-sabrelite") &&
!of_machine_is_compatible("fsl,imx6dl-sabrelite"))
return 0;
imx6_init_lowlevel();
barebox_set_hostname("sabrelite");
return 0;
}
postcore_initcall(sabrelite_postcore_init);
coredevice_initcall(sabrelite_coredevices_init);

View File

@ -69,6 +69,7 @@ static int sabresd_devices_init(void)
return 0;
armlinux_set_architecture(3980);
barebox_set_hostname("sabresd");
return 0;
}
@ -89,16 +90,3 @@ static int sabresd_coredevices_init(void)
* gpios are available.
*/
coredevice_initcall(sabresd_coredevices_init);
static int sabresd_postcore_init(void)
{
if (!of_machine_is_compatible("fsl,imx6q-sabresd"))
return 0;
imx6_init_lowlevel();
barebox_set_hostname("sabresd");
return 0;
}
postcore_initcall(sabresd_postcore_init);

View File

@ -69,19 +69,8 @@ static int gk802_env_init(void)
devfs_add_partition(bootsource_name, 0x00000, SZ_512K, DEVFS_PARTITION_FIXED, barebox_name);
devfs_add_partition(bootsource_name, SZ_512K, SZ_512K, DEVFS_PARTITION_FIXED, default_environment_name);
barebox_set_hostname("gk802");
return 0;
}
late_initcall(gk802_env_init);
static int gk802_console_init(void)
{
if (!of_machine_is_compatible("zealz,imx6q-gk802"))
return 0;
barebox_set_hostname("gk802");
imx6_init_lowlevel();
return 0;
}
postcore_initcall(gk802_console_init);

View File

@ -26,17 +26,6 @@
#include <mach/bbu.h>
#include <mach/imx6.h>
static int santaro_postcore_init(void)
{
if (!of_machine_is_compatible("guf,imx6q-santaro"))
return 0;
imx6_init_lowlevel();
return 0;
}
postcore_initcall(santaro_postcore_init);
static int santaro_device_init(void)
{
uint32_t flag_sd = 0, flag_emmc = 0;

View File

@ -47,14 +47,3 @@ static int phytec_pcaaxl3_init(void)
return 0;
}
device_initcall(phytec_pcaaxl3_init);
static int phytec_pcaaxl3_core_init(void)
{
if (!of_machine_is_compatible("phytec,imx6q-pcaaxl3"))
return 0;
imx6_init_lowlevel();
return 0;
}
postcore_initcall(phytec_pcaaxl3_core_init);

View File

@ -71,14 +71,3 @@ static int phytec_pfla02_init(void)
return 0;
}
device_initcall(phytec_pfla02_init);
static int phytec_pfla02_core_init(void)
{
if (!of_machine_is_compatible("phytec,imx6x-pbab01"))
return 0;
imx6_init_lowlevel();
return 0;
}
postcore_initcall(phytec_pfla02_core_init);

View File

@ -72,6 +72,8 @@ static int hummingboard_device_init(void)
gpio_direction_output(IMX_GPIO_NR(3, 22), 1);
gpio_direction_output(IMX_GPIO_NR(1, 0), 1);
barebox_set_hostname("hummingboard");
return 0;
}
device_initcall(hummingboard_device_init);
@ -87,16 +89,3 @@ static int hummingboard_late_init(void)
return 0;
}
late_initcall(hummingboard_late_init);
static int hummingboard_lwl_init(void)
{
if (!of_machine_is_compatible("solidrun,hummingboard"))
return 0;
barebox_set_hostname("hummingboard");
imx6_init_lowlevel();
return 0;
}
postcore_initcall(hummingboard_lwl_init);

View File

@ -113,17 +113,8 @@ static int tqma6x_env_init(void)
default_environment_path_set("/dev/mmc2.boot1");
barebox_set_hostname("mba6x");
return 0;
}
late_initcall(tqma6x_env_init);
static int tqma6x_core_init(void)
{
if (!of_machine_is_compatible("tq,mba6x"))
return 0;
imx6_init_lowlevel();
return 0;
}
postcore_initcall(tqma6x_core_init);

View File

@ -164,6 +164,7 @@ static int udoo_devices_init(void)
udoo_epit_init();
armlinux_set_bootparams((void *)0x10000100);
barebox_set_hostname("udoo");
return 0;
}
@ -179,16 +180,3 @@ static int udoo_coredevices_init(void)
return 0;
}
coredevice_initcall(udoo_coredevices_init);
static int udoo_postcore_init(void)
{
if (!of_machine_is_compatible("udoo,imx6qdl-udoo"))
return 0;
imx6_init_lowlevel();
barebox_set_hostname("udoo");
return 0;
}
postcore_initcall(udoo_postcore_init);

View File

@ -120,16 +120,3 @@ static int variscite_custom_init(void)
return 0;
}
device_initcall(variscite_custom_init);
static int variscite_custom_core_init(void)
{
if (!of_machine_is_compatible("variscite,imx6q-custom"))
return 0;
imx6_init_lowlevel();
pr_debug("Completing custom_core_init()\n");
return 0;
}
postcore_initcall(variscite_custom_core_init);

View File

@ -114,6 +114,8 @@ int imx6_init(void)
u32 rev;
u32 mx6_silicon_revision;
imx6_init_lowlevel();
imx6_boot_save_loc((void *)MX6_SRC_BASE_ADDR);
rev = readl(MX6_ANATOP_BASE_ADDR + SI_REV);