Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp103105lqh; Thu, 30 May 2024 15:47:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX/bUw339FG0/CWaZjCaXM1Dp//gcRj+rQT0ilxQ+0WuMKtI5JZSWavpFu+c75nQzJgkYk5y0S4sEgmJUeSTjEbLdEV0iozbYkT7z+O+Q== X-Google-Smtp-Source: AGHT+IG34yWLealgMCNm/fhU1I8AMpyj34aKKNv1tLKzCPu3eS/IYapOi2M6kqshgejOJLJUuRS9 X-Received: by 2002:a05:6122:6111:b0:4da:ac09:94d3 with SMTP id 71dfb90a1353d-4eb02da1ad3mr110506e0c.6.1717109241690; Thu, 30 May 2024 15:47:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717109241; cv=pass; d=google.com; s=arc-20160816; b=y1gQ88zCGUfw1hDs4JHj9Sa+c2F6VJi+n9n6FRR1ESYsK2/7DfJ/ZGp55DQ/RqqEWS yx8nM4DpXPYE0wpgdt4ZHZSivil0+odp3JcS/0kyVqJ5+boo7GBEP16xT1BOQ6BAPVls x1YT/bTYzi4UZ5B/OJhhs9ZAgo82kZNVRh1bGvcJeJS2Ue/sJAvK+oZ1JZ5LuMSrZSo/ fr5DmPr3gh0E5bX+PUbNsRER0Dcq5S6EvPTK63BAsPsLVuCLdGnpV7wCEvp2m5w957zS WjTeVVDzSdmCTKiM/PH6UMrJk+qcO0/co9P3Yble9nzgJfBc8BWBemkc8rXHqhwX1U92 oXvA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=vGiOTL7ihlI5Yhs010iFkTmajDvoSp2W9SJUSNub5/M=; fh=0xjpkdATwgo/KofNZQGm8mff48hVRB+oRsUJoc4puE4=; b=I8mrMuB/O+IJtV6m1/E+ObKsX2+79nwjB+6famtT/yqMWsKz0fS9jk92z6G5QyzeA2 qH4fQ883qMawK5hZ/SJfjpflz7haHGTy+mFa9WnyAFxjbwtg3UNKXtu7glUVHD/rjEVp JMHJ6+i2kgf3MrGVOijrGQL3x6UAmBPJQDNIlgn8gD87tDKzqRJMwExgyEIeZrOcdfRE PCxAgqMydBiqyqoJjLLT878Uae3phHs8+LHi3AsDhWIRiQdbnnj6si0qIlstVAWjrSwb /1IhgS1eCHc/Ut12MF4DOFAnwE3v5PxsI2yrrqIytdycgBXdjoOFtgG1vu023T5cLX01 YDyw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=iFIMusMJ; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-195984-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195984-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43ff23ac2e7si7045711cf.13.2024.05.30.15.47.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 15:47:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195984-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=iFIMusMJ; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-195984-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195984-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 68D5A1C23E2B for ; Thu, 30 May 2024 22:47:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 25921180A80; Thu, 30 May 2024 22:46:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="iFIMusMJ" Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.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 DB4B01862B8 for ; Thu, 30 May 2024 22:46:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717109190; cv=none; b=NYTtq0tcBkx1Pyj9YCrjmzIjBIomuC/Hi4KyNootTyhPbInKc0AuhHJ3K6rqtfQWMpIZc/0VbYoAZRsIsQYWZ4N/4xg2eggXaLV36dooGPc0urZwb/YraaRNNObpNm0RB53OWhKMzI3hWPyc5s4I4O9jHwg5Z/T3myJd554kg4U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717109190; c=relaxed/simple; bh=cQNJ3XMzHwi5FaJGdzzeq5t/gSbidgfxwp2JxpD4I2Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GxC+iT6qVk1mCmb1O3TJ9TtuSaMQEartCZ17TJP08IHy3KzpnhvZfe4zy1z2Xpq7CMghDB9ZslluyXhTXQueOadZmdaKZpVIslbDc2QDgZ2KALIateUXKxeHWs60ZAWcmgSUdVgzRV9+oBIhn5mtKjQEaR7rIC9BmfcnBNfEH98= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=iFIMusMJ; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1f47f07aceaso3876175ad.0 for ; Thu, 30 May 2024 15:46:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1717109188; x=1717713988; 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=vGiOTL7ihlI5Yhs010iFkTmajDvoSp2W9SJUSNub5/M=; b=iFIMusMJDubVZ/kcABU8xhG0Ad/x5rACFtKQ+tQNrW/26dZpeEaREYmht8dyfH9lqB 0KNmgDAB37VbA3//YyU6RRbR65eLMbpg8JUhIiDNlCstF4u6OZzbQbgpZBEI1PBhFOFH EzDgx4PAFmxHB7W98te9SXmXLB3sgX2hz+aLk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717109188; x=1717713988; 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=vGiOTL7ihlI5Yhs010iFkTmajDvoSp2W9SJUSNub5/M=; b=YnulS+yfPRA7e8ilM7W3Q6PqWt1441G6Ls2w8oQqLvsiAAR+kMj+TM5fNIezqRuY2c f5pnyoZhNnM6ZcqzR+8BJrYEUHeGe9+E+12UspxlUcIs8lIknbUWTCWBeDLJwhECUly2 iX1fyIneRY6h3jcUmxU9BArlJ8dKR0AYXN4vepe5Q7SG1AR3qHKW1O8efbOZzAzBkqqP ELIzUfjCMHHrJ74qEtIDb6o8cooGHMAnwlR49vLFvtsiuD8x/izey2tFq4+EW+T1jJjE 1quLkMjfPw/WpjPtI6x0rWmryL7Y2h2ESRPTH6f9BL7HTzFJZilyRUadIWdj1CW0wPLv Y1Fg== X-Forwarded-Encrypted: i=1; AJvYcCW9JYULgyzw0raAv4xib6vVsNBO/th2AIgfwcBDiSod++mj2dA6f/BsRh+MXFwdJhK/+le7cXfzgldVbOMdL+KWWLi7qO5V3v1IAmkW X-Gm-Message-State: AOJu0YxD7sKo0HMNMwkj27ib5AgkQp1yL296uTOvpaVROkS4ytRptOjK GgzlAzMORugIPm0WwUM8tRjUOl/KykXuKfDXzJv2Fr99kM0TzSj+rDHVMW8yPg== X-Received: by 2002:a17:903:32c2:b0:1f3:b55:e247 with SMTP id d9443c01a7336-1f6370a783bmr1589435ad.55.1717109188230; Thu, 30 May 2024 15:46:28 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:564b:72b6:4827:cf6a]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f632410b20sm2955795ad.273.2024.05.30.15.46.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 15:46:27 -0700 (PDT) From: Douglas Anderson To: Greg Kroah-Hartman , Jiri Slaby Cc: linux-arm-msm@vger.kernel.org, John Ogness , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Tony Lindgren , Stephen Boyd , linux-serial@vger.kernel.org, Yicong Yang , Johan Hovold , linux-kernel@vger.kernel.org, Bjorn Andersson , Andy Shevchenko , Konrad Dybcio , Douglas Anderson , Thomas Gleixner , Vijaya Krishna Nivarthi Subject: [PATCH v2 4/7] serial: qcom-geni: Introduce qcom_geni_serial_poll_bitfield() Date: Thu, 30 May 2024 15:45:56 -0700 Message-ID: <20240530154553.v2.4.Ic6411eab8d9d37acc451705f583fb535cd6dadb2@changeid> X-Mailer: git-send-email 2.45.1.288.g0e0cd299f1-goog In-Reply-To: <20240530224603.730042-1-dianders@chromium.org> References: <20240530224603.730042-1-dianders@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit With a small modification the qcom_geni_serial_poll_bit() function could be used to poll more than just a single bit. Let's generalize it. We'll make the qcom_geni_serial_poll_bit() into just a wrapper of the general function. Signed-off-by: Douglas Anderson --- The new function isn't used yet (except by the wrapper) but will be used in a future change. Changes in v2: - New drivers/tty/serial/qcom_geni_serial.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 71258eefa654..539a6ac85511 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -265,8 +265,8 @@ static bool qcom_geni_serial_secondary_active(struct uart_port *uport) return readl(uport->membase + SE_GENI_STATUS) & S_GENI_CMD_ACTIVE; } -static bool qcom_geni_serial_poll_bit(struct uart_port *uport, - unsigned int offset, u32 field, bool set) +static bool qcom_geni_serial_poll_bitfield(struct uart_port *uport, + unsigned int offset, u32 field, u32 val) { u32 reg; struct qcom_geni_serial_port *port; @@ -321,7 +321,7 @@ static bool qcom_geni_serial_poll_bit(struct uart_port *uport, timeout_us = DIV_ROUND_UP(timeout_us, 10) * 10; while (timeout_us) { reg = readl(uport->membase + offset); - if ((bool)(reg & field) == set) + if ((reg & field) == val) return true; udelay(10); timeout_us -= 10; @@ -329,6 +329,12 @@ static bool qcom_geni_serial_poll_bit(struct uart_port *uport, return false; } +static bool qcom_geni_serial_poll_bit(struct uart_port *uport, + unsigned int offset, u32 field, bool set) +{ + return qcom_geni_serial_poll_bitfield(uport, offset, field, set ? field : 0); +} + static void qcom_geni_serial_setup_tx(struct uart_port *uport, u32 xmit_size) { u32 m_cmd; -- 2.45.1.288.g0e0cd299f1-goog