Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5526418ybl; Tue, 27 Aug 2019 06:07:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxr5dekqnRSBqm3Io8qQTI+6QZYjx7mRDmUZqGsTlxPi8k+r87/8WK0TtjZXyTdlH6PK/Yc X-Received: by 2002:a63:db47:: with SMTP id x7mr21191626pgi.375.1566911275441; Tue, 27 Aug 2019 06:07:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566911275; cv=none; d=google.com; s=arc-20160816; b=D4/egGQX0jIB7bEqumoPInKwzv2t7t76qp1JP4LOLG/PZo5XO/xSlgoOiqlAxKhWdk yv20Z0MqmktCDA6BiaChW/2hWLh8iV1UGLgEn+Kg1R6cFeUUgMZVz3DXby1OW5S/XOEV ueujEZIdW0J+uF15a0Btj3vXT+4//Rj+FydVQsZTYSrlvH99BxK/HIujNMasVRpnU1rx ZXLucJ53ZEmWwQJIWv2+6qHhl4ji2nTU4tgaVelLbkiaRI8wxGg2sMlo+rbpCRGOqu32 Szw2xYHhosQ5vVEhIa+UtVmuVL8qyNuiRDaPudq5MvQguhtG/mG0ylXUWReeQl3xpRxP i6pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=tLfakLGpMLvdTV8QFc4nFi+HIp0PsQAUDM5NCWw4kOM=; b=jBZMBTYQL6WIPqvldVhUMrZHcJn/kVVlT/RqFtZ8BuKf1Z27bdjx+7Rq4QeU7w0b05 XcRA44Z1fs4KvKBvhB4mK5VV9B+r53YpnJyjAx/RNMCdDApOtl5KDx59eZ1ayFTP0qHF FZcfSs/a29gOd1MnS9PPXirO6xww9eWyKTqjFlLWIsDH+3A3N/GYamLpx3LVtN2ekpV+ djpTuMJhn+CY7C05iFbRfoKfqzLcx6bucauI+uOfAt61CPfjhMjHM4WEzJo3UChd+yJm CiN87JzjWPlhhznr1NRlY9sxe7ATW+abbn57X79CHpd4qS/kXvv3k5XpeqgaEHsJ1omS hdEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="e3RW4O/b"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3si13671371pfn.140.2019.08.27.06.07.38; Tue, 27 Aug 2019 06:07:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="e3RW4O/b"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727138AbfH0NGg (ORCPT + 99 others); Tue, 27 Aug 2019 09:06:36 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:35112 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726054AbfH0NGg (ORCPT ); Tue, 27 Aug 2019 09:06:36 -0400 Received: by mail-pg1-f193.google.com with SMTP id n4so12687617pgv.2; Tue, 27 Aug 2019 06:06:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=tLfakLGpMLvdTV8QFc4nFi+HIp0PsQAUDM5NCWw4kOM=; b=e3RW4O/bkBNjJRXt0syqTSuQGa6iNaNuqgXq1e20CmuXTlkyv4RT1GXqxjJswj3P9n /YdtWylwjfbPGSAQdoXp4eYTIbehmw1D9qGRsg1gTqCMVaKrxKQWjCdN86PKqUq51kRq NR8qAB0zKrdjK75IhJeRlJgDOAXQNeFdgAjdFD4dBsx4aN9OEFmUQFHpIvf8vtA0Bj70 ket1ALJGUasj0Ii86eSbQCX2dj2wHIOF1zoAwi0pGp63B+/MuqFU13+jrGuTeNXLRXKG 6OQqyleuALUIjqcKCCtWtnbGPvmSg1mzEQWWArfw4basGrT1oA/gbONb+qvQ5t4qTte8 UQDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=tLfakLGpMLvdTV8QFc4nFi+HIp0PsQAUDM5NCWw4kOM=; b=pbHCZEAOLetKCRzGf5GsdRs6WElwESHdRdobz/kwaeb9+CxleZWf83EgnNYlTqSZmL p+rMYNKNN6c2z7AZXG2EXdxzdWUN0m5Lc/P8WIgtZDGW0HuUIZY97oM/0gCjdvG5ny83 SCoyeAfbKWzzIJwBl+opfvQ+5ACs5rCatKMDnKhduNjYpWUhejeGvtB9zdr7S0dpWulh FhVT9s5f4AYN1sxUcKBlLG0l/AZlGdPqZHMQUyhNStH9/8cx9t7fuBRD+P1iieToYSsW SyKB+LI5/hrvcs9e/rONdQ5rhSifob+D5RX61vgg8wZo5jJHhYwRDF2dojZ3gZzvvKa0 TEDw== X-Gm-Message-State: APjAAAW7uHObV+ILc8VSmdcBBS9YwsHvI3phIa9NDExXdpeXH9wXrYrv 2XhzDbObJwtimc1xrFoDY9QBGC6p X-Received: by 2002:a63:c203:: with SMTP id b3mr21289785pgd.450.1566911194546; Tue, 27 Aug 2019 06:06:34 -0700 (PDT) Received: from server.roeck-us.net (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by smtp.gmail.com with ESMTPSA id a23sm11467191pfc.71.2019.08.27.06.06.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Aug 2019 06:06:32 -0700 (PDT) Subject: Re: [PATCH v2 3/4] watchdog/aspeed: add support for dual boot To: Ivan Mikhaylov , Wim Van Sebroeck Cc: Joel Stanley , Andrew Jeffery , linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, Alexander Amelkin , openbmc@lists.ozlabs.org, Rob Herring , Mark Rutland , devicetree@vger.kernel.org References: <20190826104636.19324-1-i.mikhaylov@yadro.com> <20190826104636.19324-4-i.mikhaylov@yadro.com> <0df27d36-b45f-2059-6ead-a09ceb4b7605@roeck-us.net> <818746d20661b51914a7802dcbe0081352900b05.camel@yadro.com> From: Guenter Roeck Message-ID: Date: Tue, 27 Aug 2019 06:06:30 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <818746d20661b51914a7802dcbe0081352900b05.camel@yadro.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/27/19 2:24 AM, Ivan Mikhaylov wrote: > On Mon, 2019-08-26 at 17:14 -0700, Guenter Roeck wrote: >>> +/* >>> + * At alternate side the 'access_cs0' sysfs node provides: >>> + * ast2400: a way to get access to the primary SPI flash chip at CS0 >>> + * after booting from the alternate chip at CS1. >>> + * ast2500: a way to restore the normal address mapping from >>> + * (CS0->CS1, CS1->CS0) to (CS0->CS0, CS1->CS1). >>> + * >>> + * Clearing the boot code selection and timeout counter also resets to the >>> + * initial state the chip select line mapping. When the SoC is in normal >>> + * mapping state (i.e. booted from CS0), clearing those bits does nothing >>> for >>> + * both versions of the SoC. For alternate boot mode (booted from CS1 due >>> to >>> + * wdt2 expiration) the behavior differs as described above. >>> + * >> The above needs to be in the sysfs attribute documentation as well. > > My apologies but I didn't find any suitable, only watchdog parameters with > dtbindings file, where should I put it? Documentation/watchdog/aspeed-wdt- > sysfs.rst? > Documentation/ABI/testing/sysfs-class-watchdog Guenter >>> + * This option can be used with wdt2 (watchdog1) only. >> >> This implies a specific watchdog numbering which is not guaranteed. >> Someone might implement a system with some external watchdog. >> >>> + */ >>> +static DEVICE_ATTR_RW(access_cs0); >>> + >>> +static struct attribute *bswitch_attrs[] = { >>> + &dev_attr_access_cs0.attr, >>> + NULL >>> +}; >>> +ATTRIBUTE_GROUPS(bswitch); >>> + >>> static const struct watchdog_ops aspeed_wdt_ops = { >>> .start = aspeed_wdt_start, >>> .stop = aspeed_wdt_stop, >>> @@ -306,9 +359,16 @@ static int aspeed_wdt_probe(struct platform_device >>> *pdev) >>> } >>> >>> status = readl(wdt->base + WDT_TIMEOUT_STATUS); >>> - if (status & WDT_TIMEOUT_STATUS_BOOT_SECONDARY) >>> + if (status & WDT_TIMEOUT_STATUS_BOOT_SECONDARY) { >>> wdt->wdd.bootstatus = WDIOF_CARDRESET; >>> >>> + if (of_device_is_compatible(np, "aspeed,ast2400-wdt") || >>> + of_device_is_compatible(np, "aspeed,ast2500-wdt")) >>> + wdt->wdd.groups = bswitch_groups; > >> Kind of odd that the attribute only exists if the system booted from the >> second flash, but if that is what you want I won't object. Just make sure >> that this is explained properly. > Perhaps dts configuration option would be better solution for it then? "force- > cs0-switch" as example? Also, if it would be an option, dtbindings/wdt file for You said earlier that this can not be done automatically but _must_ be done from user space after the system has booted. Otherwise you could just automatically switch to cs0 when the driver probes. As I said, all I am asking for is proper documentation. Guenter > documentation will be the right place for it. Usage of this at side 0 will not > get any good/bad results, it just makes user confused, so I decided to put it > only at side 1. It works only for ast2400/2500 board unfortunately, for 2600 > there is big difference in switching mechanism. Any other thoughts how to make > it better? > > Thanks. > >