Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp275710pxb; Wed, 20 Jan 2021 06:51:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJyIM+KHqru7O10bO0IOKEkxbCP+cLmQvxIb68a/pRVp8WnTO+PHETCHduoaQoeZeh3bHjV0 X-Received: by 2002:aa7:c9cf:: with SMTP id i15mr7489093edt.296.1611154315972; Wed, 20 Jan 2021 06:51:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611154315; cv=none; d=google.com; s=arc-20160816; b=lD2XaqIfH9sEu734Ln37fuy1u0TZd/l/W8yGBikUNv+0Tf6jv5sd9d+nFZuu/5ExPa VHl79iL+0lwhJ4zUTPog6mQi6hzsov5IvY319uyTZddwOdicBJUDOE3u9TF9x/9V44RR PkbMWciTaZZdFytcp2vuM9VzBicGK8QHW8ypuXTUMO8aUdLLvkjmD/Cy2paV4U7kriok jlBg5eNAgTtFX6krUC1r99GvONeQwzZYnd9DRoXNaY0gTkngvtBF7roT8ItkOv3i92g6 Fe4URJpc4xgbtEQJLHKIYzItHJyHLMUgxcfupD75srzyv6UkTwo+mU19dA5m6orrRnXW DKxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ZOvZA96ZqHhYYsl3TXxpU61JXBoyw6gS3vQQtm7WhqA=; b=jtL1kvffANjvKLUxpmKNbuISejeCDT1uU/eHaQyBzv+mDhu/5eP5/GKInGK03RmjGZ 0SfOj6N6HrgbApbatq3oPoi/cmPVeBSsxufffAw1UTy8qxOszCRux9p0BQqMmkX9qVk+ BpaitgCyFEe6jMK1GjFbCaw4yGktYWGeh+yKCcf8hIW0K/nKCMYCZDL3dACcqaIvsowk 4ugDQDlRYmZTj43kjUHCKVHpe3Gb10kltwrnOJKwqB8X71igxTRqCTCxRGuJd2rltqSq W77XWj6sHobGlkKbIynoI20v1nfrgRUxO48HLvKgStDWqkYacfHvKaefeW5EczkXdK3t /hGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XGLsFqBf; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p19si753878eji.91.2021.01.20.06.51.31; Wed, 20 Jan 2021 06:51:55 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=XGLsFqBf; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390461AbhATONn (ORCPT + 99 others); Wed, 20 Jan 2021 09:13:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728002AbhATNHn (ORCPT ); Wed, 20 Jan 2021 08:07:43 -0500 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 680F7C061757 for ; Wed, 20 Jan 2021 05:07:03 -0800 (PST) Received: by mail-pf1-x42d.google.com with SMTP id j12so7303937pfj.12 for ; Wed, 20 Jan 2021 05:07:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ZOvZA96ZqHhYYsl3TXxpU61JXBoyw6gS3vQQtm7WhqA=; b=XGLsFqBfw29Axuri0oRGB/SxGWwPC7x9iXNKeWx1fOQd8pNcWe580ocWmP+vByX8p2 2djvXDWYV6b/0PPSyWBfS0TzmYUHM7drEbSJlaGFF7+93p0iv8HKen6LU3BtbwX4fnDz YTqBI0q3y8GI37coPtA8sJsqBfyNv/H8hikQ9tWeA44biBh7fvY0O3hf5k1qRacdCrVj 9k6DSywqBx/oolXcfCqKs1CWp/IgmBQVKla7D5PKMGqpAv8Fm+4Xq8LIjrmHevXwluBE 3s0dLTxUFPLrIkdJp+L0nzWbu7PclY62v0aZyEaYwDNeDusMNXf1jwIXalp2k46eUmjo OHKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ZOvZA96ZqHhYYsl3TXxpU61JXBoyw6gS3vQQtm7WhqA=; b=bgeGunh/pN9Bc6NM8OAswzqBBOuLCTEaQfSTmZxupd8FwlSF7P08CgW0n8fsDaIGVT fzq78MC7Qx+xuaqadj9j40mR0kPTrSr6EiVBh8XHdAcG4ovMjEPmQCQTJ7HRt7VE7oso 4XjV/NB6wdWcTvLUB5MYoXTWyXZLPN7mfPpfQO3DCX5UbMxfY+yFO1K+JMCDjUYX6AAh o5PX9jaF7zYDiJqYVrGsE7plVJ8rmE18mNXIwIaPiG1vd15qpoWHY4TY+8PhfJScBhGT CY++Y+NEU9fb+g67K2qi8dSfh1LWqKstRsbUm2/3DsRM4FiNjoD528n3DBgwMqhJfUUH +XpA== X-Gm-Message-State: AOAM5332KwtTz5ukHFi3PPNSqJcLWt3rGdtvtLFWtWB+0L7Y7x/Yw5Oy w3j5/FJB9StSyeZgG6HKSEc= X-Received: by 2002:aa7:8eda:0:b029:19e:c8c3:ed74 with SMTP id b26-20020aa78eda0000b029019ec8c3ed74mr9014247pfr.66.1611148022806; Wed, 20 Jan 2021 05:07:02 -0800 (PST) Received: from localhost (g238.115-65-210.ppp.wakwak.ne.jp. [115.65.210.238]) by smtp.gmail.com with ESMTPSA id r30sm2593787pjg.43.2021.01.20.05.07.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jan 2021 05:07:01 -0800 (PST) Date: Wed, 20 Jan 2021 22:06:59 +0900 From: Stafford Horne To: Geert Uytterhoeven Cc: Karol Gugala , Mateusz Holenko , Gabriel Somlo , linux-riscv , Linux Kernel Mailing List , Joel Stanley Subject: Re: [PATCH v4] drivers/soc/litex: Add restart handler Message-ID: <20210120130659.GN2002709@lianli.shorne-pla.net> References: <20210119080938.1832733-1-geert@linux-m68k.org> <20210119213444.GL2002709@lianli.shorne-pla.net> <20210119221110.GM2002709@lianli.shorne-pla.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 20, 2021 at 09:20:39AM +0100, Geert Uytterhoeven wrote: > Hi Stafford, > > On Tue, Jan 19, 2021 at 11:11 PM Stafford Horne wrote: > > On Wed, Jan 20, 2021 at 06:34:44AM +0900, Stafford Horne wrote: > > > On Tue, Jan 19, 2021 at 09:09:38AM +0100, Geert Uytterhoeven wrote: > > > > Let the LiteX SoC Controller register a restart handler, which resets > > > > the LiteX SoC by writing 1 to CSR_CTRL_RESET_ADDR. > > > > > > > > Signed-off-by: Geert Uytterhoeven > > > > > > Thanks, this looks good to me, queued to my linux-next branch. > > > > > > -Stafford > > > > > > > @@ -66,8 +71,19 @@ static int litex_check_csr_access(void __iomem *reg_addr) > > > > > > > > struct litex_soc_ctrl_device { > > > > void __iomem *base; > > > > + struct notifier_block reset_nb; > > > > }; > > > > > > > > +static int litex_reset_handler(struct notifier_block *this, unsigned long mode, > > > > + void *cmd) > > > > +{ > > > > + struct litex_soc_ctrl_device *soc_ctrl_dev = > > > > + container_of(this, struct litex_soc_ctrl_device, reset_nb); > > > > > > Nice. > > > > > > > + litex_write32(soc_ctrl_dev->base + RESET_REG_OFF, RESET_REG_VALUE); > > > > + return NOTIFY_DONE; > > > > +} > > > > + > > > > Actually, I tested this out on the latest (2-weeks ago) Litex and > > openrisc/for-next and it didn't seem to work correctly. > > > > I will look into it a bit closer, but if you see or can think of anything let > > me know. Note There are a few failures below related to network services as my > > for-next kernel doesnt have a network driver (yet). > > Hmmm, openrisc/for-next does have commit 131172a4a8ce3fcc ("openrisc: > restart: Call common handlers before hanging"). > > It's been a few years I used an OpenRISC setup. > Do you have a link to Linux on mor1kx/LiteX setup instructions? Actually, I rebuilt everything again and it works fine. FYI, my instructions for setup are here: - https://github.com/stffrdhrn/or1k-utils/tree/master/litex I use an arty dev board, you can see the reset working below. There are some things I need to fix in my dev rootfs shutdown scripts but it does reset. # shutdown -r now Broadcast message from root@buildroot (console) (Thu Jan 1 00:01:07 1970): The system is going down for reboot NOW! INIT: Switching to runlevel: 6 # mounting home work nfs ... mount: mounting 10.0.0.27:/home/shorne/work on /home/shorne/work failed: No such device enabling login for shorne ... setting coredumps ... Stopping dropbear sshd: FAIL Stopping ntpd: FAIL Nothing to do, sntp is not a daemon. Stopping network: ifdown: interface lo not configured ifdown: interface eth0 not configured OK Saving random seed: [ 70.960000] random: dd: uninitialized urandom read (512 bytes read) OK Stopping klogd: OK Stopping syslogd: start-stop-daemon: warning: killing process 51: No such process FAIL umount: devtmpfs busy - remounted read-only umount: can't unmount /: Invalid argument [ 72.650000] reboot: Res __ _ __ _ __ / / (_) /____ | |/_/ / /__/ / __/ -_)> < /____/_/\__/\__/_/|_| Build your hardware, easily! (c) Copyright 2012-2020 Enjoy-Digital (c) Copyright 2007-2015 M-Labs BIOS built on Jan 20 2021 21:18:10 BIOS CRC passed (b12f1de3) Migen git sha1: 40b1092 LiteX git sha1: 57289dd4 --=============== SoC ==================-- CPU: MOR1KX @ 100MHz BUS: WISHBONE 32-bit @ 4GiB -Stafford