Heiko Stuebner | 35aca36 | 2013-05-21 01:06:04 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Samsung's S3C2416 flattened device tree enabled machine |
| 3 | * |
| 4 | * Copyright (c) 2012 Heiko Stuebner <heiko@sntech.de> |
| 5 | * |
| 6 | * based on mach-exynos/mach-exynos4-dt.c |
| 7 | * |
| 8 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. |
| 9 | * http://www.samsung.com |
| 10 | * Copyright (c) 2010-2011 Linaro Ltd. |
| 11 | * www.linaro.org |
| 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of the GNU General Public License version 2 as |
| 15 | * published by the Free Software Foundation. |
| 16 | */ |
| 17 | |
| 18 | #include <linux/clocksource.h> |
| 19 | #include <linux/irqchip.h> |
| 20 | #include <linux/of_platform.h> |
| 21 | #include <linux/serial_core.h> |
Tushar Behera | 334a1c7 | 2014-02-14 10:32:45 +0900 | [diff] [blame] | 22 | #include <linux/serial_s3c.h> |
Heiko Stuebner | 35aca36 | 2013-05-21 01:06:04 +0900 | [diff] [blame] | 23 | |
| 24 | #include <asm/mach/arch.h> |
| 25 | #include <mach/map.h> |
| 26 | |
| 27 | #include <plat/cpu.h> |
| 28 | #include <plat/pm.h> |
Heiko Stuebner | 35aca36 | 2013-05-21 01:06:04 +0900 | [diff] [blame] | 29 | |
| 30 | #include "common.h" |
| 31 | |
| 32 | /* |
| 33 | * The following lookup table is used to override device names when devices |
| 34 | * are registered from device tree. This is temporarily added to enable |
| 35 | * device tree support addition for the S3C2416 architecture. |
| 36 | * |
| 37 | * For drivers that require platform data to be provided from the machine |
| 38 | * file, a platform data pointer can also be supplied along with the |
| 39 | * devices names. Usually, the platform data elements that cannot be parsed |
| 40 | * from the device tree by the drivers (example: function pointers) are |
| 41 | * supplied. But it should be noted that this is a temporary mechanism and |
| 42 | * at some point, the drivers should be capable of parsing all the platform |
| 43 | * data from the device tree. |
| 44 | */ |
| 45 | static const struct of_dev_auxdata s3c2416_auxdata_lookup[] __initconst = { |
Heiko Stuebner | 52c76e4 | 2013-06-19 02:40:18 +0900 | [diff] [blame] | 46 | OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART, |
Heiko Stuebner | 35aca36 | 2013-05-21 01:06:04 +0900 | [diff] [blame] | 47 | "s3c2440-uart.0", NULL), |
Heiko Stuebner | 52c76e4 | 2013-06-19 02:40:18 +0900 | [diff] [blame] | 48 | OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART + 0x4000, |
Heiko Stuebner | 35aca36 | 2013-05-21 01:06:04 +0900 | [diff] [blame] | 49 | "s3c2440-uart.1", NULL), |
Heiko Stuebner | 52c76e4 | 2013-06-19 02:40:18 +0900 | [diff] [blame] | 50 | OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART + 0x8000, |
Heiko Stuebner | 35aca36 | 2013-05-21 01:06:04 +0900 | [diff] [blame] | 51 | "s3c2440-uart.2", NULL), |
Heiko Stuebner | 52c76e4 | 2013-06-19 02:40:18 +0900 | [diff] [blame] | 52 | OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART + 0xC000, |
Heiko Stuebner | 35aca36 | 2013-05-21 01:06:04 +0900 | [diff] [blame] | 53 | "s3c2440-uart.3", NULL), |
| 54 | OF_DEV_AUXDATA("samsung,s3c6410-sdhci", S3C_PA_HSMMC0, |
| 55 | "s3c-sdhci.0", NULL), |
| 56 | OF_DEV_AUXDATA("samsung,s3c6410-sdhci", S3C_PA_HSMMC1, |
| 57 | "s3c-sdhci.1", NULL), |
| 58 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", S3C_PA_IIC, |
| 59 | "s3c2440-i2c.0", NULL), |
| 60 | {}, |
| 61 | }; |
| 62 | |
| 63 | static void __init s3c2416_dt_map_io(void) |
| 64 | { |
| 65 | s3c24xx_init_io(NULL, 0); |
| 66 | s3c24xx_init_clocks(12000000); |
| 67 | } |
| 68 | |
| 69 | static void __init s3c2416_dt_machine_init(void) |
| 70 | { |
| 71 | of_platform_populate(NULL, of_default_bus_match_table, |
| 72 | s3c2416_auxdata_lookup, NULL); |
| 73 | |
| 74 | s3c_pm_init(); |
| 75 | } |
| 76 | |
| 77 | static char const *s3c2416_dt_compat[] __initdata = { |
| 78 | "samsung,s3c2416", |
| 79 | "samsung,s3c2450", |
| 80 | NULL |
| 81 | }; |
| 82 | |
| 83 | DT_MACHINE_START(S3C2416_DT, "Samsung S3C2416 (Flattened Device Tree)") |
| 84 | /* Maintainer: Heiko Stuebner <heiko@sntech.de> */ |
| 85 | .dt_compat = s3c2416_dt_compat, |
| 86 | .map_io = s3c2416_dt_map_io, |
| 87 | .init_irq = irqchip_init, |
| 88 | .init_machine = s3c2416_dt_machine_init, |
| 89 | .init_time = clocksource_of_init, |
| 90 | .restart = s3c2416_restart, |
| 91 | MACHINE_END |