Kukjin Kim | b3e68fb | 2012-02-10 13:13:15 +0900 | [diff] [blame] | 1 | /* |
| 2 | * SAMSUNG EXYNOS5250 Flattened Device Tree enabled machine |
| 3 | * |
| 4 | * Copyright (c) 2012 Samsung Electronics Co., Ltd. |
| 5 | * http://www.samsung.com |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/of_platform.h> |
| 13 | #include <linux/serial_core.h> |
Arun Kumar K | 2eae613 | 2012-10-23 22:51:33 +0900 | [diff] [blame^] | 14 | #include <linux/memblock.h> |
| 15 | #include <linux/of_fdt.h> |
Kukjin Kim | b3e68fb | 2012-02-10 13:13:15 +0900 | [diff] [blame] | 16 | |
| 17 | #include <asm/mach/arch.h> |
| 18 | #include <asm/hardware/gic.h> |
| 19 | #include <mach/map.h> |
| 20 | |
| 21 | #include <plat/cpu.h> |
| 22 | #include <plat/regs-serial.h> |
Arun Kumar K | 2eae613 | 2012-10-23 22:51:33 +0900 | [diff] [blame^] | 23 | #include <plat/mfc.h> |
Kukjin Kim | b3e68fb | 2012-02-10 13:13:15 +0900 | [diff] [blame] | 24 | |
| 25 | #include "common.h" |
| 26 | |
| 27 | /* |
| 28 | * The following lookup table is used to override device names when devices |
| 29 | * are registered from device tree. This is temporarily added to enable |
| 30 | * device tree support addition for the EXYNOS5 architecture. |
| 31 | * |
| 32 | * For drivers that require platform data to be provided from the machine |
| 33 | * file, a platform data pointer can also be supplied along with the |
| 34 | * devices names. Usually, the platform data elements that cannot be parsed |
| 35 | * from the device tree by the drivers (example: function pointers) are |
| 36 | * supplied. But it should be noted that this is a temporary mechanism and |
| 37 | * at some point, the drivers should be capable of parsing all the platform |
| 38 | * data from the device tree. |
| 39 | */ |
| 40 | static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = { |
| 41 | OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART0, |
| 42 | "exynos4210-uart.0", NULL), |
| 43 | OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART1, |
| 44 | "exynos4210-uart.1", NULL), |
| 45 | OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART2, |
| 46 | "exynos4210-uart.2", NULL), |
| 47 | OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART3, |
| 48 | "exynos4210-uart.3", NULL), |
Thomas Abraham | 380c3a5 | 2012-05-15 15:56:57 +0900 | [diff] [blame] | 49 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(0), |
| 50 | "s3c2440-i2c.0", NULL), |
| 51 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(1), |
| 52 | "s3c2440-i2c.1", NULL), |
Thomas Abraham | a5c1777 | 2012-09-26 08:54:42 +0900 | [diff] [blame] | 53 | OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI0, |
| 54 | "dw_mmc.0", NULL), |
| 55 | OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI1, |
| 56 | "dw_mmc.1", NULL), |
| 57 | OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI2, |
| 58 | "dw_mmc.2", NULL), |
| 59 | OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI3, |
| 60 | "dw_mmc.3", NULL), |
Thomas Abraham | b0b2781 | 2012-07-14 10:54:31 +0900 | [diff] [blame] | 61 | OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI0, |
| 62 | "exynos4210-spi.0", NULL), |
| 63 | OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI1, |
| 64 | "exynos4210-spi.1", NULL), |
| 65 | OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI2, |
| 66 | "exynos4210-spi.2", NULL), |
Kukjin Kim | b3e68fb | 2012-02-10 13:13:15 +0900 | [diff] [blame] | 67 | OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL), |
| 68 | OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL), |
Thomas Abraham | 6080622 | 2012-04-10 08:37:59 -0700 | [diff] [blame] | 69 | OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL), |
Shaik Ameer Basha | 1128658 | 2012-09-07 14:13:08 +0900 | [diff] [blame] | 70 | OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC0, |
| 71 | "exynos-gsc.0", NULL), |
| 72 | OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC1, |
| 73 | "exynos-gsc.1", NULL), |
| 74 | OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC2, |
| 75 | "exynos-gsc.2", NULL), |
| 76 | OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC3, |
| 77 | "exynos-gsc.3", NULL), |
Arun Kumar K | 2eae613 | 2012-10-23 22:51:33 +0900 | [diff] [blame^] | 78 | OF_DEV_AUXDATA("samsung,mfc-v6", 0x11000000, "s5p-mfc-v6", NULL), |
Kukjin Kim | b3e68fb | 2012-02-10 13:13:15 +0900 | [diff] [blame] | 79 | {}, |
| 80 | }; |
| 81 | |
| 82 | static void __init exynos5250_dt_map_io(void) |
| 83 | { |
| 84 | exynos_init_io(NULL, 0); |
| 85 | s3c24xx_init_clocks(24000000); |
| 86 | } |
| 87 | |
| 88 | static void __init exynos5250_dt_machine_init(void) |
| 89 | { |
| 90 | of_platform_populate(NULL, of_default_bus_match_table, |
| 91 | exynos5250_auxdata_lookup, NULL); |
| 92 | } |
| 93 | |
| 94 | static char const *exynos5250_dt_compat[] __initdata = { |
| 95 | "samsung,exynos5250", |
| 96 | NULL |
| 97 | }; |
| 98 | |
Arun Kumar K | 2eae613 | 2012-10-23 22:51:33 +0900 | [diff] [blame^] | 99 | static void __init exynos5_reserve(void) |
| 100 | { |
| 101 | struct s5p_mfc_dt_meminfo mfc_mem; |
| 102 | |
| 103 | /* Reserve memory for MFC only if it's available */ |
| 104 | mfc_mem.compatible = "samsung,mfc-v6"; |
| 105 | if (of_scan_flat_dt(s5p_fdt_find_mfc_mem, &mfc_mem)) |
| 106 | s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize, mfc_mem.loff, |
| 107 | mfc_mem.lsize); |
| 108 | } |
| 109 | |
Kukjin Kim | b3e68fb | 2012-02-10 13:13:15 +0900 | [diff] [blame] | 110 | DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)") |
| 111 | /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ |
| 112 | .init_irq = exynos5_init_irq, |
Marc Zyngier | 06853ae | 2011-09-08 13:15:22 +0100 | [diff] [blame] | 113 | .smp = smp_ops(exynos_smp_ops), |
Kukjin Kim | b3e68fb | 2012-02-10 13:13:15 +0900 | [diff] [blame] | 114 | .map_io = exynos5250_dt_map_io, |
| 115 | .handle_irq = gic_handle_irq, |
| 116 | .init_machine = exynos5250_dt_machine_init, |
Shawn Guo | bb13fab | 2012-04-26 10:35:40 +0800 | [diff] [blame] | 117 | .init_late = exynos_init_late, |
Kukjin Kim | b3e68fb | 2012-02-10 13:13:15 +0900 | [diff] [blame] | 118 | .timer = &exynos4_timer, |
| 119 | .dt_compat = exynos5250_dt_compat, |
| 120 | .restart = exynos5_restart, |
Arun Kumar K | 2eae613 | 2012-10-23 22:51:33 +0900 | [diff] [blame^] | 121 | .reserve = exynos5_reserve, |
Kukjin Kim | b3e68fb | 2012-02-10 13:13:15 +0900 | [diff] [blame] | 122 | MACHINE_END |