Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2123161pxv; Sat, 26 Jun 2021 09:45:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz85WNx7DZqdPz0PybHDkXQS4Yt/dq5hlJOUNR13OYk4kWosrgfIf9GKWim01JjHfmx8bG4 X-Received: by 2002:a92:dc4b:: with SMTP id x11mr11711642ilq.152.1624725953409; Sat, 26 Jun 2021 09:45:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624725953; cv=none; d=google.com; s=arc-20160816; b=NsaVRtmeuLkUuOyhF+roV3QS5fIHOxhTU3titRdhwopcd5NPd1BwDT0wX2cM0telCh r1ZQxOSRe/UoIzWWc0tabjiQuZ8L0mmHBlomnJwmTqcbNEfihQuvk0UX9RwnTW7NoyZj j8WzoKp6fmrt9eqOp1/4A8jUWDigphuNXzH0A+tQOv2PkL3otdWe19QkSsfRT1kp4KBS wNT7DKivbvjUOwjQIAmpXO9K2TMrPSqMUt+dsyzxKwAC/9yNLinkE4LfqLA/To3X+Tk5 tu64cdI7X5vPmAY2HC6jOs93Eq0shREhqw+xmQ43dW7gwZJhCnpl1egT1Glb0ZXXQXjZ 8/jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=ovWG5LZ0HJGaKUK0ftUFTQNPke9NDxifHMvnL+53FRk=; b=yqvxR9wH1vici1bCVv85fsGhh1HbOnmnM5VlX7oAhrNY64j/g+GA1VXQkYgaj6A+iM jYYIMOXDT+f9pgcbCYUHtPdHI6loJLQbO9S9gpQbm01XdPHTAfVSTAhjqZ6kcRwDQY+3 GpJOVSeb1BjJafl9l24mncf/oM4w7EJuTaSxjgfSRZNtsZCXk2sAuuQQQFOTCEOgOHY0 czh+S/I2jMG6rvn6v5YgvzpH6t4IDgAU53GW3tltdW7rhIcgrs/CRlNroQjfcMG8Y6PD d04sLZr/hjpreCHWe/dlj77qDTnytCf/M+M0e1hoGiJMDAYaUXQgQRvToQTJUucJuBUT meqQ== 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 a13si8924005ilj.80.2021.06.26.09.45.40; Sat, 26 Jun 2021 09:45:53 -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 S230215AbhFZQrC convert rfc822-to-8bit (ORCPT + 99 others); Sat, 26 Jun 2021 12:47:02 -0400 Received: from mail-ot1-f49.google.com ([209.85.210.49]:44793 "EHLO mail-ot1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229946AbhFZQrC (ORCPT ); Sat, 26 Jun 2021 12:47:02 -0400 Received: by mail-ot1-f49.google.com with SMTP id 59-20020a9d0ac10000b0290462f0ab0800so5066933otq.11; Sat, 26 Jun 2021 09:44:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=HxcRIBCSc7MQbCKOyndHrkKI3BYQ9FTRmkxDuLtYrT8=; b=sJIoJBtoja2yelN1uMLLbJ85v1D7Fj/KYelZ/hR3ERnPxfY42FXrQubWGt7t57YEk9 fIfvWtCY0xryY4Ta2vQ+d6X713bvozhhnEFYqLtuuVex6+/b0+LuJLMChJtVxupG/9BF 3KbW1guEOUshZNhcUU2FheK5QUg3HXvjnd3Jv1NxNTCytpeAwRjGHP9G1B8FZoWtnI6J JKC9tq7gvHkflwTxH0ov7D86WI5qdn/UG4rxZTzePDlJAFIhGbPfimDiUnnwuXruJW1g ZCcEtDq8f4XLmmy6e97I6anbsj5t95W4bqAVvsimbNcKA/xlyGzBsz6PfXeqQPZOxq39 femw== X-Gm-Message-State: AOAM5309CxIpZeHz/ytTKyAc/9DItIY4Br/B0yATg/JEk4CKynzC0JTL e1fIwQAB63Qgb6vDPBonMfgInHfd0TmAW+eLkko= X-Received: by 2002:a05:6830:2707:: with SMTP id j7mr14916038otu.37.1624725878591; Sat, 26 Jun 2021 09:44:38 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= Date: Sat, 26 Jun 2021 18:44:27 +0200 Message-ID: Subject: Re: [PATCH v2 2/2] MIPS: Malta: Do not byte-swap accesses to the CBUS UART To: "Maciej W. Rozycki" Cc: Greg Kroah-Hartman , Jiri Slaby , Thomas Bogendoerfer , "open list:SERIAL DRIVERS" , "open list:BROADCOM NVRAM DRIVER" , open list , stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 26, 2021 at 6:11 AM Maciej W. Rozycki wrote: > > Correct big-endian accesses to the CBUS UART, a Malta on-board discrete > TI16C550C part wired directly to the system controller's device bus, and > do not use byte swapping with the 32-bit accesses to the device. > > The CBUS is used for devices such as the boot flash memory needed early > on in system bootstrap even before PCI has been initialised. Therefore > it uses the system controller's device bus, which follows the endianness > set with the CPU, which means no byte-swapping is ever required for data > accesses to CBUS, unlike with PCI. > > The CBUS UART uses the UPIO_MEM32 access method, that is the `readl' and > `writel' MMIO accessors, which on the MIPS platform imply byte-swapping > with PCI systems. Consequently the wrong byte lane is accessed with the > big-endian configuration and the UART is not correctly accessed. > > As it happens the UPIO_MEM32BE access method makes use of the `ioread32' > and `iowrite32' MMIO accessors, which still use `readl' and `writel' > respectively, however they byte-swap data passed, effectively cancelling > swapping done with the accessors themselves and making it suitable for > the CBUS UART. > > Make the CBUS UART switch between UPIO_MEM32 and UPIO_MEM32BE then, > based on the endianness selected. With this change in place the device > is correctly recognised with big-endian Malta at boot, along with the > Super I/O devices behind PCI: > > Serial: 8250/16550 driver, 5 ports, IRQ sharing enabled > printk: console [ttyS0] disabled > serial8250.0: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A > printk: console [ttyS0] enabled > printk: bootconsole [uart8250] disabled > serial8250.0: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A > serial8250.0: ttyS2 at MMIO 0x1f000900 (irq = 20, base_baud = 230400) is a 16550A > > Signed-off-by: Maciej W. Rozycki > Fixes: e7c4782f92fc ("[MIPS] Put an end to 's long and annyoing existence") > Cc: stable@vger.kernel.org # v2.6.23+ > --- > Changes from v1: > > - Remove console message duplicates from the commit description. > --- > arch/mips/mti-malta/malta-platform.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) Reviewed-by: Philippe Mathieu-Daudé