From nobody Sat Nov 30 16:25:11 2024 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 CAA141B1D67; Mon, 9 Sep 2024 08:42:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725871377; cv=none; b=Cf641wfp4b/KMzGO6uK5AoHxugqXbdhvsOjiPcyIgerEF+YVSkT4/osffVinMDO9vzK+vbVoiclktgi+p3oFXZ6MdZMQM2yDcKKqmyCW4YA3ZRdDJSkicrqM5PhEz3Z0DMgXEvnpAqAPQO65ApfuX5c+9pL9m3OrxVNyLqZ3ZHQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725871377; c=relaxed/simple; bh=VWXmO1RyWUyhWh2dn59RYX/QZ88zhjH3WSnJNNQVVnc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sXpthfO9HHJRKfUIdmBf/fH2aJpQ52Rxb2XhHjLfi7JdOaoEKOl80A8N2J1vKqXHPnzdmQtOp7GIkFqGQ96EP/uqRW8YzxyITXxTxKSejtD0maaRQoBoUNEsIXxg+vWJfROnyTDhS2NqLdV0LWQt5kL8RRrDON568ZhZGni9peg= 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=BRx2//bK; arc=none smtp.client-ip=209.85.214.170 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="BRx2//bK" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-206bd1c6ccdso36197635ad.3; Mon, 09 Sep 2024 01:42:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725871375; x=1726476175; 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=BRx2//bKDXOT0EOli4y8CJLrUtMKQyDzIxIiwDK6XqLvV0l1MaggpLSd8qqiApVsvq I2Xw01rAqGCfPc8iJuw2JipLnxvhq4cjI8s51lSkSGLHFnRLGbzIT0t6SacF0IW6rEYk Zjr+UzI/o3wsbhB9EWoDdBhbjCtHO647KyPZM4ZuDcjxRjCiaTuCcS//qBpE2eSf0eN5 eVrWvXUQSqCAkKaxXzY14Zyih5r6Fl4OHu22DaZQ4qySqTlgwr5yPR80QjfMMGYt1Gpb NCp7WvBVAK2P47T0z6UIsUggjA/wUmJWgL+5hkQzEaowXmXRlOi5+5LlrncoA/LwBdY+ grpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725871375; x=1726476175; 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=mL3rQ9nz7xllRfeNdd78lZ/XxxvR9Y9RkwpxIhB02K/FhBW+U/+KYEaR+a6BqDWrDc Ej0M3v5J70juGv8LwR1PUN4MqgRS7xXyqoNP6gRN2APqAjwkbIFAxGqhh1QekrIC37gJ ASYXd+m4zQqSsUhqjUd5Fl/iyYz//GBlhuzgD31SjltgbK/z90GNADkQ3NUYlFccbOJA mK8K1zF2gH2vyfhPyvsFB7byeLy4A1Fnnsx1hIenAOgApMxAY6wBq0DSVGq0PPleNsCM xR8dI5sk8/E5WUWTEgp1YhHHiSx9rNEAFI3ioQ8qtQmXP8oT3QrjU4Y/7BlNoTy1tRLh Hrzw== X-Forwarded-Encrypted: i=1; AJvYcCUE1r4hpkvGEa01/zHswGjNUtLML6b6Wc6v6w6AR3Tk9AM1jQa+dn8/7JvnLl79p0vnHoUNkalJJM7DZYE=@vger.kernel.org, AJvYcCUaW528SQcdxyWCEvk1NwmN5DWBG5mduqQEzCw3NHD0a76rD9dx8wZqqrXBoaiC4ApMLcRcicqdvHILS7k4@vger.kernel.org, AJvYcCVZyOP5dZasKQIoQmFxDT3wURjk19HuX9RYnj8WEozHi6MN63dZd7eFrkso5ogF6RwDUIPImuhRHskniTgchqslAnY=@vger.kernel.org X-Gm-Message-State: AOJu0YyT5qF42P5NCBTJ3zkU2YXs5HJ0dKxnNx85rUhJ0cy2QvxjbXE2 5cYFEs5gkIQUY/Kwy0hMoPvrHn/+C9/mwfWzTPtEF8ADR5YmUovU X-Google-Smtp-Source: AGHT+IHiDYxp2luZ1A4jiUkw8o2xWduuxjjGAFTCAzkleRs2eiF+6NUWiZjUn6ZHSoKHqp3vyv42cw== X-Received: by 2002:a17:902:ea01:b0:1fb:93d6:9fef with SMTP id d9443c01a7336-206f05f643bmr99589505ad.38.1725871375038; Mon, 09 Sep 2024 01:42:55 -0700 (PDT) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-20710f1d663sm29678675ad.188.2024.09.09.01.42.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 01:42:54 -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 v4 1/3] tty: serial: samsung: Use BIT() macro for APPLE_S5L_* Date: Mon, 9 Sep 2024 16:37:25 +0800 Message-ID: <20240909084222.3209-2-towinchenmi@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240909084222.3209-1-towinchenmi@gmail.com> References: <20240909084222.3209-1-towinchenmi@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" New entries using BIT() will be added soon, so change the existing ones for consistency. Signed-off-by: Nick Chan Reviewed-by: Neal Gompa Suggested-by: Andi Shyti Suggested-by: Krzysztof Kozlowski Tested-by: Janne Grunau --- 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) =20 #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) =20 -#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) =20 #ifndef __ASSEMBLY__ --=20 2.46.0 From nobody Sat Nov 30 16:25:11 2024 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.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 57EC31B253F; Mon, 9 Sep 2024 08:42:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725871380; cv=none; b=uw6pR8iqulo80NAyGOvh/Q5KruIU4BGK9892gnQ8rMm+vicIsuXJPhXhm2rW962n35a9z7tJhBkJz8gHzKmyb/sLjowxkBY5Y8bJMTy7xAfBPvOHZYsfiNb3SIxsGwHrNTKpYquDtmvwlSp4fYhfjOiUUACTgqLgoanBtAobVhM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725871380; c=relaxed/simple; bh=mapt5MFKq+QW9FLF0HkigQF3cCnBrZGhZO0+2qfCsgM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SU8Zrms1yy5lBZpMYJ/fqHNFq+tP5317fDYT01Z9LnJ9Y04K2CHCOrH15QUdn5O5B9qjh/T0tfoC1x/fc4p5hHcn/78b/Zr7Y4N3sdm99G7E/cpFqWBk+pHAwSpCyMLSow6J8Rb/K/NsuWD2xv9mJLsZXoYYaLMY8wtlKYPbhOU= 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=euH1PtTd; arc=none smtp.client-ip=209.85.214.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="euH1PtTd" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2068acc8b98so36693415ad.3; Mon, 09 Sep 2024 01:42:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725871379; x=1726476179; 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=ime9++9V4dMSnALios3NYyCHO13/6swkeU9Ozoi9OGk=; b=euH1PtTdn+crm5xDlQUppCMwUBgTs7s3VjmYpcDFdD9QHJTDtHDjBRdVgq9oOK52Po 52aWwhwiz4mQGEi4yzK6GJLC2434XnusMAREITxny/AtV7UmSKx4p8flitaBOlexq19j nHERSlXTm5y2TwoBkJXNe8oS4/eC2jdIR6Db6W/RBKDd2rAA2884sV2Kj1mmPsJnibPb UPxWU2ELWEktyBMND5rl9JDcBjsmAA5O1Ty4GwSPnZvc816dfz/MZphUk+e05/du5e5o 82ZNZwiwMavFQL2VpKKPMDgRVS7iLfHSXnDDICPcFzHcvrEkla/Kl7PQWlm7McZMvz+V 66Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725871379; x=1726476179; 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=ime9++9V4dMSnALios3NYyCHO13/6swkeU9Ozoi9OGk=; b=Qj6CcrC7oDHFO4VRzj6TIocLG/JFHHAWuZmv2Z/fGUyR0ZdSnDNewu6aNYjdK86XUn 5Kx/iAUAHHGpdF1wTB25u9Ii/vpxlgxFumVmif4CHjpReS+wz2iRXtyPkO97h/HiABVm HcWf+aQ9aGnnba5iC693SVviJhBxLLl/w4HXKl/e1O3GA0HZd9nBBYnCpvba1eemHGTH V1S8haVWQAQBEe3HK+5ZUvSUanOj1DOlRulm6pNC2o41vdtHFvgtd+rzBHRwdAOaRtc7 wTXIARS+Qnt/kiNp1Wn/eTZdQeYGdIKWhsOI3sGktR6ZweF9JCGHMyL1n/aBPXryd7h/ 46Dw== X-Forwarded-Encrypted: i=1; AJvYcCUONB3ZaXTJoCk7z8zvuY96oJrfsSQOG5NllLX7Dp6VsjCVydL8BHLmxLepNIhVVrhO9EFwDJfiSH8Xb9lR0bt9O/Y=@vger.kernel.org, AJvYcCUyu7KfKuIYDEd0iUQjbcZUgVCLtxTabui+vNLpYfOCgWtUKmZn3YNWvFpAQcGK9LGU8qOuXmpTqTtS4Cc=@vger.kernel.org, AJvYcCWgZNUhNLiyV1Y121pk8vXbXoaPDDur0UgVTWEsNBIQeBzYHG8vwx3QGMA6YDSuldg+OLQ54Mu5KdyWqegx@vger.kernel.org X-Gm-Message-State: AOJu0YxAtNO+rhjC6HHwJCAZtJWuiJeHfKzKOm3KkK9VVQ8erYDGdxi/ kt3LbFG+X8/zjqNz7v8pS6Rh36mmGOzIGiyYZimPT/bCzAuXCcS2 X-Google-Smtp-Source: AGHT+IHf2rGkS0joRjpvnV/EQc6r/nFx+luAU70uoQR21TpftM5FoMHszKqU8pZjc+MZSnAAlsiOeA== X-Received: by 2002:a17:902:d491:b0:206:ca91:1df8 with SMTP id d9443c01a7336-2070c1c7184mr87144285ad.53.1725871378748; Mon, 09 Sep 2024 01:42:58 -0700 (PDT) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-20710f1d663sm29678675ad.188.2024.09.09.01.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 01:42:58 -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 v4 2/3] tty: serial: samsung: Fix A7-A11 serial earlycon SError Date: Mon, 9 Sep 2024 16:37:26 +0800 Message-ID: <20240909084222.3209-3-towinchenmi@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240909084222.3209-1-towinchenmi@gmail.com> References: <20240909084222.3209-1-towinchenmi@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Neal Gompa Tested-by: Janne Grunau --- 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_seria= l_drv_data =3D { .name =3D "Apple S5L UART", .type =3D TYPE_APPLE_S5L, .port_type =3D PORT_8250, - .iotype =3D UPIO_MEM, + .iotype =3D UPIO_MEM32, .fifosize =3D 16, .rx_fifomask =3D S3C2410_UFSTAT_RXMASK, .rx_fifoshift =3D 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 *de= vice, const char *opt) { + /* Apple A7-A11 requires MMIO32 register accesses. */ + device->port.iotype =3D UPIO_MEM32; + /* Close enough to S3C2410 for earlycon... */ device->port.private_data =3D &s3c2410_early_console_data; =20 --=20 2.46.0 From nobody Sat Nov 30 16:25:11 2024 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (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 1E4B21B1D60; Mon, 9 Sep 2024 08:43:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725871386; cv=none; b=uBDRnWABTjwyH3goVylJ8JHXQ9nyHXxK/HiLhzrQFWpPUnLTwWJ7MIxmVExMc9LeWn+nURs5jdOrQHmhsas52JCbdvEbftvN42SHQAiDy5rpLNd7w4bUEO+HYIURRAIv+JDFRJ+zXmNek+veaP9gSKJkwSBIzPv5/v5LFO0HHfU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725871386; c=relaxed/simple; bh=2rgcqQaxV+vaTYNa/iYGEHbrgXFhVyx5kvPK4hjbDKo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kSND+ga4xuNwloC9ucsGH5VQrnlT8sRg+IGzEGjjW3oAe0hZJ8dsll/HuOsIX3yzCbmNl1LQoB3+k4L5sYtWDqKsCJ6UThHF8XTLxJcYD4n1XZCkYQ5InH1agRqXKmlymoHBifAATzBgA0IRBFtwXm6l2rf+X04T+QijI/vXr8c= 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=ZrSOKfF1; arc=none smtp.client-ip=209.85.214.171 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="ZrSOKfF1" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-20551e2f1f8so39290385ad.2; Mon, 09 Sep 2024 01:43:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725871384; x=1726476184; 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=k9iZfGPEL6q9g6QlnTdnypN7TCKR5oC3QJw/pc0I/ZU=; b=ZrSOKfF1AYuVxBJMoOt9qJdA0IrmZyREggr8EFPqOlywA9KBXCe6MjGK7Ju0/Y4We+ axYMXug/Y3lnfirjRw61YRSef9prNe9Wjiaf6QsyYUJ/5H359/WGBe2lG4QDCyrC9T6x yxIjCAYsNzO5Vrp9smGHnpKN14QnLjOW57o4RYz44UVP+iRYfF9L0NRGyDoyUfha3hRM 8d+0Is5xEygHxpbo/EhkB1KjKdf6qT2K+HErCeSB0AOuvgPbZGxm7otGTu0+p9Cmq/Zr lQHudC51k0IFqGIL+qGi6W8AYAO2AH3IQ0W1zNEdg3NwxdpHDId9jN6lfd0MZl01Hg7v ui7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725871384; x=1726476184; 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=k9iZfGPEL6q9g6QlnTdnypN7TCKR5oC3QJw/pc0I/ZU=; b=TGqVdoVgs4xb4+dRbY3pFQ6ehp/WW6EVaQHsUmLai27MorqvG2CRzuQ3yN715AgxxD UbIsKkVB6SSA/eNsVoej6/Jp/Af7t2LenvQl5mWDX39Rzaq5Vuq28BNG705rTs+ofjNj jlv3pqBWrtyDMMqqfHweYkYE/1/cAyGKxD4EEuufImul8Q2DVq32gvjViXYyljjLb5C7 lNHoDzhZYJ1c8dYWJ1CDBd6EUYNL3Xm1kPHPNKsJaBS9H5uKPxaijXUTo/cNFLfeKgI6 pNLIkRMCaL5q3/OI124Ask2HqTAGr/XY3yhsFjusH9Q3uJSWJGrHEj1YJxI0nyOontCI Vj8Q== X-Forwarded-Encrypted: i=1; AJvYcCVhDctkDWjS1S8h/BoJFLwrFVVWgatGBJPr8mRV0x8so1HP0s3Do4cIeK9zit+1v6U6GsVAhS02PPAL4a0FOm27who=@vger.kernel.org, AJvYcCWm9449Terkv+iAxBcE3q07fM68umKton1i3+WpQr94XZgdD4QomtzISukVrFNvZArXJjqxAreGTvPm86w=@vger.kernel.org, AJvYcCWuXZ+m3C7rRseeH4ocSZlLmC3TTAgDQmQTs9yVyM4/qxWIR/JHXPv8Bv9sWb4cEghuWzfP8nzNqakBF9gN@vger.kernel.org X-Gm-Message-State: AOJu0YzcPOXqVzmvMp/Rm6N7ZmBEShG9VrR5D/M9IkoGNuIOufXgI7W8 vX7XFLULsUBTZUGpYZzh/70TWrKcArfg3smbJ2+lWrU60tUsAKQk6Zu+wPoD X-Google-Smtp-Source: AGHT+IETpMgE3nam9BevIeTnOC8EuIrch6KUJc3lEg8eO4UfI/iouxLpDDWq53gBkBWatisEH+7hxQ== X-Received: by 2002:a17:902:db09:b0:205:5136:b2fb with SMTP id d9443c01a7336-206f04e9433mr97297955ad.23.1725871384339; Mon, 09 Sep 2024 01:43:04 -0700 (PDT) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-20710f1d663sm29678675ad.188.2024.09.09.01.43.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 01:43:04 -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 v4 3/3] tty: serial: samsung: Fix serial rx on Apple A7-A9 Date: Mon, 9 Sep 2024 16:37:27 +0800 Message-ID: <20240909084222.3209-4-towinchenmi@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240909084222.3209-1-towinchenmi@gmail.com> References: <20240909084222.3209-1-towinchenmi@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Nick Chan Reviewed-by: Neal Gompa Tested-by: Janne Grunau --- 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 *po= rt) 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, vo= id *id) u32 pend =3D rd_regl(port, S3C2410_UTRSTAT); irqreturn_t ret =3D IRQ_NONE; =20 - 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 =3D s3c24xx_serial_rx_irq(ourport); } if (pend & APPLE_S5L_UTRSTAT_TXTHRESH) { @@ -1190,7 +1193,8 @@ static void apple_s5l_serial_shutdown(struct uart_por= t *port) ucon =3D rd_regl(port, S3C2410_UCON); ucon &=3D ~(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); =20 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); =20 return ret; } @@ -2143,13 +2148,15 @@ static int s3c24xx_serial_resume_noirq(struct devic= e *dev) =20 ucon &=3D ~(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); =20 if (ourport->tx_enabled) ucon |=3D APPLE_S5L_UCON_TXTHRESH_ENA_MSK; if (ourport->rx_enabled) ucon |=3D 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; =20 wr_regl(port, S3C2410_UCON, ucon); =20 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) =20 -#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) =20 #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) =20 +#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) =20 #ifndef __ASSEMBLY__ =20 --=20 2.46.0