From patchwork Tue Sep 10 09:20:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "neil.armstrong@linaro.org" X-Patchwork-Id: 1983063 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=PGuTLLFy; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X2yqB4zh7z1y1C for ; Tue, 10 Sep 2024 19:20:38 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C907A88F72; Tue, 10 Sep 2024 11:20:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="PGuTLLFy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 10F4488F72; Tue, 10 Sep 2024 11:20:35 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0585788F70 for ; Tue, 10 Sep 2024 11:20:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=neil.armstrong@linaro.org Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-53660856a21so2922132e87.2 for ; Tue, 10 Sep 2024 02:20:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725960030; x=1726564830; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=biSm18yZGgi2o3fcqtSUq93PVwUF/FUAc7uacCwORCk=; b=PGuTLLFyxlMyGFHG1z9ImcRDExl/i6HUO671RFe1SBxeS7aIlGEu1WGP+WKjI8KiEM vSSaLJVzKIxVROuOllAZ5OqylVOuv1roX6ga6jXy9mLWJB3d9nAXaWrKGcxyJuLBMOLL qQWH8oIyUg8Nbo4zmIYiAoSbcE6pkE99dZnasFJ8ojvaWoIr8E+0J6DzrWLtBJ90LHWQ 93EhG7MiJ9B76NhWh6Xbc4s4wMhwd8BacKyNJDo0b4+IkJW9qVqB2Qm7WlOxq9hCPrjh P9/ELLtz2wzL6zAv3DPyNR+YO5Am3fkHf8OOrIwB+7QKmBvfIIVXUICcp/2kOmhIVhmH DCXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725960030; x=1726564830; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=biSm18yZGgi2o3fcqtSUq93PVwUF/FUAc7uacCwORCk=; b=b2c5wbeRoH0BcjoWHJVqnfZj6LYwwTgftSXn704XPMRQcUEZfCMIbDNPnrX8MhDgd2 0iDxVS5veEC/zBKtj5Y2po9CwZX//QqsIfLDcrfoWq+ngiX+lqu/cWdySuqPy4DT+JCS ajfhtqWXyZb2nuWr4MLtmeY67EDW9x48u5iUmeisxc3TulJdY9quCqum12p9N1p/5TyZ Z4XV+EIuZakzK67mo386O6eiqM3sYWyFMUJHWYCNRFM7j0GLhDkVF8yFO9lSbi8sQy30 uxdXQKRwAx3xaGiqtKv1LHxIV+ipnlt0YciPMDMgWK0udjGWOxGtgBYyEYtIcFF8TfRR YreQ== X-Gm-Message-State: AOJu0YwSQuicBDBYourxHsvnDYaFx+CvhfZhThekc+xmd8Zd4Rq0ZQWx AqjeIw86yVlAQP5r4WqoNv5KolauaMwOKfkj2mzOQSRRFX1BixazIQZKMf4BSDE= X-Google-Smtp-Source: AGHT+IHt8nZo3fW+FagtW2kQt24+TTlzXWp3fuoA2TS4CEZ/ZMy2XiBJ7JR26o/vdZSvl7e5I7NYTw== X-Received: by 2002:a05:6512:31c5:b0:52c:e07d:229c with SMTP id 2adb3069b0e04-536587b06e0mr10422885e87.22.1725960029075; Tue, 10 Sep 2024 02:20:29 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb099acf6sm101256245e9.9.2024.09.10.02.20.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 02:20:28 -0700 (PDT) From: Neil Armstrong Date: Tue, 10 Sep 2024 11:20:18 +0200 Subject: [PATCH 01/13] ufs: allocate descriptors with size aligned with DMA_MINALIGN MIME-Version: 1.0 Message-Id: <20240910-topic-ufs-enhancements-v1-1-3ee0bffacc64@linaro.org> References: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> In-Reply-To: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> To: Tom Rini , Bhupesh Sharma , Neha Malcom Francis Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io, Neil Armstrong X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1349; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=ZHS2jy/EiG6hVskbTeagCeI2IfA8YWfz33iJ6L6mEhs=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBm4A9W+13nYUZOgKbKnDZBdG3CNOrFO2d/WPHOz900 UrTEM5KJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZuAPVgAKCRB33NvayMhJ0cleEA CuGrlxaP+IMpUuTe3DFqooewrSRYv0JzdvigwWr1h0mmdZI9K2kZns2vCxa/ig8ZCvb+kpF9h7CpdR 6dlwWKi5uWK27KvAGWof7VU96gEDHOKlv/AD4wEYG9kOwsSn/rT8H+QnB3ODqT1suHUlqzykK0NPQr eHbI56TAB1ms8vguBraQWhDD2J8X6dYb2DIuPapWCSzC5555qtsjBItHgeM1FwbivpcGEFvvR09QhN /xqI+1mzUaczSxDvQUx3z1LCst8POhlRo5asdDuOWPepIw+kRnIm3e1Qx6IA7phdshTDBjfWVadmwr i0dXwngfzuD78Cn+WVrC5iyAEwo5sL9AHfq5xfuFhNeQzUY3Uv9eAZ0l4ICC6yRJhdQXC0y22nv9ZM BUBJyTMjGdXIkgK3lQS61plEFibVvPM+TSBVO57o8ZAsixl+zeoI8Njb6CtUuFv+YJzKdFNo6f8k0L HqRe/ynwA8SuM1BMykqFxTYbyzxLpALPkVk2hQvPbjNpQAezVfJR7SdPlkNkbDcTHyTfdHV9ioKuH8 6s+troki6LqagvUazf2FFlPYNRr/qnb3hlYkmZfxfvEkqkL4ta2qmw3disosghIF1anS5kiGz/eA74 QcpelNn3b9trouqWPYOTfOX3hD0LQoW4P6lps2HC+J5k7/ZBW5mhSkEmJBMA== X-Developer-Key: i=neil.armstrong@linaro.org; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Align the allocation size with DMA_MINALIGN to make sure we do not flush/invalidate data from following allocations. Signed-off-by: Neil Armstrong Reviewed-by: Neha Malcom Francis --- drivers/ufs/ufs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c index be64bf971f1..e005cc90608 100644 --- a/drivers/ufs/ufs.c +++ b/drivers/ufs/ufs.c @@ -633,7 +633,9 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba) /* Allocate one Transfer Request Descriptor * Should be aligned to 1k boundary. */ - hba->utrdl = memalign(1024, sizeof(struct utp_transfer_req_desc)); + hba->utrdl = memalign(1024, + ALIGN(sizeof(struct utp_transfer_req_desc), + ARCH_DMA_MINALIGN)); if (!hba->utrdl) { dev_err(hba->dev, "Transfer Descriptor memory allocation failed\n"); return -ENOMEM; @@ -642,7 +644,9 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba) /* Allocate one Command Descriptor * Should be aligned to 1k boundary. */ - hba->ucdl = memalign(1024, sizeof(struct utp_transfer_cmd_desc)); + hba->ucdl = memalign(1024, + ALIGN(sizeof(struct utp_transfer_cmd_desc), + ARCH_DMA_MINALIGN)); if (!hba->ucdl) { dev_err(hba->dev, "Command descriptor memory allocation failed\n"); return -ENOMEM; From patchwork Tue Sep 10 09:20:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "neil.armstrong@linaro.org" X-Patchwork-Id: 1983064 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=Gats2Xex; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X2yqN1vmZz1y1C for ; Tue, 10 Sep 2024 19:20:48 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3D25888F74; Tue, 10 Sep 2024 11:20:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Gats2Xex"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A3C2F88F89; Tue, 10 Sep 2024 11:20:37 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B8CB888F70 for ; Tue, 10 Sep 2024 11:20:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=neil.armstrong@linaro.org Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-374b25263a3so3156242f8f.0 for ; Tue, 10 Sep 2024 02:20:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725960030; x=1726564830; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=XbxLFe5fzwN6Jt4d+R2OdF/xYcYZgzxGRtyCuZrKV3I=; b=Gats2XexNC3fBdUJu/TtfiG+J44YlP2+lT/CM2FMzv8Vm7ba22r/SDKJjO/9XkvhLR HM2V5E9TGy2DCs6Q4h6rvAceYXceVsUo0lEItDbQtFPEi8TEYrxOXkZgkosES98SEm+T qCY2I1I+WugwPv/IK7/5VLikv/JliJ/ReWabk5NONiNLKe6D7pP5RcwGWypVz6zVnDXm FPEQIizxmQ6zL1wdL6dEKvGYh0oe41ZRRfYUTI2kcwUev29lXvwQCjqPkbEIaCMRlCs+ F9PACaU89KwQ9axzr1TadjZ5J8bbaEjj5+Rn9J23V1d9S7FaXYfvXjcootTLHFQC80ON 3pVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725960030; x=1726564830; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XbxLFe5fzwN6Jt4d+R2OdF/xYcYZgzxGRtyCuZrKV3I=; b=lXix2IXHkkjVp+nZaui9f3sByCk9bkVYOspw0UedYAOLdmml+Z81u3m5ByFP6NSpUV wWHQ33gUAwc8uxVVpo8P7XKfAaQuQEfdUUnUZrvt1rc8WcOuOBNiSwR6SDVN6ChMOBRu 6PtAywbmXdFC3Hp0SxAfk5IoUefoOE6xRKPwJs8w/adHYfVY6IrLyPhJS7FQxuAbhe4j bzOkgOSJQtu+7k00vh1tiCAbcsIB7n7YalRzwm24B1H4uhz9VXMtccV4uWpTrpPpP+Br L7Uspl7eduvtZQaf9Q8QBxbfG7oya+e2DucMHU/z71q+xIPZ/lmdxMXDSOd7sV2NF/Ll lwMg== X-Gm-Message-State: AOJu0YxBX+sn5ZdZdvj43qP6jmgwl9V7u+dDEbHyIg8TS3ZurW/W4G/m RDZYKJCYB0T5ZzdUbQHUqdpDelTN2kGhh0zp8G+GPAQ6EDaJuTUWB9ej9brOaFY= X-Google-Smtp-Source: AGHT+IH5B5+Dxqh3hkECazqj9AifFfyarsX5uZZuEdiwP3JwTkvrb90jsR75mTZiGoF7xoiOCHZiNg== X-Received: by 2002:a5d:5e0e:0:b0:374:af04:d6a3 with SMTP id ffacd0b85a97d-3789913417fmr5827602f8f.57.1725960029823; Tue, 10 Sep 2024 02:20:29 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb099acf6sm101256245e9.9.2024.09.10.02.20.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 02:20:29 -0700 (PDT) From: Neil Armstrong Date: Tue, 10 Sep 2024 11:20:19 +0200 Subject: [PATCH 02/13] ufs: fix dcache flush and invalidate range calculation MIME-Version: 1.0 Message-Id: <20240910-topic-ufs-enhancements-v1-2-3ee0bffacc64@linaro.org> References: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> In-Reply-To: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> To: Tom Rini , Bhupesh Sharma , Neha Malcom Francis Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io, Neil Armstrong X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1874; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=oVsz8gmXWVEZJZf1Mg+oM6GpP73pR3b7jLP7OPiK+Sw=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBm4A9WNWc17o2C698+AIILxdeWPed6pOpY1TgDkvuA gHbQilKJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZuAPVgAKCRB33NvayMhJ0WieEA CHNb2WSHPIYL9cqYeBBoFm+aJSg/lqQVjg+g/b6gO+yWVC6h76+N4DjGB2TbyYgfzwA7fXzQfGTA6/ 4BACxlFu2yPWh5gOU6htvsABQE39OioBIlM7vnNLFLvprBCPfOzb2SAMQ5a5sHY4xhOuQUqZjw+AJE dDxJ2BfL1iHWpwriLA1UTqWcGahY43dUTfuY5uzC7zGl9LppqpOjxohqWwHkmfa2ZpnrwC4pNIcBVT ptrBk/yoHm9krleb814GOmzDxp4JRRfdQzxAa2tnXI7kAGSem8JuVVTy+EzCkl7iOkYJonNaMZUR2p /+ebnr3Iw4rEs0qcYEC+L+oqUSGX66oYZJnfbEU8TgxbGsj0YFFK9XRaNBpZzIaXxwyM5x5a4fiKpx b4yh/8GizQaLfoWVYUppYrPyv0ktUE5C7hFBDGH8REOxiQR4h7ptpHhcPBIugDGpxybnVOrZgMmOE1 0CsLJeijS5/OyO7GkHORSqKhBU1ZV4DaTgn8rvuRHttm5rouNdto7gWuJkwxlQWlUQVGs9X7B8jZWx tes3L7BHyJ3DhUhCKLBl+D2FhMChCiSzaCXu+ttP85PnAkClMSwZ02Iqo4NF8gwl4D2VKhiE4wLmzP 1rgCfvzyJOz/vzIhSrzIKPPtOpqfwoI4Xb0UwNxHAJ0legM3LB2Zt1NG/4SQ== X-Developer-Key: i=neil.armstrong@linaro.org; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The current calculation will omit doing a flush/invalidate on the last cacheline if the base address is not aligned with DMA_MINALIGN. This causes commands failures and write corruptions on Qualcomm platforms. Signed-off-by: Neil Armstrong Reviewed-by: Neha Malcom Francis --- drivers/ufs/ufs.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c index e005cc90608..3d9a7d7ee12 100644 --- a/drivers/ufs/ufs.c +++ b/drivers/ufs/ufs.c @@ -703,11 +703,11 @@ static inline u8 ufshcd_get_upmcrs(struct ufs_hba *hba) */ static void ufshcd_cache_flush_and_invalidate(void *addr, unsigned long size) { - uintptr_t aaddr = (uintptr_t)addr & ~(ARCH_DMA_MINALIGN - 1); - unsigned long asize = ALIGN(size, ARCH_DMA_MINALIGN); + uintptr_t start_addr = (uintptr_t)addr & ~(ARCH_DMA_MINALIGN - 1); + uintptr_t end_addr = ALIGN((uintptr_t)addr + size, ARCH_DMA_MINALIGN); - flush_dcache_range(aaddr, aaddr + asize); - invalidate_dcache_range(aaddr, aaddr + asize); + flush_dcache_range(start_addr, end_addr); + invalidate_dcache_range(start_addr, end_addr); } /** @@ -1466,13 +1466,13 @@ static void prepare_prdt_table(struct ufs_hba *hba, struct scsi_cmd *pccb) } if (pccb->dma_dir == DMA_TO_DEVICE) { /* Write to device */ - flush_dcache_range(aaddr, aaddr + - ALIGN(datalen, ARCH_DMA_MINALIGN)); + flush_dcache_range(aaddr, + ALIGN((uintptr_t)pccb->pdata + datalen, ARCH_DMA_MINALIGN)); } /* In any case, invalidate cache to avoid stale data in it. */ - invalidate_dcache_range(aaddr, aaddr + - ALIGN(datalen, ARCH_DMA_MINALIGN)); + invalidate_dcache_range(aaddr, + ALIGN((uintptr_t)pccb->pdata + datalen, ARCH_DMA_MINALIGN)); table_length = DIV_ROUND_UP(pccb->datalen, MAX_PRDT_ENTRY); buf = pccb->pdata; From patchwork Tue Sep 10 09:20:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "neil.armstrong@linaro.org" X-Patchwork-Id: 1983065 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=ittsiPOG; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X2yqZ2rPJz1y1C for ; Tue, 10 Sep 2024 19:20:58 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9125088F83; Tue, 10 Sep 2024 11:20:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ittsiPOG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C27D388F70; Tue, 10 Sep 2024 11:20:37 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C139388F71 for ; Tue, 10 Sep 2024 11:20:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=neil.armstrong@linaro.org Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-42cb5b3c57eso20719605e9.2 for ; Tue, 10 Sep 2024 02:20:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725960031; x=1726564831; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=LEhQDQDoxZL1RsT+VpAi2rzEIb8vUqNrn2fMKbW+JY8=; b=ittsiPOGuNluDrZwNxp3uhmZKGImC9kRDYKl/ogBTpmG9YFVQCA6XTOZrlx4gU6cns dBEi6Y+C24beSWLK61HIz6ftkQ/BVTCks/WKAf9Bjrid/wnz4rAOCADgxBG3g7QOx39o RFawZOpVFxIiBRyR5eu5POef2wawURhbIr12g7IcUH39zAe6pXu/7yAbwIKcODm0S5Kj sxub5BQpD6GXIGFHxDbx6BMH7QOvQa0uKkxZ625cBA5ZAsXl8Vn7gCyT0TnpVTGLdeye 7e7xQbsmkznxHwQY4CP/wnCaoItqjykbDYfbZlZ9bsBNNrPVpUmqVCHZSViCpbaKLadh AdTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725960031; x=1726564831; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LEhQDQDoxZL1RsT+VpAi2rzEIb8vUqNrn2fMKbW+JY8=; b=upq2U4Hh6ps0rZTHxL49ElcB34fELQV04bPBRhWfjn2urUuB/QIfHINzGfHP0FUW3b wATvLSgPlmZMrp4KJBfSHqVMYMQ2sXqQfzXrTj75e2BH0IAHDx1lMsUkj6ZjTkCcYY2m Wds+GPYC+Z33PMMW+RahsistO7HKMgo8eV6EcWAWnalumKMRtidsUhMZpzE63CzddQt9 zWsIX1zI/duEbwL5P8fZrg+8DAG13r3jCKnNVLvUrngmXnz2e7YyaS/mxJTAA2ho5TkJ zq68Djqd12IKyirHVCbwJDqLdpcESZ+Jo15mfU0CMVez4tnCKeOzNLETVKWSE5Z7KNu0 FUMQ== X-Gm-Message-State: AOJu0YwIKrCytVys/pMPfIkKQChNCDjYHmCG5WZP7zt+NeAe5Ok2WApa TIkWytWl1EBzw6yghFR+XYXNZt9rpvGsTijg5zqs/RrtPGpcY3m1esHVI/QKdRc= X-Google-Smtp-Source: AGHT+IEps2jcKfK6N1pDArNL/Sdw2ORa5sj49cv468mgC4cjJ73Ks/vE0PHuX0PkjLSveFpmmasTHg== X-Received: by 2002:a05:600c:1987:b0:42c:bc60:5332 with SMTP id 5b1f17b1804b1-42cbc60562emr24027485e9.19.1725960030627; Tue, 10 Sep 2024 02:20:30 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb099acf6sm101256245e9.9.2024.09.10.02.20.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 02:20:30 -0700 (PDT) From: Neil Armstrong Date: Tue, 10 Sep 2024 11:20:20 +0200 Subject: [PATCH 03/13] ufs: split flush and invalidate to only invalidate when required MIME-Version: 1.0 Message-Id: <20240910-topic-ufs-enhancements-v1-3-3ee0bffacc64@linaro.org> References: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> In-Reply-To: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> To: Tom Rini , Bhupesh Sharma , Neha Malcom Francis Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io, Neil Armstrong X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=5586; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=BYnT23fIi9xx0noxSPJMps/PiHvLoWV0OfglFfZoTSk=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBm4A9WKvnneZzhpV5aQJKs/4Ve4vyxl/Oxtqc2ILkE l998h5CJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZuAPVgAKCRB33NvayMhJ0dXzD/ 4zVVC8yC68xaZyKNcHR6CQR/h/fRMZgmqQNO5LAlKiytOsMGnvR4UFKiOZQmdDJE62xezJ/1PqWmp7 VflBUubro5XHsHEQhvhJ/jE7luAqQAIdDL3/ix3kMrsGQvoa2ms56QXAflCnHNU0vhT8TrSfKrGRGV 8Mv/Cz24OWFlayhXCt1BgLN9oqCqzHE/cWhi6zZaopdDb429jKpgOoxMWQMVdbP1VE7UTQpU0rGHGT SZttk4MKydlNRvdGc/2rC3ub36YduUXPwzx8Y9WmVCPEjDkaIkhG2IJYuOPRRAJ/8qGEIKuVd1Tf2K hkJya2783kZvoDmRqaCAqQ2GeieaPXx72gD3t/zzYTqPZhZboZGuCQlgfhhvHfG0dnFUdgx4uIKFNF t67ttUY2w2FUw+vYytqbRrUJVHMoiGDW8WRruuSPgcz/qK4SZBsQQABAi5ESmwBxX1X18XuQqugXYp hNzwManWmHM64DEP0So9jWd1BLRb2of3pq4P8RLM5zOs4ZiAU6cykRRrQrMEHKGpT/S5V70YqKxMXu HxD6gYK1Ue2sDXyj02Cgu7vnFHr+BFn3SS567i3ZfSv2Klu46nXUXIvN6drS0zSKf38fpEJnu0U10Q aMvT3ZTeRy83NQsmiL33azdhoQVStVQFk9ExDqiNlwpq/tf2srmd+LGu/yFw== X-Developer-Key: i=neil.armstrong@linaro.org; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean There is no need to flush and invalidate all data updated by the driver, mainly because on ARM platforms flush also invalidates the cachelines. Split the function in two and add the appropriate cacheline invalidates after the UFS DMA operation finishes to make sure we read from memory. Flushing then invalidating cacheline unaligned data causes data corruption issues on Qualcomm platforms, and is largely unnecessary anyway, so let's cleanup the cache operations. Signed-off-by: Neil Armstrong Reviewed-by: Neha Malcom Francis --- drivers/ufs/ufs.c | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c index 3d9a7d7ee12..5845fd694d3 100644 --- a/drivers/ufs/ufs.c +++ b/drivers/ufs/ufs.c @@ -696,17 +696,28 @@ static inline u8 ufshcd_get_upmcrs(struct ufs_hba *hba) } /** - * ufshcd_cache_flush_and_invalidate - Flush and invalidate cache + * ufshcd_cache_flush - Flush cache * - * Flush and invalidate cache in aligned address..address+size range. - * The invalidation is in place to avoid stale data in cache. + * Flush cache in aligned address..address+size range. */ -static void ufshcd_cache_flush_and_invalidate(void *addr, unsigned long size) +static void ufshcd_cache_flush(void *addr, unsigned long size) { uintptr_t start_addr = (uintptr_t)addr & ~(ARCH_DMA_MINALIGN - 1); uintptr_t end_addr = ALIGN((uintptr_t)addr + size, ARCH_DMA_MINALIGN); flush_dcache_range(start_addr, end_addr); +} + +/** + * ufshcd_cache_invalidate - Invalidate cache + * + * Invalidate cache in aligned address..address+size range. + */ +static void ufshcd_cache_invalidate(void *addr, unsigned long size) +{ + uintptr_t start_addr = (uintptr_t)addr & ~(ARCH_DMA_MINALIGN - 1); + uintptr_t end_addr = ALIGN((uintptr_t)addr + size, ARCH_DMA_MINALIGN); + invalidate_dcache_range(start_addr, end_addr); } @@ -754,7 +765,7 @@ static void ufshcd_prepare_req_desc_hdr(struct ufs_hba *hba, req_desc->prd_table_length = 0; - ufshcd_cache_flush_and_invalidate(req_desc, sizeof(*req_desc)); + ufshcd_cache_flush(req_desc, sizeof(*req_desc)); } static void ufshcd_prepare_utp_query_req_upiu(struct ufs_hba *hba, @@ -785,13 +796,13 @@ static void ufshcd_prepare_utp_query_req_upiu(struct ufs_hba *hba, /* Copy the Descriptor */ if (query->request.upiu_req.opcode == UPIU_QUERY_OPCODE_WRITE_DESC) { memcpy(ucd_req_ptr + 1, query->descriptor, len); - ufshcd_cache_flush_and_invalidate(ucd_req_ptr, 2 * sizeof(*ucd_req_ptr)); + ufshcd_cache_flush(ucd_req_ptr, 2 * sizeof(*ucd_req_ptr)); } else { - ufshcd_cache_flush_and_invalidate(ucd_req_ptr, sizeof(*ucd_req_ptr)); + ufshcd_cache_flush(ucd_req_ptr, sizeof(*ucd_req_ptr)); } memset(hba->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp)); - ufshcd_cache_flush_and_invalidate(hba->ucd_rsp_ptr, sizeof(*hba->ucd_rsp_ptr)); + ufshcd_cache_flush(hba->ucd_rsp_ptr, sizeof(*hba->ucd_rsp_ptr)); } static inline void ufshcd_prepare_utp_nop_upiu(struct ufs_hba *hba) @@ -809,8 +820,8 @@ static inline void ufshcd_prepare_utp_nop_upiu(struct ufs_hba *hba) memset(hba->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp)); - ufshcd_cache_flush_and_invalidate(ucd_req_ptr, sizeof(*ucd_req_ptr)); - ufshcd_cache_flush_and_invalidate(hba->ucd_rsp_ptr, sizeof(*hba->ucd_rsp_ptr)); + ufshcd_cache_flush(ucd_req_ptr, sizeof(*ucd_req_ptr)); + ufshcd_cache_flush(hba->ucd_rsp_ptr, sizeof(*hba->ucd_rsp_ptr)); } /** @@ -877,6 +888,8 @@ static int ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag) */ static inline int ufshcd_get_req_rsp(struct utp_upiu_rsp *ucd_rsp_ptr) { + ufshcd_cache_invalidate(ucd_rsp_ptr, sizeof(*ucd_rsp_ptr)); + return be32_to_cpu(ucd_rsp_ptr->header.dword_0) >> 24; } @@ -888,6 +901,8 @@ static inline int ufshcd_get_tr_ocs(struct ufs_hba *hba) { struct utp_transfer_req_desc *req_desc = hba->utrdl; + ufshcd_cache_invalidate(req_desc, sizeof(*req_desc)); + return le32_to_cpu(req_desc->header.dword_2) & MASK_OCS; } @@ -1437,8 +1452,8 @@ void ufshcd_prepare_utp_scsi_cmd_upiu(struct ufs_hba *hba, memcpy(ucd_req_ptr->sc.cdb, pccb->cmd, cdb_len); memset(hba->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp)); - ufshcd_cache_flush_and_invalidate(ucd_req_ptr, sizeof(*ucd_req_ptr)); - ufshcd_cache_flush_and_invalidate(hba->ucd_rsp_ptr, sizeof(*hba->ucd_rsp_ptr)); + ufshcd_cache_flush(ucd_req_ptr, sizeof(*ucd_req_ptr)); + ufshcd_cache_flush(hba->ucd_rsp_ptr, sizeof(*hba->ucd_rsp_ptr)); } static inline void prepare_prdt_desc(struct ufshcd_sg_entry *entry, @@ -1461,7 +1476,7 @@ static void prepare_prdt_table(struct ufs_hba *hba, struct scsi_cmd *pccb) if (!datalen) { req_desc->prd_table_length = 0; - ufshcd_cache_flush_and_invalidate(req_desc, sizeof(*req_desc)); + ufshcd_cache_flush(req_desc, sizeof(*req_desc)); return; } @@ -1487,8 +1502,8 @@ static void prepare_prdt_table(struct ufs_hba *hba, struct scsi_cmd *pccb) prepare_prdt_desc(&prd_table[table_length - i - 1], buf, datalen - 1); req_desc->prd_table_length = table_length; - ufshcd_cache_flush_and_invalidate(prd_table, sizeof(*prd_table) * table_length); - ufshcd_cache_flush_and_invalidate(req_desc, sizeof(*req_desc)); + ufshcd_cache_flush(prd_table, sizeof(*prd_table) * table_length); + ufshcd_cache_flush(req_desc, sizeof(*req_desc)); } static int ufs_scsi_exec(struct udevice *scsi_dev, struct scsi_cmd *pccb) From patchwork Tue Sep 10 09:20:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "neil.armstrong@linaro.org" X-Patchwork-Id: 1983066 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=z1aFuhwi; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X2yqm6P4dz1y1C for ; Tue, 10 Sep 2024 19:21:08 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EB43A88F90; Tue, 10 Sep 2024 11:20:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="z1aFuhwi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8738B88F8C; Tue, 10 Sep 2024 11:20:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D47DF88F75 for ; Tue, 10 Sep 2024 11:20:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=neil.armstrong@linaro.org Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-42cafda818aso27663305e9.2 for ; Tue, 10 Sep 2024 02:20:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725960031; x=1726564831; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=oqKlusR5GPCCrTUypghPMVt4yqn9KaI81pA8qZgjw04=; b=z1aFuhwiiaX4GJxZdcaXmA6X78ZsjAfBcMkDtReeSIHjULpf3YJWsXBHaGOODdMeE/ FMXE1gtjqdkLHYp0rOD3Ue6o9rIOLieRJhk2UIR4WOC66OS6pzvd21qXXvJ74ldFjMK6 E7RTooowCKHR767WtWTA77CA5hyGuxP8HGz7q8y4XaDs/K74VlFYTuv+0xKq45imJ3c6 NPpSw2gXl3+Mmyqf6125YAEcaCydaOJWnBK9XAjLM45Gth3DEBE5ANjCzSCXWOVN68N9 LtcGZe8RQgbIpu+eP5R0xJ9ID+m3nZFqaEE6xVxtJI0yaEPKwTvPLj4Q0/EjPtS1pfME 7PQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725960031; x=1726564831; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oqKlusR5GPCCrTUypghPMVt4yqn9KaI81pA8qZgjw04=; b=r/SbP4ERSLt/HPhXaMzK77bQ7tH86g0zkUD4XPX3a3j5L+cIIKQWiom7FiHc7UiG+2 lDuQtxKWNz+oEqTSnPI9b586p8BTz3UT2lL3f7RM9XodrKlE+umMzev+3/xnGPnmP2Yv 7nF+l3uU9YNrI9r9Bvye68BBdIl2JbBowc0vPPsxcx+xyJ+9kDg/HA4r8K8injDSEHYI QJ9OMFrBFbMBYbYu5uIxidScgB0pW+9Ad4gKrw9GniQGX0LKi19R/MyyzNEVdQ2AOhRm +fGVLAL4RqDnC4X+edb7Ni4moaFj407NkB8tgaUEpLbUjs3XELhiSyb86slZO5DaoxXP Bkqw== X-Gm-Message-State: AOJu0Yz2H8C+W2e3kO19nx2Rk9l5ku2SgqljEm0UUTUs17P84KrUTMbh bR/6Fm8K/kD8cgN0fAlawajUbzBbMr4c5sQef1myzLRM5+bhwtnca4ytREcxW0g= X-Google-Smtp-Source: AGHT+IGkP3brE6LmgzXUzVqPn90sIp5cTBMC1thJWAAyCgz1npY9kMN1OvBbiwiGF0dKkkvoaAseLg== X-Received: by 2002:a7b:c345:0:b0:42c:b6e4:e3aa with SMTP id 5b1f17b1804b1-42cb6e4e445mr51403875e9.5.1725960031359; Tue, 10 Sep 2024 02:20:31 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb099acf6sm101256245e9.9.2024.09.10.02.20.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 02:20:31 -0700 (PDT) From: Neil Armstrong Date: Tue, 10 Sep 2024 11:20:21 +0200 Subject: [PATCH 04/13] ufs: use dcache helpers for scsi_cmd data and only invalidate if necessary MIME-Version: 1.0 Message-Id: <20240910-topic-ufs-enhancements-v1-4-3ee0bffacc64@linaro.org> References: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> In-Reply-To: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> To: Tom Rini , Bhupesh Sharma , Neha Malcom Francis Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io, Neil Armstrong X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1884; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=lxI4HS7I1NPzQe4WEGjAEWu+wJ/tDWmbIzQmUpETYAY=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBm4A9XKZOOFnS0AMMQKlbGWz/p83lvY6NFAV9oBlUm sbFm7juJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZuAPVwAKCRB33NvayMhJ0R9VEA CMpaNJQFU69INFouPBXUVEgJr3sjbVCzjeo3yZelU+m6KHNDt5qOcscvyRvOj8fNpRfDfPSkCcGtT6 FUa9PR36vf83JX1jAvW/IQvdEzuaiK0lPelOJr0gqw79cNslPTI67LFAHIvFS80GDHBE0H79p3la9g IJmX1+tQK7uvHtUDa5QCHi3VuRZXqC14yOkSqo6MlRRDTfLRhmAWh24ikWGIilwz2+5fa8S2HYrD4J 9hw4vqhGCLRYIgts6lv2PL29RhYBv8rRdTIXAbnFpz6QApY8q6o+/aihQk0531zu8lBs+uR/OqGYR+ 1C46MWCOMB8hRv90bHvNVHxTZbWMjcV2OJVh7crOeCjw5ulxWVwJNkh4DE8WOcYFnBKufJihbPsADT 9MliClw3+rXW0G0uaklFtGyDqc4fFNCTrMCWy3Mtg4ikAZ08sSlKe/GM2hx6SRQF1oUI5QwhXYyyLm MAm4OYLJZPjfNUsb/oP+88Kuhjg9rnPauJlq/k6Bvg0qyCCdpqMWsmHt5HVI/SLDrIl7dxlu2OvsUY +ls15c7qSkcH3mq7zOxVE6bo2CTFWxYQi29oOz4rPhEJnIzJqU48DoE1ZJi7bMKCbbI9dGuOQsCWGq 4Fe4vqw4Di2TmmSa5GyZ+iOAqJWpQuNT3mvHm3EJnVbcDtou/fwffB2s8ssA== X-Developer-Key: i=neil.armstrong@linaro.org; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Now we have proper flush and invalidate helpers, we can use them directly to operate on the scsi_cmd data. Likewise, we do not need to flush then invalidate, just flush _or_ invalidate depending on the data direction. Signed-off-by: Neil Armstrong Reviewed-by: Neha Malcom Francis --- drivers/ufs/ufs.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c index 5845fd694d3..d99dcdef7d0 100644 --- a/drivers/ufs/ufs.c +++ b/drivers/ufs/ufs.c @@ -1468,7 +1468,6 @@ static void prepare_prdt_table(struct ufs_hba *hba, struct scsi_cmd *pccb) { struct utp_transfer_req_desc *req_desc = hba->utrdl; struct ufshcd_sg_entry *prd_table = hba->ucd_prdt_ptr; - uintptr_t aaddr = (uintptr_t)(pccb->pdata) & ~(ARCH_DMA_MINALIGN - 1); ulong datalen = pccb->datalen; int table_length; u8 *buf; @@ -1480,15 +1479,6 @@ static void prepare_prdt_table(struct ufs_hba *hba, struct scsi_cmd *pccb) return; } - if (pccb->dma_dir == DMA_TO_DEVICE) { /* Write to device */ - flush_dcache_range(aaddr, - ALIGN((uintptr_t)pccb->pdata + datalen, ARCH_DMA_MINALIGN)); - } - - /* In any case, invalidate cache to avoid stale data in it. */ - invalidate_dcache_range(aaddr, - ALIGN((uintptr_t)pccb->pdata + datalen, ARCH_DMA_MINALIGN)); - table_length = DIV_ROUND_UP(pccb->datalen, MAX_PRDT_ENTRY); buf = pccb->pdata; i = table_length; @@ -1517,8 +1507,12 @@ static int ufs_scsi_exec(struct udevice *scsi_dev, struct scsi_cmd *pccb) ufshcd_prepare_utp_scsi_cmd_upiu(hba, pccb, upiu_flags); prepare_prdt_table(hba, pccb); + ufshcd_cache_flush(pccb->pdata, pccb->datalen); + ufshcd_send_command(hba, TASK_TAG); + ufshcd_cache_invalidate(pccb->pdata, pccb->datalen); + ocs = ufshcd_get_tr_ocs(hba); switch (ocs) { case OCS_SUCCESS: From patchwork Tue Sep 10 09:20:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "neil.armstrong@linaro.org" X-Patchwork-Id: 1983067 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=Kn2qII41; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X2yqy6sMjz1y1s for ; Tue, 10 Sep 2024 19:21:18 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5051A88F95; Tue, 10 Sep 2024 11:20:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Kn2qII41"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9073D88F75; Tue, 10 Sep 2024 11:20:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1D11D88F86 for ; Tue, 10 Sep 2024 11:20:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=neil.armstrong@linaro.org Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-53660856a21so2922168e87.2 for ; Tue, 10 Sep 2024 02:20:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725960032; x=1726564832; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=q2LW5MkEO5pymB6e7w7IUQGE027uBvWv7Inx1yFDrmg=; b=Kn2qII41EIXdN64MFO9dVeDVSLmc9J/LZl+BcGeDfcbaC5XrfQty8yPD9cohnhYGxU /tv2p3gt3ut3yMdeLZ10cXC/RNGqnVwKmuXzXagLK5brwIbyr1mh1PgFxFwG4M98mEFI dHvyHByypzNYOq00Cy3coRb9gR2GsNIvw8KTzTyR07KL4J62XiGT1ySFFl2cZk2rsHq+ DWWGoPvZHfD2zHR4a/DHQwZjAE8a//UnNJl6cJy2ulP7Pd3zfvENkQji6oCF+2iDRhgr 3CogXsV2CLBJohYhwy158uhxS7OjsK6NOZq/1nYZs+ofBSySZRecMIV3PHHruv9EKarO PPuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725960032; x=1726564832; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q2LW5MkEO5pymB6e7w7IUQGE027uBvWv7Inx1yFDrmg=; b=TCIKVacnmyN1E3kDT8ztBtPaSTCnO7tBN3mGyUhSaAku69VLHPJukVS85okH5/jOFE bKRD0Qoj+bFn1RsJIRC3fRQe82vjK3RyT2v9dvjuAtsl87LyCDLq1jspKELXMTvlesk8 O6zulDp43+CqJT1a+va8kPTnp/vu2GFdvHDw17TshWd0eb9WbGd3sgE6B9Hqvbq05QIa SrzPHMmFMpkAE+6NIKs1irygvFECUNekbRmHBkvv/4c1apyKdvQsS9eAtHUGhX7xCdka UDaH5RJPkvtYHSLH3p6h5qfHCP89vl6qrhQ9/cPRfEEvT0iwlX/sXmz67VfV3Taiyi3V FjyQ== X-Gm-Message-State: AOJu0Yz3FJIfKcerEqekAUVzIDMnPCn5Tluk0YsgcJyNcdW2/MMMGsbj wWt+ufOuBmITweq/aXPnWpXXiL9Rcero9zR3jqQh/Zo1S8EnFtxFxLh/yqK/Mm0= X-Google-Smtp-Source: AGHT+IH/rUdCZ+jTEbxt0Bw2M+x86cDqqSn5amG6wgmCaTrBUt1BNEohy5zb1MQGqcYPzfQjgYGepA== X-Received: by 2002:a05:6512:1103:b0:52e:9ac6:a20f with SMTP id 2adb3069b0e04-536587fc91amr9316054e87.37.1725960032097; Tue, 10 Sep 2024 02:20:32 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb099acf6sm101256245e9.9.2024.09.10.02.20.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 02:20:31 -0700 (PDT) From: neil.armstrong@linaro.org Date: Tue, 10 Sep 2024 11:20:22 +0200 Subject: [PATCH 05/13] ufs: Add UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS MIME-Version: 1.0 Message-Id: <20240910-topic-ufs-enhancements-v1-5-3ee0bffacc64@linaro.org> References: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> In-Reply-To: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> To: Tom Rini , Bhupesh Sharma , Neha Malcom Francis Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io, Neil Armstrong , Marek Vasut X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=972; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=gzfDJdXexZqNaG9T3+YZbLI3JscEH/uXNYFxEdmKPMo=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBm4A9XyVAVvreJ4D+GnA405GxJCE9BF0WdMQsuyVDk W1lEtRmJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZuAPVwAKCRB33NvayMhJ0d6jEA CYMbqBrzHe3bK+BqJJHP28AzuzF8RhGsWeB1c3edNEeQVSV6OVrghBT5obv+3oKVc6dSXwiJX6Z/Hg pqwqq9D9cMVz+UBmWbfW72GpscDFVGey4uuK//OderZzYFj/QdcreZnZPbwDVjSnvdyUreE6biGrz5 yenfe73mAutXumFB//7r0OKlypvMgAum/CTdorxwlk9fN2eVuUNZw9yqWCBIamJiF8LhYvOmarNoji yJLyQD53BH2mG+jrF5x6rpowtop8ziF+S6lL61oMjcRqAW8yu1AFCZeoO3/fsFR5g4ztc4Kk/oc59y s8WE8dJC0YNWxSpBWuuOCyNNPyXfVzSP2I/th8zMBhY8cYubPHmkHDl/L8Icl974QD4nau+vnALO0G uUhicUWg83N10UrrI/JI7CZakSsZwLpNau7MMJSdS/q12VuQb6OdjDLY97IAXliGYZC4LPd1z6XuqX p58F73AL4dc+RhBJSq0LaqTnq0vGUausuuQxbE1lqOJHVlwDEaO0S9H2S3U63sMuSojeNPuMiq7+rw im2vmBtguJI59Bq13yhLlimUUURf3Ip4TKfRUiM+Cq44oR3vja//jtPEuoKPIxcSgXXUz6WA5jsSdC H85IOsrtbpkRfRovucomtZf6thjJdpZ6LXVGRHmxcXn4G2mjWEe8OWEh1tXQ== X-Developer-Key: i=neil.armstrong@linaro.org; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Marek Vasut Add UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS for host controllers which do not support 64-bit addressing. Ported from Linux kernel commit 6554400d6f66 ("scsi: ufs: core: Add UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS") with ufs_scsi_buffer_aligned() based on U-Boot generic bounce buffer. Signed-off-by: Marek Vasut --- drivers/ufs/ufs.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/ufs/ufs.h b/drivers/ufs/ufs.h index 43042c294bb..c92f47d82b5 100644 --- a/drivers/ufs/ufs.h +++ b/drivers/ufs/ufs.h @@ -732,6 +732,12 @@ struct ufs_hba { */ #define UFSHCD_QUIRK_HIBERN_FASTAUTO BIT(2) +/* + * This quirk needs to be enabled if the host controller has + * 64-bit addressing supported capability but it doesn't work. + */ +#define UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS 0x2 + /* Virtual memory reference */ struct utp_transfer_cmd_desc *ucdl; struct utp_transfer_req_desc *utrdl; From patchwork Tue Sep 10 09:20:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "neil.armstrong@linaro.org" X-Patchwork-Id: 1983070 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=vr8XgASi; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X2yrV0VZXz1y1C for ; Tue, 10 Sep 2024 19:21:46 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A5CBF88F88; Tue, 10 Sep 2024 11:20:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="vr8XgASi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7B55188F7D; Tue, 10 Sep 2024 11:20:40 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1673788F83 for ; Tue, 10 Sep 2024 11:20:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=neil.armstrong@linaro.org Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-42ca4e0299eso28522275e9.2 for ; Tue, 10 Sep 2024 02:20:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725960033; x=1726564833; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Gb0PkV2QOViT6B2gcnzaIs4IGKO1Z8HfdQrV/Um4OaQ=; b=vr8XgASiS1YdHCI7upoiCJRNFQxtpRfflCT82lNzS5dWeuDTdjBRB52Bs+m+kzrH1D gRr0XtmCy3B3E131vmv5s+McUPoBdvNvUtamSiPBEscLHyUhfjnWREHMuZP5bbn8spFH w4nbUa+Zoat3oraT833UyN86aQ9yLRMyCjyPzm4K0r/UzEwIgn8btFGxdoENKHk4qmBC gs1+y3XzbwcNvpYSlO1Yj2VqI4JaKPEhAsGGWPIt13B7zmP+L+kztck6An1HVHZ8UfLg Ukfk73HjuxvOJh7hKnFwlSmuZZtMeOkOmpDelOiss8knwla9c7ABDa7Eg5NsLu40iJHt 9hFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725960033; x=1726564833; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Gb0PkV2QOViT6B2gcnzaIs4IGKO1Z8HfdQrV/Um4OaQ=; b=meIHAUejUGkdUpT5XMKzB/c6VXXiv7DNmzkOhd5McA/OTtH3wTDatt5frMsKTwXBRR HzJT8LCA0zU2t6OK3ejDOH4MUlw/b7ki/18oJDOqDPD2OMYg50l1NKFPeFhhRA8ceVDu CFuzmeMBvl8FJFpWu/CBIMLEDgZh8TS+on6+EohvSBTU9WtRBmfrDxdopOznjcEWcRDf HuzZXwNWfr7gUNqw3PV6h9IOqj7T6HfFpBaZAEQfT8iml8xz1JO8Ll8rd5KAcrWAKm6L 1r4f6HEGiDI9A0FarWuxfb+DUqPMz6oRUPyl9C+KvecF2bOYfw6bAHldctOzHeu9DJxg xVFQ== X-Gm-Message-State: AOJu0YxGF17jNsZfTL1A9HSNVn9YpYcM+QE46FZi4ULZ5uR+eR1bkVql /tcP0IxrwIG630Hbdoz4FzbVk7zFtLpQ9VkHmmwOAbKmtp5IeAFwXDPo5A6JyG4= X-Google-Smtp-Source: AGHT+IEW+ezLQYVs+af1/qJV1TfFJgo/sNUThgShKD3ihjL3xyAu8iHUMHvHgO4qSe9SH5pZqBIVgA== X-Received: by 2002:a05:600c:45cb:b0:428:1608:831e with SMTP id 5b1f17b1804b1-42cad76a0b5mr76602065e9.22.1725960032910; Tue, 10 Sep 2024 02:20:32 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb099acf6sm101256245e9.9.2024.09.10.02.20.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 02:20:32 -0700 (PDT) From: neil.armstrong@linaro.org Date: Tue, 10 Sep 2024 11:20:23 +0200 Subject: [PATCH 06/13] ufs: Add UFSHCD_QUIRK_HIBERN_FASTAUTO MIME-Version: 1.0 Message-Id: <20240910-topic-ufs-enhancements-v1-6-3ee0bffacc64@linaro.org> References: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> In-Reply-To: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> To: Tom Rini , Bhupesh Sharma , Neha Malcom Francis Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io, Neil Armstrong , Marek Vasut X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=913; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=OW1BOfb9J2JCSQ+o+aNgKOU5e1Bne+zLUtmpxqp0jnI=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBm4A9YmaBGtI59t0o/zu7x5DkVJbiHlvvSjqTs7LPB SpvxACKJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZuAPWAAKCRB33NvayMhJ0f4UD/ 0ZnFx77ghxKxiOudBJKuknEQX07KTN7dsuPa6wIs+cIWOvmcDaTFUnjrvEWGxrfTOE1LajIyckBc9t khWNnAEMCj/rAR3WCXKAU+LE/YjRSk9cKKFGdAPNbWTh+h5N8gaCFfjhGRHgqQkbWGyuFsIix0rYmU wuIYyYp2H9M6rz0WYe0R9kpMb2rdSva3sCwvEd3dSv2iZwzmuaAEgpCp0rwzvpP4K8M9FU8iOrDhnD WJ0FTUkKISWnXrHax/8CQrZ66yvxi+T8lacj8B3v8HbLpfy3y70cYQuAk+sdqbIFAIdLaCyphhBAZD 3vT1jIdN/hhoPKgh3ncg5y7lyjD5gxdvklqsjIc4IJUk/UxsQntlbQG/+RDZXP9xQHle1WeeiWgC5q Wkqy3UHrqH+0BQ33pxAtimVJg0++18opp9k8EulIH4RLStF6axjucZ+JMMwH7gW2nP8Ecc4pzS8zpi YlCB1E8FUmURxgEeFSZGW2E2Q5cJwnDCAIaU81vnDyuagfGm7xt2SwBHLHiR2DuEtC8q4lM0Iv5BYV DWyNMPWNd3IszxjGg91ocfLNR3cMYKwO78USy48qTlv1VToIY1lHFdYH8orH53/BXgJikgOWssGTpL AtHfn5GAatHoAVu0IWwpgtoWtLO437KBzuWxWWX8YLNvrQMPa06X2hK1mQtg== X-Developer-Key: i=neil.armstrong@linaro.org; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Marek Vasut Add UFSHCD_QUIRK_HIBERN_FASTAUTO quirk for host controllers which supports auto-hibernate the capability but only FASTAUTO mode. Ported from Linux kernel commit 2f11bbc2c7f3 ("scsi: ufs: core: Add UFSHCD_QUIRK_HIBERN_FASTAUTO") Signed-off-by: Marek Vasut --- drivers/ufs/ufs.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/ufs/ufs.h b/drivers/ufs/ufs.h index c92f47d82b5..b55c4a9e996 100644 --- a/drivers/ufs/ufs.h +++ b/drivers/ufs/ufs.h @@ -738,6 +738,12 @@ struct ufs_hba { */ #define UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS 0x2 +/* + * This quirk needs to be enabled if the host controller has + * auto-hibernate capability but it's FASTAUTO only. + */ +#define UFSHCD_QUIRK_HIBERN_FASTAUTO 0x4 + /* Virtual memory reference */ struct utp_transfer_cmd_desc *ucdl; struct utp_transfer_req_desc *utrdl; From patchwork Tue Sep 10 09:20:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "neil.armstrong@linaro.org" X-Patchwork-Id: 1983069 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=lhMvgX2M; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X2yr86qbrz1y1C for ; Tue, 10 Sep 2024 19:21:28 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B0F6188F86; Tue, 10 Sep 2024 11:20:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="lhMvgX2M"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BA0C088F75; Tue, 10 Sep 2024 11:20:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D0F3D88F71 for ; Tue, 10 Sep 2024 11:20:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=neil.armstrong@linaro.org Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-374ca65cafdso3313872f8f.2 for ; Tue, 10 Sep 2024 02:20:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725960034; x=1726564834; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3m7Q+AqHnJtFLnPxeYXXhUgB8nIPlDQz0O1xPV0ygqg=; b=lhMvgX2MA+VdedGWL0PkL76KMD4yf/RIdISNGoE8LpDrGkj8KfMtgoF0mcxHS+AUPR puMe7PEbJ4MYQh7V66swUHcrE5sX4dsHV8rvUqaiRQJdyxsZXQRzu1jpKckwoJsTO//p o1hBZBNn/gCYU2E2Did8rho28a7H6UArI5wNsjOUe+6QgfSkY8uhleH67Hg9PxhwUzfj mcfbI+uToUnLAfjKpy7oB5xOP5P9bXneAjYLpYrMP2/LCCejqcLZw5nMQxxYvgjUH9KA rVX5NgSmUkTJ5FG8S0sTaSWQvCSh5R3hNvxI57VsyQncnWRAVhrcRTzw8/JN3jwsvwyx jsoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725960034; x=1726564834; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3m7Q+AqHnJtFLnPxeYXXhUgB8nIPlDQz0O1xPV0ygqg=; b=KGavvQSMRqCtE4sJdi7OrEbjks3AnSu+sMz8WxaxnPPH1UmAW9RreV+w9Gc7B8FnsR bfEz3CV+2DwWEtMyiXu23MUHjIklsHRPEllOYuYeRDrwF+qKPcDhjAD55SQY7K7DUm08 9gGs1Sy3jH7Q3R2b3rWtTbdYdpY9ONqpYXIVc7i45jRKae68MPXAnsxPQTRIa5QVK5G5 whhK4OdPztGWPDMHGhrWKMvrENz9NvAyjYAYj/c1/k2VOM4K9gD38mJG7XUW4sfgfzU+ C1vhNnmAxpSM0ZynxquwtCuNs7H9cP2O+0O5Kk7XBZ8IYn2JeBkWHv5D1lURXJR0APGe JtQA== X-Gm-Message-State: AOJu0YzJFugS4C1SEChLs3Lp2KRuMX09vNj/ggRyRceQR3h2F/b+27V/ 1z/9b3uN/ExYOAN69cWJGpoJJ/j6hgAcIZb+9mLLyDupvTvjq6ILaXM62J/AXCg= X-Google-Smtp-Source: AGHT+IEekeKiFW5aPHkwkoEwWNLZYIjUksIhjKx1C579YBpQDCfvcBl+59UMdelSPFx9OnSd+BHe5g== X-Received: by 2002:a5d:58e7:0:b0:378:81aa:2662 with SMTP id ffacd0b85a97d-378949ef189mr6367476f8f.7.1725960033725; Tue, 10 Sep 2024 02:20:33 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb099acf6sm101256245e9.9.2024.09.10.02.20.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 02:20:33 -0700 (PDT) From: neil.armstrong@linaro.org Date: Tue, 10 Sep 2024 11:20:24 +0200 Subject: [PATCH 07/13] ufs/ufs.h: Add definition of 'ufshcd_rmwl()' MIME-Version: 1.0 Message-Id: <20240910-topic-ufs-enhancements-v1-7-3ee0bffacc64@linaro.org> References: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> In-Reply-To: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> To: Tom Rini , Bhupesh Sharma , Neha Malcom Francis Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io, Neil Armstrong , Bhupesh Sharma X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1213; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=n6sWzFGKN/U+YwB57DGrAsU0A4QspTvAYyw+DnuGD8k=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBm4A9Yg80Meq/DkdL3QnMmX4btuNj2Xeb0Ic+Nm+93 cDyzfEmJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZuAPWAAKCRB33NvayMhJ0fvwEA DQ7dD+27vRZoV+7Z2U/Llw9NPJf085YQu006d6L4/WcO8Xq5oqfcBSx+cnm+n+8Yxl+p0Xz4AoGn3C 2F/IdVQbEZFjNiGWouMyKANj2HtvRopV8avK3UPeCTSBIsiJbrHOS9LlzzMpyuCFGhwLaiTYllEwJ7 qp8YN9s9HU2QmH7wXHBMKnFJMY9brXHzlRNMT5bZrgcy3dMvvWI+xliGipQ1z9Xsd7Xlo/kSC/UiuK f+q++ZJM4/X4IdREjWKx7SSUCSFihvoNmqxmncin95965p8wYKDggOnhLJdHKiM2EhXJA8ZNJaYLwp HHVOWwar55YGNTro34qrZEiv6Ng27MWe7Xa/3Znt0fELFTE0AsB5zf9WVc8Wg5IQr+f3AYoJQrhSlU sm20IMjvsdJirUHkMiQOnyPqEIfQroeNGqIbqIa1NbN2Z4YpZVGNnRx9uF9535ZN2X2OCVkXeH4Nag 3jNgQVBtoNgppxjSF9mU5yq36HHX/t9HqmEaqcHHV8+NPuzR6KkFuxVWsb2WAGMfFKyGB7BKpzjzpR QuA6GdqYO5uu7qReN2yF1DyK6ToIWTE5/CjwKDury9KGBlgGg1i+LTvilg5/KPcox/3zNrBNBHTHr8 UV2TnI01A50bv4nmNgKCqCliz+XLHWZ0Nfit7PW8YZkwyfLOLeDU3k2tE6OA== X-Developer-Key: i=neil.armstrong@linaro.org; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Bhupesh Sharma Add definition of 'ufshcd_rmwl()' helper function which would be later used by Qualcomm UFS driver to read-modify-write registers. Signed-off-by: Bhupesh Sharma --- drivers/ufs/ufs.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/ufs/ufs.h b/drivers/ufs/ufs.h index b55c4a9e996..555f8a6857d 100644 --- a/drivers/ufs/ufs.h +++ b/drivers/ufs/ufs.h @@ -3,6 +3,7 @@ #define __UFS_H #include +#include #include "unipro.h" struct udevice; @@ -933,6 +934,23 @@ enum { #define ufshcd_readl(hba, reg) \ readl((hba)->mmio_base + (reg)) +/** + * ufshcd_rmwl - perform read/modify/write for a controller register + * @hba: per adapter instance + * @mask: mask to apply on read value + * @val: actual value to write + * @reg: register address + */ +static inline void ufshcd_rmwl(struct ufs_hba *hba, u32 mask, u32 val, u32 reg) +{ + u32 tmp; + + tmp = ufshcd_readl(hba, reg); + tmp &= ~mask; + tmp |= (val & mask); + ufshcd_writel(hba, tmp, reg); +} + /* UTRLRSR - UTP Transfer Request Run-Stop Register 60h */ #define UTP_TRANSFER_REQ_LIST_RUN_STOP_BIT 0x1 From patchwork Tue Sep 10 09:20:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "neil.armstrong@linaro.org" X-Patchwork-Id: 1983071 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=sx88d2oG; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X2yrm5G89z1y1C for ; Tue, 10 Sep 2024 19:22:00 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 146B088F8F; Tue, 10 Sep 2024 11:20:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="sx88d2oG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9D47A88F9A; Tue, 10 Sep 2024 11:20:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B8EE388F86 for ; Tue, 10 Sep 2024 11:20:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=neil.armstrong@linaro.org Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-428e0d18666so48344705e9.3 for ; Tue, 10 Sep 2024 02:20:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725960035; x=1726564835; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=pXv5ZgubOL3yjfLM9ECp2Jx1KLJbtiMwclsA2KmrMo4=; b=sx88d2oGVrLUvxEdFcK3rDA9E03jP5cTLQsjD/4Wna86s9LwdKk+gKRwByUpfrYRhH MPazQaVog3wA8QoHpm1gGqKcGHDubLrIaI2h29Y/O1fYU9W28b73EIG8VTy9r7EhfM3j q9N6Gj+a0zPbKZoXzoxntMWCGE3pe782c+biTCJErC12IrErhN3FQdZx3nnlOHmBYBik +l00s8ccWrxNgA9mBiZoPX2xnJ7wazNXfkVxsAgsDznWpwlVsUTRGylSOwEk6AZUJW9q Ukoz6Ku88SkWegk5ofja946+lBsbMxZSEXkObW54j4uUKPuRXtmEXVKFLS7ud2ud0IXT Q0Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725960035; x=1726564835; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pXv5ZgubOL3yjfLM9ECp2Jx1KLJbtiMwclsA2KmrMo4=; b=SCuS5RzWCQ5ouhbv+1lZjfJChyaiyYHrJAoGRQXYBzy/DXr3YOEc/OoPcn+ToKVCq3 u+AFdYUVZAA0Mch8PQ5B0YBoRP2hcxvVdODSqM8OR3DNAldq3fz8Jrdvn5Z9Th3hnlwe x3Z6WgziEsb95VlrBesx4r/dnLXqG3YdXkDa7NIEJ5PVobyVEIwPL8J6+BOTBCzIdUNn LFr0+sbOVv2C2VOfGNdzNYQehztF34iAmev7SjuigswxiKmnu+BgdO9iMJKyOh2pyPAY wwZUbAn88CONgX3xOokzG02mBqPVcZxbhUjUHFVPm9LC4ba+e0fFcG3bGPzHLlltXijq Yl1Q== X-Gm-Message-State: AOJu0Ywm6JkcaV6y9PUBkcfri36xprLY1gdMtCyCs+cwH16hD3XmlA9Z 547RECmIyAkBJ+BkcZp+8VXflV2KJHs+nq+h38Em/ngODmplas3q+v7mqy1Ni8zEGetRJAeUBP+ x X-Google-Smtp-Source: AGHT+IFiWx0uPcGbTSuBshMMiY6U4+H2z7bcNyZDxiYaKcj0b81j1dw5OyAwu2UuLWsvkdgzd36mAQ== X-Received: by 2002:a05:600c:3c8d:b0:426:647b:1bfc with SMTP id 5b1f17b1804b1-42c9f9d385emr98631195e9.30.1725960034596; Tue, 10 Sep 2024 02:20:34 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb099acf6sm101256245e9.9.2024.09.10.02.20.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 02:20:34 -0700 (PDT) From: neil.armstrong@linaro.org Date: Tue, 10 Sep 2024 11:20:25 +0200 Subject: [PATCH 08/13] ufs: Clear UECPA once due to LINERESET has happened during LINK_STARTUP MIME-Version: 1.0 Message-Id: <20240910-topic-ufs-enhancements-v1-8-3ee0bffacc64@linaro.org> References: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> In-Reply-To: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> To: Tom Rini , Bhupesh Sharma , Neha Malcom Francis Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io, Neil Armstrong , Bhupesh Sharma X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=727; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=zS0wWmluBSs9D3MV9MEogWQo9jfQBO7Fvm6JkMA7XQ8=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBm4A9YiqiTELH8pKi5tTUq2w9sk5mWmQbb5kCys7aN 6+r1j+OJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZuAPWAAKCRB33NvayMhJ0SH4D/ 9HpVAshxTVrcMD7xuXz5vbKKrmXqktPkB3d+3sqG6MCqm1H5w1i6Rj828769vD6DLkugiXbNdGFGQB 9zQOywB8b+Z8WVuM2jWFUXVtthuJpbNZyvvY1Y9HlKHX+frAz5ONyDzsZ/545GAjWuyRttquFPj+rB 6hn6rqfQBi+zWiEW0l12QmhpCZFVcAnGU4GfLoerbuIo7uy772EICTI7T6Jx8VXalnqK6pbNhmDfM2 VSj94h4KpSStgjGYsbHsZUn5XdHzlyIW6YpgwubG3FaWhuhZYJB/nH45khSVZgShmUZxaW4MPLmdOO TqnpMoDGTlWeVvdDieoEZb380Uy/ffEWy6jZYhPoAc8kThm96FJ9D6oKDuuOho+QTyGVAHwEMPD1M/ unQDhn8G/k7Slpmus5sY2WCQDo+2wECKyWn0tWPzvhiPAEPrXuayUjyexJHe3kOjL4dg8fAFjFp7/T kJhlQeObGDTqD8JJX5H2bDpCbuUXUYDmpcFp/EUPRXRCOeQF/WkkkweAnnn5oHZFqlbUCrKfTV85t0 7hblavDGlN0Idti2a5RR0za5dNlcOjyxzOFjLLKgNlAaNQqzUvwJZbjt1rMoai8dmyTn3inR0NfRXR VQgFPqYotRfvYuYrsZjDOAdPonJnBfUWeJIdpvaH5wdBbSCJgmGHG9wY3Sjw== X-Developer-Key: i=neil.armstrong@linaro.org; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Bhupesh Sharma Clear UECPA once in u-boot UFS driver due to LINERESET has happened during LINK_STARTUP. This makes the u-boot ufs driver behavior related to UECPA similar to Linux UFS driver. Signed-off-by: Bhupesh Sharma --- drivers/ufs/ufs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c index d99dcdef7d0..565a6af1404 100644 --- a/drivers/ufs/ufs.c +++ b/drivers/ufs/ufs.c @@ -504,6 +504,8 @@ link_startup: if (ret) goto out; + /* Clear UECPA once due to LINERESET has happened during LINK_STARTUP */ + ufshcd_readl(hba, REG_UIC_ERROR_CODE_PHY_ADAPTER_LAYER); ret = ufshcd_make_hba_operational(hba); out: if (ret) From patchwork Tue Sep 10 09:20:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "neil.armstrong@linaro.org" X-Patchwork-Id: 1983072 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=NzimKahz; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X2ys04S3vz1y1C for ; Tue, 10 Sep 2024 19:22:12 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6F36C88FA5; Tue, 10 Sep 2024 11:20:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="NzimKahz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EBA0C88F9C; Tue, 10 Sep 2024 11:20:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E001788F71 for ; Tue, 10 Sep 2024 11:20:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=neil.armstrong@linaro.org Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-42cb0f28bfbso4679055e9.1 for ; Tue, 10 Sep 2024 02:20:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725960036; x=1726564836; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=HV8ewGL5ts1akQ5UvRod54uQuskpBFgWIEw8bl8J2hQ=; b=NzimKahzQZAQCLG4KsM/Y2DTHitxAQBS3ywD/tRD1z+5x5YOXGelNT5wuF0QCouj2i k97E/XZbOMkOV9Oz/Hk5QlrFztznCmpC1kRkYDCI3dRYrhejE6r3CwFlL6ejQyWXff82 cACr9kWTXRM85MSwoHGT1PCDO6jT83zTxYe6plrhtvauAbi+Q9ystekZttlpkeMj83bG Elt4ADmwB8jkfvuQQgaC/ujw3Ho6PIaBls/MABffzv2+keWQndMe+TkP3Qj3pGMky+Pj NCCA6NkyfYtZAxZn0Ol/alnbdKoj0MqG4SdMOHALLs1GyHPW/LvtTVvrz/tt5uOASMvj bY4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725960036; x=1726564836; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HV8ewGL5ts1akQ5UvRod54uQuskpBFgWIEw8bl8J2hQ=; b=uGaLTUNqGJ5gOXhpmHcEh3nHH0tQTxeR7xnS4rWSD4zVr6IqWjLuiaDOXy3ZJXmx5D 22rWe51BAxReGPb9bZdLmRUIUuhjORF9kIykC7v/W3+7RwGWIaL0LBSuRoGbW63TwAF7 bxVaUrVogxiZJMef9DpeNmQKxLjYRxHlOtIS+ylCBU9q1a2XbN815eRH+R3hms9srK5K leNWwwMt/IWvroWZT/zchCFpL+Ty5LWtecYNc+gN+xbZ1nTvtCHgeYDb8YQGPrE2XQ9j WfEtO1hmUibvBH1j6ClBBEnOwMVDwMLItMsF2CmzQink2akL5wSE+ZmSTBe26K3/gd3K yZ7A== X-Gm-Message-State: AOJu0YyWY5XfWANDDq56cmVuWPH6TAeYC0msqqwQ0RKl3LuUz2N2eOLM EVzAZlQYUIbdE7OIKesEj719tFt1UKdiMCG3jHcZf4KBoWZOBRySRrNZanzWbBU= X-Google-Smtp-Source: AGHT+IGB30H9TwNlNWhg72qCcdlP1SGwOCCYa0fq1z6ke2fPT+3H4NR8O26PIaeMWaxexp8uTR3KhA== X-Received: by 2002:a05:600c:1d03:b0:42c:b950:680a with SMTP id 5b1f17b1804b1-42cb9506955mr35635715e9.20.1725960035579; Tue, 10 Sep 2024 02:20:35 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb099acf6sm101256245e9.9.2024.09.10.02.20.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 02:20:35 -0700 (PDT) From: neil.armstrong@linaro.org Date: Tue, 10 Sep 2024 11:20:26 +0200 Subject: [PATCH 09/13] ufs: Sync possible UFS Quirks with Linux UFS driver MIME-Version: 1.0 Message-Id: <20240910-topic-ufs-enhancements-v1-9-3ee0bffacc64@linaro.org> References: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> In-Reply-To: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> To: Tom Rini , Bhupesh Sharma , Neha Malcom Francis Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io, Neil Armstrong , Bhupesh Sharma X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=5647; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=5A1oQNU/wPrcd8KX7K18Fe1TPVAS2m1OHwrC9jqiadc=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBm4A9ZY2Z1lOgpzcaZo0voAgqmM/dOU4/XQnA3u9Cs n8KTNeGJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZuAPWQAKCRB33NvayMhJ0eyqEA CjjveOPo4eqFoLmTaPW24+T4TTl6BPfRe1XjgWx7EjLfx29AcauH/ml/cAQ0frkcWQ0K6QF04iOkBc J5UgOZiY0d/Gqav6ON8hDO0YQFZYQ2H1Hu4TqqP45geUfO8a4bJUpCwSxksmR5dCHoSOIvkYGK2iEE YCsk77FVTBjMbrssYmSv9kIw3Fzh1tlXXw+8zcj394bAQ3jRDSvoZOI9xs/7+Yv7p96BAvGXB71RHB I0LkYdPtp4jaL5mLOGX5z5IAS7VauAlvNCgb6S60pfCfykonFODbWf6KL2mJkTbehVmzj1gfknfQnA 1CZpuILYKNHVrnQjGH7hcDYaZ5Yo5y9+XgkTgK/lBlJp+Q1JNdpxmJYZkSgnZTQUM0yA3GWhLbPU+n Q0XUerkJ5GR4hlr6lSxSiB6HunLZK05/4T+BrerOb/l9fHYyaGu3EpsJbF7Uv5WSfS2cmDpXx62WQy mrFTvAaPkwAy2gGHjKBpkr30hSHj+Sh9Mf1M4TV4er6HhHaS2fepZbQ7uqZKPkHFfHdzbSTHMvAQ9E pbqsatvkM80MjIAT7rkht2P1f/avsPXZghdaESmRcIi8DB8IQFJltJlHtd4fVNhOdzNKFbL7hzmgbP R5eLu5oNoZ4KFa8lrF4Pgn3YEutEfze6p//mjSbyg3aVoyb7LvZ7I5SwcvzQ== X-Developer-Key: i=neil.armstrong@linaro.org; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Bhupesh Sharma Sync u-boot UFS driver to add all possible UFS Quirks as supported by Linux UFS driver as well. Signed-off-by: Bhupesh Sharma --- drivers/ufs/ufs.h | 151 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 120 insertions(+), 31 deletions(-) diff --git a/drivers/ufs/ufs.h b/drivers/ufs/ufs.h index 555f8a6857d..e8a14411560 100644 --- a/drivers/ufs/ufs.h +++ b/drivers/ufs/ufs.h @@ -712,38 +712,127 @@ struct ufs_hba { u32 version; u32 intr_mask; u32 quirks; -/* - * If UFS host controller is having issue in processing LCC (Line - * Control Command) coming from device then enable this quirk. - * When this quirk is enabled, host controller driver should disable - * the LCC transmission on UFS device (by clearing TX_LCC_ENABLE - * attribute of device to 0). - */ -#define UFSHCD_QUIRK_BROKEN_LCC BIT(0) -/* - * This quirk needs to be enabled if the host controller has - * 64-bit addressing supported capability but it doesn't work. - */ -#define UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS BIT(1) - -/* - * This quirk needs to be enabled if the host controller has - * auto-hibernate capability but it's FASTAUTO only. - */ -#define UFSHCD_QUIRK_HIBERN_FASTAUTO BIT(2) - -/* - * This quirk needs to be enabled if the host controller has - * 64-bit addressing supported capability but it doesn't work. - */ -#define UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS 0x2 - -/* - * This quirk needs to be enabled if the host controller has - * auto-hibernate capability but it's FASTAUTO only. - */ -#define UFSHCD_QUIRK_HIBERN_FASTAUTO 0x4 + /* Interrupt aggregation support is broken */ +#define UFSHCD_QUIRK_BROKEN_INTR_AGGR (1 << 0) + + /* + * delay before each dme command is required as the unipro + * layer has shown instabilities + */ +#define UFSHCD_QUIRK_DELAY_BEFORE_DME_CMDS (1 << 1) + + /* + * If UFS host controller is having issue in processing LCC (Line + * Control Command) coming from device then enable this quirk. + * When this quirk is enabled, host controller driver should disable + * the LCC transmission on UFS device (by clearing TX_LCC_ENABLE + * attribute of device to 0). + */ +#define UFSHCD_QUIRK_BROKEN_LCC (1 << 2) + + /* + * The attribute PA_RXHSUNTERMCAP specifies whether or not the + * inbound Link supports unterminated line in HS mode. Setting this + * attribute to 1 fixes moving to HS gear. + */ +#define UFSHCD_QUIRK_BROKEN_PA_RXHSUNTERMCAP (1 << 3) + + /* + * This quirk needs to be enabled if the host controller only allows + * accessing the peer dme attributes in AUTO mode (FAST AUTO or + * SLOW AUTO). + */ +#define UFSHCD_QUIRK_DME_PEER_ACCESS_AUTO_MODE (1 << 4) + + /* + * This quirk needs to be enabled if the host controller doesn't + * advertise the correct version in UFS_VER register. If this quirk + * is enabled, standard UFS host driver will call the vendor specific + * ops (get_ufs_hci_version) to get the correct version. + */ +#define UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION (1 << 5) + + /* + * Clear handling for transfer/task request list is just opposite. + */ +#define UFSHCI_QUIRK_BROKEN_REQ_LIST_CLR (1 << 6) + + /* + * This quirk needs to be enabled if host controller doesn't allow + * that the interrupt aggregation timer and counter are reset by s/w. + */ +#define UFSHCI_QUIRK_SKIP_RESET_INTR_AGGR (1 << 7) + + /* + * This quirks needs to be enabled if host controller cannot be + * enabled via HCE register. + */ +#define UFSHCI_QUIRK_BROKEN_HCE (1 << 8) + + /* + * This quirk needs to be enabled if the host controller regards + * resolution of the values of PRDTO and PRDTL in UTRD as byte. + */ +#define UFSHCD_QUIRK_PRDT_BYTE_GRAN (1 << 9) + + /* + * This quirk needs to be enabled if the host controller reports + * OCS FATAL ERROR with device error through sense data + */ +#define UFSHCD_QUIRK_BROKEN_OCS_FATAL_ERROR (1 << 10) + + /* + * This quirk needs to be enabled if the host controller has + * auto-hibernate capability but it doesn't work. + */ +#define UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8 (1 << 11) + + /* + * This quirk needs to disable manual flush for write booster + */ +#define UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL (1 << 12) + + /* + * This quirk needs to disable unipro timeout values + * before power mode change + */ +#define UFSHCD_QUIRK_SKIP_DEF_UNIPRO_TIMEOUT_SETTING (1 << 13) + + /* + * Align DMA SG entries on a 4 KiB boundary. + */ +#define UFSHCD_QUIRK_4KB_DMA_ALIGNMENT (1 << 14) + + /* + * This quirk needs to be enabled if the host controller does not + * support UIC command + */ +#define UFSHCD_QUIRK_BROKEN_UIC_CMD (1 << 15) + + /* + * This quirk needs to be enabled if the host controller cannot + * support physical host configuration. + */ +#define UFSHCD_QUIRK_SKIP_PH_CONFIGURATION (1 << 16) + + /* + * This quirk needs to be enabled if the host controller has + * 64-bit addressing supported capability but it doesn't work. + */ +#define UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS (1 << 17) + + /* + * This quirk needs to be enabled if the host controller has + * auto-hibernate capability but it's FASTAUTO only. + */ +#define UFSHCD_QUIRK_HIBERN_FASTAUTO (1 << 18) + + /* + * This quirk needs to be enabled if the host controller needs + * to reinit the device after switching to maximum gear. + */ +#define UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH (1 << 19) /* Virtual memory reference */ struct utp_transfer_cmd_desc *ucdl; From patchwork Tue Sep 10 09:20:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "neil.armstrong@linaro.org" X-Patchwork-Id: 1983073 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=Bi43sfFX; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X2ysC5vJ8z1y1C for ; Tue, 10 Sep 2024 19:22:23 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C386B88FAA; Tue, 10 Sep 2024 11:20:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Bi43sfFX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A42DB88FA4; Tue, 10 Sep 2024 11:20:42 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BB0FF88F88 for ; Tue, 10 Sep 2024 11:20:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=neil.armstrong@linaro.org Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-42cae4eb026so29308135e9.0 for ; Tue, 10 Sep 2024 02:20:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725960036; x=1726564836; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=FiZ7d/zss0qv1wKmPr1Qcf9QsjkyREN4pR1f7/QXCVA=; b=Bi43sfFXEgBAXAMXRYqEhXlQTO1R5uR0X3TmKkK+EX3vISSSJ2D9BHmQMI+7cl3xs3 XFPfIYnpkfTf0vGnIYLUZpyDb6IEuESl1TcPWjuESvM/CHtzyTZA5cUGSzynxYsoSNhm zZRlunMBMO7HuPQl9bjQjbI19gUClzQB46Rz5psikemv5FCLxb+i5exJOHcwhCu03Atm FQmd5412aZ2VjgfBD7xrEXemv0i4awa2xOY1bkBJuWHqYzNjzTU6S1lY+TJfAcNJT4E8 BUCRsH2kEOpBZ3vg/Ezq/SSE3DTJfw+PUOi5/Hu+pePrA2nUmHXfAYQaNOkClBiwmn4F 25Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725960036; x=1726564836; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FiZ7d/zss0qv1wKmPr1Qcf9QsjkyREN4pR1f7/QXCVA=; b=i5hIajNwZuWrBynpNeZHS2OezSAVh177iu/f+okjgxdQaVUQ6Rbe9N3Qwc7/8d8sRb ePKNOJ2KEP0/iYT0LUejGHHyiCS+27BgLcYp21GuwVCChRtH1jgWrdsJrREoWXLYuawk 39MZ2zbVynAungem8+G3thgG+/DoFd4QFL+trddIwu2MZuH/QzV4uJiap3C65qL+kr5r b7e54kL9ET7AO1bry1+KYA4Vuojocx47KGd4HvhCGs9aV86hnXrQZBLXRyPsS+Vv1m9J ZRPJ7kSuN73UJEsWoHXze1dO5C4Cqm8pQ0DTZobrNw7WuU2LmZI5qwmci5YIV2vhRG+r FALw== X-Gm-Message-State: AOJu0YyoZ7tVYcYHKRZiGMQn3bc2edpE4tBmPRtYVsxsMAUIux1R+Y3s BGhdJ2VL6EGqemhgQ5ZyGlYiSmVLvCbOZjh+cp64lk12lmuj5pwZ7grS2QO1+7USG7QpdIHaOJH 3 X-Google-Smtp-Source: AGHT+IHspWzbUYfKTVdevvKN7dtJU3HsDYkBgN62QpAtNjqj3aWvWvK7vhpeYLt1Z2gXVoNY7K1cjA== X-Received: by 2002:a05:600c:4506:b0:427:ab29:30cf with SMTP id 5b1f17b1804b1-42c9f9768a5mr105140035e9.4.1725960036412; Tue, 10 Sep 2024 02:20:36 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb099acf6sm101256245e9.9.2024.09.10.02.20.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 02:20:36 -0700 (PDT) From: neil.armstrong@linaro.org Date: Tue, 10 Sep 2024 11:20:27 +0200 Subject: [PATCH 10/13] ufs: Add missing memory barriers MIME-Version: 1.0 Message-Id: <20240910-topic-ufs-enhancements-v1-10-3ee0bffacc64@linaro.org> References: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> In-Reply-To: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> To: Tom Rini , Bhupesh Sharma , Neha Malcom Francis Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io, Neil Armstrong , Bhupesh Sharma X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1550; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=5oG/hJDRzgrfw1H7DuKQEcfPeZJkmu0N1nxQo6XZS64=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBm4A9ZVkHT19ZhlfhIdSkNnKZzoCEsYUXcZSYKd92F 7bJ4EfSJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZuAPWQAKCRB33NvayMhJ0SIhEA C80FMzpCUoL7uXVNU45bWmcf0QdEPKhUxv7NOy9+DXJzpZ0DUP1YnL4beBxKlYwSR7I5RJkvlVjX4m HJhQdWxjMno62b2CUzNl46hGlqprRmBGQEu6U1MVfeWgkDfJJgkTgjBj4821oavZgLEBLucRcRQn3d +S3EfrCcMuSvKjxu2+j+YL9DD36Ie//1CaovgO0D0qPr4Nhh1DyfmGRemPl4jmaXDkVUUNeTYsGiTV gZM9MBSh72byTc7V0FI9ov8JHzF3xzzWrgJVacazrlSCdlsyyP6yOBZHu+lmQB7BNnnFljolDLNxqR 5UfEPlKB+bDhG5eos294bw5Ej/Zq8b3KtV6QFzT1jSPTLZDkHxmY9jm1crrLMXWChIZehhgI0WdccZ yI9vM8Zxctb0vKh2CKtC6Hw1nJNw0+S8skBL0zg2k86qqsKSU7yVFxYGVr12rK+0hxyj4vapN2wa7j xGRT7NgOCzNsUKWNK2QFN7yEyqNbrRk5yOUvAPer6QHPZKeqNinystndrcovseBaPHMJ83KE6IFK6h CoaFjBUwbDBpP+I4ndvSFBftTlNujch46roOIbRSFvjE51iNOpE9ue9Uhl1bq8og43O37Bn+jlM8Zl IgKcyAfMoVTMifmjnc6dQ/tCAcqFS0TpUgZk7bvQL7fi6+fAMnANYR1jfHgA== X-Developer-Key: i=neil.armstrong@linaro.org; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Bhupesh Sharma Add missing wmb() and mb() barriers in the u-boot UFS core framework driver to allow registers updates to happen before follow-up read operations. This makes the barrier placement similar to the Linux UFS driver. Signed-off-by: Bhupesh Sharma --- drivers/ufs/ufs.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c index 565a6af1404..5d4e5424358 100644 --- a/drivers/ufs/ufs.c +++ b/drivers/ufs/ufs.c @@ -432,6 +432,12 @@ static int ufshcd_make_hba_operational(struct ufs_hba *hba) ufshcd_writel(hba, upper_32_bits((dma_addr_t)hba->utmrdl), REG_UTP_TASK_REQ_LIST_BASE_H); + /* + * Make sure base address and interrupt setup are updated before + * enabling the run/stop registers below. + */ + wmb(); + /* * UCRDY, UTMRLDY and UTRLRDY bits must be 1 */ @@ -861,6 +867,9 @@ static int ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag) ufshcd_writel(hba, 1 << task_tag, REG_UTP_TRANSFER_REQ_DOOR_BELL); + /* Make sure doorbell reg is updated before reading interrupt status */ + wmb(); + start = get_timer(0); do { intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS); @@ -1994,6 +2003,8 @@ int ufshcd_probe(struct udevice *ufs_dev, struct ufs_hba_ops *hba_ops) REG_INTERRUPT_STATUS); ufshcd_writel(hba, 0, REG_INTERRUPT_ENABLE); + mb(); + err = ufshcd_hba_enable(hba); if (err) { dev_err(hba->dev, "Host controller enable failed\n"); From patchwork Tue Sep 10 09:20:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "neil.armstrong@linaro.org" X-Patchwork-Id: 1983074 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=HWCLlxzY; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X2ysQ55qLz1y1C for ; Tue, 10 Sep 2024 19:22:34 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2F13888FAC; Tue, 10 Sep 2024 11:20:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="HWCLlxzY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A9E4388FB4; Tue, 10 Sep 2024 11:20:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C114688F9B for ; Tue, 10 Sep 2024 11:20:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=neil.armstrong@linaro.org Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-42ca6ba750eso21825645e9.0 for ; Tue, 10 Sep 2024 02:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725960037; x=1726564837; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=RXsLDtSn+yuIut/V8TcI/hXin8AlEwPOWBtFyFIn58w=; b=HWCLlxzY+r476K6u+jUvCkMuRb2UMKzO/8dW7M9jjUbxC3X0h80D0dJs6E/54O9Ibk fyQWbx7hNbSg257dLzeXbIbzeuwPOPR3/00ATCxPxP117j1AULU5jpme95XmYOmjy5z6 9u3gUftzL1HwXYFPA5BBAcI+k8rckSD7xc+G0buxM4xYx8OoMvdDkIMJXHVKhW/ZHLTo /wVMTnUWb28w/nodf8x3IYL+igvilG31rTwE2O9MUWaowO5IVldUxCDIpZtAFWmjZQRQ QcyfigUegr02P03G1pA+hQu29+AlPcdOoO4unv09IT6a+CsGBXA7tV08ikyqcfkVxS0S GQqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725960037; x=1726564837; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RXsLDtSn+yuIut/V8TcI/hXin8AlEwPOWBtFyFIn58w=; b=xHQu4h4POXo0DLY9zfpLOwJbqKFay9+FVS1NLYmwqLivhVQ47MqdYWbgIv0zVOkU30 ttQs4CIHxKS2eQEMVFhrHNXN1pZ5mkbsQ1Ztp22cv9OfFU01rfzu3HejD0Jwbyln9GyX kE4ZveeYMM9f45fd75XgbfwbiKNesYqeR31XInKzQfFRIVgacR6a5yTvJfNlKZuGv8mN E701et5YepR+PGvq6UYQ1xQeySH/EwNPFQZc62eLZwx/wRvMjhq/zsfoIlWzI5AtKZIt OxFVh358KIFhwNC7G1lRs5nr8rWdNQ+PaLYrmXMEa0TP55ZNTyiGPRecvS6EFnuqrSKf KJig== X-Gm-Message-State: AOJu0Yx3GYct5drfuAiUIXaqfEWhnTaWJ4Ro8OWKO0XgGeDOZJbna4Nf x/mdN2HD4MD14bffQWa8dYqhpy36in5Urk6mlXxarS8kga6S1Y2O5oWf06reA+7TRBoXJj4+OPl r X-Google-Smtp-Source: AGHT+IHHpvrIJWbl6Q5MxRicMLGqEzo3EF+EmFPmoBq38YRxMYeivn9QWUmBF+RMsbE0R1smotxaig== X-Received: by 2002:a05:600c:3b27:b0:42c:b81b:c49c with SMTP id 5b1f17b1804b1-42cbddeb447mr14614805e9.10.1725960037256; Tue, 10 Sep 2024 02:20:37 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb099acf6sm101256245e9.9.2024.09.10.02.20.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 02:20:36 -0700 (PDT) From: neil.armstrong@linaro.org Date: Tue, 10 Sep 2024 11:20:28 +0200 Subject: [PATCH 11/13] ufs: Fix debug message in 'ufs_start' MIME-Version: 1.0 Message-Id: <20240910-topic-ufs-enhancements-v1-11-3ee0bffacc64@linaro.org> References: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> In-Reply-To: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> To: Tom Rini , Bhupesh Sharma , Neha Malcom Francis Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io, Neil Armstrong , Bhupesh Sharma X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=648; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=HYT2AgyXY0azFUgq+gGCV5dPIL9lk8/Aii9/9kmWuwQ=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBm4A9aBVv3XdB8WlSGua3C3LvARLTz9XhlMltEHJBH oYwba6qJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZuAPWgAKCRB33NvayMhJ0dUND/ 9ufVb8o1Q0HzaT0TgW1XJRsDr2xmJn7F6T1f9dR61jzetyyvtlZzD/rlMf9RPVAzOiJsS2cZvgebqK 5P1UUmixxD2B8ed/VzapQcdxaaJdwXvw7oBwc3VSd61OH3AyvSgOlmLBhzBypXgd8NjX9kduDDLLVP FqVLmIIE0U0eG6xucjgdwKsUfJbSGHFg3s1jvbqwDQ9DbPI9TzU4fY3taoZLHeV3l/dNG8fXfsdDp7 SB/6cZXpGwxmP8wplC+d/h0f/4yEu0K7z5onYzgDIAUajQNzumzyfg92Esjh7cfjNd5XJTMPgjQL6m qsJccvTf0naf3QBRR+2KsIYFb2EW0WxFVSSj48CEmfMgPsRM5lCby/9aOGROCmw5H5z5jB9JZGwF0M Q4cIC+EpCUVdSIE+2JZY2N3qMqDWScf8GRDkfBh+wSXoPXu/rcltaljJvAkWBkX1o/ilMkRVmTw2T+ nrwgehyfB12wDIqSsLCBmm6qJG6VbXQVyqBjgb7TP7Don/JIbJ+zieqS/HDlMkSm8ktBegxunE2u5y XmtihXYQO5sHsCY+WOf0I/e6vSoLAqGSkp3ugbV38s50rLuufjWVeTsUQ62uWx8SG97WI4wx1rCUZj M9njcbJlpdtjx3xo1a30YxfTfFrI7jJmekTBeZ3NnqmA0ZSPQIJ8kF7OVo7g== X-Developer-Key: i=neil.armstrong@linaro.org; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Bhupesh Sharma Minor typo fix and rewording of printf message inside 'ufs_start' which announces the availability of the UFS device. Signed-off-by: Bhupesh Sharma --- drivers/ufs/ufs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c index 5d4e5424358..d2df5c26f76 100644 --- a/drivers/ufs/ufs.c +++ b/drivers/ufs/ufs.c @@ -1925,7 +1925,7 @@ int ufs_start(struct ufs_hba *hba) return ret; } - printf("Device at %s up at:", hba->dev->name); + debug("UFS Device %s is up!\n", hba->dev->name); ufshcd_print_pwr_info(hba); } From patchwork Tue Sep 10 09:20:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "neil.armstrong@linaro.org" X-Patchwork-Id: 1983075 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=Q4ITwJzv; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X2ysc6nW8z1y1C for ; Tue, 10 Sep 2024 19:22:44 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8839D88FC1; Tue, 10 Sep 2024 11:20:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Q4ITwJzv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A1E7A88FB9; Tue, 10 Sep 2024 11:20:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BE02688F73 for ; Tue, 10 Sep 2024 11:20:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=neil.armstrong@linaro.org Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-42ca6ba750eso21825755e9.0 for ; Tue, 10 Sep 2024 02:20:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725960038; x=1726564838; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=5R77FTIvtPNu08lHr7vGlHnrY8zzK4MdH2DqP4QqLdQ=; b=Q4ITwJzv/E+LcDWtCkVgQaOR4GO4SUL5rWWmfq5ATfumJ12KVz1+0stK8uhhE30QU1 Xq2k8NNKEjUWNN9l8h2OxCM291R1C2BNciYP0vwfE+5og6jGrupfvy0voNlYSsYwakPq b5Re3rYLWFLUFzlYd6i1k/rg8pXjEDOG9CZRcnVlpNTi4OYagxdllAqOkfJ+ecEI/RxK 9R9bwQpdXPlrquHyA5rVSuf6TQd980ApT2INHVjlMCWXtVaZ/RCboBpXJsXZ8uWs15ON kYRpBNR+E5YTn+S5iTOgztsge+rif79VXzuKggh0Ii8bSatWy/1WSD9wycrXErNEJF53 tlNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725960038; x=1726564838; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5R77FTIvtPNu08lHr7vGlHnrY8zzK4MdH2DqP4QqLdQ=; b=W69NTPkOELB7OEIT/3YEhVIPqB4wROOUmqZ+ntO/UB7FkVsy3LjCT6yfjIqaEP6Ylk Ibz9gbYO+EBq8RyGBq9gZ/1F0i8pBdQ2cn+TdlMy+g8WvcIYXA/D11YXCos7+lHN+tyR fZbkLjMKPpoX8mQtO3khCHSeFRpWQW0zcMRq2LMAljojZp+5fbYiA+xelw5w8tZ3mOXL ZD6LmNFkueAfJXE73P9BljxBRqyfAsAAqwcUH7lBX91YSdBmxDHidkKssCYEaSaE5Y6v EDS8TfKAjaxc9Wh4auLcppE+P6iq5EOfYYWXXgnM6/EBTWssDIwd9wgrfobsPoBVigFj a1cg== X-Gm-Message-State: AOJu0YyoNRHhDncYqcTf1vrNnBLAxAgpEkOavKs+msTgMEnXlt5dCrAY Vl3ItHvPD/rO05RivwfYkgJTN9jVGITkOh9d7TaJMgVrwy86lPJ6zwbA68jX/Ek= X-Google-Smtp-Source: AGHT+IEBvVe/puofqkx6sxa26WEIyjLtFDg6XaacrzLz9XpMtG2Zui9jayy02bzK54V9wSaqgDETIg== X-Received: by 2002:a05:600c:4f08:b0:42c:b54c:a6d7 with SMTP id 5b1f17b1804b1-42cbde1a7b6mr13899315e9.14.1725960038071; Tue, 10 Sep 2024 02:20:38 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb099acf6sm101256245e9.9.2024.09.10.02.20.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 02:20:37 -0700 (PDT) From: Neil Armstrong Date: Tue, 10 Sep 2024 11:20:29 +0200 Subject: [PATCH 12/13] ufs: core: remove link_startup_again logic MIME-Version: 1.0 Message-Id: <20240910-topic-ufs-enhancements-v1-12-3ee0bffacc64@linaro.org> References: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> In-Reply-To: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> To: Tom Rini , Bhupesh Sharma , Neha Malcom Francis Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io, Neil Armstrong X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1234; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=NrIM0ZBahJTnOEZXBhlRGdNy6U8dDMrbIU2LDji0hxk=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBm4A9aUhOolvgxKvpxtsAo2w+OO3eef2gtQ1ljlzB6 r6BIojGJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZuAPWgAKCRB33NvayMhJ0XH2D/ 0fV7p0ujSUyT3mzPtmxDpVu6QuvyvQGjaQ7ImIn71kpU5DLhSbYw4yovTa+0Aa6V1e97yXJ7f6TehB VWbPGSDbqYcAydyo+Wsjjt0u4GcwQHYgWJsslZkLNM7xtb2pEznhBOlx0/OrbCKfAPlYwVtSSf1lb+ sbik85E5WhXb7KMXczlmtf/d8L+22F8kkwhj+HP5xj5XvuK3zdyUH4WDbBZgvLw1TAx9XKOGkFmStQ InWZteD2pv5TPPHz1DdKyk4Nl2h0bBCucResnkmEI7IAcwhCmGgT2zFZRcw8UAsvfTB0f3yej3lAjn T/JbATTSd+MOXK/9ebm65kQQL0mWN3nQJ4v6fyxs6sz3fW4A3DleoG8OMk4+afQRb3GxNoKzzoXAaM W3Z+UQxAcllTpjTO+ro7hmD14tIdNtQPKQUjTnpawwp6fMxHgzyJUQXq1iizbn4krCY6oJtTZah+eI zrQGlmLMjc2D/v/juZdl4YbLbKUjFXxS4ZVzg/dp6dW5LIqtcU3cnT3wzD+D+u2YUBaG1UWnEupjJ4 7JQpf5oCWnkMREPgpVQTzETUmdh19+pw5M7yghSJ/FTd+1P/1OHmDNpL3qY4zhO+4ZzzgaCpQus91V K/woFGvfKbOcQ2y6rGbNGWzCEYS7tYZo9Gnr5cX9hwBit1oIvktFxVXr0U0Q== X-Developer-Key: i=neil.armstrong@linaro.org; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The link_startup_again logic was added in Linux to handle device that were set in LinkDown state, which should not be the case since U-boot doesn't set LinkDown state are init, and Linux sets the device active in ufshcd_init() for the first link startup. While it worked to far, it breaks link startup for Qualcomm Controllers v5, let's just remove the logic. Signed-off-by: Neil Armstrong --- drivers/ufs/ufs.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c index d2df5c26f76..e34e4586224 100644 --- a/drivers/ufs/ufs.c +++ b/drivers/ufs/ufs.c @@ -462,9 +462,7 @@ static int ufshcd_link_startup(struct ufs_hba *hba) { int ret; int retries = DME_LINKSTARTUP_RETRIES; - bool link_startup_again = true; -link_startup: do { ufshcd_ops_link_startup_notify(hba, PRE_CHANGE); @@ -490,12 +488,6 @@ link_startup: /* failed to get the link up... retire */ goto out; - if (link_startup_again) { - link_startup_again = false; - retries = DME_LINKSTARTUP_RETRIES; - goto link_startup; - } - /* Mark that link is up in PWM-G1, 1-lane, SLOW-AUTO mode */ ufshcd_init_pwr_info(hba); From patchwork Tue Sep 10 09:20:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "neil.armstrong@linaro.org" X-Patchwork-Id: 1983077 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=kzE+mWda; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X2yt24QMnz1y1C for ; Tue, 10 Sep 2024 19:23:06 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3F18888FB8; Tue, 10 Sep 2024 11:20:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="kzE+mWda"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C15CC88FBE; Tue, 10 Sep 2024 11:20:45 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DAE9A88FAA for ; Tue, 10 Sep 2024 11:20:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=neil.armstrong@linaro.org Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-42cb1758e41so24603675e9.1 for ; Tue, 10 Sep 2024 02:20:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725960039; x=1726564839; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=eXgKvKziNCDVpM542c0JIfC8nrp074BX8CGUocIxGCw=; b=kzE+mWday/i06JWRX1XRDep/KiN62fr2/nhfAecpfq8s949AqIdc+QRRnw9ozHs5fQ 6Qpu3WmystnrY/9rNB2py2NIy27rGAtWbpWhfXf8cW3SoHZvr/vx5Z5uGzxbVnLDIdSx HHBL41qDWUrUyRMQZ57xCQLrSwhxe/xGThcHApaUk/kTxQM2PulbgGxJalCOljABsCH4 1L6DRvuhGBI2cmEjrepC6xYEWm/xnWm+RaaPI8NRDOKIgBovmQEuFrxhaoX9Tg54M4ZD VkySw9h1Tuqg/S3rzwRKr5ywmNMA338Gha54R2h6B4wZB8WTVTlaMExwBxE4ZGjghJoA bArg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725960039; x=1726564839; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eXgKvKziNCDVpM542c0JIfC8nrp074BX8CGUocIxGCw=; b=v8AkfznFVF1ymRGZ1/o/wQwZFw/iTv1REaoa97eTX5vpCUVXQ5WJsPk++szN2KyHU0 OVHcfCUU7oMiBSnHlYlnaOcYue05ujM52+UPVlNdsrx6ZnDkylP60DiMm0veuE4DzYvs wOv9/NwILpRkssheDlaKPC8EDDUyXhqGH2aR2mJwUGEjammMezczPDlHj5olIID2LeB0 /vTLPxV5c3vRQcwp51WSOnrfgOnUzwpYN1fx9SM3lpKyddm0gNE+XTT0amuGKJuPbqnk QHtZ4AXL1pr49V7REgXdbMka8j2YoiJUJhUiD/CWzKG8THyB+IE4Sir7V3XZJxZ3E+jO lXwg== X-Gm-Message-State: AOJu0YxcYcvdyVFNq/eJ7NemI98fq83LFv/HVSZZ2BhAvaSnEQKo3eQ5 7N0mBp7Ww5c5p5dAa2ysNZuaZjWdb6qbZIlBNYBwpUguRP0i3KHH7YYMz8WM/z3QRRl+8thJ37M v X-Google-Smtp-Source: AGHT+IEcfFPGeJr9ZN7vO0CWayr1GFbC8XmffzKCz907KBoxj8xmISWpEBzZ1NvRGfbm/cSGBHy8Sw== X-Received: by 2002:a05:600c:4f88:b0:426:62c5:4741 with SMTP id 5b1f17b1804b1-42cae70a06bmr71771985e9.2.1725960038916; Tue, 10 Sep 2024 02:20:38 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb099acf6sm101256245e9.9.2024.09.10.02.20.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 02:20:38 -0700 (PDT) From: Neil Armstrong Date: Tue, 10 Sep 2024 11:20:30 +0200 Subject: [PATCH 13/13] MAINTAINERS: Add myself to the list of UFS maintainers MIME-Version: 1.0 Message-Id: <20240910-topic-ufs-enhancements-v1-13-3ee0bffacc64@linaro.org> References: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> In-Reply-To: <20240910-topic-ufs-enhancements-v1-0-3ee0bffacc64@linaro.org> To: Tom Rini , Bhupesh Sharma , Neha Malcom Francis Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io, Neil Armstrong X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=696; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=NV/1x6jD/OQh3su2pTY3i9G6mDTz+ecb8+ZFijMmMPE=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBm4A9bQ2/UL3ewyDN5cuG4HTngg+jF6rQcQtaW2bWC tV4BJbSJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZuAPWwAKCRB33NvayMhJ0c99D/ sF1n71M0kzMJqxVAP3pYZqcPiZdLOrmlmUtoF21cE/fvxTG6htDEQ8B9HmHOzyqCij5mIp5dBE0VLh d/LWl2DyOhQlEqJyXf1hkvUMcbSkiXnNdslIIIzTPc4eRyYA+HXkuJ11ndGmdyHBuYB7lq893YYtN2 fzopyafTcwsPUm1S+M0KOUOF0+WDYCh+uyfta06gRS+eejSowzR/nhJNx1yT+NnMzKAaMWyz/tAM9I tCnl3z8ediNiPUnR+Diqd5aa1yliY89kU6gn/iqSsehhdVZxHZKo0EHpG15j3W8uUL+oXPiL6hDYNv kvp21hRVevG/SLOp8AVTGXK9j/nTq+kIXlYvylhIqtGCiVe09AFc9o6sndoPeXJvBIZM4hGQWFIS+p LCEWm+opu+r2L4yrJwCkdMMvsvgqGtOR4lXOXs3t2Wf67rRZVYYEXIMKOz065Ohg3X37yeetrijSOp /U1tPP2SY185pnP8G1Nl2sixSGvMO0oBVqy4vWZvVKwIssXrmQaQ0nUWL2LnhXZbtjk5r+UPIUob9Y 8L/NiBdPiTgDpp/fvosgcyzBvCeS2e5/GVwB/NNKSLo8V5QXkFdMdVGYzGE4RwchJxM9X8+vRE9Apt LgS6PMLtgFi8w0kMGopUwG19ssrdIk+V3Qf+v39VQv6WlVbGnY5LMGlDMZcg== X-Developer-Key: i=neil.armstrong@linaro.org; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Adding myself to continue Bhupesh's work to enhance and fix UFS support in U-boot, especially for Qualcomm SoCs, and help review patches and maintain the UFS subsystem. Signed-off-by: Neil Armstrong Reviewed-by: Neha Malcom Francis --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 7ab39d91a55..14809c057c9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1707,6 +1707,7 @@ T: git https://source.denx.de/u-boot/custodians/u-boot-ubi.git F: drivers/mtd/ubi/ UFS +M: Neil Armstrong M: Bhupesh Sharma M: Neha Malcom Francis S: Maintained