Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp245760pxb; Thu, 30 Sep 2021 05:19:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9vy61M5dwyASR+5QMtiBY13ZGku2ERrbuXdvq8+yBa/JjJTh7knDFgNJS8xDeXLiJ+xfq X-Received: by 2002:a17:90b:33cc:: with SMTP id lk12mr6063399pjb.191.1633004349040; Thu, 30 Sep 2021 05:19:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633004349; cv=none; d=google.com; s=arc-20160816; b=GdvmWk0IIirFaDCyCj0DWsjtWniJVO1g7I9TDrhr3Us+c/wgmdFFWfKH8qEyogoJdg z63+PREYaxBFFoQDZrBgkp32FNhQPWp4TuQuS2iv0wpXPcYDkIGpMpuyuOZu5SOg8jSn 3Ag5blgl024iI8ni0hdj+W4ElHbDRnkPkE2B9VoGDF7v0teBuuLN6zQ08D17UDrcHeXx zuPLAZaz7ys3xfaj6ntzUb5o16pI6HH0rmrGte6l6cJeBCSqlut/N/1noMiP+07D7A8c l6TXEsrR9VQ/mty0g8owZ8s4IItEVsm3tlmE73EVCflbNgB40nmwVxrdBklP+HKJVdKw G8HQ== 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=pqAX+UbJIa/RMJv8j6rl+G+R+tbCZ7fA5m1R+K85bTM=; b=zXi175Igim4sYMiiIISREP9bBkrp9zhVycZhtxQEkPt0U4VJKkAC+cJL+zvmZYGCxd TKZUdGz0PP7W1f1/FAcNV9BSY8FISVHs2+qk3x6L1Ps0ZKa/XKGx23zgm7JmUd42E7tC bAhaWAosE4G86pJaSHrWIb9j7dzAdh1CfHC6CHXSQXIEQH50x5IO1QlDXJ9+AJn/fING 0XqL7SKr6Q5XIp53InNFDSg2CUmCEsu/f+9+RmoY8E+1J5DLx79T9SoF+Ui7gid5B1bU e7VI0Uwf8g2j3wCYiz7R+627eMX4m9xd7SlM/oOSg2sS8/6xquEVWGjSb1fOTR/PsyDO mdVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=Coj8IMPq; 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 q199si3642262pgq.595.2021.09.30.05.18.52; Thu, 30 Sep 2021 05:19:09 -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=Coj8IMPq; 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 S1349583AbhI3J5N (ORCPT + 99 others); Thu, 30 Sep 2021 05:57:13 -0400 Received: from smtp-relay-internal-1.canonical.com ([185.125.188.123]:57826 "EHLO smtp-relay-internal-1.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238316AbhI3J5K (ORCPT ); Thu, 30 Sep 2021 05:57:10 -0400 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (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 992204025C for ; Thu, 30 Sep 2021 09:55:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1632995727; bh=pqAX+UbJIa/RMJv8j6rl+G+R+tbCZ7fA5m1R+K85bTM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Coj8IMPqpFx00+3UZ87iL3TxNl8BnxZtvCql+1ieHUWjy1QTen5UFIKh3BNHOZFlr LFWfKWSHawhBVXgmq+a++aBfIiLCmQqCVsg1kOuBaCRJyN5EuhqWpZLxgvk1BjhiYm d5jKTWu9vqSNG7OqFWVx1zQ7iELEf5vACdMySwmiIxxJqtpa8zNba99+R0CO/Nn4Kr 4r5joUvZhwS2XnTwVktWGASPI+Q/8RUaXT9IwjM9q1dYol4YUs7LanCJRDKJkhTaHw hxzlBnAL1doACEw2q1LMUNcr5rlLf7AV4VmZIRXbg1ymbQDn3ZKQjbslsetabP09Z2 cC7ziKreG4rBA== Received: by mail-ed1-f69.google.com with SMTP id r11-20020aa7cfcb000000b003d4fbd652b9so5664443edy.14 for ; Thu, 30 Sep 2021 02:55:27 -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=pqAX+UbJIa/RMJv8j6rl+G+R+tbCZ7fA5m1R+K85bTM=; b=31TFnxAVfUvO1LUUZGxM4807ZFQ5MVfY8dP1cy814fVyeESGzQomxf7C7VMRUfK7N/ wcpdO1gjfkM7H6SfCtidwdk4Ca6GOfqY/il2Ngn+oUi3QWaAim2BzH6iH1aTof66oTM3 RBLid6BpbJ+oiuj64SIzEZF95q/es36f+d9aS3oXokxSzko43i/D/RdfPaY6451QrbK/ u5UDCYVhm7XHCi5NzNmPGmBOdoRQCbMAKObs18sgI9ERoToAG4vaO/8rHUrrBMfCsDa6 0v7kAqZECjPD3Po2c02nMa2nfLFXgiQ/emfH5eviX4XBF0ZmBfAsfpuZQdtUcl3M37MN XauQ== X-Gm-Message-State: AOAM530fwn0jUgkhyRzNClIy/y2RfslbobWUIWx6coN3fczPySbSnmBS UhLhr+pLZZ8fwTFAXgr34VffWosX2JGDPgdTd0rc75fhloCvA4WdYUgQkYcglE29KhAiNyl/o8l DuhQYCJwMx2+mN6xS0LgjCdaBYucoDDi+f0U5dlCb9Bk3JkS0j23yPvdVzw== X-Received: by 2002:a50:da49:: with SMTP id a9mr6069826edk.281.1632995727272; Thu, 30 Sep 2021 02:55:27 -0700 (PDT) X-Received: by 2002:a50:da49:: with SMTP id a9mr6069808edk.281.1632995727067; Thu, 30 Sep 2021 02:55:27 -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:55:16 +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 Hi Adam, Thank you for your answer. 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. After clearing all those registers and a reset as done in this patch, I get the following values: FAULT_LOG: 0x00 EVENT_A: 0x10 => As per the datasheet, "Sequencer reached final position caused event" ? EVENT_B: 0x00 EVENT_C: 0x00 EVENT_D: 0x00 Do you need any other info? > > 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. Alex