Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5727117rwr; Tue, 9 May 2023 05:42:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5XWNkj1szL+3YAAic2U4uiElI2C6j2/jntNq9jr0gYBQyg/taCpr7dB0ctcp4PPHxP2AFw X-Received: by 2002:a17:903:2347:b0:1a9:91d7:ba2 with SMTP id c7-20020a170903234700b001a991d70ba2mr17312281plh.48.1683636151373; Tue, 09 May 2023 05:42:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683636151; cv=none; d=google.com; s=arc-20160816; b=0udv5VWTOxUIOzJD/04WCqg1pi3T9UaHTrzBy6SQf5h/ZyCjSHN3kkph1c59o8uVrh q/L/eRmC7uvnSWwPtErX1Q4j+GRtSw+uoITFWdTa+QU/m5vR4wQfriudwU5HJcEpUTOT Oo3ZQBl9IIfkEly1fmqVKnKIZO3t2KGDq6a2x9WE8XasAQtQmiLNtjQm7QpwFX67fJGz 4/8m3mibQ5q0IX0eK5sQHZRzaNqGmPmtzZ/Q4vWSgCJPFynvBiVT3BiEjcBjMaXSCMax Tx8vWlxOIu3NcW//MSKCpnzEIpofAF7Rx4wJDXZ6xZBODIzdrsv7kSvPd7lRaP4vfmWp BtzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:cc:to:from :date:references:in-reply-to:message-id:mime-version:user-agent :feedback-id:dkim-signature:dkim-signature; bh=jMFJATipArZQBRY6U4nByREOOWvUXM2jwlxY3nY6hu0=; b=EGpEGYR+qz+mVkq7YOsOIBuJmhfCM8dMbdp187JIPTIVFfIqlKhmtW8LCOStV5P+Uj 3QdDkvyd8+Kcw/D7v/e0tMae7a5+eVIbmj1s+xB5Xsq13P+J1+pe5xy1iByppmCXco3r I1+m535GP7l/1/4Ub5FCkSRJTfRV3vVdKJX5OAAWCtaKxvfjt2+snUw7L8z+7CDSmcpz +ZWQ25RmjSyTBJYwuOcH+gUmcYESNyvPLLdOtkFT4uwrU7JtAzohm7r9PH/LlrnFpR7E /hryTwypCl4240WvOSkkpgh+22/GKITDSM2qVD9uMOl0JiZjDIEnqeqthe96rJIVUUBZ DHgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=ZfsaS5LD; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=LC89PMaH; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h14-20020a170902f54e00b001a5298ca6d5si1520203plf.453.2023.05.09.05.42.19; Tue, 09 May 2023 05:42:31 -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=@arndb.de header.s=fm3 header.b=ZfsaS5LD; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=LC89PMaH; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235670AbjEIMQK (ORCPT + 99 others); Tue, 9 May 2023 08:16:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229741AbjEIMQI (ORCPT ); Tue, 9 May 2023 08:16:08 -0400 Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 160CA3C25; Tue, 9 May 2023 05:16:04 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 846B63200437; Tue, 9 May 2023 08:15:59 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute6.internal (MEProxy); Tue, 09 May 2023 08:16:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1683634559; x=1683720959; bh=jMFJATipArZQBRY6U4nByREOOWvUXM2jwlx Y3nY6hu0=; b=ZfsaS5LDJ0o2jzmbku6hsKKp4oObCLeMCqZEuxd7nuCw81w3krt pdTWFMEX9b9NcYaoE/uuu3vGgpdVsc0I0nGzz+Uay2NA7FhED7+e05ZXqfIMk/Iq rRUOymcyzGBMyo3ksf/3lgDJaC63Rx6Z6PhM0P5ZpXPdtU+1Vef4AEsFNAKGdjgg dZw2C//hotodyFWSm0gHFvmcYvhon9wVV5WTGatxB2Pxi5PqN9BABn1MDJV3H/lN KS1YH+4O9/bOqLhy84QRVeo2cnXI0lHp+XiIr9BsL7f3UIotn67VTbPb+fossMxB WuhptkpiWKvn/rtm8Hmdpjb7h8TYrF97bWg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1683634559; x=1683720959; bh=jMFJATipArZQBRY6U4nByREOOWvUXM2jwlx Y3nY6hu0=; b=LC89PMaH+NrcQx7ntd8N9c3gGTHk77YGeaxocqDBUZVoNX0vYyy 21gcoBEEur2Z3DyJN+3uWL1oRfWL8EAasgFYOdQd/eNjdmqPmI46x8QcC0PjPOtY Y+LEnUCBV6jci5GBm9+zGwL34nXM0OOZbJJ9puBraCNP6/TI3EEEy7ysKv4MZn1X ZEyFb8kmi48FyJ7DV+rdwwABX4tr/MhG5bOXniO3Q5w6h9Jzue030dhaDd2e+8Br InKeJCDAFNq4mzX+WoKT/gaZt/j7n5l1QJ4Zzj9q3UrUC60g4RLBxmXFXbUvmoOU MnwFoU1scv97ZmqrJxT9ne0HWqResTECjDA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeegtddggeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtgfesthhqredtreerjeenucfhrhhomhepfdet rhhnugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrg htthgvrhhnpeegfeejhedvledvffeijeeijeeivddvhfeliedvleevheejleetgedukedt gfejveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grrhhnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 6606FB60086; Tue, 9 May 2023 08:15:58 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-415-gf2b17fe6c3-fm-20230503.001-gf2b17fe6 Mime-Version: 1.0 Message-Id: In-Reply-To: <2ba483e9-267f-2159-1ea8-75a2618fcdf9@linux.intel.com> References: <20230508025936.36776-1-ychuang570808@gmail.com> <20230508025936.36776-11-ychuang570808@gmail.com> <2ba483e9-267f-2159-1ea8-75a2618fcdf9@linux.intel.com> Date: Tue, 09 May 2023 14:14:00 +0200 From: "Arnd Bergmann" To: =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , "Jacky Huang" Cc: "Rob Herring" , krzysztof.kozlowski+dt@linaro.org, "Lee Jones" , "Michael Turquette" , "Stephen Boyd" , "Philipp Zabel" , "Greg Kroah-Hartman" , "Jiri Slaby" , "Tomer Maimon" , "Catalin Marinas" , "Will Deacon" , devicetree@vger.kernel.org, linux-clk@vger.kernel.org, LKML , linux-arm-kernel@lists.infradead.org, linux-serial , schung@nuvoton.com, mjchen@nuvoton.com, "Jacky Huang" Subject: Re: [PATCH v10 10/10] tty: serial: Add Nuvoton ma35d1 serial driver support Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Tue, May 9, 2023, at 12:17, Ilpo J=C3=A4rvinen wrote: > On Mon, 8 May 2023, Jacky Huang wrote: >> + >> +#define UART_NR 17 >> + >> +#define UART_REG_RBR 0x00 >> +#define UART_REG_THR 0x00 >> +#define UART_REG_IER 0x04 >> +#define UART_REG_FCR 0x08 >> +#define UART_REG_LCR 0x0C >> +#define UART_REG_MCR 0x10 > > These duplicate include/uapi/linux/serial_reg.h ones, use the std ones=20 > directly. > > Setup regshift too and use it in serial_in. I think this came up in previous reviews, but it turned out that only the first six registers are compatible, while the later ones are all different, and it's not 8250 compatible. It might be helpful to rename the registers to something with a prefix other than UART_REG_*, to avoid the confusion and possible namespace clash. > >> +/* UART_REG_IER - Interrupt Enable Register */ >> +#define IER_RDA_IEN BIT(0) /* RBR Available Interrupt Enable */ >> +#define IER_THRE_IEN BIT(1) /* THR Empty Interrupt Enable */ >> +#define IER_RLS_IEN BIT(2) /* RX Line Status Interrupt Enable */ > > These look same as UART_IER bits, use the std ones. ... > Are these same as UART_FCR_CLEAR_* functionality wise? If they're use = std=20 > ones. Again, I'd think we're better off having a distinct naming for them than trying to share the definitions with 8250. >> +static struct uart_driver ma35d1serial_reg =3D { >> + .owner =3D THIS_MODULE, >> + .driver_name =3D "serial", >> + .dev_name =3D "ttyS", >> + .major =3D TTY_MAJOR, >> + .minor =3D 64, >> + .cons =3D MA35D1SERIAL_CONSOLE, >> + .nr =3D UART_NR, >> +}; > > This doesn't seem necessary, 8250 core will have the uart_driver for y= ou > and most of the console stuff too. You just need to setup a few things=20 > correctly (see the setup functions in 8250_early for ideas/examples). >... >> + >> + ret =3D uart_add_one_port(&ma35d1serial_reg, &up->port); > > For 8250, you should be using serial8250_register_8250_port(). See the=20 > other drivers how to setup the console functions. Consequently, this should also be kept separate from the serial8250 driver, I don't see a way to fit the nuvoton code into the existing driver without making the resulting driver worse for everyone. There is one thing that absolutely needs to be changed though: the driver_name/dev_name/major/minor fields all clash with the 8250 driver, so you cannot have a kernel that has both drivers built-in. All of these should change to get out of the way of the existing drivers. Arnd