From patchwork Fri Feb 18 08:12:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Liu X-Patchwork-Id: 169 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:31 -0000 Delivered-To: patches@linaro.org Received: by 10.146.25.23 with SMTP id 23cs86426yay; Fri, 18 Feb 2011 00:14:56 -0800 (PST) Received: by 10.216.213.15 with SMTP id z15mr321407weo.61.1298016895552; Fri, 18 Feb 2011 00:14:55 -0800 (PST) Received: from DB3EHSOBE001.bigfish.com (db3ehsobe001.messaging.microsoft.com [213.199.154.139]) by mx.google.com with ESMTPS id h47si2634281wej.151.2011.02.18.00.14.55 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 18 Feb 2011 00:14:55 -0800 (PST) Received-SPF: neutral (google.com: 213.199.154.139 is neither permitted nor denied by best guess record for domain of r64343@freescale.com) client-ip=213.199.154.139; Authentication-Results: mx.google.com; spf=neutral (google.com: 213.199.154.139 is neither permitted nor denied by best guess record for domain of r64343@freescale.com) smtp.mail=r64343@freescale.com Received: from mail89-db3-R.bigfish.com (10.3.81.247) by DB3EHSOBE001.bigfish.com (10.3.84.21) with Microsoft SMTP Server id 14.1.225.8; Fri, 18 Feb 2011 08:14:54 +0000 Received: from mail89-db3 (localhost.localdomain [127.0.0.1]) by mail89-db3-R.bigfish.com (Postfix) with ESMTP id 5B8C2E886EB; Fri, 18 Feb 2011 08:14:54 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bh8275dhz2dh2a8h668h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: KIP:(null); UIP:(null); IPVD:NLI; H:de01egw01.freescale.net; RD:de01egw01.freescale.net; EFVD:NLI Received: from mail89-db3 (localhost.localdomain [127.0.0.1]) by mail89-db3 (MessageSwitch) id 1298016884921990_26447; Fri, 18 Feb 2011 08:14:44 +0000 (UTC) Received: from DB3EHSMHS005.bigfish.com (unknown [10.3.81.247]) by mail89-db3.bigfish.com (Postfix) with ESMTP id 50FCFD00C4; Fri, 18 Feb 2011 08:14:29 +0000 (UTC) Received: from de01egw01.freescale.net (192.88.165.102) by DB3EHSMHS005.bigfish.com (10.3.87.105) with Microsoft SMTP Server (TLS) id 14.1.225.8; Fri, 18 Feb 2011 08:14:26 +0000 Received: from az33smr01.freescale.net (az33smr01.freescale.net [10.64.34.199]) by de01egw01.freescale.net (8.14.3/8.14.3) with ESMTP id p1I8EOjI012335; Fri, 18 Feb 2011 01:14:24 -0700 (MST) Received: from localhost.localdomain (r64343-desktop.ap.freescale.net [10.192.242.36]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id p1I8EGYg022541; Fri, 18 Feb 2011 02:14:22 -0600 (CST) From: Jason Liu To: CC: , , Subject: [PATCH 1/3] arm/dt: add basic mx51 device tree support Date: Fri, 18 Feb 2011 16:12:08 +0800 Message-ID: <1298016730-22761-2-git-send-email-r64343@freescale.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1298016730-22761-1-git-send-email-r64343@freescale.com> References: <1298016730-22761-1-git-send-email-r64343@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com Signed-off-by: Jason Liu --- arch/arm/mach-mx5/Kconfig | 6 +++ arch/arm/mach-mx5/Makefile | 1 + arch/arm/mach-mx5/board-dt.c | 64 +++++++++++++++++++++++++++++++ arch/arm/mach-mx5/clock-mx51-mx53.c | 45 +++++++++++++++++++++- arch/arm/plat-mxc/include/mach/common.h | 1 + 5 files changed, 116 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig index de4fa99..5fbbd36 100644 --- a/arch/arm/mach-mx5/Kconfig +++ b/arch/arm/mach-mx5/Kconfig @@ -47,6 +47,12 @@ config MACH_MX51_BABBAGE u-boot. This includes specific configurations for the board and its peripherals. +config MACH_MX51_DT + bool "Generic MX51 board (FDT support)" + select USE_OF + help + Support for generic Freescale MX51 boards using Flattened Device Tree. + config MACH_MX51_3DS bool "Support MX51PDK (3DS)" select SOC_IMX51 diff --git a/arch/arm/mach-mx5/Makefile b/arch/arm/mach-mx5/Makefile index 0d43be9..540697e 100644 --- a/arch/arm/mach-mx5/Makefile +++ b/arch/arm/mach-mx5/Makefile @@ -18,3 +18,4 @@ obj-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += board-cpuimx51sd.o obj-$(CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD) += eukrea_mbimxsd-baseboard.o obj-$(CONFIG_MACH_MX51_EFIKAMX) += board-mx51_efikamx.o obj-$(CONFIG_MACH_MX50_RDP) += board-mx50_rdp.o +obj-$(CONFIG_MACH_MX51_DT) += board-dt.o diff --git a/arch/arm/mach-mx5/board-dt.c b/arch/arm/mach-mx5/board-dt.c new file mode 100644 index 0000000..78ecd12 --- /dev/null +++ b/arch/arm/mach-mx5/board-dt.c @@ -0,0 +1,64 @@ +/* + * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved. + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "devices.h" + +static struct of_device_id mx51_dt_match_table[] __initdata = { + { .compatible = "simple-bus", }, + {} +}; + +static void __init mx51_dt_board_init(void) +{ + of_platform_bus_probe(NULL, mx51_dt_match_table, NULL); +} + +static void __init mx51_dt_timer_init(void) +{ + mx51_clocks_init(32768, 24000000, 22579200, 0); + mx5_clk_dt_init(); +} + +static struct sys_timer mxc_timer = { + .init = mx51_dt_timer_init, +}; + +static const char * mx51_dt_board_compat[] = { + "fsl,mx51_babbage", + NULL +}; + +DT_MACHINE_START(MX51_DT, "Freescale MX51 (Flattened Device Tree)") + .boot_params = PHYS_OFFSET + 0x100, + .map_io = mx51_map_io, + .init_irq = mx51_init_irq, + .init_machine = mx51_dt_board_init, + .dt_compat = mx51_dt_board_compat, + .timer = &mxc_timer, +MACHINE_END diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c index 0a19e75..b8a608e 100644 --- a/arch/arm/mach-mx5/clock-mx51-mx53.c +++ b/arch/arm/mach-mx5/clock-mx51-mx53.c @@ -15,13 +15,19 @@ #include #include #include - +#include #include #include #include #include +#ifdef CONFIG_OF +#include +#include +#include +#endif /* CONFIG_OF */ + #include "crm_regs.h" /* External clock values passed-in by the board code */ @@ -1432,3 +1438,40 @@ int __init mx53_clocks_init(unsigned long ckil, unsigned long osc, MX53_INT_GPT); return 0; } + +#ifdef CONFIG_OF +static struct clk* mx5_dt_clk_get(struct device_node *np, + const char *output_id, void *data) +{ + return data; +} + +static __init void mx5_dt_scan_clks(void) +{ + struct device_node *node; + struct clk *clk; + const char *id; + int rc; + + for_each_compatible_node(node, NULL, "clock") { + id = of_get_property(node, "clock-outputs", NULL); + if (!id) + continue; + + clk = clk_get_sys(id, NULL); + if (IS_ERR(clk)) + continue; + + rc = of_clk_add_provider(node, mx5_dt_clk_get, clk); + if (rc) { + kfree(clk); + pr_err("error adding fixed clk %s\n", node->name); + } + } +} + +void __init mx5_clk_dt_init(void) +{ + mx5_dt_scan_clks(); +} +#endif diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h index aea2cd3..a28e84a 100644 --- a/arch/arm/plat-mxc/include/mach/common.h +++ b/arch/arm/plat-mxc/include/mach/common.h @@ -58,4 +58,5 @@ extern void mxc91231_arch_reset(int, const char *); extern void mxc91231_prepare_idle(void); extern void mx51_efikamx_reset(void); extern int mx53_revision(void); +extern void mx5_clk_dt_init(void); #endif