Commit 8321b758 authored by Shawn Guo's avatar Shawn Guo

ARM: imx: use machine specific hook for late init

Signed-off-by: default avatarShawn Guo <shawn.guo@linaro.org>
Acked-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
parent bb13fabc
...@@ -62,11 +62,8 @@ EXPORT_SYMBOL(mx51_revision); ...@@ -62,11 +62,8 @@ EXPORT_SYMBOL(mx51_revision);
* Dependent on link order - so the assumption is that vfp_init is called * Dependent on link order - so the assumption is that vfp_init is called
* before us. * before us.
*/ */
static int __init mx51_neon_fixup(void) int __init mx51_neon_fixup(void)
{ {
if (!cpu_is_mx51())
return 0;
if (mx51_revision() < IMX_CHIP_REVISION_3_0 && if (mx51_revision() < IMX_CHIP_REVISION_3_0 &&
(elf_hwcap & HWCAP_NEON)) { (elf_hwcap & HWCAP_NEON)) {
elf_hwcap &= ~HWCAP_NEON; elf_hwcap &= ~HWCAP_NEON;
...@@ -75,7 +72,6 @@ static int __init mx51_neon_fixup(void) ...@@ -75,7 +72,6 @@ static int __init mx51_neon_fixup(void)
return 0; return 0;
} }
late_initcall(mx51_neon_fixup);
#endif #endif
static int get_mx53_srev(void) static int get_mx53_srev(void)
......
...@@ -115,6 +115,7 @@ DT_MACHINE_START(IMX51_DT, "Freescale i.MX51 (Device Tree Support)") ...@@ -115,6 +115,7 @@ DT_MACHINE_START(IMX51_DT, "Freescale i.MX51 (Device Tree Support)")
.handle_irq = imx51_handle_irq, .handle_irq = imx51_handle_irq,
.timer = &imx51_timer, .timer = &imx51_timer,
.init_machine = imx51_dt_init, .init_machine = imx51_dt_init,
.init_late = imx51_init_late,
.dt_compat = imx51_dt_board_compat, .dt_compat = imx51_dt_board_compat,
.restart = mxc_restart, .restart = mxc_restart,
MACHINE_END MACHINE_END
...@@ -297,5 +297,6 @@ MACHINE_START(EUKREA_CPUIMX51, "Eukrea CPUIMX51 Module") ...@@ -297,5 +297,6 @@ MACHINE_START(EUKREA_CPUIMX51, "Eukrea CPUIMX51 Module")
.handle_irq = imx51_handle_irq, .handle_irq = imx51_handle_irq,
.timer = &mxc_timer, .timer = &mxc_timer,
.init_machine = eukrea_cpuimx51_init, .init_machine = eukrea_cpuimx51_init,
.init_late = imx51_init_late,
.restart = mxc_restart, .restart = mxc_restart,
MACHINE_END MACHINE_END
...@@ -335,5 +335,6 @@ MACHINE_START(EUKREA_CPUIMX51SD, "Eukrea CPUIMX51SD") ...@@ -335,5 +335,6 @@ MACHINE_START(EUKREA_CPUIMX51SD, "Eukrea CPUIMX51SD")
.handle_irq = imx51_handle_irq, .handle_irq = imx51_handle_irq,
.timer = &mxc_timer, .timer = &mxc_timer,
.init_machine = eukrea_cpuimx51sd_init, .init_machine = eukrea_cpuimx51sd_init,
.init_late = imx51_init_late,
.restart = mxc_restart, .restart = mxc_restart,
MACHINE_END MACHINE_END
...@@ -175,5 +175,6 @@ MACHINE_START(MX51_3DS, "Freescale MX51 3-Stack Board") ...@@ -175,5 +175,6 @@ MACHINE_START(MX51_3DS, "Freescale MX51 3-Stack Board")
.handle_irq = imx51_handle_irq, .handle_irq = imx51_handle_irq,
.timer = &mx51_3ds_timer, .timer = &mx51_3ds_timer,
.init_machine = mx51_3ds_init, .init_machine = mx51_3ds_init,
.init_late = imx51_init_late,
.restart = mxc_restart, .restart = mxc_restart,
MACHINE_END MACHINE_END
...@@ -426,5 +426,6 @@ MACHINE_START(MX51_BABBAGE, "Freescale MX51 Babbage Board") ...@@ -426,5 +426,6 @@ MACHINE_START(MX51_BABBAGE, "Freescale MX51 Babbage Board")
.handle_irq = imx51_handle_irq, .handle_irq = imx51_handle_irq,
.timer = &mx51_babbage_timer, .timer = &mx51_babbage_timer,
.init_machine = mx51_babbage_init, .init_machine = mx51_babbage_init,
.init_late = imx51_init_late,
.restart = mxc_restart, .restart = mxc_restart,
MACHINE_END MACHINE_END
...@@ -207,29 +207,32 @@ static void mx51_efikamx_power_off(void) ...@@ -207,29 +207,32 @@ static void mx51_efikamx_power_off(void)
static int __init mx51_efikamx_power_init(void) static int __init mx51_efikamx_power_init(void)
{ {
if (machine_is_mx51_efikamx()) { pwgt1 = regulator_get(NULL, "pwgt1");
pwgt1 = regulator_get(NULL, "pwgt1"); pwgt2 = regulator_get(NULL, "pwgt2");
pwgt2 = regulator_get(NULL, "pwgt2"); if (!IS_ERR(pwgt1) && !IS_ERR(pwgt2)) {
if (!IS_ERR(pwgt1) && !IS_ERR(pwgt2)) { regulator_enable(pwgt1);
regulator_enable(pwgt1); regulator_enable(pwgt2);
regulator_enable(pwgt2); }
} gpio_request(EFIKAMX_POWEROFF, "poweroff");
gpio_request(EFIKAMX_POWEROFF, "poweroff"); pm_power_off = mx51_efikamx_power_off;
pm_power_off = mx51_efikamx_power_off;
/* enable coincell charger. maybe need a small power driver ? */
/* enable coincell charger. maybe need a small power driver ? */ coincell = regulator_get(NULL, "coincell");
coincell = regulator_get(NULL, "coincell"); if (!IS_ERR(coincell)) {
if (!IS_ERR(coincell)) { regulator_set_voltage(coincell, 3000000, 3000000);
regulator_set_voltage(coincell, 3000000, 3000000); regulator_enable(coincell);
regulator_enable(coincell);
}
regulator_has_full_constraints();
} }
regulator_has_full_constraints();
return 0; return 0;
} }
late_initcall(mx51_efikamx_power_init);
static void __init mx51_efikamx_init_late(void)
{
imx51_init_late();
mx51_efikamx_power_init();
}
static void __init mx51_efikamx_init(void) static void __init mx51_efikamx_init(void)
{ {
...@@ -293,5 +296,6 @@ MACHINE_START(MX51_EFIKAMX, "Genesi EfikaMX nettop") ...@@ -293,5 +296,6 @@ MACHINE_START(MX51_EFIKAMX, "Genesi EfikaMX nettop")
.handle_irq = imx51_handle_irq, .handle_irq = imx51_handle_irq,
.timer = &mx51_efikamx_timer, .timer = &mx51_efikamx_timer,
.init_machine = mx51_efikamx_init, .init_machine = mx51_efikamx_init,
.init_late = mx51_efikamx_init_late,
.restart = mx51_efikamx_restart, .restart = mx51_efikamx_restart,
MACHINE_END MACHINE_END
...@@ -211,22 +211,25 @@ static void mx51_efikasb_power_off(void) ...@@ -211,22 +211,25 @@ static void mx51_efikasb_power_off(void)
static int __init mx51_efikasb_power_init(void) static int __init mx51_efikasb_power_init(void)
{ {
if (machine_is_mx51_efikasb()) { pwgt1 = regulator_get(NULL, "pwgt1");
pwgt1 = regulator_get(NULL, "pwgt1"); pwgt2 = regulator_get(NULL, "pwgt2");
pwgt2 = regulator_get(NULL, "pwgt2"); if (!IS_ERR(pwgt1) && !IS_ERR(pwgt2)) {
if (!IS_ERR(pwgt1) && !IS_ERR(pwgt2)) { regulator_enable(pwgt1);
regulator_enable(pwgt1); regulator_enable(pwgt2);
regulator_enable(pwgt2);
}
gpio_request(EFIKASB_POWEROFF, "poweroff");
pm_power_off = mx51_efikasb_power_off;
regulator_has_full_constraints();
} }
gpio_request(EFIKASB_POWEROFF, "poweroff");
pm_power_off = mx51_efikasb_power_off;
regulator_has_full_constraints();
return 0; return 0;
} }
late_initcall(mx51_efikasb_power_init);
static void __init mx51_efikasb_init_late(void)
{
imx51_init_late();
mx51_efikasb_power_init();
}
/* 01 R1.3 board /* 01 R1.3 board
10 R2.0 board */ 10 R2.0 board */
...@@ -287,6 +290,7 @@ MACHINE_START(MX51_EFIKASB, "Genesi Efika Smartbook") ...@@ -287,6 +290,7 @@ MACHINE_START(MX51_EFIKASB, "Genesi Efika Smartbook")
.init_irq = mx51_init_irq, .init_irq = mx51_init_irq,
.handle_irq = imx51_handle_irq, .handle_irq = imx51_handle_irq,
.init_machine = efikasb_board_init, .init_machine = efikasb_board_init,
.init_late = mx51_efikasb_init_late,
.timer = &mx51_efikasb_timer, .timer = &mx51_efikasb_timer,
.restart = mxc_restart, .restart = mxc_restart,
MACHINE_END MACHINE_END
...@@ -694,6 +694,11 @@ static void __init pcm037_reserve(void) ...@@ -694,6 +694,11 @@ static void __init pcm037_reserve(void)
MX3_CAMERA_BUF_SIZE); MX3_CAMERA_BUF_SIZE);
} }
static void __init pcm037_init_late(void)
{
pcm037_eet_init_devices();
}
MACHINE_START(PCM037, "Phytec Phycore pcm037") MACHINE_START(PCM037, "Phytec Phycore pcm037")
/* Maintainer: Pengutronix */ /* Maintainer: Pengutronix */
.atag_offset = 0x100, .atag_offset = 0x100,
...@@ -704,5 +709,6 @@ MACHINE_START(PCM037, "Phytec Phycore pcm037") ...@@ -704,5 +709,6 @@ MACHINE_START(PCM037, "Phytec Phycore pcm037")
.handle_irq = imx31_handle_irq, .handle_irq = imx31_handle_irq,
.timer = &pcm037_timer, .timer = &pcm037_timer,
.init_machine = pcm037_init, .init_machine = pcm037_init,
.init_late = pcm037_init_late,
.restart = mxc_restart, .restart = mxc_restart,
MACHINE_END MACHINE_END
...@@ -160,9 +160,9 @@ static const struct gpio_keys_platform_data ...@@ -160,9 +160,9 @@ static const struct gpio_keys_platform_data
.rep = 0, /* No auto-repeat */ .rep = 0, /* No auto-repeat */
}; };
static int __init eet_init_devices(void) int __init pcm037_eet_init_devices(void)
{ {
if (!machine_is_pcm037() || pcm037_variant() != PCM037_EET) if (pcm037_variant() != PCM037_EET)
return 0; return 0;
mxc_iomux_setup_multiple_pins(pcm037_eet_pins, mxc_iomux_setup_multiple_pins(pcm037_eet_pins,
...@@ -176,4 +176,3 @@ static int __init eet_init_devices(void) ...@@ -176,4 +176,3 @@ static int __init eet_init_devices(void)
return 0; return 0;
} }
late_initcall(eet_init_devices);
...@@ -234,3 +234,8 @@ void __init imx53_soc_init(void) ...@@ -234,3 +234,8 @@ void __init imx53_soc_init(void)
platform_device_register_simple("imx31-audmux", 0, imx53_audmux_res, platform_device_register_simple("imx31-audmux", 0, imx53_audmux_res,
ARRAY_SIZE(imx53_audmux_res)); ARRAY_SIZE(imx53_audmux_res));
} }
void __init imx51_init_late(void)
{
mx51_neon_fixup();
}
...@@ -8,4 +8,10 @@ enum pcm037_board_variant { ...@@ -8,4 +8,10 @@ enum pcm037_board_variant {
extern enum pcm037_board_variant pcm037_variant(void); extern enum pcm037_board_variant pcm037_variant(void);
#ifdef CONFIG_MACH_PCM037_EET
int pcm037_eet_init_devices(void);
#else
static inline int pcm037_eet_init_devices(void) { return 0; }
#endif
#endif #endif
...@@ -53,6 +53,7 @@ extern void imx35_soc_init(void); ...@@ -53,6 +53,7 @@ extern void imx35_soc_init(void);
extern void imx50_soc_init(void); extern void imx50_soc_init(void);
extern void imx51_soc_init(void); extern void imx51_soc_init(void);
extern void imx53_soc_init(void); extern void imx53_soc_init(void);
extern void imx51_init_late(void);
extern void epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq); extern void epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq);
extern void mxc_timer_init(struct clk *timer_clk, void __iomem *, int); extern void mxc_timer_init(struct clk *timer_clk, void __iomem *, int);
extern int mx1_clocks_init(unsigned long fref); extern int mx1_clocks_init(unsigned long fref);
...@@ -149,4 +150,10 @@ extern void imx6q_pm_init(void); ...@@ -149,4 +150,10 @@ extern void imx6q_pm_init(void);
static inline void imx6q_pm_init(void) {} static inline void imx6q_pm_init(void) {}
#endif #endif
#ifdef CONFIG_NEON
extern int mx51_neon_fixup(void);
#else
static inline int mx51_neon_fixup(void) { return 0; }
#endif
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment