Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4824860pxu; Thu, 10 Dec 2020 06:26:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJzhXjGaWdmsgr9ue02IoMUJeejZaFqZ0c+7Zj6aDOffYlAeM/rK0gU+Fqn6thkqKb6ls+kJ X-Received: by 2002:a17:907:105e:: with SMTP id oy30mr6615323ejb.495.1607610418565; Thu, 10 Dec 2020 06:26:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607610418; cv=none; d=google.com; s=arc-20160816; b=QvwnkqGPShJn9HnlI6A4R3POHt1wBURurz3G6B5Ye34AvcW1FZoA/7gt6Ua5TspcWz LtcCE9cRzJoe1G7jfZ8mI9uPbIpcD1pMUrKu2amtB/ICKRYLSH577+qnvj2auDwF9E2f jE8vZiVcERgURxlpeuikuw39EO+JeFFOGXhlPObqbHunHX4MGvoO1VG4D3RdcfZUeUdj 8XdEtxzy5sW4mp7ys/Qw38pRwEVVDxGVD10EG9DnRdDiL7cWmlW05e/nEzR4zFm/HUye BK6nsi608/cWenrMzoTscujx+PVi//lR61NnGGocv8d0sdNs5lV+SgIy6yrk5Qv2Rypq /Qqg== 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:dkim-signature:date; bh=VlTWv1tXsi2bpAH7/1go9tanWIlil7iuxBNxfHppb9Q=; b=u6P4IrNRaLHElmtiy68EeGeGBJDYCu7P4vgyrGT5Nt0fS/xZTC0gVmz+fuxVa5FeUx 5E+roSuuspbHkIkxDprQZhtuvtXMy82kX9Hct7sH7Y+6kx4h0r61fD/O/Imcrp6aou/J KIhS5PAESeFoysG64l2OV2WfysG8J0sCnzVGtXmcXUxNO9B52ngMCVaU/u0jOAXnpX47 fWYV6JGpHnx7Dx2kK4YGOejRWrlCDB8JLAmJcgDuQL3hd6jdy/0mK/DVrfV+A30XoO5/ frGtJHzhE/zgPdbU1K1caJxSb/qaAo+Rz9dZoIGOELY6FDzbAQE7Yh/2KS4yia6jSXnc Hv7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="W/hNtwb4"; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si3068860edj.263.2020.12.10.06.26.33; Thu, 10 Dec 2020 06:26:58 -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=@linuxfoundation.org header.s=korg header.b="W/hNtwb4"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730876AbgLJK3q (ORCPT + 99 others); Thu, 10 Dec 2020 05:29:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:52868 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725988AbgLJK3e (ORCPT ); Thu, 10 Dec 2020 05:29:34 -0500 Date: Thu, 10 Dec 2020 11:30:07 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1607596133; bh=NOlYB6gWlOdhNT+lTIb0YEj6TcISa/ub3wn3vWVEtbI=; h=From:To:Cc:Subject:References:In-Reply-To:From; b=W/hNtwb4Cvp7YAvD4fjYfG8+02skCrsmdplJz2tPlnYuQ7QbupdZltryuQ6QAzzEs UBLGVhyQPhZ3lqYuxa9F15bTK7gIWNMvc+dQisPTR7fB0IY6MJB8xwanBnRIjdQp98 DvYwG+xVcmyDlT9AZaQmyWeNNGQ+jho7nW2xr5qg= From: Greg Kroah-Hartman To: John Wang Cc: Lotus Xu , =?utf-8?B?6YOB6Zu3?= , Oskar Senft , Yong Li , Vernon Mauery , Joel Stanley , Andrew Jeffery , Jonathan Corbet , Derek Kiernan , Dragan Cvetic , Arnd Bergmann , "moderated list:ARM/ASPEED MACHINE SUPPORT" , "moderated list:ARM/ASPEED MACHINE SUPPORT" , open list , "open list:DOCUMENTATION" Subject: Re: [External] Re: [PATCH 1/3] misc: aspeed: Add Aspeed UART routing control driver. Message-ID: References: <20201210092853.303-1-wangzhiqiang.bj@bytedance.com> 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 Thu, Dec 10, 2020 at 06:06:59PM +0800, John Wang wrote: > On Thu, Dec 10, 2020 at 5:42 PM Greg Kroah-Hartman > wrote: > > > > On Thu, Dec 10, 2020 at 05:28:53PM +0800, John Wang wrote: > > > From: Oskar Senft > > > > > > This driver adds sysfs files that allow the BMC userspace to configure > > > how UARTs and physical serial I/O ports are routed. > > > > > > Tested: Checked correct behavior (both read & write) on TYAN S7106 > > > board by manually changing routing settings and confirming that bits > > > flow as expected. Tested for UART1 and UART3 as this board doesn't have > > > the other UARTs wired up in a testable way. > > > > > > Signed-off-by: Oskar Senft > > > Signed-off-by: Yong Li > > > Signed-off-by: Vernon Mauery > > > Signed-off-by: John Wang > > > --- > > > .../stable/sysfs-driver-aspeed-uart-routing | 14 + > > > .../misc-devices/aspeed-uart-routing.txt | 49 +++ > > > drivers/misc/Kconfig | 6 + > > > drivers/misc/Makefile | 1 + > > > drivers/misc/aspeed-uart-routing.c | 383 ++++++++++++++++++ > > > 5 files changed, 453 insertions(+) > > > create mode 100644 Documentation/ABI/stable/sysfs-driver-aspeed-uart-routing > > > create mode 100644 Documentation/misc-devices/aspeed-uart-routing.txt > > > create mode 100644 drivers/misc/aspeed-uart-routing.c > > > > > > diff --git a/Documentation/ABI/stable/sysfs-driver-aspeed-uart-routing b/Documentation/ABI/stable/sysfs-driver-aspeed-uart-routing > > > new file mode 100644 > > > index 000000000000..5068737d9c12 > > > --- /dev/null > > > +++ b/Documentation/ABI/stable/sysfs-driver-aspeed-uart-routing > > > @@ -0,0 +1,14 @@ > > > +What: /sys/bus/platform/drivers/aspeed-uart-routing/*/io* > > > +Date: August 2018 > > > +Contact: Oskar Senft > > > +Description: Configures the input source for the specific physical > > > + serial I/O port. > > > +Users: OpenBMC. Proposed changes should be mailed to > > > + openbmc@lists.ozlabs.org > > > + > > > +What: /sys/bus/platform/drivers/aspeed-uart-routing/*/uart* > > > +Date: August 2018 > > > +Contact: Oskar Senft > > > +Description: Configures the input source for the specific UART. > > > +Users: OpenBMC. Proposed changes should be mailed to > > > + openbmc@lists.ozlabs.org > > > diff --git a/Documentation/misc-devices/aspeed-uart-routing.txt b/Documentation/misc-devices/aspeed-uart-routing.txt > > > new file mode 100644 > > > index 000000000000..cf1c2a466875 > > > --- /dev/null > > > +++ b/Documentation/misc-devices/aspeed-uart-routing.txt > > > @@ -0,0 +1,49 @@ > > > +Kernel driver aspeed-uart-routing > > > +================================= > > > + > > > +Supported chips: > > > +ASPEED AST2500/AST2600 > > > + > > > +Author: > > > +Google LLC > > > + > > > +Description > > > +----------- > > > + > > > +The Aspeed AST2500/AST2600 allows to dynamically route the inputs for the > > > +built-in UARTS and physical serial I/O ports. > > > + > > > +This allows, for example, to connect the output of UART to another UART. > > > +This can be used to enable host<->BMC communication via UARTs, e.g. to allow > > > +access to the host's serial console. > > > + > > > +This driver is for the BMC side. The sysfs files allow the BMC userspace > > > +which owns the system configuration policy, to configure how UARTs and > > > +physical serial I/O ports are routed. > > > + > > > +The driver provides the following files in sysfs: > > > +uart1 Configure the input signal to UART1. > > > +uart2 Configure the input signal to UART2. > > > +uart3 Configure the input signal to UART3. > > > +uart4 Configure the input signal to UART4. > > > +uart5 Configure the input signal to UART5. > > > +io1 Configure the input signal to physical serial port 1. > > > +io2 Configure the input signal to physical serial port 2. > > > +io3 Configure the input signal to physical serial port 3. > > > +io4 Configure the input signal to physical serial port 4. > > > +io5 Configure the input signal to physical serial port 5. > > > + > > > +When read, each file shows the list of available options with the currently > > > +selected option marked by square brackets "[]". The list of available options > > > +depends on the selected file. > > > + > > > +Example: > > > +$ cat /sys/bus/platform/drivers/aspeed-uart-routing/*.uart_routing/uart1 > > > +[io1] io2 io3 io4 uart2 uart3 uart4 io6 > > > + > > > +In this case, UART1 gets its input signal from IO1 (physical serial port 1). > > > + > > > +$ echo -n "uart3" \ > > > + >/sys/bus/platform/drivers/aspeed-uart-routing/*.uart_routing/uart1 > > > +$ cat /sys/bus/platform/drivers/aspeed-uart-routing/*.uart_routing/uart1 > > > +io1 io2 io3 io4 uart2 [uart3] uart4 io6 > > > > Are you sure there are no other ways to configure this type of thing, > > than to a driver-specific sysfs file? > > I think this is good. but what's your suggestion? I do not know, but isn't this normally handled in a dts file? Why must it be done "on the fly" like this? > If I use a driver-specific sysfs and modify the code based on the > comments, is this a good direction to go? That's what you are trying to do here, and is why I am objecting to it :) thanks, greg k-h