Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1450507ybk; Thu, 21 May 2020 07:11:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwQUARe0x0qs/4eDBGKP7l1qGNL8qqD/YkmRa6WHaEQKAqwFXlz6zSegKBWBjC6P9JVlYO X-Received: by 2002:a05:6402:5:: with SMTP id d5mr8084161edu.247.1590070308271; Thu, 21 May 2020 07:11:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590070308; cv=none; d=google.com; s=arc-20160816; b=U2EJyr09eeNBU0F0wU8sm5mpweeJOWKL1tq3YhszanaPCwkv1KPUwsu2bOi2j9fMeS QaniLqvSKHLVnIRcTXpmVfzTtHqad8cGUVqs/nGT5szFFw47oVCPBB9SXzf8Nu5qkmTX XONTFEZ8TRB1z17g0IdNXmqGd89uwLBNxNpsBi5ozHkmtfL7asBmDn4gFUF1rol28bbp cek/96rXEWdbzztn+rbdiV7vF54lJpxWtZhX8rwxdJ8HM2tUv1c+qnBOsYwl4DkJJ9CJ pCoB1pQSfWov13sehWTOahun105SMC8Z+cOsIIAsQLFaTH5L1uVYAYtz2MaSLDYfZgLK 0pYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=alOdH6FpTairp+M5PhxIT4taA6D26zKXGD9cMgQDUe0=; b=Dq8Bn/xDk//iysFe3MbSATQjvtc9394zBvcDJ3wKxq5ihe/WItc2Ic/6FxXG3bm4cW Fo+IUu/636jmbN3r4onl43rgXPutn3RV6gpBjTqAMQS2IqDk4kWJuJl88bbIPVE2/7Hp SgSrUpYw/XQvM8LBL+IUll4x2TAt1TxmO8api6E5tqeDGOh0i86pEYkRuMowM/WQIRgP Pq0ztA/gjylV4oNTFB3ASnxT43LCJh8k67oTBYU8QLiU+OMaZMumJFhAvV7IHYOoLzB+ L5HUQDA+z7FF6MbGHAJlGUVORGMTl8VhEw6EqN7iaSNxYn3u8CIkX9FaQVHW+X30PLlt S/FQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs4si3421773ejb.275.2020.05.21.07.11.24; Thu, 21 May 2020 07:11:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729672AbgEUOIv (ORCPT + 99 others); Thu, 21 May 2020 10:08:51 -0400 Received: from mail.baikalelectronics.com ([87.245.175.226]:38506 "EHLO mail.baikalelectronics.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729869AbgEUOIt (ORCPT ); Thu, 21 May 2020 10:08:49 -0400 Received: from localhost (unknown [127.0.0.1]) by mail.baikalelectronics.ru (Postfix) with ESMTP id 2A38D80005F0; Thu, 21 May 2020 14:08:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at baikalelectronics.ru Received: from mail.baikalelectronics.ru ([127.0.0.1]) by localhost (mail.baikalelectronics.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MBbrhrAeT8CE; Thu, 21 May 2020 17:08:46 +0300 (MSK) From: Serge Semin To: Thomas Bogendoerfer CC: Serge Semin , Serge Semin , Alexey Malahov , Paul Burton , Ralf Baechle , Arnd Bergmann , Rob Herring , , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Gleixner , Allison Randal , Greg Kroah-Hartman , , Subject: [PATCH v4 08/13] mips: Add CPS_NS16550_WIDTH config Date: Thu, 21 May 2020 17:07:19 +0300 Message-ID: <20200521140725.29571-9-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20200521140725.29571-1-Sergey.Semin@baikalelectronics.ru> References: <20200521140725.29571-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On some platforms IO-memory might require to use a proper load/store instructions (like Baikal-T1 IO-memory). To fix the cps-vec UART debug printout let's add the CONFIG_CPS_NS16550_WIDTH config to determine which instructions lb/sb, lh/sh or lw/sw are required for MMIO operations. Signed-off-by: Serge Semin Cc: Alexey Malahov Cc: Thomas Bogendoerfer Cc: Paul Burton Cc: Ralf Baechle Cc: Arnd Bergmann Cc: Rob Herring Cc: devicetree@vger.kernel.org --- arch/mips/Kconfig.debug | 10 ++++++++++ arch/mips/kernel/cps-vec-ns16550.S | 18 ++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug index 93a2974d2ab7..7a8d94cdd493 100644 --- a/arch/mips/Kconfig.debug +++ b/arch/mips/Kconfig.debug @@ -148,4 +148,14 @@ config MIPS_CPS_NS16550_SHIFT form their addresses. That is, log base 2 of the span between adjacent ns16550 registers in the system. +config MIPS_CPS_NS16550_WIDTH + int "UART Register Width" + default 1 + help + ns16550 registers width. UART registers IO access methods will be + selected in accordance with this parameter. By setting it to 1, 2 or + 4 UART registers will be accessed by means of lb/sb, lh/sh or lw/sw + instructions respectively. Any value not from that set activates + lb/sb instructions. + endif # MIPS_CPS_NS16550_BOOL diff --git a/arch/mips/kernel/cps-vec-ns16550.S b/arch/mips/kernel/cps-vec-ns16550.S index d5a67b4ce9f6..30725e1df987 100644 --- a/arch/mips/kernel/cps-vec-ns16550.S +++ b/arch/mips/kernel/cps-vec-ns16550.S @@ -14,16 +14,30 @@ #define UART_TX_OFS (UART_TX << CONFIG_MIPS_CPS_NS16550_SHIFT) #define UART_LSR_OFS (UART_LSR << CONFIG_MIPS_CPS_NS16550_SHIFT) +#if CONFIG_MIPS_CPS_NS16550_WIDTH == 1 +# define UART_L lb +# define UART_S sb +#elif CONFIG_MIPS_CPS_NS16550_WIDTH == 2 +# define UART_L lh +# define UART_S sh +#elif CONFIG_MIPS_CPS_NS16550_WIDTH == 4 +# define UART_L lw +# define UART_S sw +#else +# define UART_L lb +# define UART_S sb +#endif + /** * _mips_cps_putc() - write a character to the UART * @a0: ASCII character to write * @t9: UART base address */ LEAF(_mips_cps_putc) -1: lw t0, UART_LSR_OFS(t9) +1: UART_L t0, UART_LSR_OFS(t9) andi t0, t0, UART_LSR_TEMT beqz t0, 1b - sb a0, UART_TX_OFS(t9) + UART_S a0, UART_TX_OFS(t9) jr ra END(_mips_cps_putc) -- 2.25.1