From patchwork Wed Sep 11 05:02:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13799678 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 8ABECEE020A for ; Wed, 11 Sep 2024 05:10:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LUu8ETTOYOnQU9rQCJ5bMvfZihZxeyBk0Nys8vKoQ38=; b=lbKhcV/2KOPN+TfKKfcmfciwi0 GdNxiBG9cKDR3xLFLyXIoyb4tfR6MM7IzW6RkS7A7fFt8nQYqeFlK1okoYzMLebwWhzQjOmxJAQ9E gOrAe5jqwfQDzDX1EgdnyiCmmLuqbPg/UZJoVHFZah/Ti5X1omrdRAfzUjrQew8mp03Xv2DyH/yMN PiERxLL37vSycafXR22unLjLiZH0AZobn2y05Jpq5o50xbYkko3/Xt71mLRjhZJyf9RLD4qH/3DHS r6/dYcax1YK9iixk1jmb1ASgnW3uGQj2E8We6zpYzT4LZ39kdvOwe/02eD4c+S6mUsVBM75us9xos 1iPJSLcA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1soFcU-000000086EQ-3xgJ; Wed, 11 Sep 2024 05:10:22 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1soFaZ-000000085vg-0Gef for linux-arm-kernel@lists.infradead.org; Wed, 11 Sep 2024 05:08:24 +0000 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-7191901abd6so322235b3a.3 for ; Tue, 10 Sep 2024 22:08:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726031302; x=1726636102; darn=lists.infradead.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=LUu8ETTOYOnQU9rQCJ5bMvfZihZxeyBk0Nys8vKoQ38=; b=gkC5R5+PwAwtkboL6a3cULeqSI8sw0iPJnzma+N+CdYuK8ZIstZFq2sN/jMf5eESTJ VLwCbpury3eenooOWEBu6flu/IL6T4OObv9EGVLbVoOOLXid6E3ggaHnQ1BcdOuPRacR KO+UiHbkddvVnh3Fjyw7iRW7qG/tjhzto2S7b1JYdTml/Kh2X9OCAGO34EGDrYR+qYTV FTBOjOWFHzG0y+Jk4OQ3vZoN9T63GtBq0DZTi26nBCF9hWS3HyUITuZQA7o57ZD+i4vt URyq2BwaFxm7kmg0yaKJdv0XOJW1v8N8DqrnqKhN7k/yk2YRJOUs3kw5k25AABgsgvri KnHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726031302; x=1726636102; 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=LUu8ETTOYOnQU9rQCJ5bMvfZihZxeyBk0Nys8vKoQ38=; b=fAsMcpdPhTW+X/daHxWXcUOxt7/IrtoMq2q6Y2C1uCVpIMX5znrWdpweYpg6FIxuzd MpKkmNFsXX0DlyatX7KtMy0lF4Dg++VjxagGaEOTR0cOuMWUEwdUDUJWebMho7BoC7hj Tyjlmop118fIAFoPN713HCbF7mjpchdpk+4FykfP3BAZIG5h+HJJ8WVCWmW8ektfJL5+ 3GRpOrwf9fYB5XdenPoAtW6lXVtXlH/b7I4WG/iQ/ByHoKvCtUEyLcPjT2Vu0jTRj3Gs l+tVyMrLGpvhsOipoUPEnK2sfI6xqxp5SlbZlcZS8WACsgjHjetOHLKzw+aj2x70Q14Q X3Dg== X-Forwarded-Encrypted: i=1; AJvYcCU4kGGrDP+wAmJvoq1/IdLUEMLBTAZViBAx3RvkZOl0I0msoFbspDtBAGH+fTEBsH0IqUZb3Z0vuHLrIZbYSPdn@lists.infradead.org X-Gm-Message-State: AOJu0Yx37ydRjD07YCRKV4NyuB8E350Y9yRF3UETgKVxURwzjN0d5Z6I XdW9Eq14mvA9KMrfAxQnoFShmxRRkJ08NXDqrvpifUerXBntXDlE X-Google-Smtp-Source: AGHT+IGbpbWzUpVCDPwwRhWDczI/mlb80vmo2kZf89H+XcRDjaXGPqgXIeKnJo9Lb0iVj7TrdDfXxQ== X-Received: by 2002:a05:6a20:d808:b0:1cf:3677:1c63 with SMTP id adf61e73a8af0-1cf5e114dd1mr4966993637.25.1726031301955; Tue, 10 Sep 2024 22:08:21 -0700 (PDT) Received: from nick-mbp.ust.hk (wf121-022.ust.hk. [175.159.121.22]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-719090d11e6sm2156984b3a.205.2024.09.10.22.08.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 22:08:21 -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 , Janne Grunau , Neal Gompa Subject: [PATCH v5 1/3] tty: serial: samsung: Use bit manipulation macros for APPLE_S5L_* Date: Wed, 11 Sep 2024 13:02:11 +0800 Message-ID: <20240911050741.14477-2-towinchenmi@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240911050741.14477-1-towinchenmi@gmail.com> References: <20240911050741.14477-1-towinchenmi@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240910_220823_121505_0705AC96 X-CRM114-Status: GOOD ( 10.53 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org New entries using BIT() will be added soon, so change the existing ones to use bit manipulation macros including BIT() and GENMASK() for consistency. Suggested-by: Krzysztof Kozlowski Tested-by: Janne Grunau Reviewed-by: Neal Gompa Signed-off-by: Nick Chan Reviewed-by: Andi Shyti --- include/linux/serial_s3c.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/serial_s3c.h b/include/linux/serial_s3c.h index 1672cf0810ef..2a934e20ca4b 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,10 +260,10 @@ 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_ALL_FLAGS (0x3f0) +#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 GENMASK(9, 4) #ifndef __ASSEMBLY__ From patchwork Wed Sep 11 05:02:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13799691 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 D2367EE0209 for ; Wed, 11 Sep 2024 05:11:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mNdPAQz6FCH+x9os16nRs546qMZHgKNAK/Ypn6mSlDo=; b=NvwLsgXir1gA24biKAOZyxiSZJ utVxUmAsXB1hTDSfaOrgEtHkQXZXLCqWfVLLBvcuzM50H1IBXXJNUmt9PooZ7YDFhUrDskYLoigqr EzXg6XFLSvW6N9MxfpQyau163MOgYzFmDyFM564VNLOfY3hFlxm+P8eI/0ipVn9s+AbrR4TX5m8C7 25PIg4CD/+3gjlWNXpSFPaR2CKbyZGLUTQNT9C1Uzb8onZsf2YNyXVqZXqRf15EnjWv8AAAIanVLR DVPCLKOweo8oljqVyK/rRGX9DLt5Iaz1xRZ0lI0VG1wOGxg+UbmLKD5tbnrwOI7wrR4+Yr+HsZOVH LwJSDpTA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1soFdV-000000086LB-04nT; Wed, 11 Sep 2024 05:11:25 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1soFad-000000085wX-37mK for linux-arm-kernel@lists.infradead.org; Wed, 11 Sep 2024 05:08:28 +0000 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-7191f58054aso59086b3a.0 for ; Tue, 10 Sep 2024 22:08:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726031307; x=1726636107; darn=lists.infradead.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=mNdPAQz6FCH+x9os16nRs546qMZHgKNAK/Ypn6mSlDo=; b=J5ze97C0ul5stUi71rPdaEX+FyzJJSINNdYS2/r0BaUzWst1Qj2PpEXdFV59rRh8O4 Wx/i1XglYReaVU4BhItaaVy1p7Wre9ytG/v3V/CcDKbgSprY9Ebvon8lTBAjp9sfvgRD HYYXTrZQqD9jzSYbc0sXYEP3k9CexE2s5tVeuBcYc6bKQHjRajGXYRPUKjcKs6xURUVX AaYd82VSOJZp+ZmwzmPUzysINfbCRa7bOvURSYX5SdSj0eT1DfIz0HbPNwZkM3WYvagC 2LkRgPFfKMdY9YfOjVfiascB3NbGb22gPqxFhOSedvCS+GVoeXmH83wTSysVglUlVGnr CNzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726031307; x=1726636107; 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=mNdPAQz6FCH+x9os16nRs546qMZHgKNAK/Ypn6mSlDo=; b=qMay7sU+p9WQKZUVuGCysKk58WhLAm8EbVWEc/AmAyPnHwwTBCVGQacb4FwDDd8eO3 AUeDEEDA+9QDUf3w4IpBsxYP5ZC3buIhD55j6tyHKYMLLegQq2sb5tSrqaCIZSsN9p1W rQd+NqT6+Tw09wSsEK7lhEw1CFIge4IQ14yTB38GSboCub+y03qDXRXyDIfQN4UBmd/h iW/LKarqKGpVK9vJx8isXYpEZbrxJbZig1jsksDtggw1tJEI26Uh7jR4qprDzutcJYKo B7KB7Fj/zLWwgaCSxXwsz6nPQPZKH8/72TcmYofQ+7B6ZZMy5A20xvO6uHPDsOUKrA5/ vv7Q== X-Forwarded-Encrypted: i=1; AJvYcCUoRMYQWdqqm0ncvCaolq7m38xMeuynRqyckjl3Kf0C+RUoQm4A1Kl9sKVJ6f7+cmCh/jKLLFOdpL7Yn3C4v0jh@lists.infradead.org X-Gm-Message-State: AOJu0YyqeJtTxeu+KaPk/4MGEHlokZx9U+suXB3WxKfDaAui9IlKfAMx PHaoelaff6PR2CxMTmvMuDCvE4tNezP+Bqv63fCDjWbkpjnh8YVy X-Google-Smtp-Source: AGHT+IGAjwPVwpMs2Tlzc+fCn6t25k5zV5S+6h2An1CKJfS27fXosKBLTBlxWiJ1EXeZU/4reI1Esg== X-Received: by 2002:a05:6a00:66e1:b0:714:340c:b9ee with SMTP id d2e1a72fcca58-71916e193b1mr2217489b3a.1.1726031306631; Tue, 10 Sep 2024 22:08:26 -0700 (PDT) Received: from nick-mbp.ust.hk (wf121-022.ust.hk. [175.159.121.22]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-719090d11e6sm2156984b3a.205.2024.09.10.22.08.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 22:08:26 -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 , Neal Gompa , Janne Grunau Subject: [PATCH v5 2/3] tty: serial: samsung: Fix A7-A11 serial earlycon SError Date: Wed, 11 Sep 2024 13:02:12 +0800 Message-ID: <20240911050741.14477-3-towinchenmi@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240911050741.14477-1-towinchenmi@gmail.com> References: <20240911050741.14477-1-towinchenmi@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240910_220827_807063_A157897A X-CRM114-Status: GOOD ( 17.27 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Neal Gompa Tested-by: Janne Grunau Signed-off-by: Nick Chan Reviewed-by: Andi Shyti --- 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..3fdec06322ac 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 Wed Sep 11 05:02:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13799692 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 7A3D6EE0209 for ; Wed, 11 Sep 2024 05:12:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Yvwvg02SfR9k2vRdgG/Bv8ENZ6rOieWsuZ6MKBRYnn4=; b=BLaHGZ9gJ0YLksSQggDd96mQfA rlGuXT4latOYUX+qjV5P1pW5Q8t7qggK0Bru/Q2UsMM6tblf48V4pg9m7I8yQp2W71VxTAo9gZrXp a+2G7tIdQRbkJe3UPJfvpcMMiip17hxki5RZHZhRHou5y+VtrNRvt07surLy8Reb6will9Hgrawzc wC6GDNjogmHbYilCIeahuTuQdxrnqRjm7AhBN3OC4+xNsghCHVPP3/A5SOGta1H/L06x626WEPQSd CYLPNotNLFQaIWa8E0XesJCE8WrTzpM1Ff9jLrRWgERPQdDv88Ti3ytIQgRjb3hG1oP8vUCEKGlSK ZsLkatRw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1soFeU-000000086Qg-0WYE; Wed, 11 Sep 2024 05:12:26 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1soFal-000000085yv-0UqP for linux-arm-kernel@lists.infradead.org; Wed, 11 Sep 2024 05:08:36 +0000 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-7191ee537cbso76090b3a.2 for ; Tue, 10 Sep 2024 22:08:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726031314; x=1726636114; darn=lists.infradead.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=Yvwvg02SfR9k2vRdgG/Bv8ENZ6rOieWsuZ6MKBRYnn4=; b=TQgFO/x40zB2kFDR4waenT40gPCR/6qH6W82V9vYUJUlfoNuDR+x/AiJ38Pd19BMTI ar9/FiyT69cN8TxlWRpUVQfDo+nxiehzvaCxZIcm1hb8QVt1aSiC9ZdEVu1lSnKcnQxW QeDsJq041hjDdOPFqXmVgRzuT95jz+7fRx0iIi1tAYSZ7ZvmHYg+9UmPEuQFLCbZoOty jVtbCTCt/jOIfRazdZybIR1Se8nLwpuGcbDVOppfWRJ3iJUEuVbKTcu7pOWUYej9aitn Jfbe92YBQq+eo6T0LKg6me9Pri3iT3YGvTWVYqRjJ/bdbZBPnW3KdkS+se1EpV95mdow haCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726031314; x=1726636114; 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=Yvwvg02SfR9k2vRdgG/Bv8ENZ6rOieWsuZ6MKBRYnn4=; b=ggaOxTQ47eIrZZ45IiQAWfznrR9Skj5kf89UoktmVbtZbMGK3MwjMwIoq0EqHzv/1s 0avH9Z96Vl1va91sR/19iZtw6Nn4sus6aT/WBtZVxiCkgowqFiecXMRmwtmuf4UTWfhW VgcEqu6AvwVCLKznovRSzDg06yllkfFHFL5guWA8+vxdp2v61DVDVygCStIbLdVd7LMM mchEn4R1BpFnYeBrMnbKNIxj0jhPGCKTQON8XqWH4dlT/l/gpiHEbbrP3fQ5Yr/8UVoM pSsrVN4xh7uwHrI+cqsdg2f/B4N+y6YWnsFMrmLwWzBvJSAHDnnY+8dV26EQfAUdPR8b fVzw== X-Forwarded-Encrypted: i=1; AJvYcCXe2RoisLp426wit4HP8WiuJPDHGUfHtwgzxGEUGDB7cwRGIysL9pj65+GvQmQhSLlsxo3jPLj7oiH4dIRr/U9P@lists.infradead.org X-Gm-Message-State: AOJu0YyNNdGEFnfdZi1xPZwx+VNkvU+DcZRZoVAq1Df+F4rZVvtuET0L w2s/tIL2YzNl6ivxNUHWrraPwS1gbjNOtDEstVxZM0w0FVrIEBrt X-Google-Smtp-Source: AGHT+IFSx1pD+FrsMRBNSUqJhlhYmY2n61Rn3DDVI6qu0M2QdurlC7Tp70mR5VSk+EzWYPbRcaWNmg== X-Received: by 2002:a05:6a21:3946:b0:1cf:3885:b9d8 with SMTP id adf61e73a8af0-1cf5e0ffd16mr4694941637.27.1726031313731; Tue, 10 Sep 2024 22:08:33 -0700 (PDT) Received: from nick-mbp.ust.hk (wf121-022.ust.hk. [175.159.121.22]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-719090d11e6sm2156984b3a.205.2024.09.10.22.08.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 22:08:33 -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 , Janne Grunau , Neal Gompa Subject: [PATCH v5 3/3] tty: serial: samsung: Fix serial rx on Apple A7-A9 Date: Wed, 11 Sep 2024 13:02:13 +0800 Message-ID: <20240911050741.14477-4-towinchenmi@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240911050741.14477-1-towinchenmi@gmail.com> References: <20240911050741.14477-1-towinchenmi@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240910_220835_234570_17373CB9 X-CRM114-Status: GOOD ( 16.39 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. Tested-by: Janne Grunau Reviewed-by: Neal Gompa Signed-off-by: Nick Chan Reviewed-by: Andi Shyti --- 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 3fdec06322ac..0d184ee2f9ce 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 2a934e20ca4b..102aa33d956c 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 GENMASK(9, 4) +#define APPLE_S5L_UTRSTAT_ALL_FLAGS GENMASK(9, 3) #ifndef __ASSEMBLY__