From patchwork Fri Sep 6 13:13:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 826040 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 132D71CBEBC; Fri, 6 Sep 2024 13:14:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725628499; cv=none; b=b1eup7Gkl+eJ+IcAvNVbIldWyLkphcp/RN9hARYsSlkaVOaaew+RotiAnHwaF8N+I983hfCbSF0BD9b/0FVBkhJCHMISAvOnIVCJZtpETr23GOiMGi1BKunAVhOUi9KNbZd9KfRzTRD3NePu7Tf0TKsmqdqb/3lzu52gT1U8Yug= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725628499; c=relaxed/simple; bh=uETuHjFu0CoXVLoeHxFZ1qxPWkCWtwZT2Bq3e+jgwPY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=H5FHOeLGDWYDeEbt/3UaUuacvdrcK+WTwXiu47ONSLeGGt1brXACcHNFE7d9MGkT/nKuleB96jB8W88hjCr++st/Aj2wq7ZXZjTRUMa+bUQG0MpF9u5Cci0dH+EmMfjp0qK8vMcxwyK59hPleNTlCr1plnXPjXF0CiyxZNyyIyg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iRUcpMXB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iRUcpMXB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 964CEC4CEC8; Fri, 6 Sep 2024 13:14:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725628498; bh=uETuHjFu0CoXVLoeHxFZ1qxPWkCWtwZT2Bq3e+jgwPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iRUcpMXBkDcFKCPXlsR5GkNyvCI+N3fqALSfXBIjJlfW2G098nyZXtKNkqD6d9VD0 VmH81reDQYG0DhsaybwOuRweMn4s05sq+pxSY2GTwLyHmZSdsYDcJ+4MeddGOjDM55 4SxHipI7VouaQnn5+oiSzkHb+YMlgUUVj1J8fZnRa5tp7PCjRkgHVn2lDvTTzHRO/X qjS98xS54X/aYH2eWbv898bNYDoTyw4MvFhs4BSB0sagTgfrG/Sr4UeTDjpVptI1jb kW2HmTelG4aW5BPod9WgYrxtWF+v7EMHa6HUKU9qVsEDqVZ0ZAOewdsrqN9wGAZlF4 V8cPqtTC4xdTQ== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1smYo3-000000006Ak-20vh; Fri, 06 Sep 2024 15:15:19 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: Jiri Slaby , Bjorn Andersson , Konrad Dybcio , Douglas Anderson , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= , linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio , Johan Hovold Subject: [PATCH v2 5/8] serial: qcom-geni: introduce qcom_geni_serial_poll_bitfield() Date: Fri, 6 Sep 2024 15:13:33 +0200 Message-ID: <20240906131336.23625-6-johan+linaro@kernel.org> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240906131336.23625-1-johan+linaro@kernel.org> References: <20240906131336.23625-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Douglas Anderson 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 Reviewed-by: Konrad Dybcio Link: https://lore.kernel.org/r/20240610152420.v4.5.Ic6411eab8d9d37acc451705f583fb535cd6dadb2@changeid Tested-by: NĂ­colas F. R. A. Prado Signed-off-by: Johan Hovold --- 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 54052c68555d..7bbd70c30620 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; @@ -286,7 +286,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; @@ -294,6 +294,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;