Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp129858pxb; Thu, 30 Sep 2021 02:40:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1Y00/yxs7D0rmBYG2fhACVhmu0bGuvdYDjokKg2PrzgosbkDpfkkF5nKwG/PKi7ta6Yg3 X-Received: by 2002:a05:6a00:a23:b0:43d:e856:a3d4 with SMTP id p35-20020a056a000a2300b0043de856a3d4mr3329581pfh.17.1632994853685; Thu, 30 Sep 2021 02:40:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632994853; cv=none; d=google.com; s=arc-20160816; b=Uua6AxuOJjmWFHFKK9OdM5l8h/O4bUAZWJxKtEO7MNKSNALwis8EXKdJwKNRy3p8sS MJ1NFWaLTveQG73MJ71eq4VTIG7FOX6S9v2+SvqQzYcYX40X/MqIKsJ2ByHELsBKc1Mr /QLWiBnApeX8r/cuKeZfpV32xteo5+RSfuJPaO12HrBjBA8oAL2xP/if4xPMWhC0wbaG 1I4B4XzN4/UdOZwLkBjVaXzosfBkfgXX0com6P4xQ54udf99/+aGrestCcA+nsHo1HYJ B0bx7htC0BOdrhIp6ZvWCM+bZuMCQ2DvsN4vR7mNbqjzUiHd+yuSF/5Z4408a1/aGp/4 TkBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=4X6dQ0l1/8G9mRvlRpg8SXm7KFk/1WWtkX+qwHW3nT4=; b=I9juRXHdSiNZZ8ef6kyhFRsog97pw4epJk9IZY71xUWmM+FEGpDfd288Rrt3Kkbldj YGThx1yldsF9cr2r+jGL5smFZCPnzFvRMXZPe02bs3k/Iy08nn/KdtL5NXCFwSojh8yo uwDcN5Q1vlscF3zlwxLcHlNUMy6hlgqvU6x/Bq9i8vvnMnFsCtXjhk0cDsFReWqOu6OX Ib4QV5vfPVdnDUlzkuHgJtEFnd7pH7Yc3Wnti72ccVuxTy+m/+S7e/ysNsN2ucpqynhO Hfrw74Ac4kIa6i27cpSY4FB4mHPkyNrP8J+P3mM3BwwoD/G4EiR6ECVU4B/fIbniEgLi ZroA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=ivBU7Oh7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d17si3499466pgp.58.2021.09.30.02.40.29; Thu, 30 Sep 2021 02:40:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=ivBU7Oh7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349453AbhI3Jje (ORCPT + 99 others); Thu, 30 Sep 2021 05:39:34 -0400 Received: from smtp-relay-internal-1.canonical.com ([185.125.188.123]:56860 "EHLO smtp-relay-internal-1.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349419AbhI3Jje (ORCPT ); Thu, 30 Sep 2021 05:39:34 -0400 Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 0AA71402CB for ; Thu, 30 Sep 2021 09:37:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1632994666; bh=4X6dQ0l1/8G9mRvlRpg8SXm7KFk/1WWtkX+qwHW3nT4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ivBU7Oh7NXqLJ0lxFIFoiyIcdQdn1qociACLLt4u5VWr8uMM5XXVoKvz+qJ/G1E06 279hwswxU5ls5FmxUAeeONmZ9TgSKVondLPfxZxnGTyBA+e2QI1BKHI+qOn7MuVBtp QV8GT7T5IJnXdTDJNgroZx+6EM7Gzir2A3BkY7b4J/PGt7ddYUrkEC/fTuSMsFrcpv RSJwVz8nl67NMMvgH79KDxEFpUedhN48PlJsewyCcCxZFBd36I1GF7j1jjhypUIwi/ 4QPDaYjtZdLaoBCpSIZAr2pjEPtHItTfSrdnXx8wfm0o3dD3Lk+E7FVccvDx7lhW7f WJqQpUTk0VxzQ== Received: by mail-lf1-f71.google.com with SMTP id x33-20020a0565123fa100b003fcfd99073dso5092268lfa.6 for ; Thu, 30 Sep 2021 02:37:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4X6dQ0l1/8G9mRvlRpg8SXm7KFk/1WWtkX+qwHW3nT4=; b=fOdB1sdlKz/VQ7x+2+PjCklicgvBxuKfVy26azx5bkWLcyE5DtMvd2I1SPh9X0rAz4 KLQkboxnSNlVbph5USJcK7/K8Xrx9fvQ+nV+9RXcl+YNl7YPJmNnZhqWx4zEhj4M7XJi WUuEdhtYAIJlkPWObqW24w6OLRcm5dkshrcJtLxnw1OIcGVK0H5gvp2tHJ2PaHm7kpqy 93NJ7UD3crZdcVV84icY4cKagknDnzA4JnoIegIZqRTt/moPAj6PYYya4RHDXJdCox2N dPWIW4xAsxbinNlVacqqNAP+zk9kqRfu+Oe04dgcYVyui9qEv3qyOZuwkNZNtEb61dyR Sa1Q== X-Gm-Message-State: AOAM5324Xh+Vikt0bJnMwxb7TRry0v8skv+mtjroxmwlxKswXwsK7IGs gVLxbm+BC0RtM0eJgLINFkuSfftFNaZ4ev+i/G3dQM1VQE7BxRj/PVm1xTeomCP+1snvFHD6czV c0yonfRewoJDJJVR3Qe2YEEPFC5zG5n7edAs6zAVMz8/96bQCYedmQ/56lg== X-Received: by 2002:a05:6512:32ca:: with SMTP id f10mr4992334lfg.498.1632994665302; Thu, 30 Sep 2021 02:37:45 -0700 (PDT) X-Received: by 2002:a05:6512:32ca:: with SMTP id f10mr4992318lfg.498.1632994665112; Thu, 30 Sep 2021 02:37:45 -0700 (PDT) MIME-Version: 1.0 References: <20210921053356.1705833-1-alexandre.ghiti@canonical.com> In-Reply-To: From: Alexandre Ghiti Date: Thu, 30 Sep 2021 11:37:34 +0200 Message-ID: Subject: Re: [PATCH] drivers: mfd: da9063: Add restart notifier implementation To: Adam Thomson Cc: Support Opensource , Lee Jones , "linux-riscv@lists.infradead.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 29, 2021 at 3:33 PM Adam Thomson wrote: > > On 24 September 2021 17:17, Alexandre Ghiti wrote: > > > > > +static int da9063_restart_notify(struct notifier_block *this, > > > > + unsigned long mode, void *cmd) > > > > +{ > > > > + struct da9063 *da9063 = container_of(this, struct da9063, > > > > restart_handler); > > > > + > > > > + regmap_write(da9063->regmap, DA9063_REG_PAGE_CON, 0x00); > > > > + regmap_write(da9063->regmap, DA9063_REG_CONTROL_F, 0x04); > > > > + regmap_write(da9063->regmap, DA9063_REG_CONTROL_A, 0x68); > > > > + > > > > + return NOTIFY_DONE; > > > > +} > > > > > > I will talk with our HW team to clarify, but this sequence looks to be very > > > specific to the needs of the platform in question which doesn't feel right to > > > me. As was mentioned on another thread as well, the watchdog driver already > > has > > > a restart function to reset the device (and thus the system), so I don't believe > > > we should have multiple of these. > > > > From the discussion that happened here > > https://www.dialog-semiconductor.com/products/pmics?post_id=10052#tab- > > support_tab_content, > > it does not seem possible to use the watchdog on a chip whose OTP does > > not set AUTOBOOT. But anyway, I'm looking forward to hearing from the > > HW team :) > > So I've discussed this internally and so far it's not completely clear how the > sequence you provided actually performs the reset as you suggest. It certainly > doesn't look like it should, so maybe this relates to an external pin somehow > triggering the restart in this particular scenario? I'd be interested to > understand which event bits are set when the board does restart to understand > what did actually trigger the boot-up. > > Regardless of this though, the consensus right now would be to use the RTC as a > wake event to restart the platform. An alarm can be set for a couple of seconds > into the future (or longer if required) and that would provide the event > required to come up from powerdown/shutdown, in the absence of AUTOBOOT being > set in OTP. I believe this would be the safest route to take in this case. You > can then just use the SHUTDOWN bit on CONTROL_F to take down the board. > > To reiterate, I believe this should be made a board specific quirk, rather than > as part of the generic MFD core of DA9063, as the timings may vary for other > platforms. What timings are you referring to? Is the timing you're talking to the time between the shutdown and the tick that wakes the device up? Because I have another series ready which uses a new device tree binding so that platforms that want the reset from the DA9063 can ask for it via the device tree. And then I could add a property "duration" that is platform dependent.