From patchwork Tue Nov 4 11:31:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 40133 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6384C21894 for ; Tue, 4 Nov 2014 11:31:36 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id h11sf3873035wiw.3 for ; Tue, 04 Nov 2014 03:31:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=G+FJKIPuCBQjzJWwy52kkVkZuQRkdsUdGIHHWcvUIi4=; b=KBXaFHEU7kEtRzhQnNB1BefkTIZ2mwFH/2le/FfYOfaLkie3sD4tIbwtzpKIPpZJ5+ QCIkWzT+2Y25U8srOZuvDjbdet2cNfAQ7bhwB54OovMNVMpvUuInQgL1xxhkRXhQzQ/a SVKj+t8nSopn/U2iOU/18SsPmAae/MGrCICD+QYGVOb86e94cSQ9FFdyPskglgRJjQG7 zVO7+hl+VoSisnC2E0Q1NUFaaf3N9vM1jHFTYYg8vV8RIE0Xykj1rE54CLftwg2maFbK PQpyBH1lPEBFeUGTmlsNnYQx7RTg3P4LR0o0VpBm06KrCf4hNuBM52MO5VMNl4SYs0zc N+dQ== X-Gm-Message-State: ALoCoQmaLjbpgtQkOuyno9P2piwRdK84J6z7/MJYUdhEsE9dtVLm6EiYjyCGRJjbElUPH+/R2ocK X-Received: by 10.180.81.5 with SMTP id v5mr1866526wix.0.1415100695552; Tue, 04 Nov 2014 03:31:35 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.169 with SMTP id c9ls795447laa.104.gmail; Tue, 04 Nov 2014 03:31:35 -0800 (PST) X-Received: by 10.152.22.74 with SMTP id b10mr58386172laf.16.1415100695357; Tue, 04 Nov 2014 03:31:35 -0800 (PST) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id j10si160099laf.95.2014.11.04.03.31.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Nov 2014 03:31:35 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id hs14so684957lab.19 for ; Tue, 04 Nov 2014 03:31:35 -0800 (PST) X-Received: by 10.112.12.35 with SMTP id v3mr58436470lbb.80.1415100695116; Tue, 04 Nov 2014 03:31:35 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp100142lbc; Tue, 4 Nov 2014 03:31:29 -0800 (PST) X-Received: by 10.68.163.65 with SMTP id yg1mr48780918pbb.21.1415100688434; Tue, 04 Nov 2014 03:31:28 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3si112655pdp.54.2014.11.04.03.31.27 for ; Tue, 04 Nov 2014 03:31:28 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752850AbaKDLbZ (ORCPT + 25 others); Tue, 4 Nov 2014 06:31:25 -0500 Received: from mail-wg0-f52.google.com ([74.125.82.52]:54951 "EHLO mail-wg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750985AbaKDLbU (ORCPT ); Tue, 4 Nov 2014 06:31:20 -0500 Received: by mail-wg0-f52.google.com with SMTP id b13so12648261wgh.11 for ; Tue, 04 Nov 2014 03:31:19 -0800 (PST) X-Received: by 10.180.86.198 with SMTP id r6mr23462367wiz.29.1415100679398; Tue, 04 Nov 2014 03:31:19 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id u5sm727455wiz.9.2014.11.04.03.31.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Nov 2014 03:31:18 -0800 (PST) From: Linus Walleij To: Sebastian Reichel , Dmitry Eremin-Solenikov , linux-kernel@vger.kernel.org Cc: David Woodhouse , Linus Walleij Subject: [PATCH] power: reset: augment versatile driver for integrator Date: Tue, 4 Nov 2014 12:31:12 +0100 Message-Id: <1415100672-31425-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.9.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Augment the Versatile reset driver to also handle the core module reset sequence used on the Integrator/AP and Integrator/CP. Cc: Dmitry Eremin-Solenikov Cc: David Woodhouse Cc: Sebastian Reichel Signed-off-by: Linus Walleij --- Sebastian: please merge this into your power tree if you're OK with it, the corresponding platform changes are orthogonal so these can go separately through the ARM SoC tree. --- drivers/power/reset/arm-versatile-reboot.c | 32 +++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/power/reset/arm-versatile-reboot.c b/drivers/power/reset/arm-versatile-reboot.c index 5b08bffcf1a8..adea9d0c38e0 100644 --- a/drivers/power/reset/arm-versatile-reboot.c +++ b/drivers/power/reset/arm-versatile-reboot.c @@ -15,14 +15,21 @@ #include #include +#define INTEGRATOR_HDR_CTRL_OFFSET 0x0C +#define INTEGRATOR_HDR_LOCK_OFFSET 0x14 +#define INTEGRATOR_CM_CTRL_RESET (1 << 3) + #define REALVIEW_SYS_LOCK_OFFSET 0x20 -#define REALVIEW_SYS_LOCK_VAL 0xA05F #define REALVIEW_SYS_RESETCTL_OFFSET 0x40 +/* Magic unlocking token used on all Versatile boards */ +#define VERSATILE_LOCK_VAL 0xA05F + /* * We detect the different syscon types from the compatible strings. */ enum versatile_reboot { + INTEGRATOR_REBOOT_CM, REALVIEW_REBOOT_EB, REALVIEW_REBOOT_PB1176, REALVIEW_REBOOT_PB11MP, @@ -36,6 +43,10 @@ static enum versatile_reboot versatile_reboot_type; static const struct of_device_id versatile_reboot_of_match[] = { { + .compatible = "arm,core-module-integrator", + .data = (void *)INTEGRATOR_REBOOT_CM + }, + { .compatible = "arm,realview-eb-syscon", .data = (void *)REALVIEW_REBOOT_EB, }, @@ -55,31 +66,46 @@ static const struct of_device_id versatile_reboot_of_match[] = { .compatible = "arm,realview-pbx-syscon", .data = (void *)REALVIEW_REBOOT_PBX, }, + {}, }; static void versatile_reboot(enum reboot_mode mode, const char *cmd) { /* Unlock the reset register */ - regmap_write(syscon_regmap, REALVIEW_SYS_LOCK_OFFSET, - REALVIEW_SYS_LOCK_VAL); /* Then hit reset on the different machines */ switch (versatile_reboot_type) { + case INTEGRATOR_REBOOT_CM: + regmap_write(syscon_regmap, INTEGRATOR_HDR_LOCK_OFFSET, + VERSATILE_LOCK_VAL); + regmap_update_bits(syscon_regmap, + INTEGRATOR_HDR_CTRL_OFFSET, + INTEGRATOR_CM_CTRL_RESET, + INTEGRATOR_CM_CTRL_RESET); + break; case REALVIEW_REBOOT_EB: + regmap_write(syscon_regmap, REALVIEW_SYS_LOCK_OFFSET, + VERSATILE_LOCK_VAL); regmap_write(syscon_regmap, REALVIEW_SYS_RESETCTL_OFFSET, 0x0008); break; case REALVIEW_REBOOT_PB1176: + regmap_write(syscon_regmap, REALVIEW_SYS_LOCK_OFFSET, + VERSATILE_LOCK_VAL); regmap_write(syscon_regmap, REALVIEW_SYS_RESETCTL_OFFSET, 0x0100); break; case REALVIEW_REBOOT_PB11MP: case REALVIEW_REBOOT_PBA8: + regmap_write(syscon_regmap, REALVIEW_SYS_LOCK_OFFSET, + VERSATILE_LOCK_VAL); regmap_write(syscon_regmap, REALVIEW_SYS_RESETCTL_OFFSET, 0x0000); regmap_write(syscon_regmap, REALVIEW_SYS_RESETCTL_OFFSET, 0x0004); break; case REALVIEW_REBOOT_PBX: + regmap_write(syscon_regmap, REALVIEW_SYS_LOCK_OFFSET, + VERSATILE_LOCK_VAL); regmap_write(syscon_regmap, REALVIEW_SYS_RESETCTL_OFFSET, 0x00f0); regmap_write(syscon_regmap, REALVIEW_SYS_RESETCTL_OFFSET,