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: 827711 Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (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 C65A7558BC; Wed, 11 Sep 2024 05:08:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726031304; cv=none; b=LwDlJNJZvfgQmanIzAYjQ8hFNZT7/KWXj3gkuGlO00GoeSCrnfYm+BQlMopWh/mA6DhqTYRgmANLGY95vBGvIg4zylXzoTKm2dgq2Pfl96yVyUMOXknZiLM0Lz/jfOslJ1JJuQ4dLmzd8yV7EGgq4vqPWK+2w2Axnv21sogv0so= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726031304; c=relaxed/simple; bh=yAN6mfqDrB8wTcQSVZ6SkaptmYA6iy10wKQKp7nojho=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oCxCaShkrDon8+oFACMirlfzzFBS0ZeAWr78hzrrr/F7fNKsiX9UeidcrDbvJzuH9AwAL5ZWQedRnVyMMh6S0L6awnAgQoZEVWD3aHHl2NHzxt1PANFUyTzZ3elkhlGnW6Oo+Hrx4SaTeGQVc3o4XScaoHsiGrk9wFhyoody+V8= 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=Pfjgmuw+; arc=none smtp.client-ip=209.85.215.181 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="Pfjgmuw+" Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-7d7a9200947so2632385a12.3; 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=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=LUu8ETTOYOnQU9rQCJ5bMvfZihZxeyBk0Nys8vKoQ38=; b=Pfjgmuw+sd/IE768pTh7ltIZjjY4+l+pKBkGGqn3L+nHsik/OK66LlwPE9ORxWGOHp p2grqkiUIxmUfBmwzBMbJT2r4/xfVNwEWUUMnSzHIVktFnxx6Raenr37UPPeQEw2fACC b7NaTePJhWObSCAD2uAl4kql4ch8JpI797K1NlZS7ukRgGa/SxdD17uujaWCrbqq0PSH +gH6uwj6ZrDBsGhT5T3gEOU51h5mCiA6NS8OzXZKpvd17QloFcaooDpb2LLS5lmX2pmp Yc7VzGHO+vX0TOpKNCnD7W6GbC5v4tog8P8eTGMf7N395fQaGMETwHCuTtLGbgp+gzYP /XJQ== 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=L2wvW7/j44zloIMh6j2m63DzR5YosS0JU0Ru38gx37TeYppbZKXWwq/JXpE7WZur6s 2WXena6vlIjeyF4ocn+TJqhIzpg1h54wLtkxGfZAtdUK2WVa03fsdcy1tMfR8ilRcNOA dhjYgsOOehPRUXT0W5lY5i+CHyE1qfL1vfvkIVucin152WxjCxkoPJdG/3Lf47L4ud2q j1AEqnEspSzQDeEQeOwMSojmXIXU87jSn1LfUavxV36LRbKX0V/bOVWlzFJPOZMV8QiI qW+azsBEfzCnodK81uAT5RHMmcmdWvtc4NMIj3sGamw61htykYZ1CzNG2mTxZoOo7coQ WRIQ== X-Forwarded-Encrypted: i=1; AJvYcCWLzxACcPwtgNeW0cN+f4P1L0QPY8xgRorsYC5X0IAQF+jrFWIdCWm1Eoz41G+b0bEilC+4mLf55weKr3vt@vger.kernel.org, AJvYcCX3jb6Q5LLAjYwLB8+qbphWFilS3yWHL6xCc8xoUSiMvP4vfcnEdW2yzJz49nckmZZJnS/IOs7fkP6Xp5M=@vger.kernel.org, AJvYcCXW/Atp4Web/rxRueE9GSIleCX546kqbvph3Hzhd9rpYRwTs1faOJcGNhSycu0AnrATJVTibR4Upvw5F7N08V9GUeM=@vger.kernel.org X-Gm-Message-State: AOJu0YwyuixkqRfkdWgb2A/lEjdKrN32l7PuJvqHWA/16yUJqweoFDpm Ks15WTebaQ6/59s2AJwMnHjKnqCsPukoKFdKzYeZ8CuGS1FTe0dK 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> Precedence: bulk X-Mailing-List: linux-serial@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 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 --- 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: 828960 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (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 6D0367DA68; Wed, 11 Sep 2024 05:08:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726031308; cv=none; b=LXmnsJ1tPlUxsTYud2aKfjjV8tmVF1i3X39CpnrNHGIZ+3fWPnQZj1+BHjQMIUxaKcABUPK6uw71/4XJtV49rqXc1owyoBE31mJBJk9POivBbDCb4sqDcoZqMixW/4FN+Yu9cnOi9jpot7XDnE0rIwfa5pco3OjLwsJrehPgV44= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726031308; c=relaxed/simple; bh=vz7Fc6/D6FdYhQGU0yeXVF4Yg4bvyRPDYA9zka6qPpc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O03tRLZfSE060xOFN8ezMQ8kW0UkfIRhNZ3T8PusoR/cB6BlyW9oQznAKuRLgnmGRMyyGfgWv/gxq7bdYG9YlL15O8mPhfti4K1HsobaFRtAjIsTg8E/NnNGPBKOKYinmWAbDmR6YeMl1OBjy2FQKYqBtvVp9F2SQjbMG6wlpEk= 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=eKB5dek4; arc=none smtp.client-ip=209.85.210.177 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="eKB5dek4" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-71788bfe60eso1132251b3a.1; 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=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=mNdPAQz6FCH+x9os16nRs546qMZHgKNAK/Ypn6mSlDo=; b=eKB5dek4F+A8YENvL9y0l3DVM2bpf+SwbxttKoCrT5n0NXunnH2nJj3JyerKebuMw7 vUQd8sMLTAYc14vVClaOweClGqXerxMYh6vkUreRjlcms0+bTVwjCPWwN2HOA+it9PRR RorR8TmtL3Afu8QEIq+/oRIIdlmTnANzNBg5wXm23ApgS8J6o22aH5gm07dbZ8QZh/qB vLiSXm06gWe4lRkbD6G5btGwhAYysB1yyrNGGZYcVwGRIaAAfL80KLLvwzM0o9e3N3lT 9NRvHkjCkoP0+S9pugP/j8GGgzjujnKPGPdUm4m4byZh31U8c+upzHBOTsc3dx7+YiMZ V6sA== 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=mEnJlZe42zMLUC1AbECh+Zcr/oj8P5u91+/IacOJN4Q0eRkT1ljRE+Zler146P7cbv wItEs+Cnoj0r7Im3J3l+OIflDriaMXIhLlrRcHyl8khoN8ElGs5kEiGwsV45S+ghkUOj AD+djYpHecMKnj4wXZbMmlZ0PyRLSARSCoA+kRCAoOpyFWv8Li+noJtrhGJyo1qNxhha RNOOfl62hPOPM8FCCMYSYR/sw0hmdY7iFSqpvLnIZbdqAx31ADb96UFzA+59cCYxhv5G NAn1WICImaZuQmEWHcwN4v35QJ13I2rb5iQaJ9HM7uQQUWcdPgXyT1UUYm2KwgZcfssH ofQg== X-Forwarded-Encrypted: i=1; AJvYcCU+n1e9llMMDy2FosxZBPexj+ob0w+mRbdltjhNNdkUnjYXlm/q9Cri6+wTBX3AQubXZB64zJpbQUiaIn8=@vger.kernel.org, AJvYcCUZZSebQbPUWRF5l8UzPb4SMJlzulaSJ3TKLQxpBSEh4ZX2ZkVwfPdLX0KTkYW+AFDeKVVspiNR29uxZKPc@vger.kernel.org, AJvYcCW2CkQNgL4gCXQ6jVeT7xFxZNLYTVkYjTnyppYBt4sa2uS2j2W6Q9z2Iw1ygZvilkeVwa/NSBTE18RKqqLJeIr9qP0=@vger.kernel.org X-Gm-Message-State: AOJu0Yxvv9iabK2IEtYxMPg5ktG5i4UL+upx7gxbN3vTwV+0U5yFjviP RVw/e3hsaYtpsGlXjQ7yq9y92O6yP3K1SwSw4g2Zb/VLZuUY/lpm 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> Precedence: bulk X-Mailing-List: linux-serial@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 Reviewed-by: Neal Gompa Tested-by: Janne Grunau 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..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: 827710 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (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 97A647580C; Wed, 11 Sep 2024 05:08:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726031316; cv=none; b=qXpTwidF/G/9qs5VuqLrMP9yM+i7717iMpuR4JTYFmlN23vnM2UT3CvwVt6QkyGGDw+xLXXo3nqRVEh6Wg4F5EMifZC5ybAuAjo/DgDjqVS7ZABjeqygGVwOPHc/r1B2He4vLjJMTFWH5r35znIRh+Ao4qGj9k/ykSplsl2o4f8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726031316; c=relaxed/simple; bh=VbxyHgLijtvMODTxWu3V6V7t7MJUjo0WXZgNPC4BS5g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l+jQH72On+OgPWWfB2Tn0rk55/tD6VGMOu5cPnt4n/K9ceFFNdw6QWe89yylMfdQW+KN4+pRh5zHLGUoW3NpkTebme0JUAnTUWBBYOFkP8J8VC/EMPypKzELfRfrDMB1CtvWVShMbZC2R/pMMRFV7MHQWWHu1gJw13YuNxFI48I= 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=JbL+qnB3; arc=none smtp.client-ip=209.85.215.173 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="JbL+qnB3" Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-7d4fa972cbeso5148547a12.2; 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=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=Yvwvg02SfR9k2vRdgG/Bv8ENZ6rOieWsuZ6MKBRYnn4=; b=JbL+qnB3uvABs67Yv1PoJBTN7IHOztIEvA+2/hTguQCqiuiKw/+McUfnpO/K01oZIl aubLCdSZTMn9ZYJrOjkgA0Oqn2263kUintngITFUu193z23H655+ce45XmRzXBttE4Wi StweptOIx/4jiXCU0nDPQxvS9uMw4yO/LsPXYF7cFcLqprfGj2C6ZhDwKJN6qkq6QK61 UN/Z1l1VHbBx6jQDnoh3HuujED990RCCgNS7CcExzWUVLcPx1M3Aq8qDez0Oy1yVboSf Z23Npg4IYKygyJ8ClIFu0KvmF85Bu5WNIm7tZ+BMCD86tU4tW92T6XCS+F0Y63oHwCyz s4Kw== 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=oNoHLqKO2QolxO1zqV3oZg2f0KHTOUa+wVVtPI9OxMxHs9O8FgpSgRWp/yJJ6nTlxZ fSqiKQj6OE7u4JkUdROZTL8PEh2bAC9DMq1R7Np7PwVSx2J4+AytR2wH2Oh7nsDSmxuq Z+VXY0QKV78jD0U+sQSJKKFyp/AEeAWb8AqiGIR+MJXXSlvFwnAvJFImgQwl6jKPazAt cMP74VUusgxY/ZSLg5/YLc8IqoKZVxb9NoKqoNMdE8IbB2ze8XHccEdwu9Y3AJpgZHB8 86jwDqurCL9GSMjvXMMoCS4AeSEkcvKVI09LLhcJqDqCnQQTF1DbZ/V1VJvQDKCzHSDh NUvA== X-Forwarded-Encrypted: i=1; AJvYcCVo6obePlGw9D1IjP+KED1uNDyStJBJz4JvVsPUsXkHdolah8E4YwVruEaZSDWd8M0MZFNCa7zE4HQxVZZ+@vger.kernel.org, AJvYcCWev1xqUfqj8+GZVsuG8yW7AxzuiFfyDPiLYX3ll6GK4+vLFUN9QD6GbnDRoznxHkNIQ1OwIPeDowEAQfw=@vger.kernel.org, AJvYcCXWC/Xpg7o5I+Od7YdXHyG+EQqx2xvosJ8pTlqUg550dOp1hUoslhnl4MDnBKNsT46LCt2Ii9uCVkAdCViYfm1uYRk=@vger.kernel.org X-Gm-Message-State: AOJu0Ywsuz8sCLJ00la3I1xHnD3PeTtlTG0xHMp9KUDcK+AZpfhXTTo6 /5z+AU5puEUIpVj3+ZeDEUd9WkQPmiRDF3LnZcoQ1RqnhSBSAwzl 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> Precedence: bulk X-Mailing-List: linux-serial@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. Tested-by: Janne Grunau Reviewed-by: Neal Gompa 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 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__