Shawn Guo | 9daaf31 | 2011-10-17 08:42:17 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved. |
| 3 | * Copyright 2011 Linaro Ltd. |
| 4 | * |
| 5 | * The code contained herein is licensed under the GNU General Public |
| 6 | * License. You may obtain a copy of the GNU General Public License |
| 7 | * Version 2 or later at the following locations: |
| 8 | * |
| 9 | * http://www.opensource.org/licenses/gpl-license.html |
| 10 | * http://www.gnu.org/copyleft/gpl.html |
| 11 | */ |
| 12 | |
| 13 | #include <linux/irq.h> |
Shawn Guo | 9daaf31 | 2011-10-17 08:42:17 +0800 | [diff] [blame] | 14 | #include <linux/of_irq.h> |
| 15 | #include <linux/of_platform.h> |
| 16 | #include <asm/mach/arch.h> |
| 17 | #include <asm/mach/time.h> |
Shawn Guo | 9daaf31 | 2011-10-17 08:42:17 +0800 | [diff] [blame] | 18 | |
Shawn Guo | e337247 | 2012-09-13 21:01:00 +0800 | [diff] [blame] | 19 | #include "common.h" |
Shawn Guo | 50f2de6 | 2012-09-14 14:14:45 +0800 | [diff] [blame] | 20 | #include "mx51.h" |
Shawn Guo | e337247 | 2012-09-13 21:01:00 +0800 | [diff] [blame] | 21 | |
Shawn Guo | 9daaf31 | 2011-10-17 08:42:17 +0800 | [diff] [blame] | 22 | /* |
| 23 | * Lookup table for attaching a specific name and platform_data pointer to |
| 24 | * devices as they get created by of_platform_populate(). Ideally this table |
| 25 | * would not exist, but the current clock implementation depends on some devices |
| 26 | * having a specific name. |
| 27 | */ |
| 28 | static const struct of_dev_auxdata imx51_auxdata_lookup[] __initconst = { |
| 29 | OF_DEV_AUXDATA("fsl,imx51-uart", MX51_UART1_BASE_ADDR, "imx21-uart.0", NULL), |
| 30 | OF_DEV_AUXDATA("fsl,imx51-uart", MX51_UART2_BASE_ADDR, "imx21-uart.1", NULL), |
| 31 | OF_DEV_AUXDATA("fsl,imx51-uart", MX51_UART3_BASE_ADDR, "imx21-uart.2", NULL), |
| 32 | OF_DEV_AUXDATA("fsl,imx51-fec", MX51_FEC_BASE_ADDR, "imx27-fec.0", NULL), |
| 33 | OF_DEV_AUXDATA("fsl,imx51-esdhc", MX51_ESDHC1_BASE_ADDR, "sdhci-esdhc-imx51.0", NULL), |
| 34 | OF_DEV_AUXDATA("fsl,imx51-esdhc", MX51_ESDHC2_BASE_ADDR, "sdhci-esdhc-imx51.1", NULL), |
| 35 | OF_DEV_AUXDATA("fsl,imx51-esdhc", MX51_ESDHC3_BASE_ADDR, "sdhci-esdhc-imx51.2", NULL), |
| 36 | OF_DEV_AUXDATA("fsl,imx51-esdhc", MX51_ESDHC4_BASE_ADDR, "sdhci-esdhc-imx51.3", NULL), |
| 37 | OF_DEV_AUXDATA("fsl,imx51-ecspi", MX51_ECSPI1_BASE_ADDR, "imx51-ecspi.0", NULL), |
| 38 | OF_DEV_AUXDATA("fsl,imx51-ecspi", MX51_ECSPI2_BASE_ADDR, "imx51-ecspi.1", NULL), |
| 39 | OF_DEV_AUXDATA("fsl,imx51-cspi", MX51_CSPI_BASE_ADDR, "imx35-cspi.0", NULL), |
Shawn Guo | 5bdfba2 | 2012-09-14 15:19:00 +0800 | [diff] [blame] | 40 | OF_DEV_AUXDATA("fsl,imx51-i2c", MX51_I2C1_BASE_ADDR, "imx21-i2c.0", NULL), |
| 41 | OF_DEV_AUXDATA("fsl,imx51-i2c", MX51_I2C2_BASE_ADDR, "imx21-i2c.1", NULL), |
Shawn Guo | 9daaf31 | 2011-10-17 08:42:17 +0800 | [diff] [blame] | 42 | OF_DEV_AUXDATA("fsl,imx51-sdma", MX51_SDMA_BASE_ADDR, "imx35-sdma", NULL), |
| 43 | OF_DEV_AUXDATA("fsl,imx51-wdt", MX51_WDOG1_BASE_ADDR, "imx2-wdt.0", NULL), |
| 44 | { /* sentinel */ } |
| 45 | }; |
| 46 | |
Shawn Guo | 9daaf31 | 2011-10-17 08:42:17 +0800 | [diff] [blame] | 47 | static void __init imx51_dt_init(void) |
| 48 | { |
Shawn Guo | 9daaf31 | 2011-10-17 08:42:17 +0800 | [diff] [blame] | 49 | of_platform_populate(NULL, of_default_bus_match_table, |
| 50 | imx51_auxdata_lookup, NULL); |
| 51 | } |
| 52 | |
| 53 | static void __init imx51_timer_init(void) |
| 54 | { |
| 55 | mx51_clocks_init_dt(); |
| 56 | } |
| 57 | |
| 58 | static struct sys_timer imx51_timer = { |
| 59 | .init = imx51_timer_init, |
| 60 | }; |
| 61 | |
| 62 | static const char *imx51_dt_board_compat[] __initdata = { |
Sascha Hauer | 3f8976d | 2012-02-17 12:07:00 +0100 | [diff] [blame] | 63 | "fsl,imx51", |
Shawn Guo | 9daaf31 | 2011-10-17 08:42:17 +0800 | [diff] [blame] | 64 | NULL |
| 65 | }; |
| 66 | |
| 67 | DT_MACHINE_START(IMX51_DT, "Freescale i.MX51 (Device Tree Support)") |
| 68 | .map_io = mx51_map_io, |
| 69 | .init_early = imx51_init_early, |
| 70 | .init_irq = mx51_init_irq, |
| 71 | .handle_irq = imx51_handle_irq, |
| 72 | .timer = &imx51_timer, |
| 73 | .init_machine = imx51_dt_init, |
Shawn Guo | 8321b75 | 2012-04-26 11:42:34 +0800 | [diff] [blame] | 74 | .init_late = imx51_init_late, |
Shawn Guo | 9daaf31 | 2011-10-17 08:42:17 +0800 | [diff] [blame] | 75 | .dt_compat = imx51_dt_board_compat, |
Russell King | 65ea788 | 2011-11-06 17:12:08 +0000 | [diff] [blame] | 76 | .restart = mxc_restart, |
Shawn Guo | 9daaf31 | 2011-10-17 08:42:17 +0800 | [diff] [blame] | 77 | MACHINE_END |