From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754725AbeCVMsU (ORCPT ); Thu, 22 Mar 2018 08:48:20 -0400 Received: from mail-qk0-f196.google.com ([209.85.220.196]:41583 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753742AbeCVMsQ (ORCPT ); Thu, 22 Mar 2018 08:48:16 -0400 X-Google-Smtp-Source: AG47ELsWQOW9f4tb/StFb5QEexgx+CzNqSoutzjYXN58K7+//aDDqljWqxWJ16KPMySKU4NsXkO4viM5UrUYxWMhu6M= MIME-Version: 1.0 In-Reply-To: <1521719091-25157-5-git-send-email-michel.pollet@bp.renesas.com> References: <1521719091-25157-1-git-send-email-michel.pollet@bp.renesas.com> <1521719091-25157-5-git-send-email-michel.pollet@bp.renesas.com> From: Geert Uytterhoeven Date: Thu, 22 Mar 2018 13:48:14 +0100 X-Google-Sender-Auth: 1H-UMUDSzgOruEKohakHmdzvNt4 Message-ID: Subject: Re: [PATCH v2 4/8] reset: Renesas RZ/N1 reboot driver To: Michel Pollet Cc: Linux-Renesas , Simon Horman , Phil Edworthy , Magnus Damm , Rob Herring , Mark Rutland , Lee Jones , Russell King , Sebastian Reichel , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Kernel Mailing List , Linux ARM , Linux PM list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Michel, On Thu, Mar 22, 2018 at 12:44 PM, Michel Pollet wrote: > The Renesas RZ/N1 Family (Part #R9A06G0xx) needs a small driver > to reboot the Cortex-A7 cores. This driver is a sub driver of > the sysctrl MFD. > > Signed-off-by: Michel Pollet Thanks for your patch! > --- /dev/null > +++ b/drivers/power/reset/rzn1-reboot.c > @@ -0,0 +1,109 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * RZ/N1 reboot driver > + * > + * Copyright (C) 2018 Renesas Electronics Europe Limited > + * > + * Michel Pollet , > + * Derived from zx-reboot.c > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include I don't think you need . > +#include > +#include > +#include > + > +/* Definitions from the SDK rzn1-sysctrl.h autogenerated file */ > +#define RZN1_SYSCTRL_REG_RSTEN 0x120 > +#define RZN1_SYSCTRL_REG_RSTEN_MRESET_EN 0 > +#define RZN1_SYSCTRL_REG_RSTEN_WDA7RST_EN 1 > +#define RZN1_SYSCTRL_REG_RSTEN_WDA7RST_EN_MASK 0x6 > +#define RZN1_SYSCTRL_REG_RSTEN_WDM3RST_EN 3 > +#define RZN1_SYSCTRL_REG_RSTEN_CM3LOCKUPRST_EN 4 > +#define RZN1_SYSCTRL_REG_RSTEN_CM3SYSRESET_EN 5 > +#define RZN1_SYSCTRL_REG_RSTEN_SWRST_EN 6 > +#define RZN1_SYSCTRL_REG_RSTCTRL 0x198 > +#define RZN1_SYSCTRL_REG_RSTCTRL_WDA7RST_REQ 1 > +#define RZN1_SYSCTRL_REG_RSTCTRL_WDA7RST_REQ_MASK 0x6 > +#define RZN1_SYSCTRL_REG_RSTCTRL_WDM3RST_REQ 3 > +#define RZN1_SYSCTRL_REG_RSTCTRL_CM3LOCKUPRST_REQ 4 > +#define RZN1_SYSCTRL_REG_RSTCTRL_CM3SYSRESET_REQ 5 > +#define RZN1_SYSCTRL_REG_RSTCTRL_SWRST_REQ 6 > + > + > +static struct regmap *_sysctrl; Variable names starting with an underscore are frowned upon. > +static int rzn1_reboot_probe(struct platform_device *pdev) > +{ > + int err; > + struct device *parent; > + > + parent = pdev->dev.parent; > + if (parent && parent->of_node) { > + _sysctrl = syscon_node_to_regmap(parent->of_node); > + } else { > + dev_err(&pdev->dev, "couldn't find sysctrl node\n"); > + return -ENODEV; > + } if (!parent || !parent->of_node) { dev_err(&pdev->dev, "couldn't find sysctrl node\n"); return -ENODEV; } _sysctrl = syscon_node_to_regmap(parent->of_node); > + if (IS_ERR(_sysctrl)) { > + dev_err(&pdev->dev, "couldn't find find regmap\n"); > + return PTR_ERR(_sysctrl); > + } > + err = register_restart_handler(&rzn1_reboot_nb); > + if (err) { > + dev_err(&pdev->dev, "register restart handler failed(err=%d)\n", > + err); > + } > + > + return err; > +} > + > +static const struct of_device_id rzn1_reboot_of_match[] = { > + { .compatible = "renesas,r9a06g032-reboot" }, > + { .compatible = "renesas,rzn1-reboot" }, Matching against the second (family-specific) compatible value should be sufficient. > + {} > +}; > +MODULE_DEVICE_TABLE(of, rzn1_reboot_of_match); Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds