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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F081C54EE9 for ; Wed, 7 Sep 2022 09:38:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:Message-ID: In-Reply-To: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=3U+l4vL0kUq+YlDEq89a62LUJn6fZzGZJ48kvbcHwBw=; b=GJuTNWTr9yEibz REoVnVBvud8FQodyOXAI+/Zb86yNLNyG1t3O4UGHBJaYxw4Z8zrhCqhUU1AoQrX/5yZNTr0fl9EbB J07pUkh7yH6vlhTMmcBMz+X9jf+sGdme1sVdr1Bk6rh821YHVWuZ0n7ux7RIofxMZHm+V+dHQc29c 8t9z8bas5Ef7bKVhRUfElQVOZOWnElmlpfJRAmYoKMdV3/Sgjz99qnNuXAce4kkCfwP2SMYKlRsH+ XjfRv9GToCFmSjN7NXzIx/33W+h8tOfZtxvHo7CxnfALU81X8f/P3n79O3lcifzjvZAEUgNCE2mFy KRZIrA684i/09+aN7NjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVrUV-004xQY-Iv; Wed, 07 Sep 2022 09:37:04 +0000 Received: from mga09.intel.com ([134.134.136.24]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVrHx-004psD-Cl for linux-arm-kernel@lists.infradead.org; Wed, 07 Sep 2022 09:24:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662542645; x=1694078645; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=JpKsKADH1rQTHje2jo2dXzK2ymAZXfmBxQpUVoLyhzo=; b=jj1ccWOQaxkM93ZOQUe3npfza0HqSomUn+AsI20pTaTy4vU68MlKms6F 6dgGl/O0qKg6Pr8dvXegxbKMdIi6mK98+hT94iK9k93nqWtwifs4+sFus ObVjeXFl8B9jOC339kEKFzHGLw6uMKyLipoUY2d/X52M1bo6lwvP1iTza 4ZUlxgV0NlK2bCBn86gwiuXB0E+Q0pcVhQIchGJQaR9ed8o2RzVjcCYD2 6xtP/n33bZaTCC+JyGYK6+gXhn1UeBMrXek6eJxYQNMA3dbMRpo9o47mH G+Loi/eVVXz35c9QuO6MrGtcqbBidLCQzesmsmY6j1mrESDlNn+b70Q8b Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10462"; a="297609637" X-IronPort-AV: E=Sophos;i="5.93,296,1654585200"; d="scan'208";a="297609637" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2022 02:24:01 -0700 X-IronPort-AV: E=Sophos;i="5.93,296,1654585200"; d="scan'208";a="676097152" Received: from dmatouse-mobl.ger.corp.intel.com ([10.251.223.53]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2022 02:23:56 -0700 Date: Wed, 7 Sep 2022 12:23:55 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Sergiu Moga Subject: Re: [PATCH v2 10/13] tty: serial: atmel: Only divide Clock Divisor if the IP is USART In-Reply-To: <20220906135511.144725-11-sergiu.moga@microchip.com> Message-ID: <6f7b4eb6-678a-dd4d-4927-31ae309ca49f@linux.intel.com> References: <20220906135511.144725-1-sergiu.moga@microchip.com> <20220906135511.144725-11-sergiu.moga@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220907_022405_547048_56EFBCD2 X-CRM114-Status: GOOD ( 25.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.belloni@bootlin.com, mturquette@baylibre.com, LKML , admin@hifiphile.com, krzysztof.kozlowski+dt@linaro.org, Jiri Slaby , linux-clk@vger.kernel.org, lee@kernel.org, linux-serial , devicetree@vger.kernel.org, tudor.ambarus@microchip.com, radu_nicolae.pirea@upb.ro, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org, richard.genoud@gmail.com, Greg Kroah-Hartman , linux-spi@vger.kernel.org, sboyd@kernel.org, broonie@kernel.org, kavyasree.kotagiri@microchip.com, claudiu.beznea@microchip.com 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 Tue, 6 Sep 2022, Sergiu Moga wrote: > Make sure that the driver only divides the clock divisor if the > IP handled at that point is USART, since UART IP's do not support > implicit peripheral clock division. Instead, in the case of UART, > go with the highest possible clock divisor. > > Signed-off-by: Sergiu Moga > --- > > > v1 -> v2: > - Nothing, this patch was not here before and is mainly meant as both cleanup > and as a way to introduce a new field into struct atmel_uart_port that will be > used by the last patch to diferentiate between USART and UART regarding the > location of the Baudrate Clock Source bitmask. > > > > > drivers/tty/serial/atmel_serial.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c > index 7450d3853031..6aa01ca5489c 100644 > --- a/drivers/tty/serial/atmel_serial.c > +++ b/drivers/tty/serial/atmel_serial.c > @@ -150,6 +150,7 @@ struct atmel_uart_port { > u32 rts_low; > bool ms_irq_enabled; > u32 rtor; /* address of receiver timeout register if it exists */ > + bool is_usart; > bool has_frac_baudrate; > bool has_hw_timer; > struct timer_list uart_timer; > @@ -1825,6 +1826,7 @@ static void atmel_get_ip_name(struct uart_port *port) > */ > atmel_port->has_frac_baudrate = false; > atmel_port->has_hw_timer = false; > + atmel_port->is_usart = false; > > if (name == new_uart) { > dev_dbg(port->dev, "Uart with hw timer"); > @@ -1834,6 +1836,7 @@ static void atmel_get_ip_name(struct uart_port *port) > dev_dbg(port->dev, "Usart\n"); > atmel_port->has_frac_baudrate = true; > atmel_port->has_hw_timer = true; > + atmel_port->is_usart = true; > atmel_port->rtor = ATMEL_US_RTOR; > version = atmel_uart_readl(port, ATMEL_US_VERSION); > switch (version) { > @@ -1863,6 +1866,7 @@ static void atmel_get_ip_name(struct uart_port *port) > dev_dbg(port->dev, "This version is usart\n"); > atmel_port->has_frac_baudrate = true; > atmel_port->has_hw_timer = true; > + atmel_port->is_usart = true; > atmel_port->rtor = ATMEL_US_RTOR; > break; > case 0x203: > @@ -2282,10 +2286,17 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, > cd = uart_get_divisor(port, baud); > } > > - if (cd > 65535) { /* BRGR is 16-bit, so switch to slower clock */ > + /* > + * BRGR is 16-bit, so switch to slower clock. > + * Otherwise, keep the highest possible value for the clock divisor. > + */ > + if (atmel_port->is_usart && cd > 65535) { Should this be cd > ATMEL_US_CD ? > cd /= 8; > mode |= ATMEL_US_USCLKS_MCK_DIV8; > + } else { > + cd &= 65535; ATMEL_US_CD? > } > + > quot = cd | fp << ATMEL_US_FP_OFFSET; > > if (!(port->iso7816.flags & SER_ISO7816_ENABLED)) > -- i. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel