Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2066248lqt; Sun, 21 Apr 2024 23:31:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUqMN/fJD1G5BjKXQwQUqcNPlEffMn3xkSqCLP1F9ZnHfHLlZe5LNJDJyIrWdTDbqTqmHbACxbxKSiJjT0tKRi6TEfiBKrdhcK7ajOpIg== X-Google-Smtp-Source: AGHT+IG1TZ5C/gCtW4fNCO48rV+eLJgUp/G+qs+2DrtWSUwQioYryfVGOfZjw+kH6gNgNayBOpzj X-Received: by 2002:a0c:f594:0:b0:69b:a44:3ef3 with SMTP id k20-20020a0cf594000000b0069b0a443ef3mr9653695qvm.61.1713767462225; Sun, 21 Apr 2024 23:31:02 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id q11-20020ad4574b000000b0069936018655si9847389qvx.262.2024.04.21.23.31.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Apr 2024 23:31:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-152789-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-152789-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152789-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E33421C21D55 for ; Mon, 22 Apr 2024 06:31:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8C005481B7; Mon, 22 Apr 2024 06:30:56 +0000 (UTC) Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F1C51F61C; Mon, 22 Apr 2024 06:30:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713767455; cv=none; b=Aw29ZCkuphrj5wk1jcmeQlV8Agi/XazVMPJJQ9kAX1eSqGbUA6BIaiTLvjuI3c6ctDFvvCjtGZSquI9Hq71189+Z1q8/vZjRHhMNc+ngLVZs9NxKQ4rAdXwnP9MTRym60pL9O2ALpleYUAz5TnFTQOJQQAdOL3iJSY9EHgp8urg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713767455; c=relaxed/simple; bh=ZF8/roY0/AmpBQ3CMW4FkQw3iWV/Qxm6T515kZrXsKs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=cGswfIaf+ds4Tx7WA0oPoeIjloXSL8oJ5d959kpNG8/YlnXo1Eu5FKxrTsZbcCNJLF+R3PnJ6L9rXXdDKntpLtcfCB9nQGA8tKUEzczF2DibAwLgdcudu9y20gsCeMQbHfmrbthvDO48+a107OwpL6tnsrtuFM5G5XwycaS790Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-56e78970853so8090168a12.0; Sun, 21 Apr 2024 23:30:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713767452; x=1714372252; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=bbek83bH+bmdJVeZSQAmI/qCW2wzUcsSL38Y65k0QiI=; b=BWGl1ARggi6ugmxq10uQIsaySt9pxo+gMsUiworBd4RohtYoMsE0ZJEtZWPcIzc9Fy gvQg5t5dUMxLsidjvZCZTnL0R7KT7kED0ijGhNDKdpRcgFs+WQtL2K/qFm2/QOPnwa7L wCtP3oWX7MmPpZcwwb2aTo4+TxCG/ETaPKJ6fh/HqunYyS3G0lEYQWi756Gk3wR4bcU0 2IJdZfk8WI9vYKNlr3g12GGZkQpuR5bc83aHpfSK0EUH1s4/5yCtCeXL0b6gAwHsZdom bovshqF41pnS54i0uXb6kAmaaFdsCHvu6g3+TTgqlKMoYrXAghnWR9FfH4RltYUMRMoI z7TA== X-Forwarded-Encrypted: i=1; AJvYcCVB0v+bQWrqFt1b6mHTd+Rm5IJoyKWCXC0BS7N6dsZEznFPu9269+NU5ydJq3D/Uyj0bxinBHCiEc1J3PT1NNisiAhHoWQz9gYc3I4Thw6R/djY/lvz2yFRKHNQaWlmuqd6dyjWcFLJZvU4 X-Gm-Message-State: AOJu0YzaVx443aqMzR3oK6EKaRZI2i3fW9S77ZozKwvEbp7a0HlXS8ex j6aHMuFl0ZWZt97lvBQ8tZLTxbIYSOCSyuvbLtSp9IFYhkGP/YKf X-Received: by 2002:a17:906:c112:b0:a55:aded:200d with SMTP id do18-20020a170906c11200b00a55aded200dmr3553154ejc.12.1713767452360; Sun, 21 Apr 2024 23:30:52 -0700 (PDT) Received: from ?IPV6:2a0b:e7c0:0:107::aaaa:69? ([2a0b:e7c0:0:107::aaaa:69]) by smtp.gmail.com with ESMTPSA id mc11-20020a170906eb4b00b00a5256d8c956sm5315446ejb.61.2024.04.21.23.30.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 21 Apr 2024 23:30:51 -0700 (PDT) Message-ID: <7cf31245-b2a1-419c-add6-a6a50a3f3cf1@kernel.org> Date: Mon, 22 Apr 2024 08:30:50 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 3/3] serial: sc16is7xx: add support for EXAR XR20M1172 UART To: Konstantin Pugin Cc: krzk@kernel.org, conor@kernel.org, lkp@intel.com, vz@mleia.com, robh@kernel.org, jcmvbkbc@gmail.com, nicolas.ferre@microchip.com, manikanta.guntupalli@amd.com, corbet@lwn.net, ychuang3@nuvoton.com, u.kleine-koenig@pengutronix.de, Maarten.Brock@sttls.nl, Konstantin Pugin , Greg Kroah-Hartman , Jernej Skrabec , Herve Codina , Andy Shevchenko , Hugo Villeneuve , Lech Perczak , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org References: <20240420182223.1153195-1-rilian.la.te@ya.ru> <20240420182223.1153195-4-rilian.la.te@ya.ru> Content-Language: en-US From: Jiri Slaby Autocrypt: addr=jirislaby@kernel.org; keydata= xsFNBE6S54YBEACzzjLwDUbU5elY4GTg/NdotjA0jyyJtYI86wdKraekbNE0bC4zV+ryvH4j rrcDwGs6tFVrAHvdHeIdI07s1iIx5R/ndcHwt4fvI8CL5PzPmn5J+h0WERR5rFprRh6axhOk rSD5CwQl19fm4AJCS6A9GJtOoiLpWn2/IbogPc71jQVrupZYYx51rAaHZ0D2KYK/uhfc6neJ i0WqPlbtIlIrpvWxckucNu6ZwXjFY0f3qIRg3Vqh5QxPkojGsq9tXVFVLEkSVz6FoqCHrUTx wr+aw6qqQVgvT/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jYd7P1gZb9Fwj9YLx jhn/sVIhNmEBLBoI7PL+9fbILqJPHgAwW35rpnq4f/EYTykbk1sa13Tav6btJ+4QOgbcezWI wZ5w/JVfEJW9JXp3BFAVzRQ5nVrrLDAJZ8Y5ioWcm99JtSIIxXxt9FJaGc1Bgsi5K/+dyTKL wLMJgiBzbVx8G+fCJJ9YtlNOPWhbKPlrQ8+AY52Aagi9WNhe6XfJdh5g6ptiOILm330mkR4g W6nEgZVyIyTq3ekOuruftWL99qpP5zi+eNrMmLRQx9iecDNgFr342R9bTDlb1TLuRb+/tJ98 f/bIWIr0cqQmqQ33FgRhrG1+Xml6UXyJ2jExmlO8JljuOGeXYh6ZkIEyzqzffzBLXZCujlYQ DFXpyMNVJ2ZwPmX2mWEoYuaBU0JN7wM+/zWgOf2zRwhEuD3A2cO2PxoiIfyUEfB9SSmffaK/ S4xXoB6wvGENZ85Hg37C7WDNdaAt6Xh2uQIly5grkgvWppkNy4ZHxE+jeNsU7tg= In-Reply-To: <20240420182223.1153195-4-rilian.la.te@ya.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 20. 04. 24, 20:22, Konstantin Pugin wrote: > From: Konstantin Pugin > > XR20M1172 register set is mostly compatible with SC16IS762, but it has > a support for additional division rates of UART with special DLD register. > So, add handling this register by appropriate devicetree bindings. .. > --- a/drivers/tty/serial/sc16is7xx.c > +++ b/drivers/tty/serial/sc16is7xx.c .. > @@ -555,18 +578,43 @@ static bool sc16is7xx_regmap_noinc(struct device *dev, unsigned int reg) > return reg == SC16IS7XX_RHR_REG; > } > > +static bool sc16is7xx_has_dld(struct device *dev) > +{ > + struct sc16is7xx_port *s = dev_get_drvdata(dev); > + > + if (s->devtype == &xr20m1172_devtype) > + return true; > + return false; :) so this should simply be: return s->devtype == &xr20m1172_devtype; .. > @@ -1002,6 +1052,7 @@ static void sc16is7xx_set_termios(struct uart_port *port, > const struct ktermios *old) > { > struct sc16is7xx_one *one = to_sc16is7xx_one(port, port); > + bool has_dld = sc16is7xx_has_dld(port->dev); > unsigned int lcr, flow = 0; > int baud; > unsigned long flags; > @@ -1084,7 +1135,7 @@ static void sc16is7xx_set_termios(struct uart_port *port, > /* Get baud rate generator configuration */ > baud = uart_get_baud_rate(port, termios, old, > port->uartclk / 16 / 4 / 0xffff, > - port->uartclk / 16); > + port->uartclk / (has_dld ? 4 : 16)); Could you do this instead: unsigned int divisor = sc16is7xx_has_dld(port->dev) ? 4 : 16; .. uart_get_baud_rate(..., port->uartclk / divisor); I am not sure the above warrants for a new version. Just in case you are sending one. thanks, -- js suse labs