Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965473AbbLOUjk (ORCPT ); Tue, 15 Dec 2015 15:39:40 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:49919 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932528AbbLOUjg (ORCPT ); Tue, 15 Dec 2015 15:39:36 -0500 From: Arnd Bergmann To: Thierry Reding Cc: linux-arm-kernel@lists.infradead.org, Andy Yan , heiko@sntech.de, linux-kernel@vger.kernel.org, mark.rutland@arm.com, devicetree@vger.kernel.org, khilman@linaro.org, linux@arm.linux.org.uk, pawel.moll@arm.com, ijc+devicetree@hellion.org.uk, benchan@google.com, sjg@chromium.org, linux-rockchip@lists.infradead.org, robh+dt@kernel.org, galak@codeaurora.org, wxt@rock-chips.com, john.stultz@linaro.org Subject: Re: [PATCH v3 3/5] soc: rockchip: add reboot notifier driver Date: Tue, 15 Dec 2015 21:38:41 +0100 Message-ID: <15127971.1juVbocOjP@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <20151215174234.GB24031@ulmo.nvidia.com> References: <1447840044-19689-1-git-send-email-andy.yan@rock-chips.com> <3759218.6sItdW65UG@wuerfel> <20151215174234.GB24031@ulmo.nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:njWMG5Uv0kxqqUR8J0QacV6sTS7LHHlr+K8zePN1ODVCEQoAhSX I9AgjIb4T9mvsGYjKTMvhqPxc3/2CA0PpIjDDP4iYjrby6Qst+IigLBbBawQY6pklIgd4OF 6ASlojBTbgHj0x+BicVYnk7xzMMPUZU8CQq3p5JV06Jol6SyiIcmeu1NOd0xnNXyczAqDZC j43wvS1Z6rSZOQe8Rw7gQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:9zbYjn5PXdM=:d3XqSjtwUwmkPICWqiadki fcUkkXallTalDiCVqO9fch5Ubh8nL6X6up8sBS7vcwX4nm4vym/Rs1GBhg29ymaA9pMgKtsDF 647/mvNSuNpwHe0TBPVH1KBXkwJCFcjx+8ZJnUJpue74jOuWofhYlNOUNzUVaO6GbaxX/vL5Z njpTfsahRI9vtRiy1e1VFSmzpgHU892objXssJKGfcvGhxJmIC3onL396TP0wB2PQP5Lm8r4Y a/Nof2+V7kKkfjoEqqOXzbc3brbtCPZQktLO56pQdZo7OGVV70L/VtFnTebykMyuN06FTXBcx wKaKAGAWMAVkFjVVqq4aDh5KxZoe2PHX/ncWecwFYn5PuSbH/LXj4ogGaEROoOpyoObav/OMr iZtrkksgWf/yZIU/LjANdn3yR6z87bv8MxYFp5drtI6KTMlQLlmigo2FvbrhbXOoqYrSfth+Q 0TZm2pNXQscS182gqUU/AbHbwXnreDoVPq53MotKDCritRSqxk9hKTuoyIQWDEpanwBRew/Gu 8cLa/g4V2uZh5OsHTC81hQE1VslN2Q3tQr5qPThfakzMLGIiyge9+JdyUZp1JrMkl7YqHLo3B KgXp7MCJXD+TLGU4f+fp62tfdhrFRwIdZwPmt4wVS0LOW9Vonbv+gj/eVNPz71cZUQvUQSeva EtWG/YMxvOSqq8aj5nnr61jzy/sIyzA1xh/SFW/qvXOeoPj+5hehVCC72hOVEvAvEOrEafkfb 1E/8iXEm+jqnAK57 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3491 Lines: 70 On Tuesday 15 December 2015 18:42:36 Thierry Reding wrote: > On Tue, Dec 15, 2015 at 05:34:00PM +0100, Arnd Bergmann wrote: > > On Tuesday 15 December 2015 17:31:22 Thierry Reding wrote: > > > On Mon, Dec 14, 2015 at 12:39:44PM +0100, Arnd Bergmann wrote: > > > > On Wednesday 18 November 2015 17:56:22 Andy Yan wrote: > > > > > rockchip platform have a protocol to pass the kernel reboot > > > > > mode to bootloader by some special registers when system reboot. > > > > > By this way the bootloader can take different action according > > > > > to the different kernel reboot mode, for example, command > > > > > "reboot loader" will reboot the board to rockusb mode, this is > > > > > a very convenient way to get the board enter download mode. > > > > > > > > > > Signed-off-by: Andy Yan > > > > > > > > Adding John Stultz to Cc > > > > > > > > I just saw this thread pop up again, and had to think of John's recent > > > > patch to unify this across platforms. > > > > > > > > John, can you have a look at this driver too, and see how it fits in? > > > > I think this is yet another variant, using an MMIO register rather than > > > > RAM (as HTC / NVIDIA does) or SRAM (as Qualcomm does), but otherwise > > > > it conceptually fits in with what you had. > > > > > > FWIW, Tegra typically does use an MMIO register as well. See > > > drivers/soc/tegra/pmc.c:tegra_pmc_restart_notify(). I don't know what > > > HTC does, but if it's writing somewhere in RAM it isn't using the > > > standard way of resetting the SoC. There's early boot ROM code which I > > > think evaluates the PMC_SCRATCH0 register on Tegra to determine which > > > mode to boot into. That's before even any firmware gets the chance of > > > doing anything. I just checked the android lollipop tree, and I could not find a pmc_restart_notify function, only this file https://android.googlesource.com/kernel/tegra/+/android-tegra-flounder-3.10-lollipop-release/drivers/htc_debug/stability/reboot_params.c with the device that stores into RAM. It looks like HTC ported over a driver that they were already using on some Qualcomm MSM8960 device, as in https://gitlab.com/MaC/android_kernel_htc_msm8960/blob/859977fc723f59a6b707df1d70e80826ee1dccc4/arch/arm/mach-msm/htc/htc_restart_handler.c On Android marshmallow (Flounder), that file again does not exist, and I don't see how it's done. > > HTC apparently uses a separate RAM area to pass the reboot reason, > > and they have a driver to store that, which is separate from the > > driver that they use for actually rebooting the machine. > > I wasn't very clear, but the PMC_SCRATCH0 register is used to store the > reset reason. It supports the recovery mode, which I think is really an > Android thing, "bootloader" will typically cause the bootloader not to > boot anything, and "forced-recovery" will go into a recovery mode that > is used to bootstrap the device (usually by uploading a "miniloader" > that initializes RAM, downloads a bootloader for booting or flashing an > operating system, ...). > > The write that resets the SoC is to a different register. So is this scratch register interpreted by some maskrom code, or by code that can be provided by the OEM? Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/