From patchwork Sun Sep 8 07:50:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13795339 Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (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 E033212AAE2; Sun, 8 Sep 2024 07:59:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725782378; cv=none; b=cS2cvQ9yA8OIKMvo/nfkhgbr3u7P7eFO+HEuwIYhqkmXSWTcUETEEqRIy40VWKWOakXO5/lTDHXX0IZh6Nlkjyz95h7OmR+uicKWVKva2hvZT9yb/6M1Lo7S7JXehiyElUWbg9s7r+1r5Dicd2MoyzivWP0bn449396Uy982sI8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725782378; c=relaxed/simple; bh=VWXmO1RyWUyhWh2dn59RYX/QZ88zhjH3WSnJNNQVVnc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cyn6YNChsk5AspZvWUg17fkGWQaKGoweZ0LDj/vfGm2GeNO+p0C+zIYuEBSaJRXBpDAf0ToxlU/7b93kHbteRi3tz/XXA0iaBf1xKuYDNlIUEbej03tSsvITcbb6z6Ur3UD77sQN2Aazs+vWeytp99+Mx2PfWbbNkoT//jHY0qs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YyJzVmZf; arc=none smtp.client-ip=209.85.167.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YyJzVmZf" Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3e0379a8d96so685386b6e.3; Sun, 08 Sep 2024 00:59:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725782376; x=1726387176; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vSAWxbt/KB3N4v3rcDblPZmbY76AbUJCwly8u6qq48k=; b=YyJzVmZfq497HkdkLzLmxA+mxNdsvNmZQiA/7D1HJxl0S2TejTyyl/wZosqYz2xm6m wMilpwpVR6vBuiyIj2NlECOJEoacf5T5ptwI6shZJT1y5s8rnwOjfvHy5Jzk4NWq9seJ 5FP8apHuA+maF1Aau5uScm+3Ol44A/M9InBKacvX1M/r92JEnmk5Gk/7I5nwVUfgKd02 MBtkJa8nvmOIb2xl0uya5LdhxTvN1xsSAQFeeZbH8b6g5+sSquaMWyV5Kj0W+3Ahc7RP TTlneQkMxqaWyK/UPF1apvEpOGyH4hV4OGmHrpKc0Osb3qlSPr5AppsxUFEZRg1G+1ex Q5NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725782376; x=1726387176; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vSAWxbt/KB3N4v3rcDblPZmbY76AbUJCwly8u6qq48k=; b=bLzL7gaxveVJEufWsAO5uf8MNz1it4TYaTkXsgJhHLUKhuls9g0TpfO0DWCLtZXgB5 I/6fC3Vsyn5Y7Iuj7feN8TeWapRogFNBNZePN2D75JgZ1wB+H7t0DUZuY4dyersSy2o1 60IdUDITg9wMjuci2qwtLmYN7e5DfnuEk8PXP8AYy+739C9cBP2LMy/ciJp3T7pFGp6Z BDETAs4lH7x19NlIeunEblKB/LWBsZCtK+rs7xN8AcAB1AUx5jX+1R+QRD/EUrNW2vi4 N4v7L/IXRMfpdk62jzV31Izybl/g0c2MYNxj8OPbvZQrsGa6OUbdfMYXfQIM8N5dcG9e ZFIA== X-Forwarded-Encrypted: i=1; AJvYcCU7/npPG5OtjO1fd5o0vU2LWvJ0GUQJHSI3/eMsGrJ9FkY2MVgYcoGZS1m1TTqATm2vGG2hMiXuW+W39YsG@vger.kernel.org, AJvYcCW67kBMIDp+xNh6tdFDo5XWPT4hG35fNXkZym/D2k2HnOnY3VvWbZMG4jA3P37opbfTwk9ov3TkSNlAU13ovE7rV6M=@vger.kernel.org, AJvYcCWrI2+bpgk/ufT68QHa67Obv+MRI40vohyCRt5fr6pAxVv3zCL+mT9BCI77f79IVU01zxmv/qPmiu+M4fg=@vger.kernel.org X-Gm-Message-State: AOJu0Yyx8D1OIOIOuw0oNklB9cS4zqkheky9wVCnhrEf7tyiv7bggnql IMgSGkzCPZV9AU+Ln7OSbSLOTkxy7UBkbUS4eSBBRLVP4xuuhMBEUfrE7L1n X-Google-Smtp-Source: AGHT+IF4X47dLoffOVVo0BcLEvCjOamHYwwrqOfcrpE78LRYitbuMjUJoZKkxWLK9tq8v1Y0uVOraw== X-Received: by 2002:a05:6808:4483:b0:3e0:4044:7199 with SMTP id 5614622812f47-3e0404472b2mr1298829b6e.16.1725782375953; Sun, 08 Sep 2024 00:59:35 -0700 (PDT) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id 41be03b00d2f7-7d8255dc1c6sm2012690a12.68.2024.09.08.00.59.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2024 00:59:35 -0700 (PDT) From: Nick Chan To: Krzysztof Kozlowski , Alim Akhtar , Greg Kroah-Hartman , Jiri Slaby , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: asahi@lists.linux.dev, Nick Chan Subject: [PATCH 1/3] tty: serial: samsung: Use BIT() macro for APPLE_S5L_* Date: Sun, 8 Sep 2024 15:50:48 +0800 Message-ID: <20240908075904.12133-2-towinchenmi@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240908075904.12133-1-towinchenmi@gmail.com> References: <20240908075904.12133-1-towinchenmi@gmail.com> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 New entries using BIT() will be added soon, so change the existing ones for consistency. Signed-off-by: Nick Chan --- include/linux/serial_s3c.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/serial_s3c.h b/include/linux/serial_s3c.h index 1672cf0810ef..1e8686695487 100644 --- a/include/linux/serial_s3c.h +++ b/include/linux/serial_s3c.h @@ -249,9 +249,9 @@ #define APPLE_S5L_UCON_RXTO_ENA 9 #define APPLE_S5L_UCON_RXTHRESH_ENA 12 #define APPLE_S5L_UCON_TXTHRESH_ENA 13 -#define APPLE_S5L_UCON_RXTO_ENA_MSK (1 << APPLE_S5L_UCON_RXTO_ENA) -#define APPLE_S5L_UCON_RXTHRESH_ENA_MSK (1 << APPLE_S5L_UCON_RXTHRESH_ENA) -#define APPLE_S5L_UCON_TXTHRESH_ENA_MSK (1 << APPLE_S5L_UCON_TXTHRESH_ENA) +#define APPLE_S5L_UCON_RXTO_ENA_MSK BIT(APPLE_S5L_UCON_RXTO_ENA) +#define APPLE_S5L_UCON_RXTHRESH_ENA_MSK BIT(APPLE_S5L_UCON_RXTHRESH_ENA) +#define APPLE_S5L_UCON_TXTHRESH_ENA_MSK BIT(APPLE_S5L_UCON_TXTHRESH_ENA) #define APPLE_S5L_UCON_DEFAULT (S3C2410_UCON_TXIRQMODE | \ S3C2410_UCON_RXIRQMODE | \ @@ -260,9 +260,9 @@ APPLE_S5L_UCON_RXTHRESH_ENA_MSK | \ APPLE_S5L_UCON_TXTHRESH_ENA_MSK) -#define APPLE_S5L_UTRSTAT_RXTHRESH (1<<4) -#define APPLE_S5L_UTRSTAT_TXTHRESH (1<<5) -#define APPLE_S5L_UTRSTAT_RXTO (1<<9) +#define APPLE_S5L_UTRSTAT_RXTHRESH BIT(4) +#define APPLE_S5L_UTRSTAT_TXTHRESH BIT(5) +#define APPLE_S5L_UTRSTAT_RXTO BIT(9) #define APPLE_S5L_UTRSTAT_ALL_FLAGS (0x3f0) #ifndef __ASSEMBLY__ From patchwork Sun Sep 8 07:50:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13795340 Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.176]) (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 1948213665B; Sun, 8 Sep 2024 07:59:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725782381; cv=none; b=PQIOn5hFiOq4GAu4ICCXjahjuJ+4flTfD/nI+6SBUPN9sjlgE/0rjihlD5xVZyk/dxY0RXIqnd9VB9uy+3QRzbyzH0zh5wVBc44iEzJiByL+y8hf8vLeuR+EGoAiB+x0EWgT5g4E/aOY2/nd9rbnJGZqviXYn/UbVKr0pndFOP0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725782381; c=relaxed/simple; bh=jSOpOfDN75HGeuyyYM2GrqyjGgMd6FFLDiemPseUTAc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QVy7LWrijKI5ZvpG/Pb1F5/qaML8k7j5aSf/0TQwd6MpNgrdyAO1B8usj1yT672E6emljjQbCCaAU/wB0yWhniV8ag2SAgenOpWUyofBQ9+DMb0UM1tD1ml1TLAuhRnxKNYwFU55O3KhM5OiKIHnucS2jeNXcCKZ/A5PDqWkiaw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RUBjtAmZ; arc=none smtp.client-ip=209.85.167.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RUBjtAmZ" Received: by mail-oi1-f176.google.com with SMTP id 5614622812f47-3e0402a98caso191313b6e.3; Sun, 08 Sep 2024 00:59:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725782379; x=1726387179; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MbxEfKH1k8/Qf9uULVt+DX4XSTY5IQ75JiyMJ31UTKo=; b=RUBjtAmZOYzx05sl//QVtzk324aDUIi1OMhdQj1Cil8zVTgkuFoZXOnJqU7EWh2SXM sG6P36zvPdZUXjn7CQbKZ9C4X2XopoZg2uMQcvvX0pd4kRkNjrO/L0vdYGPBuMaktOHL Y4/DJfVybTWLz7SzStBC0FdqFj5Q6YWlgyU1e1oFXaaH8Bl8UMZiJTtSia1jt+6zFoQp Dokt2QGBysq9q41TuFi/mcB+P1Es92nIUHvXLcfy5UJCmpfH2jx0Lw5RfHxOPDvSYShC fsv1CLbRuxiP2Mmj60cHFe635j+L3RLfTKZElhXhEYOW5CU5RjzTR3YfnQdPcAfC2glJ 8bfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725782379; x=1726387179; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MbxEfKH1k8/Qf9uULVt+DX4XSTY5IQ75JiyMJ31UTKo=; b=s6BKvJB2YOlqjFPArsiTE4rRzXroTSFQ5F+wMingIXKnbo+yL3SbKG3ccZQNQ80Tjg nezgbgvpJI1bZ/ermdYygDrXAIP5utZBp4lHhyPwHRxSDxml4JE3cGndKXCLOujIrZFW 2XfUOXc8ldlFRyKAs2Z7gB666CHwB2tzDmn9PmNEjTYoCAbCvCpgfcPVfsT5rtfUp/sj 0aNbK2MnK/lMQCuZ/Cmsc/BOZq9AJoWtSrFGDiJkmIyi2icv7MXd0brUJbcaFUmWxeNT 3+XOsxOYjc8RBy+1KOCP3BKLs0gltXzF2wg4UsObee+edFhrIEZV43HWUG1RjIWB6sDb AqeQ== X-Forwarded-Encrypted: i=1; AJvYcCUNlwq1SSXcIQYSneuLllRol74Az5RZr/VxkXrM44iG/ieWLyoFnnV4iUpp/sPJhah5M6SwZEqgFC/ismzs@vger.kernel.org, AJvYcCW1ZEWe97pLoEFlW0B1LsrvoMAhETXC6yyXGmqTmvSl5+mL+5M2vJ15timfZvByzIY/ZglN0Y7LTgAUCubmiHHHGN4=@vger.kernel.org, AJvYcCXKa5UBXnMcp8VuMhfnvmYKSK9pQBLKe6QObT8L/DiP8MkZps76xnqx9BxPhkpaI8ti80QDDF3d9jLybUY=@vger.kernel.org X-Gm-Message-State: AOJu0Yz0OFmKCLAFNs7sJeRYlTUZssxz8b3RKTxd59wWCACFY1NaByPy f7634mBQPBeOGrsaGjh0CfDYei0/UuLgpyyT+iFev3g+evaesJTE X-Google-Smtp-Source: AGHT+IEiYcVnzzd9XCs6BnPdnES4UAw5UPqZt8FYQLjQr9Z+xwCq74AYcx8uxESiYvlFIj/3jd88nA== X-Received: by 2002:a05:6808:301e:b0:3d9:222e:40ac with SMTP id 5614622812f47-3e02a02eebemr6979195b6e.44.1725782378990; Sun, 08 Sep 2024 00:59:38 -0700 (PDT) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id 41be03b00d2f7-7d8255dc1c6sm2012690a12.68.2024.09.08.00.59.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2024 00:59:38 -0700 (PDT) From: Nick Chan To: Krzysztof Kozlowski , Alim Akhtar , Greg Kroah-Hartman , Jiri Slaby , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: asahi@lists.linux.dev, Nick Chan Subject: [PATCH 2/3] tty: serial: samsung: Fix A7-A11 serial earlycon SError Date: Sun, 8 Sep 2024 15:50:49 +0800 Message-ID: <20240908075904.12133-3-towinchenmi@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240908075904.12133-1-towinchenmi@gmail.com> References: <20240908075904.12133-1-towinchenmi@gmail.com> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Apple's earlier SoCs, like A7-A11, requires 32-bit writes for the serial port. Otherwise, a SError happens when writing to UTXH (+0x20). This only manifested in earlycon as reg-io-width in the device tree is consulted for normal serial writes. Change the iotype of the port to UPIO_MEM32, to allow the serial port to function on A7-A11 SoCs. This change does not appear to affect Apple M1 and above. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Nick Chan --- drivers/tty/serial/samsung_tty.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c index c4f2ac9518aa..7574d4176e76 100644 --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -2536,7 +2536,7 @@ static const struct s3c24xx_serial_drv_data s5l_serial_drv_data = { .name = "Apple S5L UART", .type = TYPE_APPLE_S5L, .port_type = PORT_8250, - .iotype = UPIO_MEM, + .iotype = UPIO_MEM32, .fifosize = 16, .rx_fifomask = S3C2410_UFSTAT_RXMASK, .rx_fifoshift = S3C2410_UFSTAT_RXSHIFT, @@ -2822,6 +2822,9 @@ OF_EARLYCON_DECLARE(gs101, "google,gs101-uart", gs101_early_console_setup); static int __init apple_s5l_early_console_setup(struct earlycon_device *device, const char *opt) { + /* Apple A7-A11 requires MMIO32 register accesses. */ + device->port.iotype = UPIO_MEM32; + /* Close enough to S3C2410 for earlycon... */ device->port.private_data = &s3c2410_early_console_data; From patchwork Sun Sep 8 07:50:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13795341 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 BB1DD84E1C; Sun, 8 Sep 2024 07:59:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725782395; cv=none; b=PuGSC1Elm+iVZqWBnVAqqmaPUYJOyw2Hg79ZUt1Ea3W4CIfsH5Sp5tKge5S2tgfGCMObKwGKQ+OzQv31FKyikkWFdFm8zRJuzndF0h3VuVIdyU6zCX46hhm1YxeXC06hhowKTvHlo/oP7Z7V+cukfnvbNW2SfUAsDLgo3AfNM8w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725782395; c=relaxed/simple; bh=UPTJKYpZuE+NMhy0BOghVRXFT6JoLBwVcxFYq/KQDsE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kmONKNKs/am2DMCKYg4RUbInT0DjODJEUgOALZEagqhBXf+kzZmoEd63jXpmJlW7i8+asfBmNW7JQ+ElACt8pgTo/xYRlh+N1lFs0DEsMqB3WDv18nSoCtilJbJgKbZuFMGntGSPeqQUs6F9+G28mGIyciH/IbC286uuyI8TC8E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WxEFmcT6; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WxEFmcT6" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-2053f6b8201so31611115ad.2; Sun, 08 Sep 2024 00:59:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725782393; x=1726387193; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yp/lE9jsjwYr4QJVO6arIKQKvwQTHVJgAIKKrLEU4/M=; b=WxEFmcT6S/CYdZYFwDUAhV5QHeTD/ZPnwz34XS4I7AHlNcIsGN+1AFBBkydU4yyEvW 6i7Z8+JfQzrMJLInqkRKM0W2Lsp+VYwLUapEDMcH1QZUD+uNZjvHq23QragcEzhmBfy6 P/Gq9V/ZKXPEk6pfSTd5n5AC9Ufc2hDosPV8qRpp2FQ3nDZ+4ZoBANHE+OtyE62thneG 0Cq1qslyxN3qFX6aWRyOC1iqK48Y4+zinnxiAHM5mUQAtctmCVNPgF1/rM68XtFBYyHF NKBrJYf9x8E6jw7RiQmn1iLXWtRUh3upV0KhCq6oRpZAdTCrPGf3P4JDsf64POvME7jW /Arw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725782393; x=1726387193; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yp/lE9jsjwYr4QJVO6arIKQKvwQTHVJgAIKKrLEU4/M=; b=YL5ZiCjYrhLx5BaxKP5lU1pt5sUks9Nrrw+wF7042yjB2m/1Xc92fGGutkDR3YqRls stGJIj+5O+JDCgUn+FDvEyb08FYFhUlJvWPJeRnzpdQmYjxvOHMs7bK6T1RnybvGmII7 lJohrNGsRou6t9EycaG/56jpRh08TH25Bx8b22rNxL7ML7A5oJLHkw29Q/x9DlNT9x0I z/Fl7RACw1Jn0CIXdkamPw1rjlzUxGjKGowuEcReFUvkmalpKWy6Ifx/2M7fgO1GIW54 W7BnK+3nEoatamSV83m9q+Ao+qM60TAjUaHrdybXa2V2D8f/oovr41Pagu3Lt19RNE35 k9VA== X-Forwarded-Encrypted: i=1; AJvYcCUu9jIOKK073ROBF29pgYZKgH1ZfBYch4Bua4THbh+wV1Sik/l1G45gtwGi/lc+lVQqYWBHdTvs+MpYmXU=@vger.kernel.org, AJvYcCWW7uQ70VbKmSmmMfkT0g531wAnF3FdzzCP3GCy2nU5pHJvqkjn9KCksviEwaWgsZu1N0N6IbEbhW+JI3l2iag6Zcg=@vger.kernel.org, AJvYcCXeDMMDGxt8Hpl2HnXyiv/DeB93ncZ4tX7uS7MyO+AwYOsq6vTUx3CImreF+lNGE9d0YXpR0OwxZPJ6Usju@vger.kernel.org X-Gm-Message-State: AOJu0Yy+EyMl4Bu/UOWnT752xvztrTuBU0huOyil+FsrgrN0jKlUHKYb OrRlzNal7Q92nh2jtWYHfqdLVJLPmuzM13EqorYq3/7a3VwlJDeL X-Google-Smtp-Source: AGHT+IGCGgxhBLnfpM1/1m1EpmPE/ZTOPIdCCK6RTEVjqefLCbamq/qcZG3kSjyvJcNn7Jo7ZJWEiA== X-Received: by 2002:a17:902:e752:b0:206:ba20:dd49 with SMTP id d9443c01a7336-206f0552304mr128552445ad.33.1725782392935; Sun, 08 Sep 2024 00:59:52 -0700 (PDT) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id 41be03b00d2f7-7d8255dc1c6sm2012690a12.68.2024.09.08.00.59.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2024 00:59:52 -0700 (PDT) From: Nick Chan To: Krzysztof Kozlowski , Alim Akhtar , Greg Kroah-Hartman , Jiri Slaby , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: asahi@lists.linux.dev, Nick Chan Subject: [PATCH 3/3] tty: serial: samsung: Fix serial rx on Apple A7-A9 Date: Sun, 8 Sep 2024 15:50:50 +0800 Message-ID: <20240908075904.12133-4-towinchenmi@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240908075904.12133-1-towinchenmi@gmail.com> References: <20240908075904.12133-1-towinchenmi@gmail.com> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Apple's older A7-A9 SoCs seems to use bit 3 in UTRSTAT as RXTO, which is enabled by bit 11 in UCON. Access these bits in addition to the original RXTO and RXTO enable bits, to allow serial rx to function on A7-A9 SoCs. This change does not appear to affect the A10 SoC and up. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Nick Chan --- drivers/tty/serial/samsung_tty.c | 17 ++++++++++++----- include/linux/serial_s3c.h | 18 +++++++++++------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c index 7574d4176e76..f6f8645b0798 100644 --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -550,6 +550,7 @@ static void s3c24xx_serial_stop_rx(struct uart_port *port) case TYPE_APPLE_S5L: s3c24xx_clear_bit(port, APPLE_S5L_UCON_RXTHRESH_ENA, S3C2410_UCON); s3c24xx_clear_bit(port, APPLE_S5L_UCON_RXTO_ENA, S3C2410_UCON); + s3c24xx_clear_bit(port, APPLE_S5L_UCON_RXTO_LEGACY_ENA, S3C2410_UCON); break; default: disable_irq_nosync(ourport->rx_irq); @@ -963,9 +964,11 @@ static irqreturn_t apple_serial_handle_irq(int irq, void *id) u32 pend = rd_regl(port, S3C2410_UTRSTAT); irqreturn_t ret = IRQ_NONE; - if (pend & (APPLE_S5L_UTRSTAT_RXTHRESH | APPLE_S5L_UTRSTAT_RXTO)) { + if (pend & (APPLE_S5L_UTRSTAT_RXTHRESH | APPLE_S5L_UTRSTAT_RXTO | + APPLE_S5L_UTRSTAT_RXTO_LEGACY)) { wr_regl(port, S3C2410_UTRSTAT, - APPLE_S5L_UTRSTAT_RXTHRESH | APPLE_S5L_UTRSTAT_RXTO); + APPLE_S5L_UTRSTAT_RXTHRESH | APPLE_S5L_UTRSTAT_RXTO | + APPLE_S5L_UTRSTAT_RXTO_LEGACY); ret = s3c24xx_serial_rx_irq(ourport); } if (pend & APPLE_S5L_UTRSTAT_TXTHRESH) { @@ -1190,7 +1193,8 @@ static void apple_s5l_serial_shutdown(struct uart_port *port) ucon = rd_regl(port, S3C2410_UCON); ucon &= ~(APPLE_S5L_UCON_TXTHRESH_ENA_MSK | APPLE_S5L_UCON_RXTHRESH_ENA_MSK | - APPLE_S5L_UCON_RXTO_ENA_MSK); + APPLE_S5L_UCON_RXTO_ENA_MSK | + APPLE_S5L_UCON_RXTO_LEGACY_ENA_MSK); wr_regl(port, S3C2410_UCON, ucon); wr_regl(port, S3C2410_UTRSTAT, APPLE_S5L_UTRSTAT_ALL_FLAGS); @@ -1287,6 +1291,7 @@ static int apple_s5l_serial_startup(struct uart_port *port) /* Enable Rx Interrupt */ s3c24xx_set_bit(port, APPLE_S5L_UCON_RXTHRESH_ENA, S3C2410_UCON); s3c24xx_set_bit(port, APPLE_S5L_UCON_RXTO_ENA, S3C2410_UCON); + s3c24xx_set_bit(port, APPLE_S5L_UCON_RXTO_LEGACY_ENA, S3C2410_UCON); return ret; } @@ -2143,13 +2148,15 @@ static int s3c24xx_serial_resume_noirq(struct device *dev) ucon &= ~(APPLE_S5L_UCON_TXTHRESH_ENA_MSK | APPLE_S5L_UCON_RXTHRESH_ENA_MSK | - APPLE_S5L_UCON_RXTO_ENA_MSK); + APPLE_S5L_UCON_RXTO_ENA_MSK | + APPLE_S5L_UCON_RXTO_LEGACY_ENA_MSK); if (ourport->tx_enabled) ucon |= APPLE_S5L_UCON_TXTHRESH_ENA_MSK; if (ourport->rx_enabled) ucon |= APPLE_S5L_UCON_RXTHRESH_ENA_MSK | - APPLE_S5L_UCON_RXTO_ENA_MSK; + APPLE_S5L_UCON_RXTO_ENA_MSK | + APPLE_S5L_UCON_RXTO_LEGACY_ENA_MSK; wr_regl(port, S3C2410_UCON, ucon); diff --git a/include/linux/serial_s3c.h b/include/linux/serial_s3c.h index 1e8686695487..964a4fbf2626 100644 --- a/include/linux/serial_s3c.h +++ b/include/linux/serial_s3c.h @@ -246,24 +246,28 @@ S5PV210_UFCON_TXTRIG4 | \ S5PV210_UFCON_RXTRIG4) -#define APPLE_S5L_UCON_RXTO_ENA 9 -#define APPLE_S5L_UCON_RXTHRESH_ENA 12 -#define APPLE_S5L_UCON_TXTHRESH_ENA 13 -#define APPLE_S5L_UCON_RXTO_ENA_MSK BIT(APPLE_S5L_UCON_RXTO_ENA) -#define APPLE_S5L_UCON_RXTHRESH_ENA_MSK BIT(APPLE_S5L_UCON_RXTHRESH_ENA) -#define APPLE_S5L_UCON_TXTHRESH_ENA_MSK BIT(APPLE_S5L_UCON_TXTHRESH_ENA) +#define APPLE_S5L_UCON_RXTO_ENA 9 +#define APPLE_S5L_UCON_RXTO_LEGACY_ENA 11 +#define APPLE_S5L_UCON_RXTHRESH_ENA 12 +#define APPLE_S5L_UCON_TXTHRESH_ENA 13 +#define APPLE_S5L_UCON_RXTO_ENA_MSK BIT(APPLE_S5L_UCON_RXTO_ENA) +#define APPLE_S5L_UCON_RXTO_LEGACY_ENA_MSK BIT(APPLE_S5L_UCON_RXTO_LEGACY_ENA) +#define APPLE_S5L_UCON_RXTHRESH_ENA_MSK BIT(APPLE_S5L_UCON_RXTHRESH_ENA) +#define APPLE_S5L_UCON_TXTHRESH_ENA_MSK BIT(APPLE_S5L_UCON_TXTHRESH_ENA) #define APPLE_S5L_UCON_DEFAULT (S3C2410_UCON_TXIRQMODE | \ S3C2410_UCON_RXIRQMODE | \ S3C2410_UCON_RXFIFO_TOI) #define APPLE_S5L_UCON_MASK (APPLE_S5L_UCON_RXTO_ENA_MSK | \ + APPLE_S5L_UCON_RXTO_LEGACY_ENA_MSK | \ APPLE_S5L_UCON_RXTHRESH_ENA_MSK | \ APPLE_S5L_UCON_TXTHRESH_ENA_MSK) +#define APPLE_S5L_UTRSTAT_RXTO_LEGACY BIT(3) #define APPLE_S5L_UTRSTAT_RXTHRESH BIT(4) #define APPLE_S5L_UTRSTAT_TXTHRESH BIT(5) #define APPLE_S5L_UTRSTAT_RXTO BIT(9) -#define APPLE_S5L_UTRSTAT_ALL_FLAGS (0x3f0) +#define APPLE_S5L_UTRSTAT_ALL_FLAGS (0x3f8) #ifndef __ASSEMBLY__