From patchwork Sat Mar 9 20:29:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 2242481 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 768173FCF6 for ; Sat, 9 Mar 2013 20:29:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751327Ab3CIU3u (ORCPT ); Sat, 9 Mar 2013 15:29:50 -0500 Received: from mail-wg0-f41.google.com ([74.125.82.41]:52612 "EHLO mail-wg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751263Ab3CIU3t (ORCPT ); Sat, 9 Mar 2013 15:29:49 -0500 Received: by mail-wg0-f41.google.com with SMTP id ds1so860786wgb.0 for ; Sat, 09 Mar 2013 12:29:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=ql0A2UnL4LXoDil0VqVksyOfnJ3MgqLeTG63K9z0eu4=; b=MLubJ1B3UBMeVKv++1UFmCou6SZ+fo8djowJUuKgaK8xE6+iPr3sjlqc9GAt6jEXQA yVSxLm871L1VWGsUWf4ya4gCpQDcLWkRf4FBitbNkg/OokyOI4GM0FJ93+DVTXQ3Po8s 0TcNtR7cHkExE+y465u8lKLbw1YiHZlJjXAAuMDQJub+0ZtyYPeUaeGFHJue5ybi65BW DS4Vf/L8pMy2nzUq/G/cb00Xl4ZSMwroI2rrG4ogz4r4KobVX7k8c9Dij3WWddIl7SNL jzC9399fPwOiR3pmc+Jv340OJQAN+svuMkDgl/JhrG0NTRiXKnwxfQJBQa+Oqrwa5dhA +Nog== X-Received: by 10.194.63.109 with SMTP id f13mr11361652wjs.11.1362860988211; Sat, 09 Mar 2013 12:29:48 -0800 (PST) Received: from flatron.tomeq (87-207-52-162.dynamic.chello.pl. [87.207.52.162]) by mx.google.com with ESMTPS id eo1sm6312017wib.8.2013.03.09.12.29.45 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 09 Mar 2013 12:29:47 -0800 (PST) From: Tomasz Figa To: linux-samsung-soc@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, devicetree-discuss@lists.ozlabs.org, kgene.kim@samsung.com, broonie@opensource.wolfsonmicro.com, kwangwoo.lee@gmail.com, jacmet@sunsite.dk, augulis.darius@gmail.com, mcuelenaere@gmail.com, linux@arm.linux.org.uk, Rob Herring , Mark Rutland , Tomasz Figa Subject: [PATCH v4 2/4] ARM: s3c64xx: Add board file for boot using Device Tree Date: Sat, 9 Mar 2013 21:29:33 +0100 Message-Id: <1362860975-18635-3-git-send-email-tomasz.figa@gmail.com> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1362860975-18635-1-git-send-email-tomasz.figa@gmail.com> References: <1362860975-18635-1-git-send-email-tomasz.figa@gmail.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org This patch adds board file that will be used to boot S3C64xx-based boards using Device Tree. Signed-off-by: Tomasz Figa --- arch/arm/mach-s3c64xx/Kconfig | 14 ++++++ arch/arm/mach-s3c64xx/Makefile | 1 + arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c | 83 +++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig index 283cb77..771e2c2 100644 --- a/arch/arm/mach-s3c64xx/Kconfig +++ b/arch/arm/mach-s3c64xx/Kconfig @@ -311,3 +311,17 @@ config MACH_WLF_CRAGG_6410 select SAMSUNG_GPIO_EXTRA128 help Machine support for the Wolfson Cragganmore S3C6410 variant. + +config MACH_S3C64XX_DT + bool "Samsung S3C6400/S3C6410 machine using Device Tree" + select CLKSRC_OF + select CPU_S3C6400 + select CPU_S3C6410 + select USE_OF + help + Machine support for Samsung S3C6400/S3C6410 machines with Device Tree + enabled. + Select this if a fdt blob is available for your S3C64XX SoC based + board. + Note: This is under development and not all peripherals can be + supported with this machine file. diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile index f9ce1dc..59b3d06 100644 --- a/arch/arm/mach-s3c64xx/Makefile +++ b/arch/arm/mach-s3c64xx/Makefile @@ -58,3 +58,4 @@ obj-$(CONFIG_MACH_SMARTQ7) += mach-smartq7.o obj-$(CONFIG_MACH_SMDK6400) += mach-smdk6400.o obj-$(CONFIG_MACH_SMDK6410) += mach-smdk6410.o obj-$(CONFIG_MACH_WLF_CRAGG_6410) += mach-crag6410.o mach-crag6410-module.o +obj-$(CONFIG_MACH_S3C64XX_DT) += mach-s3c64xx-dt.o diff --git a/arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c b/arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c new file mode 100644 index 0000000..10b76cc --- /dev/null +++ b/arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c @@ -0,0 +1,83 @@ +/* + * Samsung's S3C64XX flattened device tree enabled machine + * + * Copyright (c) 2013 Tomasz Figa + * + * 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 "common.h" + +/* + * The following lookup table is used to override device names when devices + * are registered from device tree. This is temporarily added to enable + * device tree support addition for the S3C64xx architecture. + * + * For drivers that require platform data to be provided from the machine + * file, a platform data pointer can also be supplied along with the + * devices names. Usually, the platform data elements that cannot be parsed + * from the device tree by the drivers (example: function pointers) are + * supplied. But it should be noted that this is a temporary mechanism and + * at some point, the drivers should be capable of parsing all the platform + * data from the device tree. + */ +static const struct of_dev_auxdata s3c64xx_auxdata_lookup[] __initconst = { + OF_DEV_AUXDATA("samsung,s3c6400-uart", 0x7f005000, + "s3c6400-uart.0", NULL), + OF_DEV_AUXDATA("samsung,s3c6400-uart", 0x7f005400, + "s3c6400-uart.1", NULL), + OF_DEV_AUXDATA("samsung,s3c6400-uart", 0x7f005800, + "s3c6400-uart.2", NULL), + OF_DEV_AUXDATA("samsung,s3c6400-uart", 0x7f005c00, + "s3c6400-uart.3", NULL), + OF_DEV_AUXDATA("samsung,s3c6410-sdhci", 0x7c200000, + "s3c-sdhci.0", NULL), + OF_DEV_AUXDATA("samsung,s3c6410-sdhci", 0x7c300000, + "s3c-sdhci.1", NULL), + OF_DEV_AUXDATA("samsung,s3c6410-sdhci", 0x7c400000, + "s3c-sdhci.2", NULL), + {}, +}; + +static void __init s3c64xx_dt_map_io(void) +{ + s3c64xx_init_io(NULL, 0); + s3c24xx_init_clocks(12000000); +} + +static void __init s3c64xx_dt_machine_init(void) +{ + of_platform_populate(NULL, of_default_bus_match_table, + s3c64xx_auxdata_lookup, NULL); +} + +static char const *s3c64xx_dt_compat[] __initdata = { + "samsung,s3c6400", + "samsung,s3c6410", + NULL +}; + +DT_MACHINE_START(S3C6400_DT, "Samsung S3C64xx (Flattened Device Tree)") + /* Maintainer: Tomasz Figa */ + .init_irq = irqchip_init, + .map_io = s3c64xx_dt_map_io, + .init_machine = s3c64xx_dt_machine_init, + .init_late = s3c64xx_init_late, + .init_time = clocksource_of_init, + .dt_compat = s3c64xx_dt_compat, + .restart = s3c64xx_restart, +MACHINE_END