From patchwork Fri Dec 19 15:56:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 42494 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 7881B26C68 for ; Fri, 19 Dec 2014 15:56:52 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id ex7sf950182wid.3 for ; Fri, 19 Dec 2014 07:56:51 -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=ZMrTobo6pco+qH0NwgacyQILZhDm5zMR9UtUFHED0+M=; b=YW4vRwXvJDHvHNEGLIRiFZ0wywKp1GTi6/ecFZ7bRSSs3/K4/rQAS8vn3oUhc3udI2 nkWXysMM8TkXFjMxmMlF+8D0C9we0I/vygrMwsD6AbvN72iRT8Td/5Fs1s9oIOwZvmkG B9kBhS64bt+LneDrehM7Yo52ohwGxEgL7HwN2OURhSyD0R1ay1HMXGJNU2jCMBsRteir SHp5cfRA/Xhj02OE6rSJ6gA7GrxOsAxzOISRAmw17LOdNiNMLhAQUONe3dpLYsQV1vL7 np2mKnADBEBXVTtI3bQxHOWyK6kOhkdDlECRv0Cz9+8apuSwyHfCEMZcHdDWfYDs2BjU amfg== X-Gm-Message-State: ALoCoQlX5HnEtnQsyOptaWRdE3yerabhgUpkbE0OaCMzE3KmMjB5jB3G9AF4fH6DWt5kXONDQjvM X-Received: by 10.152.10.233 with SMTP id l9mr1225294lab.0.1419004611639; Fri, 19 Dec 2014 07:56:51 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.70 with SMTP id o6ls956597laj.28.gmail; Fri, 19 Dec 2014 07:56:51 -0800 (PST) X-Received: by 10.112.99.71 with SMTP id eo7mr8647432lbb.26.1419004611362; Fri, 19 Dec 2014 07:56:51 -0800 (PST) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id rd5si10342474lbb.73.2014.12.19.07.56.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 19 Dec 2014 07:56:51 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id l4so1028664lbv.25 for ; Fri, 19 Dec 2014 07:56:51 -0800 (PST) X-Received: by 10.152.2.41 with SMTP id 9mr8265211lar.47.1419004611151; Fri, 19 Dec 2014 07:56:51 -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.142.69 with SMTP id ru5csp318046lbb; Fri, 19 Dec 2014 07:56:50 -0800 (PST) X-Received: by 10.68.174.161 with SMTP id bt1mr13763609pbc.28.1419004609193; Fri, 19 Dec 2014 07:56:49 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hr7si14546866pbc.257.2014.12.19.07.56.48; Fri, 19 Dec 2014 07:56:49 -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 S1751653AbaLSP4q (ORCPT + 27 others); Fri, 19 Dec 2014 10:56:46 -0500 Received: from mail-wg0-f47.google.com ([74.125.82.47]:58321 "EHLO mail-wg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750953AbaLSP4p (ORCPT ); Fri, 19 Dec 2014 10:56:45 -0500 Received: by mail-wg0-f47.google.com with SMTP id n12so1690593wgh.34 for ; Fri, 19 Dec 2014 07:56:43 -0800 (PST) X-Received: by 10.180.78.3 with SMTP id x3mr7194653wiw.82.1419004603102; Fri, 19 Dec 2014 07:56:43 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id q7sm2808951wiv.8.2014.12.19.07.56.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Dec 2014 07:56:41 -0800 (PST) From: Linus Walleij To: Sebastian Reichel , Dmitry Eremin-Solenikov , linux-kernel@vger.kernel.org Cc: David Woodhouse , Linus Walleij Subject: [PATCH RESEND] power: reset: augment versatile driver for integrator Date: Fri, 19 Dec 2014 16:56:27 +0100 Message-Id: <1419004587-7580-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.217.180 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 --- 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,