From patchwork Wed Nov 20 09:22:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 844515 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp1606007wrx; Wed, 20 Nov 2024 01:23:01 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX6VsUX6gUX32UeNLC/g1F4kerv3aNkPmgmbu8TGSSMh2OA/LaWumYRJZttCB4cpadwgxHdbA==@linaro.org X-Google-Smtp-Source: AGHT+IH0vhZGNN3HOrv1yVzyvSmcsUVVpUAHBprItEp4F4pOJRpEVCW/aV0WYsIGqAf+fMX4W8Fr X-Received: by 2002:ac2:5964:0:b0:53d:ab1d:ff68 with SMTP id 2adb3069b0e04-53dc1343097mr1137106e87.34.1732094581563; Wed, 20 Nov 2024 01:23:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732094581; cv=none; d=google.com; s=arc-20240605; b=Xk0VBKJIvQdCfGFhUIUpGPay2BBzXtA148/zrQoRYxnHH86ljZi3aE3WUo6dCBirr9 T0bI5oupYmAhUvuq1xhEOmYwQPdfZerUveCHD5F59dBL7muoBOJPCMWwNPqhAN0IwEor FnjtNDdR4mfFH13bwPCMWyHTLQ8O7/R/rKjZx8fNcBuY1vQfX9hP43xgbVhvj+h2OZ5d k0pF4hI39k/X2jKICVcaoba2BTOz3OOYN3GuFbq8ffZfWp2c/zz+M88/gWhw5nDSwB8A v5puYZsCtmEiLEiufIAbYTbKbLrQjbySc0Xh8fVpapHVpad1qaJEpgrdLRtu4vSaEAJg aSLA== 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=yuQ5TzXWP5OfUIZvQzt0XVE1jS/2Og+WgtXMFL/PJ4E=; fh=YA49zVfN8RJ5zI+FNzYWljHqLmxmzfq3nzy1KH5CS0Y=; b=HnhPlcXqqY03GfnZGPkEkDqvOiC15fwMwiu4MWPlVABfFzSksDQo+XlkVtYMvoCqCl +ZFrqpJoLLfHAmRJcNGbeePu6Br4IdrYA6Aeyh79hcAIMSL14Z+I909gs2EAiLjdsjsu Lyhsd3zpMYpa9x5fdtB1PduT4bh8C/jPKAWRi/6iI1SeSSs7e8oVHF62hiS0L8b6w5KG 2pakdA+418XRE38jLxTC5793bls+hAXfxP0Wks9s0OZxW7IctZty2i/TQozuBbKVNCmG FkYE64vS92RYGH3RGzaiUIPNKABFk7UkT3X7PeThwjJYNEzxMFso/BfwEEFJ4djOHUcD IzIg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Nx9rNGMV; 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-aa20e015da0si841741066b.386.2024.11.20.01.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 01:23:01 -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=Nx9rNGMV; 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 9252489661; Wed, 20 Nov 2024 10:22:53 +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="Nx9rNGMV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EBCE488F20; Wed, 20 Nov 2024 10:22:50 +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 F088889500 for ; Wed, 20 Nov 2024 10:22:48 +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-43162cf1eaaso56176945e9.0 for ; Wed, 20 Nov 2024 01:22:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732094568; x=1732699368; 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=yuQ5TzXWP5OfUIZvQzt0XVE1jS/2Og+WgtXMFL/PJ4E=; b=Nx9rNGMV+eVUp1yRosM5zAx1Wbv5t758F1SKXae0Joe0B9Lc+4wbirYojM9UoLrdgL mOwc6peZlHM43h8ESeRwvCgApRZtyDV3DxU5b5K1myBSbn+QllgjvuMY33ixUvvUIajm Dy7G5fgH9Fhg/dC/nij4sny1McJ0KdWjpVt5/4o1jAE423fL4AY1rT2C4NlSCp0m+EQP uTDykHQ/FYVbIB9kw/Fp44MY0BAfZzDxwskZNSupD0M1Zucrg98HKJYqYjg3YVOlAdDg p0bTxkmN5amKBIJTs+LCyiWoFNiw3A/KVnFe4SQFwQ608ZvxW3muWvMLcoLtuowJ3cZC z0eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732094568; x=1732699368; 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=yuQ5TzXWP5OfUIZvQzt0XVE1jS/2Og+WgtXMFL/PJ4E=; b=fONau544RubEdX22CJxNdqUF6TMR4Vsx9gmEHtPvC/sknNcZj0wpkbywn1+wMFKIK2 7gX32FyDP3qZ9TEWWSzQMidlKg5biyicRkWJCAAoN6dQ4IHFfBMvKfMlNGuqFPX6QzSE kUhXRg0EUqmkE+gNHOr9elOP8SrGP1UxEA6ft9h0dhAa6X09S9kKaZFEQg7N18dquOyA Mlezi5aCIENQbJV6l9TiGhvcwdIhHN4DJ4LAZQ9Mpt5yHjEUubrehQJcFVhoke6V3K50 O9JWLp+xCtFmgJdS92LFUboCnkD4P8rPqFE9Z7y7M89QqhF9PGuPn7npSnP+uawSZvu9 YvTQ== X-Forwarded-Encrypted: i=1; AJvYcCWWG+8DbfRnB0oi/WQeIjcVjxUT9HO30pqZg4WMpEzxemwgnPUs3CNo50gkz+8yPFNQL5KcUkA=@lists.denx.de X-Gm-Message-State: AOJu0YytOvbk3wszRbTKmX4ChoQoCpodAEPxexVYxxy87vTuDG+IKGwj 2mP2TzpumoS1sLVFHXQD5oX7VxXiNu7DPOw5I2fAEvEmSpTwnIO0YFtXA8U25oE= X-Received: by 2002:a05:6000:184f:b0:382:3f77:8584 with SMTP id ffacd0b85a97d-38254afa9b6mr1563731f8f.32.1732094568506; Wed, 20 Nov 2024 01:22:48 -0800 (PST) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:8261:5fff:fe11:bdda]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3825490529fsm1557333f8f.4.2024.11.20.01.22.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 01:22:48 -0800 (PST) From: Neil Armstrong Date: Wed, 20 Nov 2024 10:22:42 +0100 Subject: [PATCH 1/6] ufs: core: include missing include/ufs.h MIME-Version: 1.0 Message-Id: <20241120-topic-ufs-cleanup-v1-1-a5cef54b1cdc@linaro.org> References: <20241120-topic-ufs-cleanup-v1-0-a5cef54b1cdc@linaro.org> In-Reply-To: <20241120-topic-ufs-cleanup-v1-0-a5cef54b1cdc@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 X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=583; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=Wh1qd89AhJPQGtArWexykWlNyamVeqfZNnA3tF5gY4I=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBnPapkFLBOIqb7Aar9YqJEHrgoUf9DPXNONtVJQtRA sILL0V2JAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZz2qZAAKCRB33NvayMhJ0W4/EA Cxr90/x3ir42sWmcZPqNvUjw3/yK5okM0FRVUlIZ8v9sgPquZEcJJO47kmZA4MA9frGbOY4476V5fT Usy7soAynXBdr9CPw63Gs6IeyjuG3wjebxgt9JmCiIQO5n3F6OH5eCEzHVcgR/ovnyGBhEvOBN0ruS vHPO79de6J8hwQJ111/lWkGSFZp3/0LJclJJnY+yLYRpBMrLasvdPKASPU4KDTz9/wDKjNj6e1cIRE usabThwSrbt5V/pNDP+DfktMJw+c1+aHBeUyT7wnCDDQWFP5NOFBx3V8A5lQmsFf14SuDUFXLvLoCZ q1xFPuZhT5G1jnBSFX0ld+S7a56A912hg5tcXN+ppnq2VRYz1h6jVOjGd47IrKCi2atamgI6Oj9cTY ejNbDUKljdHtXCQTqNSf6/ogi9SUHvIHhGFgu3BLRDCYFHSF19muUZD+LkYYOeD5CpYGwLbKGYf6zK iqI3ppf+UpxRTfHjnxVhkvS5k2f5K67EbMsyEep0rrppDFrklMBPF1auuQM2fdZYT4uj8GfOlrIwnN V432rXGz1dmOJ24IBPNHEoba+DiIJcIC7tutKDn8rK86YtoMibIc49UMxEAWewcxLI0UcRvTRZ8Psd JRsXI6N9cTUcLW9y4Q7ElRYqo+UiFY9pK2JIx2c/ngc7V+SEuIEIljbUV5WA== 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. 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 Wed Nov 20 09:22:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 844516 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp1606049wrx; Wed, 20 Nov 2024 01:23:08 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCULA4/gIaUsaoIdPEnKDjh0GiYrvs6IIhF9WNpfli1PER+2/YpLpxnoqJK8fZcsZwCofM/73A==@linaro.org X-Google-Smtp-Source: AGHT+IHemFkHrcJOw+P9MxOniqXCO2MINcylsMKkpoFxBdNIOonV9vKS/RmpxJcfpsT/r70iW4MR X-Received: by 2002:a17:906:fe01:b0:a99:f5d8:726 with SMTP id a640c23a62f3a-aa4dcd5e51bmr166291666b.23.1732094588658; Wed, 20 Nov 2024 01:23:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732094588; cv=none; d=google.com; s=arc-20240605; b=HeCQvKxMTCd9qtdIlhpKcLlUsVIo1Nm0OWBsS6TiOEyBhG5CYy+dyXSo+0/y13+e99 1UtMtyXlDQ/wvZ137XLzFdLAgyf/TAOS4dZJr4h1z7AIZYaPMAnzC4aYEuGQazlvr8nm 1IrXwh2K1P/DSQdnVp6Wr8ngtg+mZk/gJV9nafxK165t3r0I8naM30wjh1Wref5aSHux QOC7bMKfeL7wQewoyOhkbrXPxhwzUGOed3ympJvFo7mgIiICjKHeGDCAlIAl+9DbKcb5 EB3kqBO09XXMTzm+SRgAD2gLgLEoa/KQeG8ORIjLRkdgQw8njjtjfdpJkljZTMSBGI9u XxMw== 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=/Y1gMFnlB7TYksUC/LfXjXcu/lzeZpum+ykeIjwe0yQ=; fh=s9zrUyE9C9czT1NfC3lWuHozW/PXrkgWnCOWnovvFBo=; b=lxbaSzFYUc7atPYeMSz+3TCAD5pEvBfe3d2v5qJZwnChgvG3OE7WM5zcNy+Bq50bAu W+hneg9om6KLRy4TtXk2VXsXxdh9k45KVfARIrqSaQtY+/v73F1b0MzqF9eXqz/oTvJl Cqwx+LKkTgveNTQvZRebcndRANvVjOr9kXumvPA6PMA7GXyXwys4aGSWL7WAKpFpbO0K 4c5s4cjYtKk6V9qh5hZ1/LZC+dZGrou+cxS2WNbMLWdJsAInSWH0N1wMH2SDrplU3MO9 6kAdgvzMngLI/zxSmLa/+4jpq5CjZfNJILvjFt0sHE7gs9tuPv/T1wfZ8X3Oo60AL7Zk UzkQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RIBExUPe; 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-aa20df3ce86si812847966b.14.2024.11.20.01.23.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 01:23:08 -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=RIBExUPe; 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 EC53689680; Wed, 20 Nov 2024 10:22:53 +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="RIBExUPe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A19A18967C; Wed, 20 Nov 2024 10:22:52 +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-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) (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 B0DB489555 for ; Wed, 20 Nov 2024 10:22:49 +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-x32f.google.com with SMTP id 5b1f17b1804b1-432d9b8558aso3488725e9.0 for ; Wed, 20 Nov 2024 01:22:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732094569; x=1732699369; 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=/Y1gMFnlB7TYksUC/LfXjXcu/lzeZpum+ykeIjwe0yQ=; b=RIBExUPejhenCJ4tVe6JeJPBOVqUGYCNRV2YMSmPMjpC+LA6mWcBD5y1vtQHy37Gac lcA2EYuRfZvJS9xdC1bxYYekucHyighh3D0zoDqBNr5sF32I/+V0bCY8JhHuenZaqH/o aUKkNddMo90qO8ogXt5Gg+wITg5W4+vSS7ZVibBTZ/tAsz51VxApNVWKPny8o7+BTFrH G1ExNhtfD2kNGZUgdRY61+wDRBFyeXyW/FDAq17nBMxrTE0KsxAWpcn11d5z1HH0Mx5/ vYvdiK+NdG/J+wpW+X0KrrPLDoQKEpiYOGpNdzCuTMuPKSrMfG/uLfj3XaXquDwPFOdj ynrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732094569; x=1732699369; 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=/Y1gMFnlB7TYksUC/LfXjXcu/lzeZpum+ykeIjwe0yQ=; b=WVI6H5LWGtltxRvlu7Q+Gq0a5Dfd7Ph9uE1xfZ3pAnAuP8mK7Awt72IiMc3NG2JpgH 0pg3c/3rwTy9MQWrMOB7TiP4oDtCm/y6bT2UMpGUi/cOxKzo2Lbvg40ptL302y4Bssbh P31q3YDfUsL/qNRjolUYdZEAQQeREao9FjB9PpQRLdCI13hokWMKXr4RoT9CFuTPmCEJ /I6nCvtgrZLXDapCE2TRqx9CwymvFBWXk8DBCe2gr9VdQ3GA8/TOf2/5ntEXnaw4W6Zg dZiMsvVsk1IGiphSPMiP/OQuvk1P52tWkodtJHKAIOLLeQZeLrMoYX/ErYfFNOzHVSXR g1Lw== X-Forwarded-Encrypted: i=1; AJvYcCVfBMlmo0jjwqRJnjMgICee5EztBtKmly9Ix4uSqK97Jg5+tZh7K64xow+zUsDoqdNnE5mN8HM=@lists.denx.de X-Gm-Message-State: AOJu0YyqAnswSeR7o+/84ppPwMVg/167wQbA9dizjdnyrQGbAuDeKGNB iA3QBSas8/C1O2SXIwXPNI8aD5O5S9e+GZw1UfQJo5dcCqvWoWAEzp1EfTlrVwU= X-Received: by 2002:a05:600c:510d:b0:42c:b603:422 with SMTP id 5b1f17b1804b1-4334762187emr15999835e9.8.1732094569216; Wed, 20 Nov 2024 01:22:49 -0800 (PST) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:8261:5fff:fe11:bdda]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3825490529fsm1557333f8f.4.2024.11.20.01.22.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 01:22:48 -0800 (PST) From: Neil Armstrong Date: Wed, 20 Nov 2024 10:22:43 +0100 Subject: [PATCH 2/6] ufs: core: mark unexported functions as static MIME-Version: 1.0 Message-Id: <20241120-topic-ufs-cleanup-v1-2-a5cef54b1cdc@linaro.org> References: <20241120-topic-ufs-cleanup-v1-0-a5cef54b1cdc@linaro.org> In-Reply-To: <20241120-topic-ufs-cleanup-v1-0-a5cef54b1cdc@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 X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3058; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=mmBzp805WZH+Xoa18GEw/cjU1b9Arfstj6a4kNHiBew=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBnPapkWoCxA0MMs2MsYvOSK5qfyvbxjQyua422hCQt KABKD1KJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZz2qZAAKCRB33NvayMhJ0QmvEA CKnAOGwlxnKBADKa7ng27Q8ICAPGUOTQwC0TtxV1yuHtppRj76vSGoJWAhgO5embQdRUxwgtUjub1P rSGLR6PfyVQs/zCdvANPytp/DwloHsm8gvob8vEaY29qwbRfxxvXsRRrYHnc1VeGGd/YHEEv1p/ps+ IfmiLtq8eZD10DwfHLXRNKW4S+r52qkpTbcQlaWBCDIJRuHStnsssPi3xaiWvyQQu2u9GtkP7a33Vh xDPQGR7Y10zfnxl9WKn3rLSWaRQ0Pa9gzjsIQxVS5yL+AYW42QdPAiryjhO2TUFHnvGmEXrUBn2L50 1JYxXwK62XwUHP81QXkzhhOD3AekrtwGKyveKxPOSXYS1O2OXWLURH98T6WycKPkwSLqrO1l5frnn/ LWns/wwpxi3fdf1xMbhz1JrjceGeLb7az752BczFolfuB/7+j+v+sz/LIFKcEFAbN6ZDLZ0IvbPN0I EYdUdNpHsdtxZUdoDgn1mZtAbtl9gCWL7LLQ3fJkjg0UFDsCPt9lzuezHG8gHhDo6/Rk1zMenjHN5h rO+ee/m5h3kUAYRbD7MMKHgazAfBF8dipsXqZYei6qlSneVCArG7YNpLxLGduIEQhP1uk9ChzfDEPu WxhBjpJ+AYA9PbijuxHhnoFYSEXqVXjdXPFhkguUDPlLNv9T+0NG+3benJOA== 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. Signed-off-by: Neil Armstrong --- drivers/ufs/ufs.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c index 31c2959aeb12931b2bbdf26b3c676ae1a7b0fd1a..8a6c9f1e40b058dfd29bc07d011d576cdfc504cb 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: @@ -1309,9 +1309,9 @@ 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 +1570,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 +1882,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 Wed Nov 20 09:22:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 844517 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp1606094wrx; Wed, 20 Nov 2024 01:23:17 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUbKxPchvc2UgnvljjyKcitFdnLHAGUgZtO+6gU+IrfWk3qMD70jMrVSb/M5J2tgzSGwh4aIQ==@linaro.org X-Google-Smtp-Source: AGHT+IEX7qcoPDznWpqvTDCF9iAzpHsn2/kx8Im09ujXeMTuZoccB66B6hi8b0dDynmLdzO+gaX9 X-Received: by 2002:a05:6402:5ce:b0:5cf:f470:a4a0 with SMTP id 4fb4d7f45d1cf-5cff4cfa3e0mr1145462a12.32.1732094596982; Wed, 20 Nov 2024 01:23:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732094596; cv=none; d=google.com; s=arc-20240605; b=RWVPq2glV/8B8sgd3zB0y/Oif9qV8nSnzqflkVKnEnQkYEQsn/C/UuMv1ikjE3opVI gB29OEIQwSWQb7fp2ki+bMVYI86ysUCc1eOTE+OpvVAjUx5O9fCVo3hMgKyLPDZSyoFE fhxFLg7N4uO/9xi7q7U8XkRn8qlnhVXsD+fp/bVkgP3tlr2QBmi22YuL/IICnxeuR8gh MMlK3AlFx093jZC+yWe4XscRKjCdNGFs00JCFrEd3x4rTSqajGeHwq8xSleCXxPhnq9p N+Ula8nEMYBY3jDjV+JILQdwJCFbob4X92NCW8Dcc3CZDnGXqRwLMkaIeHfeXe45bMIv UqVw== 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=4TSFFfudzoIGZXxZLAT1jPSAmj1lerFDO1XLwxSYPi8=; fh=wXb+rDjsrH4D0TAmv/+rVtrnv+DqypJXjTicKHxPqWM=; b=hCj/G4vxDXygGW97NXzSKwYVZUQ4RDujO1qQM0ArUz+D11ry4WWUxZweUgw4EsY1uA bQVTTLTG5jBuGerPqaUVKX+rBIiQqMkvFKguv29c22ve55yMtqlqxhmFWyFXyOtcdz8P EKYNgDk+FBdAb183nBclLgQ0IF7XtCxA4TZY4lDjvpVmUGPrNuOsYrCfmiT0vOlcJ2f7 qXSuMmavRGAeTznWEY4XzxpDDs8LBwPEuNwAg6CR7uSgADKE7ynsmcxjXQB7EIRKxtrw Ifek0lGjMVqaOdEN75OQgj/KX45I3FVEOHrFxIQWURb86Qrq8q/A63k30LMOSw1fL0AP m6Tg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vQjK19pk; 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-5cff456df96si808791a12.556.2024.11.20.01.23.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 01:23:16 -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=vQjK19pk; 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 5738289677; Wed, 20 Nov 2024 10:22:54 +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="vQjK19pk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B293489555; Wed, 20 Nov 2024 10:22:52 +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-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7AD178965F for ; Wed, 20 Nov 2024 10:22:50 +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-x32d.google.com with SMTP id 5b1f17b1804b1-43155abaf0bso38704065e9.0 for ; Wed, 20 Nov 2024 01:22:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732094570; x=1732699370; 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=4TSFFfudzoIGZXxZLAT1jPSAmj1lerFDO1XLwxSYPi8=; b=vQjK19pk+eKiK+xuUMTAne9w45E2WrUDD171ryzwzk95DoiOmA+SKOeDOfN6EubbKJ Cf4T4swhykkTawRBtaVIzgQSa6FIOhK+4xMaGdRo4hFcHUuvmmA0YQn7A6urs8MhIHFl e//Chf7qoHR6/cuF+LUjarmLMkuws2/V8WjBjLZf+mbwYmCeQ0H+snaVAY/q/EmgWQY/ ysJeK5k/FgOtks/jwysNZnktZCdgXns+FW2hhIKLqx4j3UITrVTpFJkLBjjF+lztKSwx isVW7+kk7KUSkG+R5kWhvIDqPlXbgqimzSo5jweVmQBb8HwHVxG8C1FrzOiaDP1tf230 qaGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732094570; x=1732699370; 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=4TSFFfudzoIGZXxZLAT1jPSAmj1lerFDO1XLwxSYPi8=; b=Zz3nvGauWZw/R6y+szV3cNDR8KBFexL1xC9fnTK/IxoLcPpLvyE0vRlFMXhNIX+RcL F5Pfw3i0edTCNhjUAfIhotmO9ToUPHeXZsBmQRgKwxoHv7xU3WB9DYAUfSHT4M0J1SAi sPbjnOItFc7x4MF1JC3Qekp2DBHHsRoNPa16PmXQCNRrKbFcfl72PhKDO1v+QVtsmzbV a+SasVWFd9cuu/8s/sTSG0yrXNIaaNcDUqRMPnXtAvE/dyJhW8ssKfg0ulcJlwZKY5GF WHHhoV5Cf6Qv/WdOdm9vBk/7Adr3ThIzvZUUxMG/q+m8+Vr7H+pJScKHA6VdEJYZAYGx L7JQ== X-Forwarded-Encrypted: i=1; AJvYcCU3i+etHX2TOHQuhygzE0qeUTZpDthI70ei6FNNAMtTSa7Sy6ecJmlMvMh6OFopbXI5OLFu/tc=@lists.denx.de X-Gm-Message-State: AOJu0Yw/azmAy2x3JFq3Lw0iX/R3s5jI9opoIQps+0Y5WGv5S18PDKDj lkxB751PLeNVdSXLVmiw1oi4IFi8ltT2awk7Gql+iJ5uHd34PVtsC5s+EQlZJXM= X-Received: by 2002:a05:600c:138e:b0:431:537d:b3b4 with SMTP id 5b1f17b1804b1-433489a0703mr16514775e9.11.1732094569984; Wed, 20 Nov 2024 01:22:49 -0800 (PST) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:8261:5fff:fe11:bdda]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3825490529fsm1557333f8f.4.2024.11.20.01.22.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 01:22:49 -0800 (PST) From: Neil Armstrong Date: Wed, 20 Nov 2024 10:22:44 +0100 Subject: [PATCH 3/6] ufs: core: cosmetic fixups MIME-Version: 1.0 Message-Id: <20241120-topic-ufs-cleanup-v1-3-a5cef54b1cdc@linaro.org> References: <20241120-topic-ufs-cleanup-v1-0-a5cef54b1cdc@linaro.org> In-Reply-To: <20241120-topic-ufs-cleanup-v1-0-a5cef54b1cdc@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 X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3749; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=WuV9P+H5zvUiUBBOnV83QEZqXIh2+aZ6ntIwSPow7JE=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBnPapld+Q9a4wR6J+QihCieC3QcMUsyFt+FCcw3Rvw J2q/Y+qJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZz2qZQAKCRB33NvayMhJ0bf4D/ kBqoVNvOPx22cd5lfIqQJd9mJppZXSTsWIIVqKPHgPQedwgHURAUZz2AuyC1IoFzYMrvIROw8SFpJ8 KxdFTisxMGCorGBbKd38Tqw7QjK3vY/IsF0wlSCTq0yQ8xE4CiDssPZGgo3mpRLV5EiHAaRkJEF3YS 7lEGas77+bhrjNwOKPOmOhXNhnTBDG9gAlJoJuJL8hKGng50NGJLJ4nIV0nz23j57DK+Ie0xNhyknW X/r2foBETv/3LQ6HMSqlK6lGXe7l2Bxq2Vtq+mC6xLQZ/wljqTa2M0SLCBM81I+IXPVfx3IaoOUFEB WN5irfPxsjr1lNiQKQJ4ko//MCPnVfhkpne83nR6KmCK7ngAQLFqApP+m+PxDINq9QN0O1DpzqywBo Wpg8B02u3tYJIbIQ87Nm7SuazgyFr6nwzL8zb+1AY01bKyhl30s24aLmDDFPoaL84/Ff0zZMa7O5qd aMHfs7NLy1rorItDvvb0gnB/wB1bNRwABvfCISJ+cq38TI9WuSyTtkqU+MZLC5ZjUTweFLuFKwld3q Mb7HxzW3wKMBvgAF+nXW09L2kIDo4rcm6JKk525f6rLxD2kTxRzMEyGcHDIMVgImbprVQzSUjHMl9I K+hZyTkzAzlHWGvxLiFUqxBSl1yqxS4A5EFSeOmu58smfxPNQvTz/cUZq+2Q== 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. 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 8a6c9f1e40b058dfd29bc07d011d576cdfc504cb..173b8d01d2a415999248468890cc9bcb66a21c24 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); @@ -1963,7 +1959,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; @@ -2002,7 +1998,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 Wed Nov 20 09:22:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 844518 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp1606149wrx; Wed, 20 Nov 2024 01:23:26 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV9gK/Kd4130ar4kVcvnGgr0iBIWYSFqah+jKXoWer+61BJ6seZFLPpEx67nI0y8I/GDMEQgA==@linaro.org X-Google-Smtp-Source: AGHT+IEGw/PVeyX+YC9xDoBgf1fay1H5/j7abDau7MQ/JYOGNjg75XZJI+AHCtcWx7UW1j6Sg9h0 X-Received: by 2002:a17:907:7f9e:b0:aa4:dbfe:a944 with SMTP id a640c23a62f3a-aa4dd50a788mr147353766b.6.1732094605778; Wed, 20 Nov 2024 01:23:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732094605; cv=none; d=google.com; s=arc-20240605; b=YLeHucC9MxI1xYozsMHqq1LX89SY6YKj9ib8iipiXyFUMDMDrfFLciwftSUNfBb8zZ B0seTB70bAiO+Q8NNfvYjwY58d8wmRePVZjVd1bzJNPXUZoyzIOodmBST4WWS3q0E4WG 01RBUNpTzK8pWsPEjoLzJ0Hu32qQNIGZxczjQlfgTYUbCt/+2O8mug2umDGXwaP1MNmT wuzxkoIMJP6Atx9U2J55sQ1mLId5z2/BSye4y5mJRZGfuOtgjHre5sadeEuhC2jPpQ0U bQ/UFZ1Zi3ga9ubrb4otbZgk39m1Wa+BU+NOwK/JFozyYfVuo1ilVtEo/rbIxrYkr64U C16w== 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=U7s68va0Bu9tGYMzRH/MkeTzC1pkF/rec6OH+95Dc6I=; fh=NT9wUXVnDNWC35zAcc82eorKcU27VSAp6yQ0eQRdcnQ=; b=VC1ChfVPwfBCuJGzCOmaYTWTcr7j+lMpEcNgeeV5GrztveWKgKtdgMEC5AhH3nqIWI KyKNMnCLvjTiJkg6tzkfcM4SBaFH+2PCZTc7WxbpJ2Enh/X6BTtsu0isL35ZO68HSDXl YfkncPr0gDigzczb2FC2tZVkyozXLrYLgWDp6ZEPfVgyNOW94jzH/5i3L67cr4SDcyCT Xrp3iaTdBHcduV0hD1UWnLDUGdUcIS53RKrw54o8TXUiM0P41kS/LteqEFrDhpNH4kg8 Akp+WnuDSKAvTGuMPaDzSf3FPjw+ALRfPbDtKVa1YdjTvcTcXkly+IZ8vuW6IXd86OIb joIw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ohJEV1kP; 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-aa20e066d7fsi841577166b.632.2024.11.20.01.23.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 01:23:25 -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=ohJEV1kP; 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 B01768965F; Wed, 20 Nov 2024 10:22:57 +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="ohJEV1kP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1ECF989685; Wed, 20 Nov 2024 10:22:54 +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-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7E5DF89672 for ; Wed, 20 Nov 2024 10:22:51 +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-x42b.google.com with SMTP id ffacd0b85a97d-3823eb7ba72so1351962f8f.0 for ; Wed, 20 Nov 2024 01:22:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732094571; x=1732699371; 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=U7s68va0Bu9tGYMzRH/MkeTzC1pkF/rec6OH+95Dc6I=; b=ohJEV1kPCyodBC0UV7DFFe93FRAcq4ahC72EvGgJXUKoYh5mSFl0TK067pMqlDbk1D XVMCKFbXvZDJ/qkRJm45Kh1/d71xkrrS7Naasj3wWJnlfdWME8+hoS05pYBB9vNCfAKN We5AkJIhroTsYhTHXxjJsJ7Qo7tkyS0Lz3xsIeP76WjmUbeP6x1UEx7YMDbW3fUGP7bA dh9RSyUv1nyrjHm2qdhi3/o8V4PEJzymra80f3bpe2/nEwoQHhFQSjmDVMYdzuwlJl8m 5qQai1cLo3S37zk1q6EsMgxAfSYo+efqIC1yUkk8jIw1KxUyYSbADogznGThCkTrhKKZ r5wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732094571; x=1732699371; 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=U7s68va0Bu9tGYMzRH/MkeTzC1pkF/rec6OH+95Dc6I=; b=r3KsoQEbxn2EXROaAco7zUNjqMh1gejTIkWHT1leOLx2ub6r52wImJ9HsXdtJK2f+H IQDlbr/bfiJhdqulpRE+fStTDqmxhYMjb2kYyeeeguARB93snIS/bpj5TLFKhFmhEYHm i0nrW48MH0wE1WXanKfs5y+bHC9rHVdxCvxW5ED+Z11VSfjlGymSp7+0QFnlGT6gXc0/ mz+2xWd982HcJG5+yZWtMf+toF3QsDL0eCxySlj3r8BkKw0oDjYxTd4nmt260DSeMqET We/k69Ps/bdctVKqU9bSFzIfyzV2CHIqSkqXi8j9r5/zxkVYigHBXGzolHmRze4QuHDy FTIQ== X-Forwarded-Encrypted: i=1; AJvYcCV1c2MsRdi5W3p1QYnKDb/dfS2y00pRjK9jI4LfdT3F7pzCzhPOiiz8zEfZfl5y8BTHiHSBVug=@lists.denx.de X-Gm-Message-State: AOJu0YwvXbmJFzzA1JGW8QfnRS8hNYNTbxOx9Zm0V1A1H9/K+N2t7Hd2 J2YMOLd7zRY6yjQsedbKB1hLtFLpdKWIHXDyK8OOthB6k8UlHbbVFyRI4GOi24I= X-Gm-Gg: ASbGncusePsI56fRBBsHBN34BcshPpx7EaMmJ+FtSDDYtwEYNvGJ+jhSoKj1fv3Qigl 3/5ucyiNlKwsZG0VvA7U2gQXbW1cmPZ31Xx1RvHIE3M/EOjwaJeolFRMt4P8LUng98i5fVZQOzK ZfzJwsABJIwnQ58nmFS/NcKCwNSzDJsNekovE/l3OIB0QnwVrkcqlbuXMiroJFJV5w7onJYovfz KqKKdeyYXMpxSesHMJ/xHsLKTsg9C7EyBCHRYHFnXPmpQoaBaHP813/3TiVOfnY4+esYlc= X-Received: by 2002:a5d:6d82:0:b0:382:4a8e:b81c with SMTP id ffacd0b85a97d-38254afac4dmr1474397f8f.33.1732094570811; Wed, 20 Nov 2024 01:22:50 -0800 (PST) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:8261:5fff:fe11:bdda]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3825490529fsm1557333f8f.4.2024.11.20.01.22.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 01:22:50 -0800 (PST) From: Neil Armstrong Date: Wed, 20 Nov 2024 10:22:45 +0100 Subject: [PATCH 4/6] ufs: core: move ufshci defines in a separate header MIME-Version: 1.0 Message-Id: <20241120-topic-ufs-cleanup-v1-4-a5cef54b1cdc@linaro.org> References: <20241120-topic-ufs-cleanup-v1-0-a5cef54b1cdc@linaro.org> In-Reply-To: <20241120-topic-ufs-cleanup-v1-0-a5cef54b1cdc@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 X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=22225; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=yEkEui0wwKCyZ6tAIVReVGvf5LAnQHUqaKNUMsS5u5k=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBnPapl9umVUX6b21F9gkVTy/frqINF2t20lLuPFALn SKWNazaJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZz2qZQAKCRB33NvayMhJ0VgCD/ 4tQlPxA8J7v6A9y9oiM0QEo9UGFzR4D72qqFcM8rP4PvoDc53WIklUOAwYrMQKZni/EjOrg4yV2hp2 HLt0JNqOwoSAIxF1c0dO5O7LCsQpY0GwcUz9AO254JZZOEa8LAVPBKtwXUaZ/rRiqrj7Hy2QwAX6xj QlyepaJzi+3Nkuwtj/WbNe9RvKmIROm3xeC5H9uQLoPZgg9lZMDMyLrx2DSApniZ+JZrBsZ/oFCy47 N92+6Fz35tU1b5FCNBClhCpWua1GkxypamUBR3DMCSb/f0nHr58fHWzWpx3o/MBPGe35m3wO4YHMee YqTaJlUKS/rq62OJjRHBCzq3IF2y3oxTH2IMpfIBKYHDZUx1QPVd5UqczaQdClfLWYB+miQoGSAH51 g50dfk5gCMVX+4MyQyaJTiRfv/NnQPIgfWTQuFvhuhEYPqpXWDqpxUDv7ZEO2llCNbu0/Qcl7wTQyR J/0vr3bSfW+cMqrBQD5/aEUnQojlOZ63V4gUYtOxS/tdBCqzIvoD0RdkUWVUSDuD+aJi2Uet1ZJ0iY qYOrMPs3D/lkmwlOS6HsATO3kEWIlD2jZyTl3fqgrpChG+xxxlYOXlvnrB5I/t7mBpuUnxQL/TEDg1 e9GQn38pXuTjQFw/PvT4b5lIs8gQEJpdvkmv9HBJ5XmtGhpMg2tf9Dtmq2Jg== 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. 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 Wed Nov 20 09:22:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 844519 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp1606202wrx; Wed, 20 Nov 2024 01:23:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUV9AF+Heen3K85OIyoELcVd2H2nak341a9Klu4fdDIt1XhgMJpXwIh5SPwIxSaj808okh7Mw==@linaro.org X-Google-Smtp-Source: AGHT+IE2jyC9dGNxWa6bqfprnb3UqAqr4+RfUBqQm8sb4yKx9Sq8yMcnDiXYwyVgExu5TKD/ngwL X-Received: by 2002:a05:6402:1ed4:b0:5cf:dcd4:1277 with SMTP id 4fb4d7f45d1cf-5cff4af8578mr1636084a12.7.1732094615257; Wed, 20 Nov 2024 01:23:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732094615; cv=none; d=google.com; s=arc-20240605; b=OYd/kUSAgRRuHIiXho7NIzsXkW2wUlKpC4KMHR6eaaF3d6CvZ2uU52cK59+4gxn3/O eZMzUxbZHhPHFR2MMoSSqzaONOV1R1Z/lrFeGINuIDMCb4b3PaAs2LdD6+gW1F3z5h5T MXSiKroQMHx/LS0vEJDdTAES6H3913erxSqtQajeAFASH0sOevGjvfFiZ7Qg0G9gVUzg ielJ13VJZJuvkFcosc+zq+4ukrXnjXCCgVAtb+M5/Omq6sa8rCWSz8ZlXj33/a2ii90Z LQltqzCLmLSLfJi5CjYLpeWKOe2lMHdA77D+pFPIFhTudYqrd5kl1YOgRAV1xZG0nax5 yRpA== 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=en7bD2OZRmqCgW5+9CmDQZgDCs/w+MFcT5aUqdMc4C8=; fh=JKfqR7PxirgdHdX0gF71rIBnSHaYV547GoxcniOT0eA=; b=fgj2CYBDutSIjSWbzmC3HeBTeuGHylfHH3MTUjxG7PCZZ6aj4bfyM1XZo3yJv6ywf5 n99JEijN8+UL678dsMeNLWUwTsH7wEMR/2mqwLdYYe2ql4JskbXoTOSfw+foCoxOGwDN rrjamA3QtBH7ig/GIHfTxBe2Io5JcgC1tzCAeIGkRhlbhuDvw38ArJb7t6Pww2P+xrW1 t65y+BAIVPj1JakNyc7qdg6isCbHM99mVFQOC5JjgKhpaCq1AcaVf3dGgy6K6Kc+zgaw cNe/Fl6EVy2fpgNQq2jysgwoa6WWwiufH7whoA3UbTBj14C192lZt7kqhGJUEkucVf/a gAHQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pS2Pufte; 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-5cff45834d9si790826a12.605.2024.11.20.01.23.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 01:23:35 -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=pS2Pufte; 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 67C348967B; Wed, 20 Nov 2024 10:22:58 +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="pS2Pufte"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D41DB89691; Wed, 20 Nov 2024 10:22:54 +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-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) (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 153AD89678 for ; Wed, 20 Nov 2024 10:22:52 +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-x331.google.com with SMTP id 5b1f17b1804b1-431688d5127so16038725e9.0 for ; Wed, 20 Nov 2024 01:22:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732094571; x=1732699371; 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=en7bD2OZRmqCgW5+9CmDQZgDCs/w+MFcT5aUqdMc4C8=; b=pS2PufteQ26vKcS02eEvyiDvBvA5kHz7bO46ull+Lgbm6S3MRTTKUmDaZ3Ai16fELc OtB3Vfq2PEXbKBdQXDnwOFK8PTafAI1MYa4pD87L+zh1qXPosqmyBGHvOs+ewL0qwgJE 7nyi0SKO4KpIA9M2ypmfVL9CokshHFYGyUqgTDfyUp1zVsxhEcIeGSNzFvz03F1xNfFD RpYnkFtGWcxAa0c0ImXUn+f6J422s5Wry+/7OQYtCB6dvZUGza8nfOLB4Nt9Mj3UlZzf 8rJlTJ8kluQUq2LF91WbrQHob9PB804kvq0eoaJqLerE8Gv1wIuhOlnabUu2QvZDJXUD kyLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732094571; x=1732699371; 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=en7bD2OZRmqCgW5+9CmDQZgDCs/w+MFcT5aUqdMc4C8=; b=eO2cqyHyroJ1OhzYpku4YMesdc0r8FOuKUx/YPbBZWl/KDEC7+13DhXl5cR6+6pRKL H6w66HhDgCggd5iRyMBdH4KU+/a+2YPds/VKlVLqi6ClKNMxiJ82xhUD21q58jqx9S56 hroiOYpDT+/Ax3gFVCBuPja0TlYZVfB6sOr7xQ/L1NWJNXQZufROZhBpn1EZ+BE8Ourq Stze63KUyreTYbSOr5RI3cYC1h/JPiqvJSywAhno4V7j3Vdp7/+GnUqszR28TOuNoWfx Iuq3/MrTudai4msde9bOoXJ8Z9NANZqfCyaYNyDXWtb/WxLoso3oAWnrOxsRsJeCMtVE B6OQ== X-Forwarded-Encrypted: i=1; AJvYcCU5nwIXcgBU3R4hD9k+hDKtFyQtHr+8Y9Jc1BrJIX2gL25301FP813l1YqJBqykRm9201UN7UU=@lists.denx.de X-Gm-Message-State: AOJu0YwH1FWjzzZLvDS8AYxuy41t82eOl7eRGTw+CLusO+fs1zcH2wPD HwDYuONuLfZWsCgSAQ7ZX0C7zdJ+ZQbCTeaB75mubs0Sm6C17sF7pj4KbUhMl5I= X-Received: by 2002:a05:600c:1ca2:b0:426:5e91:3920 with SMTP id 5b1f17b1804b1-4334f026f5cmr15866885e9.29.1732094571589; Wed, 20 Nov 2024 01:22:51 -0800 (PST) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:8261:5fff:fe11:bdda]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3825490529fsm1557333f8f.4.2024.11.20.01.22.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 01:22:51 -0800 (PST) From: Neil Armstrong Date: Wed, 20 Nov 2024 10:22:46 +0100 Subject: [PATCH 5/6] ufs: core: sync unipro.h with Linux v6.12 MIME-Version: 1.0 Message-Id: <20241120-topic-ufs-cleanup-v1-5-a5cef54b1cdc@linaro.org> References: <20241120-topic-ufs-cleanup-v1-0-a5cef54b1cdc@linaro.org> In-Reply-To: <20241120-topic-ufs-cleanup-v1-0-a5cef54b1cdc@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 X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=8468; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=bAneN+BP3xzaji1nU2yAgXLWxsUXsur8/mpUZTy/gNY=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBnPapm4iy9N8hCaRlCdIk60jZdrSwZHrYmUByRGLi5 uGfJZ2qJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZz2qZgAKCRB33NvayMhJ0aT+D/ 9FtzpC/LEKftsjt20Wc5Zx+dMs66tcDDqPSAPWcEqM4w+V+ZKIEI9d/4ydhcvHgEUtdkktD5BbW/8g oehfo128z4wsTTgikgeuhMjI4fz4aVZsrhPdQmuVrgX0V/Z/RTpA+HeeDLseRfJLT+yl20y6T7dYa+ XxQRx8ZGsGqLhZlSgtT74oekkiQxLbDmvGJ3boqffiXgEGcMW44CiDitB6byvCbuuQU8G73EC07YHS XgF+1bSS8Wc/a3oKT8QclHewDSLOijBXPTUoLYcQs4oVYwMMQ5Yhxeob4f3PVShwgXKts5lNN9roIZ s6Hov3IxKGGyrXGLRFlvLYx15hT+Xq3RHmplCbVv7ca9Yeax3EmvXY7p/8xXI/eyjNiLB2XT8n2YMX FUfsuPaHa5ym4iG0y7Ru68qwHtZ+6jB2btWfU7kx4x5Tg0ZK6S36hi5KDRKXkPKOvV2SjT4LqfiwbA oAfHEhFxQRZhFHvtKMSbFUyCigA/fbA8ti6rgOzgei9a7cR9wQsMUCJD8+8yhgTqEtPj4LMeEkjeB3 Da1CekURaUVLVbWlLQjm3f034Dl0xqBNBhOR2HRUnU8QDWjMg/Pyrimz5T1VV2LXIN4UU2L4vqAJ2f /cfYpBJnPfx2Xpcd9q8plnf/k1linaOcg7X2iq1kwae0xG1RpmKQNoZ8Zmig== 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. 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 Wed Nov 20 09:22:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 844520 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp1606226wrx; Wed, 20 Nov 2024 01:23:43 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVz07y6qxzdUqZHgEAZaEWExBpXAQ1JNdNWoJNq1N9dYyd16nUlWeG+k8IBBD/maa9JzU2zNw==@linaro.org X-Google-Smtp-Source: AGHT+IG7+urOKt5FMKVBrEHmOHlqXz/+5jWEuw6O1i79Qb5dDA9LoT0U+s5sda4900ckWzliE2/N X-Received: by 2002:a05:6402:3511:b0:5cf:e218:9c5a with SMTP id 4fb4d7f45d1cf-5cff4c4504emr1295262a12.20.1732094623445; Wed, 20 Nov 2024 01:23:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732094623; cv=none; d=google.com; s=arc-20240605; b=QN8ZF6cylFmPG+LF4+satzTtTVw5kI2TVOZZwBiqScrUM0T/uZHOaGBclXEaZ0Yiwq CgWYuz1S7r2w18Nx0qFj7kK8xBnBMrJwAS1CdpeWUzE5VdcGcEe7z/LdNs0imUGGsibn dEGzFxP+V4G854BEWR7q0Y22q13zBy5W/IamBRwAqfCFlulFqMztVZE8Ghh5JymTWmHc +XXqHUShXuctceFVAH8t8zocgSN004gioPGd64eSQXGqwrzrfOAFKeZC24qpER805gFA oL4v98qlpytFtK0h5/0a8usxX+fmZoXW6VIbBBZWm7P7CK5fSzZ7u0KHJ8r5dMex2eol CEbQ== 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=d58mVy2Lu59odAq8AOPRX9+9zrlFd+bWsCiQz/tyzZQ=; fh=Gu8XPt/tes8XodmF3sKYk2V0+qvsnXR8xpmhy5QJkF4=; b=TW0KkIBkL8CRJpBDljPjtlfN3VNS87hthVK/SLTzD1+QW8V4ZfpjaJSLV2/qMLn3/0 YW1E6TGDgjCTC0SGIAFLnVswTMUOuhT9xl31sv+MSo1QDup+9uFMG6NMQfHTte6a1G9/ Pw9IyO6MpQCyvWqAo7LPtASFqWAKX/lgHkBLjpAk+86hTv+J6i3K9soLnhhDyBlctoJR m2DDpDdItlLCgmTOHhSe9FPPDvkEABibZHEYhyz7iC+eh6ejFv6G/Tp5ieGCoPrYUHYx s4wR7O+2BIBJNewuyOW5VJPnMgIhNJL66ejQ+fr281KKYxlCpC5MwBOrs+fk4l8Q/uWN Oy6w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MMh8z0tL; 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-5cff453c2b5si805323a12.242.2024.11.20.01.23.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 01:23:43 -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=MMh8z0tL; 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 C7BB989686; Wed, 20 Nov 2024 10:22:58 +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="MMh8z0tL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2862889694; Wed, 20 Nov 2024 10:22:55 +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-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) (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 EAA1F89555 for ; Wed, 20 Nov 2024 10:22:52 +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-x436.google.com with SMTP id ffacd0b85a97d-382442b7d9aso1687331f8f.1 for ; Wed, 20 Nov 2024 01:22:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732094572; x=1732699372; 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=d58mVy2Lu59odAq8AOPRX9+9zrlFd+bWsCiQz/tyzZQ=; b=MMh8z0tLz8WonCOjCyu/0cZb+s7KuNPe0Lfe+ecY2EP6fvxViFavFIDwsSCr0+/02L R5N9+UOJtQkcar2ClWBo7uftoDOABtSHbDoT4L930GQSiFCEaVre2ex1xem81fv2ebEc ES2XneK37t1gEdmTn+KuYdTZ26gawnMGOxcdcr34pdZpSINc/jISGmCIfiwE6oBbq4MB OedZDuF0KhFHswmWQVkOURJMW+HwnpTBUFGlgi2EqFUTWTSqogccZGT/4XyDYVqmpA3H eMNs0v+XPFH8/CnJbMQaOO2xRuVQpPPE9V/8KQI/pHcLOyuh/VF/jMsUuz5k+o7hikBL Gd7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732094572; x=1732699372; 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=d58mVy2Lu59odAq8AOPRX9+9zrlFd+bWsCiQz/tyzZQ=; b=cb/iWvYuzJv4dXkA8XOVc6WPYEgKpwBJTJhHgu/ZBMNhvjC4g920fdTbZNEb0YasGe emrG8ILVg6L7MHSwZq/T6GDtRr1j9M62UyEdft5EIQN/zQ+oOSbTqthGxjERiMvVLdJW YDHaOjxbqa+FO3KIAh8PE1rlTHL52NG+LhxXc7SoqIGEntHxBtC287KXovv7LFL9VZyU TZHfyP3lyA9QgP2YiakZmi69uMzI6ti00B3W5BGkIfV6aZ9yvhD1FGX+V5qaKWy98zpz tALXpUWvaCPDs+fcx5peToILl6cZ2haBQQYSseK1j8e/DzARojV7MgnCoFbeXYLMZyxq 6Lzw== X-Forwarded-Encrypted: i=1; AJvYcCX0KppoUUkdP2AV/8hYJ7hfGIseTwNp16DRovE6kNTWcAi+M6IqZkFvVrhqaqqq/jfqT8LFyvc=@lists.denx.de X-Gm-Message-State: AOJu0YxCwo9NfAio9UHpFC9jO6y2JSnvOVwTuE/nbR7uAFS/UKcqqLUg jj3LYIf36hQSxFQhTt5VoG6Xgp7XU0/9IZf3jgCa2X9JmWcezGSoSKD9YCwcYAY= X-Received: by 2002:a05:6000:2b0e:b0:382:4b6f:24ea with SMTP id ffacd0b85a97d-38254ade0a9mr1155106f8f.11.1732094572354; Wed, 20 Nov 2024 01:22:52 -0800 (PST) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:8261:5fff:fe11:bdda]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3825490529fsm1557333f8f.4.2024.11.20.01.22.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 01:22:52 -0800 (PST) From: Neil Armstrong Date: Wed, 20 Nov 2024 10:22:47 +0100 Subject: [PATCH 6/6] ufs: core: sync ufshci.h with Linux v6.12 MIME-Version: 1.0 Message-Id: <20241120-topic-ufs-cleanup-v1-6-a5cef54b1cdc@linaro.org> References: <20241120-topic-ufs-cleanup-v1-0-a5cef54b1cdc@linaro.org> In-Reply-To: <20241120-topic-ufs-cleanup-v1-0-a5cef54b1cdc@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 X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=11426; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=zFn6k6/WI4KU8Yu77BTn4eHMlAiEMz3F8WxSSUI4Mso=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBnPapmVZ98dcHeaz0AwLtmkvd8E9xralWB5WML7jQY rzO3gUyJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZz2qZgAKCRB33NvayMhJ0VXOEA Cup6cpa1UDTUONyYglpJj9Ulb+MbMKn1UsGS64HoSnUHjbai0SHgZeJQqOXgqfKhZ1SErJcJ+Cz4mh 9SI8lbMCoc3dJtb3n2T1un9hQJGR2LHdah3hKhySF7Ii/ogqgGFpu5cRI8MHrzbZHovwZIfwyX0oZI rn1hatlZc5d7zi15VxVEyNEIlGllzakwDqmzPh8RF5fAEX0Mnl1jopUTlb8k/xAECd6pAfPUBBVd6q gkf6+Dtpuhq5bdOj6uszTAVhjtY5XXMg8W8qHGzG3elfMXWi2haJk9z9ef0yoDZxexGvM9VhyxIpap cPYKTXwRM8f4jDlBIfHyCD4Mzjplwu4pQXdjfC7cR9fGTG8UtdK+jazWW/Mab8eawEnjbB34miXJBW TdlC4EKrm/eCijpzA7zJFpEjpf3lanBmXefZshVFszue74HKIOfjItaHMdlN8o8ljC3QC2qAnhy2Gf 4gVl5cdpi2zzunWqZRxWlneBRBgntXpqCSlc/0Lj4LeGFI/I9Nm6HVEmS9ooZBujzpBWeOqjNdhbzM IJ1lTrpYaYuUcgZHjXiycQSAHOYX1COBBCFC3285w5ooDT+nq1sQz/ee3euERWHjU5RhsUxn0so46V kIUm2w+49btgLRJYoq5is/A+mULd+w+2CkVWePHHJnGi1ykTiB4TFOFleFZA== 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. 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;