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 | |
Shawn Guo | ff4ab23 | 2014-05-20 15:34:06 +0800 | [diff] [blame] | 13 | #include <linux/io.h> |
Shawn Guo | 9daaf31 | 2011-10-17 08:42:17 +0800 | [diff] [blame] | 14 | #include <linux/irq.h> |
Shawn Guo | 9daaf31 | 2011-10-17 08:42:17 +0800 | [diff] [blame] | 15 | #include <linux/of_irq.h> |
| 16 | #include <linux/of_platform.h> |
| 17 | #include <asm/mach/arch.h> |
| 18 | #include <asm/mach/time.h> |
Shawn Guo | 9daaf31 | 2011-10-17 08:42:17 +0800 | [diff] [blame] | 19 | |
Shawn Guo | e337247 | 2012-09-13 21:01:00 +0800 | [diff] [blame] | 20 | #include "common.h" |
Shawn Guo | ff4ab23 | 2014-05-20 15:34:06 +0800 | [diff] [blame] | 21 | #include "hardware.h" |
Shawn Guo | e337247 | 2012-09-13 21:01:00 +0800 | [diff] [blame] | 22 | |
Shawn Guo | ff4ab23 | 2014-05-20 15:34:06 +0800 | [diff] [blame] | 23 | static void __init imx51_init_early(void) |
| 24 | { |
| 25 | mxc_set_cpu_type(MXC_CPU_MX51); |
| 26 | } |
| 27 | |
| 28 | /* |
| 29 | * The MIPI HSC unit has been removed from the i.MX51 Reference Manual by |
| 30 | * the Freescale marketing division. However this did not remove the |
| 31 | * hardware from the chip which still needs to be configured for proper |
| 32 | * IPU support. |
| 33 | */ |
| 34 | #define MX51_MIPI_HSC_BASE 0x83fdc000 |
| 35 | static void __init imx51_ipu_mipi_setup(void) |
| 36 | { |
| 37 | void __iomem *hsc_addr; |
| 38 | |
| 39 | hsc_addr = ioremap(MX51_MIPI_HSC_BASE, SZ_16K); |
| 40 | WARN_ON(!hsc_addr); |
| 41 | |
| 42 | /* setup MIPI module to legacy mode */ |
Johannes Berg | c553138 | 2016-01-27 17:59:35 +0100 | [diff] [blame] | 43 | imx_writel(0xf00, hsc_addr); |
Shawn Guo | ff4ab23 | 2014-05-20 15:34:06 +0800 | [diff] [blame] | 44 | |
| 45 | /* CSI mode: reserved; DI control mode: legacy (from Freescale BSP) */ |
Johannes Berg | c553138 | 2016-01-27 17:59:35 +0100 | [diff] [blame] | 46 | imx_writel(imx_readl(hsc_addr + 0x800) | 0x30ff, hsc_addr + 0x800); |
Shawn Guo | ff4ab23 | 2014-05-20 15:34:06 +0800 | [diff] [blame] | 47 | |
| 48 | iounmap(hsc_addr); |
| 49 | } |
| 50 | |
Shawn Guo | 9daaf31 | 2011-10-17 08:42:17 +0800 | [diff] [blame] | 51 | static void __init imx51_dt_init(void) |
| 52 | { |
Shawn Guo | ff4ab23 | 2014-05-20 15:34:06 +0800 | [diff] [blame] | 53 | imx51_ipu_mipi_setup(); |
| 54 | imx_src_init(); |
Shawn Guo | 18cb680 | 2013-05-10 09:13:44 +0800 | [diff] [blame] | 55 | |
Alexander Shiyan | 463f90f | 2016-06-25 08:26:15 +0300 | [diff] [blame] | 56 | imx_aips_allow_unprivileged_access("fsl,imx51-aipstz"); |
Shawn Guo | 9daaf31 | 2011-10-17 08:42:17 +0800 | [diff] [blame] | 57 | } |
| 58 | |
Shawn Guo | ff4ab23 | 2014-05-20 15:34:06 +0800 | [diff] [blame] | 59 | static void __init imx51_init_late(void) |
| 60 | { |
| 61 | mx51_neon_fixup(); |
| 62 | imx51_pm_init(); |
| 63 | } |
| 64 | |
Shawn Guo | 8756dd9 | 2014-07-01 16:03:00 +0800 | [diff] [blame] | 65 | static const char * const imx51_dt_board_compat[] __initconst = { |
Sascha Hauer | 3f8976d | 2012-02-17 12:07:00 +0100 | [diff] [blame] | 66 | "fsl,imx51", |
Shawn Guo | 9daaf31 | 2011-10-17 08:42:17 +0800 | [diff] [blame] | 67 | NULL |
| 68 | }; |
| 69 | |
| 70 | DT_MACHINE_START(IMX51_DT, "Freescale i.MX51 (Device Tree Support)") |
Shawn Guo | 9daaf31 | 2011-10-17 08:42:17 +0800 | [diff] [blame] | 71 | .init_early = imx51_init_early, |
Shawn Guo | 9daaf31 | 2011-10-17 08:42:17 +0800 | [diff] [blame] | 72 | .init_machine = imx51_dt_init, |
Shawn Guo | 8321b75 | 2012-04-26 11:42:34 +0800 | [diff] [blame] | 73 | .init_late = imx51_init_late, |
Shawn Guo | 9daaf31 | 2011-10-17 08:42:17 +0800 | [diff] [blame] | 74 | .dt_compat = imx51_dt_board_compat, |
Shawn Guo | 9daaf31 | 2011-10-17 08:42:17 +0800 | [diff] [blame] | 75 | MACHINE_END |