From patchwork Wed Jul 18 13:43:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tony Prisk X-Patchwork-Id: 1211191 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 70529DFFFD for ; Wed, 18 Jul 2012 13:57:28 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SrUeD-0003sp-Mc; Wed, 18 Jul 2012 13:50:42 +0000 Received: from nm1.bullet.mail.bf1.yahoo.com ([98.139.212.160]) by merlin.infradead.org with smtp (Exim 4.76 #1 (Red Hat Linux)) id 1SrUXW-0001h9-5f for linux-arm-kernel@lists.infradead.org; Wed, 18 Jul 2012 13:43:47 +0000 Received: from [98.139.212.148] by nm1.bullet.mail.bf1.yahoo.com with NNFMP; 18 Jul 2012 13:43:35 -0000 Received: from [98.139.215.254] by tm5.bullet.mail.bf1.yahoo.com with NNFMP; 18 Jul 2012 13:43:35 -0000 Received: from [127.0.0.1] by omp1067.mail.bf1.yahoo.com with NNFMP; 18 Jul 2012 13:43:35 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 532374.11347.bm@omp1067.mail.bf1.yahoo.com Received: (qmail 50809 invoked by uid 60001); 18 Jul 2012 13:43:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.nz; s=s1024; t=1342619015; bh=ngkxXLNZ6pqMGhUbI/kiIDVEwxL9PZGD8z34MvTI4ek=; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=LjUiOr1OFEYAsoGUmJN55BkQRUTIQ4Qyk9uj6vuHTnCJ+y7vsqcp307+0FZe/ORHfAIewIej8zhou1GfI/zNlM8YvL2JwMUuETey1q33m6m50/KQhr4SFweymmfr67FK55i5z2m78fa/YiDLNRVDDMoKs9PJ77DxBnebmUgtKHw= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.nz; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=zT94eiHnmsdrCC1+gEF/hliIRjFgr+Az7Lxjx5rPCMck82snHbDPXdz8pHVtObz5W5lWsYxuM3K7K0AqlyJqQEPLcviovzzlmIMTE7q49IF3kLNB1K9ocJL7tE1Sx97B1jr5hAkATKLKgP3NjfwsBYO50bMZbIUsH8eANtCQOhs=; X-YMail-OSG: mQ7_.YkVM1k2CD179thtRK2._Ajq0_XY8iPsw6iEbmIOIkt jg1lK_h12vu._1CmUO_okciLoEjkTHbedSbnXQTtGKQ3WhElODeB8.2PWj5I NAF._h08napD4CLNxe3BSLCqlhLObAouTbdNoMUD31Oal_0GU6x9uQHsFzbx KnESGptGZ_FJp2Wqrak.u6t4LUQEihvoHvCC9w5vSXGuN59tj2h90tdAmOoP 6taJOjcLgMHnJDDe5CWaR9wjm9oYQOgoXiUMKkZSuRqTQTxyuVl9ais1GOba VunRwABZVHLSn7EZS3gcSR2WY8dvOaWzxCZCceDSgGK4dqNR0mzgqOYip4R1 9ayIl.RZzeBhWEyBjtZrXs3st3UIq7lhzR5MRz_afzKzNavLpMvzZ7fk8nwp tRIBf6NTKkAOWUysmVjcYHwunT7CoNaQjoAMZOsCbWJ3Mfxon02u8_tjsFVz 1pqlwY3PBtz0rB5F_z4ghkqxXZNQTKEV6QgMr_JyplDXYmw-- Received: from [210.54.1.168] by web140803.mail.bf1.yahoo.com via HTTP; Wed, 18 Jul 2012 06:43:35 PDT X-Mailer: YahooMailWebService/0.8.120.356233 References: <1342615030.5079.YahooMailNeo@web140804.mail.bf1.yahoo.com> <201207181259.21669.arnd@arndb.de> Message-ID: <1342619015.49231.YahooMailNeo@web140803.mail.bf1.yahoo.com> Date: Wed, 18 Jul 2012 06:43:35 -0700 (PDT) From: Tony Prisk Subject: [PATCHv3 1/1] ARM:vt8500: Convert to use .restart and remove arch_reset() To: Arnd Bergmann In-Reply-To: <201207181259.21669.arnd@arndb.de> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (sentientnz[at]yahoo.co.nz) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [98.139.212.160 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 FSL_FREEMAIL_2 FSL_FREEMAIL_2 0.0 FSL_FREEMAIL_1 FSL_FREEMAIL_1 Cc: VT8500-Group , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Tony Prisk List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Removed system.h as it only contained an inline for arch_reset() Changed the existing board files to use .restart in machine descriptions. Added device tree support for the restart controller. Device tree support for mach-vt8500 is still a work-in-progress. Change History v3: style changes. Signed-off-by: Tony Prisk Acked-by: Arnd Bergmann ---  arch/arm/mach-vt8500/Makefile               |    2 +-  arch/arm/mach-vt8500/bv07.c                 |    3 +  arch/arm/mach-vt8500/include/mach/restart.h |   17 ++++++++  arch/arm/mach-vt8500/include/mach/system.h  |   13 ------  arch/arm/mach-vt8500/restart.c              |   54 +++++++++++++++++++++++++++  arch/arm/mach-vt8500/wm8505_7in.c           |    4 +-  6 files changed, 78 insertions(+), 15 deletions(-)  create mode 100644 arch/arm/mach-vt8500/include/mach/restart.h  delete mode 100644 arch/arm/mach-vt8500/include/mach/system.h  create mode 100644 arch/arm/mach-vt8500/restart.c diff --git a/arch/arm/mach-vt8500/Makefile b/arch/arm/mach-vt8500/Makefile index 81aedb7..54e6997 100644 --- a/arch/arm/mach-vt8500/Makefile +++ b/arch/arm/mach-vt8500/Makefile @@ -1,4 +1,4 @@ -obj-y += devices.o gpio.o irq.o timer.o +obj-y += devices.o gpio.o irq.o timer.o restart.o    obj-$(CONFIG_VTWM_VERSION_VT8500) += devices-vt8500.o  obj-$(CONFIG_VTWM_VERSION_WM8505) += devices-wm8505.o diff --git a/arch/arm/mach-vt8500/bv07.c b/arch/arm/mach-vt8500/bv07.c index a464c75..f9fbeb2 100644 --- a/arch/arm/mach-vt8500/bv07.c +++ b/arch/arm/mach-vt8500/bv07.c @@ -23,6 +23,7 @@    #include  #include +#include    #include "devices.h"   @@ -62,6 +63,7 @@ void __init bv07_init(void)      else          printk(KERN_ERR "PMC Hibernation register could not be remapped, not enabling power off!\n");   +    wmt_setup_restart();      vt8500_set_resources();      platform_add_devices(devices, ARRAY_SIZE(devices));      vt8500_gpio_init(); @@ -69,6 +71,7 @@ void __init bv07_init(void)    MACHINE_START(BV07, "Benign BV07 Mini Netbook")      .atag_offset    = 0x100, +    .restart    = wmt_restart,      .reserve    = vt8500_reserve_mem,      .map_io        = vt8500_map_io,      .init_irq    = vt8500_init_irq, diff --git a/arch/arm/mach-vt8500/include/mach/restart.h b/arch/arm/mach-vt8500/include/mach/restart.h new file mode 100644 index 0000000..89f9b78 --- /dev/null +++ b/arch/arm/mach-vt8500/include/mach/restart.h @@ -0,0 +1,17 @@ +/* linux/arch/arm/mach-vt8500/restart.h + * + * Copyright (C) 2012 Tony Prisk + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + */ + +void wmt_setup_restart(void); +void wmt_restart(char mode, const char *cmd); diff --git a/arch/arm/mach-vt8500/include/mach/system.h b/arch/arm/mach-vt8500/include/mach/system.h deleted file mode 100644 index 58fa801..0000000 --- a/arch/arm/mach-vt8500/include/mach/system.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/arm/mach-vt8500/include/mach/system.h - * - */ -#include - -/* PM Software Reset request register */ -#define VT8500_PMSR_VIRT    0xf8130060 - -static inline void arch_reset(char mode, const char *cmd) -{ -    writel(1, VT8500_PMSR_VIRT); -} diff --git a/arch/arm/mach-vt8500/restart.c b/arch/arm/mach-vt8500/restart.c new file mode 100644 index 0000000..497e89a --- /dev/null +++ b/arch/arm/mach-vt8500/restart.c @@ -0,0 +1,54 @@ +/* linux/arch/arm/mach-vt8500/restart.c + * + * Copyright (C) 2012 Tony Prisk + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + */ +#include +#include +#include + +#define LEGACY_PMC_BASE        0xD8130000 +#define WMT_PRIZM_PMSR_REG    0x60 + +static void __iomem *pmc_base; + +void wmt_setup_restart(void) +{ +    struct device_node *np; + +    /* +     * Check if Power Mgmt Controller node is present in device tree. If no +     * device tree node, use the legacy PMSR value (valid for all current +     * SoCs). +     */ +    np = of_find_compatible_node(NULL, NULL, "wmt,prizm-pmc"); +    if (np) { +        pmc_base = of_iomap(np, 0); + +        if (!pmc_base) +            pr_err("%s:of_iomap(pmc) failed\n", __func__); + +        of_node_put(np); +    } else { +        pmc_base = ioremap(LEGACY_PMC_BASE, 0x1000); +        if (!pmc_base) { +            pr_err("%s:ioremap(rstc) failed\n", __func__); +            return; +        } +    } +} + +void wmt_restart(char mode, const char *cmd) +{ +    if (pmc_base) +        writel(1, pmc_base + WMT_PRIZM_PMSR_REG); +} diff --git a/arch/arm/mach-vt8500/wm8505_7in.c b/arch/arm/mach-vt8500/wm8505_7in.c index cf910a9..db19886 100644 --- a/arch/arm/mach-vt8500/wm8505_7in.c +++ b/arch/arm/mach-vt8500/wm8505_7in.c @@ -23,6 +23,7 @@    #include  #include +#include    #include "devices.h"   @@ -61,7 +62,7 @@ void __init wm8505_7in_init(void)          pm_power_off = &vt8500_power_off;      else          printk(KERN_ERR "PMC Hibernation register could not be remapped, not enabling power off!\n"); - +    wmt_setup_restart();      wm8505_set_resources();      platform_add_devices(devices, ARRAY_SIZE(devices));      vt8500_gpio_init(); @@ -69,6 +70,7 @@ void __init wm8505_7in_init(void)    MACHINE_START(WM8505_7IN_NETBOOK, "WM8505 7-inch generic netbook")      .atag_offset    = 0x100, +    .restart    = wmt_restart,      .reserve    = wm8505_reserve_mem,      .map_io        = wm8505_map_io,      .init_irq    = wm8505_init_irq,