mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-18 01:34:14 +08:00
f465d145d7
This is a patch series from Shawn Guo that moves from individual late_initcalls() to using a member in the machine structure to invoke a platform's late initcalls. This cleanup is a step in the move towards multiplatform kernels since it would reduce the need to check for compatible platforms in each and every initcall. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABAgAGBQJPwHYJAAoJEIwa5zzehBx3PugP/2Wd6HN030iO5EhFBcBcrh5T WaJ4KfzK3tWev5QA3idvenVNhk5My1HQ+PLij7BLpjNqKCKlNK0k/K9wMI5X827T wkFFprdUcoMVrB1ZCjzwCk4/uTGWB5BMxoZ6mlBh1sZIR/yXo91t+wO971Uqr0ho Ky1oW9uaPZ6Eja00iDLkfJfygquA5+zNb0a29q19zWnHlRkH76jtqZgfDKy9I2nq virYZ4uhoPnY2g1JxhnaMNNC861CgfTDEtmtNjgeEbA6t9bbjqsZoQRhcYHZP4OM a4Iu8FOyIvAAzQzUglfAZ4Ar4uYTmVRnG39XFh4wK/8tJYt0hEQwFS26B0pYKx/5 F76bwc4SqO7H9AWBF0WhyUbny5XmJcNwJjobm/oCeAvemTi3xA6BbubyfKMHPoIr dDSEqcAcMt9G6sS48h3Pm0caEYDVzxf202vdylz1JABiJZi1W/7v+NMdhujfotJh 7IGehNRu0foPEsRIS9wsvD2TzSdQtDdjyFkGHd83XMc3JpvwmyePO6ynbbxrVnJJ HzlPnbLIk3VyqyVCqVXj21NKEY1dbsYPItketAwwzc1BUGcld0qvQY/t/UI4JQT6 9vq77AwNjUhfomDdEWTp7aNx0whkY0R5KEY9jHjuu9WoE+xdPZbQKm589AJ6LA4U j6HPMzWKUHOKT6g10rCl =21h6 -----END PGP SIGNATURE----- Merge tag 'cleanup-initcall' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc Pull sweeping late_initcall cleanup for arm-soc from Olof Johansson: "This is a patch series from Shawn Guo that moves from individual late_initcalls() to using a member in the machine structure to invoke a platform's late initcalls. This cleanup is a step in the move towards multiplatform kernels since it would reduce the need to check for compatible platforms in each and every initcall." Fix up trivial conflicts in arch/arm/mach-{exynos/mach-universal_c210.c, imx/mach-cpuimx51.c, omap2/board-generic.c} due to changes nearby (and, in the case of cpuimx51.c the board support being deleted) * tag 'cleanup-initcall' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: ARM: ux500: use machine specific hook for late init ARM: tegra: use machine specific hook for late init ARM: shmobile: use machine specific hook for late init ARM: sa1100: use machine specific hook for late init ARM: s3c64xx: use machine specific hook for late init ARM: prima2: use machine specific hook for late init ARM: pnx4008: use machine specific hook for late init ARM: omap2: use machine specific hook for late init ARM: omap1: use machine specific hook for late init ARM: msm: use machine specific hook for late init ARM: imx: use machine specific hook for late init ARM: exynos: use machine specific hook for late init ARM: ep93xx: use machine specific hook for late init ARM: davinci: use machine specific hook for late init ARM: provide a late_initcall hook for platform initialization
125 lines
4.1 KiB
C
125 lines
4.1 KiB
C
/*
|
|
* Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
|
|
* Copyright 2011 Linaro Ltd.
|
|
*
|
|
* The code contained herein is licensed under the GNU General Public
|
|
* License. You may obtain a copy of the GNU General Public License
|
|
* Version 2 or later at the following locations:
|
|
*
|
|
* http://www.opensource.org/licenses/gpl-license.html
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
*/
|
|
|
|
#include <linux/irq.h>
|
|
#include <linux/irqdomain.h>
|
|
#include <linux/of_irq.h>
|
|
#include <linux/of_platform.h>
|
|
#include <linux/pinctrl/machine.h>
|
|
#include <asm/mach/arch.h>
|
|
#include <asm/mach/time.h>
|
|
#include <mach/common.h>
|
|
#include <mach/mx51.h>
|
|
|
|
/*
|
|
* Lookup table for attaching a specific name and platform_data pointer to
|
|
* devices as they get created by of_platform_populate(). Ideally this table
|
|
* would not exist, but the current clock implementation depends on some devices
|
|
* having a specific name.
|
|
*/
|
|
static const struct of_dev_auxdata imx51_auxdata_lookup[] __initconst = {
|
|
OF_DEV_AUXDATA("fsl,imx51-uart", MX51_UART1_BASE_ADDR, "imx21-uart.0", NULL),
|
|
OF_DEV_AUXDATA("fsl,imx51-uart", MX51_UART2_BASE_ADDR, "imx21-uart.1", NULL),
|
|
OF_DEV_AUXDATA("fsl,imx51-uart", MX51_UART3_BASE_ADDR, "imx21-uart.2", NULL),
|
|
OF_DEV_AUXDATA("fsl,imx51-fec", MX51_FEC_BASE_ADDR, "imx27-fec.0", NULL),
|
|
OF_DEV_AUXDATA("fsl,imx51-esdhc", MX51_ESDHC1_BASE_ADDR, "sdhci-esdhc-imx51.0", NULL),
|
|
OF_DEV_AUXDATA("fsl,imx51-esdhc", MX51_ESDHC2_BASE_ADDR, "sdhci-esdhc-imx51.1", NULL),
|
|
OF_DEV_AUXDATA("fsl,imx51-esdhc", MX51_ESDHC3_BASE_ADDR, "sdhci-esdhc-imx51.2", NULL),
|
|
OF_DEV_AUXDATA("fsl,imx51-esdhc", MX51_ESDHC4_BASE_ADDR, "sdhci-esdhc-imx51.3", NULL),
|
|
OF_DEV_AUXDATA("fsl,imx51-ecspi", MX51_ECSPI1_BASE_ADDR, "imx51-ecspi.0", NULL),
|
|
OF_DEV_AUXDATA("fsl,imx51-ecspi", MX51_ECSPI2_BASE_ADDR, "imx51-ecspi.1", NULL),
|
|
OF_DEV_AUXDATA("fsl,imx51-cspi", MX51_CSPI_BASE_ADDR, "imx35-cspi.0", NULL),
|
|
OF_DEV_AUXDATA("fsl,imx51-i2c", MX51_I2C1_BASE_ADDR, "imx-i2c.0", NULL),
|
|
OF_DEV_AUXDATA("fsl,imx51-i2c", MX51_I2C2_BASE_ADDR, "imx-i2c.1", NULL),
|
|
OF_DEV_AUXDATA("fsl,imx51-sdma", MX51_SDMA_BASE_ADDR, "imx35-sdma", NULL),
|
|
OF_DEV_AUXDATA("fsl,imx51-wdt", MX51_WDOG1_BASE_ADDR, "imx2-wdt.0", NULL),
|
|
{ /* sentinel */ }
|
|
};
|
|
|
|
static int __init imx51_tzic_add_irq_domain(struct device_node *np,
|
|
struct device_node *interrupt_parent)
|
|
{
|
|
irq_domain_add_legacy(np, 128, 0, 0, &irq_domain_simple_ops, NULL);
|
|
return 0;
|
|
}
|
|
|
|
static int __init imx51_gpio_add_irq_domain(struct device_node *np,
|
|
struct device_node *interrupt_parent)
|
|
{
|
|
static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS;
|
|
|
|
gpio_irq_base -= 32;
|
|
irq_domain_add_legacy(np, 32, gpio_irq_base, 0, &irq_domain_simple_ops, NULL);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const struct of_device_id imx51_irq_match[] __initconst = {
|
|
{ .compatible = "fsl,imx51-tzic", .data = imx51_tzic_add_irq_domain, },
|
|
{ .compatible = "fsl,imx51-gpio", .data = imx51_gpio_add_irq_domain, },
|
|
{ /* sentinel */ }
|
|
};
|
|
|
|
static const struct of_device_id imx51_iomuxc_of_match[] __initconst = {
|
|
{ .compatible = "fsl,imx51-iomuxc-babbage", .data = imx51_babbage_common_init, },
|
|
{ /* sentinel */ }
|
|
};
|
|
|
|
static void __init imx51_dt_init(void)
|
|
{
|
|
struct device_node *node;
|
|
const struct of_device_id *of_id;
|
|
void (*func)(void);
|
|
|
|
of_irq_init(imx51_irq_match);
|
|
|
|
pinctrl_provide_dummies();
|
|
|
|
node = of_find_matching_node(NULL, imx51_iomuxc_of_match);
|
|
if (node) {
|
|
of_id = of_match_node(imx51_iomuxc_of_match, node);
|
|
func = of_id->data;
|
|
func();
|
|
of_node_put(node);
|
|
}
|
|
|
|
of_platform_populate(NULL, of_default_bus_match_table,
|
|
imx51_auxdata_lookup, NULL);
|
|
}
|
|
|
|
static void __init imx51_timer_init(void)
|
|
{
|
|
mx51_clocks_init_dt();
|
|
}
|
|
|
|
static struct sys_timer imx51_timer = {
|
|
.init = imx51_timer_init,
|
|
};
|
|
|
|
static const char *imx51_dt_board_compat[] __initdata = {
|
|
"fsl,imx51-babbage",
|
|
"fsl,imx51",
|
|
NULL
|
|
};
|
|
|
|
DT_MACHINE_START(IMX51_DT, "Freescale i.MX51 (Device Tree Support)")
|
|
.map_io = mx51_map_io,
|
|
.init_early = imx51_init_early,
|
|
.init_irq = mx51_init_irq,
|
|
.handle_irq = imx51_handle_irq,
|
|
.timer = &imx51_timer,
|
|
.init_machine = imx51_dt_init,
|
|
.init_late = imx51_init_late,
|
|
.dt_compat = imx51_dt_board_compat,
|
|
.restart = mxc_restart,
|
|
MACHINE_END
|