From patchwork Fri Nov 28 16:43:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 5405081 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2AB799F301 for ; Fri, 28 Nov 2014 16:46:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 38436201C0 for ; Fri, 28 Nov 2014 16:46:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 53CD02016C for ; Fri, 28 Nov 2014 16:46:28 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XuOem-000566-Sn; Fri, 28 Nov 2014 16:44:32 +0000 Received: from mail.kmu-office.ch ([2a02:418:6a02::a2]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XuOeM-0004oP-Uu for linux-arm-kernel@lists.infradead.org; Fri, 28 Nov 2014 16:44:08 +0000 Received: from trochilidae.toradex.int (unknown [46.140.72.82]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 67E955E36BA; Fri, 28 Nov 2014 17:43:18 +0100 (CET) From: Stefan Agner To: shawn.guo@linaro.org, kernel@pengutronix.de, linux@roeck-us.net Subject: [PATCH 2/2] ARM: imx: src: support vf610 system reset controller Date: Fri, 28 Nov 2014 17:43:35 +0100 Message-Id: <1417193015-6033-3-git-send-email-stefan@agner.ch> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1417193015-6033-1-git-send-email-stefan@agner.ch> References: <1417193015-6033-1-git-send-email-stefan@agner.ch> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141128_084407_333180_125DC4CF X-CRM114-Status: GOOD ( 13.62 ) X-Spam-Score: 0.0 (/) Cc: stefan@agner.ch, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Support Vybrid SoC's system reset controller (SRC). Currently we don't register a reset controller but only support the imx_cpu_jump and imx_cpu_arg functions. Signed-off-by: Stefan Agner --- arch/arm/mach-imx/Makefile | 2 +- arch/arm/mach-imx/common.h | 1 + arch/arm/mach-imx/mach-vf610.c | 8 +++++++ arch/arm/mach-imx/src-vf610.c | 53 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-imx/src-vf610.c diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index f5ac685..6f689fc 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -108,7 +108,7 @@ obj-$(CONFIG_SOC_IMX50) += mach-imx50.o obj-$(CONFIG_SOC_IMX51) += mach-imx51.o obj-$(CONFIG_SOC_IMX53) += mach-imx53.o -obj-$(CONFIG_SOC_VF610) += clk-vf610.o mach-vf610.o +obj-$(CONFIG_SOC_VF610) += clk-vf610.o src-vf610.o mach-vf610.o obj-$(CONFIG_SOC_LS1021A) += mach-ls1021a.o diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h index 59ce8f3..458db03 100644 --- a/arch/arm/mach-imx/common.h +++ b/arch/arm/mach-imx/common.h @@ -102,6 +102,7 @@ static inline void imx_scu_map_io(void) {} static inline void imx_smp_prepare(void) {} #endif void imx_src_init(void); +void vf610_src_init(void); void imx_gpc_init(void); void imx_gpc_pre_suspend(bool arm_power_off); void imx_gpc_post_resume(void); diff --git a/arch/arm/mach-imx/mach-vf610.c b/arch/arm/mach-imx/mach-vf610.c index c11ab6a..391c2b5 100644 --- a/arch/arm/mach-imx/mach-vf610.c +++ b/arch/arm/mach-imx/mach-vf610.c @@ -11,6 +11,13 @@ #include #include #include +#include "common.h" + +static void __init vf610_init_machine(void) +{ + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + vf610_src_init(); +}; static const char * const vf610_dt_compat[] __initconst = { "fsl,vf610", @@ -20,5 +27,6 @@ static const char * const vf610_dt_compat[] __initconst = { DT_MACHINE_START(VYBRID_VF610, "Freescale Vybrid VF610 (Device Tree)") .l2c_aux_val = 0, .l2c_aux_mask = ~0, + .init_machine = vf610_init_machine, .dt_compat = vf610_dt_compat, MACHINE_END diff --git a/arch/arm/mach-imx/src-vf610.c b/arch/arm/mach-imx/src-vf610.c new file mode 100644 index 0000000..5fba1d4 --- /dev/null +++ b/arch/arm/mach-imx/src-vf610.c @@ -0,0 +1,53 @@ +/* + * Copyright 2011 Freescale Semiconductor, Inc. + * Copyright 2011 Linaro Ltd. + * Copyright 2014 Toradex AG + * + * 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 "common.h" + +#define SRC_SCR 0x000 +#define SRC_GPR0 0x020 +#define BP_SRC_SCR_SW_RST 12 + +static struct notifier_block restart_nb; +static void __iomem *src_base; + +static int vf610_src_restart(struct notifier_block *nb, unsigned long action, + void *data) +{ + writel(1 << BP_SRC_SCR_SW_RST, src_base + SRC_SCR); + return NOTIFY_DONE; +} + +void __init vf610_src_init(void) +{ + struct device_node *np; + + np = of_find_compatible_node(NULL, NULL, "fsl,vf610-src"); + if (!np) + return; + + src_base = of_iomap(np, 0); + WARN_ON(!src_base); + + restart_nb.notifier_call = vf610_src_restart; + restart_nb.priority = 192; + if (register_restart_handler(&restart_nb)) + printk(KERN_WARNING "failed to setup restart handler.\n"); +}