From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42C7DC433FE for ; Thu, 10 Dec 2020 10:29:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 02CB623B31 for ; Thu, 10 Dec 2020 10:29:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730999AbgLJK3q (ORCPT ); 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D4B7C433FE for ; Thu, 10 Dec 2020 10:30:06 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CBCEB23AC4 for ; Thu, 10 Dec 2020 10:30:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CBCEB23AC4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=hssL66YI4NViKeskTn85W8kxkN8ZdARNDvuS4J5bhD0=; b=L2LmUpYitWQxnweLYB1fefy5o GnWfbbTym9Uqiibmi3DUSHiG5/peqH+kQDTfOMqXwMebGqFTTv1bJX/HML29iiEUuLr96iTHPwXPT 7qhmdfSLVy8TNKCvuu/ZW4Uh4NaNSftz6i/4qLh9GN0eePvySmhzivdw8lvZdUi3IXW1fwiBC5k3M JV9GB7ZH8l6Fy1Uyr5pXrGWg4H3H2zc7qr+iIZQNEiiOP1t8rOuA0cGWiLGwwmN6k3LT7VvUvaejc pa0+oK9JCKYj58ZebdwjWrK5+tjtRzPhpsJSIm0T59qt5IllDtapHZlFJhVvn7dkKKkdAZIbIOu+S BrKYEog7g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1knJBw-0006c4-Kv; Thu, 10 Dec 2020 10:28:56 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1knJBu-0006bO-1p for linux-arm-kernel@lists.infradead.org; Thu, 10 Dec 2020 10:28:55 +0000 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 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-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201210_052854_274610_8FAF1E7E X-CRM114-Status: GOOD ( 32.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "moderated list:ARM/ASPEED MACHINE SUPPORT" , Arnd Bergmann , Jonathan Corbet , Andrew Jeffery , Vernon Mauery , Dragan Cvetic , =?utf-8?B?6YOB6Zu3?= , Yong Li , open list , "open list:DOCUMENTATION" , Joel Stanley , Derek Kiernan , Lotus Xu , "moderated list:ARM/ASPEED MACHINE SUPPORT" , Oskar Senft Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel