From patchwork Mon Dec 30 10:30:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 854236 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp6361815wrq; Mon, 30 Dec 2024 02:31:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXZsRsgyYx3DaKqD7LCxazUh/6S9iLcOsMJvlIARaE7Wv9gmNGqmudbVgCshJAn9k33v6b2Gg==@linaro.org X-Google-Smtp-Source: AGHT+IESwka8O/VnbGPllXT9A7pEMcUSdVr/J7OCy9QDr/lwZFPkxXDSO13iMAPIzREFd9suNcaz X-Received: by 2002:a17:907:7f13:b0:aa6:ac19:7502 with SMTP id a640c23a62f3a-aac2703a601mr2522287366b.4.1735554678378; Mon, 30 Dec 2024 02:31:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735554678; cv=none; d=google.com; s=arc-20240605; b=jlM3fNnl00xyuiIlPwgRfhgqAljg+s8j/12xiv0cy4Djd5963XC86o5fKzWYIl7D5v Q6VRcjhtS1rFHswYdyCjgmWlZvtGdsSMoILMHv4NqkkEDtPrNlAZfHT1B1d+3wxKcBmn 7IERsI62YMiWoRh0WA/yMxFZZfCtzCiIO7bOa0rFgkv5kCPCgG3YaIGArxB4kH4R6x5p hkYEeqJuR/2LHB57KLEBCdGamXYZpmhWRu/K9P3OBq9IRoThP6VajnSh9fjNh3ZM/tK9 MdAXONsqM5hetqoA/EoE+UCxtXRxs/EfEkuq2S6ybbWlxzAWU3c6xEueypWaOct447Df qk4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=BHtk41PGmmkmjRHwkyCjhxhd66vRvgl1XZKtZTeeTbQ=; fh=jdqo2GKIMEMttXZ902jicStjKrqhMDJgqbEUnSXhFLk=; b=FqkG5kS87sQid6Uj4IjoKwZI0uPcaiRLDBNeBazv9Dnd7yRNtT1UGO5cn+uz8b9ymE AiMDRSDWNACyW8HzBEbHbXCbVnFStalsUkUwWVRKY3F9wCH64f8EFR22bTmSEv0ZXfCY ICTt/erGovclGeKkUrq6Ena17a3H0ebHsV6C3mMpxbt2rE91Gfaz5Jw80q0p24zDbwfK zjn2FUdqNn21bslI6JQpHP6RETJwqLi9Xz0T9FpmyNZ6tpxQyz06aBQ512UBrSKE49WQ wzc4bmn8dbFUShL9mPtjKCK6f2WWRIMAAHunHpg+40HEi/yLSPZmgUuB4b9085fKey8G tGag==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FFiK+Q2y; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5d806ff542dsi13763927a12.393.2024.12.30.02.31.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2024 02:31:18 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FFiK+Q2y; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7347A80607; Mon, 30 Dec 2024 11:31:08 +0100 (CET) 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="FFiK+Q2y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2443B80570; Mon, 30 Dec 2024 11:31:07 +0100 (CET) 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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (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 A0FC680584 for ; Mon, 30 Dec 2024 11:31:03 +0100 (CET) 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-x42c.google.com with SMTP id ffacd0b85a97d-38634c35129so6911368f8f.3 for ; Mon, 30 Dec 2024 02:31:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735554663; x=1736159463; 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=BHtk41PGmmkmjRHwkyCjhxhd66vRvgl1XZKtZTeeTbQ=; b=FFiK+Q2ycZSIBG01eUSSpZ8H9AVx85NCqxELLus5JlUwj4/bTZm48XEUOqKGFD/seW Sq0DRX/7JcKO8DBAi81HyKtxaQwJXsaIriltVoiWX8aw5S4okKRvmFQuz6CwLpYC+NBO +mnnNcbg2HL1Pak5uB7P3g5GPZdQqMIuw4tO/Vr8z/uXL4cLcydIBHTucExzPKfPStrD jYIzwDRLbeISvM2TH25p0zIYS52HrO8BkRczeRjzvWwFaPx+5nqWXtkMLsnyzSOTo5by 5Q0lM/+R59t/khxgNvSnIuGy3thOnVe8e3g8EC5l7O9ex7hecjMB9AEeUV282OepMGd7 xgxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735554663; x=1736159463; 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=BHtk41PGmmkmjRHwkyCjhxhd66vRvgl1XZKtZTeeTbQ=; b=u9EJgVGRb7AUiM9C5aFxxCUM5ACv5w8PLgO3no3hZg51/8v+LkiVL4GxLfDrngkTVi gvQgyCNntLoJoMxZnw8OobeaZTo9Udks6Woz5sKblDIi0fsVbv+PoKH1WSHqdhcVcns0 jRkoMbf0vUg+LxmxNwTGkQTsLm7AtlLO/8kibjCeENdiXN3Ny8W0ld9RTJFlQNtEXC7A BsO0gZ4fM/SiMYMt3+17ipMlmDijCLTmp4RjZTGupoI+gQCURr0fFFajhIKorhBYT3RH YwSUv+rRt8ZHDWgnTsdu2OJsw3Mo60Y5aAklM2OYFB7/DrZxOmLldURt+8lyMnpkczMs SmKA== X-Forwarded-Encrypted: i=1; AJvYcCXpvq/thz6HzerG0mIGTZH0Vy2y3nfVQgnYFg3oUHsdqo4vFlU7FPVm3+DyuD8xUTql0uAkDAs=@lists.denx.de X-Gm-Message-State: AOJu0Yzl9DKY5Q8JySJgeOmsftigh/ouCQPHaIx4f2DP41m2wDqiOjXL L3624Wyexc/c34O06E27aHJpRNrqnvcnpFQ/zgITRhwlBbrLXMZZr1E3sUUGDiM= X-Gm-Gg: ASbGncsO90gMKXiif6My0nIZ1f4Psb3xDqukta7Z5pEXibdt7Cifrs1b5grUQSH26YS j3xzUfWuKHIU1+mEv/Y6gZXC/wap2SK1Z2ooMKJNHIqRyVNa2LDLklN16D7HCOrUIziNtMiLH+S s3E/NwNNi4eC//1OBj1U9mEYhOnrcGKhcqVfH4apXuVQXk+EOB16PpOVedCgdIqC2/8EyQE9/X+ bqVarTmoZC0i0NbNI6SBeYSeQTPrNmF0cChYBpx0sMuCumFlcJjtssec1ZslbOudYSYD2FAPKRy Gg== X-Received: by 2002:a05:6000:470a:b0:385:f092:df2 with SMTP id ffacd0b85a97d-38a221faae4mr25452287f8f.34.1735554663114; Mon, 30 Dec 2024 02:31:03 -0800 (PST) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c89e1c0sm30201550f8f.77.2024.12.30.02.31.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2024 02:31:02 -0800 (PST) From: Neil Armstrong Date: Mon, 30 Dec 2024 11:30:55 +0100 Subject: [PATCH v2 1/6] ufs: core: include missing include/ufs.h MIME-Version: 1.0 Message-Id: <20241230-topic-ufs-cleanup-v2-1-4c6d7994a45d@linaro.org> References: <20241230-topic-ufs-cleanup-v2-0-4c6d7994a45d@linaro.org> In-Reply-To: <20241230-topic-ufs-cleanup-v2-0-4c6d7994a45d@linaro.org> To: Bhupesh Sharma , Neha Malcom Francis , Tom Rini Cc: michal.simek@amd.com, marek.vasut+renesas@mailbox.org, bmeng.cn@gmail.com, venkatesh.abbarapu@amd.com, u-boot@lists.denx.de, Neil Armstrong , Love Kumar X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=680; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=RHVI7HSvOhLHRjblsuJdLs1Erdv8Ou1xxclndVeJ0Hw=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBncnZiUry+hUqKSZb8liEDnOe3MUpB3i74UqYeBTCL PLOYHjeJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZ3J2YgAKCRB33NvayMhJ0RLrD/ 921xRnkUnVYmRM/cqpgYkPucVap96EyV2wiliIiMSrzR+ecwA+BPIeBVOA/A54yAL2778OWwUqg8Ep m8b+9iVhZv6eQY/r3r7o3WNSvec3xW1A6je8GagrE6pvpsvjEkxXUsoEmHQUbVVdVii63JYAUC/Ycz rPZf/exdOqcuCvvYOv7IXDoXUio2zQQTr2md2HBUQeknzkXQM4PCg6U0Bkg0QS3BKsTJQoROY7jxEy bieO5UQa/4zlmbRkr3lUjKsWJthKbQfVxsUIVFi09aMIRG6wd/eEVIqSEvAbAkBZZLy9HYMWEVkasc sfW7H/RgVu4I6IZO1JVSs9BfMLWCdcFHvoeIo3TKWPcnfewRNEKw3XGaoKJP+QyIko8fdG3RzUh2XG tminNa6z+ZgCcqlYnOZ7Na9Ra/KLqEQ7CmEjQanswPhnDc7mumBf/QUNfRJ/lOHFaLvCj/mhAS0rQg F8YIJyaOsNt8sEGMi5uDzdU/Ze8rdWV9pHQeDiR/jrLCc2CgeHPvSkISSo0N6THQIYLKV5vZRL8UWQ FDo33h7ZRD1SOjZp1a45J0iT8HlMdIAUU79WXsgFr36/pml8kjCvcPAyJiDP5YjAxI2nfOEfHK4mT1 L7e9v3gZ9etpAiUUNF8gzwrGv+knYSbZZi6Yx38nZSK/W2kRdOGTAFRCwGww== 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 Add missing ufs.h causing build warning on some symbols. Tested-by: Love Kumar Reviewed-by: Neha Malcom Francis Signed-off-by: Neil Armstrong --- drivers/ufs/ufs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c index f7d8c40c448c6865b7c04e03bab6f3f93a44a591..31c2959aeb12931b2bbdf26b3c676ae1a7b0fd1a 100644 --- a/drivers/ufs/ufs.c +++ b/drivers/ufs/ufs.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include From patchwork Mon Dec 30 10:30:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 854237 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp6361850wrq; Mon, 30 Dec 2024 02:31:26 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV4CZBzwcLsoQFgoCsFGnwOXpq3vtCRB2Y13MXRLg24og9oxI+BKG9yB/3ej60Jrwgc7MRULg==@linaro.org X-Google-Smtp-Source: AGHT+IEe2aNB+YvkWYvwFumkbeFF8nO9OrnBm1blzxchTq4CLNjNwrPUGJDATtY4kE8bHA0lf5uY X-Received: by 2002:a05:6402:51cf:b0:5d0:d18f:cc64 with SMTP id 4fb4d7f45d1cf-5d81dd64086mr31139926a12.4.1735554686141; Mon, 30 Dec 2024 02:31:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735554686; cv=none; d=google.com; s=arc-20240605; b=jmgXzGnHftC7I5iVe6IO5QtlHrw1KYwYIGN3UuzX6Hb5wZxzllO7m1M6XPw0F+fmaA GLmKsq70BcnyCKMxtrvLOY5xI69PlgpxulU0rO25X5+ffdLsC9J1NnCMpmvTf+V6vuFD kQxA/b2urLiaLjbAIY57jvF+dNQWpoNze0jqKljwfWOJX6i8cQmoAfxpLJBfZbZrX7TF vsC3kFThIQmUL6bTLLsBKWKctlYWvOKrmQ9N0tIt967kCINz1qv1VF/G8mhPvmn2TrAx HwM15ugLYNDWCMjc6Vnva8oyMfY4C9aSxo6aeOeA2Nl0a6qf2VUFPBtJToIsaNQQg+2N a7lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=5KWtDfUrleNXQMS1nijml6OAU847GUFzOHAdGU0C2/g=; fh=i1kYOAvAkwCRP+UewwqwxFDTxi/BXf4lPGOlav0sOEs=; b=iHYv8LmbHcu60215XMKwzo8lDU5S8b4kviuNIiQnJRNmDs4NunhcSykLJlcg+qHOj3 J5bpcMST8j4LgGDsRVTsfbG5ynNbLNfZxCL7L3S7Wqvk4VSdsBQS3GEQPWGUVzwoRpkS oZc9e3Cn4Cfdfel2GXCiZAVdlp65cLIJPneYtn81trcOgEHepf0ABkmf8OCAG/fHnfvE L9HqN9rVtPKEUbCB5rPfUb1yljxXdh6+Nae1C4bISPiCXxhfIgRcWdcj55iQzdW1HC0p 6NqdXFdsi3fgosan1/+IeT+nq8ZvAjSf/I+Jp9JqaekarB576IKPME+WgXhr5Hl+Jb5U GYsQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="fc8FG/1u"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5d806fc8afasi14158655a12.278.2024.12.30.02.31.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2024 02:31:26 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="fc8FG/1u"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C5750805EA; Mon, 30 Dec 2024 11:31:10 +0100 (CET) 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="fc8FG/1u"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C3B3880615; Mon, 30 Dec 2024 11:31:08 +0100 (CET) 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,RCVD_IN_DNSWL_BLOCKED, 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 76524805EA for ; Mon, 30 Dec 2024 11:31:04 +0100 (CET) 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-4364a37a1d7so95857355e9.3 for ; Mon, 30 Dec 2024 02:31:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735554664; x=1736159464; 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=5KWtDfUrleNXQMS1nijml6OAU847GUFzOHAdGU0C2/g=; b=fc8FG/1u73bwoFH5ot96gWgf0cTXWovbsssnWM5ocr13H7E9K7HZWRTJtHy858AZng mJcpdQ1CXwxatktgzhKdcZcxQX4TVBIYjCAFuyWOmo6ZPD9P8Eb9JosrWz8XXP8UX3mY VHg0YppCJlMMczc2yi37zT8wVw7Xx9hKTDKR6yzkvaA7swH9GyMG6B4f5XSKlqir3vGZ TpuGFWAK8sdphzv0Ayx2FdXbsIqMrs1N6ZvlJDP69Xfi9audfmHLzy0lQ14FgggXJoA4 IOcdiw1syopb6P/vsa2vmqGZLU/j9Vyw6xKBaKzx52sczmZ8pNNl1mat7K/99KYVEDy+ i0sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735554664; x=1736159464; 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=5KWtDfUrleNXQMS1nijml6OAU847GUFzOHAdGU0C2/g=; b=UTxIty3VVGklBEIuyI4SXcMduHXtvRE4VRsZH6dcMybd3gQT0u4Jr3JgkCMzYrl5Ii qQP3aPYT/LwdC8r+G473rDkDHKatqB5XCFQjJu/BF8GsvtKh3r2bThsV2Of2w/4auvsK 2mU/DiyXkoHCSINVWUiGCiJg98QyhijQusRBs6ZZh1ZhFbdD6XS95TgcHQvCkiG8aBRC nyOOEfFiczZwOTooShJD0NRpxXBe8ABQESNa4gEWiOcXh0k2MtxisQCM5U0Ra5qml47+ E4ZaRW2zoBMOWuaqXeQ3ogZdr0fO2qw/3CQE7qzRpxkX3L37KMS3+PrqvNujDFpWQsCw +i3Q== X-Forwarded-Encrypted: i=1; AJvYcCVrxQDqvwypK0zcG1NLYMNLsw24RKWnVqBiJPjSN0WGi9Cavy7z48jPqC3xYThYL8s2lo97sQk=@lists.denx.de X-Gm-Message-State: AOJu0YyMkLHEVZj/zDjro+iSRmOF0G2HoBSV0pdSxPCttkR+b/uQ4u1l NR5yw635uvVI2T/ZXXC0OpDkezLlUwbIscIickxMea3FERoOAOgck33rRChEWRg= X-Gm-Gg: ASbGncvTZ2Ex7yF053ceAbdR0PCDoH3bwVYUHgewG1UlAMlktPlV0jXUTahu4VGHXXt CqHLxXZdR41ypWX9cbEZfaZVEg0VmAQNl0+aOk+GL44e5bPt1N9B9IWag7qc8k/kGrVWUtZW82k mafy3GiWeQNlbmenkEHESb7GBeOnYociErvZzLeVvlF95WMfHGf7qXpjg4/sV1uHyTyKJH1lv6h PGcpgEoKdE+pBNmYBcZxbglX32z+B4IcmyATT3yYU3321bA5sYwX9VvGhyXV7UwSjyyCsrkYfqu LA== X-Received: by 2002:a05:6000:470c:b0:385:f5c4:b318 with SMTP id ffacd0b85a97d-38a221f9186mr26104915f8f.31.1735554663972; Mon, 30 Dec 2024 02:31:03 -0800 (PST) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c89e1c0sm30201550f8f.77.2024.12.30.02.31.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2024 02:31:03 -0800 (PST) From: Neil Armstrong Date: Mon, 30 Dec 2024 11:30:56 +0100 Subject: [PATCH v2 2/6] ufs: core: mark unexported functions as static MIME-Version: 1.0 Message-Id: <20241230-topic-ufs-cleanup-v2-2-4c6d7994a45d@linaro.org> References: <20241230-topic-ufs-cleanup-v2-0-4c6d7994a45d@linaro.org> In-Reply-To: <20241230-topic-ufs-cleanup-v2-0-4c6d7994a45d@linaro.org> To: Bhupesh Sharma , Neha Malcom Francis , Tom Rini Cc: michal.simek@amd.com, marek.vasut+renesas@mailbox.org, bmeng.cn@gmail.com, venkatesh.abbarapu@amd.com, u-boot@lists.denx.de, Neil Armstrong , Love Kumar X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3279; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=7Ntx+ovL4LMYDY80gnDbfbqsbq1KGnnMMPEC3UEq0H0=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBncnZjjFpN/LKB82U3aQuF1zW1YoG2xY7YVz9yKJyQ T1xO8OeJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZ3J2YwAKCRB33NvayMhJ0XsLD/ wNHngWLIdWyWFdnZofJJFu2zP/6KFxviIuHEB3dMS8ET+izeFDBXQiofcPBn+KKT1OPSSZwhPg/DOG exRP+/FuE6NN8ILESpcfzZ9jz7jLjOvzW+fWV7En7/15An3/iK9n8KvA+KZgstOhLUv5NpXvMlbHH5 thmUrKDSBzZsqJPPdC2nx0ebV5JfubDhdzqh/EeWIW9ViHmb5SdeBBfohIeIJazWJPgwJgiOSw+GYo 9UJPKooWXv2cTJx7n0eKRM/xCnbmPHO5+K+6L52MANMrtS+IytJkSSLzzSQm5ECojPc9sNV0Wgv93w 4+oAM7ApMZa9AqFjUDkSnexIxwc8cADEfXFQLl90lz2pNPXXz6+Wm7nRt3qmunB/jnGsPSf+tbCJ4K w1xD5ATdtIX+ljIDlN8/rM/+AdkvEPJ3FmjygmObJ175e1BDpc34Kns4v+QmdX7drFqlAveKi7VxP+ fd5Bd6oOeSHNaNhfUFTQLZMc7PhoA7y9Estw56TQ85GMUWeZxZJCuk+LABJh1ha3fXabJHyX1mngui 6wduEOmN6VOkQq4X6eQ5Kb3Amlcj1KhxRovKn4tCO93Gry5jO+E3KfZlh6V8aLzKcWtkFfjQig234z CKeBzOgDLx34k4DqtpUwef+bI6YLlLgTMHdpjmBRuYdKoAFXr3HdXV09gw1w== 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 Mark the remaining local functions as static to avoid build warnings. Also drop the EXPORT_SYMBOL of ufshcd_map_desc_id_to_length. Tested-by: Love Kumar Signed-off-by: Neil Armstrong --- drivers/ufs/ufs.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c index 31c2959aeb12931b2bbdf26b3c676ae1a7b0fd1a..654f8b6799ec6735f2db4f6e1c81ee94ec14a74e 100644 --- a/drivers/ufs/ufs.c +++ b/drivers/ufs/ufs.c @@ -1035,8 +1035,8 @@ static inline void ufshcd_init_query(struct ufs_hba *hba, /** * ufshcd_query_flag() - API function for sending flag query requests */ -int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode, - enum flag_idn idn, bool *flag_res) +static int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode, + enum flag_idn idn, bool *flag_res) { struct ufs_query_req *request = NULL; struct ufs_query_res *response = NULL; @@ -1171,9 +1171,9 @@ out: /** * ufshcd_query_descriptor_retry - API function for sending descriptor requests */ -int ufshcd_query_descriptor_retry(struct ufs_hba *hba, enum query_opcode opcode, - enum desc_idn idn, u8 index, u8 selector, - u8 *desc_buf, int *buf_len) +static int ufshcd_query_descriptor_retry(struct ufs_hba *hba, enum query_opcode opcode, + enum desc_idn idn, u8 index, u8 selector, + u8 *desc_buf, int *buf_len) { int err; int retries; @@ -1265,8 +1265,8 @@ static void ufshcd_init_desc_sizes(struct ufs_hba *hba) * ufshcd_map_desc_id_to_length - map descriptor IDN to its length * */ -int ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn desc_id, - int *desc_len) +static int ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn desc_id, + int *desc_len) { switch (desc_id) { case QUERY_DESC_IDN_DEVICE: @@ -1303,15 +1303,14 @@ int ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn desc_id, } return 0; } -EXPORT_SYMBOL(ufshcd_map_desc_id_to_length); /** * ufshcd_read_desc_param - read the specified descriptor parameter * */ -int ufshcd_read_desc_param(struct ufs_hba *hba, enum desc_idn desc_id, - int desc_index, u8 param_offset, u8 *param_read_buf, - u8 param_size) +static int ufshcd_read_desc_param(struct ufs_hba *hba, enum desc_idn desc_id, + int desc_index, u8 param_offset, + u8 *param_read_buf, u8 param_size) { int ret; u8 *desc_buf; @@ -1570,8 +1569,8 @@ static int ufshcd_read_device_desc(struct ufs_hba *hba, u8 *buf, u32 size) * ufshcd_read_string_desc - read string descriptor * */ -int ufshcd_read_string_desc(struct ufs_hba *hba, int desc_index, - u8 *buf, u32 size, bool ascii) +static int ufshcd_read_string_desc(struct ufs_hba *hba, int desc_index, + u8 *buf, u32 size, bool ascii) { int err = 0; @@ -1882,7 +1881,7 @@ static void ufshcd_def_desc_sizes(struct ufs_hba *hba) hba->desc_size.hlth_desc = QUERY_DESC_HEALTH_DEF_SIZE; } -int ufs_start(struct ufs_hba *hba) +static int ufs_start(struct ufs_hba *hba) { struct ufs_dev_desc card = {0}; int ret; From patchwork Mon Dec 30 10:30:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 854238 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp6361886wrq; Mon, 30 Dec 2024 02:31:34 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUMsTfiQIMZFclGyY47rs0HJ3yGUBuCkdijDv/n+TpJtdSkHBDoMReSPIuLhvOwOTCpsMlHrw==@linaro.org X-Google-Smtp-Source: AGHT+IEayMTdPHGj2QgfUduPKAyvpnuIVwg6YsxMbCUmSaEsAT01TzkDelArr0zarc7u2coleCVK X-Received: by 2002:a17:906:6a21:b0:aab:edc2:ccef with SMTP id a640c23a62f3a-aac080fe36dmr3186036766b.2.1735554694533; Mon, 30 Dec 2024 02:31:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735554694; cv=none; d=google.com; s=arc-20240605; b=HMbyLwU6nVSvVG17Eq+u497fvzBWXBKGOfIwNhi7/tOM5Z+MgXVwjzkmgrNDSpCMCu fBlHWKaY4m2STNHOAI1e5z6f551zvvb8oHguMKRsnTuc87+RotBqlB904mmeh5g2bdzS B+lnFV8+3h7XLdJVAFzW7vhYfpKSfnDRpilEMsfs9bDkXgcebeRqD2WqJFXFl+0rhKQe evdtDciOWgAMtzpZCyh6qjXpy3Bk97XpphjgXf6KdO3n5mZiLVdUTo14GWYnYSecUikD mEScPkXNFrvdUy97GsriI0R2xo6dOS3nt+O0N0Ljf5OhfA02DhrHVbNGyYkC+Mt3z1ba MqyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=CV0gAxLfFjdiPnKV+byW+aIIrcjIiUgNZiyDZtqpiPg=; fh=16xrXt5+1YFQ1mGM43b1trCBI63YCkEYnLQXz4kCm8M=; b=glP16weMhaJKQ3p3sCpz0Jql1UZPUNLVPzuTbeN1FLO+dkARL9iODkrSRzfEvP7UUa 421UUWnTlBG1+Ifnxq2JZx+LddxNyIeuSJEs3KrlsDFazC/uzWcfeAuwpwl92eavBOq9 SOgNa+hBcLmkNy4mAlaLVtwDLG+LwLOD8/UXkkTiC/QsvuCM1hixpJhcH3Km8+N6wSH8 k/V9Z6tMloG9++mZIWBhnAca/W0tI03Hhuje3fVjA7TXYxS60ngGHo3dui0NvDbVKOG+ dMH8mP02dDPgVqBCP6NFnga+Ksro4YbWTxqk6C9Nnb5sh2VYUWWh6oaWa7JwQW0n8iru 0CmA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ic774IJV; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-aac0e842603si1354847066b.199.2024.12.30.02.31.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2024 02:31:34 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ic774IJV; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1930180628; Mon, 30 Dec 2024 11:31:11 +0100 (CET) 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="ic774IJV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E3554805EA; Mon, 30 Dec 2024 11:31:08 +0100 (CET) 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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (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 6AA60805ED for ; Mon, 30 Dec 2024 11:31:05 +0100 (CET) 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-x431.google.com with SMTP id ffacd0b85a97d-3863703258fso5902972f8f.1 for ; Mon, 30 Dec 2024 02:31:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735554665; x=1736159465; 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=CV0gAxLfFjdiPnKV+byW+aIIrcjIiUgNZiyDZtqpiPg=; b=ic774IJVJW0uBtEfxIoS9QVG5n9eks8yLw0Hng6rbBILmVZSI3hkvDFcf28tUwveBe InQvtnLB+iSHg3wkEIBxYJ/YhZ1fSf8ee+1vRncIuFq3MBPs5flpa04cOgaEUx32NvVq N0pFqvpekdU2hMwPSssjjZJUZycRiGHmr9uqXeAJKihgX8UIy3C9DZK7EfqALKyp+Hvw v9nIKLyDgE6EFeZm0H98rLYWR5QrwNNv8vsHEqRb0ENzVKnXvYtuUFOtRS7rLIn+Oaod 3tDL55vkkWPHZ7xSVruqtB9A09QaP1R4h+P9xcMSlxzloJtY78XJb4SsEBjhNhO5j3+h YdxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735554665; x=1736159465; 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=CV0gAxLfFjdiPnKV+byW+aIIrcjIiUgNZiyDZtqpiPg=; b=AUHcgC1qCGOfdwjw+mn6VfClIhliEaOO+s3glG2fmzIng+ggITBJw6iqpjO+szrGPH Jb4qodqohOU8ijYkxoKzan1DmW43tf5o5XBH8z+YoZNkbtizKnImdAgWBO0Uo0+BMS6u l0uZqFVmgDjZfYw5QKh99bPgIk+noSM+R1tt525zcOA/5AMUwRSgmLJrvmgYA1WN0RlB AeJTLREk3Iw24iaF+B7VAfBCbIX3Fw+HN8NoMhmJurEdUJhK0VrfKVoLVXtnfvMIB8Xq Rkkf+Vcq1PfVzfJbUph9qKypG1G3Cw9A/s659zL4Jr8CMU39dVg8GANHTiKENGbu74cY bnwQ== X-Forwarded-Encrypted: i=1; AJvYcCXCz+TAIqQesbs5Jy0GMpQHkaxcLqDaftGGWB8ieRq/Taj9iMCarZoyMb9Dsx2hMlmRPthJ+H4=@lists.denx.de X-Gm-Message-State: AOJu0YxARvGDBQOYCW8ftyYO7AixeTqLW+VZA5gVYSCVU4LS2alnuUoV gcadtbPOrjN2NW8dlHdeuT4E6BHRaN1Qv5FQTUPjTSlZm6qOxDQ0qGUbm8+NuMo= X-Gm-Gg: ASbGncu/Ac6PqMBadIsRPs/3CDQOiLO697WSLUMw/Bl+aWr+Dz73TfYtt2CtPc7UGTM utp+7ntwrL9plJcTGFb+m4sDbgAI3m1cjF8Nh9c1Tg2SiP2H8RtJx2ozMsJuDSZUaEwBVkKrxC+ 93QnC7IYUrvJESZuOvKUKowfGqm8VFLQTrQ/7zecm364y5OP8PJsE6IVnGZal5QOiCUnWTjAPT/ +DBJ96aE3RqNrbzPbwXDVA2rA/bd8xr94LWYHHDXkiwsVG+3qj7L3DrRMs/3bDLMbx1iteUEai0 Mg== X-Received: by 2002:a5d:5f8a:0:b0:382:45db:6a1e with SMTP id ffacd0b85a97d-38a22a1983dmr31952476f8f.14.1735554664850; Mon, 30 Dec 2024 02:31:04 -0800 (PST) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c89e1c0sm30201550f8f.77.2024.12.30.02.31.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2024 02:31:04 -0800 (PST) From: Neil Armstrong Date: Mon, 30 Dec 2024 11:30:57 +0100 Subject: [PATCH v2 3/6] ufs: core: cosmetic fixups MIME-Version: 1.0 Message-Id: <20241230-topic-ufs-cleanup-v2-3-4c6d7994a45d@linaro.org> References: <20241230-topic-ufs-cleanup-v2-0-4c6d7994a45d@linaro.org> In-Reply-To: <20241230-topic-ufs-cleanup-v2-0-4c6d7994a45d@linaro.org> To: Bhupesh Sharma , Neha Malcom Francis , Tom Rini Cc: michal.simek@amd.com, marek.vasut+renesas@mailbox.org, bmeng.cn@gmail.com, venkatesh.abbarapu@amd.com, u-boot@lists.denx.de, Neil Armstrong , Love Kumar X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3846; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=0O2a6fVetyGy23roKN7lUNXvdabRfBfIX3Zg1p9emJ0=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBncnZjXG0uyzo+A2dLIy8pbPqYtopUj3zKE1qphNYf aExIJPuJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZ3J2YwAKCRB33NvayMhJ0Z6uD/ 9vehNg/V0EIaa+X+qPCeZ7Ssd3ImjROzwTT5coFKCNcExR3ImgXE1vnvARQASwCJxoETzNuQZ/Z6hf 8jDDWcVQTLpQQ/q8Ot/HqtR0jvwFd4lbncDKx8irvXxjQG5QiryBXj13QMXdW1PYqYxfynk+GioUPu pzgl/v0tQG1CsvmA5G7pjMuUsjrgwXAfVQL8gPDAcSOKLPgQhEN0d/lvnOsZbizF62vUlRDBN0iDNi QN/9iaaxub4NAiQqx/7SKI0CN6Lc7L0RgVk25BohXNoqO28EdCUKuJ3vzGBE4qPpRH1hLtkFN4XWhJ x1mOd6gtVJjnqhJgUplJS8aXxV15b1v8Mj8eZ+QyhKCgbFtUzH7V0GmFdRthoDram9JaBDM++cSFgh 4CsN+uJ4taxC82yOgpXpf83xOyMVh73nKZHQ29T+zZAgy2K/fIjFrJX9psAf/1R4iBFYYrU/nTzw5o iZhHNrJ4NsJ+lOOEVDh7Tf/C6BIGZJDZjJhhX/iuSBW1CPkolNUc6N78S9ppdgxhDoX0zfq3+oJpLg VfbgHD12de1dQC7sCP95CxnNe3L3Rwikw0Lz4WcXZBxMJCvcjiR7EaISpNbhfFGOM1pGgEV04cw4wG kpvFRQcx+/OsBNNGLqaEApOB3gsSO31AvckRiKB172FUsC9iBc78SOMZBPrA== 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 Fixes some alignment warnings, missing comments on write barrier, missing parenthesis around macro parameters and a comment typo. No functional changes intended. Reviewed-by: Neha Malcom Francis Tested-by: Love Kumar Signed-off-by: Neil Armstrong --- drivers/ufs/ufs.c | 16 ++++++---------- drivers/ufs/ufs.h | 6 +++--- drivers/ufs/unipro.h | 4 ++-- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c index 654f8b6799ec6735f2db4f6e1c81ee94ec14a74e..91f6ad3bfef9846aab39331efd9493b1a98432d3 100644 --- a/drivers/ufs/ufs.c +++ b/drivers/ufs/ufs.c @@ -314,16 +314,12 @@ static int ufshcd_disable_tx_lcc(struct ufs_hba *hba, bool peer) ufshcd_dme_peer_get(hba, UIC_ARG_MIB(PA_CONNECTEDTXDATALANES), &tx_lanes); for (i = 0; i < tx_lanes; i++) { + unsigned int val = UIC_ARG_MIB_SEL(TX_LCC_ENABLE, + UIC_ARG_MPHY_TX_GEN_SEL_INDEX(i)); if (!peer) - err = ufshcd_dme_set(hba, - UIC_ARG_MIB_SEL(TX_LCC_ENABLE, - UIC_ARG_MPHY_TX_GEN_SEL_INDEX(i)), - 0); + err = ufshcd_dme_set(hba, val, 0); else - err = ufshcd_dme_peer_set(hba, - UIC_ARG_MIB_SEL(TX_LCC_ENABLE, - UIC_ARG_MPHY_TX_GEN_SEL_INDEX(i)), - 0); + err = ufshcd_dme_peer_set(hba, val, 0); if (err) { dev_err(hba->dev, "%s: TX LCC Disable failed, peer = %d, lane = %d, err = %d\n", __func__, peer, i, err); @@ -1962,7 +1958,7 @@ int ufshcd_probe(struct udevice *ufs_dev, struct ufs_hba_ops *hba_ops) ufshcd_ops_init(hba); - /* Read capabilties registers */ + /* Read capabilities registers */ hba->capabilities = ufshcd_readl(hba, REG_CONTROLLER_CAPABILITIES); if (hba->quirks & UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS) hba->capabilities &= ~MASK_64_ADDRESSING_SUPPORT; @@ -2001,7 +1997,7 @@ int ufshcd_probe(struct udevice *ufs_dev, struct ufs_hba_ops *hba_ops) REG_INTERRUPT_STATUS); ufshcd_writel(hba, 0, REG_INTERRUPT_ENABLE); - mb(); + mb(); /* flush previous writes */ /* Reset the attached device */ ufshcd_device_reset(hba); diff --git a/drivers/ufs/ufs.h b/drivers/ufs/ufs.h index 00ecca350c350cc930d9056aba8ada0475a280dd..f4f042005e7fc2638ea6b33f26839c668d22bc9e 100644 --- a/drivers/ufs/ufs.h +++ b/drivers/ufs/ufs.h @@ -130,8 +130,8 @@ enum { (sizeof(struct utp_upiu_header))) #define RESPONSE_UPIU_SENSE_DATA_LENGTH 18 #define UPIU_HEADER_DWORD(byte3, byte2, byte1, byte0)\ - cpu_to_be32((byte3 << 24) | (byte2 << 16) |\ - (byte1 << 8) | (byte0)) + cpu_to_be32(((byte3) << 24) | ((byte2) << 16) |\ + ((byte1) << 8) | (byte0)) /* * UFS Protocol Information Unit related definitions */ @@ -915,7 +915,7 @@ static inline int ufshcd_ops_get_max_pwr_mode(struct ufs_hba *hba, } static inline int ufshcd_ops_hce_enable_notify(struct ufs_hba *hba, - bool status) + bool status) { if (hba->ops && hba->ops->hce_enable_notify) return hba->ops->hce_enable_notify(hba, status); diff --git a/drivers/ufs/unipro.h b/drivers/ufs/unipro.h index 6df953e6e6073748ac640faea00aa6ac2a8c8663..0aa35ef31dfd263739c0b5c75c26f9191f38e8ec 100644 --- a/drivers/ufs/unipro.h +++ b/drivers/ufs/unipro.h @@ -59,7 +59,7 @@ #define RXSQCTRL 0x00B5 #define CFGRXOVR6 0x00BF -#define is_mphy_tx_attr(attr) (attr < RX_MODE) +#define is_mphy_tx_attr(attr) ((attr) < RX_MODE) #define RX_MIN_ACTIVATETIME_UNIT_US 100 #define HIBERN8TIME_UNIT_US 100 @@ -77,7 +77,7 @@ #define CBPRGPLL2 UNIPRO_CB_OFFSET(0x00F8) #define CBPRGTUNING UNIPRO_CB_OFFSET(0x00FB) -#define UNIPRO_CB_OFFSET(x) (0x8000 | x) +#define UNIPRO_CB_OFFSET(x) (0x8000 | (x)) /* * PHY Adpater attributes From patchwork Mon Dec 30 10:30:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 854240 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp6361991wrq; Mon, 30 Dec 2024 02:31:52 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX3aDDna4RZNeYbbSKdyOft/4x7F8WPL0MXmWpY8tfSMv+XrAs2aJF2pNKlh+X6/Y2msz0+Zg==@linaro.org X-Google-Smtp-Source: AGHT+IEPdV92mpkmsmTnO8JozrMT+efNcP6W7pXU0gqt2DwBSMhzgUq3fKNoZas0bzU+tQ1lmJyv X-Received: by 2002:a17:907:7286:b0:aa6:79fa:b487 with SMTP id a640c23a62f3a-aac28a2ab8fmr3228735666b.10.1735554712333; Mon, 30 Dec 2024 02:31:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735554712; cv=none; d=google.com; s=arc-20240605; b=S30Dl3yQbo/X2DSGVV2ARFbDu9ugfHQEV7DGYR1Xar1TSCkg+bG95dPQyf1h0Nsr2V +t2mQhdRlud9aw9+FysnemdO9Jsr+lxR++SZ1UV2/aNB8/HcnWFn0yQ8E2im65V60YoX VR5hcG/vSHLLit550MoFMD2VTo2UiEXXeBC36nIjeqK5w/wDM8lzdE1wfVlEBf3ch2Em qQZwJ8SfBoZQLRVZ3m74vtQOtxwjzwWCavd10eLHtwBiGKVRkJ3H9H2DyJZn2QWPN6jJ gMC2NuLrzOjLyG9AaY9RNY5DMZ7eLDfZzD9gEBmyk3WMDcq7FrSbhWbxwfsWbLHUWkzm 125g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=rcKu6ylSdkTufXEbTmZgyoDPO7BH50wVG2uK9jnTiJQ=; fh=pM4DpsbzxQ999pTCeaSBQylMopphpTRZYkz0guLLm8U=; b=dhXAOAYn/iTos0916W5NB3dlyZs0FQNmwhR/t1gB+3etlgjcQlIBD8ja+sxD6nGc9S nu+yO4MaZKzkVX/2vHhhpe0qhyOD6o8D35sSgf4Sr7wRRKvH94izb+bEt55dy6DF61Gb 1cQv5nXLprp7WW3EyVw4XBPXVJSgCZtFhW7T4imk/bRvrntqYK63elY+7YeU7Auh+pzc Vo7vccPS/REqSuFHotnHDt0srpKRTO8akSWDhzBEErfI3O3MuYkIaQveFPtr2PIMNwOn bWpit22kKTb0j/nnw9Vi/tiOkXRpaROuEt5S7DJurYLuHglFayBLK5TJmMaJnZL4Dqxa Zcfg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=diKybOuT; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-aac0e841ebcsi1391756966b.200.2024.12.30.02.31.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2024 02:31:52 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=diKybOuT; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A9198805FE; Mon, 30 Dec 2024 11:31:14 +0100 (CET) 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="diKybOuT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4B20E80584; Mon, 30 Dec 2024 11:31:13 +0100 (CET) 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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (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 B990F80570 for ; Mon, 30 Dec 2024 11:31:10 +0100 (CET) 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-x429.google.com with SMTP id ffacd0b85a97d-385d7f19f20so4089756f8f.1 for ; Mon, 30 Dec 2024 02:31:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735554670; x=1736159470; 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=rcKu6ylSdkTufXEbTmZgyoDPO7BH50wVG2uK9jnTiJQ=; b=diKybOuTiioHn5qhpXjJMRjG7syZZBeXsPz/X1B/I9/Vpa2GJn9NfNyHI7ZvzesPQP WGhSU7p/n243eOFAJZ8WTYarweznG1cHyARJmtbzwTc7TnA2eFtHFNqYys7LiceCI/cF wtW2ZSUWI7CTfXPj4fKsDPT5q6HXT4laPhXtThABhT/LxD4rGttkL2+T6gKh3IUh70xu XB0cM4NmHwWpuYXBrlowi52Y2Tt8dPZu7YW0cLzLBjiMiFJdDHtxnJOs9A+9AYKZeJvI nee3svwvTXMlfPnWmt7s/i78Tzpr/bdkJqiIYUyrInanop1eK1WfPmS6FcEZinfnwg+n fDzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735554670; x=1736159470; 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=rcKu6ylSdkTufXEbTmZgyoDPO7BH50wVG2uK9jnTiJQ=; b=kV1Rr+NZDdC+iMRQ4sC8u5dkUq0fXndEpKAIju15uKSvcdHz6qrsX+8v2yQfSJ+GO9 H/ZgrKARe4GyBd0xK/OrGOPGZos/sgDVlja6uiBNmRvES5XvispsjaGDNTPRKBQC+3SM tCjbYqWlrlirhBXWoLzif9+N0IHJVyL21jJG9M7L7wb5em+OJRJ34iZ/tZy9cs73AQbp FUeStyY1T/Ei0YvxDAxggEg1cAl/kX8imXw/y/5py/xcQsP0ih4DNzSQfVbyMXCtPmlI /K4/ekyk77QAWASXkJ5YFltH37EmHAamr6x4Yc5ZAYb7/VRmY76FsgLym/uTtOv0ps76 4MbQ== X-Forwarded-Encrypted: i=1; AJvYcCXo89aqdW05Hx8EmDTHkGDqyt7WUVYpHIG09Wb7RZCMv9INo/TI4HdZwMy/eSThj2/24aarlkA=@lists.denx.de X-Gm-Message-State: AOJu0YxY9whYRCAMFubQaHHRSVNll0BK0vZvEVBemtj7KptS5aMVsqkp 1uiaPSuVRtmE0mNOi1XFp+tggQS5xwdaN8moA6N2R2DcUoDo77qT9cY31uWgpTU= X-Gm-Gg: ASbGncsQjpgZcjtedDMqpWzIe3EjEHS1J1sJM+0gP0dvnJl6yLcHmyMUgoTNVZBPwuI IN8Gg5+2B+F5piboSd2m9+0sJg+fjQNxSCBz9Ez+/vjBGvtkcyzGDah/MKwx+7RqBRJIFcNnJhZ liwEE8oVhod+ERQAqJDapPv8KMqixc82u71PSK60zK+8vo6/KOEdfvwJLfnzqG8NNwkRkaR6Kz7 X3qM0Ph6nTWsvjURDYtum90QGP46a4VAwVFMkzlQiDoyK7efT1m7XMzwRBMFjvz9nxcwJoumoFn ng== X-Received: by 2002:a5d:47af:0:b0:385:fb66:faee with SMTP id ffacd0b85a97d-38a221fa4b5mr25731403f8f.18.1735554665791; Mon, 30 Dec 2024 02:31:05 -0800 (PST) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c89e1c0sm30201550f8f.77.2024.12.30.02.31.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2024 02:31:05 -0800 (PST) From: Neil Armstrong Date: Mon, 30 Dec 2024 11:30:58 +0100 Subject: [PATCH v2 4/6] ufs: core: move ufshci defines in a separate header MIME-Version: 1.0 Message-Id: <20241230-topic-ufs-cleanup-v2-4-4c6d7994a45d@linaro.org> References: <20241230-topic-ufs-cleanup-v2-0-4c6d7994a45d@linaro.org> In-Reply-To: <20241230-topic-ufs-cleanup-v2-0-4c6d7994a45d@linaro.org> To: Bhupesh Sharma , Neha Malcom Francis , Tom Rini Cc: michal.simek@amd.com, marek.vasut+renesas@mailbox.org, bmeng.cn@gmail.com, venkatesh.abbarapu@amd.com, u-boot@lists.denx.de, Neil Armstrong , Love Kumar X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=22319; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=+fjVPV2ILuscUw9uz8gpsVPN+oE7LFd+zPguSfib/II=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBncnZkixkpuYB+JzaS+3Mgj2k/8L9Hog8NdPoKcfN9 Nu/cGPyJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZ3J2ZAAKCRB33NvayMhJ0dqgEA CiVg30jUhusULXWxnqtd0OCq/7dGNcI367udUD6ZMCH3HQC2Scxv5XUzixyzsx34DI2PI65GiA8yZv uygLNON9qwgIOtNoxFRhkjENIry0B6bEu84rPy5ilb1hjJIrCdUIS11bbWhn5AoOIaLoCv8IpM8noE dUnQrmFHSAzDRpjSczpWEopWpbSn2J4KBbLViwvqcHOZ1OkarkDAYgHvj5y5d2V6HlXh6PsWgTcjtI q1a77JOiiaN91wMybzWZjhg/x3wkQxIyTzs9KzFUn2IiYBbiGxjqtvuZ4XixjA8zMLmefdsleo90JX x+sipE+nJIkyrvO6KjhHceUE4VQLUwI+tV0Ai11wO9uCG02v6fb2jzWCvE4GN2jo6UW0Nju2UVOn6K 0EnLuByG2NDd64OwsSQCyQV1LqN2Fdz0CWJKCcG5rF6Hy9cN4bKXDkktWkdDNoGsXoIeX1pM7CquIC U2dh9VEp09vO9UEpIX7PPx4sab3Fs2FXaG9+8J86lYEH7Y/rpfWiZKclZktzmE3bTfWfR5t5n809uS wiMf4904PDJPeG4+ww4IOHWSCIZbUzPfrj+kO2MOAjn3WQQuGSjc6yeD4fDmAw0J7V8sx1GCxgd2CR u1P5wwfc4UaFsFeEiqb7mRHDfi1w6HvEcfs1d15nLnfQvhnXvg49mh9+II2Q== 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 Splitting the header will help synchronizing the defines again with Linux. Acked-by: Neha Malcom Francis Tested-by: Love Kumar Signed-off-by: Neil Armstrong --- drivers/ufs/ufs.h | 329 +------------------------------------------------- drivers/ufs/ufshci.h | 334 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 335 insertions(+), 328 deletions(-) diff --git a/drivers/ufs/ufs.h b/drivers/ufs/ufs.h index f4f042005e7fc2638ea6b33f26839c668d22bc9e..53137fae3a81ce87d744dd56c49db2a8ffba1d3d 100644 --- a/drivers/ufs/ufs.h +++ b/drivers/ufs/ufs.h @@ -4,6 +4,7 @@ #include #include +#include "ufshci.h" #include "unipro.h" struct udevice; @@ -14,11 +15,6 @@ struct udevice; #define RESPONSE_UPIU_SENSE_DATA_LENGTH 18 #define UFS_MAX_LUNS 0x7F -enum { - TASK_REQ_UPIU_SIZE_DWORDS = 8, - TASK_RSP_UPIU_SIZE_DWORDS = 8, - ALIGNED_UPIU_SIZE = 512, -}; /* UFS device power modes */ enum ufs_dev_pwr_mode { @@ -84,44 +80,6 @@ enum { /* Offset of the response code in the UPIU header */ #define UPIU_RSP_CODE_OFFSET 8 -/* To accommodate UFS2.0 required Command type */ -enum { - UTP_CMD_TYPE_UFS_STORAGE = 0x1, -}; - -enum { - UTP_SCSI_COMMAND = 0x00000000, - UTP_NATIVE_UFS_COMMAND = 0x10000000, - UTP_DEVICE_MANAGEMENT_FUNCTION = 0x20000000, - UTP_REQ_DESC_INT_CMD = 0x01000000, -}; - -/* UTP Transfer Request Data Direction (DD) */ -enum { - UTP_NO_DATA_TRANSFER = 0x00000000, - UTP_HOST_TO_DEVICE = 0x02000000, - UTP_DEVICE_TO_HOST = 0x04000000, -}; - -/* Overall command status values */ -enum { - OCS_SUCCESS = 0x0, - OCS_INVALID_CMD_TABLE_ATTR = 0x1, - OCS_INVALID_PRDT_ATTR = 0x2, - OCS_MISMATCH_DATA_BUF_SIZE = 0x3, - OCS_MISMATCH_RESP_UPIU_SIZE = 0x4, - OCS_PEER_COMM_FAILURE = 0x5, - OCS_ABORTED = 0x6, - OCS_FATAL_ERROR = 0x7, - OCS_INVALID_COMMAND_STATUS = 0x0F, - MASK_OCS = 0x0F, -}; - -/* The maximum length of the data byte count field in the PRDT is 256KB */ -#define PRDT_DATA_BYTE_COUNT_MAX (256 * 1024) -/* The granularity of the data byte count field in the PRDT is 32-bit */ -#define PRDT_DATA_BYTE_COUNT_PAD 4 - #define GENERAL_UPIU_REQUEST_SIZE (sizeof(struct utp_upiu_req)) #define QUERY_DESC_MAX_SIZE 255 #define QUERY_DESC_MIN_SIZE 2 @@ -297,79 +255,6 @@ enum desc_header_offset { QUERY_DESC_DESC_TYPE_OFFSET = 0x01, }; -struct ufshcd_sg_entry { - __le32 base_addr; - __le32 upper_addr; - __le32 reserved; - __le32 size; -}; - -#define MAX_BUFF 128 -/** - * struct utp_transfer_cmd_desc - UFS Command Descriptor structure - * @command_upiu: Command UPIU Frame address - * @response_upiu: Response UPIU Frame address - * @prd_table: Physical Region Descriptor - */ -struct utp_transfer_cmd_desc { - u8 command_upiu[ALIGNED_UPIU_SIZE]; - u8 response_upiu[ALIGNED_UPIU_SIZE]; - struct ufshcd_sg_entry prd_table[MAX_BUFF]; -}; - -/** - * struct request_desc_header - Descriptor Header common to both UTRD and UTMRD - * @dword0: Descriptor Header DW0 - * @dword1: Descriptor Header DW1 - * @dword2: Descriptor Header DW2 - * @dword3: Descriptor Header DW3 - */ -struct request_desc_header { - __le32 dword_0; - __le32 dword_1; - __le32 dword_2; - __le32 dword_3; -}; - -/** - * struct utp_transfer_req_desc - UTRD structure - * @header: UTRD header DW-0 to DW-3 - * @command_desc_base_addr_lo: UCD base address low DW-4 - * @command_desc_base_addr_hi: UCD base address high DW-5 - * @response_upiu_length: response UPIU length DW-6 - * @response_upiu_offset: response UPIU offset DW-6 - * @prd_table_length: Physical region descriptor length DW-7 - * @prd_table_offset: Physical region descriptor offset DW-7 - */ -struct utp_transfer_req_desc { - /* DW 0-3 */ - struct request_desc_header header; - - /* DW 4-5*/ - __le32 command_desc_base_addr_lo; - __le32 command_desc_base_addr_hi; - - /* DW 6 */ - __le16 response_upiu_length; - __le16 response_upiu_offset; - - /* DW 7 */ - __le16 prd_table_length; - __le16 prd_table_offset; -}; - -/** - * struct utp_upiu_header - UPIU header structure - * @dword_0: UPIU header DW-0 - * @dword_1: UPIU header DW-1 - * @dword_2: UPIU header DW-2 - */ -struct utp_upiu_header { - __be32 dword_0; - __be32 dword_1; - __be32 dword_2; -}; - /** * struct utp_upiu_query - upiu request buffer structure for * query request. @@ -403,27 +288,6 @@ struct utp_upiu_cmd { u8 cdb[UFS_CDB_SIZE]; }; -/* - * UTMRD structure. - */ -struct utp_task_req_desc { - /* DW 0-3 */ - struct request_desc_header header; - - /* DW 4-11 - Task request UPIU structure */ - struct utp_upiu_header req_header; - __be32 input_param1; - __be32 input_param2; - __be32 input_param3; - __be32 __reserved1[2]; - - /* DW 12-19 - Task Management Response UPIU structure */ - struct utp_upiu_header rsp_header; - __be32 output_param1; - __be32 output_param2; - __be32 __reserved2[3]; -}; - /** * struct utp_upiu_req - general upiu request structure * @header:UPIU header structure DW-0 to DW-2 @@ -551,63 +415,6 @@ struct uic_command { int result; }; -/* GenSelectorIndex calculation macros for M-PHY attributes */ -#define UIC_ARG_MPHY_TX_GEN_SEL_INDEX(lane) (lane) -#define UIC_ARG_MPHY_RX_GEN_SEL_INDEX(lane) (PA_MAXDATALANES + (lane)) - -#define UIC_ARG_MIB_SEL(attr, sel) ((((attr) & 0xFFFF) << 16) |\ - ((sel) & 0xFFFF)) -#define UIC_ARG_MIB(attr) UIC_ARG_MIB_SEL(attr, 0) -#define UIC_ARG_ATTR_TYPE(t) (((t) & 0xFF) << 16) -#define UIC_GET_ATTR_ID(v) (((v) >> 16) & 0xFFFF) - -/* Link Status*/ -enum link_status { - UFSHCD_LINK_IS_DOWN = 1, - UFSHCD_LINK_IS_UP = 2, -}; - -#define UIC_ARG_MIB_SEL(attr, sel) ((((attr) & 0xFFFF) << 16) |\ - ((sel) & 0xFFFF)) -#define UIC_ARG_MIB(attr) UIC_ARG_MIB_SEL(attr, 0) -#define UIC_ARG_ATTR_TYPE(t) (((t) & 0xFF) << 16) -#define UIC_GET_ATTR_ID(v) (((v) >> 16) & 0xFFFF) - -/* UIC Commands */ -enum uic_cmd_dme { - UIC_CMD_DME_GET = 0x01, - UIC_CMD_DME_SET = 0x02, - UIC_CMD_DME_PEER_GET = 0x03, - UIC_CMD_DME_PEER_SET = 0x04, - UIC_CMD_DME_POWERON = 0x10, - UIC_CMD_DME_POWEROFF = 0x11, - UIC_CMD_DME_ENABLE = 0x12, - UIC_CMD_DME_RESET = 0x14, - UIC_CMD_DME_END_PT_RST = 0x15, - UIC_CMD_DME_LINK_STARTUP = 0x16, - UIC_CMD_DME_HIBER_ENTER = 0x17, - UIC_CMD_DME_HIBER_EXIT = 0x18, - UIC_CMD_DME_TEST_MODE = 0x1A, -}; - -/* UIC Config result code / Generic error code */ -enum { - UIC_CMD_RESULT_SUCCESS = 0x00, - UIC_CMD_RESULT_INVALID_ATTR = 0x01, - UIC_CMD_RESULT_FAILURE = 0x01, - UIC_CMD_RESULT_INVALID_ATTR_VALUE = 0x02, - UIC_CMD_RESULT_READ_ONLY_ATTR = 0x03, - UIC_CMD_RESULT_WRITE_ONLY_ATTR = 0x04, - UIC_CMD_RESULT_BAD_INDEX = 0x05, - UIC_CMD_RESULT_LOCKED_ATTR = 0x06, - UIC_CMD_RESULT_BAD_TEST_FEATURE_INDEX = 0x07, - UIC_CMD_RESULT_PEER_COMM_FAILURE = 0x08, - UIC_CMD_RESULT_BUSY = 0x09, - UIC_CMD_RESULT_DME_FAILURE = 0x0A, -}; - -#define MASK_UIC_COMMAND_RESULT 0xFF - /* Host <-> Device UniPro Link state */ enum uic_link_state { UIC_LINK_OFF_STATE = 0, /* Link powered down or disabled */ @@ -940,17 +747,6 @@ static inline int ufshcd_vops_device_reset(struct ufs_hba *hba) return 0; } -/* Controller UFSHCI version */ -enum { - UFSHCI_VERSION_10 = 0x00010000, /* 1.0 */ - UFSHCI_VERSION_11 = 0x00010100, /* 1.1 */ - UFSHCI_VERSION_20 = 0x00000200, /* 2.0 */ - UFSHCI_VERSION_21 = 0x00000210, /* 2.1 */ - UFSHCI_VERSION_30 = 0x00000300, /* 3.0 */ - UFSHCI_VERSION_31 = 0x00000310, /* 3.1 */ - UFSHCI_VERSION_40 = 0x00000400, /* 4.0 */ -}; - /* Interrupt disable masks */ enum { /* Interrupt disable mask for UFSHCI v1.0 */ @@ -964,123 +760,6 @@ enum { INTERRUPT_MASK_ALL_VER_21 = 0x71FFF, }; -/* UFSHCI Registers */ -enum { - REG_CONTROLLER_CAPABILITIES = 0x00, - REG_UFS_VERSION = 0x08, - REG_CONTROLLER_DEV_ID = 0x10, - REG_CONTROLLER_PROD_ID = 0x14, - REG_AUTO_HIBERNATE_IDLE_TIMER = 0x18, - REG_INTERRUPT_STATUS = 0x20, - REG_INTERRUPT_ENABLE = 0x24, - REG_CONTROLLER_STATUS = 0x30, - REG_CONTROLLER_ENABLE = 0x34, - REG_UIC_ERROR_CODE_PHY_ADAPTER_LAYER = 0x38, - REG_UIC_ERROR_CODE_DATA_LINK_LAYER = 0x3C, - REG_UIC_ERROR_CODE_NETWORK_LAYER = 0x40, - REG_UIC_ERROR_CODE_TRANSPORT_LAYER = 0x44, - REG_UIC_ERROR_CODE_DME = 0x48, - REG_UTP_TRANSFER_REQ_INT_AGG_CONTROL = 0x4C, - REG_UTP_TRANSFER_REQ_LIST_BASE_L = 0x50, - REG_UTP_TRANSFER_REQ_LIST_BASE_H = 0x54, - REG_UTP_TRANSFER_REQ_DOOR_BELL = 0x58, - REG_UTP_TRANSFER_REQ_LIST_CLEAR = 0x5C, - REG_UTP_TRANSFER_REQ_LIST_RUN_STOP = 0x60, - REG_UTP_TASK_REQ_LIST_BASE_L = 0x70, - REG_UTP_TASK_REQ_LIST_BASE_H = 0x74, - REG_UTP_TASK_REQ_DOOR_BELL = 0x78, - REG_UTP_TASK_REQ_LIST_CLEAR = 0x7C, - REG_UTP_TASK_REQ_LIST_RUN_STOP = 0x80, - REG_UIC_COMMAND = 0x90, - REG_UIC_COMMAND_ARG_1 = 0x94, - REG_UIC_COMMAND_ARG_2 = 0x98, - REG_UIC_COMMAND_ARG_3 = 0x9C, - - UFSHCI_REG_SPACE_SIZE = 0xA0, - - REG_UFS_CCAP = 0x100, - REG_UFS_CRYPTOCAP = 0x104, - - UFSHCI_CRYPTO_REG_SPACE_SIZE = 0x400, -}; - -/* Controller capability masks */ -enum { - MASK_TRANSFER_REQUESTS_SLOTS = 0x0000001F, - MASK_TASK_MANAGEMENT_REQUEST_SLOTS = 0x00070000, - MASK_AUTO_HIBERN8_SUPPORT = 0x00800000, - MASK_64_ADDRESSING_SUPPORT = 0x01000000, - MASK_OUT_OF_ORDER_DATA_DELIVERY_SUPPORT = 0x02000000, - MASK_UIC_DME_TEST_MODE_SUPPORT = 0x04000000, -}; - -/* Interrupt Status 20h */ -#define UTP_TRANSFER_REQ_COMPL 0x1 -#define UIC_DME_END_PT_RESET 0x2 -#define UIC_ERROR 0x4 -#define UIC_TEST_MODE 0x8 -#define UIC_POWER_MODE 0x10 -#define UIC_HIBERNATE_EXIT 0x20 -#define UIC_HIBERNATE_ENTER 0x40 -#define UIC_LINK_LOST 0x80 -#define UIC_LINK_STARTUP 0x100 -#define UTP_TASK_REQ_COMPL 0x200 -#define UIC_COMMAND_COMPL 0x400 -#define DEVICE_FATAL_ERROR 0x800 -#define CONTROLLER_FATAL_ERROR 0x10000 -#define SYSTEM_BUS_FATAL_ERROR 0x20000 - -#define UFSHCD_UIC_PWR_MASK (UIC_HIBERNATE_ENTER |\ - UIC_HIBERNATE_EXIT |\ - UIC_POWER_MODE) - -#define UFSHCD_UIC_MASK (UIC_COMMAND_COMPL | UIC_POWER_MODE) - -#define UFSHCD_ERROR_MASK (UIC_ERROR |\ - DEVICE_FATAL_ERROR |\ - CONTROLLER_FATAL_ERROR |\ - SYSTEM_BUS_FATAL_ERROR) - -#define INT_FATAL_ERRORS (DEVICE_FATAL_ERROR |\ - CONTROLLER_FATAL_ERROR |\ - SYSTEM_BUS_FATAL_ERROR) - -/* Host Controller Enable 0x34h */ -#define CONTROLLER_ENABLE 0x1 -#define CONTROLLER_DISABLE 0x0 -/* HCS - Host Controller Status 30h */ -#define DEVICE_PRESENT 0x1 -#define UTP_TRANSFER_REQ_LIST_READY 0x2 -#define UTP_TASK_REQ_LIST_READY 0x4 -#define UIC_COMMAND_READY 0x8 -#define HOST_ERROR_INDICATOR 0x10 -#define DEVICE_ERROR_INDICATOR 0x20 -#define UIC_POWER_MODE_CHANGE_REQ_STATUS_MASK UFS_MASK(0x7, 8) - -#define UFSHCD_STATUS_READY (UTP_TRANSFER_REQ_LIST_READY |\ - UTP_TASK_REQ_LIST_READY |\ - UIC_COMMAND_READY) - -enum { - PWR_OK = 0x0, - PWR_LOCAL = 0x01, - PWR_REMOTE = 0x02, - PWR_BUSY = 0x03, - PWR_ERROR_CAP = 0x04, - PWR_FATAL_ERROR = 0x05, -}; - -/* UICCMD - UIC Command */ -#define COMMAND_OPCODE_MASK 0xFF -#define GEN_SELECTOR_INDEX_MASK 0xFFFF - -#define MIB_ATTRIBUTE_MASK UFS_MASK(0xFFFF, 16) -#define RESET_LEVEL 0xFF - -#define ATTR_SET_TYPE_MASK UFS_MASK(0xFF, 16) -#define CFG_RESULT_CODE_MASK 0xFF -#define GENERIC_ERROR_CODE_MASK 0xFF - #define ufshcd_writel(hba, val, reg) \ writel((val), (hba)->mmio_base + (reg)) #define ufshcd_readl(hba, reg) \ @@ -1103,12 +782,6 @@ static inline void ufshcd_rmwl(struct ufs_hba *hba, u32 mask, u32 val, u32 reg) ufshcd_writel(hba, tmp, reg); } -/* UTRLRSR - UTP Transfer Request Run-Stop Register 60h */ -#define UTP_TRANSFER_REQ_LIST_RUN_STOP_BIT 0x1 - -/* UTMRLRSR - UTP Task Management Request Run-Stop Register 80h */ -#define UTP_TASK_REQ_LIST_RUN_STOP_BIT 0x1 - int ufshcd_probe(struct udevice *dev, struct ufs_hba_ops *hba_ops); #endif diff --git a/drivers/ufs/ufshci.h b/drivers/ufs/ufshci.h new file mode 100644 index 0000000000000000000000000000000000000000..db30812b176f9e36529452e260b847241f97fdab --- /dev/null +++ b/drivers/ufs/ufshci.h @@ -0,0 +1,334 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +#ifndef __UFSHCI_H +#define __UFSHCI_H + +enum { + TASK_REQ_UPIU_SIZE_DWORDS = 8, + TASK_RSP_UPIU_SIZE_DWORDS = 8, + ALIGNED_UPIU_SIZE = 512, +}; + +/* To accommodate UFS2.0 required Command type */ +enum { + UTP_CMD_TYPE_UFS_STORAGE = 0x1, +}; + +enum { + UTP_SCSI_COMMAND = 0x00000000, + UTP_NATIVE_UFS_COMMAND = 0x10000000, + UTP_DEVICE_MANAGEMENT_FUNCTION = 0x20000000, + UTP_REQ_DESC_INT_CMD = 0x01000000, +}; + +/* UTP Transfer Request Data Direction (DD) */ +enum { + UTP_NO_DATA_TRANSFER = 0x00000000, + UTP_HOST_TO_DEVICE = 0x02000000, + UTP_DEVICE_TO_HOST = 0x04000000, +}; + +/* Overall command status values */ +enum { + OCS_SUCCESS = 0x0, + OCS_INVALID_CMD_TABLE_ATTR = 0x1, + OCS_INVALID_PRDT_ATTR = 0x2, + OCS_MISMATCH_DATA_BUF_SIZE = 0x3, + OCS_MISMATCH_RESP_UPIU_SIZE = 0x4, + OCS_PEER_COMM_FAILURE = 0x5, + OCS_ABORTED = 0x6, + OCS_FATAL_ERROR = 0x7, + OCS_INVALID_COMMAND_STATUS = 0x0F, + MASK_OCS = 0x0F, +}; + +/* The maximum length of the data byte count field in the PRDT is 256KB */ +#define PRDT_DATA_BYTE_COUNT_MAX (256 * 1024) +/* The granularity of the data byte count field in the PRDT is 32-bit */ +#define PRDT_DATA_BYTE_COUNT_PAD 4 + +/* Controller UFSHCI version */ +enum { + UFSHCI_VERSION_10 = 0x00010000, /* 1.0 */ + UFSHCI_VERSION_11 = 0x00010100, /* 1.1 */ + UFSHCI_VERSION_20 = 0x00000200, /* 2.0 */ + UFSHCI_VERSION_21 = 0x00000210, /* 2.1 */ + UFSHCI_VERSION_30 = 0x00000300, /* 3.0 */ + UFSHCI_VERSION_31 = 0x00000310, /* 3.1 */ + UFSHCI_VERSION_40 = 0x00000400, /* 4.0 */ +}; + +/* UFSHCI Registers */ +enum { + REG_CONTROLLER_CAPABILITIES = 0x00, + REG_UFS_VERSION = 0x08, + REG_CONTROLLER_DEV_ID = 0x10, + REG_CONTROLLER_PROD_ID = 0x14, + REG_AUTO_HIBERNATE_IDLE_TIMER = 0x18, + REG_INTERRUPT_STATUS = 0x20, + REG_INTERRUPT_ENABLE = 0x24, + REG_CONTROLLER_STATUS = 0x30, + REG_CONTROLLER_ENABLE = 0x34, + REG_UIC_ERROR_CODE_PHY_ADAPTER_LAYER = 0x38, + REG_UIC_ERROR_CODE_DATA_LINK_LAYER = 0x3C, + REG_UIC_ERROR_CODE_NETWORK_LAYER = 0x40, + REG_UIC_ERROR_CODE_TRANSPORT_LAYER = 0x44, + REG_UIC_ERROR_CODE_DME = 0x48, + REG_UTP_TRANSFER_REQ_INT_AGG_CONTROL = 0x4C, + REG_UTP_TRANSFER_REQ_LIST_BASE_L = 0x50, + REG_UTP_TRANSFER_REQ_LIST_BASE_H = 0x54, + REG_UTP_TRANSFER_REQ_DOOR_BELL = 0x58, + REG_UTP_TRANSFER_REQ_LIST_CLEAR = 0x5C, + REG_UTP_TRANSFER_REQ_LIST_RUN_STOP = 0x60, + REG_UTP_TASK_REQ_LIST_BASE_L = 0x70, + REG_UTP_TASK_REQ_LIST_BASE_H = 0x74, + REG_UTP_TASK_REQ_DOOR_BELL = 0x78, + REG_UTP_TASK_REQ_LIST_CLEAR = 0x7C, + REG_UTP_TASK_REQ_LIST_RUN_STOP = 0x80, + REG_UIC_COMMAND = 0x90, + REG_UIC_COMMAND_ARG_1 = 0x94, + REG_UIC_COMMAND_ARG_2 = 0x98, + REG_UIC_COMMAND_ARG_3 = 0x9C, + + UFSHCI_REG_SPACE_SIZE = 0xA0, + + REG_UFS_CCAP = 0x100, + REG_UFS_CRYPTOCAP = 0x104, + + UFSHCI_CRYPTO_REG_SPACE_SIZE = 0x400, +}; + +/* Controller capability masks */ +enum { + MASK_TRANSFER_REQUESTS_SLOTS = 0x0000001F, + MASK_TASK_MANAGEMENT_REQUEST_SLOTS = 0x00070000, + MASK_AUTO_HIBERN8_SUPPORT = 0x00800000, + MASK_64_ADDRESSING_SUPPORT = 0x01000000, + MASK_OUT_OF_ORDER_DATA_DELIVERY_SUPPORT = 0x02000000, + MASK_UIC_DME_TEST_MODE_SUPPORT = 0x04000000, +}; + +/* Interrupt Status 20h */ +#define UTP_TRANSFER_REQ_COMPL 0x1 +#define UIC_DME_END_PT_RESET 0x2 +#define UIC_ERROR 0x4 +#define UIC_TEST_MODE 0x8 +#define UIC_POWER_MODE 0x10 +#define UIC_HIBERNATE_EXIT 0x20 +#define UIC_HIBERNATE_ENTER 0x40 +#define UIC_LINK_LOST 0x80 +#define UIC_LINK_STARTUP 0x100 +#define UTP_TASK_REQ_COMPL 0x200 +#define UIC_COMMAND_COMPL 0x400 +#define DEVICE_FATAL_ERROR 0x800 +#define CONTROLLER_FATAL_ERROR 0x10000 +#define SYSTEM_BUS_FATAL_ERROR 0x20000 + +#define UFSHCD_UIC_PWR_MASK (UIC_HIBERNATE_ENTER |\ + UIC_HIBERNATE_EXIT |\ + UIC_POWER_MODE) + +#define UFSHCD_UIC_MASK (UIC_COMMAND_COMPL | UIC_POWER_MODE) + +#define UFSHCD_ERROR_MASK (UIC_ERROR |\ + DEVICE_FATAL_ERROR |\ + CONTROLLER_FATAL_ERROR |\ + SYSTEM_BUS_FATAL_ERROR) + +#define INT_FATAL_ERRORS (DEVICE_FATAL_ERROR |\ + CONTROLLER_FATAL_ERROR |\ + SYSTEM_BUS_FATAL_ERROR) + +/* Host Controller Enable 0x34h */ +#define CONTROLLER_ENABLE 0x1 +#define CONTROLLER_DISABLE 0x0 +/* HCS - Host Controller Status 30h */ +#define DEVICE_PRESENT 0x1 +#define UTP_TRANSFER_REQ_LIST_READY 0x2 +#define UTP_TASK_REQ_LIST_READY 0x4 +#define UIC_COMMAND_READY 0x8 +#define HOST_ERROR_INDICATOR 0x10 +#define DEVICE_ERROR_INDICATOR 0x20 +#define UIC_POWER_MODE_CHANGE_REQ_STATUS_MASK UFS_MASK(0x7, 8) + +#define UFSHCD_STATUS_READY (UTP_TRANSFER_REQ_LIST_READY |\ + UTP_TASK_REQ_LIST_READY |\ + UIC_COMMAND_READY) + +enum { + PWR_OK = 0x0, + PWR_LOCAL = 0x01, + PWR_REMOTE = 0x02, + PWR_BUSY = 0x03, + PWR_ERROR_CAP = 0x04, + PWR_FATAL_ERROR = 0x05, +}; + +/* UICCMD - UIC Command */ +#define COMMAND_OPCODE_MASK 0xFF +#define GEN_SELECTOR_INDEX_MASK 0xFFFF + +#define MIB_ATTRIBUTE_MASK UFS_MASK(0xFFFF, 16) +#define RESET_LEVEL 0xFF + +#define ATTR_SET_TYPE_MASK UFS_MASK(0xFF, 16) +#define CFG_RESULT_CODE_MASK 0xFF +#define GENERIC_ERROR_CODE_MASK 0xFF + +/* GenSelectorIndex calculation macros for M-PHY attributes */ +#define UIC_ARG_MPHY_TX_GEN_SEL_INDEX(lane) (lane) +#define UIC_ARG_MPHY_RX_GEN_SEL_INDEX(lane) (PA_MAXDATALANES + (lane)) + +#define UIC_ARG_MIB_SEL(attr, sel) ((((attr) & 0xFFFF) << 16) |\ + ((sel) & 0xFFFF)) +#define UIC_ARG_MIB(attr) UIC_ARG_MIB_SEL(attr, 0) +#define UIC_ARG_ATTR_TYPE(t) (((t) & 0xFF) << 16) +#define UIC_GET_ATTR_ID(v) (((v) >> 16) & 0xFFFF) + +/* Link Status*/ +enum link_status { + UFSHCD_LINK_IS_DOWN = 1, + UFSHCD_LINK_IS_UP = 2, +}; + +#define UIC_ARG_MIB_SEL(attr, sel) ((((attr) & 0xFFFF) << 16) |\ + ((sel) & 0xFFFF)) +#define UIC_ARG_MIB(attr) UIC_ARG_MIB_SEL(attr, 0) +#define UIC_ARG_ATTR_TYPE(t) (((t) & 0xFF) << 16) +#define UIC_GET_ATTR_ID(v) (((v) >> 16) & 0xFFFF) + +/* UIC Commands */ +enum uic_cmd_dme { + UIC_CMD_DME_GET = 0x01, + UIC_CMD_DME_SET = 0x02, + UIC_CMD_DME_PEER_GET = 0x03, + UIC_CMD_DME_PEER_SET = 0x04, + UIC_CMD_DME_POWERON = 0x10, + UIC_CMD_DME_POWEROFF = 0x11, + UIC_CMD_DME_ENABLE = 0x12, + UIC_CMD_DME_RESET = 0x14, + UIC_CMD_DME_END_PT_RST = 0x15, + UIC_CMD_DME_LINK_STARTUP = 0x16, + UIC_CMD_DME_HIBER_ENTER = 0x17, + UIC_CMD_DME_HIBER_EXIT = 0x18, + UIC_CMD_DME_TEST_MODE = 0x1A, +}; + +/* UIC Config result code / Generic error code */ +enum { + UIC_CMD_RESULT_SUCCESS = 0x00, + UIC_CMD_RESULT_INVALID_ATTR = 0x01, + UIC_CMD_RESULT_FAILURE = 0x01, + UIC_CMD_RESULT_INVALID_ATTR_VALUE = 0x02, + UIC_CMD_RESULT_READ_ONLY_ATTR = 0x03, + UIC_CMD_RESULT_WRITE_ONLY_ATTR = 0x04, + UIC_CMD_RESULT_BAD_INDEX = 0x05, + UIC_CMD_RESULT_LOCKED_ATTR = 0x06, + UIC_CMD_RESULT_BAD_TEST_FEATURE_INDEX = 0x07, + UIC_CMD_RESULT_PEER_COMM_FAILURE = 0x08, + UIC_CMD_RESULT_BUSY = 0x09, + UIC_CMD_RESULT_DME_FAILURE = 0x0A, +}; + +#define MASK_UIC_COMMAND_RESULT 0xFF + +/* UTRLRSR - UTP Transfer Request Run-Stop Register 60h */ +#define UTP_TRANSFER_REQ_LIST_RUN_STOP_BIT 0x1 + +/* UTMRLRSR - UTP Task Management Request Run-Stop Register 80h */ +#define UTP_TASK_REQ_LIST_RUN_STOP_BIT 0x1 + +struct ufshcd_sg_entry { + __le32 base_addr; + __le32 upper_addr; + __le32 reserved; + __le32 size; +}; + +#define MAX_BUFF 128 +/** + * struct utp_transfer_cmd_desc - UFS Command Descriptor structure + * @command_upiu: Command UPIU Frame address + * @response_upiu: Response UPIU Frame address + * @prd_table: Physical Region Descriptor + */ +struct utp_transfer_cmd_desc { + u8 command_upiu[ALIGNED_UPIU_SIZE]; + u8 response_upiu[ALIGNED_UPIU_SIZE]; + struct ufshcd_sg_entry prd_table[MAX_BUFF]; +}; + +/** + * struct request_desc_header - Descriptor Header common to both UTRD and UTMRD + * @dword0: Descriptor Header DW0 + * @dword1: Descriptor Header DW1 + * @dword2: Descriptor Header DW2 + * @dword3: Descriptor Header DW3 + */ +struct request_desc_header { + __le32 dword_0; + __le32 dword_1; + __le32 dword_2; + __le32 dword_3; +}; + +/** + * struct utp_transfer_req_desc - UTRD structure + * @header: UTRD header DW-0 to DW-3 + * @command_desc_base_addr_lo: UCD base address low DW-4 + * @command_desc_base_addr_hi: UCD base address high DW-5 + * @response_upiu_length: response UPIU length DW-6 + * @response_upiu_offset: response UPIU offset DW-6 + * @prd_table_length: Physical region descriptor length DW-7 + * @prd_table_offset: Physical region descriptor offset DW-7 + */ +struct utp_transfer_req_desc { + /* DW 0-3 */ + struct request_desc_header header; + + /* DW 4-5*/ + __le32 command_desc_base_addr_lo; + __le32 command_desc_base_addr_hi; + + /* DW 6 */ + __le16 response_upiu_length; + __le16 response_upiu_offset; + + /* DW 7 */ + __le16 prd_table_length; + __le16 prd_table_offset; +}; + +/** + * struct utp_upiu_header - UPIU header structure + * @dword_0: UPIU header DW-0 + * @dword_1: UPIU header DW-1 + * @dword_2: UPIU header DW-2 + */ +struct utp_upiu_header { + __be32 dword_0; + __be32 dword_1; + __be32 dword_2; +}; + +/* + * UTMRD structure. + */ +struct utp_task_req_desc { + /* DW 0-3 */ + struct request_desc_header header; + + /* DW 4-11 - Task request UPIU structure */ + struct utp_upiu_header req_header; + __be32 input_param1; + __be32 input_param2; + __be32 input_param3; + __be32 __reserved1[2]; + + /* DW 12-19 - Task Management Response UPIU structure */ + struct utp_upiu_header rsp_header; + __be32 output_param1; + __be32 output_param2; + __be32 __reserved2[3]; +}; + +#endif From patchwork Mon Dec 30 10:30:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 854239 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp6361933wrq; Mon, 30 Dec 2024 02:31:43 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWInr6Qc9R8u+ydWuGcBBq9NQrrYvMDBHCSFFZjXcHMH1Tiz3NQ6XOhZNtFUFU+eWJDWZkRLw==@linaro.org X-Google-Smtp-Source: AGHT+IGelFyV0K8dUIqrFPa2FE2rckCZsDNks+KXcWIi77Xxv129QG30QQ8VZ9G5JmqV5GoPAmoz X-Received: by 2002:a05:6402:3485:b0:5d0:e826:f0ec with SMTP id 4fb4d7f45d1cf-5d81dd83c51mr33913686a12.4.1735554703356; Mon, 30 Dec 2024 02:31:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735554703; cv=none; d=google.com; s=arc-20240605; b=B7De46UpP4vT1+lZBY0+ILTH7ghn3ZMxLp9yitN9EGREBHV4dThYtYCtzIA5PvaC1z EEYKjmKoVmfwzuzuI6gMxPKm37NmZa/Ln6MCnyxN1HyOXWkyykm1zluYV8sFhHKZKBdz ZYrOWOQtiUp1SNTJyBoZvA66V2NSIQFsAZO+yI2ObdhGAg5fOlmGTEw25P4OBqsT2g/0 k6ZS6PTB+vLh0ffSiviCtb8/0HrFrH/sh1ejTN/KDhc8Fgqa8zFq3Ff1PNwIs8PraFTo mGMVw6ssOHyHH8ylTVNGyDRh6Zd2xFDFHJkZAWqkXVvh3W6tbYZc0clD9ei5Chpp35v8 71lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=BVvRFBlrTD2xdj9R7M5s+RXb0V0lCIVlcF8lmZihNeA=; fh=W60Xx9yxqQPzSlvhgpBgbckbxDFLCOx9SlucIlBHDKQ=; b=IrawjPvuQtsKtHr/GFZgk3rDH9zOZYg6CkYf8Izf7M1uXu3cS6GUcGjXIC1HGMd2Dq 30saZv6sUKpALZql7FeIntOTYvQQa4w38r3kgaUPCOksXUwJIbeARK1+4r95iB4kW6Yv 3EPqTvNlmpItRsmMVkakFXyjlMPXl0LoBH3teVJtJY/CbPUDGmp+GFf2H8pNW/p5pzOL aL1wkoSfYbFQCRgtrzsg+vFOxpzAR0O9F/zQAL53ueUy5DFT+YrErELxyHgZN1jaaSnG 0Mh1GYwHmXkAYJTsDANz1WzDqr+UCTDyDNnPSTIS1OUUzrgmOtcU9iVitK0WcS4nuZ2+ 72AA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RRpucXyp; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5d8603d21e6si9235471a12.501.2024.12.30.02.31.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2024 02:31:43 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RRpucXyp; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5FCFB80655; Mon, 30 Dec 2024 11:31:11 +0100 (CET) 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="RRpucXyp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 85BEA805EA; Mon, 30 Dec 2024 11:31:09 +0100 (CET) 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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (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 52ECD80570 for ; Mon, 30 Dec 2024 11:31:07 +0100 (CET) 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-x431.google.com with SMTP id ffacd0b85a97d-385ddcfc97bso7737266f8f.1 for ; Mon, 30 Dec 2024 02:31:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735554667; x=1736159467; 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=BVvRFBlrTD2xdj9R7M5s+RXb0V0lCIVlcF8lmZihNeA=; b=RRpucXyptDewggTGoeN6o8JR+D+sRsqkhXr0lWVeVNNgnpiB65iLWVCKzHSYcjyYF8 IGlEjWj4L8AMV6zPlHylUgvERfcg5tcxf3ybJCWEbx+8SmhDsKHHzfUYmwTaRTlqMs7A DQpqtADuia7XV+lIYKpm56V+eHkeSbtA8qTx7mCB/AAjUx0GGttpKeDL+S7LAziNo4ny UWGgb3Z0C5zzN6xjdvv8cHlbD5euwkRdU3huNpi6jSp97KRciT9d4LrzP3KTetbkMoXL iJXj4m4BPvXw+NBNtJAynvwPMIa49di3b+cyg+5iZKQWs6sEfIQCojPHPXZHpqCOxq9d /RAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735554667; x=1736159467; 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=BVvRFBlrTD2xdj9R7M5s+RXb0V0lCIVlcF8lmZihNeA=; b=j2xhbsKlAxmW+xjZ50+66jaCTTyuhTptm431SMhoonFU3bmqNT09B938HNBGYYUeaz yJAUeMSEzIcT1a4elBvvaWlWB9cKvMxJ5gulsy66IDobHkME3H8eIdiVnywCudx+pWzp zufIgdl8WaOqvtfCIKeOsD4/KbPjJ9fcGNfNvh808M8UiZuYS2VshxVcmSMzwicS7sbs 2tpWenPZ96flL2JF9oJlJokGxjUCB/z4NQOpyVyO4orCQKpp1DVYIOJysFigJZ9D3aCX dyGDFzEyjPrPsUW+hSR0vsE/kMoZdEf5ZhwNIT9odiObEFjOkIeGp03UdslqrWNRhUNC WQRA== X-Forwarded-Encrypted: i=1; AJvYcCXHIOBkA39o0ZxPMWYZnVxcxQAGszm7RAZTa/YYYdvqKtm912y0aw4i0CpMi/zqnIbS7Sc1tto=@lists.denx.de X-Gm-Message-State: AOJu0Yy1W/ysWRqXDylR8N4vZCaXH2EpjU9uh3CdUDi3GwlLLHBjL6tO x9zBuFUjyHs4RfWj9AuvEjXZUWVvTJWvzlLVEpPFeV/Ig/bVQanJ+a2HEtR4aNg= X-Gm-Gg: ASbGncso4+zQpl19Q2zD9MMbVZCUx8JyjP92J3sDVPSPrkya7XtdA3g3qH5tPN8IThU mM689/L+lI90MN5eXdIhVSZwTz6570oHx8Z/ZLUKhZJh+6cTM2rgO5U3A/5fZdjqY5IJJai08H+ TD0O7aoX2RYATb3EHQ5GyMFDyv4CC8qvly34X3PiBTCvNE+RzQZVENDlzuIDAQMtvcyvUJ53uGS PVTiaP22pABotXfg6vX4ssS75HbmOnkPuwL7NMnHu2LGHbn34P+kQnFcrKQ34mE27JLHIbzcweL TA== X-Received: by 2002:adf:ab09:0:b0:38a:4184:1520 with SMTP id ffacd0b85a97d-38a418416bdmr12348398f8f.27.1735554666790; Mon, 30 Dec 2024 02:31:06 -0800 (PST) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c89e1c0sm30201550f8f.77.2024.12.30.02.31.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2024 02:31:06 -0800 (PST) From: Neil Armstrong Date: Mon, 30 Dec 2024 11:30:59 +0100 Subject: [PATCH v2 5/6] ufs: core: sync unipro.h with Linux v6.12 MIME-Version: 1.0 Message-Id: <20241230-topic-ufs-cleanup-v2-5-4c6d7994a45d@linaro.org> References: <20241230-topic-ufs-cleanup-v2-0-4c6d7994a45d@linaro.org> In-Reply-To: <20241230-topic-ufs-cleanup-v2-0-4c6d7994a45d@linaro.org> To: Bhupesh Sharma , Neha Malcom Francis , Tom Rini Cc: michal.simek@amd.com, marek.vasut+renesas@mailbox.org, bmeng.cn@gmail.com, venkatesh.abbarapu@amd.com, u-boot@lists.denx.de, Neil Armstrong , Love Kumar X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=8562; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=BqB/j77VWLz732dNzfVdTKN2U6MFKLyf7gGNEA97/uo=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBncnZkfwJSbuYd0F7zefZZwkm1J45Jd4eP+cz0Spgp jojTOrWJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZ3J2ZAAKCRB33NvayMhJ0ZVTEA CVfLpqfomHnrDqi7/XcshT9zitFTHs8mtM7xTpJHhBuGT9lJGBtyYlj+usoUw6tJPJCGlSNdkRJ/gJ SgeCha4bYGbpfP8qGBXRmM13FjndLjFubXtwJQ6ychFeHXr1nqfuu/fFDpbVMB47Rhuure26Lv6N/V /EPC5TqhPYDgwxAYO3st5hhd+LBq/EMgTCLEwzuzeYnSCE/luVyikE1ic8NKINedTt9MFNuDmkYXUB Ivw+R/BkD2Og4bVkZrtXk6lwRpHwNFfEgducuaP5tpjvPQkYoNp3z0vfTGvUnCxuadECsbvr77i+OZ UBjBuWdj2c/OOuRYzvbrOetva9/Hcel0YWvBsG/oPbhVL67XruQcFZU82aY1uYtT7J4Z6FkEYqvT8v DK8NRlsOYa3jScbTuCZvGYBPkd7W2/K6iswB/eqMDuUwjSN1ngaI9uUO7ofNV+7whR423C9I8tOiNH qTddd0z6XGYPUoGX9XZQLdFla1yC1xipUfJBZCUgp35PXn06r1mrK8mWbYe+rvaEj/4NV3svWUgIC0 e0BlSnjVL/igsYXXTfbItNW2f+DPRa1wueMYvjw55l7wsUXvjIpz9bPmPy+eIxAjaVsOj34zuvKQdv kDZNiaC32V1sWQhl9i/XvOP9ghGQbyjlVlY2kr4UP30knp4Pcd7uO5hiI9pg== 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 Sync unipro.h with the version found in the Linux v6.12 version commit adc218676eef ("Linux 6.12"). It adds new defines, and moves defines to the same place as the Linux header. No functional changes intended. Acked-by: Neha Malcom Francis Tested-by: Love Kumar Signed-off-by: Neil Armstrong --- drivers/ufs/unipro.h | 124 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 76 insertions(+), 48 deletions(-) diff --git a/drivers/ufs/unipro.h b/drivers/ufs/unipro.h index 0aa35ef31dfd263739c0b5c75c26f9191f38e8ec..56833602b77abbfa4abff5f2b57461986fe815dc 100644 --- a/drivers/ufs/unipro.h +++ b/drivers/ufs/unipro.h @@ -34,6 +34,18 @@ /* * M-RX Configuration Attributes */ +#define RX_HS_G1_SYNC_LENGTH_CAP 0x008B +#define RX_HS_G1_PREP_LENGTH_CAP 0x008C +#define RX_MIN_ACTIVATETIME_CAPABILITY 0x008F +#define RX_HIBERN8TIME_CAPABILITY 0x0092 +#define RX_HS_G2_SYNC_LENGTH_CAP 0x0094 +#define RX_HS_G3_SYNC_LENGTH_CAP 0x0095 +#define RX_HS_G2_PREP_LENGTH_CAP 0x0096 +#define RX_HS_G3_PREP_LENGTH_CAP 0x0097 +#define RX_ADV_GRANULARITY_CAP 0x0098 +#define RX_HIBERN8TIME_CAP 0x0092 +#define RX_ADV_HIBERN8TIME_CAP 0x0099 +#define RX_ADV_MIN_ACTIVATETIME_CAP 0x009A #define RX_MODE 0x00A1 #define RX_HSRATE_SERIES 0x00A2 #define RX_HSGEAR 0x00A3 @@ -42,24 +54,27 @@ #define RX_HS_UNTERMINATED_ENABLE 0x00A6 #define RX_ENTER_HIBERN8 0x00A7 #define RX_BYPASS_8B10B_ENABLE 0x00A8 -#define RX_TERMINATION_FORCE_ENABLE 0x0089 -#define RX_MIN_ACTIVATETIME_CAPABILITY 0x008F -#define RX_HIBERN8TIME_CAPABILITY 0x0092 +#define RX_TERMINATION_FORCE_ENABLE 0x00A9 +#define RXCALCTRL 0x00B4 +#define RXSQCTRL 0x00B5 +#define CFGRXCDR8 0x00BA +#define CFGRXOVR8 0x00BD +#define CFGRXOVR6 0x00BF +#define RXDIRECTCTRL2 0x00C7 +#define CFGRXOVR4 0x00E9 #define RX_REFCLKFREQ 0x00EB #define RX_CFGCLKFREQVAL 0x00EC #define CFGWIDEINLN 0x00F0 -#define CFGRXCDR8 0x00BA #define ENARXDIRECTCFG4 0x00F2 -#define CFGRXOVR8 0x00BD -#define RXDIRECTCTRL2 0x00C7 #define ENARXDIRECTCFG3 0x00F3 -#define RXCALCTRL 0x00B4 #define ENARXDIRECTCFG2 0x00F4 -#define CFGRXOVR4 0x00E9 -#define RXSQCTRL 0x00B5 -#define CFGRXOVR6 0x00BF #define is_mphy_tx_attr(attr) ((attr) < RX_MODE) +#define RX_ADV_FINE_GRAN_STEP(x) ((((x) & 0x3) << 1) | 0x1) +#define SYNC_LEN_FINE(x) ((x) & 0x3F) +#define SYNC_LEN_COARSE(x) ((1 << 6) | ((x) & 0x3F)) +#define PREP_LEN(x) ((x) & 0xF) + #define RX_MIN_ACTIVATETIME_UNIT_US 100 #define HIBERN8TIME_UNIT_US 100 @@ -80,48 +95,51 @@ #define UNIPRO_CB_OFFSET(x) (0x8000 | (x)) /* - * PHY Adpater attributes + * PHY Adapter attributes */ -#define PA_ACTIVETXDATALANES 0x1560 -#define PA_ACTIVERXDATALANES 0x1580 -#define PA_TXTRAILINGCLOCKS 0x1564 #define PA_PHY_TYPE 0x1500 #define PA_AVAILTXDATALANES 0x1520 -#define PA_AVAILRXDATALANES 0x1540 -#define PA_MINRXTRAILINGCLOCKS 0x1543 -#define PA_TXPWRSTATUS 0x1567 -#define PA_RXPWRSTATUS 0x1582 -#define PA_TXFORCECLOCK 0x1562 -#define PA_TXPWRMODE 0x1563 -#define PA_LEGACYDPHYESCDL 0x1570 #define PA_MAXTXSPEEDFAST 0x1521 #define PA_MAXTXSPEEDSLOW 0x1522 #define PA_MAXRXSPEEDFAST 0x1541 #define PA_MAXRXSPEEDSLOW 0x1542 #define PA_TXLINKSTARTUPHS 0x1544 +#define PA_AVAILRXDATALANES 0x1540 +#define PA_MINRXTRAILINGCLOCKS 0x1543 #define PA_LOCAL_TX_LCC_ENABLE 0x155E +#define PA_ACTIVETXDATALANES 0x1560 +#define PA_CONNECTEDTXDATALANES 0x1561 +#define PA_TXFORCECLOCK 0x1562 +#define PA_TXPWRMODE 0x1563 +#define PA_TXTRAILINGCLOCKS 0x1564 #define PA_TXSPEEDFAST 0x1565 #define PA_TXSPEEDSLOW 0x1566 -#define PA_REMOTEVERINFO 0x15A0 +#define PA_TXPWRSTATUS 0x1567 #define PA_TXGEAR 0x1568 #define PA_TXTERMINATION 0x1569 #define PA_HSSERIES 0x156A +#define PA_LEGACYDPHYESCDL 0x1570 #define PA_PWRMODE 0x1571 +#define PA_ACTIVERXDATALANES 0x1580 +#define PA_CONNECTEDRXDATALANES 0x1581 +#define PA_RXPWRSTATUS 0x1582 #define PA_RXGEAR 0x1583 #define PA_RXTERMINATION 0x1584 #define PA_MAXRXPWMGEAR 0x1586 #define PA_MAXRXHSGEAR 0x1587 -#define PA_RXHSUNTERMCAP 0x15A5 -#define PA_RXLSTERMCAP 0x15A6 -#define PA_GRANULARITY 0x15AA #define PA_PACPREQTIMEOUT 0x1590 #define PA_PACPREQEOBTIMEOUT 0x1591 +#define PA_REMOTEVERINFO 0x15A0 +#define PA_LOGICALLANEMAP 0x15A1 +#define PA_SLEEPNOCONFIGTIME 0x15A2 +#define PA_STALLNOCONFIGTIME 0x15A3 +#define PA_SAVECONFIGTIME 0x15A4 +#define PA_RXHSUNTERMCAP 0x15A5 +#define PA_RXLSTERMCAP 0x15A6 #define PA_HIBERN8TIME 0x15A7 #define PA_LOCALVERINFO 0x15A9 +#define PA_GRANULARITY 0x15AA #define PA_TACTIVATE 0x15A8 -#define PA_PACPFRAMECOUNT 0x15C0 -#define PA_PACPERRORCOUNT 0x15C1 -#define PA_PHYTESTCONTROL 0x15C2 #define PA_PWRMODEUSERDATA0 0x15B0 #define PA_PWRMODEUSERDATA1 0x15B1 #define PA_PWRMODEUSERDATA2 0x15B2 @@ -134,12 +152,9 @@ #define PA_PWRMODEUSERDATA9 0x15B9 #define PA_PWRMODEUSERDATA10 0x15BA #define PA_PWRMODEUSERDATA11 0x15BB -#define PA_CONNECTEDTXDATALANES 0x1561 -#define PA_CONNECTEDRXDATALANES 0x1581 -#define PA_LOGICALLANEMAP 0x15A1 -#define PA_SLEEPNOCONFIGTIME 0x15A2 -#define PA_STALLNOCONFIGTIME 0x15A3 -#define PA_SAVECONFIGTIME 0x15A4 +#define PA_PACPFRAMECOUNT 0x15C0 +#define PA_PACPERRORCOUNT 0x15C1 +#define PA_PHYTESTCONTROL 0x15C2 #define PA_TXHSADAPTTYPE 0x15D4 /* Adapt type for PA_TXHSADAPTTYPE attribute */ @@ -151,9 +166,9 @@ #define PA_HIBERN8_TIME_UNIT_US 100 /*Other attributes*/ +#define VS_POWERSTATE 0xD083 #define VS_MPHYCFGUPDT 0xD085 #define VS_DEBUGOMC 0xD09E -#define VS_POWERSTATE 0xD083 #define VS_MPHYDISABLE 0xD0C1 #define PA_GRANULARITY_MIN_VAL 1 @@ -163,7 +178,7 @@ #define PA_MAXDATALANES 4 /* PA power modes */ -enum { +enum ufs_pa_pwr_mode { FAST_MODE = 1, SLOW_MODE = 2, FASTAUTO_MODE = 4, @@ -171,8 +186,11 @@ enum { UNCHANGED = 7, }; +#define PWRMODE_MASK 0xF +#define PWRMODE_RX_OFFSET 4 + /* PA TX/RX Frequency Series */ -enum { +enum ufs_hs_gear_rate { PA_HS_MODE_A = 1, PA_HS_MODE_B = 2, }; @@ -193,14 +211,24 @@ enum ufs_hs_gear_tag { UFS_HS_G1, /* HS Gear 1 (default for reset) */ UFS_HS_G2, /* HS Gear 2 */ UFS_HS_G3, /* HS Gear 3 */ + UFS_HS_G4, /* HS Gear 4 */ + UFS_HS_G5 /* HS Gear 5 */ +}; + +enum ufs_lanes { + UFS_LANE_DONT_CHANGE, /* Don't change Lane */ + UFS_LANE_1, /* Lane 1 (default for reset) */ + UFS_LANE_2, /* Lane 2 */ }; enum ufs_unipro_ver { UFS_UNIPRO_VER_RESERVED = 0, UFS_UNIPRO_VER_1_40 = 1, /* UniPro version 1.40 */ UFS_UNIPRO_VER_1_41 = 2, /* UniPro version 1.41 */ - UFS_UNIPRO_VER_1_6 = 3, /* UniPro version 1.6 */ - UFS_UNIPRO_VER_MAX = 4, /* UniPro unsupported version */ + UFS_UNIPRO_VER_1_6 = 3, /* UniPro version 1.6 */ + UFS_UNIPRO_VER_1_61 = 4, /* UniPro version 1.61 */ + UFS_UNIPRO_VER_1_8 = 5, /* UniPro version 1.8 */ + UFS_UNIPRO_VER_MAX = 6, /* UniPro unsupported version */ /* UniPro version field mask in PA_LOCALVERINFO */ UFS_UNIPRO_VER_MASK = 0xF, }; @@ -208,27 +236,27 @@ enum ufs_unipro_ver { /* * Data Link Layer Attributes */ +#define DL_TXPREEMPTIONCAP 0x2000 +#define DL_TC0TXMAXSDUSIZE 0x2001 +#define DL_TC0RXINITCREDITVAL 0x2002 +#define DL_TC1TXMAXSDUSIZE 0x2003 +#define DL_TC1RXINITCREDITVAL 0x2004 +#define DL_TC0TXBUFFERSIZE 0x2005 +#define DL_TC1TXBUFFERSIZE 0x2006 #define DL_TC0TXFCTHRESHOLD 0x2040 #define DL_FC0PROTTIMEOUTVAL 0x2041 #define DL_TC0REPLAYTIMEOUTVAL 0x2042 #define DL_AFC0REQTIMEOUTVAL 0x2043 #define DL_AFC0CREDITTHRESHOLD 0x2044 #define DL_TC0OUTACKTHRESHOLD 0x2045 +#define DL_PEERTC0PRESENT 0x2046 +#define DL_PEERTC0RXINITCREVAL 0x2047 #define DL_TC1TXFCTHRESHOLD 0x2060 #define DL_FC1PROTTIMEOUTVAL 0x2061 #define DL_TC1REPLAYTIMEOUTVAL 0x2062 #define DL_AFC1REQTIMEOUTVAL 0x2063 #define DL_AFC1CREDITTHRESHOLD 0x2064 #define DL_TC1OUTACKTHRESHOLD 0x2065 -#define DL_TXPREEMPTIONCAP 0x2000 -#define DL_TC0TXMAXSDUSIZE 0x2001 -#define DL_TC0RXINITCREDITVAL 0x2002 -#define DL_TC0TXBUFFERSIZE 0x2005 -#define DL_PEERTC0PRESENT 0x2046 -#define DL_PEERTC0RXINITCREVAL 0x2047 -#define DL_TC1TXMAXSDUSIZE 0x2003 -#define DL_TC1RXINITCREDITVAL 0x2004 -#define DL_TC1TXBUFFERSIZE 0x2006 #define DL_PEERTC1PRESENT 0x2066 #define DL_PEERTC1RXINITCREVAL 0x2067 From patchwork Mon Dec 30 10:31:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 854241 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp6362045wrq; Mon, 30 Dec 2024 02:32:02 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUh1+0tutBwDxFTE6QlkfQq2Oxg0/iyCu99TvNfYPLqcG4p0dFJPZ0n8VC7VnIDsoU7Z2Rnow==@linaro.org X-Google-Smtp-Source: AGHT+IFzhiEkiOZv7CrMu8X+g9TlGRWixAvQjFMHrwdQbegKEbDa9bQIL4FLaAV4EOTdNDBF5sRf X-Received: by 2002:a17:907:1c10:b0:aa6:ac9b:681f with SMTP id a640c23a62f3a-aac3355d85bmr3207428766b.43.1735554722569; Mon, 30 Dec 2024 02:32:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735554722; cv=none; d=google.com; s=arc-20240605; b=hFTgUeYziceZIoutHFVSpfypO5HOZq58faHXixxqzPqBGCMvwM34lS+7lX8QEiUEuF ijKqxdjnOZDb0xuN9NSAcVuj9hvnHYYi4rXiH6ODOla+jXzw5RtVRPshwx4S6+WCCSY+ /ORbi5nGyMaxMvraTD5/ns0LQCDPToZn+sLvYFYs3XI/q4pztiF2EAKlJh029Gj22CNg SmiuazGA8C+yvtsqXcefQpYklHT2ShWl1ynzcoTj+j9Vmp5Yy3Djc9Zi+QteOnkaWo9j +20HJ5EpIiLxGFrPBS8M1ccGhRMHPsvuXZLJNW8tG88a/h7m8hei1tcpckejpcd0sqbm 9BWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=vtYSlc1uBzgE8dzeDkKxs9KOoTwtF+rm0XNgd+OsfSY=; fh=JM35mMbr8BH2glEi7wlEQ9BGTGkFD4zt1yRsoYymHaw=; b=WDyvHM08dJonfv+2x1f/iyKlO4zdB5g7LTV3i7BVJ38UMxb656Dc3+NbOo6ojbYFgR lFh5GSSs4GusmO6wF7njthXbh9e3d1MhPGv39y72wjyrQA98hbElfrGQzAVGnkal2vng jedGcEyJSy6plVLoKs7N9/lndxNWtHL0q2J3RVnQtEqljZfyj2Z2CXu4lMm5rNdAzzzD zadNsX63IpsO6t6qm1LcspS70rIMGpdy/B6Rm1OgdTgSYcwoasOH/saQnETpPzL+oVXt h9B9kSZIuDtMTx1HmG9gCowShgLYsK3JlUQhcTbuFIDLLMrC4IpIYSP3e0MLUIlSGGag rQUA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uJtazJer; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-aac0eff339csi1342456866b.300.2024.12.30.02.32.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2024 02:32:02 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uJtazJer; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 250B1805ED; Mon, 30 Dec 2024 11:31:16 +0100 (CET) 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="uJtazJer"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 843118066C; Mon, 30 Dec 2024 11:31:15 +0100 (CET) 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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,UPPERCASE_50_75 autolearn=no autolearn_force=no version=3.4.2 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (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 D1BDD806A7 for ; Mon, 30 Dec 2024 11:31:12 +0100 (CET) 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-x336.google.com with SMTP id 5b1f17b1804b1-435f8f29f8aso65627555e9.2 for ; Mon, 30 Dec 2024 02:31:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735554672; x=1736159472; 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=vtYSlc1uBzgE8dzeDkKxs9KOoTwtF+rm0XNgd+OsfSY=; b=uJtazJerkJlVthE31BtpvfO+cAZYBZfor9Wwq1zbfvmtC/8vkNe0d158mZP/TgPF23 u/WvYDx5pvT4WOGDDjB2n3/cInff8DUfyUUKIsKDI50B3PfioxP0OtftJA0IJtMfCBYU VwLgLIWjJAvhknPXECjT80UfkFstMwfb5qzaDPEOJX9/EcP5RalngBCJGAP6ySoFPlZ2 Vp+6Tt4XXlbpD3r0JZjfzi0DHdOhYBL0GwVlOYm69bpkA08WK0BzxIqpXxmCB9cEU8rj vwoYT/JuR7+OWyhGO25mUzhNAAgumBQeFNs+wATf4agFLOdX+0PvzEhG8bsOVrcWh+BL 3sCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735554672; x=1736159472; 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=vtYSlc1uBzgE8dzeDkKxs9KOoTwtF+rm0XNgd+OsfSY=; b=k3567I7GuKH/+3bSeNGRaz4DgOdI5MFPAGPM1EFbskPDPO0kRVhPnXZSfKrpbRCEhy Wpc2rjMvZSiifY08906in5nL3xb+WuQfZR2Jf2dFgPzQuH7pdkdiGswf4kwJq+I08Hbm lKkmQNBglXri8Z+LuQouGSkxb10j9iOYz1d1A9tjhcWNH4HVUbeWDr/w2R4u9SweKyzT /DoagtwARsI77DsnsPhQBE3ZhEJiZoNfsu7NGPu0lhRgLWjJJqCmxhLZytKgZz90prqo mNDnupcgG9ekaifKlG+5Us4JAdx0LwH3o56ZhuBp21H5xvwf03mn558YOG+AFBczo245 /fLQ== X-Forwarded-Encrypted: i=1; AJvYcCU+tLA8S5SqbygCP+feSBlywNmVUURjbTdgzR9C3HpwQmhiQqcKWfBN6Zv4hLt5XvL8GH40x4o=@lists.denx.de X-Gm-Message-State: AOJu0YyxwYjRhVGt0t3GdX3gHcStsPjRjx8BVjAsOCIHgdFrFPCmBci+ eZBPqePyALUNFR+PUvQmygFDlL6Y946Dv5g1CFFZbMhhG3M6vhFQx+ZMcuGYo6o= X-Gm-Gg: ASbGncvDkIJH4ftls3a8e1/+K0eJhUF5a2n6zryKTjZOTA5TWh9l9Oy7L8xX7J1Xi8E H3T2FIcLdaLeND65nWx51bhFTVunnkpojgFUw+wJD98tSrEWfwYFIIl5CKTKqiioR9eRf0W9pK2 qDkG6uCXD1r39HNXolRgzzrkyQA1i85XB6RR104GNkXg8wTfDgFCazbXm1ZFPtPE8vVqXQ9kuDy lcjgwWPt4yluUVg1J5vfOSQWI0mWAXCG2KtLFlZqB6l4l1PAhaZDgSXEtrw6vajgOy9CCJcyh5I qw== X-Received: by 2002:a5d:6da2:0:b0:385:d7a7:ad60 with SMTP id ffacd0b85a97d-38a221f11b2mr31763525f8f.3.1735554667638; Mon, 30 Dec 2024 02:31:07 -0800 (PST) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c89e1c0sm30201550f8f.77.2024.12.30.02.31.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2024 02:31:07 -0800 (PST) From: Neil Armstrong Date: Mon, 30 Dec 2024 11:31:00 +0100 Subject: [PATCH v2 6/6] ufs: core: sync ufshci.h with Linux v6.12 MIME-Version: 1.0 Message-Id: <20241230-topic-ufs-cleanup-v2-6-4c6d7994a45d@linaro.org> References: <20241230-topic-ufs-cleanup-v2-0-4c6d7994a45d@linaro.org> In-Reply-To: <20241230-topic-ufs-cleanup-v2-0-4c6d7994a45d@linaro.org> To: Bhupesh Sharma , Neha Malcom Francis , Tom Rini Cc: michal.simek@amd.com, marek.vasut+renesas@mailbox.org, bmeng.cn@gmail.com, venkatesh.abbarapu@amd.com, u-boot@lists.denx.de, Neil Armstrong , Love Kumar X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=11520; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=mw3KCZaPbgM9eDz7r3959ekqf9kLxMyERVVfuDZ2p5w=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBncnZkB4z+eMrmD9bgiTPzFKbcjaTSsugR9/scLM9c NGMv4laJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZ3J2ZAAKCRB33NvayMhJ0S8SEA DQN9qvk2aDzLK9jGIO5Y1xmnVNU1IWvpMfYtB2gXkcjjW8tZP6McOCVVS4g3GL1+8XtpXNtjM6O+oj um+4nKzQ5CyrepJa5Rt/5poE8zX/iztuZ5v156gVhW+lydOFw5cA7hL2hSag2YGUP8trZ4iul6RWVt y0B8vnEafizjqlbplauQJNJA1e5h/ZjpFBJD/s9CGuDrtPEBgQbaAXsTxujIgD3KFbY4725eS4S1Gl yRcLRMsBBoiX6NmnRuEJ1SXEpDyv5h9fqiF3v5vJtEG1bKw1IKfT2wrPDdrAc2Md3yVCvxEcS+9E54 7rInwM+21gY1aJtA2EE0PtFtyFyst6vJNIyygaee3Q4vi1zlytLYdIFEy8Bb+CN4KBGywsDSgaqOoM CGwpu58At9rBlgeq3glUdIp6jPFJHoIiNQX9awKo9dt0hXN+72xI0fBjSXiWIfOiR1IY+eDo9Nux6P krf/JngEEkqZyKLbtFKo33pMiCP4z/NpxWI8TfcmDoBKjl70LwIGnGLnVV60ZhaUqbw7QO+E4sGjoj fVFNxfUs3QhDD0ZNjwlOTKiloiAZuNBmH9FkZHzFYi16WtrznfLDqrC6C8P1Qo71YMdVwr9lOOUEw4 ZCMHGCB/9eMiRKv7TfLtwN626fBt8KHEwqafEJ6NpE9vykMu9s0CDPQMUAEQ== 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 Sync ufshci.h with the version found in the Linux v6.12 version commit adc218676eef ("Linux 6.12"). It adds new defines, and moves defines to the same place as the Linux header. No functional changes intended. Acked-by: Neha Malcom Francis Tested-by: Love Kumar Signed-off-by: Neil Armstrong --- drivers/ufs/ufshci.h | 285 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 210 insertions(+), 75 deletions(-) diff --git a/drivers/ufs/ufshci.h b/drivers/ufs/ufshci.h index db30812b176f9e36529452e260b847241f97fdab..08af517b1028804e64602767f7a51bbfb083c59b 100644 --- a/drivers/ufs/ufshci.h +++ b/drivers/ufs/ufshci.h @@ -8,61 +8,14 @@ enum { ALIGNED_UPIU_SIZE = 512, }; -/* To accommodate UFS2.0 required Command type */ -enum { - UTP_CMD_TYPE_UFS_STORAGE = 0x1, -}; - -enum { - UTP_SCSI_COMMAND = 0x00000000, - UTP_NATIVE_UFS_COMMAND = 0x10000000, - UTP_DEVICE_MANAGEMENT_FUNCTION = 0x20000000, - UTP_REQ_DESC_INT_CMD = 0x01000000, -}; - -/* UTP Transfer Request Data Direction (DD) */ -enum { - UTP_NO_DATA_TRANSFER = 0x00000000, - UTP_HOST_TO_DEVICE = 0x02000000, - UTP_DEVICE_TO_HOST = 0x04000000, -}; - -/* Overall command status values */ -enum { - OCS_SUCCESS = 0x0, - OCS_INVALID_CMD_TABLE_ATTR = 0x1, - OCS_INVALID_PRDT_ATTR = 0x2, - OCS_MISMATCH_DATA_BUF_SIZE = 0x3, - OCS_MISMATCH_RESP_UPIU_SIZE = 0x4, - OCS_PEER_COMM_FAILURE = 0x5, - OCS_ABORTED = 0x6, - OCS_FATAL_ERROR = 0x7, - OCS_INVALID_COMMAND_STATUS = 0x0F, - MASK_OCS = 0x0F, -}; - -/* The maximum length of the data byte count field in the PRDT is 256KB */ -#define PRDT_DATA_BYTE_COUNT_MAX (256 * 1024) -/* The granularity of the data byte count field in the PRDT is 32-bit */ -#define PRDT_DATA_BYTE_COUNT_PAD 4 - -/* Controller UFSHCI version */ -enum { - UFSHCI_VERSION_10 = 0x00010000, /* 1.0 */ - UFSHCI_VERSION_11 = 0x00010100, /* 1.1 */ - UFSHCI_VERSION_20 = 0x00000200, /* 2.0 */ - UFSHCI_VERSION_21 = 0x00000210, /* 2.1 */ - UFSHCI_VERSION_30 = 0x00000300, /* 3.0 */ - UFSHCI_VERSION_31 = 0x00000310, /* 3.1 */ - UFSHCI_VERSION_40 = 0x00000400, /* 4.0 */ -}; - /* UFSHCI Registers */ enum { REG_CONTROLLER_CAPABILITIES = 0x00, + REG_MCQCAP = 0x04, REG_UFS_VERSION = 0x08, - REG_CONTROLLER_DEV_ID = 0x10, - REG_CONTROLLER_PROD_ID = 0x14, + REG_EXT_CONTROLLER_CAPABILITIES = 0x0C, + REG_CONTROLLER_PID = 0x10, + REG_CONTROLLER_MID = 0x14, REG_AUTO_HIBERNATE_IDLE_TIMER = 0x18, REG_INTERRUPT_STATUS = 0x20, REG_INTERRUPT_ENABLE = 0x24, @@ -94,20 +47,98 @@ enum { REG_UFS_CCAP = 0x100, REG_UFS_CRYPTOCAP = 0x104, + REG_UFS_MEM_CFG = 0x300, + REG_UFS_MCQ_CFG = 0x380, + REG_UFS_ESILBA = 0x384, + REG_UFS_ESIUBA = 0x388, UFSHCI_CRYPTO_REG_SPACE_SIZE = 0x400, }; /* Controller capability masks */ enum { - MASK_TRANSFER_REQUESTS_SLOTS = 0x0000001F, + MASK_TRANSFER_REQUESTS_SLOTS_SDB = 0x0000001F, + MASK_TRANSFER_REQUESTS_SLOTS_MCQ = 0x000000FF, + MASK_NUMBER_OUTSTANDING_RTT = 0x0000FF00, MASK_TASK_MANAGEMENT_REQUEST_SLOTS = 0x00070000, + MASK_EHSLUTRD_SUPPORTED = 0x00400000, MASK_AUTO_HIBERN8_SUPPORT = 0x00800000, MASK_64_ADDRESSING_SUPPORT = 0x01000000, MASK_OUT_OF_ORDER_DATA_DELIVERY_SUPPORT = 0x02000000, MASK_UIC_DME_TEST_MODE_SUPPORT = 0x04000000, + MASK_CRYPTO_SUPPORT = 0x10000000, + MASK_LSDB_SUPPORT = 0x20000000, + MASK_MCQ_SUPPORT = 0x40000000, +}; + +/* MCQ capability mask */ +enum { + MASK_EXT_IID_SUPPORT = 0x00000400, +}; + +enum { + REG_SQATTR = 0x0, + REG_SQLBA = 0x4, + REG_SQUBA = 0x8, + REG_SQDAO = 0xC, + REG_SQISAO = 0x10, + + REG_CQATTR = 0x20, + REG_CQLBA = 0x24, + REG_CQUBA = 0x28, + REG_CQDAO = 0x2C, + REG_CQISAO = 0x30, +}; + +enum { + REG_SQHP = 0x0, + REG_SQTP = 0x4, + REG_SQRTC = 0x8, + REG_SQCTI = 0xC, + REG_SQRTS = 0x10, +}; + +enum { + REG_CQHP = 0x0, + REG_CQTP = 0x4, +}; + +enum { + REG_CQIS = 0x0, + REG_CQIE = 0x4, +}; + +enum { + SQ_START = 0x0, + SQ_STOP = 0x1, + SQ_ICU = 0x2, +}; + +enum { + SQ_STS = 0x1, + SQ_CUS = 0x2, +}; + +#define SQ_ICU_ERR_CODE_MASK GENMASK(7, 4) +#define UFS_MASK(mask, offset) ((mask) << (offset)) + +/* UFS Version 08h */ +#define MINOR_VERSION_NUM_MASK UFS_MASK(0xFFFF, 0) +#define MAJOR_VERSION_NUM_MASK UFS_MASK(0xFFFF, 16) + +/* Controller UFSHCI version */ +enum { + UFSHCI_VERSION_10 = 0x00010000, /* 1.0 */ + UFSHCI_VERSION_11 = 0x00010100, /* 1.1 */ + UFSHCI_VERSION_20 = 0x00000200, /* 2.0 */ + UFSHCI_VERSION_21 = 0x00000210, /* 2.1 */ + UFSHCI_VERSION_30 = 0x00000300, /* 3.0 */ + UFSHCI_VERSION_31 = 0x00000310, /* 3.1 */ + UFSHCI_VERSION_40 = 0x00000400, /* 4.0 */ }; -/* Interrupt Status 20h */ +/* + * IS - Interrupt Status - 20h + */ #define UTP_TRANSFER_REQ_COMPL 0x1 #define UIC_DME_END_PT_RESET 0x2 #define UIC_ERROR 0x4 @@ -122,25 +153,25 @@ enum { #define DEVICE_FATAL_ERROR 0x800 #define CONTROLLER_FATAL_ERROR 0x10000 #define SYSTEM_BUS_FATAL_ERROR 0x20000 +#define CRYPTO_ENGINE_FATAL_ERROR 0x40000 +#define MCQ_CQ_EVENT_STATUS 0x100000 -#define UFSHCD_UIC_PWR_MASK (UIC_HIBERNATE_ENTER |\ - UIC_HIBERNATE_EXIT |\ +#define UFSHCD_UIC_HIBERN8_MASK (UIC_HIBERNATE_ENTER |\ + UIC_HIBERNATE_EXIT) + +#define UFSHCD_UIC_PWR_MASK (UFSHCD_UIC_HIBERN8_MASK |\ UIC_POWER_MODE) -#define UFSHCD_UIC_MASK (UIC_COMMAND_COMPL | UIC_POWER_MODE) +#define UFSHCD_UIC_MASK (UIC_COMMAND_COMPL | UFSHCD_UIC_PWR_MASK) -#define UFSHCD_ERROR_MASK (UIC_ERROR |\ - DEVICE_FATAL_ERROR |\ - CONTROLLER_FATAL_ERROR |\ - SYSTEM_BUS_FATAL_ERROR) +#define UFSHCD_ERROR_MASK (UIC_ERROR | INT_FATAL_ERRORS) #define INT_FATAL_ERRORS (DEVICE_FATAL_ERROR |\ CONTROLLER_FATAL_ERROR |\ - SYSTEM_BUS_FATAL_ERROR) + SYSTEM_BUS_FATAL_ERROR |\ + CRYPTO_ENGINE_FATAL_ERROR |\ + UIC_LINK_LOST) -/* Host Controller Enable 0x34h */ -#define CONTROLLER_ENABLE 0x1 -#define CONTROLLER_DISABLE 0x0 /* HCS - Host Controller Status 30h */ #define DEVICE_PRESENT 0x1 #define UTP_TRANSFER_REQ_LIST_READY 0x2 @@ -163,6 +194,70 @@ enum { PWR_FATAL_ERROR = 0x05, }; +/* HCE - Host Controller Enable 34h */ +#define CONTROLLER_ENABLE 0x1 +#define CONTROLLER_DISABLE 0x0 +#define CRYPTO_GENERAL_ENABLE 0x2 + +/* UECPA - Host UIC Error Code PHY Adapter Layer 38h */ +#define UIC_PHY_ADAPTER_LAYER_ERROR 0x80000000 +#define UIC_PHY_ADAPTER_LAYER_ERROR_CODE_MASK 0x1F +#define UIC_PHY_ADAPTER_LAYER_LANE_ERR_MASK 0xF +#define UIC_PHY_ADAPTER_LAYER_GENERIC_ERROR 0x10 + +/* UECDL - Host UIC Error Code Data Link Layer 3Ch */ +#define UIC_DATA_LINK_LAYER_ERROR 0x80000000 +#define UIC_DATA_LINK_LAYER_ERROR_CODE_MASK 0xFFFF +#define UIC_DATA_LINK_LAYER_ERROR_TCX_REP_TIMER_EXP 0x2 +#define UIC_DATA_LINK_LAYER_ERROR_AFCX_REQ_TIMER_EXP 0x4 +#define UIC_DATA_LINK_LAYER_ERROR_FCX_PRO_TIMER_EXP 0x8 +#define UIC_DATA_LINK_LAYER_ERROR_RX_BUF_OF 0x20 +#define UIC_DATA_LINK_LAYER_ERROR_PA_INIT 0x2000 +#define UIC_DATA_LINK_LAYER_ERROR_NAC_RECEIVED 0x0001 +#define UIC_DATA_LINK_LAYER_ERROR_TCx_REPLAY_TIMEOUT 0x0002 + +/* UECN - Host UIC Error Code Network Layer 40h */ +#define UIC_NETWORK_LAYER_ERROR 0x80000000 +#define UIC_NETWORK_LAYER_ERROR_CODE_MASK 0x7 +#define UIC_NETWORK_UNSUPPORTED_HEADER_TYPE 0x1 +#define UIC_NETWORK_BAD_DEVICEID_ENC 0x2 +#define UIC_NETWORK_LHDR_TRAP_PACKET_DROPPING 0x4 + +/* UECT - Host UIC Error Code Transport Layer 44h */ +#define UIC_TRANSPORT_LAYER_ERROR 0x80000000 +#define UIC_TRANSPORT_LAYER_ERROR_CODE_MASK 0x7F +#define UIC_TRANSPORT_UNSUPPORTED_HEADER_TYPE 0x1 +#define UIC_TRANSPORT_UNKNOWN_CPORTID 0x2 +#define UIC_TRANSPORT_NO_CONNECTION_RX 0x4 +#define UIC_TRANSPORT_CONTROLLED_SEGMENT_DROPPING 0x8 +#define UIC_TRANSPORT_BAD_TC 0x10 +#define UIC_TRANSPORT_E2E_CREDIT_OVERFOW 0x20 +#define UIC_TRANSPORT_SAFETY_VALUE_DROPPING 0x40 + +/* UECDME - Host UIC Error Code DME 48h */ +#define UIC_DME_ERROR 0x80000000 +#define UIC_DME_ERROR_CODE_MASK 0x1 + +/* UTRIACR - Interrupt Aggregation control register - 0x4Ch */ +#define INT_AGGR_TIMEOUT_VAL_MASK 0xFF +#define INT_AGGR_COUNTER_THRESHOLD_MASK UFS_MASK(0x1F, 8) +#define INT_AGGR_COUNTER_AND_TIMER_RESET 0x10000 +#define INT_AGGR_STATUS_BIT 0x100000 +#define INT_AGGR_PARAM_WRITE 0x1000000 +#define INT_AGGR_ENABLE 0x80000000 + +/* UTRLRSR - UTP Transfer Request Run-Stop Register 60h */ +#define UTP_TRANSFER_REQ_LIST_RUN_STOP_BIT 0x1 + +/* UTMRLRSR - UTP Task Management Request Run-Stop Register 80h */ +#define UTP_TASK_REQ_LIST_RUN_STOP_BIT 0x1 + +/* REG_UFS_MEM_CFG - Global Config Registers 300h */ +#define MCQ_MODE_SELECT BIT(0) + +/* CQISy - CQ y Interrupt Status Register */ +#define UFSHCD_MCQ_CQIS_TAIL_ENT_PUSH_STS 0x1 + /* UICCMD - UIC Command */ #define COMMAND_OPCODE_MASK 0xFF #define GEN_SELECTOR_INDEX_MASK 0xFFFF @@ -171,7 +266,7 @@ enum { #define RESET_LEVEL 0xFF #define ATTR_SET_TYPE_MASK UFS_MASK(0xFF, 16) -#define CFG_RESULT_CODE_MASK 0xFF +#define CONFIG_RESULT_CODE_MASK 0xFF #define GENERIC_ERROR_CODE_MASK 0xFF /* GenSelectorIndex calculation macros for M-PHY attributes */ @@ -190,12 +285,6 @@ enum link_status { UFSHCD_LINK_IS_UP = 2, }; -#define UIC_ARG_MIB_SEL(attr, sel) ((((attr) & 0xFFFF) << 16) |\ - ((sel) & 0xFFFF)) -#define UIC_ARG_MIB(attr) UIC_ARG_MIB_SEL(attr, 0) -#define UIC_ARG_ATTR_TYPE(t) (((t) & 0xFF) << 16) -#define UIC_GET_ATTR_ID(v) (((v) >> 16) & 0xFFFF) - /* UIC Commands */ enum uic_cmd_dme { UIC_CMD_DME_GET = 0x01, @@ -231,11 +320,57 @@ enum { #define MASK_UIC_COMMAND_RESULT 0xFF -/* UTRLRSR - UTP Transfer Request Run-Stop Register 60h */ -#define UTP_TRANSFER_REQ_LIST_RUN_STOP_BIT 0x1 +#define INT_AGGR_COUNTER_THLD_VAL(c) (((c) & 0x1F) << 8) +#define INT_AGGR_TIMEOUT_VAL(t) (((t) & 0xFF) << 0) + +/* + * Request Descriptor Definitions + */ + +/* To accommodate UFS2.0 required Command type */ +enum { + UTP_CMD_TYPE_UFS_STORAGE = 0x1, +}; + +enum { + UTP_SCSI_COMMAND = 0x00000000, + UTP_REQ_DESC_INT_CMD = 0x01000000, + UTP_NATIVE_UFS_COMMAND = 0x10000000, + UTP_DEVICE_MANAGEMENT_FUNCTION = 0x20000000, +}; + +/* UTP Transfer Request Data Direction (DD) */ +enum utp_data_direction { + UTP_NO_DATA_TRANSFER = 0, + UTP_HOST_TO_DEVICE = 1, + UTP_DEVICE_TO_HOST = 2, +}; + +/* Overall command status values */ +enum utp_ocs { + OCS_SUCCESS = 0x0, + OCS_INVALID_CMD_TABLE_ATTR = 0x1, + OCS_INVALID_PRDT_ATTR = 0x2, + OCS_MISMATCH_DATA_BUF_SIZE = 0x3, + OCS_MISMATCH_RESP_UPIU_SIZE = 0x4, + OCS_PEER_COMM_FAILURE = 0x5, + OCS_ABORTED = 0x6, + OCS_FATAL_ERROR = 0x7, + OCS_DEVICE_FATAL_ERROR = 0x8, + OCS_INVALID_CRYPTO_CONFIG = 0x9, + OCS_GENERAL_CRYPTO_ERROR = 0xA, + OCS_INVALID_COMMAND_STATUS = 0x0F, +}; + +enum { + MASK_OCS = 0x0F, +}; + +/* The maximum length of the data byte count field in the PRDT is 256KB */ +#define PRDT_DATA_BYTE_COUNT_MAX SZ_256K +/* The granularity of the data byte count field in the PRDT is 32-bit */ +#define PRDT_DATA_BYTE_COUNT_PAD 4 -/* UTMRLRSR - UTP Task Management Request Run-Stop Register 80h */ -#define UTP_TASK_REQ_LIST_RUN_STOP_BIT 0x1 struct ufshcd_sg_entry { __le32 base_addr;