From patchwork Sat Feb 12 12:46:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: thomas.abraham@linaro.org X-Patchwork-Id: 135 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:40:15 -0000 Delivered-To: patches@linaro.org Received: by 10.147.124.5 with SMTP id b5cs261050yan; Sat, 12 Feb 2011 04:49:14 -0800 (PST) Received: by 10.42.175.65 with SMTP id az1mr2135961icb.192.1297514951586; Sat, 12 Feb 2011 04:49:11 -0800 (PST) Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by mx.google.com with ESMTP id c4si1223263ict.30.2011.02.12.04.49.11; Sat, 12 Feb 2011 04:49:11 -0800 (PST) Received-SPF: neutral (google.com: 203.254.224.33 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=203.254.224.33; Authentication-Results: mx.google.com; spf=neutral (google.com: 203.254.224.33 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) smtp.mail=thomas.abraham@linaro.org Received: from epmmp2 (mailout3.samsung.com [203.254.224.33]) by mailout3.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0LGI008LE8XWNV90@mailout3.samsung.com> for patches@linaro.org; Sat, 12 Feb 2011 21:49:08 +0900 (KST) Received: from localhost.localdomain ([107.108.73.37]) by mmp2.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LGI00IEA8XP10@mmp2.samsung.com> for patches@linaro.org; Sat, 12 Feb 2011 21:49:08 +0900 (KST) Date: Sat, 12 Feb 2011 18:16:59 +0530 From: Thomas Abraham Subject: [PATCH 1/7] ARM: s5pv310-dt: Add s5pv310 machine with device tree support In-reply-to: <1297514825-10345-1-git-send-email-thomas.abraham@linaro.org> To: devicetree-discuss@lists.ozlabs.org Cc: kgene.kim@samsung.com, grant.likely@secretlab.ca, linaro-dev@lists.linaro.org, patches@linaro.org Message-id: <1297514825-10345-2-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 Content-transfer-encoding: 7BIT References: <1297514825-10345-1-git-send-email-thomas.abraham@linaro.org> This patch adds a new Samsung's s5pv310 machine that boots with a minimal device tree support. The bootargs, memory information, console port register defaults and external crystal frequency are obtained from the device tree during boot. Signed-off-by: Thomas Abraham --- arch/arm/mach-s5pv310/Kconfig | 7 +++ arch/arm/mach-s5pv310/Makefile | 1 + arch/arm/mach-s5pv310/mach-s5pv310-dt.c | 73 +++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-s5pv310/mach-s5pv310-dt.c diff --git a/arch/arm/mach-s5pv310/Kconfig b/arch/arm/mach-s5pv310/Kconfig index 09c4c21..f0c1afd 100644 --- a/arch/arm/mach-s5pv310/Kconfig +++ b/arch/arm/mach-s5pv310/Kconfig @@ -127,6 +127,13 @@ config MACH_SMDKV310 help Machine support for Samsung SMDKV310 +config MACH_S5PV310_DT + bool "S5PV310 with device tree support" + select CPU_S5PV310 + select USE_OF + help + Machine support for Samsung's S5PV310 SoC with device tree based initialization. + endmenu comment "Configuration for HSMMC bus width" diff --git a/arch/arm/mach-s5pv310/Makefile b/arch/arm/mach-s5pv310/Makefile index 036fb38..7fa7842 100644 --- a/arch/arm/mach-s5pv310/Makefile +++ b/arch/arm/mach-s5pv310/Makefile @@ -24,6 +24,7 @@ obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o obj-$(CONFIG_MACH_SMDKC210) += mach-smdkc210.o obj-$(CONFIG_MACH_SMDKV310) += mach-smdkv310.o +obj-$(CONFIG_MACH_S5PV310_DT) += mach-s5pv310-dt.o obj-$(CONFIG_MACH_UNIVERSAL_C210) += mach-universal_c210.o # device support diff --git a/arch/arm/mach-s5pv310/mach-s5pv310-dt.c b/arch/arm/mach-s5pv310/mach-s5pv310-dt.c new file mode 100644 index 0000000..a5e33ff --- /dev/null +++ b/arch/arm/mach-s5pv310/mach-s5pv310-dt.c @@ -0,0 +1,73 @@ +/* + * Samsung's S5PV310 machine with device tree enabled. + * Copyright (c) 2011 Samsung Electronics Co., Ltd. + * http://www.samsung.com/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +*/ + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +/* + * Platfrom data for uart devices. Some elements of the platform data will + * be set by the s5pv310 platform code and the rest will be obtained from the + * device tree. TODO: remove this when driver is able to obtain all the + * platform data information from the device tree. + */ +static struct s3c2410_uartcfg uartcfgs[CONFIG_SERIAL_SAMSUNG_UARTS] __initdata; + +static void __init s5pv310_dt_map_io(void) +{ + s5p_init_io(NULL, 0, S5P_VA_CHIPID); +} + +static void s5pv310_dt_init_early(void) +{ + int i; + unsigned int *xtal_freq; + + xtal_freq = (u32 *)of_get_property(of_chosen, "xtal-frequency", NULL); + if (!xtal_freq) { + printk(KERN_ERR "Ext crystal clock frequency not specified\n"); + panic("Unknown external crystal clock frequency"); + } + + s3c24xx_init_clocks(be32_to_cpu(*xtal_freq)); + + for (i = 0; i < CONFIG_SERIAL_SAMSUNG_UARTS; i++) { + uartcfgs[i].hwport = i; + uartcfgs[i].flags = 0; + } + s3c24xx_init_uarts(uartcfgs, ARRAY_SIZE(uartcfgs)); +} + +static char const *s5pv310_dt_compat[] = { + "samsung,s5pv310", + NULL +}; + +MACHINE_START(S5PV310_DT, "Samsung's S5PV310 with flattened device tree") + /* Maintainer: Kukjin Kim */ + /* Maintainer: Changhwan Youn */ + .init_irq = s5pv310_init_irq, + .map_io = s5pv310_dt_map_io, + .timer = &s5pv310_timer, + .dt_compat = s5pv310_dt_compat, + .init_early = s5pv310_dt_init_early, +MACHINE_END