Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3210779rwb; Thu, 29 Sep 2022 23:36:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ibV/DrLEwitv/Tzlod4QxQ+AU6r6kZD/9tRAsQQm9yFZNxKwagH7c1WX6QPRvgSs1li8O X-Received: by 2002:a05:6402:350a:b0:452:8c84:8b with SMTP id b10-20020a056402350a00b004528c84008bmr6718842edd.93.1664519789646; Thu, 29 Sep 2022 23:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664519789; cv=none; d=google.com; s=arc-20160816; b=FgXRF0HKZsBRyRRtAzDGA2846VPWtSm0AkND4jb1x5laa7hVQIktFri1nvOcSWzshI NHkeZn5OM9bztjcc6+fU67Z2SUk8HwT4+TsrsUp75zrLwPgeJrXF9qcN8w6KMM5yiJ6x XYT8TG5NOF7AkIo9rAcoWKNnyEWL7ICC86B2JN1LAiLAVEBIG7mVNit+0g2vj8rmBG9L FeL9IIFng/5vZueGVeOC3nhA//0Sn9awAR8osDttLyIPy5aC3qZHCv5LxijOO2EnreaF dIE/73v9xD+nqhRvhtRfGTJn9U1flpkPRrbeq2somZD/t5q6TsPqhhOS6gIjqT+g0Jh6 sfNA== 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=j3dhrRwZ/gcv3HAXSwZKEIwdtU9UjnLuGSDCvf5mIEc=; b=X49cQ8FOm7dIjAdeSpF+T25GKLOV0EfC8kyvcxKe4JdkpMUqVACd81flTGPeiVlMNF 6bcEtfyaSiQMZ0X0tMZQFcSg9JL8K8e34O+MdUoOPrdCzt1pVjrb4MfXwh4DjROyRhD0 fnFGhcvaOsh4JEIFzzZizotmX2JwLO+gRa3spya3oN7Iex6bkIXcFwK8QleTSN/Bftc9 Pq1Jiw+HL7jthExh2msbK/VZsAH3QbLuJzFEXPHbHzlQ0QCf3EESB7AHcV/3bc+lsn6i SnUVK0oacl8gJ6npfJOb8Cc20TBLNKAUimJoZIkBhl8LhiPo+BAiVTGls/mKzRbQ1QCD YVSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="n/3DRAaX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga27-20020a1709070c1b00b00773b8e3d83bsi1362678ejc.323.2022.09.29.23.36.04; Thu, 29 Sep 2022 23:36:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="n/3DRAaX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230285AbiI3GQ7 (ORCPT + 99 others); Fri, 30 Sep 2022 02:16:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230260AbiI3GQT (ORCPT ); Fri, 30 Sep 2022 02:16:19 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1B4F17F54B; Thu, 29 Sep 2022 23:16:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664518572; x=1696054572; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=meLDc32biOGivdMOYPdJCWrVN8wpR3WdWFWRtUB782I=; b=n/3DRAaXVkmYZnGj/gUkwD+oRdCI/vrhbYVLjzEQoKhfZ3sCQCLGYqSj xc2IRaWynUuo/knpYxuQAYKtiFtV6BYGLOJKFFDgJQNwMD6fZHQcT2Qjt t9IrsWdAZAlVAoJfo+ViDCd8egvMxeumh5wgTq6LOaV/skbD+26xXmFOj B9hrRJXJD1Rpgz8Upw+9XeYszyYzH2AdApbZJKhKzhdNIOwuxjo2atjTE 8SJ0X5lISbIBoZ/KeC2MIQ9l69+ytT1kL5Dj05HOfvLcof+v1n5K7x/Sw 0iSNz2zNy7wj+aUJHhHSFPKZRh40GXljaIsB7Csgc/Y3aB5TvHiBrfMjA Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="328495816" X-IronPort-AV: E=Sophos;i="5.93,357,1654585200"; d="scan'208";a="328495816" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2022 23:16:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="600302777" X-IronPort-AV: E=Sophos;i="5.93,357,1654585200"; d="scan'208";a="600302777" Received: from yilunxu-optiplex-7050.sh.intel.com (HELO localhost) ([10.239.159.165]) by orsmga006.jf.intel.com with ESMTP; 29 Sep 2022 23:16:05 -0700 Date: Fri, 30 Sep 2022 14:07:15 +0800 From: Xu Yilun To: matthew.gerlach@linux.intel.com Cc: hao.wu@intel.com, russell.h.weight@intel.com, basheer.ahmed.muddebihal@intel.com, trix@redhat.com, mdf@kernel.org, linux-fpga@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, tianfei.zhang@intel.com, corbet@lwn.net, gregkh@linuxfoundation.org, linux-serial@vger.kernel.org, jirislaby@kernel.org, geert+renesas@glider.be, andriy.shevchenko@linux.intel.com, niklas.soderlund+renesas@ragnatech.se, phil.edworthy@renesas.com, macro@orcam.me.uk, johan@kernel.org, lukas@wunner.de, kernel test robot Subject: Re: [PATCH v2 6/6] tty: serial: 8250: add DFL bus driver for Altera 16550. Message-ID: References: <20220923121745.129167-1-matthew.gerlach@linux.intel.com> <20220923121745.129167-7-matthew.gerlach@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220923121745.129167-7-matthew.gerlach@linux.intel.com> X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-09-23 at 05:17:45 -0700, matthew.gerlach@linux.intel.com wrote: > From: Matthew Gerlach > > Add a Device Feature List (DFL) bus driver for the Altera > 16550 implementation of UART. > > Signed-off-by: Matthew Gerlach > Reported-by: kernel test robot > --- > v2: clean up error messages > alphabetize header files > fix 'missing prototype' error by making function static > tried to sort Makefile and Kconfig better > --- > drivers/tty/serial/8250/8250_dfl.c | 177 +++++++++++++++++++++++++++++ > drivers/tty/serial/8250/Kconfig | 9 ++ > drivers/tty/serial/8250/Makefile | 1 + > include/linux/dfl.h | 7 ++ > 4 files changed, 194 insertions(+) > create mode 100644 drivers/tty/serial/8250/8250_dfl.c > > diff --git a/drivers/tty/serial/8250/8250_dfl.c b/drivers/tty/serial/8250/8250_dfl.c > new file mode 100644 > index 000000000000..539ca6138eda > --- /dev/null > +++ b/drivers/tty/serial/8250/8250_dfl.c > @@ -0,0 +1,177 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Driver for FPGA UART > + * > + * Copyright (C) 2022 Intel Corporation, Inc. > + * > + * Authors: > + * Ananda Ravuri > + * Matthew Gerlach > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +struct dfl_uart { > + void __iomem *csr_base; > + struct device *dev; > + u64 uart_clk; > + u64 fifo_len; > + unsigned int fifo_size; > + unsigned int reg_shift; > + unsigned int line; > +}; > + > +static int feature_uart_walk(struct dfl_uart *dfluart, resource_size_t max) > +{ > + void __iomem *param_base; > + int off; > + u64 v; > + > + v = readq(dfluart->csr_base + DFHv1_CSR_SIZE_GRP); > + > + if (!FIELD_GET(DFHv1_CSR_SIZE_GRP_HAS_PARAMS, v)) { > + dev_err(dfluart->dev, "missing required DFH parameters\n"); > + return -EINVAL; > + } > + > + param_base = dfluart->csr_base + DFHv1_PARAM_HDR; > + > + off = dfl_find_param(param_base, max, DFHv1_PARAM_ID_CLK_FRQ); I think the parameters of dfl_find_param are too complicated to be used outside dfl framework (It is OK for dfl internal use). How about: dfl_find_param(struct dfl_device *ddev, int param_id) Thanks, Yilun