From patchwork Thu Aug 8 03:14:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817665 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp674558wrt; Wed, 7 Aug 2024 20:15:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXbC4CN54BK8lMJqXKvPtl3JFDKIcbefTeNFqf0IG9KEfBC71iRJH5E7/vY0WBY+kzd36sv+3t7FHVx8HaPICnr X-Google-Smtp-Source: AGHT+IH0D1An6Ej1OxgVzH0RekAURXcXjRfBd+c8rcDD5oD2yHIyy7Ir9+eSdfL8fJQojBfIwLca X-Received: by 2002:a2e:960b:0:b0:2ef:2555:e52d with SMTP id 38308e7fff4ca-2f19de8bd81mr3152991fa.45.1723086904784; Wed, 07 Aug 2024 20:15:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723086904; cv=none; d=google.com; s=arc-20160816; b=rkd9jcs3SJhAczu5NfQkVMq5uHcmYZ0kUPCR3a7/9gviIjY/CDlb3EWv2FWip/C4w4 /HtMbCdq+qpoHtz1VKC7VivLLD9nlwHzuutqOEYZYqColPrjl9IPnB1sGMfWbmiYDMYu ekPHC5ItjrBInq1iY0ts5TNmJgyKxJGpHPClgKlzTuBLAs0bR1AbJk4qxOAPkW83Hh8R z0ABW/b6PngMa6cQfBH7UAI0msWh3iopo09UQy/MZd5e3H/weLOrFXoKtXPS4oWR13Ur Pp6O5fCStdaOGV6jcBm1FnezdItsyxrVERwLBeMHpg8jsKXiJjvXdlI8T14IoWtGGCQ2 KBmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hrwQjBQeS/IHACiLnA4C0sWPJ+Ss5JUUFTvp1h8efso=; fh=tcmwRXe4XND4h4z90cRWkWw9dDhBdjrxUVMukfvAi+c=; b=e17hDnA4ovj6v2GxpyP5x2JPuBqJzuqR8euiuZcBnEaxKfp2lnxboIQQ3fCFlAWGSX NWqmCePZ8hFoe11MUxttuo9tBAgnOA1RR/1Gl9f7//pRdkiF7ffK9mkAB+i7tfl+C645 nblu4RLcZD4DFYA4gVqE3MEcg+AduLXF0D+dCFRMYzrIcSsHTCE5x0TiIyI20mYJfGCi ozzBnyeqIje+U57llzjAMRBI2JXdQL7zJJ/23pCPT4+RSZdQ0X3SAMkty0l7y/SQ7Fq6 OsoMEnwgyjw2bxVYwcf305PMaWD+zJZs1R2EUJU9N3dKnvhKHU6EUfLvKthPykHV9k+F x5cw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FItZnmWa; 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-a7dc9bd3be1si781413066b.55.2024.08.07.20.15.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:04 -0700 (PDT) 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=FItZnmWa; 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 30E6088A6B; Thu, 8 Aug 2024 05:14:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="FItZnmWa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5890088A3D; Thu, 8 Aug 2024 05:14:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc36.google.com (mail-oo1-xc36.google.com [IPv6:2607:f8b0:4864:20::c36]) (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 3925E8873C for ; Thu, 8 Aug 2024 05:14:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oo1-xc36.google.com with SMTP id 006d021491bc7-5d5bb2ac2ddso278220eaf.0 for ; Wed, 07 Aug 2024 20:14:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086886; x=1723691686; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hrwQjBQeS/IHACiLnA4C0sWPJ+Ss5JUUFTvp1h8efso=; b=FItZnmWacdDeivG/PIE9qJTDbJ0Lk/8yOZ0NwYvJ4ToN6kABIEsDAEwt7cgywDubXq 1XFwQVWtcYb2Ba3FAdEu2CZ3uTyb7k13tFEiLpfij4DBtdQTxTr8+HOy0fHAOpHX58T1 k46/+TeartoIp74/adJBjPSXoX3d8Z/7NiTTPUWGpQ3tSrrP320tlpuMIYNNQjUd0FZH hQeAqYVO1YkMdSlzSWoeZ3MJ9693RKGqnoDtQLPvA7dEnEyi1RyRCjknal/8iEswvZzX jQQIN5LwBfaXh2pZC479WFnoBIZot9tKmsY2fkTRYPF2rT5vwrl5+EdaNkhiZr5zCdNd SW6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086886; x=1723691686; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hrwQjBQeS/IHACiLnA4C0sWPJ+Ss5JUUFTvp1h8efso=; b=EKjNcJYzLxAGOclT4XnLLUq1EaAehnzwbezKyE6pa301sSQwyuTwHDS/kTroefTskz uo+xMg5Rv5vG1Tz+Fytpoufh4aTzlwHfp/xo8UIGkk9bvOQkPauMCW4AKfLR3jDQEmTn IcJ6U+CuAG1wE4S5tXPfm8AeKBhlfZssVN19VhDJaLnoojqgMmVjPOpwhDWCE8tycmqC OreLYX4gMoGLdAtTmlmlLdJCV0InIvhDlRF+b11xpazbHNqpoqKcX/mVeHjKbPMX/kcS wPZdsi3QQBjCltZFbAWKwFrcE2d4jzES2i6J3kEI9EQFOSupg1ewc6zEzmNhDDfppwrw C7mw== X-Forwarded-Encrypted: i=1; AJvYcCUBx66/nMkeSQnKunI+iUXe5MAP88cBPOxj+bzrNdiLgKZwLCJ7FSYbuXX+VXfrV5cNoF7N4WEvRvpvJF9Rp1Sut60MFQ== X-Gm-Message-State: AOJu0YwLVPdBGS5KoAGDaAxmN1S/SNfsUaBOtkPQWpEeId1RJpfSf9JQ tOmw+wsIMeBdtMMLumxTcQrSBF6kSE1LSq8dproagjFnfglU1H2MH/G/R2X5Zjc= X-Received: by 2002:a4a:b3ca:0:b0:5d5:d5e9:4e38 with SMTP id 006d021491bc7-5d85737a6b9mr150750eaf.2.1723086885968; Wed, 07 Aug 2024 20:14:45 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5d76205268csm3485055eaf.24.2024.08.07.20.14.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:45 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 01/38] mmc: dw_mmc: Remove unused version field from struct dwmci_host Date: Wed, 7 Aug 2024 22:14:07 -0500 Message-Id: <20240808031444.9619-2-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Nobody seems to use it, so just remove it. No functional change. Signed-off-by: Sam Protsenko Reviewed-by: Quentin Schulz --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - Added R-b tag from Quentin include/dwmmc.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/dwmmc.h b/include/dwmmc.h index 136a95b8cdb6..39024fb38aaa 100644 --- a/include/dwmmc.h +++ b/include/dwmmc.h @@ -163,7 +163,6 @@ struct dwmci_host { void *ioaddr; unsigned int quirks; unsigned int caps; - unsigned int version; unsigned int clock; unsigned int bus_hz; unsigned int div; From patchwork Thu Aug 8 03:14:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817666 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp674609wrt; Wed, 7 Aug 2024 20:15:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU0ftMg2aHfHvcd5XkBmH5d+vX4Q8/YkMm8tbLcGIAx29ZSnJVN7di6omyurQ40UnjGCcraDcEyTIOUMj9G34/r X-Google-Smtp-Source: AGHT+IFedlrotfA/3OrnOL894XsVk61SYyhIaNwhOWD7/ZRc5cJ7XDizPCcogM4Qic3xN+EaN1t6 X-Received: by 2002:a17:906:6a04:b0:a6f:1036:98cf with SMTP id a640c23a62f3a-a8090e8a3fcmr29900666b.54.1723086917445; Wed, 07 Aug 2024 20:15:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723086917; cv=none; d=google.com; s=arc-20160816; b=OvPMQ+lbxakeH/miHZyQOFLn7pk9VKmdVpMToNinuMII3tBD4E7781lo4TTvBkJZp+ dw+R4KCgsK8g5YPRSwoked0DcwXpAzG4+jWT5i/48OgRQ6Rr1fYz2U+xjRvBZJW4y1Zx sT8MlYDbAWxOtiZY5XIQt1h391w5P3vuQpreAAtkPgPx7IGeiVjla5LZL9aqWnwXF9/z lUxLWmUBI1hQDxQH98ZbO0qlq3vNM1Na6XskaMmbvAofCjQUNo2U+N/iW4iMLaoKem8r fj9gfIU1EtUGdC4KLJYIlo/gOrC96RRtj3u0yM7FAobScV7GDkKZLKocreeqdBerlYqd 2C9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eVLQcVSfl3rm2iwTcFthBnCn85I461ALqaeyLfaSK2k=; fh=LOjEXRfCDWFXhpZu3ruAxD5Hzwz3in0yII+5vdpBDHE=; b=o5mre2QC30M2mWJu/8BN+M7GEO8DDjQPJBXcHDiYunI3kRRmFy/AHsC8cpdnHdRHzL 7Iol8JsND6e+aThgkMyIkmtzDs9H3VNDETpAFqFIEquBzEJ3HMzIuxVd4acYY0oWSF6X EQHC1hW6xS3XiB7ZG3NffDpM6oqrMZrbA9qptizwlprcwRk1PBAyjepRTpjZid/28x+K JGHe0K6utDhOUInQ1tS7WXdHciZoHIT5xhiEOcNcyawQOxFDp1N1cp+ibkCbgxRc/VcY pSqNar7eqLzE2NB/hRQx3Fbmt6xxfF3QzyQFHE37GweXTEf6IfDaN6uOFFPjq2grFfPy NibQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R1RK8ZW0; 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-a7dc9c169a4si753023066b.236.2024.08.07.20.15.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:17 -0700 (PDT) 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=R1RK8ZW0; 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 A302288A3D; Thu, 8 Aug 2024 05:14:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="R1RK8ZW0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 38D4C88A6D; Thu, 8 Aug 2024 05:14:53 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0: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 3EF698874E for ; Thu, 8 Aug 2024 05:14:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-7091558067eso254255a34.3 for ; Wed, 07 Aug 2024 20:14:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086887; x=1723691687; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eVLQcVSfl3rm2iwTcFthBnCn85I461ALqaeyLfaSK2k=; b=R1RK8ZW06TBpEO+blvsjhJjAGbdieACxhsaxQYy3opjLbSv6gUS2X/3E/1IFwgBjR8 Tk4lz09tvG6w2P7asx8CCYw2VLeLppoE9YZ+cNi6BCwZx8QVdzLCu1oLhSTiRfXH/e2N UHUE3qEe19Asg7QqTdlRmQrxUwfq7un4xsCzZXOBuXsHSGw4Q3G+nl3QUQMtvKCS1D20 k0U+ZrN8p5rt2THARfUMgUOYHKQOTalcw05YaOVLYH05tfTbFfP+2f3nPRPTdzocVZdO KO7ao2cp21Kqvl4c29bmggjTyHKiJ7wSFSix4peii4Q7tZsEtg2TNxLH9gLGCni4Hm/F UeJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086887; x=1723691687; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eVLQcVSfl3rm2iwTcFthBnCn85I461ALqaeyLfaSK2k=; b=kJ02aR45oSEmsfCiOhhEUYvjGhi+SbkRCYZGNLDL/xwNQqU0FjvkhrUvcMZ5p1JQPU vKXM+h7ndUGVp39NKnxTeOg3DATJYiZ4gIPlwADxdTSNQVpaALVG8wMP86wh06Wso+Wn K6y5MSfaQnSB/nsoiRwPucmWrkZNrWXprKghJJbifFbWx53fh9Qkw0J9AJfDdCO4kFy7 KH1H5l95zgSoC8b7jHa265hHiPr3U30erPg1kkgrgHKuskWL2qP6rDCkpbrc9owrqgV8 8UWca/eJcLRkhkeDJmTwdQt/it1iuc4WcqskelO7a4stFQb1JjB9X+LkuqFybxckhFB9 4FkA== X-Forwarded-Encrypted: i=1; AJvYcCU0L/AysKUn18q4wzzPTuJQ+Jnlfux/IXv7l7ldExIxbrD69iXfo+OhEmdYE3M87dggetYY29lGHvRAibss1YFQqjn+0g== X-Gm-Message-State: AOJu0YxlME8XzZmfxEYWY5bZ/xilsEwOVaL3Yq5Jxfi2gFlt7baXFE3E rhxC58sjXRaXVoonxB8ujYEB98o9QTjlfkEEit4yQmrJwFdIgzLndUCqoYVAaYk= X-Received: by 2002:a05:6830:6989:b0:709:4507:6b37 with SMTP id 46e09a7af769-70b4fcb15a6mr713707a34.31.1723086886782; Wed, 07 Aug 2024 20:14:46 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-70a31d9e011sm5154015a34.1.2024.08.07.20.14.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:46 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 02/38] mmc: dw_mmc: Move struct idmac to dw_mmc.c Date: Wed, 7 Aug 2024 22:14:08 -0500 Message-Id: <20240808031444.9619-3-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 struct idmac is only used in dw_mmc.c, so move it there from dwmmc.h to avoid cluttering the interface in the header. No functional change. Signed-off-by: Sam Protsenko Reviewed-by: Quentin Schulz --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - Added R-b tag from Quentin drivers/mmc/dw_mmc.c | 7 +++++++ include/dwmmc.h | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index f4ecd7422cef..45665e517068 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -20,6 +20,13 @@ #define PAGE_SIZE 4096 +struct dwmci_idmac { + u32 flags; + u32 cnt; + u32 addr; + u32 next_addr; +} __aligned(ARCH_DMA_MINALIGN); + static int dwmci_wait_reset(struct dwmci_host *host, u32 value) { unsigned long timeout = 1000; diff --git a/include/dwmmc.h b/include/dwmmc.h index 39024fb38aaa..7e4acf096dce 100644 --- a/include/dwmmc.h +++ b/include/dwmmc.h @@ -198,13 +198,6 @@ struct dwmci_host { bool fifo_mode; }; -struct dwmci_idmac { - u32 flags; - u32 cnt; - u32 addr; - u32 next_addr; -} __aligned(ARCH_DMA_MINALIGN); - static inline void dwmci_writel(struct dwmci_host *host, int reg, u32 val) { writel(val, host->ioaddr + reg); From patchwork Thu Aug 8 03:14:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817667 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp674653wrt; Wed, 7 Aug 2024 20:15:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWRTfc0jOv5fhtD3tA9t4kJ3WW7nDd5xKVF0ijOiwMCcgynig6Qc5f+DuKuchHzjfJJLraRe4KtdALyt83Ab2yZ X-Google-Smtp-Source: AGHT+IG9szO+LOMsKvWK2sTnDFtKAkoxB71i11gjpogMtY1niyquxpJg3HwRFnanDmeQiw3u9yoj X-Received: by 2002:a05:6402:35d5:b0:5a3:d140:1a57 with SMTP id 4fb4d7f45d1cf-5bbb2238e96mr442983a12.1.1723086929876; Wed, 07 Aug 2024 20:15:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723086929; cv=none; d=google.com; s=arc-20160816; b=1JgnPYp7/hpjuTiGnae3RbB9C9Qv5Ax5dgwRwzosLfbQ1Gb/QaA7cyTyGGEDiE73B4 fh/wxGJpu31ew1Qfg4StWyLTPvl5mBuAO1U8APXexmZKSdKFccUPevIT83v8SCmmhYTW sg4J20fvoNG7CHGLBMaMq7PTyFJW8q1PIJf6IVVoqdsQW2w6LR7gi8trDL4Pq/A6Crsd MYruQrCGkbgczedYjG9Me4Fa+wXes2Kvyti+3y5pagKxaIFGZm6Tb9ZPW3z1d2EgpQcL Q9IxNVt4XTkdb+5A/3dntGku9Xjl13wWZSGcN1409Sk4RQkmBcwnQLObE1KJSwB/Um3i 3Gcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=82+AAIfpblJ/FxfNzNEtfvvh8sailDSat4YEVZKvy/M=; fh=yakYdCC/pfcN34D/CyuTarEMWgp2fUaiiQTTc4OKO1w=; b=i0i5FEh30p1uGh/1BaMuaLeFeZpdxUR4XjStPXa4aHbg4NadXwGz/KGTbC6xDpXQeO jsEnTSmO6UeosW4lEaqu7hN8KlWT1RSEnwlmX3qvFclwmCP6x+kWoSJDS1XAcd+u9i/d X/cszhyab251No0Ih3TAcAWSm2HS8W/auz6dCX2LCzA/qC5+pT6miBmo20/25gKkMl/D U2mBPoORR9rVlq1G3Mjd530z7pdQmPx4myLOsH1/XmC4eM29x8ntATXrG2EBkc9iuSXn EN2PrFZpdJ6XTSUv9pQWagBVzvb9fxGbtlhhzHAHI/jvhbeknZM7shDIgFEyEQwZ0r3b nfLA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QGLDI+6n; 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-5bbb2e34be8si247491a12.534.2024.08.07.20.15.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:29 -0700 (PDT) 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=QGLDI+6n; 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 167DC88A6D; Thu, 8 Aug 2024 05:14:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="QGLDI+6n"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3E00088786; Thu, 8 Aug 2024 05:14:53 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oa1-x2d.google.com (mail-oa1-x2d.google.com [IPv6:2001:4860:4864:20::2d]) (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 B1669888CF for ; Thu, 8 Aug 2024 05:14:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-260e1b5576aso381785fac.1 for ; Wed, 07 Aug 2024 20:14:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086887; x=1723691687; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=82+AAIfpblJ/FxfNzNEtfvvh8sailDSat4YEVZKvy/M=; b=QGLDI+6n6cncDjq9tlQCVBi2eFbekSyXNoVlSoiGy6aF1M4N+W6dP+/L7y4nAsiktP Jj94xCGkXjX7kVmi/xebwpMqs9bUdHtTXdo07oqJypDVOme7NthiQo5iPyJfi3FBgQti 2OT3nhM1UEbiRl5TmeVFWbSZQn8qtPfryN7BVu4N3BWoFvWvDS+ac7TZ+sOB0M/djwzG a1QJr9la7nJd/p7np4QyvycKiMSUOJsNfkdcbtr7P4T0hhwxuoyY2lsOSqXyno5JXwty xgfvNRIEAuury0K9Nlqe6a/u8mNfsWiymTJ8mEAQA9Kj6Rak9atiCx6oNWx6aZ4BkSth Mhfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086887; x=1723691687; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=82+AAIfpblJ/FxfNzNEtfvvh8sailDSat4YEVZKvy/M=; b=Oo57Kx2r2PzjqzegnvdAMCC74TdtpOoyD5xyxQRgQjACfrA4t5Mibo4MDrSpM23T/Q j2Sc6/PDxUCfzF/lo0SNfrhIEhy+y0C6AaI7aeuNF+nRzQ/lyKFAXGhSszarylZKZMVi 7YuztGuzVDTXdbu7YyR99UA7gTI5Rnlsydq0UYCEg1NO4HpR0caVXkrfcmKPm4pL8Ygg 8J2ifnrAXgk57EWjh8uDrEUYrGOySpGtTBWWv3GdAuDP3oBaUdnPUhcJanT6mlpyUELn DUcHCc6IE0OoPyKhLGilVPkMMoSxsG4Nw8OmFZMLl+ktD33717W1NfoZQm/ktQwsBj7m iRzw== X-Forwarded-Encrypted: i=1; AJvYcCVgtY9ZvT1LDLBNy3F8FYjDKvH6dp7NrYiJOiZVgzDlj3F6XA0N6beuF3yINM5NXIqi7Lv5avQjh4zqbcTBbfJaS5ccCA== X-Gm-Message-State: AOJu0YywHoYn1Fi6Fv0DMt1Va+xFuMD793odArVGh3+BghE6Vu8VTbnv qma7JhBJs1ryoZqnBrEuhSJ96ndEZeR9Vch5Z5nH9BXCoJt765oBmty1nCp4rDQ= X-Received: by 2002:a05:6870:700f:b0:260:e429:2498 with SMTP id 586e51a60fabf-2692b6ad6camr586034fac.26.1723086887504; Wed, 07 Aug 2024 20:14:47 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2689a6824f3sm4380931fac.57.2024.08.07.20.14.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:47 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 03/38] mmc: dw_mmc: Extract waiting for data busy into a separate routine Date: Wed, 7 Aug 2024 22:14:09 -0500 Message-Id: <20240808031444.9619-4-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Waiting for data busy is a logically separate operation and should be implemented as a separate routine. Follow Linux kernel example and extract it from dwmci_send_cmd(). This way it doesn't clutter dwmci_send_cmd() function, and can be reused later in other cases. No functional change. Signed-off-by: Sam Protsenko Reviewed-by: Quentin Schulz --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - Added R-b tag from Quentin drivers/mmc/dw_mmc.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index 45665e517068..395b699b0a0a 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -245,6 +245,21 @@ static int dwmci_set_transfer_mode(struct dwmci_host *host, return mode; } +static void dwmci_wait_while_busy(struct dwmci_host *host, struct mmc_cmd *cmd) +{ + unsigned int timeout = 500; /* msec */ + ulong start; + + start = get_timer(0); + while (dwmci_readl(host, DWMCI_STATUS) & DWMCI_BUSY) { + if (get_timer(start) > timeout) { + debug("%s: Timeout on data busy, continue anyway\n", + __func__); + break; + } + } +} + #ifdef CONFIG_DM_MMC static int dwmci_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, struct mmc_data *data) @@ -259,19 +274,11 @@ static int dwmci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, ALLOC_CACHE_ALIGN_BUFFER(struct dwmci_idmac, cur_idmac, data ? DIV_ROUND_UP(data->blocks, 8) : 0); int ret = 0, flags = 0, i; - unsigned int timeout = 500; u32 retry = 100000; u32 mask, ctrl; - ulong start = get_timer(0); struct bounce_buffer bbstate; - while (dwmci_readl(host, DWMCI_STATUS) & DWMCI_BUSY) { - if (get_timer(start) > timeout) { - debug("%s: Timeout on data busy, continue anyway\n", __func__); - break; - } - } - + dwmci_wait_while_busy(host, cmd); dwmci_writel(host, DWMCI_RINTSTS, DWMCI_INTMSK_ALL); if (data) { From patchwork Thu Aug 8 03:14:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817669 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp674772wrt; Wed, 7 Aug 2024 20:15:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWfI1i+fcs0i8YDZLe+OY70jbmMQOevVLk2lHZM7Z9wpjVI1e+PTHOlwFV7yR80zusS7s7/fWoeCCEaucBNDJCd X-Google-Smtp-Source: AGHT+IGh295S4FH2LI37xFrg8szqQOo5opHfvcIWtPzdSuVTN4DAOGXyCnTtqsdg5LEJ10LhpaED X-Received: by 2002:a05:6512:15a0:b0:52c:c5c4:43d4 with SMTP id 2adb3069b0e04-530e588be65mr362492e87.53.1723086952059; Wed, 07 Aug 2024 20:15:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723086952; cv=none; d=google.com; s=arc-20160816; b=p4wAJUFzj2OotBv6FtdtGmneYw0ZDmOisN4db7q0ONC8zPq0PZUjm2kbizIxMDre8Q 3gvQcEPxgBPBhLBR/FZS/omvZVVTMFtA2BXU1CZBlhy/1KQBczGEzvksMIZfBYNxx+1L aE1vdS4BCH1QPMYoAZEliMM1AmvTMGwq3jIECH7TBHuJ4cKxQ43bZ5wWRjWCLfW5B3Jo qWJpLa7vRnw+YkezT30Q2Ze6SiF142GjrU3hrUT4eoyf0hpFjVwQgYTs1Avb5FDWn73B 2me+eCCaXO60lCZg8k0kmjroeVjTl2HWPjpO8FJ/Oaoda2F0c0RbA9abZj99seMxhiPQ 3ZiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FRCqD5v1ORpY/kJffGm3A2945sYGmKt5zChbimK5q7M=; fh=MkQlSBdhP8274AUugMtShokXmqYAT6bL0FUEn7PksF0=; b=rH+PLHOeWsCyXPL42LedYGU4o77hcjHz7HPpE2GbB3e6vOp3a9+nER0VpoZ9auLSJX Cor7xsjXYD9MtMxlFISIh0v0mD4s0dMIudlSj2wfGIB1HTEvVnTs4dvKwD4BroPVCRiQ dybxNJTmlejjs/Et7psGQQXd1swi0K7xgsA8o0fijlTxJMAL9r/Bs4qDGnQKRSQPO3C4 h6+KoioIj+uMm2E7/shEJoRa7y9MnXp1PLoyaznibfinV166dkCmcE6fHV6yWNU7OOMM 7Rttmf5DIZWvtJ07+bn/Lj59p8I0LcaHwHdKRnC8sS5bIcMWFLtnyUzTOBAP3dSDhKJP HsIQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QBC9gp2t; 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-a7dc9d6921dsi719695766b.423.2024.08.07.20.15.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:52 -0700 (PDT) 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=QBC9gp2t; 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 B767088A83; Thu, 8 Aug 2024 05:14:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="QBC9gp2t"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6BF8788641; Thu, 8 Aug 2024 05:14:54 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc36.google.com (mail-oo1-xc36.google.com [IPv6:2607:f8b0:4864:20::c36]) (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 9955A88641 for ; Thu, 8 Aug 2024 05:14:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oo1-xc36.google.com with SMTP id 006d021491bc7-5c6661bca43so326329eaf.0 for ; Wed, 07 Aug 2024 20:14:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086888; x=1723691688; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FRCqD5v1ORpY/kJffGm3A2945sYGmKt5zChbimK5q7M=; b=QBC9gp2t6bba8xUEeUvLAeLYKUzoT8B7whRHXTkUi3OXJAX8izhyTRIY6fXA8ZDZOV 1uorl78+wDQNCts1aZEqKM1UsUsGJTTN5KPslUNzvv85AShIKIFmAeuhsxMW2a95FzZl mDCp8zLmq2nG4ZFO0KYGl0pzbaAKENkc53Dl8cEq8uzj8VECxnd0vRzmxksoYw21O4aI m9hplIT7EJ18B84bVkPkUJ26ZxG1w+NkpT+QvIwHAk55j0/pJ7mlapsQU1SIeeS6Y1n3 WV/wOBhm4Wb89dmUWNqX5sSvsipgDgjWL/oUQS4KdRms0E2K8SLEGgRjHAKumRtl8vUW g7OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086888; x=1723691688; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FRCqD5v1ORpY/kJffGm3A2945sYGmKt5zChbimK5q7M=; b=XVBbDotl/RIRC5471aNQtJVGXKbA1OA1ZDuurFaj58G1uej+cqTmJ9vpqpf1um1tl8 nn45Aw3kn1wLpb6046x5KGZnmWnw7eezBIrbhfZlkPza7Lz1ZwRmh12G9+QWDnwELjhq n1SKST+W/kwT+/XQ9MWpQPooMewb8DX/td6IaTOwNIlszkW6RqXw521OMQNEoF84/QZv bugPb3GWpuwD3fyD3alspm4lFuWXOp/wQL4vn+AGjgvhhhMZ2GD9lZrzlWXkc4/05jBZ SOf6fbqUfb7c54RUvMWW9nFzANiJZSJ2y5+ajVnDVmMAYqSzeJndDhO8EVJSikgU/8Nx 52CA== X-Forwarded-Encrypted: i=1; AJvYcCXAo1zw8OL+VTydj/Y/dwelsvC6PMvTW23i+PGJeN6mfF/KnONuIhrKHWg2r+/5vlgSvhXv4LG0/T+6U7+eM53lmy9xQA== X-Gm-Message-State: AOJu0YxV8PwFVlRcvDDEOTvDc0N101M83FKqslCW+L7ofGingsKDzOi0 aiqAYtdmTR9akqmskPSCij0L1hE5Aev9uaWgqsZjykNP34hKJ6jzdjCoJ43S1ZE= X-Received: by 2002:a05:6820:2782:b0:5d5:c3a9:4010 with SMTP id 006d021491bc7-5d855bd447fmr667311eaf.5.1723086888184; Wed, 07 Aug 2024 20:14:48 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5d7478b084csm3481820eaf.0.2024.08.07.20.14.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:47 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 04/38] mmc: dw_mmc: Extract FIFO init into a separate routine Date: Wed, 7 Aug 2024 22:14:10 -0500 Message-Id: <20240808031444.9619-5-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Move FIFO threshold initialization into a separate function to make dwmci_init() more readable. No functional change. Signed-off-by: Sam Protsenko Reviewed-by: Quentin Schulz --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - Added R-b tag from Quentin drivers/mmc/dw_mmc.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index 395b699b0a0a..4a9e57165fbb 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -538,6 +538,20 @@ static int dwmci_set_ios(struct mmc *mmc) return 0; } +static void dwmci_init_fifo(struct dwmci_host *host) +{ + if (!host->fifoth_val) { + u32 fifo_size; + + fifo_size = dwmci_readl(host, DWMCI_FIFOTH); + fifo_size = ((fifo_size & RX_WMARK_MASK) >> RX_WMARK_SHIFT) + 1; + host->fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size / 2 - 1) | + TX_WMARK(fifo_size / 2); + } + + dwmci_writel(host, DWMCI_FIFOTH, host->fifoth_val); +} + static int dwmci_init(struct mmc *mmc) { struct dwmci_host *host = mmc->priv; @@ -562,16 +576,7 @@ static int dwmci_init(struct mmc *mmc) dwmci_writel(host, DWMCI_IDINTEN, 0); dwmci_writel(host, DWMCI_BMOD, 1); - - if (!host->fifoth_val) { - uint32_t fifo_size; - - fifo_size = dwmci_readl(host, DWMCI_FIFOTH); - fifo_size = ((fifo_size & RX_WMARK_MASK) >> RX_WMARK_SHIFT) + 1; - host->fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size / 2 - 1) | - TX_WMARK(fifo_size / 2); - } - dwmci_writel(host, DWMCI_FIFOTH, host->fifoth_val); + dwmci_init_fifo(host); dwmci_writel(host, DWMCI_CLKENA, 0); dwmci_writel(host, DWMCI_CLKSRC, 0); From patchwork Thu Aug 8 03:14:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817668 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp674700wrt; Wed, 7 Aug 2024 20:15:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWJo2F8grKgkl1hoO/0ZcdwoWFtMEJHBaxj/utGhjnO16NUL34kuI7AJ6SGmVxLrm2M7MA4XiKOfdIo3z2OARxS X-Google-Smtp-Source: AGHT+IFY28FW5iZIWUj1eU4WVTU23R+pJLtS0q3rOzoko5TKzJ1VsROosanVfF9nBSxL13AK72fF X-Received: by 2002:a17:907:1c84:b0:a77:d85c:86f5 with SMTP id a640c23a62f3a-a8090e41c8fmr32415566b.53.1723086940908; Wed, 07 Aug 2024 20:15:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723086940; cv=none; d=google.com; s=arc-20160816; b=zXwj4IncazCcsj20uvpCIV63ILV/ZqLycN/F3kIp08DMvgAoqPEM806tBEgrzOzF73 D7vu0/5q0///e0RC1hKvWunrZS88oXqMbX/arVNOTp0dERcfwxybi3/WXccqq6pbuPRh qoe4bxvBaAF3V3BT4jlMznpzjxcX/X02lKqwrOG8kcNwWITKCuEvc9go/ZMV26O8u2pI YW0suVPJKvM/vJzrNb3KAPMAXm6dawSAkKFloRRvUJDlydYafU7+9sMMnHeUT50oiXHo 989kqE9JWzm74lBVNeVmylGpLJXoWxtgtCoxsT/HhJayZwSwjHTxD2YK0r6c/Od+NfUM leOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eY2rTYjkOWFBzEA+E9TVgo0yeFXWo2Z9cx2a5ssETXc=; fh=nOJ9imYy143OvSOUGWkXxKfDa2Sn9pJGpUfEyWfJgSY=; b=aypNnzvJ5iaVTf3fI7SLv9k4JDxPCNuF5Oy06U9HOGp/+KkILquL60/0v2GwcD4JTq sOVNEY44/sOdBay4K/pGkbn+Y4kJqfHUmMZTUvWcamL1lQIypB/sureDu2Hy8ZywRrd0 ZJIoU6pxqy9MEz/RReR93mQXlqth+4Qg1Yy0C82cZTieYyz1hghkPiAxz/2WbEs+61oM hIK8RiJ+UDH4Y8doMXnCNGc5MP+tRsXxtXeTgVjOw9eUKNOQhxRLnQxyAl828yimtv2G 2wkSOlVY7GC3XLkDcOJy3ze7aabj+v0f+MWJoL3IGBdf/krnpMp1/IG4v8lyvhPYHspT RWTw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ol+odSIO; 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-a7dc9f5db6esi753014566b.946.2024.08.07.20.15.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:40 -0700 (PDT) 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=ol+odSIO; 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 82D66889EF; Thu, 8 Aug 2024 05:14:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ol+odSIO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B4E6B88A6D; Thu, 8 Aug 2024 05:14:53 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) (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 7D727889E6 for ; Thu, 8 Aug 2024 05:14:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-3db157d3bb9so395342b6e.2 for ; Wed, 07 Aug 2024 20:14:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086889; x=1723691689; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eY2rTYjkOWFBzEA+E9TVgo0yeFXWo2Z9cx2a5ssETXc=; b=ol+odSIOoBPwL5qoApT2uCmPVzNGpQx5bQN59YyYUVh0nQ6F9Ux2XnlRNl7GfvqrOu I16JIYn67BwgnE8mBqaCYOhQDZdfgi9KcGK7+61gbr7uxEYCppLYwEQHQXqZR11dW5ba rTHmHtl0ascjiml5P/mcd1SW51IZ148dLWAE/wO5OctzUTs87HKhD4fyU8bkM94uRMyf 88dvtuvoBTeloSM4hoST1zDHfZAqx6srb5VoRSGlUjYfHtWFcij45ftgrEKHC/ZzmhCz Z2gBmWUO9jDDdoY057qO1Mim9JwLyC0LHtZaxjKYpDE7WuPNIylhUWLqmzV5hITaVd5h B9Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086889; x=1723691689; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eY2rTYjkOWFBzEA+E9TVgo0yeFXWo2Z9cx2a5ssETXc=; b=wxRNRKVwBPLIg3Oz9nc7vEAiNFdU2ZtxYJ5+7LE/sj6mAW66Nig7SZD17PbDutBi3r TI7BSrhs0G/IuF/EbmNBQ/tE0yfXz70SB+1QztpUvYgrmzL/oNSk7n9mba9aUI03QDBk dQkYA8MnVdp+UebtrMuYTR5sfHpVw2zPpsSRXi/YMBx6Rt/ab29qeMwhcNUzG5uq7dei dV5KPjYGZzQm+WE4JB7WVxFA5xQRt4ZoY8j/XIZSFV28Is3uQ68FLk4H7jhJl3wUDfEx xl2jiXYysk34kO7X1ENpdVW7SgYGKkOsXAbe8GDgpy2OmHK0/1j7fDP2JBMGde/Wm0Ot 67qA== X-Forwarded-Encrypted: i=1; AJvYcCXCOo0BCoFsEFbp+Lca4WohbdJ/g1XFT3PlviJz0JaIPyj5fxYJFPBAIopzu00H9VYpwXPHb+9+fakKxwL6qztpeOlMjg== X-Gm-Message-State: AOJu0YwebjP4d2qfsNjbYFjr0Cte10abaJFDH+23hmSyGfnB2nKlYmpE xaAmI+Yvrlc1/ap29QbB9M7b0/udbm4RVJpOd/EsazCD/lAD0fpFy/CD1SN5Crw= X-Received: by 2002:a05:6808:210f:b0:3d9:dcbc:6b7b with SMTP id 5614622812f47-3dc3b41cf8fmr771495b6e.11.1723086888848; Wed, 07 Aug 2024 20:14:48 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3db563b705asm4639955b6e.35.2024.08.07.20.14.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:48 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 05/38] mmc: dw_mmc: Extract divider update to a separate function Date: Wed, 7 Aug 2024 22:14:11 -0500 Message-Id: <20240808031444.9619-6-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Extract the clock divider update into dwmci_update_div() function. It's a procedure recommended in TRM, so it's better to keep it in a dedicated function to make the code clearer. While at it also extract the clock control code into a separate routine to avoid code duplication in dwmci_setup_bus(). No functional change. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - Moved CLKSRC after disabling the clock as recommended in TRM, to avoid possible glitch - Extracted div update into a separate function with corresponding comment - Changed the patch subject and reworked the commit message drivers/mmc/dw_mmc.c | 81 +++++++++++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 31 deletions(-) diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index 4a9e57165fbb..b9c14fe6857b 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -410,11 +410,56 @@ static int dwmci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, return ret; } -static int dwmci_setup_bus(struct dwmci_host *host, u32 freq) +static int dwmci_control_clken(struct dwmci_host *host, bool on) { - u32 div, status; + const u32 val = on ? DWMCI_CLKEN_ENABLE | DWMCI_CLKEN_LOW_PWR : 0; + const u32 cmd_only_clk = DWMCI_CMD_PRV_DAT_WAIT | DWMCI_CMD_UPD_CLK; int timeout = 10000; + u32 status; + + dwmci_writel(host, DWMCI_CLKENA, val); + + /* Inform CIU */ + dwmci_writel(host, DWMCI_CMD, DWMCI_CMD_START | cmd_only_clk); + do { + status = dwmci_readl(host, DWMCI_CMD); + if (timeout-- < 0) { + debug("%s: Timeout!\n", __func__); + return -ETIMEDOUT; + } + } while (status & DWMCI_CMD_START); + + return 0; +} + +/* + * Update the clock divider. + * + * To prevent a clock glitch keep the clock stopped during the update of + * clock divider and clock source. + */ +static int dwmci_update_div(struct dwmci_host *host, u32 div) +{ + int ret; + + /* Disable clock */ + ret = dwmci_control_clken(host, false); + if (ret) + return ret; + + /* Set clock to desired speed */ + dwmci_writel(host, DWMCI_CLKDIV, div); + dwmci_writel(host, DWMCI_CLKSRC, 0); + + /* Enable clock */ + return dwmci_control_clken(host, true); +} + +static int dwmci_setup_bus(struct dwmci_host *host, u32 freq) +{ + u32 div; unsigned long sclk; + int ret; if ((freq == host->clock) || (freq == 0)) return 0; @@ -437,35 +482,9 @@ static int dwmci_setup_bus(struct dwmci_host *host, u32 freq) else div = DIV_ROUND_UP(sclk, 2 * freq); - dwmci_writel(host, DWMCI_CLKENA, 0); - dwmci_writel(host, DWMCI_CLKSRC, 0); - - dwmci_writel(host, DWMCI_CLKDIV, div); - dwmci_writel(host, DWMCI_CMD, DWMCI_CMD_PRV_DAT_WAIT | - DWMCI_CMD_UPD_CLK | DWMCI_CMD_START); - - do { - status = dwmci_readl(host, DWMCI_CMD); - if (timeout-- < 0) { - debug("%s: Timeout!\n", __func__); - return -ETIMEDOUT; - } - } while (status & DWMCI_CMD_START); - - dwmci_writel(host, DWMCI_CLKENA, DWMCI_CLKEN_ENABLE | - DWMCI_CLKEN_LOW_PWR); - - dwmci_writel(host, DWMCI_CMD, DWMCI_CMD_PRV_DAT_WAIT | - DWMCI_CMD_UPD_CLK | DWMCI_CMD_START); - - timeout = 10000; - do { - status = dwmci_readl(host, DWMCI_CMD); - if (timeout-- < 0) { - debug("%s: Timeout!\n", __func__); - return -ETIMEDOUT; - } - } while (status & DWMCI_CMD_START); + ret = dwmci_update_div(host, div); + if (ret) + return ret; host->clock = freq; From patchwork Thu Aug 8 03:14:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817670 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp674811wrt; Wed, 7 Aug 2024 20:16:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUW8SVf3drUWS3R/lDF3g0sHW4fwX3gHN/bYCjX3PEi7rxwVUpUI5ksKjfTYF7FHzAw+NI1lbIOQdcN8mtdcmCa X-Google-Smtp-Source: AGHT+IE1KGcsdkchZyENZ98wlivBGB5zPY1LK2xqQKiSdKxkAh4AogWerSrKBmUIGQ30AIByrC7g X-Received: by 2002:a2e:a548:0:b0:2ef:2e6b:410e with SMTP id 38308e7fff4ca-2f19de2235cmr3098141fa.4.1723086960871; Wed, 07 Aug 2024 20:16:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723086960; cv=none; d=google.com; s=arc-20160816; b=f2pwNAert7XRBx02A01byNOEu/opm++hfogewjqszPZ7PuoGavAwY17pQUNz4is/TO pr2Cz6J1N8xJEAQNgHd9BWTYcKftA9MzbnVNi3d2APyoEkecFQ864h2OcKIR7whM3oWa KRtIfn5+PWcIR1L4ICO3jO7ztkj/tUGQakvyQbJbiOnWIGD05uhMogvkLmJaLovJaueF RyWS86R7LZbFjHdxpQ0BZESywQwyu5QCONfF4IVrQWZqgTMJ6gTfUKNltPXnYrJ4KYYI 0DjDbSVIJB1ixAfHb3lMWHBEjqE4J9PFCPpxqRCvtBBs8+nlrDkKnhptrHsJqlRyM8y6 sjIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RzPnAW61MjVevF12qCy9+5xM+ky0LjDVg2Oln8L34PY=; fh=u/vRNLBW87m7u1utoCo8QQoYZu3/+H+euBfuqZZx4iA=; b=SNuLM6iwpFI34v2/fWLWx4RT6yCBUszNhJewWsqx+j5/GcXCgStzBtixh7V8IHmet5 JTOcDdUIRrXF9jYNVN38Hx1OcWzu19diMmgcjlsJ/rtIVuf18lOiuJ2bXA+zGL/Rpdwc fYjo9NoI+GRyDDtzibT8Yo1HnGD1r2GGpXmievYoIWKi0XZGV9namc0gGyPYhGDtGv/X KRardzM1OVL4MvgfV/q8FVSz+Wnx8dueEJTZTcE6K468iWEu6JjGxcasaRbwyRNduH/1 cMOL3i1ddycH4GuH8xe15fUgCVy7kw1e3nQBeBGRkR+G/QLdk3dVSCQakdRd4SOPTDTe Fgqw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sAZa64HT; 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-5bbb2e6f9ebsi249796a12.616.2024.08.07.20.16.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:16:00 -0700 (PDT) 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=sAZa64HT; 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 3189688A9C; Thu, 8 Aug 2024 05:14:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="sAZa64HT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F30DD88A2A; Thu, 8 Aug 2024 05:14:54 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) (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 7D42C8890F for ; Thu, 8 Aug 2024 05:14:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-ot1-x330.google.com with SMTP id 46e09a7af769-70942ebcc29so295333a34.0 for ; Wed, 07 Aug 2024 20:14:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086889; x=1723691689; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RzPnAW61MjVevF12qCy9+5xM+ky0LjDVg2Oln8L34PY=; b=sAZa64HTe70NZ6P6lprHKZxTKzVBmfubVY/YinDQotRXQw+alVY5SgtqWCsaTr9dq8 fNbTYguM3stK6qFlr21RsTGiw2IakGW6rCtW7FyAnIi+9cAE+AxTn749gRbH/w/KJLWN 9j4M4Al/GsBaAznZyCGvHws/O0Kk0s/YFLZtum5lxB98fX3XlLP0kArVKRlK5q1/UI2d zQptkxQ6K+9s9wu4oGuMHKuHxdDAlZd4dJKgwd7a09cy/uZB7Moei9yS0UoQxNwro/PK bV0muY59wJqGTgSWbJ/gwhWBVg8F33FOsyggOPHv+s8WT/bD+Gea7NmPRuFR17oyNZ+V gakw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086889; x=1723691689; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RzPnAW61MjVevF12qCy9+5xM+ky0LjDVg2Oln8L34PY=; b=u3BG6iQwI8kTEpg/U/J7yYsJmCa4PBgadfoBGZWXdS1sh9ghbqK9a6QjgPj7OJjhdd DQ0lD5FZmkUp0xn5nNOB/zopdp9/S9qW1WCn3wxbKvn/kxct2IcljSqox3+iOVi6OISo ZMI5d9rLz9do42DZEC6cv3GW9l3c0pF5aQo+e5+Fvh5P+2rUGld5vHE9wn47DncFXkH2 fC5Ur4XLH+Up4UMJ0nUzMGZLz1D1HgMseCl0OPbFa3FGXCrcUe/F5i0iSif/wg1dGjQa 3TNaTtmKww6I7jGNh0CKElPXpeUIMqxNz7N64EbA6W9/HKyi9opFh++0y/dHEMSAoSyf ZQ0w== X-Forwarded-Encrypted: i=1; AJvYcCUB9F4tsyLRwOIAnpIRnlDZMESZ96b7MSrtnJUWyvPiz4U5K85rOSbKc5h3zDq4XPCsMmeeQJv0kLD8fv+k6h2JoBNerQ== X-Gm-Message-State: AOJu0YyVW7xk7qFj1oBnJTgkAVl+zzcjkVfw7AMQxez3HGiN3g9q3VHl IjbmZDSX+0NkntSMzG5IFivEkfXsTi3PezQtnEwuBdkblUAiVi1EPfbbpYQXIXA= X-Received: by 2002:a05:6830:6705:b0:709:2721:ad44 with SMTP id 46e09a7af769-70b4fc35a9emr972334a34.12.1723086889517; Wed, 07 Aug 2024 20:14:49 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-70a3a76907fsm5163119a34.71.2024.08.07.20.14.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:49 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 06/38] mmc: dw_mmc: Extract FIFO data transfer into a separate routine Date: Wed, 7 Aug 2024 22:14:12 -0500 Message-Id: <20240808031444.9619-7-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 FIFO data transfer is implemented as quite a massive chunk of code. Extract it into a dedicated function to make dwmci_data_transfer() easier to read and reduce the indentation level of the code. No functional change. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) drivers/mmc/dw_mmc.c | 107 +++++++++++++++++++++---------------------- 1 file changed, 53 insertions(+), 54 deletions(-) diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index b9c14fe6857b..b99f63a6f8bd 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -139,25 +139,67 @@ static unsigned int dwmci_get_timeout(struct mmc *mmc, const unsigned int size) return timeout; } -static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) +static int dwmci_data_transfer_fifo(struct dwmci_host *host, + struct mmc_data *data, u32 mask) { - struct mmc *mmc = host->mmc; + const u32 fifo_depth = (((host->fifoth_val & RX_WMARK_MASK) >> + RX_WMARK_SHIFT) + 1) * 2; + const u32 int_rx = mask & (DWMCI_INTMSK_RXDR | DWMCI_INTMSK_DTO); + const u32 int_tx = mask & DWMCI_INTMSK_TXDR; int ret = 0; - u32 timeout, mask, size, i, len = 0; - u32 *buf = NULL; - ulong start = get_timer(0); - u32 fifo_depth = (((host->fifoth_val & RX_WMARK_MASK) >> - RX_WMARK_SHIFT) + 1) * 2; + u32 len = 0, size, i; + u32 *buf; + + size = (data->blocksize * data->blocks) / 4; + if (!host->fifo_mode || !size) + return 0; - size = data->blocksize * data->blocks; if (data->flags == MMC_DATA_READ) buf = (unsigned int *)data->dest; else buf = (unsigned int *)data->src; - timeout = dwmci_get_timeout(mmc, size); + if (data->flags == MMC_DATA_READ && int_rx) { + dwmci_writel(host, DWMCI_RINTSTS, int_rx); + while (size) { + ret = dwmci_fifo_ready(host, DWMCI_FIFO_EMPTY, &len); + if (ret < 0) + break; + + len = (len >> DWMCI_FIFO_SHIFT) & DWMCI_FIFO_MASK; + len = min(size, len); + for (i = 0; i < len; i++) + *buf++ = dwmci_readl(host, DWMCI_DATA); + size = size > len ? (size - len) : 0; + } + } else if (data->flags == MMC_DATA_WRITE && int_tx) { + while (size) { + ret = dwmci_fifo_ready(host, DWMCI_FIFO_FULL, &len); + if (ret < 0) + break; + + len = fifo_depth - ((len >> DWMCI_FIFO_SHIFT) & + DWMCI_FIFO_MASK); + len = min(size, len); + for (i = 0; i < len; i++) + dwmci_writel(host, DWMCI_DATA, *buf++); + size = size > len ? (size - len) : 0; + } + dwmci_writel(host, DWMCI_RINTSTS, DWMCI_INTMSK_TXDR); + } - size /= 4; + return ret; +} + +static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) +{ + struct mmc *mmc = host->mmc; + int ret = 0; + u32 timeout, mask, size; + ulong start = get_timer(0); + + size = data->blocksize * data->blocks; + timeout = dwmci_get_timeout(mmc, size); for (;;) { mask = dwmci_readl(host, DWMCI_RINTSTS); @@ -168,50 +210,7 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) break; } - if (host->fifo_mode && size) { - len = 0; - if (data->flags == MMC_DATA_READ && - (mask & (DWMCI_INTMSK_RXDR | DWMCI_INTMSK_DTO))) { - dwmci_writel(host, DWMCI_RINTSTS, - mask & (DWMCI_INTMSK_RXDR | - DWMCI_INTMSK_DTO)); - while (size) { - ret = dwmci_fifo_ready(host, - DWMCI_FIFO_EMPTY, - &len); - if (ret < 0) - break; - - len = (len >> DWMCI_FIFO_SHIFT) & - DWMCI_FIFO_MASK; - len = min(size, len); - for (i = 0; i < len; i++) - *buf++ = - dwmci_readl(host, DWMCI_DATA); - size = size > len ? (size - len) : 0; - } - } else if (data->flags == MMC_DATA_WRITE && - (mask & DWMCI_INTMSK_TXDR)) { - while (size) { - ret = dwmci_fifo_ready(host, - DWMCI_FIFO_FULL, - &len); - if (ret < 0) - break; - - len = fifo_depth - ((len >> - DWMCI_FIFO_SHIFT) & - DWMCI_FIFO_MASK); - len = min(size, len); - for (i = 0; i < len; i++) - dwmci_writel(host, DWMCI_DATA, - *buf++); - size = size > len ? (size - len) : 0; - } - dwmci_writel(host, DWMCI_RINTSTS, - DWMCI_INTMSK_TXDR); - } - } + ret = dwmci_data_transfer_fifo(host, data, mask); /* Data arrived correctly. */ if (mask & DWMCI_INTMSK_DTO) { From patchwork Thu Aug 8 03:14:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817672 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp674911wrt; Wed, 7 Aug 2024 20:16:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXNLkHeIg4/EA0YiJ6RpY6BkeKa/IrAkKiAdTUQgEBVaDoK3JaFBbB5S/j7HukYBawFuTxZPBd1miYuXltwB7nG X-Google-Smtp-Source: AGHT+IG1nsxGeIncHEq/hGWqPs6Soet0KHGAfti8GZ6i3iczuarb1v2QWFD0m8fvCLA1SRSmEu7T X-Received: by 2002:a05:6402:3484:b0:57a:3046:1cd8 with SMTP id 4fb4d7f45d1cf-5bbb22399e9mr553903a12.7.1723086982831; Wed, 07 Aug 2024 20:16:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723086982; cv=none; d=google.com; s=arc-20160816; b=RZfwe+FCK+bJJMNGp/+DWw64A2MHrneyf7b2gvtm8f70mrYYiY8XiCZsGTmM6sheNO bM/0B+LzAxVyu0Ef24RB7Q6QTWxe+ooGt3Gwo3ATz0OxZ9Us740QA9hEAyGqLaQxCAOo ZzrM6iVwoTS6J9rfLCfRayE6zbyiHIPcex22K3/sWPXRtVGqRNv1w/ualOQqt2RpVudv 2yfUGWsIdyhR0okCHATzWJCJu4MWrFj/hv1w8fDrO4EfsYJPHbaUKF4ZvhbQhCKN/BZc jb++S8I8SkmZn8k4SSc5teUyf1IYXKKPCNJudYHom9HRpCxHF8BZH27yUMzf5Rk0Vf9L Xqsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lajTQ3JYoTyQySiuDMhbE4W09/EbwBdHGoc2IwlOBbU=; fh=45D9Rh4B1/C1ZXLA6mQRbjtIf8kVezwKbWC9lK1HD1o=; b=ZOCNhLYapfcGt1xc8WDQuxgXJ49XiCdMIzZvRL4nNIchHs2vGshs6lAx3TmIohknIO SufXv/lU1CgwKSCDfb0o/wx73GvdmroB0gGQlmDxPhL2PWY6vkFn629/8UrQ39EBi7VI 6gVnyIpmZlMG3QTe0dzBAkEXe3eY+SZnpVpWvoZRN9DqQ08w6d2Dz8h0/p4XsBmRnYVH lpT1ztixbll42ThkLoHAGg1+iBIEjrelwLESnm42KNrOC6MYB26U9ygteSe5cXdeolb5 HdnwR9wDZbaZCR8Wr1uTo6t+Y/EyIfp2tRW2mciat5bht4TT1q/xu3JurSPk3g1hWI5L goRw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L7RDndfT; 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-5bbb2e705ffsi244924a12.680.2024.08.07.20.16.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:16:22 -0700 (PDT) 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=L7RDndfT; 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 30D3988AF6; Thu, 8 Aug 2024 05:15:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="L7RDndfT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2CBA98873C; Thu, 8 Aug 2024 05:14:55 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oa1-x2f.google.com (mail-oa1-x2f.google.com [IPv6:2001:4860:4864:20::2f]) (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 B78A48871A for ; Thu, 8 Aug 2024 05:14:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-2611da054fbso393890fac.1 for ; Wed, 07 Aug 2024 20:14:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086890; x=1723691690; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lajTQ3JYoTyQySiuDMhbE4W09/EbwBdHGoc2IwlOBbU=; b=L7RDndfTf2X01URl93pc84NUFEuRt541PiZ4qjnuIgEf8o45P01aQ5l1hAYyxHYMxh KpxODW9kEEb6gRCC3dZ2UfuW4W1MUQcFJwOW5IqfETbngTedEWqeCemIwGhc3Fs2WxB8 9zhI0f7VftGFGJlAgAVMQuvCdEo/IliKAfawwP+TipvT2PNomCSAf75MkvDE3obbZ6jJ JPc7f64NpCdx3BYtbKaqruWQeoduPYXorJDrX24eR3anSyKIlPirelK3VoKlz63kNlmS U2qDRUnFLilL50244gXvkW4np4/ZIBQ2ueFE0RgLsQJqCY5ddqNCH5H6fgn4tptl24yK Q3TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086890; x=1723691690; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lajTQ3JYoTyQySiuDMhbE4W09/EbwBdHGoc2IwlOBbU=; b=MIPYdEH/Yzc4hHxnpi5mxGY53rCAs50OM50xvcI7lwv9rbirY+PuJHVSFdKlB8Rd4s DyWsxPpgSxT2yvxggM1J2QLLb8dvBlQwgJ/slDlYqbFiujDc2llFZA2u+fT1f/jMRBSV 8ZtwTbMhX6tSS23ZA8l+OiJ5J9JIk60OnwhJsfnFeK2rD5aJqgmzNovMSv5DyRpqE9b/ OD3ZjLtMbJ653pqeTHw/LIiTzrwGxjvTdDBqFmgTyPZDpagEz0LhroQb4MGg2ad2dybe 163KWcYw9wu0iqdy5qqIem1EFjZsRAW8YQ3xkdYWaXTnAtrjYMvXwe9vsSkTW4Zvpm+N Ov0Q== X-Forwarded-Encrypted: i=1; AJvYcCU3nZIX+gR9nBOco+/QqEsluTpn3m4kiBv3iu7/lBkJ6dHcM+Wp1kAXjDI22sM9vvVZbT3oXfYOoN2xvpmxjXNID9zgsg== X-Gm-Message-State: AOJu0Yz9dLEGpIlgLlCWKuedhipIeZcCMBP7vmD3s6oe/ibUthwwJf2O st2Q4FI9i0oXsD4GE/a7nZvYr+w/SihR60VHNyxiBKNNOcttIm3GBwLBExdHjqo= X-Received: by 2002:a05:6870:d107:b0:260:fdd5:4147 with SMTP id 586e51a60fabf-2692b63ef02mr709416fac.15.1723086890236; Wed, 07 Aug 2024 20:14:50 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2689a2f1af9sm4379042fac.13.2024.08.07.20.14.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:49 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 07/38] mmc: dw_mmc: Extract DMA transfer handling code into a separate routine Date: Wed, 7 Aug 2024 22:14:13 -0500 Message-Id: <20240808031444.9619-8-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Make dwmci_send_cmd() easier to read by moving the DMA transfer handling code into a dedicated function. No functional change. Signed-off-by: Sam Protsenko Reviewed-by: Quentin Schulz --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - Added R-b tag from Quentin drivers/mmc/dw_mmc.c | 51 ++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index b99f63a6f8bd..8fc26399034b 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -232,6 +232,33 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) return ret; } +static int dwmci_dma_transfer(struct dwmci_host *host, uint flags, + struct bounce_buffer *bbstate) +{ + int ret; + u32 mask, ctrl; + + if (flags == MMC_DATA_READ) + mask = DWMCI_IDINTEN_RI; + else + mask = DWMCI_IDINTEN_TI; + + ret = wait_for_bit_le32(host->ioaddr + DWMCI_IDSTS, + mask, true, 1000, false); + if (ret) + debug("%s: DWMCI_IDINTEN mask 0x%x timeout\n", __func__, mask); + + /* Clear interrupts */ + dwmci_writel(host, DWMCI_IDSTS, DWMCI_IDINTEN_MASK); + + ctrl = dwmci_readl(host, DWMCI_CTRL); + ctrl &= ~DWMCI_DMA_EN; + dwmci_writel(host, DWMCI_CTRL, ctrl); + + bounce_buffer_stop(bbstate); + return ret; +} + static int dwmci_set_transfer_mode(struct dwmci_host *host, struct mmc_data *data) { @@ -274,7 +301,7 @@ static int dwmci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, data ? DIV_ROUND_UP(data->blocks, 8) : 0); int ret = 0, flags = 0, i; u32 retry = 100000; - u32 mask, ctrl; + u32 mask; struct bounce_buffer bbstate; dwmci_wait_while_busy(host, cmd); @@ -382,26 +409,8 @@ static int dwmci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, if (data) { ret = dwmci_data_transfer(host, data); - - /* only dma mode need it */ - if (!host->fifo_mode) { - if (data->flags == MMC_DATA_READ) - mask = DWMCI_IDINTEN_RI; - else - mask = DWMCI_IDINTEN_TI; - ret = wait_for_bit_le32(host->ioaddr + DWMCI_IDSTS, - mask, true, 1000, false); - if (ret) - debug("%s: DWMCI_IDINTEN mask 0x%x timeout.\n", - __func__, mask); - /* clear interrupts */ - dwmci_writel(host, DWMCI_IDSTS, DWMCI_IDINTEN_MASK); - - ctrl = dwmci_readl(host, DWMCI_CTRL); - ctrl &= ~(DWMCI_DMA_EN); - dwmci_writel(host, DWMCI_CTRL, ctrl); - bounce_buffer_stop(&bbstate); - } + if (!host->fifo_mode) + ret = dwmci_dma_transfer(host, data->flags, &bbstate); } udelay(100); From patchwork Thu Aug 8 03:14:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817671 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp674867wrt; Wed, 7 Aug 2024 20:16:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUBv3aaSfnsds7DXgAqQDRI9/Dw/i5T1zc+s2/0tPUAyYkdMrVRCuWX72E/FUPxOKh50mQWpIHL8bJsvrKbHvSz X-Google-Smtp-Source: AGHT+IG2jZFi+DWmO1MyR5DQrUUkaGpr75rVc5p2Wq82Ic4zzZKhzuVmVVMXK4rsZYrHoCdvJFKI X-Received: by 2002:a05:6402:d08:b0:57d:72e:5b3a with SMTP id 4fb4d7f45d1cf-5bbb2341801mr380602a12.33.1723086972154; Wed, 07 Aug 2024 20:16:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723086972; cv=none; d=google.com; s=arc-20160816; b=qQgYKhOWcsLqTZHwyX7mTmsfaexU/GfrF/GAi1Pi0E2HODnEJ3+1CtFK6yrSGXNgPw m8zRM8/SVjl0WavIRog1Mis/Lji7c1HlmnHT9FgWPtLvNGG+Pe51mKyBAjtqvbNH1H3r ClpyQN+JKjuKSven6Ug4kaNO+INfA0YPJXQzzTP6bQ571J2TOw4pbKMD2ufS7neSeGU5 QyzR2nezLYT6awpBE+MxQWgnrb7gwD03uFhWmen2DGQgVblu4iRsMClfdr3jYmIk1b+L t3V/KfWcbXLMWo81lV5V7ZTd7hPNahlNC8ZxnmiLD+sDQpMvUOWIkhR0jIXr5cYNWpga 4Mfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=74cEtQY4AKykl70Rjuduf42kwRXuU030jQ8VMINt+nE=; fh=9D+KVfKwvk476TBAGYf4OrbpwCHkFNDKpyTYHFIkpgk=; b=ROr71jdOTGXluvRYzROLvR08hTeHkkNHsMYj/kteYiVs7ZmkZ0Ct/cIvIuyuf/g1jU +aRu/4VpoqZl9NzgIGUAgrBcVUjv2k65U+NnPNb+m4QBUhh8p/7UXKzeqv8nicr6yFJy Th1kPpcOg/rRDN7C98HXp/hRLKLChTvssyEvIddzRr8BypqL2DtHSVl7BEBZfQMEaWZt 8qCMtaxxieDai3cfBpUB1mrsnFmltsmD8G6zay7pd0CVEq6AZqXQIDtOTMY1YxQCLHk3 FmnboJfJrtmjkMoNsqkuezY1G2HdKh328Psfmv5It/nbhoxqFrwKFac3lsfa4y5qU86r eXvA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="XnT00wR/"; 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-5bbb2d23d17si247339a12.442.2024.08.07.20.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:16:12 -0700 (PDT) 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="XnT00wR/"; 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 9A1F688AE4; Thu, 8 Aug 2024 05:14:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="XnT00wR/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 28A4E88A2A; Thu, 8 Aug 2024 05:14:55 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc2c.google.com (mail-oo1-xc2c.google.com [IPv6:2607:f8b0:4864:20::c2c]) (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 5A5458873C for ; Thu, 8 Aug 2024 05:14:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-5d59e491fefso282749eaf.1 for ; Wed, 07 Aug 2024 20:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086891; x=1723691691; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=74cEtQY4AKykl70Rjuduf42kwRXuU030jQ8VMINt+nE=; b=XnT00wR/cCI15MmuY5pAb+s4LcqbMY3beyH+n94CIyw06lAoiixjdJuklcU6poy0Q8 6UHrnlfmeNV16DDzsOwgtOVLtCCahNSGsAKcf0Y5Rb9+nUILVZBuDM0P2F8XaiC2q8Ny gxMEkqI2Y2gVVd/cA+AjqiMS3MEuGgB4ByBCigQlVpSKZ5939BiVUA+Jqk+ok7mrxAWU +zLX+ffLVMlmDUDAyEh/COk92LdmCEAdqSReq6tprXdj/AabjdPoqdAQDT2lnC2jmSgN C6fftEwvkoGc0rCleSBelCOTInM0jab57bIsFWUhnc1jo2eY3uSidHrUU027Ut+xCXmO 6v4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086891; x=1723691691; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=74cEtQY4AKykl70Rjuduf42kwRXuU030jQ8VMINt+nE=; b=H1GXou9NoTmpQlKrN/piI4Ow0vyoxdPOn6/HDSbOvG4XwDhnrHGeM0lX+cGl+V6Iud DRepbxCXLjAqtl7gt/g0RWbjOALC/jcYAjC/C17FyxpLTtuLwY+EZGKYRr3aYnXLifoc 7QKQHosPNYt3CeN6E9wV8Tw1Qs+rNG9SrpD89GqsuCJ3NtMtOWnhNdjYPe1Pl1apSlH2 u4d7pkpxXXK1NHc19P/zZ9cCvhkcSVeZ+TV4Rg1VNXxerGBJfVm/PPtzAJgdcbubTRfN LbLhfDqu/v1+LRiWLfVclRCWX4XTFi8pchOwsdk590rel6rce3PGsICpIAJzrVJE6tTb 5suA== X-Forwarded-Encrypted: i=1; AJvYcCX9n/j3WIlbV0Agu/FIYUA1atPjvwyxv4PmoKvlF7EQ4GKNz3eL/csrpdFudRDMiBPmba7IcSQEjvVphaFDh5jl9FVnDA== X-Gm-Message-State: AOJu0YwnYK+q0fkF3Nbz4S59kVdvlcry5wy4M4Xb0hGqUGnapCiX2WWR BM8d/LP4BduPAdy+ZvgoXRcH3Sddlaw6kid5d+/PATrxAAVILjFWsKSwlj78GqQ= X-Received: by 2002:a05:6870:d18b:b0:261:1a17:c817 with SMTP id 586e51a60fabf-2692b61859amr758267fac.7.1723086891009; Wed, 07 Aug 2024 20:14:51 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-70a31d9e011sm5154051a34.1.2024.08.07.20.14.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:50 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 08/38] mmc: dw_mmc: Extract setting the DMA descriptor into a separate routine Date: Wed, 7 Aug 2024 22:14:14 -0500 Message-Id: <20240808031444.9619-9-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Make dwmci_prepare_data() function easier to read by extracting the preparation of IDMAC descriptor into a dedicated function. No functional change. Signed-off-by: Sam Protsenko Reviewed-by: Quentin Schulz --- Changes in v5: - (none) Changes in v4: - Rebased on top of the most recent master Changes in v3: - (none) Changes in v2: - Added R-b tag from Quentin drivers/mmc/dw_mmc.c | 51 +++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index 8fc26399034b..d73d58bcf7d7 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -53,46 +53,57 @@ static void dwmci_set_idma_desc(struct dwmci_idmac *idmac, desc->next_addr = (ulong)desc + sizeof(struct dwmci_idmac); } -static void dwmci_prepare_data(struct dwmci_host *host, - struct mmc_data *data, +static void dwmci_prepare_desc(struct mmc_data *data, struct dwmci_idmac *cur_idmac, void *bounce_buffer) { - unsigned long ctrl; - unsigned int i = 0, flags, cnt, blk_cnt; + struct dwmci_idmac *desc = cur_idmac; ulong data_start, data_end; + unsigned int blk_cnt, i; + data_start = (ulong)cur_idmac; blk_cnt = data->blocks; - dwmci_wait_reset(host, DWMCI_CTRL_FIFO_RESET); - - /* Clear IDMAC interrupt */ - dwmci_writel(host, DWMCI_IDSTS, 0xFFFFFFFF); + for (i = 0;; i++) { + unsigned int flags, cnt; - data_start = (ulong)cur_idmac; - dwmci_writel(host, DWMCI_DBADDR, (ulong)cur_idmac); - - do { - flags = DWMCI_IDMAC_OWN | DWMCI_IDMAC_CH ; - flags |= (i == 0) ? DWMCI_IDMAC_FS : 0; + flags = DWMCI_IDMAC_OWN | DWMCI_IDMAC_CH; + if (i == 0) + flags |= DWMCI_IDMAC_FS; if (blk_cnt <= 8) { flags |= DWMCI_IDMAC_LD; cnt = data->blocksize * blk_cnt; } else cnt = data->blocksize * 8; - dwmci_set_idma_desc(cur_idmac, flags, cnt, - (ulong)bounce_buffer + (i * PAGE_SIZE)); + dwmci_set_idma_desc(desc, flags, cnt, + (ulong)bounce_buffer + i * PAGE_SIZE); + desc++; - cur_idmac++; if (blk_cnt <= 8) break; blk_cnt -= 8; - i++; - } while(1); + } - data_end = (ulong)cur_idmac; + data_end = (ulong)desc; flush_dcache_range(data_start, roundup(data_end, ARCH_DMA_MINALIGN)); +} + +static void dwmci_prepare_data(struct dwmci_host *host, + struct mmc_data *data, + struct dwmci_idmac *cur_idmac, + void *bounce_buffer) +{ + unsigned long ctrl; + + dwmci_wait_reset(host, DWMCI_CTRL_FIFO_RESET); + + /* Clear IDMAC interrupt */ + dwmci_writel(host, DWMCI_IDSTS, 0xFFFFFFFF); + + dwmci_writel(host, DWMCI_DBADDR, (ulong)cur_idmac); + + dwmci_prepare_desc(data, cur_idmac, bounce_buffer); ctrl = dwmci_readl(host, DWMCI_CTRL); ctrl |= DWMCI_IDMAC_EN | DWMCI_DMA_EN; From patchwork Thu Aug 8 03:14:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817673 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp674945wrt; Wed, 7 Aug 2024 20:16:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVMRVjO1IbaLXGOs/CRsQF4ZXws4zV6er3smcBRK2WNPmnJai8lj+yUz7HnaghN3ivgOvgwAuDcr71R8TXvpZpW X-Google-Smtp-Source: AGHT+IFBPZc09tBy6TIIWuzUUepDb5wRQuBJUf7vjEdrmH/62lmnQ5gVuGkrZ4eQoALg13E9e+kY X-Received: by 2002:a05:6402:5204:b0:5a2:a808:a2e0 with SMTP id 4fb4d7f45d1cf-5bbb21f4142mr372766a12.4.1723086992843; Wed, 07 Aug 2024 20:16:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723086992; cv=none; d=google.com; s=arc-20160816; b=xTylMhtNgPCfsC9/BMSB0JEtqCw1G9bwrxiXeO4x2M9gNM9XkxSaT/9O3FZjzzKZgc pXHwhttkggR+Ri/avYOKlsmWnWqtOSGGGynKt/jyq0IUTcrJ2idDSEF2wo19xFtTQ+ag IxH2H1hEFj8A4k04xy/c6FqzJ0nSwuVhkhKPmMKTwaDit4pJKXwgYrFrtU/GSRGVNKTX 2J29/Kzvqc7atlxHqXK1pi2NFmFoy9wHRtZG2+kM16XLEAt7aQaSHlGbJZmCQdHrsnFQ 3qpTDsSNjk7lCL2WsxlyFnNzyNakNI6v2cqRj917MaZVQDUWZykSetzNkoOs42fZgpa0 SaCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ou+/LKIzS8B7VKc6gIEftWDf7y0ax9FFdW27CIW2CG4=; fh=eqUy7A6Xa8hTD/OwdAcaEJa9XGKgQXgez7K9Nd3WPJg=; b=UX/w0QkdaexuKvjmth07MYveaDjP0L7Heq6qg4cbHKr3fc2nXq5F3AHEKwspWf9INS 0lTZFFCi/VHbJy/NzuC6JR/55u9B/e5i1uA/LHSo3K8mMYNM7EcQwBGpUwn/LrVoE0Kt IK6XdWOgOU+C+KY6oxjUVMMiLYrLQpp7+/Gvw9qCSBbnAqneLSdNnWAx2J5VbV9JThZB 659cOAOx/3oBwkqpRKHltlrGM25MQhg5F63lPhY5I8jyj7wtipuJZ758lWOfiAYUPiYn UeNl+ixpihMJtWaCe4WYh6WZ+3qJ4wCGZ/Q5BYB0xCgYC68AkZNnpOGAthc4ZqwFo0h2 Sz6Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tGgZdNHs; 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-5bbb2bf99e4si253496a12.75.2024.08.07.20.16.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:16:32 -0700 (PDT) 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=tGgZdNHs; 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 9C20F88B09; Thu, 8 Aug 2024 05:15:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="tGgZdNHs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ADB088873C; Thu, 8 Aug 2024 05:14:55 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0: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 EA9FC88A66 for ; Thu, 8 Aug 2024 05:14:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-ot1-x32d.google.com with SMTP id 46e09a7af769-704466b19c4so292282a34.0 for ; Wed, 07 Aug 2024 20:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086892; x=1723691692; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ou+/LKIzS8B7VKc6gIEftWDf7y0ax9FFdW27CIW2CG4=; b=tGgZdNHsHWj/Zw/hCDLBxKv5a7c6qfdPKP9QgH8YE3mWDnKaBL9bs5nUrO8/ZTSBJg I3+at3fCLrCU/x+2v3w26lu/jDN0An2/TQcqOIkF6M98Wvic4zmyROD309C7gA02IglJ xGAwrXRZGFsd59xflUxjJurP86p4iw2HhFChrH8JeQbl1FbFh6LRimH3R0a2ZDsEEOjI 7vO8csrKGxfc7m218I4cD7rTEsXEQgJJx+l7ozGx3griVvgnrjcQB0Z3jW//25LzsTTD lW5yNCyAHImSKrt9QfJkGffgtg2LHy7FmWvRORp7XnSLLjiE+6AcI5+thogemIcXkOiJ HSjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086892; x=1723691692; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ou+/LKIzS8B7VKc6gIEftWDf7y0ax9FFdW27CIW2CG4=; b=rXdetQYGGbVHkeJVGXmMvZY7D26BljpqllKGg6ShJwnZ4/sSCiOnzMiRUdX3jYYSAA c7uD4vfLiYHORAyLylLailvwaawbVfM7zc6xGS8HMnMz9rBkVkFWlcZG1uQsQEGow/pi I/+B0cC7BXfvf2h+jvePpn0xm4CPZXCY55RStabNH7URzzK7vCblJVZ27O3eZVMX06gp FCJSjq/dVTxapFgRh/ZnbHrEfsFWEp+J6mV4h7Y+w5pZeW3o25gaE3TZufQMbNY0kcWq e/Ld8Y9tHPbn/rYTPRxcdsS+/JL82OvjHoZ8waVRFqTDRhI03LAyHS41/Io/apDmSpDD UJmw== X-Forwarded-Encrypted: i=1; AJvYcCWX6I2C/sGBe0At7uPveZVpWxeSxeAik+4dm/d0rKVrW5DQtZXsFwA27Ws8QlVxDYYWxPYz1pkahr2qste+uO0ascaNxg== X-Gm-Message-State: AOJu0Yx8/i+RtafajQlby97ogTPQPlRZ/ofypLlnoo876ihDLcLUxLVx 6CGLaLKczPbJ0s0B8+LM7EiIgJmmbiG6EJR++mSf3aUWHiSYpt62zXAHxSObNOI= X-Received: by 2002:a05:6830:6987:b0:709:3431:94c3 with SMTP id 46e09a7af769-70b4fc95923mr648403a34.23.1723086891753; Wed, 07 Aug 2024 20:14:51 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-70b20d2ef80sm4445523a34.40.2024.08.07.20.14.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:51 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 09/38] mmc: dw_mmc: Improve 32-bit IDMAC descriptor namings Date: Wed, 7 Aug 2024 22:14:15 -0500 Message-Id: <20240808031444.9619-10-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Prepare for adding 64-bit IDMAC descriptors by renaming current 32-bit descriptor and its fields accordingly. While at it, make use of virt_to_phys() to make it more obvious in which places the physical addresses have to be used. No functional change. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) drivers/mmc/dw_mmc.c | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index d73d58bcf7d7..3e7073f7de1b 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -20,11 +20,12 @@ #define PAGE_SIZE 4096 -struct dwmci_idmac { - u32 flags; - u32 cnt; - u32 addr; - u32 next_addr; +/* Internal DMA Controller (IDMAC) descriptor for 32-bit addressing mode */ +struct dwmci_idmac32 { + u32 des0; /* Control descriptor */ + u32 des1; /* Buffer size */ + u32 des2; /* Buffer physical address */ + u32 des3; /* Next descriptor physical address */ } __aligned(ARCH_DMA_MINALIGN); static int dwmci_wait_reset(struct dwmci_host *host, u32 value) @@ -42,22 +43,23 @@ static int dwmci_wait_reset(struct dwmci_host *host, u32 value) return 0; } -static void dwmci_set_idma_desc(struct dwmci_idmac *idmac, - u32 desc0, u32 desc1, u32 desc2) +static void dwmci_set_idma_desc32(struct dwmci_idmac32 *desc, u32 control, + u32 buf_size, u32 buf_addr) { - struct dwmci_idmac *desc = idmac; + phys_addr_t desc_phys = virt_to_phys(desc); + u32 next_desc_phys = desc_phys + sizeof(struct dwmci_idmac32); - desc->flags = desc0; - desc->cnt = desc1; - desc->addr = desc2; - desc->next_addr = (ulong)desc + sizeof(struct dwmci_idmac); + desc->des0 = control; + desc->des1 = buf_size; + desc->des2 = buf_addr; + desc->des3 = next_desc_phys; } static void dwmci_prepare_desc(struct mmc_data *data, - struct dwmci_idmac *cur_idmac, + struct dwmci_idmac32 *cur_idmac, void *bounce_buffer) { - struct dwmci_idmac *desc = cur_idmac; + struct dwmci_idmac32 *desc32 = cur_idmac; ulong data_start, data_end; unsigned int blk_cnt, i; @@ -65,6 +67,7 @@ static void dwmci_prepare_desc(struct mmc_data *data, blk_cnt = data->blocks; for (i = 0;; i++) { + phys_addr_t buf_phys = virt_to_phys(bounce_buffer); unsigned int flags, cnt; flags = DWMCI_IDMAC_OWN | DWMCI_IDMAC_CH; @@ -76,22 +79,22 @@ static void dwmci_prepare_desc(struct mmc_data *data, } else cnt = data->blocksize * 8; - dwmci_set_idma_desc(desc, flags, cnt, - (ulong)bounce_buffer + i * PAGE_SIZE); - desc++; + dwmci_set_idma_desc32(desc32, flags, cnt, + buf_phys + i * PAGE_SIZE); + desc32++; if (blk_cnt <= 8) break; blk_cnt -= 8; } - data_end = (ulong)desc; + data_end = (ulong)desc32; flush_dcache_range(data_start, roundup(data_end, ARCH_DMA_MINALIGN)); } static void dwmci_prepare_data(struct dwmci_host *host, struct mmc_data *data, - struct dwmci_idmac *cur_idmac, + struct dwmci_idmac32 *cur_idmac, void *bounce_buffer) { unsigned long ctrl; @@ -308,7 +311,7 @@ static int dwmci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, { #endif struct dwmci_host *host = mmc->priv; - ALLOC_CACHE_ALIGN_BUFFER(struct dwmci_idmac, cur_idmac, + ALLOC_CACHE_ALIGN_BUFFER(struct dwmci_idmac32, cur_idmac, data ? DIV_ROUND_UP(data->blocks, 8) : 0); int ret = 0, flags = 0, i; u32 retry = 100000; From patchwork Thu Aug 8 03:14:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817674 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp674989wrt; Wed, 7 Aug 2024 20:16:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXstReJQysqnjf0ZVZ9Zf3ztvk0AfsvYZN9OydYyCi15DYYo1FWmdBqgJkG99CtOgXU0e8UReuPgKgBRYgPt8se X-Google-Smtp-Source: AGHT+IEvH2J2McbTHJzxcbrBhUsFNPMvE6lXkgKttgtnp3XLVW8r7JYV8KQw9/TJU5LqHwRHWYo7 X-Received: by 2002:a05:6402:40d0:b0:5a3:d140:1a39 with SMTP id 4fb4d7f45d1cf-5bbb218266amr362471a12.1.1723087002122; Wed, 07 Aug 2024 20:16:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087002; cv=none; d=google.com; s=arc-20160816; b=f6ag4sDI146afE1xNV3lrghMA/+OrqC9WFzNltrjqfhRBd71vbFv/VVSrv+IieloVe CxERKWryCIzV2nr0wZHDSVboSHyHX3BpmTDrRlUmVYcDbLMHPylagI0pakQlIBNQVfQ7 er2RsWeI+PIP1m5mIK6T77DVV28seo9dSzy168Y3ZQyhJDbvgPhnBq7pWoHb5E1BCATj KyytuokDjF9YtpDkQPboFRzZy6b8i5Nm6OokcmImf5aRt86v8pTF7iF4ZXbhs/BRh0/a lHR6mQ/p/2+GDYeX8j2uvTtizqm5QA2T638FUzLDyCJArvVZfcEQhcn7ATzvr9dR9p4o UVaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jYetHHY3O0zbeb7xCuNlAFpYJgf23BKNDtT+GM78k8c=; fh=ix8jn3PVSm5TUDO/o9UgVAL1iFAB6CMfEdrwxSFziwQ=; b=jSqHlUtUx+zwtC4SratDHgKUD4Pr86aMACo4Xv0IZ1/IHMFFqZMbTiH1Wt+zsrHz9j JaLSbWMPrUUtEfubKaL+oOb7uy4fllW3fCATbIwf7tHBP2KDlMY1mSnOLTGIvHJQl7cJ DMU/cggFCBmAPGcfdAjXsWrEobpbUS0z652+fD4B8hpMSfb6RNhuEfzR6vAsOl43HubH oNCWZLZes03utHENADlBuNzMEtKdOkUAYxEC/81kbEJkEz2lVF7JXThDRl6R/Vz2gndr o57uu9eUaTx0TP530dqOMWP5EXNwhFK7o44M64GmTaaJT3wDDSiN3q6Z6sxgQ9B/jjJr 7xPA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hB5f1tGo; 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-5bbb2e7011dsi236644a12.625.2024.08.07.20.16.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:16:42 -0700 (PDT) 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=hB5f1tGo; 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 7DAB188B02; Thu, 8 Aug 2024 05:15:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="hB5f1tGo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A51C98890F; Thu, 8 Aug 2024 05:14:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) (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 C0B40888F8 for ; Thu, 8 Aug 2024 05:14:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3db12a2f530so384487b6e.1 for ; Wed, 07 Aug 2024 20:14:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086892; x=1723691692; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jYetHHY3O0zbeb7xCuNlAFpYJgf23BKNDtT+GM78k8c=; b=hB5f1tGoCDNYUGpsrmekbKJ5OQVx8KY9FPDZLzj08L1MXYI9fjR4U+IeTg193SBvUh Wz4Fmab5s7B2tqVkpdGO7VYHjWFBg4ZOVVJ3PYCO3S9EeO/stUZfRvAoh55sYGcQd1zI HJZ4LTqfTEzoIT0HqZUxATLBzlGq9JURI0eYgzCZ3HtZlQW7a+LWvgeKnWGxDgNbuj+k fTMnjucRHw8fZfmcZ3KO909uR89pu+j5S4xctDBNFcr0kLsKwXL+R8UN/+PKAQJRZyGn /V3yt9IB2DLmdXq7KhLKGbiZbCfjSVS1naPQTjrywKrUBXmVi7fgfcCnM6Mw3eaL327l ZgpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086892; x=1723691692; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jYetHHY3O0zbeb7xCuNlAFpYJgf23BKNDtT+GM78k8c=; b=SC3qJsKms4a1wFkl3Tprj9Z5kMt1jsv7urOwnzH5QupXC8oJxsjZKj7S4QV33CyqJI 3tcUAiepkIimwZz93z41kMmxKFqCXCExiH71WzLjm9yaJLWWtnW32I+UB0Rt2R9ecrB+ NP47pCxRaG2LRS1fmjrc4hDBSPewfkDrEYEqbWbj3GOx4cKH245s8amQIllgLUSlYryJ 9/g2sMtP6uOp1AW9SRxS5pGZFFeRw3aDLzqwtr2obFQNj3RrwF5XrOK6gcuEmUkGy0fs qnnaZdeT6N4aM/owCaaFt4S4TuTKsjNqYniWe1XVuWW+OTHHWOpGv9WZcuBjrbY/YmfZ JocA== X-Forwarded-Encrypted: i=1; AJvYcCV/+wni2XD+kyi+97LSSf86QBcQOSDMLJhONdstaJJepd8KtPeFi49ZGNkG3+PszArP/pMdF4ppw/ZhESx/SUL+tucjkQ== X-Gm-Message-State: AOJu0YwpHqwiksIGWmtlEz0kv3zxDpVQ1yAwc+ZMh6P7/iABrS3TTXUb nppYIhYrnU+wh4mmV0mm2078hqXVYtYAzQtnro0UKJX4rzAkrojPtuT8dLDwnQWZM5fbIMZ2Lkq 4zp+j/Q== X-Received: by 2002:a05:6808:2208:b0:3d9:28e5:5865 with SMTP id 5614622812f47-3dc3b4265f6mr693033b6e.21.1723086892455; Wed, 07 Aug 2024 20:14:52 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3db56361a6csm4641755b6e.6.2024.08.07.20.14.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:52 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 10/38] mmc: dw_mmc: Add support for 64-bit IDMAC Date: Wed, 7 Aug 2024 22:14:16 -0500 Message-Id: <20240808031444.9619-11-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Some DW MMC blocks (e.g. those on modern Exynos chips) support 64-bit DMA addressing mode. 64-bit DW MMC variants differ from their 32-bit counterparts: - the register layout is a bit different (because there are additional IDMAC registers present for storing upper part of 64-bit addresses) - DMA descriptor structure is bigger and different from 32-bit one Introduce all necessary changes to enable support for 64-bit DMA capable DW MMC blocks. Next changes were made: 1. Check which DMA address mode is supported in current IP-core version. HCON register (bit 27) indicates whether it's 32-bit or 64-bit addressing. Add boolean .dma_64bit_address field to struct dwmci_host and store the result there. dwmci_init_dma() function is introduced for doing so, which is called on driver's init. 2. Add 64-bit DMA descriptor (struct dwmci_idmac64) and use it in dwmci_prepare_desc() in case if .dma_64bit_address field is true. A new dwmci_set_idma_desc64() function was added for populating that descriptor. 3. Add registers for 64-bit DMA capable blocks. To make the access to IDMAC registers universal between 32-bit / 64-bit cases, a new struct dwmci_idmac_regs (and corresponding host->regs field) was introduced, which abstracts the hardware by being set to appropriate offset constants on init. All direct calls to IDMAC registers were correspondingly replaced by accessing host->regs. 4. Allocate and use 64-bit DMA descriptors buffer in case when IDMAC is 64-bit capable. Extract all the code (except for the IDMAC descriptors buffer allocation) from dwmci_send_cmd() to dwmci_send_cmd_common(), so that it's possible to keep IDMAC buffer (either 32-bit or 64-bit) on stack during send_cmd routine. The insights for this implementation were taken from Linux kernel DW MMC driver. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - Replaced CONFIG_IS_ENABLED() with #ifdef drivers/mmc/dw_mmc.c | 152 ++++++++++++++++++++++++++++++++++--------- include/dwmmc.h | 39 ++++++++++- 2 files changed, 160 insertions(+), 31 deletions(-) diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index 3e7073f7de1b..55eb8a54f594 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -28,6 +28,39 @@ struct dwmci_idmac32 { u32 des3; /* Next descriptor physical address */ } __aligned(ARCH_DMA_MINALIGN); +/* Internal DMA Controller (IDMAC) descriptor for 64-bit addressing mode */ +struct dwmci_idmac64 { + u32 des0; /* Control descriptor */ + u32 des1; /* Reserved */ + u32 des2; /* Buffer sizes */ + u32 des3; /* Reserved */ + u32 des4; /* Lower 32-bits of Buffer Address Pointer 1 */ + u32 des5; /* Upper 32-bits of Buffer Address Pointer 1 */ + u32 des6; /* Lower 32-bits of Next Descriptor Address */ + u32 des7; /* Upper 32-bits of Next Descriptor Address */ +} __aligned(ARCH_DMA_MINALIGN); + +/* Register offsets for DW MMC blocks with 32-bit IDMAC */ +static const struct dwmci_idmac_regs dwmci_idmac_regs32 = { + .dbaddrl = DWMCI_DBADDR, + .idsts = DWMCI_IDSTS, + .idinten = DWMCI_IDINTEN, + .dscaddrl = DWMCI_DSCADDR, + .bufaddrl = DWMCI_BUFADDR, +}; + +/* Register offsets for DW MMC blocks with 64-bit IDMAC */ +static const struct dwmci_idmac_regs dwmci_idmac_regs64 = { + .dbaddrl = DWMCI_DBADDRL, + .dbaddru = DWMCI_DBADDRU, + .idsts = DWMCI_IDSTS64, + .idinten = DWMCI_IDINTEN64, + .dscaddrl = DWMCI_DSCADDRL, + .dscaddru = DWMCI_DSCADDRU, + .bufaddrl = DWMCI_BUFADDRL, + .bufaddru = DWMCI_BUFADDRU, +}; + static int dwmci_wait_reset(struct dwmci_host *host, u32 value) { unsigned long timeout = 1000; @@ -55,11 +88,27 @@ static void dwmci_set_idma_desc32(struct dwmci_idmac32 *desc, u32 control, desc->des3 = next_desc_phys; } -static void dwmci_prepare_desc(struct mmc_data *data, - struct dwmci_idmac32 *cur_idmac, - void *bounce_buffer) +static void dwmci_set_idma_desc64(struct dwmci_idmac64 *desc, u32 control, + u32 buf_size, u64 buf_addr) +{ + phys_addr_t desc_phys = virt_to_phys(desc); + u64 next_desc_phys = desc_phys + sizeof(struct dwmci_idmac64); + + desc->des0 = control; + desc->des1 = 0; + desc->des2 = buf_size; + desc->des3 = 0; + desc->des4 = buf_addr & 0xffffffff; + desc->des5 = buf_addr >> 32; + desc->des6 = next_desc_phys & 0xffffffff; + desc->des7 = next_desc_phys >> 32; +} + +static void dwmci_prepare_desc(struct dwmci_host *host, struct mmc_data *data, + void *cur_idmac, void *bounce_buffer) { struct dwmci_idmac32 *desc32 = cur_idmac; + struct dwmci_idmac64 *desc64 = cur_idmac; ulong data_start, data_end; unsigned int blk_cnt, i; @@ -79,34 +128,47 @@ static void dwmci_prepare_desc(struct mmc_data *data, } else cnt = data->blocksize * 8; - dwmci_set_idma_desc32(desc32, flags, cnt, - buf_phys + i * PAGE_SIZE); - desc32++; + if (host->dma_64bit_address) { + dwmci_set_idma_desc64(desc64, flags, cnt, + buf_phys + i * PAGE_SIZE); + desc64++; + } else { + dwmci_set_idma_desc32(desc32, flags, cnt, + buf_phys + i * PAGE_SIZE); + desc32++; + } if (blk_cnt <= 8) break; blk_cnt -= 8; } - data_end = (ulong)desc32; + if (host->dma_64bit_address) + data_end = (ulong)desc64; + else + data_end = (ulong)desc32; flush_dcache_range(data_start, roundup(data_end, ARCH_DMA_MINALIGN)); } static void dwmci_prepare_data(struct dwmci_host *host, struct mmc_data *data, - struct dwmci_idmac32 *cur_idmac, + void *cur_idmac, void *bounce_buffer) { + const u32 idmacl = virt_to_phys(cur_idmac) & 0xffffffff; + const u32 idmacu = (u64)virt_to_phys(cur_idmac) >> 32; unsigned long ctrl; dwmci_wait_reset(host, DWMCI_CTRL_FIFO_RESET); /* Clear IDMAC interrupt */ - dwmci_writel(host, DWMCI_IDSTS, 0xFFFFFFFF); + dwmci_writel(host, host->regs->idsts, 0xffffffff); - dwmci_writel(host, DWMCI_DBADDR, (ulong)cur_idmac); + dwmci_writel(host, host->regs->dbaddrl, idmacl); + if (host->dma_64bit_address) + dwmci_writel(host, host->regs->dbaddru, idmacu); - dwmci_prepare_desc(data, cur_idmac, bounce_buffer); + dwmci_prepare_desc(host, data, cur_idmac, bounce_buffer); ctrl = dwmci_readl(host, DWMCI_CTRL); ctrl |= DWMCI_IDMAC_EN | DWMCI_DMA_EN; @@ -257,13 +319,13 @@ static int dwmci_dma_transfer(struct dwmci_host *host, uint flags, else mask = DWMCI_IDINTEN_TI; - ret = wait_for_bit_le32(host->ioaddr + DWMCI_IDSTS, + ret = wait_for_bit_le32(host->ioaddr + host->regs->idsts, mask, true, 1000, false); if (ret) debug("%s: DWMCI_IDINTEN mask 0x%x timeout\n", __func__, mask); /* Clear interrupts */ - dwmci_writel(host, DWMCI_IDSTS, DWMCI_IDINTEN_MASK); + dwmci_writel(host, host->regs->idsts, DWMCI_IDINTEN_MASK); ctrl = dwmci_readl(host, DWMCI_CTRL); ctrl &= ~DWMCI_DMA_EN; @@ -300,20 +362,10 @@ static void dwmci_wait_while_busy(struct dwmci_host *host, struct mmc_cmd *cmd) } } -#ifdef CONFIG_DM_MMC -static int dwmci_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, - struct mmc_data *data) +static int dwmci_send_cmd_common(struct dwmci_host *host, struct mmc_cmd *cmd, + struct mmc_data *data, void *cur_idmac) { - struct mmc *mmc = mmc_get_mmc_dev(dev); -#else -static int dwmci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, - struct mmc_data *data) -{ -#endif - struct dwmci_host *host = mmc->priv; - ALLOC_CACHE_ALIGN_BUFFER(struct dwmci_idmac32, cur_idmac, - data ? DIV_ROUND_UP(data->blocks, 8) : 0); - int ret = 0, flags = 0, i; + int ret, flags = 0, i; u32 retry = 100000; u32 mask; struct bounce_buffer bbstate; @@ -432,6 +484,28 @@ static int dwmci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, return ret; } +#ifdef CONFIG_DM_MMC +static int dwmci_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, + struct mmc_data *data) +{ + struct mmc *mmc = mmc_get_mmc_dev(dev); +#else +static int dwmci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, + struct mmc_data *data) +{ +#endif + struct dwmci_host *host = mmc->priv; + const size_t buf_size = data ? DIV_ROUND_UP(data->blocks, 8) : 0; + + if (host->dma_64bit_address) { + ALLOC_CACHE_ALIGN_BUFFER(struct dwmci_idmac64, idmac, buf_size); + return dwmci_send_cmd_common(host, cmd, data, idmac); + } else { + ALLOC_CACHE_ALIGN_BUFFER(struct dwmci_idmac32, idmac, buf_size); + return dwmci_send_cmd_common(host, cmd, data, idmac); + } +} + static int dwmci_control_clken(struct dwmci_host *host, bool on) { const u32 val = on ? DWMCI_CLKEN_ENABLE | DWMCI_CLKEN_LOW_PWR : 0; @@ -593,6 +667,27 @@ static void dwmci_init_fifo(struct dwmci_host *host) dwmci_writel(host, DWMCI_FIFOTH, host->fifoth_val); } +static void dwmci_init_dma(struct dwmci_host *host) +{ + int addr_config; + + if (host->fifo_mode) + return; + + addr_config = (dwmci_readl(host, DWMCI_HCON) >> 27) & 0x1; + if (addr_config == 1) { + host->dma_64bit_address = true; + host->regs = &dwmci_idmac_regs64; + debug("%s: IDMAC supports 64-bit address mode\n", __func__); + } else { + host->dma_64bit_address = false; + host->regs = &dwmci_idmac_regs32; + debug("%s: IDMAC supports 32-bit address mode\n", __func__); + } + + dwmci_writel(host, host->regs->idinten, DWMCI_IDINTEN_MASK); +} + static int dwmci_init(struct mmc *mmc) { struct dwmci_host *host = mmc->priv; @@ -615,16 +710,13 @@ static int dwmci_init(struct mmc *mmc) dwmci_writel(host, DWMCI_TMOUT, 0xFFFFFFFF); - dwmci_writel(host, DWMCI_IDINTEN, 0); dwmci_writel(host, DWMCI_BMOD, 1); dwmci_init_fifo(host); + dwmci_init_dma(host); dwmci_writel(host, DWMCI_CLKENA, 0); dwmci_writel(host, DWMCI_CLKSRC, 0); - if (!host->fifo_mode) - dwmci_writel(host, DWMCI_IDINTEN, DWMCI_IDINTEN_MASK); - return 0; } diff --git a/include/dwmmc.h b/include/dwmmc.h index 7e4acf096dce..de18fda68ac8 100644 --- a/include/dwmmc.h +++ b/include/dwmmc.h @@ -44,12 +44,22 @@ #define DWMCI_UHS_REG 0x074 #define DWMCI_BMOD 0x080 #define DWMCI_PLDMND 0x084 +#define DWMCI_DATA 0x200 +/* Registers to support IDMAC 32-bit address mode */ #define DWMCI_DBADDR 0x088 #define DWMCI_IDSTS 0x08C #define DWMCI_IDINTEN 0x090 #define DWMCI_DSCADDR 0x094 #define DWMCI_BUFADDR 0x098 -#define DWMCI_DATA 0x200 +/* Registers to support IDMAC 64-bit address mode */ +#define DWMCI_DBADDRL 0x088 +#define DWMCI_DBADDRU 0x08c +#define DWMCI_IDSTS64 0x090 +#define DWMCI_IDINTEN64 0x094 +#define DWMCI_DSCADDRL 0x098 +#define DWMCI_DSCADDRU 0x09c +#define DWMCI_BUFADDRL 0x0a0 +#define DWMCI_BUFADDRU 0x0a4 /* Interrupt Mask register */ #define DWMCI_INTMSK_ALL 0xffffffff @@ -142,6 +152,29 @@ /* quirks */ #define DWMCI_QUIRK_DISABLE_SMU (1 << 0) +/** + * struct dwmci_idmac_regs - Offsets of IDMAC registers + * + * @dbaddrl: Descriptor base address, lower 32 bits + * @dbaddru: Descriptor base address, upper 32 bits + * @idsts: Internal DMA status + * @idinten: Internal DMA interrupt enable + * @dscaddrl: IDMAC descriptor address, lower 32 bits + * @dscaddru: IDMAC descriptor address, upper 32 bits + * @bufaddrl: Current data buffer address, lower 32 bits + * @bufaddru: Current data buffer address, upper 32 bits + */ +struct dwmci_idmac_regs { + u32 dbaddrl; + u32 dbaddru; + u32 idsts; + u32 idinten; + u32 dscaddrl; + u32 dscaddru; + u32 bufaddrl; + u32 bufaddru; +}; + /** * struct dwmci_host - Information about a designware MMC host * @@ -157,6 +190,8 @@ * @fifoth_val: Value for FIFOTH register (or 0 to leave unset) * @mmc: Pointer to generic MMC structure for this device * @priv: Private pointer for use by controller + * @dma_64bit_address: Whether DMA supports 64-bit address mode or not + * @regs: Registers that can vary for different DW MMC block versions */ struct dwmci_host { const char *name; @@ -196,6 +231,8 @@ struct dwmci_host { /* use fifo mode to read and write data */ bool fifo_mode; + bool dma_64bit_address; + const struct dwmci_idmac_regs *regs; }; static inline void dwmci_writel(struct dwmci_host *host, int reg, u32 val) From patchwork Thu Aug 8 03:14:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817675 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675028wrt; Wed, 7 Aug 2024 20:16:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUVr2O0lVB1XUKiQrDQvNOw89JdHE2mUcV7WXQV5TcrUzoiNEn4sDwYAvoI3j3uIwoypj1rQm8ZKRapS1OuqZIJ X-Google-Smtp-Source: AGHT+IFh4C9muZmE/M+kgzgqIwooluZErE2IVQsh9/MBtC5H8eNxuLo/p7FttkQGmhFZrUk8qrqs X-Received: by 2002:a05:6512:39d2:b0:52e:f2e8:1646 with SMTP id 2adb3069b0e04-530e589b68amr261053e87.58.1723087013100; Wed, 07 Aug 2024 20:16:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087013; cv=none; d=google.com; s=arc-20160816; b=WfY7QPwkymodZm18oiP5HKq+lDvgOBAbGQCSOOm7Wm9dyJg6Upkuoa51VhYM/S2iQR YbNta+NIbUKHX0owGMPdLJAcQpPXTkd/IzoW7zMoCbty8BpmNBZ7/6ci9hVLqU23FML5 UPCCtehQPKaI+d6AN0UTe+QyFfC10rtKRDLFIFub+qMI2X96F6IBFuddCtHrTQWZjRCq j4hrul4gMeHswyUBLIjHBGL9cOIDXjGqTvy7XyDsoPeIS6zrv0iEcha9m1tBR5Khqske wG3/3aKUVBTVsim3q9ukPlm19zB9ENvt5sJ2oNWwG5zQ3SRb9DtCxVmLSfiaS8RvCEDv diow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1IHEydZhumGORVNXMzY5xGUJhKsQksqQtA2zgg/imTQ=; fh=5VtPN9yIj9BnidV+bpgFjP/nsITage5HJOdqxjvIzc4=; b=aeF9CPCnYmrWmxXIlzL4UFuFs4uSuJhyw4u1sqk9MIXttmdLiMWbWRgtR+Sj+A84SX w7cjSQnHnOhGUxSUQVBHveMXwiS+FP53MUJS8nz46RXK6hIUhznyb2pkqJSIg7BN2li4 3hPJ3RMrnqx5pKzYiKvziOv5rSHjsykQ+rl8wJNo6xAqfyvSosldk/7Gh48eone6zJMX 5zszweSyl6Qj9yihX0JZ0u9f0OyWdrDqfdqIrROWc2YjXIVX/BUyHl7bD8KD4aHCeWuC 1GfPxkVWUgHDP4v0CugjR4Z9hXNRI9+sfTZkkGbj0+h/YUtASml+BsCc92M62/Re10fU kInQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ew/wuuxy"; 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-a7dc9c22edasi758810366b.242.2024.08.07.20.16.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:16:53 -0700 (PDT) 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="ew/wuuxy"; 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 4EBF788AE0; Thu, 8 Aug 2024 05:15:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ew/wuuxy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 15CBF88A6E; Thu, 8 Aug 2024 05:14:57 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) (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 6BC8288A6D for ; Thu, 8 Aug 2024 05:14:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oi1-x233.google.com with SMTP id 5614622812f47-3db51b8ec15so746984b6e.1 for ; Wed, 07 Aug 2024 20:14:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086893; x=1723691693; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1IHEydZhumGORVNXMzY5xGUJhKsQksqQtA2zgg/imTQ=; b=ew/wuuxy8lEUmBsqeKdxcsltjt2TO2RlaQKlToDAm+djZO+tWkeKJNoomv+fGn2ll0 WPDKv5MvhAYGic4jEUho6ob9A/upQtEKvYURiUdW2WHtw1ifLDLIQmkdbnHg9qBcDcRN 7w6Em6vr37Xwr1M5xnYgT7teBfR6CP2SgkqnzBB4u+xY1l/kLI7D6Nv9UrH2tkDWsdzd cROpbW3VK132chjrJqi8l4xdsApFm4CEtGhbUHHDALk/OS++qJ9wBIlDpdlRdvS4mCHA ogdwASvWWCGNqpGRk37vqRNEEsCz0Ji4uGMrhhd5O5qnNVacCgkxQHGP0OP9IpU1z5sh WpSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086893; x=1723691693; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1IHEydZhumGORVNXMzY5xGUJhKsQksqQtA2zgg/imTQ=; b=Usa+mnEPxe/Xp+BTR21M10qHm5HFg44IsXYd20o1Kkai5/PTwGak0obmhcyYiCuhhf q1E4ZEPzdpz15e0IQ+exwWgNnGwHfqmM2bsiB5i5HnDdBRCIdjzUou2uaOyaGC5lg2qY NxpOv3Qa6wezhN6tRpoC/gH2ewcxHTZKqPKzNE4B9AhIPaBkTdMeU4RH9bw/izBuF4N5 j037o+wnDaVqwY2yRQ3EPLJCN43+c/dhaFvHSEhzxH08RH8zRktFg7QLf2fXMiO5IL0I P2KcCklYdUuPVq3B3mu9nMkJ4NXQizm+m5afOFvy7keIz/4Sj0kqrN4v6nHKhRGZK9SO I8kQ== X-Forwarded-Encrypted: i=1; AJvYcCWJpi8fwc68W2oo+2fOVnCr5GGFuUiakzd48n2Z6EPB99OtLMOsHbepBFzgWeI/iOPpod8J0iBa8Q9FGBzJvceeT0utbQ== X-Gm-Message-State: AOJu0YzhEzuCnGiwafEHqJEBuUlNQ+cBTSJCFh8NwOQKdm+LkxKfELDT ikPAQUsefXb9qV4QaLnkoYuhoZqW/kQtns92IB+f1cw+O5mdkA+A5+G3dE6B2Qc= X-Received: by 2002:a05:6808:13d6:b0:3d6:2bab:16ca with SMTP id 5614622812f47-3dc3c184e05mr138271b6e.13.1723086893177; Wed, 07 Aug 2024 20:14:53 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3db56370f62sm4608381b6e.15.2024.08.07.20.14.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:52 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 11/38] mmc: dw_mmc: Replace fifoth_val property with fifo-depth Date: Wed, 7 Aug 2024 22:14:17 -0500 Message-Id: <20240808031444.9619-12-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Replace fifoth_val property with its fifo-depth counterpart in all DW MMC drivers. fifo-depth is a common property used in upstream Linux kernel. The FIFOTH register value will be calculated using fifo-depth value in DW MMC core (dw_mmc.c). This change reduces code duplication in platform drivers, and pulls common FIFOTH register value calculation into core dw_mmc driver where it belongs. No functional change. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) drivers/mmc/dw_mmc.c | 21 +++++++++++++-------- drivers/mmc/exynos_dw_mmc.c | 10 +++++----- drivers/mmc/ftsdc010_mci.h | 1 - drivers/mmc/hi6220_dw_mmc.c | 7 +++---- drivers/mmc/nexell_dw_mmc.c | 5 +---- drivers/mmc/rockchip_dw_mmc.c | 5 +---- drivers/mmc/snps_dw_mmc.c | 6 ++---- drivers/mmc/socfpga_dw_mmc.c | 4 ++-- include/dwmmc.h | 4 ++-- 9 files changed, 29 insertions(+), 34 deletions(-) diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index 55eb8a54f594..47dcc37c2c7c 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -218,8 +218,6 @@ static unsigned int dwmci_get_timeout(struct mmc *mmc, const unsigned int size) static int dwmci_data_transfer_fifo(struct dwmci_host *host, struct mmc_data *data, u32 mask) { - const u32 fifo_depth = (((host->fifoth_val & RX_WMARK_MASK) >> - RX_WMARK_SHIFT) + 1) * 2; const u32 int_rx = mask & (DWMCI_INTMSK_RXDR | DWMCI_INTMSK_DTO); const u32 int_tx = mask & DWMCI_INTMSK_TXDR; int ret = 0; @@ -254,8 +252,8 @@ static int dwmci_data_transfer_fifo(struct dwmci_host *host, if (ret < 0) break; - len = fifo_depth - ((len >> DWMCI_FIFO_SHIFT) & - DWMCI_FIFO_MASK); + len = host->fifo_depth - ((len >> DWMCI_FIFO_SHIFT) & + DWMCI_FIFO_MASK); len = min(size, len); for (i = 0; i < len; i++) dwmci_writel(host, DWMCI_DATA, *buf++); @@ -655,16 +653,23 @@ static int dwmci_set_ios(struct mmc *mmc) static void dwmci_init_fifo(struct dwmci_host *host) { - if (!host->fifoth_val) { + u32 fifo_thr, fifoth_val; + + if (!host->fifo_depth) { u32 fifo_size; + /* + * Automatically detect FIFO depth from FIFOTH register. + * Power-on value of RX_WMark is FIFO_DEPTH-1. + */ fifo_size = dwmci_readl(host, DWMCI_FIFOTH); fifo_size = ((fifo_size & RX_WMARK_MASK) >> RX_WMARK_SHIFT) + 1; - host->fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size / 2 - 1) | - TX_WMARK(fifo_size / 2); + host->fifo_depth = fifo_size; } - dwmci_writel(host, DWMCI_FIFOTH, host->fifoth_val); + fifo_thr = host->fifo_depth / 2; + fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_thr - 1) | TX_WMARK(fifo_thr); + dwmci_writel(host, DWMCI_FIFOTH, fifoth_val); } static void dwmci_init_dma(struct dwmci_host *host) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index a51f762988da..377c9e6d90b9 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -150,8 +150,8 @@ static int do_dwmci_init(struct dwmci_host *host) return exynos_dwmci_core_init(host); } -static int exynos_dwmci_get_config(const void *blob, int node, - struct dwmci_host *host, +static int exynos_dwmci_get_config(struct udevice *dev, const void *blob, + int node, struct dwmci_host *host, struct dwmci_exynos_priv_data *priv) { int err = 0; @@ -200,7 +200,7 @@ static int exynos_dwmci_get_config(const void *blob, int node, priv->sdr_timing = DWMMC_MMC2_SDR_TIMING_VAL; } - host->fifoth_val = fdtdec_get_int(blob, node, "fifoth_val", 0); + host->fifo_depth = dev_read_u32_default(dev, "fifo-depth", 0); host->bus_hz = fdtdec_get_int(blob, node, "bus_hz", 0); host->div = fdtdec_get_int(blob, node, "div", 0); @@ -216,8 +216,8 @@ static int exynos_dwmmc_probe(struct udevice *dev) struct dwmci_host *host = &priv->host; int err; - err = exynos_dwmci_get_config(gd->fdt_blob, dev_of_offset(dev), host, - priv); + err = exynos_dwmci_get_config(dev, gd->fdt_blob, dev_of_offset(dev), + host, priv); if (err) return err; err = do_dwmci_init(host); diff --git a/drivers/mmc/ftsdc010_mci.h b/drivers/mmc/ftsdc010_mci.h index 782d92be2f5f..36187cfa04f6 100644 --- a/drivers/mmc/ftsdc010_mci.h +++ b/drivers/mmc/ftsdc010_mci.h @@ -28,7 +28,6 @@ struct ftsdc010_chip { int dev_index; int dev_id; int buswidth; - u32 fifoth_val; struct mmc *mmc; void *priv; bool fifo_mode; diff --git a/drivers/mmc/hi6220_dw_mmc.c b/drivers/mmc/hi6220_dw_mmc.c index c68a9157bfcc..0302f5c296b9 100644 --- a/drivers/mmc/hi6220_dw_mmc.c +++ b/drivers/mmc/hi6220_dw_mmc.c @@ -36,7 +36,7 @@ struct hi6220_dwmmc_priv_data { struct hisi_mmc_data { unsigned int clock; bool use_fifo; - u32 fifoth_val; + u32 fifo_depth; }; static int hi6220_dwmmc_of_to_plat(struct udevice *dev) @@ -125,7 +125,7 @@ static int hi6220_dwmmc_probe(struct udevice *dev) host->mmc = &plat->mmc; host->fifo_mode = mmc_data->use_fifo; - host->fifoth_val = mmc_data->fifoth_val; + host->fifo_depth = mmc_data->fifo_depth; host->mmc->priv = &priv->host; upriv->mmc = host->mmc; host->mmc->dev = dev; @@ -158,8 +158,7 @@ static const struct hisi_mmc_data hi6220_mmc_data = { static const struct hisi_mmc_data hi3798mv2x_mmc_data = { .clock = 50000000, .use_fifo = false, - // FIFO depth is 256 - .fifoth_val = MSIZE(4) | RX_WMARK(0x7f) | TX_WMARK(0x80), + .fifo_depth = 256, }; static const struct udevice_id hi6220_dwmmc_ids[] = { diff --git a/drivers/mmc/nexell_dw_mmc.c b/drivers/mmc/nexell_dw_mmc.c index 2e1ce54c7d50..80df617e07e9 100644 --- a/drivers/mmc/nexell_dw_mmc.c +++ b/drivers/mmc/nexell_dw_mmc.c @@ -186,10 +186,7 @@ static int nexell_dwmmc_probe(struct udevice *dev) struct dwmci_host *host = &priv->host; struct udevice *pwr_dev __maybe_unused; - host->fifoth_val = MSIZE(0x2) | - RX_WMARK(priv->fifo_size / 2 - 1) | - TX_WMARK(priv->fifo_size / 2); - + host->fifo_depth = priv->fifo_size; host->fifo_mode = priv->fifo_mode; dwmci_setup_cfg(&plat->cfg, host, priv->max_freq, priv->min_freq); diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c index 1a10b7057a47..b2a46a95481c 100644 --- a/drivers/mmc/rockchip_dw_mmc.c +++ b/drivers/mmc/rockchip_dw_mmc.c @@ -138,10 +138,7 @@ static int rockchip_dwmmc_probe(struct udevice *dev) if (ret < 0) return ret; #endif - host->fifoth_val = MSIZE(0x2) | - RX_WMARK(priv->fifo_depth / 2 - 1) | - TX_WMARK(priv->fifo_depth / 2); - + host->fifo_depth = priv->fifo_depth; host->fifo_mode = priv->fifo_mode; #if CONFIG_IS_ENABLED(MMC_PWRSEQ) diff --git a/drivers/mmc/snps_dw_mmc.c b/drivers/mmc/snps_dw_mmc.c index 9bdbe5070b1d..f30331e51f7e 100644 --- a/drivers/mmc/snps_dw_mmc.c +++ b/drivers/mmc/snps_dw_mmc.c @@ -81,7 +81,7 @@ static int snps_dwmmc_of_to_plat(struct udevice *dev) host->ioaddr = dev_read_addr_ptr(dev); /* - * If fifo-depth is unset don't set fifoth_val - we will try to + * If fifo-depth is unset don't set fifo_depth - we will try to * auto detect it. */ ret = dev_read_u32(dev, "fifo-depth", &fifo_depth); @@ -89,9 +89,7 @@ static int snps_dwmmc_of_to_plat(struct udevice *dev) if (fifo_depth < FIFO_MIN || fifo_depth > FIFO_MAX) return -EINVAL; - host->fifoth_val = MSIZE(0x2) | - RX_WMARK(fifo_depth / 2 - 1) | - TX_WMARK(fifo_depth / 2); + host->fifo_depth = fifo_depth; } host->buswidth = dev_read_u32_default(dev, "bus-width", 4); diff --git a/drivers/mmc/socfpga_dw_mmc.c b/drivers/mmc/socfpga_dw_mmc.c index f738019b8357..3147d3019c0a 100644 --- a/drivers/mmc/socfpga_dw_mmc.c +++ b/drivers/mmc/socfpga_dw_mmc.c @@ -134,8 +134,8 @@ static int socfpga_dwmmc_of_to_plat(struct udevice *dev) * We only have one dwmmc block on gen5 SoCFPGA. */ host->dev_index = 0; - host->fifoth_val = MSIZE(0x2) | - RX_WMARK(fifo_depth / 2 - 1) | TX_WMARK(fifo_depth / 2); + + host->fifo_depth = fifo_depth; priv->drvsel = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev), "drvsel", 3); priv->smplsel = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev), diff --git a/include/dwmmc.h b/include/dwmmc.h index de18fda68ac8..7bb456e792b4 100644 --- a/include/dwmmc.h +++ b/include/dwmmc.h @@ -187,7 +187,7 @@ struct dwmci_idmac_regs { * @dev_index: Arbitrary device index for use by controller * @dev_id: Arbitrary device ID for use by controller * @buswidth: Bus width in bits (8 or 4) - * @fifoth_val: Value for FIFOTH register (or 0 to leave unset) + * @fifo_depth: Depth of FIFO, bytes (or 0 for automatic detection) * @mmc: Pointer to generic MMC structure for this device * @priv: Private pointer for use by controller * @dma_64bit_address: Whether DMA supports 64-bit address mode or not @@ -204,7 +204,7 @@ struct dwmci_host { int dev_index; int dev_id; int buswidth; - u32 fifoth_val; + u32 fifo_depth; struct mmc *mmc; void *priv; From patchwork Thu Aug 8 03:14:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817676 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675069wrt; Wed, 7 Aug 2024 20:17:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUjDT2BGPNBF5DPgJr028JhQSKzF3jDuUGyDS6iWumY2CibcUe+xdb3wGKuT8KvQsMfkYOCLnpSJBIw1Tl+r1we X-Google-Smtp-Source: AGHT+IEsw2znWNbqrYILPs3S8B2OS/40/HdW8l+WcNa5PrVeQyBkDdZIFFqw6HgqnF4whzdB4gDq X-Received: by 2002:a17:907:e61c:b0:a7a:a06b:eecd with SMTP id a640c23a62f3a-a8090bebcd4mr29741866b.5.1723087025558; Wed, 07 Aug 2024 20:17:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087025; cv=none; d=google.com; s=arc-20160816; b=W6SP13VSrOHgsu3P7uLxf8IUabtCTWto0/wqVpdWUXjSYOB7ylZ/brJpIIUUezTuVs gQR2d2e4PoUFrUBxsfvVNe6GR0mgsXcaedyRhSju3qTd1l0ZpgjqAbLI2oFHSCMSpaZx 6lgN6ymYPV670ej8xeKWn5dRyWYD6Dosctu3PQi0yyr33e7lSpohnCOdXkzqNfI1cVSF wCl/6qPx7f7KsNSHvrAVCwbSocJ9HgEendfbzfc2Mbu37KWwFtpwPsiOu2TV8l0LFmfC 6dlpp72bvWLagnBCpyPc6roDAIbskgv/QlUZtvvVkftDr13/fJDO5/dHSdXKdsLbfq3X i7fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Vfc42k2rGmzaMHGyVMMMb8hxPUv2/prCKnyN6JqV2UQ=; fh=cG0vsP5cKuqWrCH7g8zUmjy1wqXvZ+BBzSSbEZYzncs=; b=ccbGsevRet5Izrux4qJpXiCThsqzb1TKwam4yRHQFdcpB26OnYp5+ZjIDd7/0rNvuj IxsTUSX1ge/1NkZZd9IWqENapIERv739xowDKbn4GIUKt7qQJ3q2+BXBpqYwAjR7AR/6 ASgJqHYQfazBYZZ+jUrn6J64dlubZsm4UvJE8kE6Fb7IRmFljkA0wy2AQkJl2HCybQTL FeCfGEwV7MTdmy2cUJxLMu2XSQEN7AMofhCcmj54EGZydI0Ti+inZOUhs3J+fCqXLwWa 1I3+PsWESHQEB+s9vIXKExwAqA9iVJoFZ2JfT4VS/IPZq6Jm+Jgl+hO9FF0s1xOtu+wK 2dVQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MhdGZVSU; 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-a7dc9ea71f0si736242866b.508.2024.08.07.20.17.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:17:05 -0700 (PDT) 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=MhdGZVSU; 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 09D3B88B21; Thu, 8 Aug 2024 05:15:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="MhdGZVSU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6EDD688A7A; Thu, 8 Aug 2024 05:14:57 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc2b.google.com (mail-oo1-xc2b.google.com [IPv6:2607:f8b0:4864:20::c2b]) (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 26F03889EF for ; Thu, 8 Aug 2024 05:14:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-5d5af743b8fso301903eaf.3 for ; Wed, 07 Aug 2024 20:14:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086894; x=1723691694; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Vfc42k2rGmzaMHGyVMMMb8hxPUv2/prCKnyN6JqV2UQ=; b=MhdGZVSU1+OeEVgLlaUHejIfbYCGCmydIRPHsCmTR3lNFFcAbKN19Jr75tiU9Gy65q T914ThaG/ZQOC8KUreT5P3vpND75Azlw0SvKJJxo1ydKbrbkSopPS9povOCUABqhGFJG icOF1ipYeySqyh5/EQxAuXhgtvoJf+u1IE5vtMwdw3udB5aOp+ENPDX4ooz4llTBTNOC HaiupAwIikiZkcTgVCcQpzfdKWRt0XkIkzHOv0+wKj8W1lDKkS32kjbILC3WZoEZzDpU kBRhJQV++FTN41AHLPfetKUJx3gbv9By/vOcG2/dcqFJHxrmJVdcCIaP6bYlqGA8e0SA aMeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086894; x=1723691694; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Vfc42k2rGmzaMHGyVMMMb8hxPUv2/prCKnyN6JqV2UQ=; b=PEospr/AoxBqw++zsPhwqqKeVTEenanSj6GH8BMwgx6v1VndwDvHxoNwefRVdHiqGs dUwaneyT7J8KEXcab7S5eEOUyUb1BnrKAbEa318u07w5wh2VLgEquU189ousFy6h1mRq 91m4uAxOBZYzd9d5SU5+3i6/O/KbzH0t/9lDvWrNmvgE8zWMNoIotPHo85aieG3SqAN9 d3+EgCoU3+VVyNt7EhfYCTZ+pvz59jIqv6szz5z/DeK6ysOfrchPkK+L3wColfG7DmDc Og1BeAFlhgu290pHrHxLrPBBPe0c7y76sIA1WVM2cQyxjvNS0BAyFx3wHJvAQjkLC6Bo IB7Q== X-Forwarded-Encrypted: i=1; AJvYcCV4mMDIlirTIK68py5HOD0Wftu4/Opbi9uMQ4AT3v0jJQ14t88FoM5Fo5pHGXuuQJ+0q7pq/WYgAcemvIBt8oYyOcFCOA== X-Gm-Message-State: AOJu0YybLKdz97Ql7mmRIF6u+q5WzFRfnUwewz8mW8uTWXt0S58D6SFn jKYKmgwF/8/0h0Vlj5HPaoPRO+Al5rrt9akiUie3Vw7DtLtl0iwlN4tJ9Vl8OOA= X-Received: by 2002:a05:6820:2015:b0:5d8:4845:1a4e with SMTP id 006d021491bc7-5d855757b7cmr955476eaf.0.1723086893865; Wed, 07 Aug 2024 20:14:53 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5d7625e9b97sm3557272eaf.34.2024.08.07.20.14.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:53 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 12/38] mmc: dw_mmc: Fix kernel-doc comments in dwmmc.h Date: Wed, 7 Aug 2024 22:14:18 -0500 Message-Id: <20240808031444.9619-13-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Rework kernel-doc comments in dwmmc.h header so it's actually possible to generate a proper documentation from it usin scripts/kernel-doc script, with no errors. No functional change. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) include/dwmmc.h | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/include/dwmmc.h b/include/dwmmc.h index 7bb456e792b4..77c8989148a1 100644 --- a/include/dwmmc.h +++ b/include/dwmmc.h @@ -182,6 +182,7 @@ struct dwmci_idmac_regs { * @ioaddr: Base I/O address of controller * @quirks: Quick flags - see DWMCI_QUIRK_... * @caps: Capabilities - see MMC_MODE_... + * @clock: Current clock frequency (after internal divider), Hz * @bus_hz: Bus speed in Hz, if @get_mmc_clk() is NULL * @div: Arbitrary clock divider value for use by controller * @dev_index: Arbitrary device index for use by controller @@ -190,6 +191,10 @@ struct dwmci_idmac_regs { * @fifo_depth: Depth of FIFO, bytes (or 0 for automatic detection) * @mmc: Pointer to generic MMC structure for this device * @priv: Private pointer for use by controller + * @clksel: (Optional) Platform function to run when speed/width is changed + * @board_init: (Optional) Platform function to run on init + * @cfg: Internal MMC configuration, for !CONFIG_BLK cases + * @fifo_mode: Use FIFO mode (not DMA) to read and write data * @dma_64bit_address: Whether DMA supports 64-bit address mode or not * @regs: Registers that can vary for different DW MMC block versions */ @@ -210,9 +215,12 @@ struct dwmci_host { int (*clksel)(struct dwmci_host *host); void (*board_init)(struct dwmci_host *host); - /** - * Get / set a particular MMC clock frequency + * @get_mmc_clk: (Optional) Platform function to get/set a particular + * MMC clock frequency + * + * @host: DWMMC host + * @freq: Frequency the host is trying to achieve * * This is used to request the current clock frequency of the clock * that drives the DWMMC peripheral. The caller will then use this @@ -220,16 +228,12 @@ struct dwmci_host { * required MMC bus clock frequency. If you want to handle the * clock external to DWMMC, use @freq to select the frequency and * return that value too. Then DWMMC will put itself in bypass mode. - * - * @host: DWMMC host - * @freq: Frequency the host is trying to achieve */ unsigned int (*get_mmc_clk)(struct dwmci_host *host, uint freq); #ifndef CONFIG_BLK struct mmc_config cfg; #endif - /* use fifo mode to read and write data */ bool fifo_mode; bool dma_64bit_address; const struct dwmci_idmac_regs *regs; @@ -267,6 +271,10 @@ static inline u8 dwmci_readb(struct dwmci_host *host, int reg) #ifdef CONFIG_BLK /** * dwmci_setup_cfg() - Set up the configuration for DWMMC + * @cfg: Configuration structure to fill in (generally &plat->mmc) + * @host: DWMMC host + * @max_clk: Maximum supported clock speed in Hz (e.g. 150000000) + * @min_clk: Minimum supported clock speed in Hz (e.g. 400000) * * This is used to set up a DWMMC device when you are using CONFIG_BLK. * @@ -291,28 +299,23 @@ static inline u8 dwmci_readb(struct dwmci_host *host, int reg) * struct rockchip_mmc_plat *plat = dev_get_plat(dev); * * See rockchip_dw_mmc.c for an example. - * - * @cfg: Configuration structure to fill in (generally &plat->mmc) - * @host: DWMMC host - * @max_clk: Maximum supported clock speed in HZ (e.g. 150000000) - * @min_clk: Minimum supported clock speed in HZ (e.g. 400000) */ void dwmci_setup_cfg(struct mmc_config *cfg, struct dwmci_host *host, u32 max_clk, u32 min_clk); /** * dwmci_bind() - Set up a new MMC block device + * @dev: Device to set up + * @mmc: Pointer to mmc structure (normally &plat->mmc) + * @cfg: Empty configuration structure (generally &plat->cfg). This is + * normally all zeroes at this point. The only purpose of passing + * this in is to set mmc->cfg to it. * * This is used to set up a DWMMC block device when you are using CONFIG_BLK. * It should be called from your driver's bind() method. * * See rockchip_dw_mmc.c for an example. * - * @dev: Device to set up - * @mmc: Pointer to mmc structure (normally &plat->mmc) - * @cfg: Empty configuration structure (generally &plat->cfg). This is - * normally all zeroes at this point. The only purpose of passing - * this in is to set mmc->cfg to it. * Return: 0 if OK, -ve if the block device could not be created */ int dwmci_bind(struct udevice *dev, struct mmc *mmc, struct mmc_config *cfg); @@ -320,12 +323,12 @@ int dwmci_bind(struct udevice *dev, struct mmc *mmc, struct mmc_config *cfg); #else /** * add_dwmci() - Add a new DWMMC interface + * @host: DWMMC host structure + * @max_clk: Maximum supported clock speed in Hz (e.g. 150000000) + * @min_clk: Minimum supported clock speed in Hz (e.g. 400000) * * This is used when you are not using CONFIG_BLK. Convert your driver over! * - * @host: DWMMC host structure - * @max_clk: Maximum supported clock speed in HZ (e.g. 150000000) - * @min_clk: Minimum supported clock speed in HZ (e.g. 400000) * Return: 0 if OK, -ve on error */ int add_dwmci(struct dwmci_host *host, u32 max_clk, u32 min_clk); From patchwork Thu Aug 8 03:14:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817677 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675127wrt; Wed, 7 Aug 2024 20:17:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX+JrYPwqr5gwEHhR95Sly07C61534RJngexrRi3o/cI7bSO3yKdNhFwJNikyRc2by2xo2i5QqXRGDAuPRcidlZ X-Google-Smtp-Source: AGHT+IEhKAXjn0bBtlVqDMSUVaCj/mNvwExg5lJ16/FGsFSOqSmIlivzo4uG/ti3e3Omxz5nzd62 X-Received: by 2002:a2e:9b4b:0:b0:2ef:2d4d:af76 with SMTP id 38308e7fff4ca-2f19de7b862mr2734591fa.43.1723087036549; Wed, 07 Aug 2024 20:17:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087036; cv=none; d=google.com; s=arc-20160816; b=mtaiBdG3WdITgDWxRieh7HC70JDMtT2K7bYlbyi5LvWb0RVxsOtu8hQoe2Mni0yjKY CiuGoqmM5vapD1SYVvTzA4sQaIssA9CBDmkuYccYGTpjO/I81XZXNWCpsUxH1MZkJDcf gYRKO34MhHXjsVL0ySLKlpQu/9J56IrtuoUQYR1AfTJS6NmAx/4oJRQFHZZ62q5Qlzlc CQOzazhPqexMBHrazO1wsYh+QVwWu+TbiVOXhVyVitBdMTNxaTxF48WiJXjND+4RNhHF byHIhU36/Apm2QYacJ5rllfkWBQCVPIS4JtH8zB4psBOPZW0qjjGfSfAHNibMJCAULh4 F6LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sHnNxLDOxB6atnhaqns+IVEM5t1CfdK+WhlcnxoGD5g=; fh=isZMqWlAO3nGx1QEE6KXl6VWGclw25cVt0NhPs+RZXQ=; b=Hxix9xwMM/hZexSr/Wzfj1IGPdeoDoLXeVRRX2PDu4qvuDsDSREY3z0LjC9VkVCOod CBATeT5nk4IQz0/6BoOdR4aM0hovAZS7yOl62Fso5aafFkqYN15DmsVsjhiSYyshhkOa anlC60BTIacol7hUZZ6va5UV/y0MCy+XRVhcGrVbKZUhacrqlfQEs+PxnWGAPBqZx4aO OtT44zS2Q1f7vZdXdjiVGABkMGU8xV2zh+/QFQsFFLuqcgyto/lHwaMOthyzt/Vx4u5+ SY1TJYB/VP2FISTbf8AqRByY8kOvxHlaZD2sb9csQt004tkDJLTOU1wJ1boJxg3Br4ZD x8uQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jTgvmu2q; 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-5bbb2cfea33si255450a12.218.2024.08.07.20.17.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:17:16 -0700 (PDT) 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=jTgvmu2q; 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 947E588B3A; Thu, 8 Aug 2024 05:15:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="jTgvmu2q"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7A74988A83; Thu, 8 Aug 2024 05:14:58 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DCCC38873C for ; Thu, 8 Aug 2024 05:14:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-70943713472so208135a34.2 for ; Wed, 07 Aug 2024 20:14:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086894; x=1723691694; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sHnNxLDOxB6atnhaqns+IVEM5t1CfdK+WhlcnxoGD5g=; b=jTgvmu2qlV/S17AGpSQjMvIXCgFmxezFZZoEDTydUYFPoZLAFgU+yXGKOVw0qknOrk QZ9HeMd0Bz4AhyxZpYxVv+VIMFsBIYJsaN6CpsxiZiFfzuXFSvOjR1G5Zaq1Qno/hZ1D RYp5alUQxmTSwbQDO/iWTD5Rl+HOc4JCzxQV8zAQFemWLO2kE3CVHpICixITmslanPe+ ZtsofYoy4FXRujQ5g5E6RuwEvUcxW/F+eF127S4Lx7npiRy0IKNibdz5WxQZSinina6n aaL2IKZnWHTTlbMQyNgeuXG6EffjrDbKfejQSVH6X9LCxmsQmif/Ev0DckFhQu/8D/BU IPHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086894; x=1723691694; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sHnNxLDOxB6atnhaqns+IVEM5t1CfdK+WhlcnxoGD5g=; b=ceQ9RJSZ1JuIZQXnJ+CqUzHB1LlS/T7PKFWcLdjDlZ/YNj6Fp4p3QQG9nr0c2p3l5d NdkmJwKi93qbQwYPjXb5H6vwTcgpZvLu4XBcVt3yBc5bXvTsIk/CErm0j6K6D4u+x3fW jxOpa7zyO+wsxe+Ct7VrqoiXzwsciLkH58+5uwj4BuGvSyC/3b1CrNkrVCYFWZg5UtRM hpuh3Q5XnDs7V61YRS7Iv1WQvFWK8GNwOZohQFDUgTe9V0Pr2hXuLC/tiBYneBKy1rRv MYpXUtn9DEJwpzXbXGhcKscFB0dnQk+RvwpNl+ke7nd7KJK5M6uIw1DsprgPXVE0/H8g J0dQ== X-Forwarded-Encrypted: i=1; AJvYcCXHvQn+K75yxzapKVLiyPewcbTCSODzeX8obDRK3Vy29vGNRyzgLO/3W13F4rD7DMJ/FPqhb7JukCpZsShFpINhKNHOKA== X-Gm-Message-State: AOJu0YzuKUAkV+OvvmzdZT0TuTVGTJ/gvB/31M5Ad2dc7cCPodSeQJXR 3NzDM20hMeOQEgdFIXoThfBQuCrheFukGvT//JosnA4Hob6pwEVe0HZH1xj2beA= X-Received: by 2002:a05:6830:3919:b0:709:3c0a:ff00 with SMTP id 46e09a7af769-70b4fc947d2mr847321a34.24.1723086894578; Wed, 07 Aug 2024 20:14:54 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-70a31eafaf5sm5128620a34.31.2024.08.07.20.14.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:54 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 13/38] mmc: dw_mmc: Improve coding style Date: Wed, 7 Aug 2024 22:14:19 -0500 Message-Id: <20240808031444.9619-14-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Fix most of checkpatch warnings and other obvious style issues. No functional change. Signed-off-by: Sam Protsenko Reviewed-by: Quentin Schulz --- Changes in v5: - (none) Changes in v4: - Rebased on top of the most recent master Changes in v3: - (none) Changes in v2: - Added R-b tag from Quentin drivers/mmc/dw_mmc.c | 68 ++++++++++---------- include/dwmmc.h | 149 ++++++++++++++++++++++--------------------- 2 files changed, 110 insertions(+), 107 deletions(-) diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index 47dcc37c2c7c..8551eac70185 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -125,8 +125,9 @@ static void dwmci_prepare_desc(struct dwmci_host *host, struct mmc_data *data, if (blk_cnt <= 8) { flags |= DWMCI_IDMAC_LD; cnt = data->blocksize * blk_cnt; - } else + } else { cnt = data->blocksize * 8; + } if (host->dma_64bit_address) { dwmci_set_idma_desc64(desc64, flags, cnt, @@ -150,10 +151,8 @@ static void dwmci_prepare_desc(struct dwmci_host *host, struct mmc_data *data, flush_dcache_range(data_start, roundup(data_end, ARCH_DMA_MINALIGN)); } -static void dwmci_prepare_data(struct dwmci_host *host, - struct mmc_data *data, - void *cur_idmac, - void *bounce_buffer) +static void dwmci_prepare_data(struct dwmci_host *host, struct mmc_data *data, + void *cur_idmac, void *bounce_buffer) { const u32 idmacl = virt_to_phys(cur_idmac) & 0xffffffff; const u32 idmacu = (u64)virt_to_phys(cur_idmac) >> 32; @@ -277,7 +276,7 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) for (;;) { mask = dwmci_readl(host, DWMCI_RINTSTS); - /* Error during data transfer. */ + /* Error during data transfer */ if (mask & (DWMCI_DATA_ERR | DWMCI_DATA_TOUT)) { debug("%s: DATA ERROR!\n", __func__); ret = -EINVAL; @@ -286,16 +285,15 @@ static int dwmci_data_transfer(struct dwmci_host *host, struct mmc_data *data) ret = dwmci_data_transfer_fifo(host, data, mask); - /* Data arrived correctly. */ + /* Data arrived correctly */ if (mask & DWMCI_INTMSK_DTO) { ret = 0; break; } - /* Check for timeout. */ + /* Check for timeout */ if (get_timer(start) > timeout) { - debug("%s: Timeout waiting for data!\n", - __func__); + debug("%s: Timeout waiting for data!\n", __func__); ret = -ETIMEDOUT; break; } @@ -317,8 +315,8 @@ static int dwmci_dma_transfer(struct dwmci_host *host, uint flags, else mask = DWMCI_IDINTEN_TI; - ret = wait_for_bit_le32(host->ioaddr + host->regs->idsts, - mask, true, 1000, false); + ret = wait_for_bit_le32(host->ioaddr + host->regs->idsts, mask, true, + 1000, false); if (ret) debug("%s: DWMCI_IDINTEN mask 0x%x timeout\n", __func__, mask); @@ -334,7 +332,7 @@ static int dwmci_dma_transfer(struct dwmci_host *host, uint flags, } static int dwmci_set_transfer_mode(struct dwmci_host *host, - struct mmc_data *data) + struct mmc_data *data) { unsigned long mode; @@ -380,12 +378,12 @@ static int dwmci_send_cmd_common(struct dwmci_host *host, struct mmc_cmd *cmd, } else { if (data->flags == MMC_DATA_READ) { ret = bounce_buffer_start(&bbstate, - (void*)data->dest, + (void *)data->dest, data->blocksize * data->blocks, GEN_BB_WRITE); } else { ret = bounce_buffer_start(&bbstate, - (void*)data->src, + (void *)data->src, data->blocksize * data->blocks, GEN_BB_READ); } @@ -420,9 +418,9 @@ static int dwmci_send_cmd_common(struct dwmci_host *host, struct mmc_cmd *cmd, if (cmd->resp_type & MMC_RSP_CRC) flags |= DWMCI_CMD_CHECK_CRC; - flags |= (cmd->cmdidx | DWMCI_CMD_START | DWMCI_CMD_USE_HOLD_REG); + flags |= cmd->cmdidx | DWMCI_CMD_START | DWMCI_CMD_USE_HOLD_REG; - debug("Sending CMD%d\n",cmd->cmdidx); + debug("Sending CMD%d\n", cmd->cmdidx); dwmci_writel(host, DWMCI_CMD, flags); @@ -436,7 +434,7 @@ static int dwmci_send_cmd_common(struct dwmci_host *host, struct mmc_cmd *cmd, } if (i == retry) { - debug("%s: Timeout.\n", __func__); + debug("%s: Timeout\n", __func__); return -ETIMEDOUT; } @@ -449,14 +447,14 @@ static int dwmci_send_cmd_common(struct dwmci_host *host, struct mmc_cmd *cmd, * below shall be debug(). eMMC cards also do not favor * CMD8, please keep that in mind. */ - debug("%s: Response Timeout.\n", __func__); + debug("%s: Response Timeout\n", __func__); return -ETIMEDOUT; } else if (mask & DWMCI_INTMSK_RE) { - debug("%s: Response Error.\n", __func__); + debug("%s: Response Error\n", __func__); return -EIO; } else if ((cmd->resp_type & MMC_RSP_CRC) && (mask & DWMCI_INTMSK_RCRC)) { - debug("%s: Response CRC Error.\n", __func__); + debug("%s: Response CRC Error\n", __func__); return -EIO; } @@ -555,24 +553,24 @@ static int dwmci_setup_bus(struct dwmci_host *host, u32 freq) unsigned long sclk; int ret; - if ((freq == host->clock) || (freq == 0)) + if (freq == host->clock || freq == 0) return 0; + /* - * If host->get_mmc_clk isn't defined, - * then assume that host->bus_hz is source clock value. - * host->bus_hz should be set by user. + * If host->get_mmc_clk isn't defined, then assume that host->bus_hz is + * source clock value. host->bus_hz should be set by user. */ - if (host->get_mmc_clk) + if (host->get_mmc_clk) { sclk = host->get_mmc_clk(host, freq); - else if (host->bus_hz) + } else if (host->bus_hz) { sclk = host->bus_hz; - else { - debug("%s: Didn't get source clock value.\n", __func__); + } else { + debug("%s: Didn't get source clock value\n", __func__); return -EINVAL; } if (sclk == freq) - div = 0; /* bypass mode */ + div = 0; /* bypass mode */ else div = DIV_ROUND_UP(sclk, 2 * freq); @@ -596,7 +594,7 @@ static int dwmci_set_ios(struct mmc *mmc) struct dwmci_host *host = (struct dwmci_host *)mmc->priv; u32 ctype, regs; - debug("Buswidth = %d, clock: %d\n", mmc->bus_width, mmc->clock); + debug("Bus width = %d, clock: %d\n", mmc->bus_width, mmc->clock); dwmci_setup_bus(host, mmc->clock); switch (mmc->bus_width) { @@ -710,10 +708,10 @@ static int dwmci_init(struct mmc *mmc) /* Enumerate at 400KHz */ dwmci_setup_bus(host, mmc->cfg->f_min); - dwmci_writel(host, DWMCI_RINTSTS, 0xFFFFFFFF); + dwmci_writel(host, DWMCI_RINTSTS, 0xffffffff); dwmci_writel(host, DWMCI_INTMASK, 0); - dwmci_writel(host, DWMCI_TMOUT, 0xFFFFFFFF); + dwmci_writel(host, DWMCI_TMOUT, 0xffffffff); dwmci_writel(host, DWMCI_BMOD, 1); dwmci_init_fifo(host); @@ -747,7 +745,7 @@ static const struct mmc_ops dwmci_ops = { #endif void dwmci_setup_cfg(struct mmc_config *cfg, struct dwmci_host *host, - u32 max_clk, u32 min_clk) + u32 max_clk, u32 min_clk) { cfg->name = host->name; #ifndef CONFIG_DM_MMC @@ -783,7 +781,7 @@ int add_dwmci(struct dwmci_host *host, u32 max_clk, u32 min_clk) dwmci_setup_cfg(&host->cfg, host, max_clk, min_clk); host->mmc = mmc_create(&host->cfg, host); - if (host->mmc == NULL) + if (!host->mmc) return -1; return 0; diff --git a/include/dwmmc.h b/include/dwmmc.h index 77c8989148a1..a99b2f3bf0cc 100644 --- a/include/dwmmc.h +++ b/include/dwmmc.h @@ -15,31 +15,31 @@ #define DWMCI_CTRL 0x000 #define DWMCI_PWREN 0x004 #define DWMCI_CLKDIV 0x008 -#define DWMCI_CLKSRC 0x00C +#define DWMCI_CLKSRC 0x00c #define DWMCI_CLKENA 0x010 #define DWMCI_TMOUT 0x014 #define DWMCI_CTYPE 0x018 -#define DWMCI_BLKSIZ 0x01C +#define DWMCI_BLKSIZ 0x01c #define DWMCI_BYTCNT 0x020 #define DWMCI_INTMASK 0x024 #define DWMCI_CMDARG 0x028 -#define DWMCI_CMD 0x02C +#define DWMCI_CMD 0x02c #define DWMCI_RESP0 0x030 #define DWMCI_RESP1 0x034 #define DWMCI_RESP2 0x038 -#define DWMCI_RESP3 0x03C +#define DWMCI_RESP3 0x03c #define DWMCI_MINTSTS 0x040 #define DWMCI_RINTSTS 0x044 #define DWMCI_STATUS 0x048 -#define DWMCI_FIFOTH 0x04C +#define DWMCI_FIFOTH 0x04c #define DWMCI_CDETECT 0x050 #define DWMCI_WRTPRT 0x054 #define DWMCI_GPIO 0x058 -#define DWMCI_TCMCNT 0x05C +#define DWMCI_TCMCNT 0x05c #define DWMCI_TBBCNT 0x060 #define DWMCI_DEBNCE 0x064 #define DWMCI_USRID 0x068 -#define DWMCI_VERID 0x06C +#define DWMCI_VERID 0x06c #define DWMCI_HCON 0x070 #define DWMCI_UHS_REG 0x074 #define DWMCI_BMOD 0x080 @@ -47,7 +47,7 @@ #define DWMCI_DATA 0x200 /* Registers to support IDMAC 32-bit address mode */ #define DWMCI_DBADDR 0x088 -#define DWMCI_IDSTS 0x08C +#define DWMCI_IDSTS 0x08c #define DWMCI_IDINTEN 0x090 #define DWMCI_DSCADDR 0x094 #define DWMCI_BUFADDR 0x098 @@ -63,94 +63,94 @@ /* Interrupt Mask register */ #define DWMCI_INTMSK_ALL 0xffffffff -#define DWMCI_INTMSK_RE (1 << 1) -#define DWMCI_INTMSK_CDONE (1 << 2) -#define DWMCI_INTMSK_DTO (1 << 3) -#define DWMCI_INTMSK_TXDR (1 << 4) -#define DWMCI_INTMSK_RXDR (1 << 5) -#define DWMCI_INTMSK_RCRC (1 << 6) -#define DWMCI_INTMSK_DCRC (1 << 7) -#define DWMCI_INTMSK_RTO (1 << 8) -#define DWMCI_INTMSK_DRTO (1 << 9) -#define DWMCI_INTMSK_HTO (1 << 10) -#define DWMCI_INTMSK_FRUN (1 << 11) -#define DWMCI_INTMSK_HLE (1 << 12) -#define DWMCI_INTMSK_SBE (1 << 13) -#define DWMCI_INTMSK_ACD (1 << 14) -#define DWMCI_INTMSK_EBE (1 << 15) - -/* Raw interrupt Regsiter */ -#define DWMCI_DATA_ERR (DWMCI_INTMSK_EBE | DWMCI_INTMSK_SBE | DWMCI_INTMSK_HLE |\ - DWMCI_INTMSK_FRUN | DWMCI_INTMSK_EBE | DWMCI_INTMSK_DCRC) -#define DWMCI_DATA_TOUT (DWMCI_INTMSK_HTO | DWMCI_INTMSK_DRTO) +#define DWMCI_INTMSK_RE BIT(1) +#define DWMCI_INTMSK_CDONE BIT(2) +#define DWMCI_INTMSK_DTO BIT(3) +#define DWMCI_INTMSK_TXDR BIT(4) +#define DWMCI_INTMSK_RXDR BIT(5) +#define DWMCI_INTMSK_RCRC BIT(6) +#define DWMCI_INTMSK_DCRC BIT(7) +#define DWMCI_INTMSK_RTO BIT(8) +#define DWMCI_INTMSK_DRTO BIT(9) +#define DWMCI_INTMSK_HTO BIT(10) +#define DWMCI_INTMSK_FRUN BIT(11) +#define DWMCI_INTMSK_HLE BIT(12) +#define DWMCI_INTMSK_SBE BIT(13) +#define DWMCI_INTMSK_ACD BIT(14) +#define DWMCI_INTMSK_EBE BIT(15) + +/* Raw interrupt register */ +#define DWMCI_DATA_ERR (DWMCI_INTMSK_EBE | DWMCI_INTMSK_SBE | \ + DWMCI_INTMSK_HLE | DWMCI_INTMSK_FRUN | \ + DWMCI_INTMSK_EBE | DWMCI_INTMSK_DCRC) +#define DWMCI_DATA_TOUT (DWMCI_INTMSK_HTO | DWMCI_INTMSK_DRTO) + /* CTRL register */ -#define DWMCI_CTRL_RESET (1 << 0) -#define DWMCI_CTRL_FIFO_RESET (1 << 1) -#define DWMCI_CTRL_DMA_RESET (1 << 2) -#define DWMCI_DMA_EN (1 << 5) -#define DWMCI_CTRL_SEND_AS_CCSD (1 << 10) -#define DWMCI_IDMAC_EN (1 << 25) +#define DWMCI_CTRL_RESET BIT(0) +#define DWMCI_CTRL_FIFO_RESET BIT(1) +#define DWMCI_CTRL_DMA_RESET BIT(2) +#define DWMCI_DMA_EN BIT(5) +#define DWMCI_CTRL_SEND_AS_CCSD BIT(10) +#define DWMCI_IDMAC_EN BIT(25) #define DWMCI_RESET_ALL (DWMCI_CTRL_RESET | DWMCI_CTRL_FIFO_RESET |\ DWMCI_CTRL_DMA_RESET) /* CMD register */ -#define DWMCI_CMD_RESP_EXP (1 << 6) -#define DWMCI_CMD_RESP_LENGTH (1 << 7) -#define DWMCI_CMD_CHECK_CRC (1 << 8) -#define DWMCI_CMD_DATA_EXP (1 << 9) -#define DWMCI_CMD_RW (1 << 10) -#define DWMCI_CMD_SEND_STOP (1 << 12) -#define DWMCI_CMD_ABORT_STOP (1 << 14) -#define DWMCI_CMD_PRV_DAT_WAIT (1 << 13) -#define DWMCI_CMD_UPD_CLK (1 << 21) -#define DWMCI_CMD_USE_HOLD_REG (1 << 29) -#define DWMCI_CMD_START (1 << 31) +#define DWMCI_CMD_RESP_EXP BIT(6) +#define DWMCI_CMD_RESP_LENGTH BIT(7) +#define DWMCI_CMD_CHECK_CRC BIT(8) +#define DWMCI_CMD_DATA_EXP BIT(9) +#define DWMCI_CMD_RW BIT(10) +#define DWMCI_CMD_SEND_STOP BIT(12) +#define DWMCI_CMD_ABORT_STOP BIT(14) +#define DWMCI_CMD_PRV_DAT_WAIT BIT(13) +#define DWMCI_CMD_UPD_CLK BIT(21) +#define DWMCI_CMD_USE_HOLD_REG BIT(29) +#define DWMCI_CMD_START BIT(31) /* CLKENA register */ -#define DWMCI_CLKEN_ENABLE (1 << 0) -#define DWMCI_CLKEN_LOW_PWR (1 << 16) +#define DWMCI_CLKEN_ENABLE BIT(0) +#define DWMCI_CLKEN_LOW_PWR BIT(16) -/* Card-type registe */ +/* Card type register */ #define DWMCI_CTYPE_1BIT 0 -#define DWMCI_CTYPE_4BIT (1 << 0) -#define DWMCI_CTYPE_8BIT (1 << 16) +#define DWMCI_CTYPE_4BIT BIT(0) +#define DWMCI_CTYPE_8BIT BIT(16) -/* Status Register */ -#define DWMCI_FIFO_EMPTY (1 << 2) -#define DWMCI_FIFO_FULL (1 << 3) -#define DWMCI_BUSY (1 << 9) +/* Status register */ +#define DWMCI_FIFO_EMPTY BIT(2) +#define DWMCI_FIFO_FULL BIT(3) +#define DWMCI_BUSY BIT(9) #define DWMCI_FIFO_MASK 0x1fff #define DWMCI_FIFO_SHIFT 17 -/* FIFOTH Register */ +/* FIFOTH register */ #define MSIZE(x) ((x) << 28) #define RX_WMARK(x) ((x) << 16) #define TX_WMARK(x) (x) #define RX_WMARK_SHIFT 16 #define RX_WMARK_MASK (0xfff << RX_WMARK_SHIFT) -#define DWMCI_IDMAC_OWN (1 << 31) -#define DWMCI_IDMAC_CH (1 << 4) -#define DWMCI_IDMAC_FS (1 << 3) -#define DWMCI_IDMAC_LD (1 << 2) +#define DWMCI_IDMAC_OWN BIT(31) +#define DWMCI_IDMAC_CH BIT(4) +#define DWMCI_IDMAC_FS BIT(3) +#define DWMCI_IDMAC_LD BIT(2) -/* Bus Mode Register */ -#define DWMCI_BMOD_IDMAC_RESET (1 << 0) -#define DWMCI_BMOD_IDMAC_FB (1 << 1) -#define DWMCI_BMOD_IDMAC_EN (1 << 7) +/* Bus Mode register */ +#define DWMCI_BMOD_IDMAC_RESET BIT(0) +#define DWMCI_BMOD_IDMAC_FB BIT(1) +#define DWMCI_BMOD_IDMAC_EN BIT(7) /* UHS register */ -#define DWMCI_DDR_MODE (1 << 16) +#define DWMCI_DDR_MODE BIT(16) /* Internal IDMAC interrupt defines */ -#define DWMCI_IDINTEN_RI BIT(1) -#define DWMCI_IDINTEN_TI BIT(0) +#define DWMCI_IDINTEN_RI BIT(1) +#define DWMCI_IDINTEN_TI BIT(0) +#define DWMCI_IDINTEN_MASK (DWMCI_IDINTEN_TI | DWMCI_IDINTEN_RI) -#define DWMCI_IDINTEN_MASK (DWMCI_IDINTEN_TI | \ - DWMCI_IDINTEN_RI) - -/* quirks */ -#define DWMCI_QUIRK_DISABLE_SMU (1 << 0) +/* Quirks */ +#define DWMCI_QUIRK_DISABLE_SMU BIT(0) /** * struct dwmci_idmac_regs - Offsets of IDMAC registers @@ -230,6 +230,7 @@ struct dwmci_host { * return that value too. Then DWMMC will put itself in bypass mode. */ unsigned int (*get_mmc_clk)(struct dwmci_host *host, uint freq); + #ifndef CONFIG_BLK struct mmc_config cfg; #endif @@ -253,6 +254,7 @@ static inline void dwmci_writeb(struct dwmci_host *host, int reg, u8 val) { writeb(val, host->ioaddr + reg); } + static inline u32 dwmci_readl(struct dwmci_host *host, int reg) { return readl(host->ioaddr + reg); @@ -269,6 +271,7 @@ static inline u8 dwmci_readb(struct dwmci_host *host, int reg) } #ifdef CONFIG_BLK + /** * dwmci_setup_cfg() - Set up the configuration for DWMMC * @cfg: Configuration structure to fill in (generally &plat->mmc) @@ -301,7 +304,7 @@ static inline u8 dwmci_readb(struct dwmci_host *host, int reg) * See rockchip_dw_mmc.c for an example. */ void dwmci_setup_cfg(struct mmc_config *cfg, struct dwmci_host *host, - u32 max_clk, u32 min_clk); + u32 max_clk, u32 min_clk); /** * dwmci_bind() - Set up a new MMC block device @@ -321,6 +324,7 @@ void dwmci_setup_cfg(struct mmc_config *cfg, struct dwmci_host *host, int dwmci_bind(struct udevice *dev, struct mmc *mmc, struct mmc_config *cfg); #else + /** * add_dwmci() - Add a new DWMMC interface * @host: DWMMC host structure @@ -332,6 +336,7 @@ int dwmci_bind(struct udevice *dev, struct mmc *mmc, struct mmc_config *cfg); * Return: 0 if OK, -ve on error */ int add_dwmci(struct dwmci_host *host, u32 max_clk, u32 min_clk); + #endif /* !CONFIG_BLK */ #ifdef CONFIG_DM_MMC From patchwork Thu Aug 8 03:14:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817678 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675168wrt; Wed, 7 Aug 2024 20:17:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWSPAsiC5En2VatoVm0wRACaVT8gptXWnbAXjxu71djnw0ykRaaR86hu2EGPISsJHTdbTe9kDZpNyDqeQs+byy3 X-Google-Smtp-Source: AGHT+IHn992Dwc5q8VooEY8AJ4zjhxE2fSTBJbJUf1GUbJOC1HAC28BdjzhpQAyolo4RFk+aLk8h X-Received: by 2002:a17:907:80e:b0:a77:c84b:5a60 with SMTP id a640c23a62f3a-a8090c81d24mr28012366b.26.1723087046665; Wed, 07 Aug 2024 20:17:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087046; cv=none; d=google.com; s=arc-20160816; b=KlUsbchUZbMlwmLcBdbdWgs/4afV8hoBPGXYTSiDatMU6BflKU4z0YBQVPYhWUfkY8 GMuqw08Ejp6Wyjqrh+g8KfpMVpJAb9p3wtono3rQWkWAHH2cwZRHnNDe19Z1FY2Z7hvH T3BdBJvavmDe6k6xhD/grYn31PTt7q07yLxrIR3+/hkTrybOkRiaxhbiU3HlucikOJS0 IKLfV2D/uVrv/IJ7/KQqA+xXbAbeKyYoVrsSE5c2K3GGvCVwM/TQbRZ+Ek7Wfs9bVYul UC5o4uRBhf/yL1PLtYl9NrF48CtSeoJvMzfyGiOvorupzjiOw3N/uS0mtCdD+XW9qwzf YB8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3Hl7qYibvsXpbq6wpkL/2KHzx28NxJyPXH8KfUMFYPM=; fh=10jkUCB+Lsj1g+w+FG7fPISTrx9PWb1Q0lXQUs3sbeg=; b=zAzTc43Yx9yGemB0zDaror7iAjnIfmx/DM0m8CQZuB46H4TJZHUXgOjs2iDHNIS1Kj JzineGPhC1TWyOTuuAuXXLHmDsPjKS2gdokLZVfKJs/TWGtebwi7dn+8hiiFCnR+U4fw ztuzdVb4rWFOAcqNZFTQtge4VVxiGtKZsjlVQyttuU13ZA9kdcjfxZLDTpiSPDq9njoA fAX9LA/fGWVODf8/vHaj6BF0zNGoKynt4uMrcRNwcyjlwVRtzEOmj4ofBXRPTQCiK/Rb 7QuNoIROhVk6xhOHIYkP+YzkuO4P8FBmadSC9ztmQ/sRodkO9OiOg942QInxYyKw9lqR ycGg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OdJrvxDu; 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-a7dc9c16989si777852066b.251.2024.08.07.20.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:17:26 -0700 (PDT) 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=OdJrvxDu; 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 15EFC88AFF; Thu, 8 Aug 2024 05:15:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="OdJrvxDu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E7074888CF; Thu, 8 Aug 2024 05:14:58 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) (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 8DF11888CF for ; Thu, 8 Aug 2024 05:14:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3db12a2f530so384536b6e.1 for ; Wed, 07 Aug 2024 20:14:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086895; x=1723691695; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3Hl7qYibvsXpbq6wpkL/2KHzx28NxJyPXH8KfUMFYPM=; b=OdJrvxDuyKK8cXzFvp6IAOI32Q5c0O91bfwoWYsyrISP0Hz7NWIhV8EmAqBwmQSy99 GlMk21iNImmZAcoyXEd9mR1zx/rUWP1FdAogo/bLXich3kgyQ+YgzcKEVSIf0MrhFOi6 DzGVJiQ+5opQSzJpP0kLgIVXM+y9UfY+BlArSYHuVspZLle2Q6zjlOd8dkNpe7FPUN7R ilAbWbUc5VjNilzNxayrEju4tPR0P6D5cL+4iPg67OjlfK+NZmaubEXTdNYXbjJLfREL 27rdTP+s9VDpgP4Roo8r8eCi7QVs4T1ZTchQje5ttdgsUsCM/0mMtGy2w71YdXeIG5SU ZLFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086895; x=1723691695; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3Hl7qYibvsXpbq6wpkL/2KHzx28NxJyPXH8KfUMFYPM=; b=iEaD8S156IgCbPWlhslAEOOYDa8hGfoyqeWTZumzVpoHXmBBnP5lC6s8XUgjxDO/j7 88/hDmtQBFPzjJ8RI47t4tsSXk8qT0lJEd66arVdsXpCHJeWHIHYJ+8IONGZUhiAxRXm rvxWqjAmzpKYB1YSgBcPg0t/CVCZ0rvPQZbWwlqdfTLrX38nalvdewTp9pXu8blO10bs Ugh4Re/mmz8IDfJcbiaKuJxos7qKgO3Cs5Yi3qV+2FNb36+0MXyX6JGPROFjV3GarWXR YcohGnZM7U/jyqS9Cz7srfgjPq1WmnyOPayh8QWXDUrFzuefBX4O0EczbOMrOgoCPIJA fbwA== X-Forwarded-Encrypted: i=1; AJvYcCXYUXUwG65LsTxwAmvKp+xbYPzppwHRQBOUqqAP0YYRGHMC8awIiOuY7kiETLyoG2H9OW7nFNdsseEGJKZzWavC3ASEjQ== X-Gm-Message-State: AOJu0YwzsGYscB7+EaScG09phyo8pIW3+9qgr5y/IXwbiyLTNJOPrAeJ uvNAijF4jTyJDMvbatkRjsiwNWVoowZSfwlT4E6esQYX0+Wy4DxMLHhzmYFd0yE= X-Received: by 2002:a05:6808:23cc:b0:3da:e2b1:10d2 with SMTP id 5614622812f47-3dc3b4074b9mr753880b6e.2.1723086895240; Wed, 07 Aug 2024 20:14:55 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3db56361a2csm4574214b6e.9.2024.08.07.20.14.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:54 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 14/38] arm: dts: exynos: Add upstream DW MMC properties to all Exynos dts Date: Wed, 7 Aug 2024 22:14:20 -0500 Message-Id: <20240808031444.9619-15-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Some device tree properties for DW MMC block were updated in Linux kernel. Let's follow its example and rework corresponding properties in all Exynos device trees. Don't remove outdated properties yet, it'll be done later once DW MMC driver is updated accordingly to read the updated properties instead of outdated ones. Next properties are added: * samsung,dw-mshc-ciu-div and samsung,dw-mshc-sdr-timing: They were derived from outdated samsung,timing property. * fifo-depth (generic replacement for fifoth_val): FIFO depth was calculated from fifoth_val (using expressions from FIFOTH register description in TRM): fifo-depth = ((fifoth_val >> 16) + 1) * 2 * bus-width: generic replacement for samsung,bus-width * clock-frequency: generic replacement for bus_hz * non-removable: generic replacement for samsung,removable = <0> No functional change. Signed-off-by: Sam Protsenko --- Changes in v5: - Added missing bus-width property to sdhci2 node (SD card) in exynos4412-odroid.dts Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) arch/arm/dts/exynos4210-origen.dts | 1 + arch/arm/dts/exynos4210-trats.dts | 2 ++ arch/arm/dts/exynos4210-universal_c210.dts | 2 ++ arch/arm/dts/exynos4412-odroid.dts | 7 +++++++ arch/arm/dts/exynos4412-trats2.dts | 8 ++++++++ arch/arm/dts/exynos5250-arndale.dts | 6 ++++++ arch/arm/dts/exynos5250-smdk5250.dts | 7 +++++++ arch/arm/dts/exynos5250-snow.dts | 7 +++++++ arch/arm/dts/exynos5250-spring.dts | 4 ++++ arch/arm/dts/exynos5420-smdk5420.dts | 7 +++++++ arch/arm/dts/exynos5422-odroidxu3.dts | 2 ++ arch/arm/dts/exynos54xx.dtsi | 7 +++++++ 12 files changed, 60 insertions(+) diff --git a/arch/arm/dts/exynos4210-origen.dts b/arch/arm/dts/exynos4210-origen.dts index 65a5fcd67eff..a4915de2c49c 100644 --- a/arch/arm/dts/exynos4210-origen.dts +++ b/arch/arm/dts/exynos4210-origen.dts @@ -26,6 +26,7 @@ &sdhci2 { samsung,bus-width = <4>; + bus-width = <4>; samsung,timing = <1 2 3>; cd-gpios = <&gpk2 2 0>; status = "okay"; diff --git a/arch/arm/dts/exynos4210-trats.dts b/arch/arm/dts/exynos4210-trats.dts index 05989ee97e5b..4fbdf4730994 100644 --- a/arch/arm/dts/exynos4210-trats.dts +++ b/arch/arm/dts/exynos4210-trats.dts @@ -241,6 +241,7 @@ &sdhci0 { samsung,bus-width = <8>; + bus-width = <8>; samsung,timing = <1 3 3>; pwr-gpios = <&gpk0 2 0>; status = "okay"; @@ -248,6 +249,7 @@ &sdhci2 { samsung,bus-width = <4>; + bus-width = <4>; samsung,timing = <1 2 3>; cd-gpios = <&gpx3 4 0>; status = "okay"; diff --git a/arch/arm/dts/exynos4210-universal_c210.dts b/arch/arm/dts/exynos4210-universal_c210.dts index 610a8ad2e71e..1b3ac1fee15f 100644 --- a/arch/arm/dts/exynos4210-universal_c210.dts +++ b/arch/arm/dts/exynos4210-universal_c210.dts @@ -236,6 +236,7 @@ &sdhci0 { samsung,bus-width = <8>; + bus-width = <8>; samsung,timing = <1 3 3>; pwr-gpios = <&gpk0 2 0>; status = "okay"; @@ -243,6 +244,7 @@ &sdhci2 { samsung,bus-width = <4>; + bus-width = <4>; samsung,timing = <1 2 3>; cd-gpios = <&gpx3 4 0>; status = "okay"; diff --git a/arch/arm/dts/exynos4412-odroid.dts b/arch/arm/dts/exynos4412-odroid.dts index ce08e8dc1ebb..a405b9708719 100644 --- a/arch/arm/dts/exynos4412-odroid.dts +++ b/arch/arm/dts/exynos4412-odroid.dts @@ -235,6 +235,7 @@ &sdhci2 { samsung,bus-width = <4>; + bus-width = <4>; samsung,timing = <1 2 3>; cd-inverted; cd-gpios = <&gpk2 2 0>; @@ -243,9 +244,15 @@ &mshc_0 { samsung,bus-width = <8>; + bus-width = <8>; samsung,timing = <2 1 0>; + samsung,dw-mshc-ciu-div = <0>; + samsung,dw-mshc-sdr-timing = <2 1>; samsung,removable = <0>; + non-removable; fifoth_val = <0x203f0040>; + fifo-depth = <0x80>; + clock-frequency = <400000000>; bus_hz = <400000000>; div = <0x3>; index = <4>; diff --git a/arch/arm/dts/exynos4412-trats2.dts b/arch/arm/dts/exynos4412-trats2.dts index c4db137e01f6..30758ffa1ef9 100644 --- a/arch/arm/dts/exynos4412-trats2.dts +++ b/arch/arm/dts/exynos4412-trats2.dts @@ -109,6 +109,7 @@ sdhci@12510000 { samsung,bus-width = <8>; + bus-width = <8>; samsung,timing = <1 3 3>; pwr-gpios = <&gpk0 4 0>; status = "disabled"; @@ -432,6 +433,7 @@ &sdhci0 { samsung,bus-width = <8>; + bus-width = <8>; samsung,timing = <1 3 3>; pwr-gpios = <&gpk0 4 0>; status = "disabled"; @@ -439,6 +441,7 @@ &sdhci2 { samsung,bus-width = <4>; + bus-width = <4>; samsung,timing = <1 2 3>; cd-gpios = <&gpk2 2 0>; status = "okay"; @@ -446,9 +449,14 @@ &mshc_0 { samsung,bus-width = <8>; + bus-width = <8>; samsung,timing = <2 1 0>; + samsung,dw-mshc-ciu-div = <0>; + samsung,dw-mshc-sdr-timing = <2 1>; samsung,removable = <0>; + non-removable; fifoth_val = <0x203f0040>; + clock-frequency = <400000000>; bus_hz = <400000000>; div = <0x3>; index = <4>; diff --git a/arch/arm/dts/exynos5250-arndale.dts b/arch/arm/dts/exynos5250-arndale.dts index 60309c61f302..7f84589c97a2 100644 --- a/arch/arm/dts/exynos5250-arndale.dts +++ b/arch/arm/dts/exynos5250-arndale.dts @@ -28,7 +28,10 @@ mmc@12200000 { samsung,bus-width = <8>; + bus-width = <8>; samsung,timing = <1 3 3>; + samsung,dw-mshc-ciu-div = <3>; + samsung,dw-mshc-sdr-timing = <1 3>; }; mmc@12210000 { @@ -37,7 +40,10 @@ mmc@12220000 { samsung,bus-width = <4>; + bus-width = <4>; samsung,timing = <1 2 3>; + samsung,dw-mshc-ciu-div = <3>; + samsung,dw-mshc-sdr-timing = <1 2>; }; mmc@12230000 { diff --git a/arch/arm/dts/exynos5250-smdk5250.dts b/arch/arm/dts/exynos5250-smdk5250.dts index afe0cca48a93..882db2d1f608 100644 --- a/arch/arm/dts/exynos5250-smdk5250.dts +++ b/arch/arm/dts/exynos5250-smdk5250.dts @@ -146,8 +146,12 @@ mmc@12200000 { samsung,bus-width = <8>; + bus-width = <8>; samsung,timing = <1 3 3>; + samsung,dw-mshc-ciu-div = <3>; + samsung,dw-mshc-sdr-timing = <1 3>; samsung,removable = <0>; + non-removable; }; mmc@12210000 { @@ -156,7 +160,10 @@ mmc@12220000 { samsung,bus-width = <4>; + bus-width = <4>; samsung,timing = <1 2 3>; + samsung,dw-mshc-ciu-div = <3>; + samsung,dw-mshc-sdr-timing = <1 2>; samsung,removable = <1>; }; diff --git a/arch/arm/dts/exynos5250-snow.dts b/arch/arm/dts/exynos5250-snow.dts index e41f2d3041e2..bcf04d5c07c0 100644 --- a/arch/arm/dts/exynos5250-snow.dts +++ b/arch/arm/dts/exynos5250-snow.dts @@ -302,8 +302,12 @@ mmc@12200000 { samsung,bus-width = <8>; + bus-width = <8>; samsung,timing = <1 3 3>; + samsung,dw-mshc-ciu-div = <3>; + samsung,dw-mshc-sdr-timing = <1 3>; samsung,removable = <0>; + non-removable; }; mmc@12210000 { @@ -312,7 +316,10 @@ mmc@12220000 { samsung,bus-width = <4>; + bus-width = <4>; samsung,timing = <1 2 3>; + samsung,dw-mshc-ciu-div = <3>; + samsung,dw-mshc-sdr-timing = <1 2>; samsung,removable = <1>; }; diff --git a/arch/arm/dts/exynos5250-spring.dts b/arch/arm/dts/exynos5250-spring.dts index 77e7a6b9e45a..7270a546a795 100644 --- a/arch/arm/dts/exynos5250-spring.dts +++ b/arch/arm/dts/exynos5250-spring.dts @@ -104,8 +104,12 @@ mmc@12200000 { samsung,bus-width = <8>; + bus-width = <8>; samsung,timing = <1 3 3>; + samsung,dw-mshc-ciu-div = <3>; + samsung,dw-mshc-sdr-timing = <1 3>; samsung,removable = <0>; + non-removable; }; mmc@12210000 { diff --git a/arch/arm/dts/exynos5420-smdk5420.dts b/arch/arm/dts/exynos5420-smdk5420.dts index 7a5da674fbed..1f27baafebaf 100644 --- a/arch/arm/dts/exynos5420-smdk5420.dts +++ b/arch/arm/dts/exynos5420-smdk5420.dts @@ -107,8 +107,12 @@ mmc@12200000 { samsung,bus-width = <8>; + bus-width = <8>; samsung,timing = <1 3 3>; + samsung,dw-mshc-ciu-div = <3>; + samsung,dw-mshc-sdr-timing = <1 3>; samsung,removable = <0>; + non-removable; samsung,pre-init; }; @@ -118,7 +122,10 @@ mmc@12220000 { samsung,bus-width = <4>; + bus-width = <4>; samsung,timing = <1 2 3>; + samsung,dw-mshc-ciu-div = <3>; + samsung,dw-mshc-sdr-timing = <1 2>; samsung,removable = <1>; }; diff --git a/arch/arm/dts/exynos5422-odroidxu3.dts b/arch/arm/dts/exynos5422-odroidxu3.dts index 9d055d066fd3..767b3e415d58 100644 --- a/arch/arm/dts/exynos5422-odroidxu3.dts +++ b/arch/arm/dts/exynos5422-odroidxu3.dts @@ -281,10 +281,12 @@ mmc@12200000 { fifoth_val = <0x201f0020>; + fifo-depth = <0x40>; }; mmc@12220000 { fifoth_val = <0x201f0020>; + fifo-depth = <0x40>; }; emmc-reset { diff --git a/arch/arm/dts/exynos54xx.dtsi b/arch/arm/dts/exynos54xx.dtsi index 221da8b4850b..fd74166c7e48 100644 --- a/arch/arm/dts/exynos54xx.dtsi +++ b/arch/arm/dts/exynos54xx.dtsi @@ -120,8 +120,12 @@ mmc@12200000 { samsung,bus-width = <8>; + bus-width = <8>; samsung,timing = <1 3 3>; + samsung,dw-mshc-ciu-div = <3>; + samsung,dw-mshc-sdr-timing = <1 3>; samsung,removable = <0>; + non-removable; samsung,pre-init; }; @@ -131,7 +135,10 @@ mmc@12220000 { samsung,bus-width = <4>; + bus-width = <4>; samsung,timing = <1 2 3>; + samsung,dw-mshc-ciu-div = <3>; + samsung,dw-mshc-sdr-timing = <1 2>; samsung,removable = <1>; }; From patchwork Thu Aug 8 03:14:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817679 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675199wrt; Wed, 7 Aug 2024 20:17:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU9E8VLPXEs8c4ebt0oqm8XseHlCVEJ0GBKkMEcl1WmPCnXSDb3fZTtQngv4lCwEvMiwl661h8AsL88XVcJ6Clw X-Google-Smtp-Source: AGHT+IEzCMrwe07dmIqRAgSkRe0V8vxubUoRoOJopOB3CdVTSUiwe2wYgIh8h0o/MfwPSvj00bLC X-Received: by 2002:a05:6512:4006:b0:530:aea2:2454 with SMTP id 2adb3069b0e04-530e5811e58mr269453e87.7.1723087057163; Wed, 07 Aug 2024 20:17:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087057; cv=none; d=google.com; s=arc-20160816; b=jz+6YMJWa3jc3xDZvc7qHWvEyaH2sObRTQZn/XJmXhUeYAkQEOsuQiq86j7eyFiywa Oiqk+Ew9dJiJh3f2O7B+XbpMPlAxuqvo4Wb+JsLyII7h/AO8uaIKLPNqKm6DRaRfVH+I Vj28uHcylBteQhE6Lix05gTpWnvE3Pp2YWj1xtoxxGfCpTZepSIns5RBhgF+vuBs5vCX CRtLUIOP29iSw3xtOcoOsVCtwp24r3whTXrl+lkt+QGVkjRCstkLmLRdqbzZWl5jnHEc 3N/K3adfUeKj+LJIWoMvp/i+Vpy/PFagxorQ1oQALjNyP11ub4T0aJ7vOShCcqysUExo Sw7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6cUfHwk0Yus8LngelZKE317fNTQM+N79ervvdou1M48=; fh=c7/oQLOLfpi5Ef8nQDFdhsIjQUXDwNkZQVexC9lMY+c=; b=dzerI+Bu73KVttAduYI1VuaBYzabAGqu5kKWo+apKyZghRdm/Zhju15SXHZ4w79S0H 8eTEsgga6IwisVD36ego2eHdQHZpGBtYWMHJVr+6+NClKKZ/bC+LACFJwcjvnI9LBW0l jGGRFHvnQ5vMtVB4cxz7QcAIumrMndf9cBgMYzxZtAefGLROYPFJcPQJcoWdi5Srkb0U OjI1kOTdcdcMOMxc+wVChxj614p8VfYOpA5DB3Xc2rm0ZKVkTSzroSTnjt7BN1ZK6b0n 8wsmlJ9h4g1p54IpieocDyYRGfCUGuJiRV6Goowhf7747yXP8cQiHEKt52qVQwIv94f4 ZS1A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cjiJfipj; 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-5bbb2c1f7b1si256618a12.160.2024.08.07.20.17.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:17:37 -0700 (PDT) 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=cjiJfipj; 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 8555688B57; Thu, 8 Aug 2024 05:15:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="cjiJfipj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8BE5388AE3; Thu, 8 Aug 2024 05:14:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc2d.google.com (mail-oo1-xc2d.google.com [IPv6:2607:f8b0:4864:20::c2d]) (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 545E588A34 for ; Thu, 8 Aug 2024 05:14:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oo1-xc2d.google.com with SMTP id 006d021491bc7-5d608060241so294618eaf.1 for ; Wed, 07 Aug 2024 20:14:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086896; x=1723691696; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6cUfHwk0Yus8LngelZKE317fNTQM+N79ervvdou1M48=; b=cjiJfipjmiiu4D6+OsUztiWlzynDctYOJG9hz5lIK0LaAtqv+2GTybftbycvWYsJwm wMYpAylw/RVpxPCJyFpCo3N9QxXp7gSwyyPx96R8wDLMowme6vumQ/Cq57MoLtMbUGR/ tP3vOZZrj4FL1rwby/5MClyhBpECjRJQKruceu5SYSav3DxKHzc6i7mVez87+gTYFrBw T3xksoONqfeIx6ioQe3yWB49qdwgrYwH+NfPtFfopWinkm1eoNePSA/dF2n9zs9wisQt 30oFxTx5Or6tkrKVAKA1KewGAIZGZxsIZOsAe1AYWlmWJnMhUe2TMKwmiuXFwJlxPziw Bv1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086896; x=1723691696; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6cUfHwk0Yus8LngelZKE317fNTQM+N79ervvdou1M48=; b=TcNLGanPYiGQxu3mY3m8ZwvyoTaVIKURh+MmkDYVccFFEQuJ9rGOd/7x47B9X33JHN Z7mPhVoEw8g0SO3cJeL4BPU0b5b8itjEUxt9jeSCnDrXjXizW28ytDSLDiBT8jCfXDdu FtFZfxENdk1vSIOq3BUwEwTT3UHnvTMnSRKE+nTyTrjWoy1nW2dVf0iCd8okrGX9ep+q rJC0EfJGRY6LxDYEmV7ZN9z+blVzmFGmsy/O6ctgBy3cVtaANO/cV2+nBdTbMWfZ7yMe hgI0syxXKXt/vMTL6dSLvJwwFMjEi0f5WaRiW2d3/5MP4lY+DzqvbTZ/U34mRqGZyidw Wadg== X-Forwarded-Encrypted: i=1; AJvYcCX00c7/Ejz1iT10LfE24x0oOOq8udAU1P8/2oqiw4tLIfwmhZuID6Mr/pF7+eCb72L80zyMOGusHrQ0O5dBFKYh4AkfNw== X-Gm-Message-State: AOJu0YwKz/TVxFibRcX7msguV26OMIEiwRFTrhCjPLpvrRW6zgikE8m7 /ePtOg47VyeXOiKPFgtXimPkYE/7yiUouH8kOJu68PlRjULUgrr5uB/+35WDLmY= X-Received: by 2002:a05:6820:4b0b:b0:5c6:61b9:20ba with SMTP id 006d021491bc7-5d855a51016mr881507eaf.1.1723086896050; Wed, 07 Aug 2024 20:14:56 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5d757179759sm3497983eaf.8.2024.08.07.20.14.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:55 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 15/38] dt-bindings: exynos: Update bindings doc for DW MMC controller Date: Wed, 7 Aug 2024 22:14:21 -0500 Message-Id: <20240808031444.9619-16-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Update the bindings doc for Exynos DW MMC block to follow the upstream example and reflect the latest changes made in corresponding Linux kernel bindings. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) doc/device-tree-bindings/exynos/dwmmc.txt | 46 +++++++++++++---------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/doc/device-tree-bindings/exynos/dwmmc.txt b/doc/device-tree-bindings/exynos/dwmmc.txt index 694d1959162c..d90792be8599 100644 --- a/doc/device-tree-bindings/exynos/dwmmc.txt +++ b/doc/device-tree-bindings/exynos/dwmmc.txt @@ -12,7 +12,9 @@ SOC specific and Board specific properties are channel specific. Required SoC Specific Properties: - compatible: should be - - samsung,exynos-dwmmc: for exynos platforms + - samsung,exynos4412-dw-mshc: for Exynos4 platforms + - samsung,exynos-dwmmc: for Exynos5 platforms + - samsung,exynos7-dw-mshc-smu: for Exynos7 platforms (with SMU block) - reg: physical base address of the controller and length of memory mapped region. @@ -23,32 +25,38 @@ Required Board Specific Properties: - #address-cells: should be 1. - #size-cells: should be 0. -- samsung,bus-width: The width of the bus used to interface the devices +- bus-width: The width of the bus used to interface the devices supported by DWC_mobile_storage (SD-MMC/EMMC/SDIO). . Typically the bus width is 4 or 8. -- samsung,timing: The timing values to be written into the - Drv/sample clock selection register of corresponding channel. - . It is comprised of 3 values corresponding to the 3 fileds - 'SelClk_sample', 'SelClk_drv' and 'DIVRATIO' of CLKSEL register. - . SelClk_sample: Select sample clock among 8 shifted clocks. - . SelClk_drv: Select drv clock among 8 shifted clocks. - . DIVRATIO: Clock Divide ratio select. - . The above 3 values are used by the clock phase shifter. +- samsung,dw-mshc-ciu-div: The divider value for the card interface unit (ciu) + clock (0..7). +- samsung,dw-mshc-sdr-timing: The timing values for single data rate (SDR) mode + operation. + . First value is CIU clock phase shift value for TX mode (0..7). + . Second value is CIU clock phase shift value for RX mode (0..7). +- samsung,dw-mshc-ddr-timing: The timing values for double data rate (DDR) mode + operation. If missing, values from samsung,dw-mshc-sdr-timing are used. + . First value is CIU clock phase shift value for TX mode (0..7). + . Second value is CIU clock phase shift value for RX mode (0..7). Example: mmc@12200000 { - samsung,bus-width = <8>; - samsung,timing = <1 3 3>; - samsung,removable = <1>; -} + bus-width = <8>; + non-removable; + samsung,dw-mshc-ciu-div = <3>; + samsung,dw-mshc-sdr-timing = <1 3>; + samsung,dw-mshc-ddr-timing = <0 2>; +}; + In the above example, . The bus width is 8 - . Timing is comprised of 3 values as explained below + . Divider value for CLKSEL register is 3. The CIU clock rate will be + calculated as SDCLKIN / (3 + 1). + . SDR and DDR timings are comprised of 2 values as explained below 1 - SelClk_sample 3 - SelClk_drv - 3 - DIVRATIO - . The 'removable' flag indicates whether the the particilar device + . The 'non-removable' flag indicates whether the particular device cannot be removed (always present) or it is a removable device. - 1 - Indicates that the device is removable. - 0 - Indicates that the device cannot be removed. + Flag is present - Indicates that the device cannot be removed. + Flag is not present - Indicates that the device is removable. From patchwork Thu Aug 8 03:14:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817680 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675265wrt; Wed, 7 Aug 2024 20:17:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVDVfj6DUBJ1RgxbLBZWlmLkU8jqb7flMK9BhVMvnzGVSbsuCgWYOxwfK3PG76MBBC53vlk2oTTLhqOPLVT3jI3 X-Google-Smtp-Source: AGHT+IH67VwYT6ZkOEYx0QpZl8ov36V+89BC4q50sEfwjxn+b5Yhs1tTp1teAKc6ivaRHtqJwgmf X-Received: by 2002:a05:6402:4407:b0:5a2:5bd2:ca50 with SMTP id 4fb4d7f45d1cf-5bbb23dedd8mr411284a12.25.1723087073341; Wed, 07 Aug 2024 20:17:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087073; cv=none; d=google.com; s=arc-20160816; b=jYj1a906R/1jwErVPZvjg9duKAWLvSfy7yKDaIEX8pjNm0OeX82zdT6k9FdFqkL+me faqMd7LcneEeHeVO0/OsF39sFdHtDUKy4nhVDnRlEwiHsQYOCEov3HAlbJeGfYW3xYya W72FMVzZOUzlX081Hc6loMGbtCyfvVBOD8hEoSFN064wPY6IkXX+bMkyD9wgTpr78hNH M4jzi+xXEKflRKoJ4vT2WknLIdi2SN7FxMSQcPI3V6P6srkK1IGjyKsqtj/6HmNqN0ZY ihUqVolUnm5LwNjtN2s/DrHiX7tBPkvQIffjvXF2ne5ZwndbXJvFjWFBIbbpo4qlbO72 sThg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Vj5yOoYqRmk6ibwWr0LCEjUzXfYo7p7hgCs6F8uRp28=; fh=AVY6INam1ZtOxNpVoacXKbLYE/Ay4KtqR9qFeG4F84o=; b=pI6+IpeL41JGyvo616Guw0ktGeEavf2GEQdFeKSA7zLPqF6BnW9AMA4ZcRSCvtB/no ZojWRhmbSWKThRhmwmLf6iH1iiwOd2KvNCxLPcRoLEqsP7nyl3Bj0BI5O5rBdcDGZcOl fkDP15kXFO79ponO+mQ4MCeuvDgFjbofbUZKWbcHL72O7XBQY0TAwA/MS2pM6ESb0K0u Ct31nAPU15J1H2uYioU0WQ6zNJDYi/MnZZEC3w62wuS8Gvt6CUvI1XSTyBWV53ku5ls0 VzFKDEUJ/QhP8NateyosQWGU/E2sMxYVC/B7yNehdEtKUNVGa/PNOwgpXQ3nDc/ny8Sh doig==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="JoClWhk/"; 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-5bbb2e33d3asi241408a12.496.2024.08.07.20.17.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:17:53 -0700 (PDT) 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="JoClWhk/"; 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 90E4088A8C; Thu, 8 Aug 2024 05:15:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="JoClWhk/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 19BB68873C; Thu, 8 Aug 2024 05:15:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) (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 ABBEB8873C for ; Thu, 8 Aug 2024 05:14:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oi1-x22a.google.com with SMTP id 5614622812f47-3db23a6085aso264133b6e.1 for ; Wed, 07 Aug 2024 20:14:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086896; x=1723691696; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Vj5yOoYqRmk6ibwWr0LCEjUzXfYo7p7hgCs6F8uRp28=; b=JoClWhk/X4+PuBo1bD/wnJyAo++x/RvoIMrNShFjGL4CjAN9+P10rxrlN+/p2KbctQ jQpWV3R4D9AYgYjBdQNMnYo87f10w77pPPNyrLhLw5RB1Z4RKGuEFH1zI4kJSCUMxOU3 1OqFruLrGafOpitAp4WzdKyMwVOlMCFfaMaWe16IECHofMTxNKXwNUbyliE9Y6I7SIaW JY+yiLasSiHtIwh+c9dDyZ1gLtEUK3Z8m/1atMTFbilFTfKTXABK0udHyW3KwREvTK9X qTn+y3Ez62Z2ag5wjtO3uC7b8FlDM1e3mcv20EJoubM1tt8RvJrkitkM/Xu6YBtWV1PA S4UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086897; x=1723691697; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Vj5yOoYqRmk6ibwWr0LCEjUzXfYo7p7hgCs6F8uRp28=; b=R7BtjwR8vDEHv1lG4KzlSDjYtGOwDzUIm8SBGXT/+gyK4Q1zms/rxW+gKatVD0OLb3 MRzFIdeJY4PbzxOOEAHCT+q6FGcObX+ixQxiFhBrfC0pm3RvP7/vD03PHpATOupY5GEc xKm23gTAUoDXgXueqdZ1YKgG+G2NtcfnOaQUTlCReKtoxfHgZLvl/75qmfzb7mtkn1Tw m6+vd+Tm+ao+wHWBS2ETEAeb1ne0QxO8LstccrtMXtSvwJmZDCBAcwGy8NYIHRajAoe5 CyF+Yzl5EjLjj83iHFIh6rqutJCLj8X6d0gKnbvYAdsLVKeQHlSMpqeYou5Ur6NXIZiq m+dw== X-Forwarded-Encrypted: i=1; AJvYcCWSCZrVIxlGxuO0pecO1/csbmCDBp0LfFA1vWtG2hIhL+AErGz2erxxYffpdJrzWUn4lk2aw85Hvry8xkoEfvk56Od9SA== X-Gm-Message-State: AOJu0YzyQoYGi3ZSxaDEugIhp8CNOOKjJ98m8pBYUAvcPkLS0xJdS7GI 6JZWQU93QEFktRhLRVUKxhK0bSBxq7wnFDpCigXEtWJqy2Hjn8nRpRiwVFMh0zw= X-Received: by 2002:a05:6808:f0a:b0:3d9:3e6f:ba07 with SMTP id 5614622812f47-3dc3c160ca8mr103171b6e.3.1723086896715; Wed, 07 Aug 2024 20:14:56 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3db563b80b2sm4594283b6e.45.2024.08.07.20.14.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:56 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 16/38] arm: exynos: Add header guard for dwmmc.h Date: Wed, 7 Aug 2024 22:14:22 -0500 Message-Id: <20240808031444.9619-17-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 header guard to prevent possible build errors. Fixes: 77b55e8cfcee ("ARM: exynos: move SoC sources to mach-exynos") Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) arch/arm/mach-exynos/include/mach/dwmmc.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/mach-exynos/include/mach/dwmmc.h b/arch/arm/mach-exynos/include/mach/dwmmc.h index 59c28ed54c58..811e9a04c6e3 100644 --- a/arch/arm/mach-exynos/include/mach/dwmmc.h +++ b/arch/arm/mach-exynos/include/mach/dwmmc.h @@ -4,6 +4,9 @@ * Jaehoon Chung */ +#ifndef __ASM_ARM_ARCH_DWMMC_H +#define __ASM_ARM_ARCH_DWMMC_H + #define DWMCI_CLKSEL 0x09C #define DWMCI_SET_SAMPLE_CLK(x) (x) #define DWMCI_SET_DRV_CLK(x) ((x) << 16) @@ -25,3 +28,5 @@ /* CLKSEL Register */ #define DWMCI_DIVRATIO_BIT 24 #define DWMCI_DIVRATIO_MASK 0x7 + +#endif /* __ASM_ARM_ARCH_DWMMC_H */ From patchwork Thu Aug 8 03:14:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817681 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675307wrt; Wed, 7 Aug 2024 20:18:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU0xql/WcK8dl8umKYDGWXW9Bu+sEkNsO30+49qUQGMZYLkU/0uuKit+EW3H2sTFBVU5tS4agflU2UElNf5ygh4 X-Google-Smtp-Source: AGHT+IGVhIiQyGNdipmgLWnbEn7es3lO+/WP9d5kGyV5eckW9lJMDee8LSpM5wbe9f+hJkmMDy3G X-Received: by 2002:a05:6512:b2a:b0:52f:244:206f with SMTP id 2adb3069b0e04-530e58c6e65mr261413e87.53.1723087085099; Wed, 07 Aug 2024 20:18:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087085; cv=none; d=google.com; s=arc-20160816; b=NYeFZD/HJis/pehNu1Q/wYKgGV6/71A5Gg5cQO4EM4AsiAfhJ2uM1MhwHFBDSR4Q0P YzBUGa7zglH2Hyrn3jD76KClqpsRKlaiIpzjxAAOUdZpdO/4ENcgDT8rVbvq9o3g+yRL +WHVOoFA9EN/QrlCyODjnRXcdLaenTBEekI+jC2SPNelrLO5SXMLAVflCBMy1vO5zB41 dcpUklMs0yibxtCGv/fMCxF/6S8qhMlR0/2oOA556kI5MlhI9D2h31riY3T/+hd/RrtC rxyIfCp7Zpq2UcAQxpidftOI69VNyM5MfulDuJdC6y8WgXOJhi/OCNOqQ9EEeVSIPQbM flZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=W/Opz58k2M9Rm+jtv1QysddzT+5tlN71aNOiKrAKmsI=; fh=itBk0Ds0gbxWuj9uGwEll6wcjfYqiSpMEgTSGTvFOEg=; b=lDAMD8ndsSRJD2MmEDUZ2y+QLCRkPlFaoTINUMl5Og4MIytqIiqeqrjTeiKM8CYxP4 5825HOtvlCZ2nhIMZGfPAlKznrN0jAlmZyBerNczys1Ly02k1M+zrGJXDmAEHuYE58ug TMxoxa/vTdRoCmEKK9vWz1g8HNewQ+R+eoiTjSB6fV4wvbweRghMrb4/RJD0OZgqtM1P 7+t2yBUe1PpbBCzy0v2NzJfS2/B0/iqggqoxzwvbgPwjznKIRYrZ9QJnBAkYUjY09Z6o oATdTqTfpw0R/KxA0MvjSmg3JDJir7SkjbxKM2Rj1sV6OoZVDZLOtYsbw/sJ1wIgnDsx fOWg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OfsbG1QR; 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-5bbb2bf8cb2si263962a12.79.2024.08.07.20.18.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:18:05 -0700 (PDT) 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=OfsbG1QR; 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 30A5488B8E; Thu, 8 Aug 2024 05:15:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="OfsbG1QR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0DBEC88A7A; Thu, 8 Aug 2024 05:15:03 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oa1-x2b.google.com (mail-oa1-x2b.google.com [IPv6:2001:4860:4864:20::2b]) (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 7D92F88AFF for ; Thu, 8 Aug 2024 05:15:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-261112c303bso388187fac.1 for ; Wed, 07 Aug 2024 20:15:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086897; x=1723691697; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=W/Opz58k2M9Rm+jtv1QysddzT+5tlN71aNOiKrAKmsI=; b=OfsbG1QR8b2P9lNFp5eO5ziF6500ld4jBXmlrUgn951cTS9hi8jyh+AmjtC13T54vH ZuTcopshwkMxYmvwR3GqC9/vwvIiZzsT9nG4VD50vZh3pJPpYZFUk/Q3msaNFjdtif+O QSU8B2z6duu9YBa6LVcGoenwiexaiHcec8+fa5vnz8dkBFrFRCLP8byR4wkrNWTiYPyp 67rajmpEsY5MuXqu0quHlGKRn2bheMkoaEQYinP5sbFAAAjt0H8Ya4L1dxbRULVMFirC UJoQuYI7+lPNvEXxf6Q16K3d1iPbZYFJI9zcctRogF9CjiwIiuqGzQiqlq4EDnt2SPZ7 1fQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086897; x=1723691697; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W/Opz58k2M9Rm+jtv1QysddzT+5tlN71aNOiKrAKmsI=; b=wOKNArGQ9gk1f4q5JkIcCY8TpZFwSPWCWNwlnEwdEqRev/d6jjnQlOSbPZUj6j9yFR pVrs7tiqPmXMefENuRIPJaG9eF70QQvxrMvQZiDjsiGeHNyVtJvoBJ6Yg/iMDf4lLxit Hj5zqlQxoqJy2RWy3Li2duM3PUZhlh2dC6KJFIro5n8yC5ftYj34chbpr4+Nj9+CsfxC y8ZYltiw0r8w0VJLmQ1fbjcAufwv7EwRPomi24+vHeAYx9k6sGQ3wHAuhp2xMjSDJpSS EsS/fzeCQJsQFXv4VAayIJ7A768tmXlADaeVFdRgLomdLx2PE0FVLvmmRTWpixgNzb0x Evpg== X-Forwarded-Encrypted: i=1; AJvYcCWnXZu1KUN/viKQuHi6kuCYjx8pasTRIxOey2CtZzmCpxuhFfSxi55lLgF55tjlWqitCkafuvnJBFri5v/H1S6yQGjfLg== X-Gm-Message-State: AOJu0YxWg+wt19ssACJ9nfZv7SgtFF1kUdaU4T+LKIsXWaoB4GZPZHXr /ZZ4vQsBJ31CJBY+RujrgmXX9PdcunTHPInCGOFfXS+xrOC8S6r1VjURSza+yd8= X-Received: by 2002:a05:6870:b69f:b0:261:e19:4587 with SMTP id 586e51a60fabf-2692b61801cmr761131fac.6.1723086897413; Wed, 07 Aug 2024 20:14:57 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2689a2f2269sm4359925fac.14.2024.08.07.20.14.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:57 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 17/38] mmc: exynos_dw_mmc: Fix obtaining the base address of controller Date: Wed, 7 Aug 2024 22:14:23 -0500 Message-Id: <20240808031444.9619-18-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Getting the base address with outdated fdtdec_get_addr() API and further casting it to (void *) leads to next build warning on ARM64 platforms: In function 'exynos_dwmci_get_config': warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] host->ioaddr = (void *)base; Use livetree API instead (dev_read_addr_ptr()), which handles this correctly. Fixes: a082a2dde061 ("EXYNOS5: DWMMC: Added FDT support for DWMMC") Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) drivers/mmc/exynos_dw_mmc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index 377c9e6d90b9..a86d58663c1b 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -155,7 +155,7 @@ static int exynos_dwmci_get_config(struct udevice *dev, const void *blob, struct dwmci_exynos_priv_data *priv) { int err = 0; - u32 base, timing[3]; + u32 timing[3]; /* Extract device id for each mmc channel */ host->dev_id = pinmux_decode_periph_id(blob, node); @@ -173,12 +173,11 @@ static int exynos_dwmci_get_config(struct udevice *dev, const void *blob, host->buswidth = fdtdec_get_int(blob, node, "samsung,bus-width", 4); /* Set the base address from the device node */ - base = fdtdec_get_addr(blob, node, "reg"); - if (!base) { + host->ioaddr = dev_read_addr_ptr(dev); + if (!host->ioaddr) { printf("DWMMC%d: Can't get base address\n", host->dev_index); return -EINVAL; } - host->ioaddr = (void *)base; /* Extract the timing info from the node */ err = fdtdec_get_int_array(blob, node, "samsung,timing", timing, 3); From patchwork Thu Aug 8 03:14:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817682 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675355wrt; Wed, 7 Aug 2024 20:18:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV/62YlGay5A6oaBPprVLjU/JwI1+Q3aGb0w1VqAiyAXAVSEaR9WHtOClWGPbgQQ1o/ZBJjK+aRT/qvDpxiMa5+ X-Google-Smtp-Source: AGHT+IE5mWu7F8v/o9kfTOjB94t08v1m7i0budmtmylchJ2B1+gZsUsG0E+CbpcfsjCK54Dp40v2 X-Received: by 2002:a17:907:d862:b0:a7a:b73f:7584 with SMTP id a640c23a62f3a-a8090dae9eemr32155766b.34.1723087095538; Wed, 07 Aug 2024 20:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087095; cv=none; d=google.com; s=arc-20160816; b=culoXyQw9bJtBTP7ZAyjqkvINCJ7a+U4R5w4Vp6SMlzZcnCuh6LWkeOb+tcI6QK7WM Hd1jLVAggR9imXqtUYiQj/UbfmYIZjUjikvZInPdlegexqYMqKd0Ge56aJylunhhQ0+M +DSbpDQlh98khtG+8ft8vgIx9gCvC+MqpSVNzlUA0DFZyLHdbYlznYX5/mIvr9Q3uqKV W9LkMsl4IMryr+77JiMYl2HiscqQ6Enoe0ke+CEqqvpDJ4FOWPrhjND+xEfNHtNq5KdP a0nkwQefc264JO6eM7Y5FpOWZ6kmoqTmG0X5fuUKopLZSPEm1uKIVmk5rhmZY3zGasWo PZLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Kz94lu9Gp6TTEliC2UjCP43PfkTbwokeD+M420iZUXQ=; fh=yvl+kpBaVqMWB3peqLkJjcUxXsl/SmjtEu6CcNX2EV4=; b=lW9f+q5gb5De48m+fozFtGOx5zYrtiIcil6BHLHnH5vci6hObP8bKMiuDlqgSM8xY7 0Ti3gphxpyx/0g/cmTuL7zF9yBK44yDYOEItzpTNumt+iR0k1STAL3jTEw2QhZT6K7UB 0WW0Su6LD22jl9cONvDGvorWRdlT+pbTn9MGfL2GRSxNqVPJApj6zWOTV2iAEVUYZBiE +A3qbb9Ij5Tt7VEeezDiXyWxq0UNEPBRdqWMty7b5eqi39IcCggU8C9d4k/SC5ta/HTQ WrWLValHuxg1jyVPq7zRK0c8RcjXJCTr6tBahBnKwEMiOsp2pk5fr7wgEaFKa5n8Hvua UE3w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=InPJ+CcP; 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-a7dc9d66412si796329166b.290.2024.08.07.20.18.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:18:15 -0700 (PDT) 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=InPJ+CcP; 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 9F73A88B9E; Thu, 8 Aug 2024 05:15:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="InPJ+CcP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 788E988AE5; Thu, 8 Aug 2024 05:15:04 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) (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 9280C88B03 for ; Thu, 8 Aug 2024 05:15:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oi1-x233.google.com with SMTP id 5614622812f47-3db1657c0fdso417298b6e.1 for ; Wed, 07 Aug 2024 20:15:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086898; x=1723691698; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Kz94lu9Gp6TTEliC2UjCP43PfkTbwokeD+M420iZUXQ=; b=InPJ+CcPHRbNG/idGC8Jm8NpDaQdXuIbOzlARdtUYsyCy5BBKsWfIoBolMz/6Tg8a/ 9k9rogqgs5RxWyYVRWlRDVzpWPUuQN0ZhArhFXeLdU3bgGwUrWbxvr2a2iiYldva/CUx rOFIlRsUTdHAtbbNCI+zB54IBAQKvCjPlTnarrxVOYXMcsIDMr6/PW76/Bfc0BRhoieg voorpgyB70bxUDpgHvKO2d8Gxs+YeRfZ/jTCEPXV9wSQXdtx9c8wmbD2yDOPy+NTmmv5 D/O5uhJr8h+i6+EPDHc4JkgvaSS+1aSlqUGh3WRSoRWLSeqXIGZVI1TotzVF/mPyEf2B WabQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086898; x=1723691698; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Kz94lu9Gp6TTEliC2UjCP43PfkTbwokeD+M420iZUXQ=; b=FOHgod+AXNUhl6obrztFRVqGOgPElf/huFlvEQSKp/r5ULAv3aPlp/E+P2AtB7FEqi 1c8GzZt16P/Tw+AjRKUeAUIZO0UwYD+YtGMo6zK38mk99s9MYErMLiwJdeLfUQCn0K6/ 1qA+PMKEY9UnLpFCQ6+ChQySocR7JoB1+urDqREYXFEGxwxWtSkdtPIC8IlXF3X+hjGV LaWgfPsHaGP+SpUYe2P/oKmzzkMnv+NN8MrY0jn9vzJqPNG7levxClMUjN8o1ZSe8Gon Wj1KZitOA4Wvk8vmKyFMmmS5wBnoHtMoU9LD6EMaOSOs13SSde/zUOS/xnlVly8YLw+4 h/Bg== X-Forwarded-Encrypted: i=1; AJvYcCUVEzDjiiClc1YYH2Yp9EcgowK0xeta3yLTNOhXeKlGIZqvfUoPh+QfNLH9oTezrVcXfECh7CbWzZjEnMire+fbh6M1UQ== X-Gm-Message-State: AOJu0YyAqWY1cTrkYVLpkTmsGTgKToA32hv2Z9gpkbSpBWXN43NOMQbD HdwsXnKenNI7kz+kku/Ncw1GChzXMRR9Rigw0MWaZZVNTe8jEp2mjQz5rcHN0+g= X-Received: by 2002:a05:6871:b21:b0:261:1fdc:494a with SMTP id 586e51a60fabf-2692b6a54c5mr778607fac.21.1723086898130; Wed, 07 Aug 2024 20:14:58 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2689a2f2b2asm4339525fac.16.2024.08.07.20.14.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:57 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 18/38] mmc: exynos_dw_mmc: Fix getting private data in exynos_dwmci_board_init() Date: Wed, 7 Aug 2024 22:14:24 -0500 Message-Id: <20240808031444.9619-19-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 In case of CONFIG_DM_MMC, host->priv actually holds (struct udevice *), and not (struct dwmci_exynos_priv_data *). This makes *priv pointer invalid and may lead to Synchronous Abort during its dereference later in exynos_dwmci_board_init(). Fix it by extracting exynos_dwmmc_get_priv() helper from exynos_dwmci_clksel() and using it for getting the private data in exynos_dwmci_board_init() Fixes: 3537ee879e04 ("mmc: exynos_dw_mmc: support the Driver mode for Exynos") Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) drivers/mmc/exynos_dw_mmc.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index a86d58663c1b..aa542c13fea8 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -41,18 +41,24 @@ struct dwmci_exynos_priv_data { u32 sdr_timing; }; +static struct dwmci_exynos_priv_data *exynos_dwmmc_get_priv( + struct dwmci_host *host) +{ +#ifdef CONFIG_DM_MMC + return container_of(host, struct dwmci_exynos_priv_data, host); +#else + return host->priv; +#endif +} + /* * Function used as callback function to initialise the * CLKSEL register for every mmc channel. */ static int exynos_dwmci_clksel(struct dwmci_host *host) { -#ifdef CONFIG_DM_MMC - struct dwmci_exynos_priv_data *priv = - container_of(host, struct dwmci_exynos_priv_data, host); -#else - struct dwmci_exynos_priv_data *priv = host->priv; -#endif + struct dwmci_exynos_priv_data *priv = exynos_dwmmc_get_priv(host); + dwmci_writel(host, DWMCI_CLKSEL, priv->sdr_timing); return 0; @@ -82,7 +88,7 @@ unsigned int exynos_dwmci_get_clk(struct dwmci_host *host, uint freq) static void exynos_dwmci_board_init(struct dwmci_host *host) { - struct dwmci_exynos_priv_data *priv = host->priv; + struct dwmci_exynos_priv_data *priv = exynos_dwmmc_get_priv(host); if (host->quirks & DWMCI_QUIRK_DISABLE_SMU) { dwmci_writel(host, EMMCP_MPSBEGIN0, 0); From patchwork Thu Aug 8 03:14:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817685 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675451wrt; Wed, 7 Aug 2024 20:18:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV8l5p58wW9qiaSxTAJDk+iRDo7Lz7RHS+GgGhWC9XZrQuzaCzTW8gIdiE+wzavLGJF5pBdrqVqg0nvO1NnrC+d X-Google-Smtp-Source: AGHT+IHAC0UkdOdcgWHNg0eypf2mM/THUbRpY0EIfs1qQYvL85LXYqWKCWD6cqnItKPzdkIbSdO9 X-Received: by 2002:a17:907:f149:b0:a72:4320:19f3 with SMTP id a640c23a62f3a-a8090dae705mr33489966b.39.1723087125844; Wed, 07 Aug 2024 20:18:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087125; cv=none; d=google.com; s=arc-20160816; b=o8E6vZAgorubav31ErDzbvX+rcAM9+GFeyv8uAp+75QlLw4O0jL1Jugn8U+K150FOQ /b73wEE+ehfGOTJuJbmn/BizoepEbvsxDy0dVFrvJwqGw7wlJxk+Cxa7/XrWHEQ527MZ KeT2KpLLDgagELTvh0dzRcP6au20Ai9fJGBSSRSOGEZ5yUYFIUs5v2IrR2iUDLSPB+61 s/X8pB0PJyCoUdYEa/CvvN2Zsfa8tPPR4b2Q6uTlnz0Gn558/uSOCxlvMk1cqZF+YVXk Wa0gRcBCOcTAMOtVm9e4BhDJ0JVeYU74NUSzZlvLHbCbFLygaatvxLSBxmzwm2QZN60w Y3dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oGSehZbyVmfZFJWsa6AwvbuNwM7MFiH8p2cT6TnAGUM=; fh=TrU5+750c6rhbBCHnR2k9jocOvCFdUCFMgyoLF8E7e8=; b=DKfdBISiE/96Trgkojd5eNdnT79HDcL7hl6Ohp7LEdFN+A9K7KeZxhasaaab0SM5KC WHojSfVI4QE6hKNSuYLOVyxzOAYOceh3YpRBYJZeRPsFfqTo4U/5Nbanrj/jsqJudmNm 3TDgu50N2wKmpSgbRC6HDsVFrjO4hpDVMgyQTT3AIOw9rY4w0VrfkI/AJLTRpyCv3FOe gczRSSjkLuGhfkQBM66/VyZ3IHOqSco4THI3prwVaoCgTmswc/oVfkyhFzb3fcJa4tD4 ICxq6/FSxg3oSUjPYEeAlpVlnbXXkGysyYwwYndnZvE7tN9dvMm9h2jx4wYculOzGbmZ QVvg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y+gxXCXN; 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-a7dc9f6a4f4si719559766b.1035.2024.08.07.20.18.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:18:45 -0700 (PDT) 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=y+gxXCXN; 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 0E23888B86; Thu, 8 Aug 2024 05:15:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="y+gxXCXN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D027488AEA; Thu, 8 Aug 2024 05:15:05 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oa1-x32.google.com (mail-oa1-x32.google.com [IPv6:2001:4860:4864:20::32]) (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 05DDC888BC for ; Thu, 8 Aug 2024 05:15:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-267b7ef154aso367214fac.0 for ; Wed, 07 Aug 2024 20:15:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086899; x=1723691699; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oGSehZbyVmfZFJWsa6AwvbuNwM7MFiH8p2cT6TnAGUM=; b=y+gxXCXN9vUzbCcB4oD9gicjifJ4alU4yCYwE38NuvTLtyOnW12zTyhIrPLRKr4jRJ igfppADyftY8sBn/h/HXOMQDfSdhoboz2KxehZqpxJIfi2+UHfAoJ6V9j5VSFKr3iNy8 UNnbg/uZMRpYTw7Ltk6ImZgF5Rh5OFgLioghsdIc4HVT+VSEEzfnrNs1hfP/IXCIaZ/M 78x1S40rCFmGZDvbHPJFPQrGon7lfA1oTI4UJj/H7Yyv5H4MYojiUHbUzzfdVNRbrSMk 4fHdIix4nV0ktEiXJzgiyWij9XJ502f+E0isvTExaC8SYLR4YRu47wGYcjDT7Q/ZRXvs 0Wdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086899; x=1723691699; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oGSehZbyVmfZFJWsa6AwvbuNwM7MFiH8p2cT6TnAGUM=; b=b5mgWZty8IHMhpeyagI/yHWvksBggoDynJVy9CbeqjoyQskby3bDnI8MyFiIqOTspx Aqo5tS7RwPCDLFGygdlqa9MGl05WZQYXUxXrx3o5mUnITIS4hzr3gxmXYB+Qe1Q0+xYB QbYNvXAS3sO2kYCU3I/tG60GkT6XeSrKx1TUnuW6e/GVZk3j8gzHzx5hZ69wmRpVownn 5FfsrZuVDqyMC/EdYpzrmtwSFjXLJMJZ3khYU73TTPUWKetwgAmDznTx0tqm53Z1M/b5 nRNZSLL1lk7b+r2jGVBOK7VMIvJ7v3PHs9WrMw5JhVt9cYoa9GeWbdf1RS9prUMFWcCE VVlg== X-Forwarded-Encrypted: i=1; AJvYcCUUOae1pMK4vQDaNYTOAvP0aTUUd+LNh3hJj/GREPhVPLmWDBjDIo3uA/a9Vr21he4Dc23Jdp0g7D+Bk8K8i9dTmw39wQ== X-Gm-Message-State: AOJu0YwQVKTDPzhk37DK6r/bOHBcKX6dxr1/QCsvg0j39+StaR4sglGS hMQ5aL354vMJgqQ4z4Z80NyG/C6h26c6bQmUyc6VvvOcWY8UispNJPcxr+cAudY= X-Received: by 2002:a05:6870:8199:b0:268:952b:d2a4 with SMTP id 586e51a60fabf-2692b7ba256mr551343fac.32.1723086898850; Wed, 07 Aug 2024 20:14:58 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-70a3a773c4fsm5127951a34.78.2024.08.07.20.14.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:58 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 19/38] mmc: exynos_dw_mmc: Don't call pinmux functions on ARM64 chips Date: Wed, 7 Aug 2024 22:14:25 -0500 Message-Id: <20240808031444.9619-20-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Pinmux configuration on ARM64 platforms must be performed during startup in pinctrl driver using info from device tree. exynos_pinmux_config() and pinmux_decode_periph_id() are only available on ARM32 platforms, so don't call those functions on ARM64 platforms. Instead of the latter function, use "non-removable" property from device tree to derive the dev_index value. This fixes next linking errors on ARM64 platforms: ld: drivers/mmc/exynos_dw_mmc.o: in function `exynos_dwmci_get_config': undefined reference to `pinmux_decode_periph_id' ld: drivers/mmc/exynos_dw_mmc.o: in function `do_dwmci_init': undefined reference to `exynos_pinmux_config' Fixes: a082a2dde061 ("EXYNOS5: DWMMC: Added FDT support for DWMMC") Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - Replaced CONFIG_IS_ENABLED() with #ifdef drivers/mmc/exynos_dw_mmc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index aa542c13fea8..ed2752391603 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -144,6 +144,7 @@ static int exynos_dwmci_core_init(struct dwmci_host *host) static int do_dwmci_init(struct dwmci_host *host) { +#ifdef CONFIG_CPU_V7A int flag, err; flag = host->buswidth == 8 ? PINMUX_FLAG_8BIT_MODE : PINMUX_FLAG_NONE; @@ -152,6 +153,7 @@ static int do_dwmci_init(struct dwmci_host *host) printf("DWMMC%d not configure\n", host->dev_index); return err; } +#endif return exynos_dwmci_core_init(host); } @@ -163,6 +165,7 @@ static int exynos_dwmci_get_config(struct udevice *dev, const void *blob, int err = 0; u32 timing[3]; +#ifdef CONFIG_CPU_V7A /* Extract device id for each mmc channel */ host->dev_id = pinmux_decode_periph_id(blob, node); @@ -174,6 +177,12 @@ static int exynos_dwmci_get_config(struct udevice *dev, const void *blob, printf("DWMMC%d: Can't get the dev index\n", host->dev_index); return -EINVAL; } +#else + if (dev_read_bool(dev, "non-removable")) + host->dev_index = 0; /* eMMC */ + else + host->dev_index = 2; /* SD card */ +#endif /* Get the bus width from the device node (Default is 4bit buswidth) */ host->buswidth = fdtdec_get_int(blob, node, "samsung,bus-width", 4); From patchwork Thu Aug 8 03:14:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817683 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675389wrt; Wed, 7 Aug 2024 20:18:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUT0VoefpjSvvTElWYIMwYpkfbljfb5RMYAVbSkHvrm9vo7HMPXAVrW5VBDzzYBhAOOIMJS+w==@linaro.org X-Google-Smtp-Source: AGHT+IFnA5hP5oawl003yIMuUFK4xED84PCGBcDp5pWLZS7mPs1fhW84EaMfUM6JpHhgRGOU9V8Q X-Received: by 2002:a05:6402:27cd:b0:5ba:83d:3294 with SMTP id 4fb4d7f45d1cf-5bbb21f3804mr417608a12.2.1723087105529; Wed, 07 Aug 2024 20:18:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087105; cv=none; d=google.com; s=arc-20160816; b=mrPgCVBciD8Mom3bUuZgI6vveXcAosMXWqbqvFFTiPqy7IDiXt5Ck8Hwh2YL8HxEJj RHqle6KXiNz+Ixf8MFWWOWJw2yiGQSLDzEUMO5ZXZV1KK+1cjptBcirxWFfLyRHC+1G7 LaSkEkq7/Y/07qs9xGh8KJnE/NaWl49HQ1HLOGMvR/3Sue6h3KkekgUbyG9YYuv1WJ1p /3hxI5R7gRFbDHQmPQiWkMH5wH/MFUFe8rFVVt9kg35Femq7LO7ceQ6lMD7S9wUoUAMJ lMb8pKnLASuIVgR8BVnadClhvC54UZLenJX8IMY3kwAG1y6sLnEqpVZ7XC/zduX2GHtC vsMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ukmMu5LRhdgC+46ZyoYi+TUcr7hLYbVhOVtZ/x46Yl4=; fh=6hxdks5XmdZie09wGPORNUrjBuvtLGJC/OOKqa/y48A=; b=IzbGaSwN7/UslwozNDq1SC9hz59ag6ntj1JHoyshsl6xirp4DQVx5k+K2ebrRhAIYQ RxoYKn/zCG66k6gA2l3kavYZj7s3NH2FNcRaiMaoAeUf748gbIC5/zS/8HfKzj6btmQU oMQPRFm3Vov2amk+spAqjF3eUqkkbdWBHbiCiN35Y+cAXdJJDdUThYdAjXVjmhCe5qAr QXdE64H94rQvMXVi8kl3sBKLPPQesMbNvjGFePRC6OFlwm/8ElHezDSdX+N8SqgemPec lFL88hwmGx6xzSo8FNmY9RH0CXk7atxRak245ybVScLlTp0XKaBBlIfP5hcMa9uyBoKx qqeg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bI4gKXgl; 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-5bbb2d3d759si236919a12.507.2024.08.07.20.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:18:25 -0700 (PDT) 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=bI4gKXgl; 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 186CF88BAB; Thu, 8 Aug 2024 05:15:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="bI4gKXgl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E71AE88B0E; Thu, 8 Aug 2024 05:15:04 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oa1-x30.google.com (mail-oa1-x30.google.com [IPv6:2001:4860:4864:20::30]) (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 42B968873C for ; Thu, 8 Aug 2024 05:15:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-260e1b5576aso381867fac.1 for ; Wed, 07 Aug 2024 20:15:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086899; x=1723691699; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ukmMu5LRhdgC+46ZyoYi+TUcr7hLYbVhOVtZ/x46Yl4=; b=bI4gKXglinr7HejNoIP4C1ZFc+CgLBJ3vGmB0dZ4jOZ2HwaD9e7rXAGlRqod7IkzyZ bIKdmnx8CPe0NG2u0Mt4hDRyHsIEDEQh0q6unV5YH2Wlu+SqNks6BfNU5JI31T4QufNk 5kV4FrEJoI7LFuw+nmMStZmK0+jkdBQq4HLteWdu6fVarNrGgMqVeA5XXBkElQCGcsfh HaW8CJi5TXxYVIsHQAWdwtd1rpszSs3M22iWCbHDWz4r5obJh9T9Y7e9P261c1NvA/GA Vafe42lJCcQzNwWYOblNGJ1b/npvCZLE5sfkJ3IcKqWuTAIJwULUh8B5k7pdZIufBaOe aoyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086899; x=1723691699; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ukmMu5LRhdgC+46ZyoYi+TUcr7hLYbVhOVtZ/x46Yl4=; b=FTyY9Aspg3TY2CzMiHaYuNUamwEM99vp0TUPjo4WYTwRZO7Fad2WGGjVkRrbfKFpqM LRWCMtbatuRC0NJLPJGI7zgVUHi1yfGIzze4PSsYHWO520SVu0YZCaliYa04bl4nfhDa M9yZ6Ac+FsGxgza3Q+tnOACnaiSwTL7NvtTDh0pOuC2kM6UxI4WGsI1z+JRa+TB648zT UQDanTWnAV05/+fnrZJdErFEPBmRJlwuXF4Gw+v978+FoRhKJ7Qc9qxb8dMEWGu0KYbm YzkifqM0XiGOC54PFq8ctcOFETxlvezHEFLrh4UZsd85aUqfD303WlAskgV47nKPSA0A yukw== X-Forwarded-Encrypted: i=1; AJvYcCX+lURhMI+L79xPyUpF8vQ8vKbh8GWlf9Gos05ZE0ky4ep2VB9KcmeQrJbxlgiC/rvr/BpNy/g=@lists.denx.de X-Gm-Message-State: AOJu0Yy+uj7L5sm9qZ4JB69oZI7cXqY5nVPscHV4ew9nvaxFIA+1tEej 15GgEsbaYM/QXhFwdfmwRtGNY7vL0ksNCs2Y9YUO/iPjDthZDpOFOSFRvzUzaVs= X-Received: by 2002:a05:6870:d88c:b0:261:7b0:9d66 with SMTP id 586e51a60fabf-2692b82466bmr635063fac.50.1723086899521; Wed, 07 Aug 2024 20:14:59 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2689a2a4cb8sm4336743fac.3.2024.08.07.20.14.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:59 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 20/38] mmc: exynos_dw_mmc: Obtain and use CIU clock via CCF API Date: Wed, 7 Aug 2024 22:14:26 -0500 Message-Id: <20240808031444.9619-21-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 New Exynos chips should implement clock drivers using CCF framework. In that case corresponding CCF functions can be used to get/set the clock rates. Moreover, already existing get_mmc_clk() and set_mmc_clk() calls are only implemented for CONFIG_CPU_V7A (i.e. ARM32 chips). In case of ARM64 chips that config option is not defined, so build will crash on linking stage, with errors like these: ld: drivers/mmc/exynos_dw_mmc.o: in function `exynos_dwmci_get_sclk': undefined reference to `get_mmc_clk' ld: drivers/mmc/exynos_dw_mmc.o: in function `exynos_dwmci_set_sclk': undefined reference to `set_mmc_clk' Fix that issue by using CCF clocks API on ARM64 platforms for getting and setting the source clock (sclk = SDCLKIN = CIU) rate. To implement this, first extract the existing ARM32 clock control code into helper functions with more generic signatures to abstract getting/setting the sclk rate. Then add CCF clock support to those functions for ARM64 platforms. Fixes: a082a2dde061 ("EXYNOS5: DWMMC: Added FDT support for DWMMC") Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - Replaced CONFIG_IS_ENABLED() with #ifdef drivers/mmc/exynos_dw_mmc.c | 87 +++++++++++++++++++++++++++++++++---- 1 file changed, 79 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index ed2752391603..4d28ede0d756 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -4,6 +4,7 @@ * Jaehoon Chung */ +#include #include #include #include @@ -15,6 +16,7 @@ #include #include #include +#include #include #define DWMMC_MAX_CH_NUM 4 @@ -38,6 +40,7 @@ struct dwmci_exynos_priv_data { #ifdef CONFIG_DM_MMC struct dwmci_host host; #endif + struct clk clk; u32 sdr_timing; }; @@ -51,6 +54,61 @@ static struct dwmci_exynos_priv_data *exynos_dwmmc_get_priv( #endif } +/** + * exynos_dwmmc_get_sclk - Get source clock (SDCLKIN) rate + * @host: MMC controller object + * @rate: Will contain clock rate, Hz + * + * Return: 0 on success or negative value on error + */ +static int exynos_dwmmc_get_sclk(struct dwmci_host *host, unsigned long *rate) +{ +#ifdef CONFIG_CPU_V7A + *rate = get_mmc_clk(host->dev_index); +#else + struct dwmci_exynos_priv_data *priv = exynos_dwmmc_get_priv(host); + + *rate = clk_get_rate(&priv->clk); +#endif + + if (IS_ERR_VALUE(*rate)) + return *rate; + + return 0; +} + +/** + * exynos_dwmmc_set_sclk - Set source clock (SDCLKIN) rate + * @host: MMC controller object + * @rate: Desired clock rate, Hz + * + * Return: 0 on success or negative value on error + */ +static int exynos_dwmmc_set_sclk(struct dwmci_host *host, unsigned long rate) +{ + int err; + +#ifdef CONFIG_CPU_V7A + unsigned long sclk; + unsigned int div; + + err = exynos_dwmmc_get_sclk(host, &sclk); + if (err) + return err; + + div = DIV_ROUND_UP(sclk, rate); + set_mmc_clk(host->dev_index, div); +#else + struct dwmci_exynos_priv_data *priv = exynos_dwmmc_get_priv(host); + + err = clk_set_rate(&priv->clk, rate); + if (err < 0) + return err; +#endif + + return 0; +} + /* * Function used as callback function to initialise the * CLKSEL register for every mmc channel. @@ -68,6 +126,7 @@ unsigned int exynos_dwmci_get_clk(struct dwmci_host *host, uint freq) { unsigned long sclk; int8_t clk_div; + int err; /* * Since SDCLKIN is divided inside controller by the DIVRATIO @@ -77,7 +136,13 @@ unsigned int exynos_dwmci_get_clk(struct dwmci_host *host, uint freq) */ clk_div = ((dwmci_readl(host, DWMCI_CLKSEL) >> DWMCI_DIVRATIO_BIT) & DWMCI_DIVRATIO_MASK) + 1; - sclk = get_mmc_clk(host->dev_index); + + err = exynos_dwmmc_get_sclk(host, &sclk); + if (err) { + printf("DWMMC%d: failed to get clock rate (%d)\n", + host->dev_index, err); + return 0; + } /* * Assume to know divider value. @@ -107,19 +172,19 @@ static void exynos_dwmci_board_init(struct dwmci_host *host) static int exynos_dwmci_core_init(struct dwmci_host *host) { - unsigned int div; - unsigned long freq, sclk; + unsigned long freq; + int err; if (host->bus_hz) freq = host->bus_hz; else freq = DWMMC_MAX_FREQ; - /* request mmc clock vlaue of 52MHz. */ - sclk = get_mmc_clk(host->dev_index); - div = DIV_ROUND_UP(sclk, freq); - /* set the clock divisor for mmc */ - set_mmc_clk(host->dev_index, div); + err = exynos_dwmmc_set_sclk(host, freq); + if (err) { + printf("DWMMC%d: failed to set clock rate on probe (%d); " + "continue anyway\n", host->dev_index, err); + } host->name = "EXYNOS DWMMC"; #ifdef CONFIG_EXYNOS5420 @@ -230,6 +295,12 @@ static int exynos_dwmmc_probe(struct udevice *dev) struct dwmci_host *host = &priv->host; int err; +#ifndef CONFIG_CPU_V7A + err = clk_get_by_index(dev, 1, &priv->clk); /* ciu */ + if (err) + return err; +#endif + err = exynos_dwmci_get_config(dev, gd->fdt_blob, dev_of_offset(dev), host, priv); if (err) From patchwork Thu Aug 8 03:14:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817684 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675414wrt; Wed, 7 Aug 2024 20:18:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUer8FyP1DmgVst3Mi1oI4A48HKpZiKe+Ckvt1IhX2YNY9h12pbNzL57Mu8OFSMBZr7QIMNfRaEgxpiPlipNnVe X-Google-Smtp-Source: AGHT+IEtshd5rnwq+NfWxRun3JEGQW88yY6l2JcFhJz61XPtJHQzIf2H4/Xm5gE77Xt2yHot4Xo0 X-Received: by 2002:a05:6402:3509:b0:5a2:abcb:c4cf with SMTP id 4fb4d7f45d1cf-5bbb21eca39mr463355a12.22.1723087115561; Wed, 07 Aug 2024 20:18:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087115; cv=none; d=google.com; s=arc-20160816; b=s/4DqHqlmqA9ag4yYC/YcaxZCtMXaev9Fihn8upiMilG9ANwEk8/oOqJYOFD8sFC6m vHNWIUZ580adkHB0Lk6fxjG2XRqgsQdecBkidjR75/UtdMBLiMOFveYLZ+ZEipi7qkxa ByVMY7Vsu26/Wl/Xj4NjRBG9/tAWzqFeadjenMK5MdmmBVyMGakBz6dAQ/wO+0+incMc 3lJLRqklPAie8A6LlCZ29osQAXecOqiuy3jUwyf0wzNfDTgplj8WB+VPa7UVgLGCBB71 /kgbmYxU0T1ILEIbHsvimFAJmL4pgcGGjaRab+js5KAeSZTrVqPfggtX8DxD4xA2bZkX fFHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sgGukJlNcf0K2Z5Fvf+KW1N0Z6A0j+D44vCIr+vTCLw=; fh=Gu/9pttbmlIRQd69BIO50p1StjsFUPNUddBtmcOaLtw=; b=SY/U93kOxVY/dO+mrVgRWNSd2HRYW3cm8UTM0RTstaUDFYZ4IK5p9Es412l1DCtrxH gccMpOeOctSE45HRzFfpZXOhWZ6jziCgxeMTHvzfNj+scbOa5BQsEkyJS0pclj1x7u3J y62OcoA/EGHeF/LuduTdA0mEFBSIqe7Po5ChGtKz32loIo0bbfjNdpDHhSApoHNdik8K fLK28ZBiW2uKKYtGbn7onew+6lhKo16MXYdFV8oF1DwJi65aJfA6SVANbDVyFbzEYftb kgP6Om+G8fUjYN9rF4OjfipNvgPnU6016hwIJLb1WYq90O6pF08wdZigsz4LQVhwluk8 sC9w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="LTh/Ngcy"; 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-5bbb2e38d77si238100a12.577.2024.08.07.20.18.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:18:35 -0700 (PDT) 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="LTh/Ngcy"; 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 9F3D188BB4; Thu, 8 Aug 2024 05:15:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="LTh/Ngcy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0CFC68873C; Thu, 8 Aug 2024 05:15:05 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) (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 E574988AE0 for ; Thu, 8 Aug 2024 05:15:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-3db16129143so366302b6e.0 for ; Wed, 07 Aug 2024 20:15:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086900; x=1723691700; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sgGukJlNcf0K2Z5Fvf+KW1N0Z6A0j+D44vCIr+vTCLw=; b=LTh/Ngcy7ysNebxg0QgMXCb0nSYslRPxuOz8GNXbc+icnFkwLUBUcHYDR5cnUSexez uaD7i6tmHVqcj6Mwc47kGw87x9pxRWx6WWTJ6IPTIpssYl5rvx62labta6w/a3pths3B fGK0A0YL0yh3h/uKTUh6cGKdjB3N53bqr6ikP7jgLLElPGjFOCrpnrIbieGKx8TYimwM Ywnw7xMvVCM97S1FmK2Te+9pP5mbOeHBs0pizAysm3sRPBueviAfNmf1TBWWOBdV7jlg WasDERjmwARG+JIuMnkjiszapXjZ031Z1SGqBNV7LFFAXnCI9J8QQHet+PqzKSiBMr/0 c5kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086900; x=1723691700; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sgGukJlNcf0K2Z5Fvf+KW1N0Z6A0j+D44vCIr+vTCLw=; b=rTPKnJ4wSmR17YE0H2mc7pEmspIEvMVtL3cKBcWVLEuE3Qtpc+QKM7M6ZyxsE17bO/ OJAyvjEHI8GPlWR7skBH4dpkXnosptD5lLz1/Y/4x4X+R73WwiIWUef+5LGGhbw1sfTP NMXPJyNJtSha4JM+7drNMXJLCaLqYClSHGmeKQVM3vV9BP1J1Cg0Jq/+AV8UHsJbymKx ikc4zGKBKHpqoskx7MVi3sNeEd8ZEWtwyrHlUpD5F5gaSwZKyJAgW7r+txJT0Iw87Nqg yoOBRRgtHKa00/RKgtkKP5V+D4UjpbFLmHjq+5873aN8Z6khG8Ph6BpeumtAveigxDZh scnQ== X-Forwarded-Encrypted: i=1; AJvYcCWDpMQKKCielbTzsr3zWyoHwfEFVTaCUjMaUsYymeQNyKJqsIugxNQzLRgH1LmnZwxmsSH5kZPDhhtJk4kLr1G7jPiZ3Q== X-Gm-Message-State: AOJu0YwM7RGy2/0h5KdEkA3ArN+YqVzVl1vnM5HBRBwZJdBupJ0wpiwc +76yJ5PbAAt+ubo+hY/6WVudOW4wW7M20wDyXPHKg5rujsKW7XtMxoNNbZPLF4U= X-Received: by 2002:a05:6808:13d2:b0:3d9:2b24:5b2 with SMTP id 5614622812f47-3dc3b1c4ad0mr744092b6e.0.1723086900335; Wed, 07 Aug 2024 20:15:00 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3db56361b99sm4612825b6e.11.2024.08.07.20.14.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:00 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 21/38] mmc: exynos_dw_mmc: Use .of_to_plat for device tree parsing Date: Wed, 7 Aug 2024 22:14:27 -0500 Message-Id: <20240808031444.9619-22-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 exynos_dwmci_get_config() is called from the probe function and used to read data from device tree. Make use of .of_to_plat driver callback instead, and convert exynos_dwmci_get_config() to match its signature. No functional change. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) drivers/mmc/exynos_dw_mmc.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index 4d28ede0d756..09a59fdf0120 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -223,10 +223,13 @@ static int do_dwmci_init(struct dwmci_host *host) return exynos_dwmci_core_init(host); } -static int exynos_dwmci_get_config(struct udevice *dev, const void *blob, - int node, struct dwmci_host *host, - struct dwmci_exynos_priv_data *priv) +#ifdef CONFIG_DM_MMC +static int exynos_dwmmc_of_to_plat(struct udevice *dev) { + const void *blob = gd->fdt_blob; + struct dwmci_exynos_priv_data *priv = dev_get_priv(dev); + struct dwmci_host *host = &priv->host; + int node = dev_of_offset(dev); int err = 0; u32 timing[3]; @@ -286,7 +289,6 @@ static int exynos_dwmci_get_config(struct udevice *dev, const void *blob, return 0; } -#ifdef CONFIG_DM_MMC static int exynos_dwmmc_probe(struct udevice *dev) { struct exynos_mmc_plat *plat = dev_get_plat(dev); @@ -301,10 +303,6 @@ static int exynos_dwmmc_probe(struct udevice *dev) return err; #endif - err = exynos_dwmci_get_config(dev, gd->fdt_blob, dev_of_offset(dev), - host, priv); - if (err) - return err; err = do_dwmci_init(host); if (err) return err; @@ -335,6 +333,7 @@ U_BOOT_DRIVER(exynos_dwmmc_drv) = { .name = "exynos_dwmmc", .id = UCLASS_MMC, .of_match = exynos_dwmmc_ids, + .of_to_plat = exynos_dwmmc_of_to_plat, .bind = exynos_dwmmc_bind, .ops = &dm_dwmci_ops, .probe = exynos_dwmmc_probe, From patchwork Thu Aug 8 03:14:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817686 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675500wrt; Wed, 7 Aug 2024 20:18:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU4nCv6HjszTczTGV/Ui3X+6KE9MloLqObgHQ1TTam61gNpekVMWQZPijO80gq6tZVcfwwNXu0NkdLP29lC0bnK X-Google-Smtp-Source: AGHT+IEJV5p2BzLaFxTDgA5gA8EucSHXutLMlGQ5jjsuuFU9x/sMidOl6k3zAdFudP/X10w2AJI9 X-Received: by 2002:a05:6402:208a:b0:5a1:6c50:a35 with SMTP id 4fb4d7f45d1cf-5bbb2411412mr392448a12.37.1723087135804; Wed, 07 Aug 2024 20:18:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087135; cv=none; d=google.com; s=arc-20160816; b=ABISl5Rr44kG6rO3u5wAERVoIXuL/EYHhT20pSLZrQf1Q1Sebglr13DzSHZtRHKL/C IK8Y3Mn0IZtRme6IiqBNK/+vVKgTavCjPky2o46XjsEu0KFczm7oMZENb2aZehzk3oWp j8Hf/l7oWJCyMSiGHKdAgSEfNCRQNSRe9mEF7MsSZZnMslnlE+hgatuB/JQuPrXjGbZq cNOUBPfnDrEbcQBPR0gkqO+JBW+REqTjoxLaxx++FH3/92heTKWq635OiDEFz26bkeEw cE7clpRLQUj89Ii+paOUsCeQWGgb5K4OPhZNIkmLvcdNFPindGEF0yU1A0JWcmtswPdz 7GiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jac/AK+/fRXX6frGsgkwuddOiwt75cCMUFZhhfIW9h8=; fh=lBtoWRjFntcnUbTK3mJKNUtiHNRKMTvShzSVX7EwD9Y=; b=PimohJEhamEX20cNs+KC2Y75nextJ11xSA9qNm5lYw/Nt3OBCGfVMtygGeE1fnoOlH h8gj2bLFVVnUU8EwFRSZtuj5d+iHNwuNCEwawHYp3TQv4EVGhCxK9DJegln1hG8TtWbV eTkbMMezQjXWjuPwSnAlUDdRjMGDJGFHK1tgqot4WnuBC16ld0WFhOf3/mYJKwCXWxiC MLRim4IkYcExseX1WmEzZ6FmojXUJOg287h32rJ4ytnMXL3EYJFotw2x/soKV823fdww EKmpQ6MlDgaJdJtU4MSy2+SOGEg8hfaJIB8I15l9+UYm+zF99LZlJVllz4i5BhG9AAYr OxDA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Yg3/BaaZ"; 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-5bbb2bf9467si250767a12.17.2024.08.07.20.18.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:18:55 -0700 (PDT) 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="Yg3/BaaZ"; 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 8468988BBB; Thu, 8 Aug 2024 05:15:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Yg3/BaaZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 65D8B88B32; Thu, 8 Aug 2024 05:15:06 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) (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 681DF88AE1 for ; Thu, 8 Aug 2024 05:15:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3dc16d00ba6so401534b6e.0 for ; Wed, 07 Aug 2024 20:15:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086901; x=1723691701; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jac/AK+/fRXX6frGsgkwuddOiwt75cCMUFZhhfIW9h8=; b=Yg3/BaaZ2tyA2GnFzbrlRiGwqKiw/2m2vMLOWGTnI6LclsUVO2ooBMOFZhG7/toVWc LlOLjFuSTRlEJ1MXw2KhiXFeJFIDs8vCvXSiX4PQ/fxP6wI+RF6iZcCyv0ExkZzLlcMd XWndnX3UIOUldF4ORvYIH+EdI6SqjXelURHAxUNuKG9vrJoeoyQeFnkDQPF0oCkqI/vs K1abq84ix5RcLgDVJ6K4QPuzVeiK+wCRnJRz6HyLi3bjSE0Nxynau6mdV4ly5OXuMmnV FGWni4cRHfrieOMUS0A0yIQg+W1ufNmOSYyciyc8dRlCn5IulCBdYnC9xsHWKHfsVdsr hJRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086901; x=1723691701; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jac/AK+/fRXX6frGsgkwuddOiwt75cCMUFZhhfIW9h8=; b=CQgR2obU/0oTtac3IwQS5OlCTcYuRD5zxu2xTXvCU5cGhQ3kV+yXkIprJpgl0PWNbp ZbwKjalI+zMRR9QcrWnQFzwGgJPZpGZgCJ6n1/Z+0QpR2a5LiOn/4/jbzO1BdN2Do0Ma ouG8enNQCk+9PRN7lTNxa85cq8aSaewVMxDXp9zJ5I5P4mtAsZfK3tTabWlUAZ2BL3TH GzV6D2IlY5h8l6RYF+ZkasqaD8pxcpR2cI3dFC2ug0D9EPoS3vXE9mvxEoJMiL/AhV1f FZv7E/JDenRjncxGQzHZr86NLANK/IhEifXR3+5FIhjr+nSY6fUUqYH20nvJah314uW5 IqEQ== X-Forwarded-Encrypted: i=1; AJvYcCVT08mKkbvLOewD3WimQc5hK66iHyQoxohu0ddl9hmurGDMiaAJfc1YuPWqxJN/LvLQJTxhB4SId0sGSSBV9QNbS0qWeA== X-Gm-Message-State: AOJu0YwXdy8TtJkLkGDSTVNxAprYOoz7ibxw6JjAQD0qaBqkkfCe8wzD pbbUVeEc/aF0eZBjSbORLhzZVIRgJYrg/zq/5QhG2hRDxClbNinWPAjWu13Xdbw= X-Received: by 2002:a05:6808:2185:b0:3d9:2ac4:5d69 with SMTP id 5614622812f47-3dc3b427b8bmr637587b6e.25.1723086901016; Wed, 07 Aug 2024 20:15:01 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3db563b705asm4640056b6e.35.2024.08.07.20.15.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:00 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 22/38] mmc: exynos_dw_mmc: Convert to use livetree API Date: Wed, 7 Aug 2024 22:14:28 -0500 Message-Id: <20240808031444.9619-23-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Update the driver to use livetree API instead of FDT one. No functional change. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - Moved exynos_dwmmc_of_to_plat() under #ifdef CONFIG_DM_MMC stanza drivers/mmc/exynos_dw_mmc.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index 09a59fdf0120..50d0208b29fd 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -6,9 +6,7 @@ #include #include -#include #include -#include #include #include #include @@ -226,18 +224,19 @@ static int do_dwmci_init(struct dwmci_host *host) #ifdef CONFIG_DM_MMC static int exynos_dwmmc_of_to_plat(struct udevice *dev) { - const void *blob = gd->fdt_blob; struct dwmci_exynos_priv_data *priv = dev_get_priv(dev); struct dwmci_host *host = &priv->host; - int node = dev_of_offset(dev); int err = 0; u32 timing[3]; #ifdef CONFIG_CPU_V7A + const void *blob = gd->fdt_blob; + int node = dev_of_offset(dev); + /* Extract device id for each mmc channel */ host->dev_id = pinmux_decode_periph_id(blob, node); - host->dev_index = fdtdec_get_int(blob, node, "index", host->dev_id); + host->dev_index = dev_read_u32_default(dev, "index", host->dev_id); if (host->dev_index == host->dev_id) host->dev_index = host->dev_id - PERIPH_ID_SDMMC0; @@ -253,7 +252,7 @@ static int exynos_dwmmc_of_to_plat(struct udevice *dev) #endif /* Get the bus width from the device node (Default is 4bit buswidth) */ - host->buswidth = fdtdec_get_int(blob, node, "samsung,bus-width", 4); + host->buswidth = dev_read_u32_default(dev, "samsung,bus-width", 4); /* Set the base address from the device node */ host->ioaddr = dev_read_addr_ptr(dev); @@ -263,7 +262,7 @@ static int exynos_dwmmc_of_to_plat(struct udevice *dev) } /* Extract the timing info from the node */ - err = fdtdec_get_int_array(blob, node, "samsung,timing", timing, 3); + err = dev_read_u32_array(dev, "samsung,timing", timing, 3); if (err) { printf("DWMMC%d: Can't get sdr-timings for devider\n", host->dev_index); @@ -283,8 +282,8 @@ static int exynos_dwmmc_of_to_plat(struct udevice *dev) } host->fifo_depth = dev_read_u32_default(dev, "fifo-depth", 0); - host->bus_hz = fdtdec_get_int(blob, node, "bus_hz", 0); - host->div = fdtdec_get_int(blob, node, "div", 0); + host->bus_hz = dev_read_u32_default(dev, "bus_hz", 0); + host->div = dev_read_u32_default(dev, "div", 0); return 0; } From patchwork Thu Aug 8 03:14:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817687 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675542wrt; Wed, 7 Aug 2024 20:19:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVeeTMb/wdKma3mvmS5mvTPnh/i6OgBnE5pVBynBykVXpBjI3SKiRvFqm2lKZWYPdah623pKttD9WnUBIcy3jHN X-Google-Smtp-Source: AGHT+IH/thWpNgrqEJJ8bfvZHO7Wu7oKW84Cu2Kh/RGMoy8vvRxZPv/d2rfuncKjQ8+0cJXrSBBJ X-Received: by 2002:a05:6402:3484:b0:5b9:3846:8bab with SMTP id 4fb4d7f45d1cf-5bbb21a3b5bmr484304a12.14.1723087147043; Wed, 07 Aug 2024 20:19:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087147; cv=none; d=google.com; s=arc-20160816; b=hhe1H1kWY3O2x5xaBFmhWKuUc+sAZEs+z1W+hzdayg1i8nfHngZ3LwotmUNmfQoddZ psss9YM+Yn5QdO+dfs0nUX89QQHLXxEblWoJx8OxhUo/BiKsDdQsvqxl14GgrBktw+2U 74yW6M2h2mL4ajbnEhgJkV89yi4fw3ncb3u6nj1zfiwYo9EZZJfOi3CHzobtwnw+eYnM oQIdZDnuS2kjxJmUxuhJyKrEWuugBGxMTcy045NWfwRXFZg7aWSngN+mlk5TpK0jvwg9 /LLCoscuGRM8tyWwdNTabj3Cxm+HrCpkmfBu1eUE/jzaWK7m0cFgOlkJE1570pfx0/tx wfpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=invefIoNeSGS3tiUpl+43dNdH+yHeDxghKAHCOxtGnQ=; fh=SgNO6FOoxkqnjIJWrxFyeKRj+UHbQxssA6r38U6ESWA=; b=B8Ic9dRvZ9NeZYK3uoi60h7CT9wj3d+ryM1oVkopl6JD4bii1JihheIVckcPph5u07 A/7zafu5jSg98OeNNS+HE8WTYUKjHYZORYspcwx55wEcL0FySx2BVGbN336lpcvM1Z16 aOh8wpWRoPheUmbbstrO+5To4GPxEpivsZxmuGkiWbRff7gug1sLKjW1h791uHpUowNi ndWxCZYqCKLDWK/wMjPMQSgRdXwVXZ8dNCthDUDys2IGjH1wIf65P/vCGhRH9zceAzEl beZLVaWFzK5RnNlH2esCqhUZDvC52PDnNpV0OZ532XD/GtYT/iB6vjq/k8jufbXMg2FR w4rA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ou1hRH3t; 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-5bbb2bf8451si260825a12.7.2024.08.07.20.19.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:19:07 -0700 (PDT) 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=ou1hRH3t; 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 E8A5288BC1; Thu, 8 Aug 2024 05:15:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ou1hRH3t"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DA91288B48; Thu, 8 Aug 2024 05:15:06 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) (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 2D3F788A87 for ; Thu, 8 Aug 2024 05:15:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3db23a60850so379696b6e.0 for ; Wed, 07 Aug 2024 20:15:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086902; x=1723691702; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=invefIoNeSGS3tiUpl+43dNdH+yHeDxghKAHCOxtGnQ=; b=ou1hRH3tJKCvZZ0vQ0XHexOVkzhUUtgpObdBXs1MnOb1TcdbQqM6t7zh9gwh7Pb7Yu hSPJ4LUUlhLDNUgCAuGqoteOIMrx67fmJRxoQJAYrQZ1jcaoAA6P4Fdnin+77/qJzOiG 0TNv8cgamtJnsMDjekk+Bj6tGV8gW6u8P4S20gUGpgwiEO4+1xfPZChiEOERVyeLEXf5 WuqJlXltiIl6mpwHq9oL88FidBqAbmscBKLCsxvdUWDv/fEVHYPGxQ15FquW/q9fjcbM amTdFWj80YvH3/vHaMjifjG1B0ciEapohe77+buvhUDdwLxgaQSSky/43Y/nouLVpmQX ihig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086902; x=1723691702; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=invefIoNeSGS3tiUpl+43dNdH+yHeDxghKAHCOxtGnQ=; b=NXVjTAUODnsm0deh5MmR/2xqHyO0T0W+YL/g20WJtlM6byW7/NdzjGRpwMJ+tns36I u3SYFhLAw9zwoBqYp454++5rfe2sNh803n8PzE884dqNX+wswV/WBZ+8PE6Qux78iVwY FfH1O1f1rnoz0AZGxfHT/oieDMrk44k3ukuWJTRqmapmiqwGaboq1MciBBg4cgESjisZ vsfyWtZD4Rfc0n1x/6/FSZOc7QZDnutLtq4wrmVIz+CkIEyUBHCcoL/6rbR93UMTY7UU bbZWOcUem9nhrCsQ6AVCXZpp2z/1BCUqCHjpLDvwa3OnxqTgJtvztAB1911Aj624Gq1a 3uEw== X-Forwarded-Encrypted: i=1; AJvYcCUoXueGquHeBwUB63+qV2gGSIpk/yf/zrnFYmzk+qbMqdvMUrIaSqCasiEL9/RvUyVUqxVrrieKEPzknxeVDPF90OuGRw== X-Gm-Message-State: AOJu0Yx+rtKngx3NcVwXzoilKwBymMCq1cGmBWuXFyrNwaAwU1s+rkyQ gk2cY3hLvjlvZOv2Y4+nLEADxhRKzeRC0RL/wirI82Dg2VGo7hjpZL/2zS1R2dc= X-Received: by 2002:a05:6808:2396:b0:3dc:1720:ffb3 with SMTP id 5614622812f47-3dc3b4266a0mr687420b6e.23.1723086901752; Wed, 07 Aug 2024 20:15:01 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3db5637b600sm4663880b6e.33.2024.08.07.20.15.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:01 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 23/38] mmc: exynos_dw_mmc: Read upstream SDR timing properties Date: Wed, 7 Aug 2024 22:14:29 -0500 Message-Id: <20240808031444.9619-24-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The obsolete "samsung,timing" dts property is now split into "samsung,dw-mshc-ciu-div" (for holding the internal DW MMC divider value) and "samsung,dw-mshc-sdr-timing" (for actual timing values) in upstream Linux kernel. Rework the driver to make use of new properties instead of the old one. All affected dts files were already updated accordingly. No functional change. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) drivers/mmc/exynos_dw_mmc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index 50d0208b29fd..4108af47e518 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -227,7 +227,7 @@ static int exynos_dwmmc_of_to_plat(struct udevice *dev) struct dwmci_exynos_priv_data *priv = dev_get_priv(dev); struct dwmci_host *host = &priv->host; int err = 0; - u32 timing[3]; + u32 div, timing[2]; #ifdef CONFIG_CPU_V7A const void *blob = gd->fdt_blob; @@ -262,16 +262,16 @@ static int exynos_dwmmc_of_to_plat(struct udevice *dev) } /* Extract the timing info from the node */ - err = dev_read_u32_array(dev, "samsung,timing", timing, 3); + div = dev_read_u32_default(dev, "samsung,dw-mshc-ciu-div", 0); + err = dev_read_u32_array(dev, "samsung,dw-mshc-sdr-timing", timing, 2); if (err) { - printf("DWMMC%d: Can't get sdr-timings for devider\n", - host->dev_index); + printf("DWMMC%d: Can't get sdr-timings\n", host->dev_index); return -EINVAL; } - priv->sdr_timing = (DWMCI_SET_SAMPLE_CLK(timing[0]) | - DWMCI_SET_DRV_CLK(timing[1]) | - DWMCI_SET_DIV_RATIO(timing[2])); + priv->sdr_timing = DWMCI_SET_SAMPLE_CLK(timing[0]) | + DWMCI_SET_DRV_CLK(timing[1]) | + DWMCI_SET_DIV_RATIO(div); /* sdr_timing didn't assigned anything, use the default value */ if (!priv->sdr_timing) { From patchwork Thu Aug 8 03:14:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817688 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675574wrt; Wed, 7 Aug 2024 20:19:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWOsK2siHPNGEnCkfVb/7VGsMdzdKwbn0Svxj09d77gzR+0vvsOuoFD5NTLcRWZC9aFGJ1r29AB64/i3y5bTK3R X-Google-Smtp-Source: AGHT+IEUE/RrBQ+7VArS0xu6hwD3gzjPqKe9EQkepAf6J3Fh1S2SxAAIdq91HI/mWd8K9YNQp8do X-Received: by 2002:a05:6402:1d54:b0:58c:b2b8:31b2 with SMTP id 4fb4d7f45d1cf-5bbb3d1d1f0mr275699a12.17.1723087156729; Wed, 07 Aug 2024 20:19:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087156; cv=none; d=google.com; s=arc-20160816; b=e20TgF4hIaa8QyLy60O92XAyeM+brmp/AntkUu000vwTmkp+bbX4AoG7kzKyNFpDzS NXnba/Hy7MAdC46rNwLCDWbM9GEKG1PYRBHi46ogKLLu6icVDfHKpAv+fzpaF4Jss+JZ hXurBjsv2VzpkTlaClOjTxCfCygXnQoXuLEjiq+xrjFpQElziOiVx4aHsg5cs96Y+938 jtbxbQbYXIUmknRMCcLKEvMtlZtRNTevLnBDhvbeAOU1NisEAW/T5sMDW3o76sWquBfq 1Pl+reluF5IGYTFLGpv2D5T7eEpqMOaRJUditg1OE9LF8E4F/GMOnWfIxPcuyNEAkDYO nHNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=f6YDJBIvcCFAl4slfQa3e+M/r3XTbUp34q0bDWEj3So=; fh=gQca5A9u1NSj5vMX0KgN6NH1bV+10jWwhd8ZzXS8wBQ=; b=FtE11PivwcuBLHC6SE/0mWRnHE1kI5+bncLIsWWLeAFdABC8SwFCZYhVON5YH3Rocg gyWCmZisqdx/TVz7sJOJGww9d37Tl75WD3NQxV8Aqt7wT5lMSwquKSxdE1r10XyQHK/L InfqEajffM1KGbLTCkGMW/LFGJwgoTqKpPupBWypJTc2ayUiQS3Lb7llMWQ9f3mXDw0N 4jNx2+1r0Ex5VWX54lsys+vIYqvd/ipKXmP0aPZ04rwnjM+PD/cDCaWjg29VymimUaKr qLSoVdYbGtgJ5oEtLhPunP7PS07WnBNqD2LefsIul1QhCT8pcFs6jicEkZYshFBAo9Bc 2LHA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sRVoHnvF; 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-5bbb2c1f5dfsi256205a12.156.2024.08.07.20.19.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:19:16 -0700 (PDT) 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=sRVoHnvF; 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 613E188BC8; Thu, 8 Aug 2024 05:15:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="sRVoHnvF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0057B88A87; Thu, 8 Aug 2024 05:15:06 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0: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 7C78C88AFF for ; Thu, 8 Aug 2024 05:15:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-ot1-x32f.google.com with SMTP id 46e09a7af769-70945a007f0so245640a34.2 for ; Wed, 07 Aug 2024 20:15:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086903; x=1723691703; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=f6YDJBIvcCFAl4slfQa3e+M/r3XTbUp34q0bDWEj3So=; b=sRVoHnvFsnnn5LH7TdkHe9FBa93KLgHrTQ+9VMrOaawEY2vZA5iCEkMf8C0KiQrrQ/ iLQbj/7EWpkOx8DHRWjHyYxS2AF36QdfvP4jPqql7pzw/dCMBE2FRv/XzUUCtbZpdMgW 17GNA4fju7BxsXepp2jUpw3BWG4hCQbjccDhjXNmfNxMKyszO0w6FN1jhF5UXREmw5x9 Tl4mQ6uV26kkdAscZfCna6X9z4ChuLmNCTqJsHKhrilKuSFkKfkoEWfSabYVHeBbPUra xgn5O5kpqFYEE69dqrg7Qj+J8gdrMc/OOYPKxYfa662XBPtz9BaAfXW5i6899QOrtZwk IEGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086903; x=1723691703; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f6YDJBIvcCFAl4slfQa3e+M/r3XTbUp34q0bDWEj3So=; b=a/mQRn6qOqsC+fcFmsJZI6N7v4gxgh9s89q8njsR2nSMsCu0tTr8ZkMj8Z353LNN7R +4jbylHysH4ryq4Ur9L1ZSOmyHdlZVOzsK1ecZNwsuMNe6AhuCWfq5nNKffU6yoV2hL0 Ndf5L15XeWZ4FoItOi/0Am/UVtklGBNVINdol+qlLAIrDcnFPCw+yZXeNsDVoBcacmZ9 5UObZdJ74RIUBGMT7xih9O64giV4jVKnFRgJnkXFb5iVdJUydxGC1jvcociv3c6NzPPq uwvcaQxc/RdjI3amWgtkRQe8Jt/vX7WD5JjkjCS8C19zz/MflDtMmUM57Gb8o3Mmbes7 ZFJw== X-Forwarded-Encrypted: i=1; AJvYcCX1EG7ok8oshlf1/vkqlbQ8FKbLGP8ZHYwoZrLEltXEITsxw4zaf8Gclxh8xd8n+olaQ1BJkWEGd2cHsjNEq5CC3li70A== X-Gm-Message-State: AOJu0YxQ/t2arMILbZ+0A2+Rxz5pDDiPixvNNeQGN9vMw9gd4GhnFTeT RpuAnpZNrVWvv90+vOZTFuzqBdzXd+5PzG/caTxR0cB/XspnzA++YPK71+ERLR8= X-Received: by 2002:a05:6830:6608:b0:703:b0e9:d951 with SMTP id 46e09a7af769-70b4fc2e66cmr675014a34.6.1723086902844; Wed, 07 Aug 2024 20:15:02 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-70a3a7693dbsm5175702a34.72.2024.08.07.20.15.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:02 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 24/38] mmc: exynos_dw_mmc: Abstract CLKSEL register Date: Wed, 7 Aug 2024 22:14:30 -0500 Message-Id: <20240808031444.9619-25-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 CLKSEL register offset may vary between different Exynos chips, e.g. on ARM64 vs ARM32 chips. Provide a way to specify its offset value for each compatible instead of hard-coding its value in read/write calls. No functional change. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) drivers/mmc/exynos_dw_mmc.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index 4108af47e518..fd2ced3d711d 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -33,6 +33,11 @@ struct exynos_mmc_plat { }; #endif +/* Chip specific data */ +struct exynos_dwmmc_variant { + u32 clksel; /* CLKSEL register offset */ +}; + /* Exynos implmentation specific drver private data */ struct dwmci_exynos_priv_data { #ifdef CONFIG_DM_MMC @@ -40,6 +45,7 @@ struct dwmci_exynos_priv_data { #endif struct clk clk; u32 sdr_timing; + const struct exynos_dwmmc_variant *chip; }; static struct dwmci_exynos_priv_data *exynos_dwmmc_get_priv( @@ -115,13 +121,14 @@ static int exynos_dwmci_clksel(struct dwmci_host *host) { struct dwmci_exynos_priv_data *priv = exynos_dwmmc_get_priv(host); - dwmci_writel(host, DWMCI_CLKSEL, priv->sdr_timing); + dwmci_writel(host, priv->chip->clksel, priv->sdr_timing); return 0; } unsigned int exynos_dwmci_get_clk(struct dwmci_host *host, uint freq) { + struct dwmci_exynos_priv_data *priv = exynos_dwmmc_get_priv(host); unsigned long sclk; int8_t clk_div; int err; @@ -132,7 +139,7 @@ unsigned int exynos_dwmci_get_clk(struct dwmci_host *host, uint freq) * clock value to calculate the CLKDIV value. * as per user manual:cclk_in = SDCLKIN / (DIVRATIO + 1) */ - clk_div = ((dwmci_readl(host, DWMCI_CLKSEL) >> DWMCI_DIVRATIO_BIT) + clk_div = ((dwmci_readl(host, priv->chip->clksel) >> DWMCI_DIVRATIO_BIT) & DWMCI_DIVRATIO_MASK) + 1; err = exynos_dwmmc_get_sclk(host, &sclk); @@ -229,6 +236,8 @@ static int exynos_dwmmc_of_to_plat(struct udevice *dev) int err = 0; u32 div, timing[2]; + priv->chip = (struct exynos_dwmmc_variant *)dev_get_driver_data(dev); + #ifdef CONFIG_CPU_V7A const void *blob = gd->fdt_blob; int node = dev_of_offset(dev); @@ -322,9 +331,22 @@ static int exynos_dwmmc_bind(struct udevice *dev) return dwmci_bind(dev, &plat->mmc, &plat->cfg); } +static const struct exynos_dwmmc_variant exynos4_drv_data = { + .clksel = DWMCI_CLKSEL, +}; + +static const struct exynos_dwmmc_variant exynos5_drv_data = { + .clksel = DWMCI_CLKSEL, +}; + static const struct udevice_id exynos_dwmmc_ids[] = { - { .compatible = "samsung,exynos4412-dw-mshc" }, - { .compatible = "samsung,exynos-dwmmc" }, + { + .compatible = "samsung,exynos4412-dw-mshc", + .data = (ulong)&exynos4_drv_data, + }, { + .compatible = "samsung,exynos-dwmmc", + .data = (ulong)&exynos5_drv_data, + }, { } }; From patchwork Thu Aug 8 03:14:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817689 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675625wrt; Wed, 7 Aug 2024 20:19:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWuiq+uGFDUvoZDNdCawp792JsFQp5IXtsz5Sz3UnuorHo0WD18c7xikI7dcKlNZQq9oJLZcdvaNtQqAbq63tXQ X-Google-Smtp-Source: AGHT+IFFMdwk+dOTyfBBfYtLM2ivojS3cmHi+lB34kq5ucrBhi7Mf/CG9h1enmOEDV4pJgD7NXG1 X-Received: by 2002:a05:6402:2710:b0:5ba:cb82:a776 with SMTP id 4fb4d7f45d1cf-5bbb21bb860mr378109a12.9.1723087167677; Wed, 07 Aug 2024 20:19:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087167; cv=none; d=google.com; s=arc-20160816; b=hZ92FrMTmuo3aUJFNTIaFhDPWMvwBwERPrvuwxPDbGecH4CNqzpOCHbp7lpHYFRX9+ 2bEf0BazxikY6oC1Bi2AgqE+KmV64zobXdTubJBRRMaqIfSMUM+uk+Vg0sK/co2BeNQ/ Q2HzC82bHwEzKqPhQ/NkvAjIiwZZ4TR8Mc7+fZc6HcGoBQDxNtsj8M/GQjPj4VJxPOvq c4M7bL8xiyj0skTTq2cyIkysB2DssXEqqirHFL+JPiNgZUO0v8JqDH+U6qZehO9vbt9a 7a4jAEd5TQH21qhOLTSmtygNh2N9RXrFXgDN2vfbP4XThj5T7RiQ0YCjHOoVAsVvHVbk 6vjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Z5adIMgDtwrz5dZldHqzodzy1zNjuQCD7qLIe+oWWtg=; fh=v805UjT1kfESlZuIJFg1zUSrq9i//GKxV0pw3NyXDM4=; b=rcqfEdqwdE3/rC49AecLCMgssda2/RLnHqpmjziGFRwzxmanJumWUrYGcsT/cCaO6K UcqhGdQRX5EAHFXt/Myo1RyAqxcUAHK7aYhjazRUjFhYdZi0BCZtgTT7y4Sx4YHX0OP9 U/e49oVrzGZJG5hdyFXWqKNWcXcLC7lSI1f1uz0ZV9aAfoyUMOirjxicxF2J1o4awzpV ucz2zNlwT+0v62ncr82pK1u2+wRkkWMvWLqxSiKlbH8eWxEZ8EujZWsVoWONBsfG250P KXqQCMewIT65he4KTTrIQ2DUDYz9XZlbSWen+GmrjmmxBJ4uC5PzH0xfgSTtFMcZ49oL vn8g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TWa5KGQk; 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-5bbb2cff64esi250525a12.247.2024.08.07.20.19.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:19:27 -0700 (PDT) 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=TWa5KGQk; 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 D247388BD2; Thu, 8 Aug 2024 05:15:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="TWa5KGQk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D30E688B69; Thu, 8 Aug 2024 05:15:07 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) (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 3C5E08873C for ; Thu, 8 Aug 2024 05:15:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3db1d4dab7fso376380b6e.1 for ; Wed, 07 Aug 2024 20:15:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086903; x=1723691703; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z5adIMgDtwrz5dZldHqzodzy1zNjuQCD7qLIe+oWWtg=; b=TWa5KGQkYw66J9XVrw3cE1FscJu8hLIADuqPvPnrSz29Tiw0lwXXrSyRacpkrNYDEz J1tJq8Lj8h8/Gudo5buwVo0ZEqjNp4gRrZIJBes/BYIoXtT3XZYgXP7DyxI7yjlwOD4U C708VcVDVO94Hh0wTSbLCHgcqhVm4Ru1RdNM38iLn3JZDdVtSFwnIyJ1d5L38KtsOlu8 uHvwSjHTd7FZBojwGsyNu+pBLAdq3zrfNcXevP+eaIVYr1rUWWJDGvKsfq4zae+LgSNY EtnHtEG8bYcF05xoAZaTjsYmlKAqS4hqPY5QAhWLEEYowGZHhw44w1o2wh4OXm4srGgy HJVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086903; x=1723691703; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z5adIMgDtwrz5dZldHqzodzy1zNjuQCD7qLIe+oWWtg=; b=i2GxDAcsLacPUqUJrA+c1yFeWOCflWt6d2OhaZup3c1BAOUtwf6ZwPrroFNmrAXwPe VuzUhXSv7PYp6qwOYKoRClj83dGl2G+7TtSFVjvSPSZfzQLMdwAeD4udjnMfdLanPp55 EBOsmlVp/7gEDexaAj/VTtoeSSvV/gZZR1Hg58oYxsgzY++6IB6/PKSiOt/66MjaOg1b PaluoOn5BtzRN4Vqm3eTFJ9UuRWX46f+zJQJPdUCXy2hfmffbDE5Z4SycmNXFpnwWkr0 4UPUXCnAQoOHYpoe9wpRngbcoAf21Lk0+4KsVGaHbO13LNPgsgborwZPW+y8W8A4DcaJ 5AeQ== X-Forwarded-Encrypted: i=1; AJvYcCWp6baNiQ4PnjbzQgElhmj5T9uq3ZfMb6CltIZI+HQiD849rJQ3h9I3cdn8hVQN3DCPGMvL7SY8q8X5MIgRs0XL/IddiA== X-Gm-Message-State: AOJu0Ywh5vsZsHbx/jbijjitWNZsXF2QiYTjbyth0c+iwzXWZHRVeYs9 FTjFA2iLsamd+1lxiXWSjOLssvQItEe+4MPFuCs0pG6JpLpQ5p0uGBuyvXlPZmM= X-Received: by 2002:a05:6808:218c:b0:3d8:4603:e7b0 with SMTP id 5614622812f47-3dc3b461393mr600702b6e.44.1723086903546; Wed, 07 Aug 2024 20:15:03 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3db563c7e21sm4593119b6e.53.2024.08.07.20.15.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:03 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 25/38] mmc: exynos_dw_mmc: Refactor fixed CIU clock divider Date: Wed, 7 Aug 2024 22:14:31 -0500 Message-Id: <20240808031444.9619-26-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Some chips like Exynos4412 have fixed internal CIU clock divider. Instead of reading it from non-standard "div" dts property, store its value in the driver internally, in static chip data associated with corresponding compatible. This makes it possible to avoid using host->div for storing it, so the latter can be removed safely. Also create a helper function called exynos_dwmmc_get_ciu_div() for getting the current div value: in case the fixed div is provided in the chip data it will be used, otherwise the current div value is being read from CLKSEL register. The insights for this change were taken from dw_mmc-exynos.c driver in Linux kernel. No functional change. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) drivers/mmc/ca_dw_mmc.c | 2 +- drivers/mmc/exynos_dw_mmc.c | 43 +++++++++++++++++++++++++------------ include/dwmmc.h | 2 -- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/drivers/mmc/ca_dw_mmc.c b/drivers/mmc/ca_dw_mmc.c index 54a2ba4795e3..1af5ec0532ea 100644 --- a/drivers/mmc/ca_dw_mmc.c +++ b/drivers/mmc/ca_dw_mmc.c @@ -86,7 +86,7 @@ unsigned int ca_dwmci_get_mmc_clock(struct dwmci_host *host, uint freq) clk_div = 1; } - return SD_SCLK_MAX / clk_div / (host->div + 1); + return SD_SCLK_MAX / clk_div; } static int ca_dwmmc_of_to_plat(struct udevice *dev) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index fd2ced3d711d..b5c8f592c7e8 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -23,6 +23,8 @@ #define DWMMC_MMC0_SDR_TIMING_VAL 0x03030001 #define DWMMC_MMC2_SDR_TIMING_VAL 0x03020001 +#define EXYNOS4412_FIXED_CIU_CLK_DIV 4 + #ifdef CONFIG_DM_MMC #include DECLARE_GLOBAL_DATA_PTR; @@ -36,6 +38,7 @@ struct exynos_mmc_plat { /* Chip specific data */ struct exynos_dwmmc_variant { u32 clksel; /* CLKSEL register offset */ + u8 div; /* (optional) fixed clock divider value: 0..7 */ }; /* Exynos implmentation specific drver private data */ @@ -126,12 +129,18 @@ static int exynos_dwmci_clksel(struct dwmci_host *host) return 0; } -unsigned int exynos_dwmci_get_clk(struct dwmci_host *host, uint freq) +/** + * exynos_dwmmc_get_ciu_div - Get internal clock divider value + * @host: MMC controller object + * + * Returns: Divider value, in range of 1..8 + */ +static u8 exynos_dwmmc_get_ciu_div(struct dwmci_host *host) { struct dwmci_exynos_priv_data *priv = exynos_dwmmc_get_priv(host); - unsigned long sclk; - int8_t clk_div; - int err; + + if (priv->chip->div) + return priv->chip->div + 1; /* * Since SDCLKIN is divided inside controller by the DIVRATIO @@ -139,9 +148,17 @@ unsigned int exynos_dwmci_get_clk(struct dwmci_host *host, uint freq) * clock value to calculate the CLKDIV value. * as per user manual:cclk_in = SDCLKIN / (DIVRATIO + 1) */ - clk_div = ((dwmci_readl(host, priv->chip->clksel) >> DWMCI_DIVRATIO_BIT) - & DWMCI_DIVRATIO_MASK) + 1; + return ((dwmci_readl(host, priv->chip->clksel) >> DWMCI_DIVRATIO_BIT) + & DWMCI_DIVRATIO_MASK) + 1; +} +unsigned int exynos_dwmci_get_clk(struct dwmci_host *host, uint freq) +{ + unsigned long sclk; + u8 clk_div; + int err; + + clk_div = exynos_dwmmc_get_ciu_div(host); err = exynos_dwmmc_get_sclk(host, &sclk); if (err) { printf("DWMMC%d: failed to get clock rate (%d)\n", @@ -149,11 +166,7 @@ unsigned int exynos_dwmci_get_clk(struct dwmci_host *host, uint freq) return 0; } - /* - * Assume to know divider value. - * When clock unit is broken, need to set "host->div" - */ - return sclk / clk_div / (host->div + 1); + return sclk / clk_div; } static void exynos_dwmci_board_init(struct dwmci_host *host) @@ -270,8 +283,10 @@ static int exynos_dwmmc_of_to_plat(struct udevice *dev) return -EINVAL; } - /* Extract the timing info from the node */ - div = dev_read_u32_default(dev, "samsung,dw-mshc-ciu-div", 0); + if (priv->chip->div) + div = priv->chip->div; + else + div = dev_read_u32_default(dev, "samsung,dw-mshc-ciu-div", 0); err = dev_read_u32_array(dev, "samsung,dw-mshc-sdr-timing", timing, 2); if (err) { printf("DWMMC%d: Can't get sdr-timings\n", host->dev_index); @@ -292,7 +307,6 @@ static int exynos_dwmmc_of_to_plat(struct udevice *dev) host->fifo_depth = dev_read_u32_default(dev, "fifo-depth", 0); host->bus_hz = dev_read_u32_default(dev, "bus_hz", 0); - host->div = dev_read_u32_default(dev, "div", 0); return 0; } @@ -333,6 +347,7 @@ static int exynos_dwmmc_bind(struct udevice *dev) static const struct exynos_dwmmc_variant exynos4_drv_data = { .clksel = DWMCI_CLKSEL, + .div = EXYNOS4412_FIXED_CIU_CLK_DIV - 1, }; static const struct exynos_dwmmc_variant exynos5_drv_data = { diff --git a/include/dwmmc.h b/include/dwmmc.h index a99b2f3bf0cc..8c2500da9efe 100644 --- a/include/dwmmc.h +++ b/include/dwmmc.h @@ -184,7 +184,6 @@ struct dwmci_idmac_regs { * @caps: Capabilities - see MMC_MODE_... * @clock: Current clock frequency (after internal divider), Hz * @bus_hz: Bus speed in Hz, if @get_mmc_clk() is NULL - * @div: Arbitrary clock divider value for use by controller * @dev_index: Arbitrary device index for use by controller * @dev_id: Arbitrary device ID for use by controller * @buswidth: Bus width in bits (8 or 4) @@ -205,7 +204,6 @@ struct dwmci_host { unsigned int caps; unsigned int clock; unsigned int bus_hz; - unsigned int div; int dev_index; int dev_id; int buswidth; From patchwork Thu Aug 8 03:14:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817690 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675698wrt; Wed, 7 Aug 2024 20:19:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVzmhutR6DjGi/3pwejUK8MYUDH9+z1m9FL5sNUvzuJJ1Oa6pxYMd97WUSd0grS0pffKcC+lg==@linaro.org X-Google-Smtp-Source: AGHT+IF2EhJwATjH2/VkIu5PCcHrjdDC1dVPoaNbS5fT3Dtd8DdAopx7h7z0PZRNU9UePpbr1Q5d X-Received: by 2002:a05:6402:518d:b0:5ab:3174:9e1f with SMTP id 4fb4d7f45d1cf-5bbb21a418amr356330a12.15.1723087179497; Wed, 07 Aug 2024 20:19:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087179; cv=none; d=google.com; s=arc-20160816; b=JcXaBZ1YiRKu5dz3j/un1Gd1EzRyuNe72XDMeQLMOuyOYf6hUp40w5i/mQy96U/ryJ G8HUM3ShYosNhEMhr1n1Ivw6i5txRGvcJlTZ5Y1nNDov7fK9LgpadQMQ2KSl1MXJnoMs Ki/eqQ0fctRiIjz/TPkPF89eQ2xmKaH+NHqrKO/uyLnyZ6fYLD5KaYr2nc/Bg+01XS2B xUETJqWfilNxlZ3UXB8zPpLAGNt8t+6OUzm2Gu+NZPezvL1oHKMkKq9ZiSBWAdDSN6Qe HeojM1NyWDEE5gaoto61VBiNxDrzlu1bOr29V8tidcEJvT0sMGo3lGJH5zXC18qsaUNz yiig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XgMOaDzDZtrOt6LtYkihbZiTIDSf9dvw6ZbjZCxwNSY=; fh=i+dSBoBYlfJnGeuwbg0oeBHJ6Tybb20F2+q8bRVUxdI=; b=ntU6WklrNo7sNCEQr6obNQ/4tosCWM/77PyTIa+8rOKbSfDIA/TKgVbpa78W6hm/w1 U6Y+rm3dvcbezLIbfxl7Cxi/Gkn7FUAO89QUByQhE+VwkAgT40kcs5T58MDZ5NP2CDNQ sfH5kKaiS86O5DOhDi85lwTuWcIJxuIo+MQ9FqHdZkE1Lg0FZ1KsmqTJtWhpmcOwzlXY 4KVigyr8zaqCkFX86ljlaL3eEpRs5LreAVPcAy7EeieGigfsD9V6+KeyPue+CMfDL7uG gsf4W1C0RAfdM464cMHlgE5HQAl2cEgI4shIsT9gazLI6KvHbFAzpQBA3WQjdJQc9q7d VFjA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SQMFCMLq; 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-5bbb2cffcc6si239687a12.332.2024.08.07.20.19.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:19:39 -0700 (PDT) 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=SQMFCMLq; 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 7DB7F88BD9; Thu, 8 Aug 2024 05:15:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="SQMFCMLq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4C66F88AD4; Thu, 8 Aug 2024 05:15:08 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) (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 8BF4E88B1E for ; Thu, 8 Aug 2024 05:15:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-3db14cc9066so381602b6e.3 for ; Wed, 07 Aug 2024 20:15:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086904; x=1723691704; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XgMOaDzDZtrOt6LtYkihbZiTIDSf9dvw6ZbjZCxwNSY=; b=SQMFCMLqwB6R0P7+5ggjY33eBquIYQwawWDTPveUcM3LAVsdmT1fLypyZ2pLLeqCGA do2DDFQ2PzWFFYOzoA3nYW1mADIXap9ZBdNj+0DCd/VeJH990zG0Nxmv1WTGnUTDYHGc uC2SOda5O3D1rD4otEY7/qNjIqJrtJovGl9OaKEJARAPsZFJySQiJBT1en0RssHF3Xso WoexBoHqz3/HOzQBKDd1ivPeV+0C/dJEz4nuuxqdBLOE7/RHUGfQQmADMj6sDq8kOMwp nZkxdbSasNVWHhx/3xxZHNVZj3G5QGBYS0dp06qT8HpmDFOUIuyp7TBdmMbuWOQ/yDt/ FrrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086904; x=1723691704; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XgMOaDzDZtrOt6LtYkihbZiTIDSf9dvw6ZbjZCxwNSY=; b=W2L5nsEROKIZAMonKnkswzSua78bbbzlAFcPpDw+yRk4sLtSMyXFwXsKAlaircx/8R EXMdzmifXif44Zhs1lS1g9IlwstrRyAtDoHjZenffEybWNw/SJUVhLT4/e+zsMx67PeA 8vWGjwz3sE0ey6alN2rK6TN/Jsjph/04KZvfZdJf4pOLjr84ciMJT6ZnnXbuQcSgd9C+ jlOi2Oo7hvMH+K4fUCrx3v4g64/SzaSLlBolUKYNB4nSXf58O38/6s5jcUswxoDF7ElI 9qZnxEl9H005NYIeJByl2/f0bl45NWKOEF/KNOA1nqhIDdb2d87YlInqYFnrz2X+U3ON 78wg== X-Forwarded-Encrypted: i=1; AJvYcCW/nzS9C2lZ/zrdCfjhqiB430818kk5vg+WQsVDtcLT+lw6qGydJeCj7zvRCZZzofYhQcHmoxU=@lists.denx.de X-Gm-Message-State: AOJu0Yxwag8tnVmo1vXKuFLIPrb92OxclP3XaD7aSmEDgfCpisxEX25S w9cdCmGYKsQpQWUTAcARFpLaiyHGSYr472M1QA2FLDm182CqorUfF2joDGDdUFY= X-Received: by 2002:a05:6808:181b:b0:3d6:362b:5ea3 with SMTP id 5614622812f47-3dc3b41b30bmr627735b6e.14.1723086904249; Wed, 07 Aug 2024 20:15:04 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3db56361a88sm4583195b6e.4.2024.08.07.20.15.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:03 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 26/38] mmc: exynos_dw_mmc: Read common bus-width property Date: Wed, 7 Aug 2024 22:14:32 -0500 Message-Id: <20240808031444.9619-27-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Instead of using non-standard "samsung,bus-width" dts property, read common "bus-width" property used in upstream Linux kernel. It's safe to do so, as "bus-width" property was already added to corresponding nodes in all affected Exynos device tree files. No functional change. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) drivers/mmc/exynos_dw_mmc.c | 2 +- drivers/mmc/s5p_sdhci.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index b5c8f592c7e8..612c2d0c615d 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -274,7 +274,7 @@ static int exynos_dwmmc_of_to_plat(struct udevice *dev) #endif /* Get the bus width from the device node (Default is 4bit buswidth) */ - host->buswidth = dev_read_u32_default(dev, "samsung,bus-width", 4); + host->buswidth = dev_read_u32_default(dev, "bus-width", 4); /* Set the base address from the device node */ host->ioaddr = dev_read_addr_ptr(dev); diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c index 80dbb38c9b36..278019f02abb 100644 --- a/drivers/mmc/s5p_sdhci.c +++ b/drivers/mmc/s5p_sdhci.c @@ -166,7 +166,7 @@ static int sdhci_get_config(const void *blob, int node, struct sdhci_host *host) host->index = dev_id - PERIPH_ID_SDMMC0; /* Get bus width */ - bus_width = fdtdec_get_int(blob, node, "samsung,bus-width", 0); + bus_width = fdtdec_get_int(blob, node, "bus-width", 0); if (bus_width <= 0) { debug("MMC: Can't get bus-width\n"); return -EINVAL; From patchwork Thu Aug 8 03:14:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817691 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675737wrt; Wed, 7 Aug 2024 20:19:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWnRAFXJMOSo7WmEcoblqEVoCvyXx9fc8zAel7AQlZQVl+kMaRSFmS/PSLYybrIxV1l4mddsJxQ+vrAuj0o0hxe X-Google-Smtp-Source: AGHT+IEFLOOrcZn/M+nRoaMfasVJmb2s7G4SGAAUdIj+/RI2nAcN5vRQ8JmG9wf7IuYr71MTB20A X-Received: by 2002:a05:6512:3c9e:b0:52e:9619:e26a with SMTP id 2adb3069b0e04-530e5844362mr338267e87.26.1723087188564; Wed, 07 Aug 2024 20:19:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087188; cv=none; d=google.com; s=arc-20160816; b=Vr8NKeA2fY+CXPyZAv1KmpRE5RqhBYkgrs1vGdZlGKaGsB1yYf8V4Aomqfn5VKE3eW uMzhbMEmPS4HBBsuRXX7cx+pgPhBjbV6Bm2CNryurKYzCUzxmzL+vcN6+YOe3O7whLxB 8x/SwpwAUioauNxJRZFx0dRtgMROv6eep9ALl7rT3qlnAtEx+W4V2bCK/a54n24ZEUTk HR2LBYh5Bbw+QLMJIvF2mLP3tw9JmhsaGGO2B1UgqtMp7rKhwJDPMKBI15gpGaIdIytV n3VbOiSg+xhqgIj8UK6XypwTgcn9sGoos98vLt/Wf31UJT5h8dmbEUGuV05Afe2QS1ev loEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BEMddII/dJg7zeqKXZ6gh3nt7UHm8knkyF/Q9SP/yNk=; fh=JqIPkxqnZRzzucn15uTwMDS7JrPlR0Qnyieh5wSjklc=; b=SGhRRSA5Utvv1XC/a/2pUoppoJjvCoRMqlwj6oSOf/oUccVn32/c1kX+hjTYs5JrpI mpEdR/sPuW/cYsr1HROuAQJVG804LEUDxCRsEu8JWlCifPRShuZPoFVMiAmcSVV1iw0Y dg5iC3Im98NYoK1ox7xgiVE8ND61VtDwOpnMxmA0tZSYmBBmydDmXgpjYHuiaQYwa+0f JLJweg9DmanHUdUoTEofRftPUtNw6cYF8r0XZVJFOH4XTh8tSlcDlTKp52kg5LNj1gdM vVpRgiKBf6Zi9LWUZK98flIf+TyWFd9mR24Pmtjltnwd4+QooOoOtrJz56Ma0W0VhxVZ 9dOg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N8tYK29A; 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-a7dc9d68b79si784939066b.479.2024.08.07.20.19.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:19:48 -0700 (PDT) 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=N8tYK29A; 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 24BC288BE6; Thu, 8 Aug 2024 05:15:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="N8tYK29A"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BB6D788B6B; Thu, 8 Aug 2024 05:15:08 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) (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 448C788B28 for ; Thu, 8 Aug 2024 05:15:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3db504ab5f3so407138b6e.0 for ; Wed, 07 Aug 2024 20:15:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086905; x=1723691705; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BEMddII/dJg7zeqKXZ6gh3nt7UHm8knkyF/Q9SP/yNk=; b=N8tYK29A5uvhpMPHaykBQI5oJ00k4o9Z23bhvuLHiFfxVaZsd0oPqko8wmMS3DxXYG qiKl3pyUPKBG0foANwcAWCTrPWRmoWcDi8NiFCR7IIr+YZO41Hj9fXa1B1xM/QyIzklk Gvoqxl7mhvmZK3JgWXyuqWqMiMp1Kd6FKyb1UMJA9XFbl8o0AB0FT6HkOgP0lesZiq5D 52DF0P8R6zCRy8P/KtK5/UNeAgiZpTxhWp2opF9/uu5xust+fybzbn5W8Oe5Hbr4E27i 7dW1CBqmJ6FmLVr4aO2m4AiKblX4vPlBgqR6xY6W0kuFVX7PlycgonbgbDSEei2OtO39 sjwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086905; x=1723691705; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BEMddII/dJg7zeqKXZ6gh3nt7UHm8knkyF/Q9SP/yNk=; b=j/vSn0Z9nYQGztybv2qVRny3+5glFCqLPF3I544sUwRc53IuHZwaJrIViPye7vcfAN aylUuouUs7aUI8zklcuRI703tbhDbpLTZFZzdIZ1dXIUdsdlTT7H5c2XU3Y4M6DeSy51 /5h2qfuTwHQf+sfAyIQwRcMoo9snsXDQYE/7+q0aDMmhXNBldSm26L5XuFN4XSIJC03q hbnLFdtB9qBFSg87HpQ30ei7/5+0BPnYtky642VHNqK9iznGsaImR/v3C099ugn6SQQe ndqlXh4uSr28rah6gca4rRTe0It8tfNAtBtmGmvhYr5jKEQT3KZV5WefI+7OKajXDRJ2 1MmQ== X-Forwarded-Encrypted: i=1; AJvYcCU9sqAClWtMiih67OydsUsd34xY5LauFuRfxftMIRhXETCfcybEroDvrh9VxtC6yX8j+a+/kXVTa0cHgXVaBARQDzFGVg== X-Gm-Message-State: AOJu0YyN+0mRmnzEPGJI2E10c69BOHn3QNOSB7bXw0CIHqCPPzL/PfOC ClnOLqKq2zbtZKBJj6Im0A/cXQyzAMS7H/kakXmiCejLZ4vpD7VEMXWtH6Ild5c= X-Received: by 2002:a54:4790:0:b0:3da:b3c2:b4c0 with SMTP id 5614622812f47-3dc3b455a2amr619017b6e.31.1723086904993; Wed, 07 Aug 2024 20:15:04 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3db563c77b6sm4582401b6e.54.2024.08.07.20.15.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:04 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 27/38] mmc: exynos_dw_mmc: Read common clock-frequency property Date: Wed, 7 Aug 2024 22:14:33 -0500 Message-Id: <20240808031444.9619-28-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Instead of using non-standard "bus_hz" dts property, read common "clock-frequency" property used in upstream Linux kernel. It's safe to do so, as "clock-frequency" property was already added to corresponding nodes in all affected Exynos device tree files. No functional change. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) drivers/mmc/exynos_dw_mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index 612c2d0c615d..bed8bd8a0fcf 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -306,7 +306,7 @@ static int exynos_dwmmc_of_to_plat(struct udevice *dev) } host->fifo_depth = dev_read_u32_default(dev, "fifo-depth", 0); - host->bus_hz = dev_read_u32_default(dev, "bus_hz", 0); + host->bus_hz = dev_read_u32_default(dev, "clock-frequency", 0); return 0; } From patchwork Thu Aug 8 03:14:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817692 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675778wrt; Wed, 7 Aug 2024 20:19:59 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU9UHsxG+HY91r5h1sL19JhzyBnQo8oZnQw1yz2MnAjRUs8NX33sL0bIY1Jpaw0p+rkSbVYyDRdrkf66RA6wzjN X-Google-Smtp-Source: AGHT+IGfH/M35Zrdqbtt9VBkRE3+yicz1dhTXd3R/zqMHGFIh9XYLDhU/C84SrYHvFclLo7oJsa4 X-Received: by 2002:a05:6512:3984:b0:52f:89aa:c344 with SMTP id 2adb3069b0e04-530e5870607mr360213e87.16.1723087198844; Wed, 07 Aug 2024 20:19:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087198; cv=none; d=google.com; s=arc-20160816; b=V6NRF/Nn+qnySyLV7jzUkjgTb+NBSkZ6J0cAXldn8JtQu7Lgr9W2TH1LQ2IEIYuw9N EAdSOR/Za75hNbXpBOh6l1iBoVOvZLAPY7K7eXFACv2vEGYCBeDrDaNr968GD8nsUrHG v9D3f5zNeWvhkp6XhW/nWhVz7AoaXLzwCfLs7b/D8P0WeHQpEH4jeZi69nAzRx+w0Xw7 TkkAXfq5eaSRWyKz0kZET3Ef84yAIvE2nRXkR6DjA9qN4FbwrS1RcjUCTMNAF4H8jMnv ytkDUdNQbQKhWD/+UN5fNgAc3HgNbxVdt61aSzNm1OQ6VCO8ZZo/d4YmqxUZFd0unM6w lnSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=crDJTDIWGS2LNY90dpOb7cQutAxy6tgKbBo7wBVDAbM=; fh=D0c9laY1G9H7/dRPYaB814NLKEpKanoh9LkRKsZX/P4=; b=c8OPUczjvl8N5n2vnQMxogHPdI+BIsKK8DaVuRKZ5cJvTTkOBsaaOV4YcQPiEi4P1E NqGOIPiokMhKmSsp2JbE5FBQ8cwLKqzQerACbJvLuuegnFImcgRz5FfxepvZBWGJ5p6k yp0pZLN6C6BP0demq1ha2aVcyzxg36Jt1tlmdDFS4zW+OZYob0POajED/QysIraxT5+w h9LHJdYkVfL3RpkraF4Juq0V1Hyv1ETmv0Xl85s3WbZOddLJB5A9kszKSigUQJRAgWUo 62MywgZB6biyjMvkoMfO8lU6cmEJg/06gCsLslskdVJyRE42HbcOy2sbiCP3OifYUhqc UmmQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P8Or0G8K; 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-a7dc9f68ddcsi742029066b.943.2024.08.07.20.19.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:19:58 -0700 (PDT) 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=P8Or0G8K; 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 977D688BFC; Thu, 8 Aug 2024 05:15:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="P8Or0G8K"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8930288B28; Thu, 8 Aug 2024 05:15:10 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) (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 0DD0988A8C for ; Thu, 8 Aug 2024 05:15:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3db130a872fso388279b6e.2 for ; Wed, 07 Aug 2024 20:15:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086906; x=1723691706; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=crDJTDIWGS2LNY90dpOb7cQutAxy6tgKbBo7wBVDAbM=; b=P8Or0G8KoCtunzFsSC/lmeqejFCP8Gi+5X4+hO75aUxNmBYtUP08RYZnGxBhkdSwAJ I+jAYNvTwNuOdlcFwI5XQFNUR89/KuHRVy/B6+eNiy7d8slWM+QUq1wE3i/NeI4Y/ucd kmKm85PCaL3VoFLiLkcl6UmEtsrNVP6wCTAAcwlDxxQPJU8EZjKFpV/uYrj1zgVjWEHp 05CTMuIEy44D+R6EaTzG7IWGUhTqxsu6So+/EY+wBo0K11I1i7tDjnUkfIvQHkgoK4YQ Ihbmzu24NPJ8NOui9nNfaxNd453Dq+IwbzhuAC2okng+G4Ig1iPcMNgbJEkoSNrqIIUo ZjTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086906; x=1723691706; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=crDJTDIWGS2LNY90dpOb7cQutAxy6tgKbBo7wBVDAbM=; b=h8SJt+V8FbrfBCrzouWyUK64uiVHgNbjPavbEzRVkdbGmqSaa9SHitE2BJD0bsirFR M/Z2QNFNXltfkFyDzXuGX39ISVLE97fZmRUrO5+siwaTG6EyzTqAte1tpW5VDsAIizfX pklCgnGsC/UHY82WQzTKxW6c3/14IkQzd8HRyB09DmZ3W9BcJ0gWNPNyQoLoI4tXk5+p ncsSgD75hMABRyCf7K8Jb/LCUBhtNWRJ14+KbUZkHIFmV5meNBqLVK+IGQezNf90q1fu O4Iv85IsS5LX/8iGFRK8Wn8hbhZWEpWYahC5f2QBBuEP7XZTQ7FVTMzMCHvaM3e7EMA/ 7CvQ== X-Forwarded-Encrypted: i=1; AJvYcCW7SiA//l+MYVrbWJ+HCI/sdYKH1VVDrvou/ioQ9L6dle1E4dbVv2P49co+OHf0uS6VF6QG+4jB2YWDu56hxZPPpenm7Q== X-Gm-Message-State: AOJu0Yy6fJH90Eoly8YDs3Oq1tfjfIwAhQ19KCvaau9U1ftFB5JRDH4Q ujMDqZPxEwPzHT4U3AVBGwOhJxUWf/A/jI/3NJZJ4Vv1xX2X2UQf50SnkLbhXQE= X-Received: by 2002:a05:6808:178e:b0:3d9:2626:c64a with SMTP id 5614622812f47-3dc3b41c71dmr601694b6e.18.1723086905844; Wed, 07 Aug 2024 20:15:05 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3db563b8707sm4625099b6e.36.2024.08.07.20.15.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:05 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 28/38] mmc: exynos_dw_mmc: Move quirks from struct dwmci_host to chip data Date: Wed, 7 Aug 2024 22:14:34 -0500 Message-Id: <20240808031444.9619-29-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 host->quirks field is only used internally in exynos_dw_mmc.c driver. To avoid cluttering the scope of struct dwmci_host, move quirks field into Exynos driver's chip data, where it can be statically defined. No functional change. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - Replaced CONFIG_IS_ENABLED() with #ifdef drivers/mmc/exynos_dw_mmc.c | 13 ++++++++----- include/dwmmc.h | 5 ----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index bed8bd8a0fcf..b9d655c0d5c8 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -25,6 +25,9 @@ #define EXYNOS4412_FIXED_CIU_CLK_DIV 4 +/* Quirks */ +#define DWMCI_QUIRK_DISABLE_SMU BIT(0) + #ifdef CONFIG_DM_MMC #include DECLARE_GLOBAL_DATA_PTR; @@ -39,6 +42,7 @@ struct exynos_mmc_plat { struct exynos_dwmmc_variant { u32 clksel; /* CLKSEL register offset */ u8 div; /* (optional) fixed clock divider value: 0..7 */ + u32 quirks; /* quirk flags - see DWMCI_QUIRK_... */ }; /* Exynos implmentation specific drver private data */ @@ -173,7 +177,7 @@ static void exynos_dwmci_board_init(struct dwmci_host *host) { struct dwmci_exynos_priv_data *priv = exynos_dwmmc_get_priv(host); - if (host->quirks & DWMCI_QUIRK_DISABLE_SMU) { + if (priv->chip->quirks & DWMCI_QUIRK_DISABLE_SMU) { dwmci_writel(host, EMMCP_MPSBEGIN0, 0); dwmci_writel(host, EMMCP_SEND0, 0); dwmci_writel(host, EMMCP_CTRL0, @@ -205,11 +209,7 @@ static int exynos_dwmci_core_init(struct dwmci_host *host) } host->name = "EXYNOS DWMMC"; -#ifdef CONFIG_EXYNOS5420 - host->quirks = DWMCI_QUIRK_DISABLE_SMU; -#endif host->board_init = exynos_dwmci_board_init; - host->caps = MMC_MODE_DDR_52MHz; host->clksel = exynos_dwmci_clksel; host->get_mmc_clk = exynos_dwmci_get_clk; @@ -352,6 +352,9 @@ static const struct exynos_dwmmc_variant exynos4_drv_data = { static const struct exynos_dwmmc_variant exynos5_drv_data = { .clksel = DWMCI_CLKSEL, +#ifdef CONFIG_EXYNOS5420 + .quirks = DWMCI_QUIRK_DISABLE_SMU, +#endif }; static const struct udevice_id exynos_dwmmc_ids[] = { diff --git a/include/dwmmc.h b/include/dwmmc.h index 8c2500da9efe..6edb9e1a59c5 100644 --- a/include/dwmmc.h +++ b/include/dwmmc.h @@ -149,9 +149,6 @@ #define DWMCI_IDINTEN_TI BIT(0) #define DWMCI_IDINTEN_MASK (DWMCI_IDINTEN_TI | DWMCI_IDINTEN_RI) -/* Quirks */ -#define DWMCI_QUIRK_DISABLE_SMU BIT(0) - /** * struct dwmci_idmac_regs - Offsets of IDMAC registers * @@ -180,7 +177,6 @@ struct dwmci_idmac_regs { * * @name: Device name * @ioaddr: Base I/O address of controller - * @quirks: Quick flags - see DWMCI_QUIRK_... * @caps: Capabilities - see MMC_MODE_... * @clock: Current clock frequency (after internal divider), Hz * @bus_hz: Bus speed in Hz, if @get_mmc_clk() is NULL @@ -200,7 +196,6 @@ struct dwmci_idmac_regs { struct dwmci_host { const char *name; void *ioaddr; - unsigned int quirks; unsigned int caps; unsigned int clock; unsigned int bus_hz; From patchwork Thu Aug 8 03:14:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817694 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675892wrt; Wed, 7 Aug 2024 20:20:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXkQAaSKd27kR2XHxSktKVzPmLtyQG36yvmfSbMaljc8jCSWhoq5f7CFP/SRqUQ4BVFe3X1t3s5BCmfM9bwzJyH X-Google-Smtp-Source: AGHT+IFARbVFLd6Zddu3eZm82rjDFjc6oA/FTFF/kc+ua54gVwXP3Dhw2Yg6BGL4vGEPt10dHWu4 X-Received: by 2002:a17:907:ea1:b0:a75:2495:a6a3 with SMTP id a640c23a62f3a-a8090f03f38mr36041066b.67.1723087220655; Wed, 07 Aug 2024 20:20:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087220; cv=none; d=google.com; s=arc-20160816; b=TlGJbIFXNTpgvOuTl/R1ct4YEBRa/VL17+VA2+e+0KYOlZrv0aXy3yNU1xDO+zR6eH Y7JCu2/NPZRZAIs0MTM4e1wDI9AXpumrqDpFKLu9CiENNVD3XN63taBrLw3o+/Sxx8Hi 8J+mesRBZwyki5yW4Bj7oFKN+YbDLFrJQZ52GDNG37l5WEY3LFLO2PZYJg8OBUk6QkpL 9bYqA8XE5FCSCb78vXHjDIN949SETbjoKoTH7Rat1A+G8JDO5xMTno6AVngrWBZu5yZn hukT6cmqMW6ud7SslKK2+VDQTCDUKIul1V+RP4ooyw4Js8kBHCtVooH7nhPShlF4J1vj LE0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DSKAXbivnyO7PTI88YIY/YwtRuzwHbsX/v2bURPmZbc=; fh=vmnHnmHxGt+PJgkDyp90Nzp0hI8d6+a1PnvqAMs9Yxs=; b=wd/j98Im9qfY4LzujlqcVA4OQ7Bwug9EiNpXfIfOg9n2gFfut5T82BfTAWQbWUofDz /5kAix91YLWWa0vfxnJNpdrakaEQzGpz3uvVUHoVpqc4Z2HxXMpNMBAD4rh12beoZQmy qu8UWEE/ngkV8SjD4sbrJeHMJI5yLAaAmvw2duqXEitta+f2toDrNRocDaF/02vduAws nUde8XMnA5lbNB3y+pbosrrioKUe/A+neRsr5StmtOaujeFV1nSJAJF57H+mLQY0JN97 At8yVbJPE426m8kmt/WVzQlmSLZ1+a4eKWq1stGDLMN/UoDE2f58D5RZT/3SWZRE3eVk ZIoA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nIuTyDrR; 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-a7dc9f329c9si726947966b.868.2024.08.07.20.20.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:20:20 -0700 (PDT) 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=nIuTyDrR; 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 952D388BE1; Thu, 8 Aug 2024 05:15:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="nIuTyDrR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DF0FC88B6B; Thu, 8 Aug 2024 05:15:11 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) (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 C0EBC88B60 for ; Thu, 8 Aug 2024 05:15:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-3dc16d00ba6so401567b6e.0 for ; Wed, 07 Aug 2024 20:15:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086906; x=1723691706; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DSKAXbivnyO7PTI88YIY/YwtRuzwHbsX/v2bURPmZbc=; b=nIuTyDrRtLzuLu0jSdeiO79eHcLAzOmixTwwe9Dao1Pxvpn7fwtcI0Ol7UX9zIZGAq DnAZWSTNFTkH2w6GY1uES5FL/FV6WupRfGN4dBO47djCot3eVPHyw6kXAOZA8MrSHOnO PdyVmY+F26wUIKDFDdcktnHkakRi/d5TwSZGE/51qsn5GfY04z2e7ShCiCSXbaqewoHU wTLu1sUVhPMUioMxoyAGqShfKHaK3rLPkTXKQifL+aipyVmRig9q57ExBfedEnUWzm+p Da/gmzMBd1E5+ZRl/KrkRkjOczdHObB82apb06cfOtaLzU8lqb2oC1aH2h/gqbQYwDR8 0xXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086906; x=1723691706; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DSKAXbivnyO7PTI88YIY/YwtRuzwHbsX/v2bURPmZbc=; b=E44Blt19n67hXqUrqSWznUgPNfEiZ0c2IItigoHTzb1wBIlkC+QnoLnCXBa2vA/JAr b/bgbY7iTRIIzGBi5//BhIFqAv7yVLdFDwvHJ3YOjUY+QanqPZOQrbIHaumZ2doyETWM w+zgEp1fn8QY7khw/ngU/Bdrq4tEL8aFXuKwPJTgvpMNsrbmhnOl/3cA8/xLEeraq0oG FWc+aYdbnpa6S4MMYTzR0mlxLYyGfqeRr62rgz8d9d/y489jpeN2eN6urOOhZue0pdOh SyEf16XTLCoIWj5hS6VSnKagAPRcKyrVEdUgFuaIshfQfy8soewBQyBCWxYa3SFPfP/A /uVA== X-Forwarded-Encrypted: i=1; AJvYcCURk8nXkhB3GYe1CNsNUDyfahUh4kl5QdUVkiwGLfRIs5ibsOKlG1GYuIeaow8WZHTX4O1bhoCpLPFxcGL+GHufl/M6iQ== X-Gm-Message-State: AOJu0YxdNmy2OEEXQ5j+kZpeq6wKD4BOiXb6GlbQvDE1iAuujxZImcGh yjapInhQF1pjfGEahahgt2MvjHvSG24t3XwHFTBIgLY2gGqxIq/IRV+3SR8SSUM= X-Received: by 2002:a05:6870:7815:b0:261:26ab:f89d with SMTP id 586e51a60fabf-2692b7f6fc3mr627609fac.48.1723086906594; Wed, 07 Aug 2024 20:15:06 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-70a31eaf6d6sm5127643a34.30.2024.08.07.20.15.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:06 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 29/38] mmc: exynos_dw_mmc: Read and use DDR timing when available Date: Wed, 7 Aug 2024 22:14:35 -0500 Message-Id: <20240808031444.9619-30-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 DDR timing values should be defined in "samsung,dw-mshc-ddr-timing" dts property, and used when DDR MMC mode is selected. Read that value from dts and use it. If it's not available, use SDR timing values instead. This change is following upstream Linux kernel implementation. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) drivers/mmc/exynos_dw_mmc.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index b9d655c0d5c8..32f3ea168b6c 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -52,6 +52,7 @@ struct dwmci_exynos_priv_data { #endif struct clk clk; u32 sdr_timing; + u32 ddr_timing; const struct exynos_dwmmc_variant *chip; }; @@ -127,8 +128,14 @@ static int exynos_dwmmc_set_sclk(struct dwmci_host *host, unsigned long rate) static int exynos_dwmci_clksel(struct dwmci_host *host) { struct dwmci_exynos_priv_data *priv = exynos_dwmmc_get_priv(host); + u32 timing; - dwmci_writel(host, priv->chip->clksel, priv->sdr_timing); + if (host->mmc->selected_mode == MMC_DDR_52) + timing = priv->ddr_timing; + else + timing = priv->sdr_timing; + + dwmci_writel(host, priv->chip->clksel, timing); return 0; } @@ -305,6 +312,17 @@ static int exynos_dwmmc_of_to_plat(struct udevice *dev) priv->sdr_timing = DWMMC_MMC2_SDR_TIMING_VAL; } + err = dev_read_u32_array(dev, "samsung,dw-mshc-ddr-timing", timing, 2); + if (err) { + debug("DWMMC%d: Can't get ddr-timings, using sdr-timings\n", + host->dev_index); + priv->ddr_timing = priv->sdr_timing; + } else { + priv->ddr_timing = DWMCI_SET_SAMPLE_CLK(timing[0]) | + DWMCI_SET_DRV_CLK(timing[1]) | + DWMCI_SET_DIV_RATIO(div); + } + host->fifo_depth = dev_read_u32_default(dev, "fifo-depth", 0); host->bus_hz = dev_read_u32_default(dev, "clock-frequency", 0); From patchwork Thu Aug 8 03:14:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817693 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675850wrt; Wed, 7 Aug 2024 20:20:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVvwJshUzl3c32BNDTl5NMM9SQPkV7lbLGL/g9TC5hIWZSxm4eEej8Nn1J/uHyBW/MzJIUF3IiTbM3kRFRRc9+S X-Google-Smtp-Source: AGHT+IHVvuLz+lPFlpEksv5zGOWwL4kdz3LKwv+Rv/GanH7maHNPIDqCZpWr05NvXXsJeIW9ZW5b X-Received: by 2002:a17:907:f724:b0:a7a:a30b:7b92 with SMTP id a640c23a62f3a-a8090c02a4bmr31559066b.1.1723087210262; Wed, 07 Aug 2024 20:20:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087210; cv=none; d=google.com; s=arc-20160816; b=dPp2BBSmI/dZsz/zBn9qCPCx+t/ieNn3e4pK3tPqAsBp2BB9MeoMM2ypO4gIdRD0vT 1hpHd5Zl2y3s6FyWsMpa+GNSVBMPrQ/bG3tB3vmkx8VP9u/vqNgnGfPTzlMAjY4aDiXD LGyT8iiC+62A/bAtXQWwaORy5im1h1LDqCXlOERxF0Eb5TaHFqFuBnacsqZZbfOZRnG3 3LY3Hkp50cIJaG725yJj1EBNaonQARoBbfY/iQ0a86jXEHESOJ6YbhAKICQHR7Ksnrko g4M7J7clJv+AyDwDEQA5C6FYzIqFkTxAwVyVXepd6rfyHe01XF7I9wUwbg5QFUuZ4Jn5 4OJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fWrhxoCkEjPUic6kyEGt3ZwqMIeuuOwcuUhFbLTHQ3Q=; fh=ah5ct/5fz+6pitH2Q0Q2vs0v4cNjiuHZWqfUP1JTzU4=; b=oz6Xxu+lwqlXdisslG+kpc09YQo6mtVNMj8J240+tyKmxwL/38pqyPJxsDEsgbg4Em dJL1WOL2JQm3kWzPv686tQTtAxqvOO5qewCciss4JPA7ewNf84MZ1774QzF2lu8G+00i Mtn2JlWATgygE5azQxsENv2obQafdEhkl2nnHyH2QoeMsAW3BrtxNQdEGqWsbzzOt/6j A9e8MTt0C8AThKydzwp76inEyRrjaBX71tj8e45o7L6AIZRzU8nqFoFvFyT4nXmreGB/ WddkIJM+iuymKuviCER2rXsoh5lNyqaB2Wj0LfCWe0IYdQWRAa0LVDH6JaakdZe+dqhA T+ZQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FiCcR0Aj; 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-a7dc9bd04d2si732366266b.101.2024.08.07.20.20.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:20:10 -0700 (PDT) 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=FiCcR0Aj; 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 13C7788C0F; Thu, 8 Aug 2024 05:15:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="FiCcR0Aj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D40D588B8D; Thu, 8 Aug 2024 05:15:10 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc35.google.com (mail-oo1-xc35.google.com [IPv6:2607:f8b0:4864:20::c35]) (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 8C20E88B1E for ; Thu, 8 Aug 2024 05:15:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oo1-xc35.google.com with SMTP id 006d021491bc7-5d5b986a806so736522eaf.1 for ; Wed, 07 Aug 2024 20:15:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086907; x=1723691707; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fWrhxoCkEjPUic6kyEGt3ZwqMIeuuOwcuUhFbLTHQ3Q=; b=FiCcR0AjyqDPumbGI9lpf/iYgZ53oSFjVDtRsiNGlzBxjkB7lnt3uc8KH8xiOPfrZ0 SDZnlNiktyhdnBBAAPGusQwSKBH2/kSh7IKjh91LZTPO+v2bsgviCNVWET8vmON/NqhR bLQVxMLXLSj9tX6JE7Gne69KAg+lxj2yDOo+US81F20J5jX+u3+v6JykiZPvB82il5+e 98mIiDnFGLGtvwsG/w6fyUi9qTjGEJK2EwB8dj9gDBDj6FrXHL8NQ13R6tI6LQPLeZAd lu+HSiZke11CqjkGIsqk23lxgtBuap0Ws/9JsmHkYfVZCX4UWx3vluWF+s5JLGMs+LKl 9W4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086907; x=1723691707; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fWrhxoCkEjPUic6kyEGt3ZwqMIeuuOwcuUhFbLTHQ3Q=; b=V6IuUI4qpiAa71aD/fZPUwHUOl+vAP7NkGXDATMVgREMUU73CBHF53Yqb1iHcpPtWI kBlWFQ+Lk38SRsi7PLbQ51bm8d8xdQzCs85xMUnmYcXJiggYEF3mucS6iGVqKQ84oMr4 ymt/Zjthk1sLLLxRQDPEW1LGgD5u9N5T3w6zu9MvYIw5mczuHElCGeSyfIbGanfO25rT uTWdGzBFkjRJ20Nrb+/fVNlbR6gty0hjknLFBghB/RXYIs92+DM4wpWk6KBzMNfGR33+ wByLY6kzzRUd4lJB+99Wwrz0+mLId7HV87oGL04nG26obK/C+PyiEkE24jhCTaMFX1cg gxvg== X-Forwarded-Encrypted: i=1; AJvYcCXsPcfGUtCcNWMONHCoRZxh/E8TPyDtCsIMN7/psv18t04mRw2WlkKU3ancak5wpdr4Tdvr2AjJzDMDPSg86sXKgRMlDg== X-Gm-Message-State: AOJu0YyLIHqDmvP+kd4j4qFg92yFX3jq+cMchkblEXepDtdMnCelJesO uiAPePEVhmWYliCWhd5iNa6ZTUe8B/GqyRSSZrX+hX+hJ3mNWEYyBiKB+ajgy5g= X-Received: by 2002:a05:6808:16ab:b0:3db:14d0:32c6 with SMTP id 5614622812f47-3dc3bfb13bfmr119546b6e.24.1723086907315; Wed, 07 Aug 2024 20:15:07 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3db563b8815sm4621381b6e.39.2024.08.07.20.15.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:07 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 30/38] mmc: exynos_dw_mmc: Set requested freq in get_mmc_clk() callback Date: Wed, 7 Aug 2024 22:14:36 -0500 Message-Id: <20240808031444.9619-31-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 By now exynos_dw_mmc driver was relying on the correct CIU clock frequency being set on driver init. But dw_mmc core is actually trying to change CIU clock rate dynamically, on init and in set_ios() callback, which it's requesting via host->get_mmc_clk() callback (the name is misleading: although it's called "get_mmc_clk()", it can actually request both get and set operations). Implement setting the requested rate for CIU clock in Exynos driver to achieve the correct dw_mmc core driver operation at all times. DDR mode requires the clock to be twice as fast (when 8 bit bus is used), so handle this too, to make DDR function properly. This change makes the eMMC throughput on E850-96 board twice as fast. That's because "clock-frequency" is set to 800 MHz in E850-96 device tree, but for DDR52 mode it should be 416 MHz (and TRM states it should be 400 MHz for DDR50/8bit mode). The dw_mmc core is requesting 52 MHz bus_hz for DDR52 mode, and DDR+8bit mode means it should be x2 fast, so: f_ciu = 2 * ciu_div * f_bus = 2 * 4 * 52e6 = 416 MHz, where f_ciu - freq of clock fed to DW MMC block from CMU (SDCLKIN), Hz f_bus - freq of clock fed to the card (CCLKIN), Hz ciu_div - value of internal divider (in DW MMC block). Another way to work that around would be overriding the "clock-frequency" property in corresponding dts. But setting the clock frequency dynamically as it's done here looks much neater. This implementation follows what's done in Linux kernel dw_mmc-exynos driver in .set_ios() callback for MMC_TIMING_MMC_DDR52 case. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) drivers/mmc/exynos_dw_mmc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index 32f3ea168b6c..ee3ae9f5e650 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -169,7 +169,17 @@ unsigned int exynos_dwmci_get_clk(struct dwmci_host *host, uint freq) u8 clk_div; int err; + /* Should be double rate for DDR mode */ + if (host->mmc->selected_mode == MMC_DDR_52 && host->mmc->bus_width == 8) + freq *= 2; + clk_div = exynos_dwmmc_get_ciu_div(host); + err = exynos_dwmmc_set_sclk(host, freq * clk_div); + if (err) { + printf("DWMMC%d: failed to set clock rate (%d); " + "continue anyway\n", host->dev_index, err); + } + err = exynos_dwmmc_get_sclk(host, &sclk); if (err) { printf("DWMMC%d: failed to get clock rate (%d)\n", From patchwork Thu Aug 8 03:14:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817695 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675929wrt; Wed, 7 Aug 2024 20:20:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUrlaTwvBVeNMo7n8FP1MeDAPhd31jVBuVTSmm4w2J3N5jwhuLsfjoZbKqCglcC3rhd/3WPItFGZYIi8q9WNVGY X-Google-Smtp-Source: AGHT+IGwGysx5WeWtZEYo/HdtkxZCIccu/ymxnCb81DWTJ2Ot8JOpzhk3RTPgaYBF6aiPI4dnwex X-Received: by 2002:a05:6402:1d4f:b0:5bb:9afd:8d05 with SMTP id 4fb4d7f45d1cf-5bbb23f70b1mr385326a12.24.1723087231386; Wed, 07 Aug 2024 20:20:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087231; cv=none; d=google.com; s=arc-20160816; b=caY2MIiQvYZw1cAYuKhrgsEQJHF8c1zFBHs3QkT59A21Hu4sWaaLN92njueXp0QWT4 kqy4umqX12IAncZQpqKhfNOJpUUgsL19/slRse1ujXu1QGdkL8HfYNyx7gZQQ6tKG8Eo shgejANR8rbGyk39xhxXzayNGwLyO5zFui8dPXcCmC7gQVnrxgCdQTIX+fbdu1IsTD7j f3+2yVyHAp5zD8NqL/rvr2iBZToxKlSyppsNyFg/6y1z7kwP5HKX6JrI54QHP9iXe8Jr JgbM1yxDDrTo0nYwrZ+Qnh2FnKHkiQJbL3QGewahzStfHWhqxLUzPcV0TgV+YERpPgaF OiLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+hh43Z+GW0dcCdUS/7pgvX0HmnQt16/ZlN6VS4bB2LU=; fh=UgwJ36QSqZ+XZWO1M71yCGI+KpMCWowyiGfzHPIv68o=; b=mRdgWHOYSdQk9ws+Wi28aJjM3EZWVPKGVml9bYgBP/Q6WE4Nv5wFMY+a0F9JSOEh7Y MWPlclQJoJ/NwgapZk03UncHoukjpNSbTl4NiRt09zvFK9ar04koMXqv6Pte5/1yZQXR dYR+8hAYLsgIZ5HjF8o5BK7otPnY0Q3Ap91hpQwYccxgBIDZB44MHwuHx+uqnDUrZOWm iXzHdFx5NfSEawkh+crHL0sjJx3WPTag5grqe8165QA79yiL8DIqsTjtA0gn9uOvHhMO P0fSmPq1d00XeVIdOzhA1k+aaWSpr0SBNtfbcgmooAHfHVpPiUyKMA8jazCBtcdnOqRe BPlg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nMMLMrBS; 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-5bbb2e7062bsi257475a12.641.2024.08.07.20.20.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:20:31 -0700 (PDT) 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=nMMLMrBS; 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 0514388C3A; Thu, 8 Aug 2024 05:15:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="nMMLMrBS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B627D88B48; Thu, 8 Aug 2024 05:15:12 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oa1-x2a.google.com (mail-oa1-x2a.google.com [IPv6:2001:4860:4864:20::2a]) (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 83F0588B69 for ; Thu, 8 Aug 2024 05:15:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-260f033fda3so359393fac.3 for ; Wed, 07 Aug 2024 20:15:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086908; x=1723691708; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+hh43Z+GW0dcCdUS/7pgvX0HmnQt16/ZlN6VS4bB2LU=; b=nMMLMrBS8wbj7Z5BKub0W0mA8JpR5RePPUEztm+PV/zDkxSqHktzod3txhG+PXEKqi PaFgsEmHE1ju5My8MDLNeHH8Cflp82X/mq2TkeloOQ1hf3hsWkG7vrNVz9atHgwj3A0p NKo+e3UcDgP3I6erLAYgvXr9RkpruP0ZU9QRj3su85dVs2g2CBI67KS/WuAPlGCMlT8L XdfnoK/Lm+xTRU200PJ7GX1ZU0sHBN+ek4IldfcoKj/nETMXUX5/RgtwL2L4imOamPKU Vo7/3sorDej8s8q1W9oihFkLg3e03yVTduUJvuoSeo58J+3SYpEikW9AsDP8oeyTcC4m VBIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086908; x=1723691708; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+hh43Z+GW0dcCdUS/7pgvX0HmnQt16/ZlN6VS4bB2LU=; b=ZlXTjbCPSBg0cQYZd1nC0dTEx+2Kf162joNhxqea2zQYspkwMmVvauJFEZO+rrgRPX IQHYVGlFoqoNH909mj7tE8BQdwuAeQnJCEhzZwhe+rlThYU24U0baIIlEOIgSXqNGw5T skC/Ow0e6PyZcdwHd6EYr4AeuocB9MUrAxHe2gAFyh7d/jTzEOReZFIKiE2397YXaC1P geHFmibwLxSnzQNwEOzJ2C9rYcheqaDxOdIE5vJBUUHnyqV+jE70CvfbWMBWtg3csfC5 95ini8nhEzz3JxJ3FzLoYsfq4uJqiktCBUO2ZwqDUsnxSlyRideNZVbts4Un+689Liqo QIow== X-Forwarded-Encrypted: i=1; AJvYcCVQmYfuy1PYuSS7qXt9h0zW6v0gRiLdUMHKhljniJXlVIZxz4ymEjFktovQwOxbSPehO+0WvJ1Mq8a+naLC6p15F+d/kg== X-Gm-Message-State: AOJu0Yy5vv18gsQLGsAGBj91CA7mJj1LuRuLJN45Pcs2SZkeyitb46u4 EezmYNPjQP4oS+Hadd6/K1eiJ3w9GUZt1EBIp66U5M8bpgSgPWTNrmCqDB654RU= X-Received: by 2002:a05:6870:1491:b0:254:f00e:56a2 with SMTP id 586e51a60fabf-2692b61b2ccmr671994fac.9.1723086908013; Wed, 07 Aug 2024 20:15:08 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2689a6d1b1asm4320250fac.58.2024.08.07.20.15.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:07 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 31/38] mmc: exynos_dw_mmc: Add support for ARM64 Exynos chips Date: Wed, 7 Aug 2024 22:14:37 -0500 Message-Id: <20240808031444.9619-32-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 the compatible entry and corresponding chip data for Exynos7 compatible chips, which covers modern ARM64 based Exynos chips. They have some differences w.r.t. old ARM32 Exynos chips: - CLKSEL register offset is different - 64-bit IDMAC descriptor and 64-bit IDMAC registers are used (implemented in dw_mmc core driver) In terms of the driver implementation, the CIU clock is obtained via CCF framework (as opposed to ad-hoc clock driver implementation for ARM32 chips). Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) arch/arm/mach-exynos/include/mach/dwmmc.h | 1 + drivers/mmc/exynos_dw_mmc.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/arch/arm/mach-exynos/include/mach/dwmmc.h b/arch/arm/mach-exynos/include/mach/dwmmc.h index 811e9a04c6e3..7cb71be0d9fd 100644 --- a/arch/arm/mach-exynos/include/mach/dwmmc.h +++ b/arch/arm/mach-exynos/include/mach/dwmmc.h @@ -8,6 +8,7 @@ #define __ASM_ARM_ARCH_DWMMC_H #define DWMCI_CLKSEL 0x09C +#define DWMCI_CLKSEL64 0x0a8 #define DWMCI_SET_SAMPLE_CLK(x) (x) #define DWMCI_SET_DRV_CLK(x) ((x) << 16) #define DWMCI_SET_DIV_RATIO(x) ((x) << 24) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index ee3ae9f5e650..29241edf7915 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -385,6 +385,11 @@ static const struct exynos_dwmmc_variant exynos5_drv_data = { #endif }; +static const struct exynos_dwmmc_variant exynos7_smu_drv_data = { + .clksel = DWMCI_CLKSEL64, + .quirks = DWMCI_QUIRK_DISABLE_SMU, +}; + static const struct udevice_id exynos_dwmmc_ids[] = { { .compatible = "samsung,exynos4412-dw-mshc", @@ -392,6 +397,9 @@ static const struct udevice_id exynos_dwmmc_ids[] = { }, { .compatible = "samsung,exynos-dwmmc", .data = (ulong)&exynos5_drv_data, + }, { + .compatible = "samsung,exynos7-dw-mshc-smu", + .data = (ulong)&exynos7_smu_drv_data, }, { } }; From patchwork Thu Aug 8 03:14:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817699 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp676130wrt; Wed, 7 Aug 2024 20:21:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVPc7OzBrjcwouzDPrhfuo9ugOtppJPNwjmNmDuTsT+cJIntpp0lc6tcxyxRoN8U+nYLinXFRxIz1GcLYjLBv3i X-Google-Smtp-Source: AGHT+IHE99p4TuLjx12tUizEsJm6sZnp5YCo86nSxjUxgiG3mnbnZ/KsNLKfE9G+JVUwPpCD53Vz X-Received: by 2002:a05:651c:1502:b0:2f1:750d:53a7 with SMTP id 38308e7fff4ca-2f19de1bc88mr3685701fa.8.1723087276954; Wed, 07 Aug 2024 20:21:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087276; cv=none; d=google.com; s=arc-20160816; b=oqO39pkSAGDGppSPzft8/mfBJDvpmsM5J089UaFNPyr413TeKWsptUdrwSPac8eEsA CU+SucahNwL7uuPR0fPgci9jBf+dbeqSLBI5mDVPDCpKRWTv23YUsB2jsuh8U4FbxO57 j0lF+YGVXkYAnSgl7NGI7YrL6e40VSr/cfH8RjdjWmzfgNZFcGphrezz3mvL0JcAbQiZ jpkDW/1tBjI3IYFqZ05ifohDjFW2tVqZb8zQUgoUVOdAXkJO1iIvU1J9yVMo5WKXvWBf +RvywU99glqRs+ey067/T+aNgyoJgYM3EVZ/IRTyMXpf9tSJW5zfMWa4xnKDgGxkNMg2 lk9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8NRQ4QXQbK1CqEg2RUXFUCwBoJYHu+XXTCKoRwHYpXA=; fh=PrDCTIQJUoqFSkGO46Tc7PCfO/jJ8i1wxzAEJUk0Ky0=; b=skjqN2nCNjlCMz9dLkyf6KquP43O39pAK5aMXlcxOxxHKnfKaMF9JYBlryEbqUg0f1 iHnh09epay6zNz5xhs+NwI3L59XehI2zi+wpWzQ/cx4mDMbdsWkUyGH/QigYgoImUNjE QD8VnKTsnU3v6CdCIFXNckn/EDIMIGceyj3Z2vZqr3wva9Bc4Enilwz66fb1O2dVb46V JTDROmQruQQjadQ8jWM/Pn3QPbXItEQviMCQ17jmHU3s2yyjgWgR6yKYLsIfdMcaj6iW 8AnHJMZdYwt8HYvG3/oAe80fNIYvs2sViaZDq8OCFhmGFpym1/ceDw++vPJ+L+1o01LF zM5A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C64RPkt2; 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-a7dc9d6853esi706444366b.445.2024.08.07.20.21.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:21:16 -0700 (PDT) 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=C64RPkt2; 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 BE38488C4C; Thu, 8 Aug 2024 05:15:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="C64RPkt2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 61BCD88A34; Thu, 8 Aug 2024 05:15:21 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) (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 5274F88B6B for ; Thu, 8 Aug 2024 05:15:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3db12a2f530so384671b6e.1 for ; Wed, 07 Aug 2024 20:15:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086909; x=1723691709; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8NRQ4QXQbK1CqEg2RUXFUCwBoJYHu+XXTCKoRwHYpXA=; b=C64RPkt2gcPXFVJpSm1DoPuFqif/h0MDl48yJI2TiBdSVsZZ3P+mCxzV7/STKZuidg C5jAnkTBneUs51S3dsLPw63mkhktoWSnQ2LRqOG2YGsw7S+D6+p1QYBggcHR4z7apRWY lc2zmJadptEORfdmEKnPdscK79Zd8plmMa06BM87NgRBVmnQGiHehX695etreGbYhTzH Lf5Ws0Ibd8wlR6BsGaZSUOAmN1Peu8DP2EuH/zO7X9zyVAAj6dWB9OjWTxAH/O+NG7Ve BzAmOyCgAkAo10vbu91eQIGnVXbPdyu0XMjMhbSxX7atCB7m9GUVXSE/bRlH+rXC82zX g2HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086909; x=1723691709; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8NRQ4QXQbK1CqEg2RUXFUCwBoJYHu+XXTCKoRwHYpXA=; b=YAnxVYVBdDE/ps89m0/0W0Lll1wkgkogvoiwfcSpqljWdMH0sE72ogH3BA6M4NVRGv bD2uaA2JkCSFtRZzPgWQKsmaNo9CcrMXpjwf3Xu+xta8aXCSV4qXPTL88w4wSKJ5yTjn BgyUHL44MHGd20WNJ1FfABznt0zeQFl+HsEJFmo1t0cZldMVk3PiTSG4TQYdGXIGuAIJ xKVPvz5Vw8qh6zP1ktir9Y5oKjYyT1p4RmMC+lkzilpUNs0gUVY3nbC7RNWfc2bqkSKt DiRAQKauj8Ns0Pd0xgZejbKFmB4fnOg9yRm3Zk/dwnQc4hKgKxYLxOzm7shKHCOHHC54 L7Kw== X-Forwarded-Encrypted: i=1; AJvYcCVC48gHoFdSMLFgo+qghLdWIJnwSFnzYi7Ct05BipSDHD6yUtuCMgV45uxlh9pR2M6C0ToPLZRnnIxCIj+TptAuCO8+gQ== X-Gm-Message-State: AOJu0Ywz4ktPteg3gFt4+FEoSZBnSbuHluUspG9w3uzoqNbh98Skuz3P mRuiRBigeqI9w8ve8E2F/fvysV43LRR3p9nWUrn3Q556o/BnKC/BpqtcP1yw0tU= X-Received: by 2002:a05:6870:a450:b0:261:1e3f:777c with SMTP id 586e51a60fabf-2692b6a4d27mr631960fac.27.1723086908694; Wed, 07 Aug 2024 20:15:08 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2689a2f2269sm4360022fac.14.2024.08.07.20.15.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:08 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 32/38] mmc: exynos_dw_mmc: Pull all init code into probe function Date: Wed, 7 Aug 2024 22:14:38 -0500 Message-Id: <20240808031444.9619-33-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean There is no logical sense to split the initialization code between multiple functions. Pull both do_dwmci_init() and exynos_dwmci_core_init() into exynos_dwmmc_probe() to make the code more simple and obvious. No functional change. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - Replaced CONFIG_IS_ENABLED() with #ifdef drivers/mmc/exynos_dw_mmc.c | 86 +++++++++++++++---------------------- 1 file changed, 35 insertions(+), 51 deletions(-) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index 29241edf7915..41fb32c579ef 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -209,55 +209,6 @@ static void exynos_dwmci_board_init(struct dwmci_host *host) exynos_dwmci_clksel(host); } -static int exynos_dwmci_core_init(struct dwmci_host *host) -{ - unsigned long freq; - int err; - - if (host->bus_hz) - freq = host->bus_hz; - else - freq = DWMMC_MAX_FREQ; - - err = exynos_dwmmc_set_sclk(host, freq); - if (err) { - printf("DWMMC%d: failed to set clock rate on probe (%d); " - "continue anyway\n", host->dev_index, err); - } - - host->name = "EXYNOS DWMMC"; - host->board_init = exynos_dwmci_board_init; - host->caps = MMC_MODE_DDR_52MHz; - host->clksel = exynos_dwmci_clksel; - host->get_mmc_clk = exynos_dwmci_get_clk; - -#ifndef CONFIG_DM_MMC - /* Add the mmc channel to be registered with mmc core */ - if (add_dwmci(host, DWMMC_MAX_FREQ, DWMMC_MIN_FREQ)) { - printf("DWMMC%d registration failed\n", host->dev_index); - return -1; - } -#endif - - return 0; -} - -static int do_dwmci_init(struct dwmci_host *host) -{ -#ifdef CONFIG_CPU_V7A - int flag, err; - - flag = host->buswidth == 8 ? PINMUX_FLAG_8BIT_MODE : PINMUX_FLAG_NONE; - err = exynos_pinmux_config(host->dev_id, flag); - if (err) { - printf("DWMMC%d not configure\n", host->dev_index); - return err; - } -#endif - - return exynos_dwmci_core_init(host); -} - #ifdef CONFIG_DM_MMC static int exynos_dwmmc_of_to_plat(struct udevice *dev) { @@ -345,6 +296,7 @@ static int exynos_dwmmc_probe(struct udevice *dev) struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct dwmci_exynos_priv_data *priv = dev_get_priv(dev); struct dwmci_host *host = &priv->host; + unsigned long freq; int err; #ifndef CONFIG_CPU_V7A @@ -353,9 +305,41 @@ static int exynos_dwmmc_probe(struct udevice *dev) return err; #endif - err = do_dwmci_init(host); - if (err) +#ifdef CONFIG_CPU_V7A + int flag; + + flag = host->buswidth == 8 ? PINMUX_FLAG_8BIT_MODE : PINMUX_FLAG_NONE; + err = exynos_pinmux_config(host->dev_id, flag); + if (err) { + printf("DWMMC%d not configure\n", host->dev_index); return err; + } +#endif + + if (host->bus_hz) + freq = host->bus_hz; + else + freq = DWMMC_MAX_FREQ; + + err = exynos_dwmmc_set_sclk(host, freq); + if (err) { + printf("DWMMC%d: failed to set clock rate on probe (%d); " + "continue anyway\n", host->dev_index, err); + } + + host->name = "EXYNOS DWMMC"; + host->board_init = exynos_dwmci_board_init; + host->caps = MMC_MODE_DDR_52MHz; + host->clksel = exynos_dwmci_clksel; + host->get_mmc_clk = exynos_dwmci_get_clk; + +#ifndef CONFIG_DM_MMC + /* Add the mmc channel to be registered with mmc core */ + if (add_dwmci(host, DWMMC_MAX_FREQ, DWMMC_MIN_FREQ)) { + printf("DWMMC%d registration failed\n", host->dev_index); + return -1; + } +#endif dwmci_setup_cfg(&plat->cfg, host, DWMMC_MAX_FREQ, DWMMC_MIN_FREQ); host->mmc = &plat->mmc; From patchwork Thu Aug 8 03:14:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817696 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp675966wrt; Wed, 7 Aug 2024 20:20:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX7fKTkvnGxzT+5FCcTHcfOXWAtb7yMRxsxBLaLqR3N6oIN5TKUgthNSfeubAOX8Qf/cqyI+rPb2lWdpT82QUMJ X-Google-Smtp-Source: AGHT+IE7BdXZu1ZCCDQhTBUzzad5q7eLCzBxexMccaYdTkoPnFZXT/IoxBnwRFGn6qGtvWyP7o32 X-Received: by 2002:a17:907:86a4:b0:a7d:d08f:95ac with SMTP id a640c23a62f3a-a8090e3ccfcmr24538166b.47.1723087241778; Wed, 07 Aug 2024 20:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087241; cv=none; d=google.com; s=arc-20160816; b=yDcI8otAgqsvos00RmIwBpCZOvXv6lKnPVCozvq7VMFFdYTwPNoc0UNNePn/IZnUhC UlfhqHLZ0i1TZYeBrDYcTkfG6v9FUhkf9y5vfzC6i2swDTMAXiwLZxThkKENPnTKXnxp f8ghAGRbsPNGzgZA3nF/tb0D+VTaDLopvVboVllR95eSbj8bLTXrEsNRTLgw0yta6K2V Ord6vgsOVwRrJmmdsR54tTClyCcIeHEJwSJLKkxzw6fqM03KiHpvTEvEFsE39KdoR6DQ WQQVb9LHWgHr7jcadExG944QogmcCZ+4FoTYGcNFJJosNFbe2ojTAjtQnAKhC+Ao8MLB yhew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=m4DMU5JktK+PKeTe51YJVJuuv8p8NLdnwCctV/VHPMo=; fh=cSnUVk/wugLNjHrir0P5w+O/CJdWMh5Uc82MJyvrY/4=; b=LORttIsAAIScjMISCA9Xl8W9BoCS4pDaVJiDwVuU2jWX9NsBQNqVGxMsg8Cfqbl06A RqUmDfsjmeDuqNN5SHFpu+EjBVhtj02W/STRi7vzw/siScltLBk39YQRFmjAIF8Nl6ub HfeDKN/uyc5hy1gp+hw+sEK1zvUF06jHv3p8Qrz4E6TDYrWPRqCy2oS+om881iVY0vwi 8tyy1JalpQurHFvTm2MnAO9PTuwRFZ1cJ6EgfdTpdrmjux/n5D0duO5cwlVOyCZRUc/y UWJV17n2ckjIgtxO/UcFvMOEDSFR3gpc9IqmTK6N40FgPhsfMExqw8xdFtMxL2RknSmD KzUg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JLLYAjm4; 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-a7dc9f6a4cbsi742500166b.1037.2024.08.07.20.20.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:20:41 -0700 (PDT) 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=JLLYAjm4; 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 6825088B99; Thu, 8 Aug 2024 05:15:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="JLLYAjm4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4A83E88C06; Thu, 8 Aug 2024 05:15:20 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0: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 5CA8388C15 for ; Thu, 8 Aug 2024 05:15:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-ot1-x32d.google.com with SMTP id 46e09a7af769-70943713472so208175a34.2 for ; Wed, 07 Aug 2024 20:15:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086909; x=1723691709; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=m4DMU5JktK+PKeTe51YJVJuuv8p8NLdnwCctV/VHPMo=; b=JLLYAjm44UrhvVj+S8skfR0o671Mad+ySLPF09H/zwyAiqZKOzy23u8I8C+XNWhf4t iANtnewzoHzZduubZH6NuUaU4+oAXJkZaqqEugWUrWirY1pHOE/9X8Wz1b5TR82BqYUE tNia6FmMxT/wEoqdXV+HJFQWcYg+5+wvtxmaRvpSTXmD8KddW6ye2RgwCY6A4kY5JCvb nk9crbfsFYoh93j+59L3hEPp79PjvBWQ+E4gWV0271Tjl4DsncWnhyLpHBRbWmKW0kCL 8StE68v7QATUXV77UWRkPUJDHOF0dfT46wdVnVkeTFeEP7gz1kKjO1QphE6hfTpX/jqf Z0pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086909; x=1723691709; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m4DMU5JktK+PKeTe51YJVJuuv8p8NLdnwCctV/VHPMo=; b=ei3gkmx/JD/831LtbCC+4m636bGF5v0ycAo/RcWPTLg/geckyIq6o5RX5H3Y7upfZH vKIkxbuyibYXwya3ZqzjV25L58hCTe+6HmfA82N7XM6Lxz23LVRmxvEYNtnRGCdPxB0d kMPPnLpBWyuRSLQmOQ+rvI4TH7syvYi9Zn2GDwbyEorCZtK13b/IBvwqlz1lPurPsTQI 5FaGaJihT51ZAwk/lf4SnsxRGjIfKG8u81hoqaTASbzZJLShFT5kog/m3Oyb/nFhvLuC N6nRvAYVTpM3D9VtbCR29aECHNwt0jNrvCPJPv+a0wH+YqsFMrJWbJ7uxyhVQDSlwZna pnUg== X-Forwarded-Encrypted: i=1; AJvYcCXDiD9rTLkqWC/tg+2yM6m8IeIvT++sY3l6NrCE1+3z/zUSMXx0Fg+WBeoarucST67dPwX54Ye2evoniqPaBpBh3UoD+Q== X-Gm-Message-State: AOJu0YxOEk7TZ04lbfcb2rhsUhS/gwEJ0+j3JSYKgHGznanOBhZ3gJJh xAG1ymfPNqdGDm0+W76sUjC5gwClSnxILDQ5iCEsbyT1CujCRFKCBoKQOsJW5s8= X-Received: by 2002:a05:6830:6301:b0:703:6ca6:27 with SMTP id 46e09a7af769-70b4fc493cdmr996833a34.16.1723086909437; Wed, 07 Aug 2024 20:15:09 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-70a31eaf6d6sm5127661a34.30.2024.08.07.20.15.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:09 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 33/38] mmc: exynos_dw_mmc: Don't call dwmci_setup_cfg() after add_dwmci() Date: Wed, 7 Aug 2024 22:14:39 -0500 Message-Id: <20240808031444.9619-34-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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_dwmci() is already calling dwmci_setup_cfg() internally, there is no needed to call dwmci_setup_cfg() again in case when add_dwmci() is used (for non-DM cases). Fix it by calling dwmci_setup_cfg() only in DM cases, when add_dwmci() wasn't called. Also, this assignment: host->mmc = &plat->mmc; is wrong in non-DM case when add_dwmci() was called, as it's creating mmc object internally. Fix that by pulling that assignment into DM case, when add_dwmci() isn't called. While at it, add also this missing assignment: host->mmc->dev = dev; Fixes: 3537ee879e04 ("mmc: exynos_dw_mmc: support the Driver mode for Exynos") Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - Replaced CONFIG_IS_ENABLED() with #ifdef drivers/mmc/exynos_dw_mmc.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index 41fb32c579ef..43111b749a6b 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -333,19 +333,21 @@ static int exynos_dwmmc_probe(struct udevice *dev) host->clksel = exynos_dwmci_clksel; host->get_mmc_clk = exynos_dwmci_get_clk; -#ifndef CONFIG_DM_MMC - /* Add the mmc channel to be registered with mmc core */ - if (add_dwmci(host, DWMMC_MAX_FREQ, DWMMC_MIN_FREQ)) { +#ifdef CONFIG_BLK + dwmci_setup_cfg(&plat->cfg, host, DWMMC_MAX_FREQ, DWMMC_MIN_FREQ); + host->mmc = &plat->mmc; +#else + err = add_dwmci(host, DWMMC_MAX_FREQ, DWMMC_MIN_FREQ); + if (err) { printf("DWMMC%d registration failed\n", host->dev_index); - return -1; + return err; } #endif - dwmci_setup_cfg(&plat->cfg, host, DWMMC_MAX_FREQ, DWMMC_MIN_FREQ); - host->mmc = &plat->mmc; host->mmc->priv = &priv->host; - host->priv = dev; upriv->mmc = host->mmc; + host->mmc->dev = dev; + host->priv = dev; return dwmci_probe(dev); } From patchwork Thu Aug 8 03:14:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817698 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp676065wrt; Wed, 7 Aug 2024 20:21:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVTh9EBIEsunEaUfdhyMUx4jikprTBbtiEOSFTbqELRiRL/qv/+MHkGT0DgcUACyFSsvSZ5yHm5nRd3vab+EXnF X-Google-Smtp-Source: AGHT+IEiCJwkrmdxPneP9NqWUQ4b5cbGWpazMGEBCpJgcDWFf2V+NHm3OclIyXQ6mHt2aLRJQuK+ X-Received: by 2002:a05:6402:280c:b0:59f:9f59:b034 with SMTP id 4fb4d7f45d1cf-5bbb3c8f81emr338299a12.13.1723087262737; Wed, 07 Aug 2024 20:21:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087262; cv=none; d=google.com; s=arc-20160816; b=SidvpMoUOag8FZGQHrSlrCKXvWOI1r8Ntl0yBvIn6EWAJhjCLXk2/RsR81YnsH8zj9 zDWWHqD2XaPL1WkRwHUngzt8ifTKVJ05WNWO6g9nwnGvm0HlTR8YZ08IgJKrj61hQwDm aqMqaqBJbHNKPJ0QvO1dMO/nbcgzV4aPXMnn3Dcvx/AmotBYe92SaON/QCeWUZWHMr8e YQjWPhlkzO26zVfppRGJwyo87qoxyf0lpj8E4MOyv0WhduGf+yBdoS7OelB23mQF+O2d Wai87EEKJz/ZDcP8qqkqw2R9PwF7coOBgSOCYG5Uy/FtjJ9vuBvCNgQSWtuGuTgVDMgq vTVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RJSCepS5zMEk/aEHxN7GgskRjPtUAinU5iuesTC8YmY=; fh=XBrA0lxsZiLO05K3QQ2zmy1wTYHuby6BzzRGNGv6YZ4=; b=L1uUQOuQUHM1pNsdJOm1ckYydWJ0AaIpQijuJh5NDvTQQQGAqHJ+MZKoazCBMGbWGz dWFM9AOt6v2eF7hFqJuMd3BZIf5EFSLHMXV5tOKUs3vvHunQaoyoVMNXLwz3k0BCRC6k WrnZRyQNrwOCi2sh10T3Q6iPLbczREHkf6j3+QaswDUE8udGGgaKXGkO7ngicX4gPFez bTSPjZu/cjrvHe5AgOZH0vHY0Od2A9RLqPqIuMZkUPqWn3Tv7DdjjfwJThMgwBqdenCI 4uXHRoA1ObTphp3UM9XVqg6UItugIHdN9uYCdh3HF7LPCS52OaJGl8fP8j1UwVm4yhAa szog==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zwYTwJKe; 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-5bbb2c1f643si255780a12.183.2024.08.07.20.21.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:21:02 -0700 (PDT) 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=zwYTwJKe; 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 53D7E88C44; Thu, 8 Aug 2024 05:15:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="zwYTwJKe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 00C9A88A34; Thu, 8 Aug 2024 05:15:21 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc2c.google.com (mail-oo1-xc2c.google.com [IPv6:2607:f8b0:4864:20::c2c]) (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 B9C1588C1C for ; Thu, 8 Aug 2024 05:15:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-5d5c7f23f22so297675eaf.0 for ; Wed, 07 Aug 2024 20:15:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086910; x=1723691710; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RJSCepS5zMEk/aEHxN7GgskRjPtUAinU5iuesTC8YmY=; b=zwYTwJKez4AxsIeS6mu7ZR7U1zd3vtqHYNPyqdT3SZ3Talt3lrBu/jMjOG+L4J3p7Y acdnj3JTVIOVhOF/lOiyaXgQaCk+2ZddKCK4WYik+u0pf638FH0wDcCtfnWI3fW6Go0Y inhQ+him99t5/AuaWSssFqYCSdej1H86lLz2TbXFocBdhnBXUWK3FAe5cs4qXvwzVjYF JEsrMsqMl4YZN8GHmpx/S0G1L3F4O+E7I8G+XRVC8nzbAGj/Ei3HtZZclZsTjHd9Zh6X fScLupLv32g3Vab48whkI4edN6gdqLHjrK38GoAe6VdsPVjU+/LiTwnTdIQ/+HTDLK5h tANw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086910; x=1723691710; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RJSCepS5zMEk/aEHxN7GgskRjPtUAinU5iuesTC8YmY=; b=sPVsXrkNrETNr7Tc8MwUoI3KnyQe13Lu3glyhzGLf7LReslhcogPVzKP0Bhx8QfEeo cqq+hFUq6TDJMPUXMUr0ExzYNa9Kh/TCWosHhP45bsev4ssucnV6iHgtwMPGPrCmaO8G VGQ/Z7Zak+/ht6oEMDY+Vs8JT8jP98KzwDqLQxBfAhNDKwjW5bAJqVgCuJaukbDRvNvk UAJ0GGg2+eNgtvRgK2eC+ez8BjtKRPbdkMpNAwEK1er0wZiKmeW7r57QvBuBLjVMYJzF NdmLr4J22aBft8Bwvd7pZ6l7slrdNrvR5QnRdwDIhQY2NJBPtO9PAFgetk4ob+gfxL2e Hycw== X-Forwarded-Encrypted: i=1; AJvYcCVU3HwVk4VULOcpAquC6hcd7ewDvfluJd/RerHLvRzjSP1htcynRY1urSnuQ0fdPG45oe4hDKOU6WV3hgO28js6YkJB9g== X-Gm-Message-State: AOJu0Yzna0lEiCWMJLWxfKYc3Jjn7OpVm7w4CyzZe5TDqEbsXHRLo/3P qk8+HgfRBCER1ZXQbDfAf21PfIF9EaXYzJ0YKs1WfULkAkhYsrDvgizbxXnw8Rk= X-Received: by 2002:a05:6820:1e0e:b0:5ce:d2e3:b18 with SMTP id 006d021491bc7-5d855c6e599mr551553eaf.8.1723086910240; Wed, 07 Aug 2024 20:15:10 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5d76261a27fsm3523707eaf.39.2024.08.07.20.15.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:09 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 34/38] mmc: exynos_dw_mmc: Use dev->name as driver's displayed name Date: Wed, 7 Aug 2024 22:14:40 -0500 Message-Id: <20240808031444.9619-35-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Reduce U-Boot footprint by reusing dev->name as a driver's displayed name. This changes boot device name (and "mmc info" output) from "EXYNOS DWMMC" to something like "mmc@12100000". Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) drivers/mmc/exynos_dw_mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index 43111b749a6b..a9e240fd91d6 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -327,7 +327,7 @@ static int exynos_dwmmc_probe(struct udevice *dev) "continue anyway\n", host->dev_index, err); } - host->name = "EXYNOS DWMMC"; + host->name = dev->name; host->board_init = exynos_dwmci_board_init; host->caps = MMC_MODE_DDR_52MHz; host->clksel = exynos_dwmci_clksel; From patchwork Thu Aug 8 03:14:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817701 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp676191wrt; Wed, 7 Aug 2024 20:21:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVbzU7hMiQctro3TRgKfvte5Ny9kE85UgS5bDdACRkiMkuQYkQMUg2JTpalR1e30r4808XJ5hTxISpwQIzVCdqf X-Google-Smtp-Source: AGHT+IHLQFoc2pXyfoTRyx5GCMXSyBbtKnzEPnJRXN0mjttoNja+WqL1wd//uEDCxTbrMeG9BlXo X-Received: by 2002:a17:907:3e1d:b0:a7d:edb2:21f5 with SMTP id a640c23a62f3a-a8090c25611mr36892066b.12.1723087290833; Wed, 07 Aug 2024 20:21:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087290; cv=none; d=google.com; s=arc-20160816; b=JD8WR4GC0sshhnNAGm2Ol46Mt/Bbudu1eyTho1bwxujsY+xUKemFqsUM3ZajJGRTPe W/h0Rn3bv8183/ziCj6xqliDkJCHutf08YWx6BiFw/otk3xSQOqZRor11WitxTUPbxUP aoAiEyjic/QMUT+IpVldGuP4s42sFfD8TE3HxGu+pFtRsLakHFEEs5eOWrEwuILjHEWO 1xkIm9Ob7XwgMDpYvmvsKCwnbwo5Q8CzB+iEEH/IpWhtbz9Nika5ZgDCPyxCQMww5b77 zwhTlnNRB6/RvFtbINAxXdPeEGvUOxaOPmKWX1S0vKODLphX9OzFDx53nJRD3dIPkM27 SWbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rLFXdHGMnWLYnhM9vqaerX9xibelRdBawZDKsXl43no=; fh=HHDy10khPf8HPbHKAEPTjxNM7mAw6CBtRxH9XggdTao=; b=cJoeycv3vqmizataQdZWi58M3B2upo5MwJ02iEy3/zAvXfOoNogIYTJNS3ebmC0b0S JMgyEDjYKQCEL/ZcoiwOSB63kttlIgnBPQRyLlZxSf0Y4tulm2XL7qTwS6OZ84G/GXl/ rEU9I0xRzbiOE8BZvMMqdfFefF1TEugkVC5FmKPWC9D3UJ4D0nHAR4P6g5BLtOgT7Jgr Ii+3+Cj+hX0SEXw2J5E2aoHIm1tqxiL/9+rG0ukK250Rhd6+eUax8/N16lvuuXVr4TDZ tY5Y1nsZl5H/fG+WUmRXsS6/+kCXTFJm5t2ROBIeCZiDgP+C/l34EdCBS+d8Sy2lzo84 cBgg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L3Tgegg4; 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-a7dc9f3d693si700567866b.903.2024.08.07.20.21.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:21:30 -0700 (PDT) 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=L3Tgegg4; 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 1354088C25; Thu, 8 Aug 2024 05:15:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="L3Tgegg4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3B3D888C3E; Thu, 8 Aug 2024 05:15:22 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oa1-x2c.google.com (mail-oa1-x2c.google.com [IPv6:2001:4860:4864:20::2c]) (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 BCB7388C26 for ; Thu, 8 Aug 2024 05:15:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-260e6dfc701so357159fac.3 for ; Wed, 07 Aug 2024 20:15:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086911; x=1723691711; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rLFXdHGMnWLYnhM9vqaerX9xibelRdBawZDKsXl43no=; b=L3Tgegg4y9kBcjDHAoUBC2adutksC91S77Yj0jIfkfizSk06ouIyNMIX4QBl+N/lGI AMdeQdrfmP4KVMZ64GiGCLLnBNKT6gljo0Ibdl712+/fXouEvbY1tzixEWsfyAM1yOYD DF/XXXeZxUhJoDdqxrIM3efl0pfa1FHz2OnhyxYSiO6WCRQg5B4c/sU7Jaom0ZAL7tTi 5+mjtTlNm/g9tJ6bW9TWUGgJsmkYakxjuX/WHdQQgUe5Es5NiTO+CIY5DFOC1MoUuYSF oJOTZc2baJYrouZoG/fvhFKg7QWIgBI3Cs9yRsPCCS3SjSJo/xtcE/kSGNf3umUbdCyi NoEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086911; x=1723691711; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rLFXdHGMnWLYnhM9vqaerX9xibelRdBawZDKsXl43no=; b=FQJzvJFINUhi2DagUX1Sh+P4x1Zml5nSdDB5cvsXALeEeBJTtttLYnzUN2g4uIlile oChiCGHpO+JFmF6ybNvEeDPOeNkNzhBpfcpBTRDrHBjmphdbb9x+QSIwaIT8T3DPFJqD JxVv2gVGhcW6migZinpoAkc8vzHZuxdKwNVl/aie8SJPNFplyiIYvBABfN/uOpZPgPcB Y/n/G10NS+Eog6wsE93B8KXgNfys8O/nET8MYOXItI8uGUxgvXaPNo+8pOmZgqsy6HvZ zVQVGYArQUcgZdIHrGdqUz79+h/K/a9tSTK2qzgJhpLxpTDFA+uVR/QdviCZtIWlQWFq gJqw== X-Forwarded-Encrypted: i=1; AJvYcCXsODarkNZmk7BhhJxcXMGTteZPCoGAAucbPSxEPJQu2vZWL67i5MCDQcU64aCxJ6LpLy79dRwPapEiFY5FpMqIN2FIkw== X-Gm-Message-State: AOJu0YwntThoE20wCff88oqfYybcS/UuZfhcSNt5J5fmx4SCg+lHUeSl Q+QvPOQPWHzoaKtYnuxHjR8dw1R8ko/PxJk6TvM2XBCnr5l7kZsgPGYDalBcsJI= X-Received: by 2002:a05:6870:71c3:b0:261:acf:e964 with SMTP id 586e51a60fabf-2692b7f270cmr642320fac.48.1723086911047; Wed, 07 Aug 2024 20:15:11 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2689a2f1af9sm4379180fac.13.2024.08.07.20.15.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:10 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 35/38] mmc: exynos_dw_mmc: Improve coding style Date: Wed, 7 Aug 2024 22:14:41 -0500 Message-Id: <20240808031444.9619-36-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Fix most of checkpatch warnings and other obvious style issues. No functional change. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) arch/arm/mach-exynos/include/mach/dwmmc.h | 36 +++++++++++++---------- drivers/mmc/exynos_dw_mmc.c | 26 ++++++---------- 2 files changed, 29 insertions(+), 33 deletions(-) diff --git a/arch/arm/mach-exynos/include/mach/dwmmc.h b/arch/arm/mach-exynos/include/mach/dwmmc.h index 7cb71be0d9fd..75d84988b7d6 100644 --- a/arch/arm/mach-exynos/include/mach/dwmmc.h +++ b/arch/arm/mach-exynos/include/mach/dwmmc.h @@ -7,24 +7,28 @@ #ifndef __ASM_ARM_ARCH_DWMMC_H #define __ASM_ARM_ARCH_DWMMC_H -#define DWMCI_CLKSEL 0x09C -#define DWMCI_CLKSEL64 0x0a8 -#define DWMCI_SET_SAMPLE_CLK(x) (x) -#define DWMCI_SET_DRV_CLK(x) ((x) << 16) -#define DWMCI_SET_DIV_RATIO(x) ((x) << 24) +#include -#define EMMCP_MPSBEGIN0 0x1200 -#define EMMCP_SEND0 0x1204 -#define EMMCP_CTRL0 0x120C +#define DWMCI_CLKSEL 0x09c +#define DWMCI_CLKSEL64 0x0a8 +#define DWMCI_SET_SAMPLE_CLK(x) (x) +#define DWMCI_SET_DRV_CLK(x) ((x) << 16) +#define DWMCI_SET_DIV_RATIO(x) ((x) << 24) -#define MPSCTRL_SECURE_READ_BIT (0x1<<7) -#define MPSCTRL_SECURE_WRITE_BIT (0x1<<6) -#define MPSCTRL_NON_SECURE_READ_BIT (0x1<<5) -#define MPSCTRL_NON_SECURE_WRITE_BIT (0x1<<4) -#define MPSCTRL_USE_FUSE_KEY (0x1<<3) -#define MPSCTRL_ECB_MODE (0x1<<2) -#define MPSCTRL_ENCRYPTION (0x1<<1) -#define MPSCTRL_VALID (0x1<<0) +/* Protector Register */ +#define DWMCI_EMMCP_BASE 0x1000 +#define EMMCP_MPSBEGIN0 (DWMCI_EMMCP_BASE + 0x0200) +#define EMMCP_SEND0 (DWMCI_EMMCP_BASE + 0x0204) +#define EMMCP_CTRL0 (DWMCI_EMMCP_BASE + 0x020c) + +#define MPSCTRL_SECURE_READ_BIT BIT(7) +#define MPSCTRL_SECURE_WRITE_BIT BIT(6) +#define MPSCTRL_NON_SECURE_READ_BIT BIT(5) +#define MPSCTRL_NON_SECURE_WRITE_BIT BIT(4) +#define MPSCTRL_USE_FUSE_KEY BIT(3) +#define MPSCTRL_ECB_MODE BIT(2) +#define MPSCTRL_ENCRYPTION BIT(1) +#define MPSCTRL_VALID BIT(0) /* CLKSEL Register */ #define DWMCI_DIVRATIO_BIT 24 diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index a9e240fd91d6..c8bf89d6d355 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -45,7 +45,7 @@ struct exynos_dwmmc_variant { u32 quirks; /* quirk flags - see DWMCI_QUIRK_... */ }; -/* Exynos implmentation specific drver private data */ +/* Exynos implementation specific driver private data */ struct dwmci_exynos_priv_data { #ifdef CONFIG_DM_MMC struct dwmci_host host; @@ -121,10 +121,7 @@ static int exynos_dwmmc_set_sclk(struct dwmci_host *host, unsigned long rate) return 0; } -/* - * Function used as callback function to initialise the - * CLKSEL register for every mmc channel. - */ +/* Configure CLKSEL register with chosen timing values */ static int exynos_dwmci_clksel(struct dwmci_host *host) { struct dwmci_exynos_priv_data *priv = exynos_dwmmc_get_priv(host); @@ -163,7 +160,7 @@ static u8 exynos_dwmmc_get_ciu_div(struct dwmci_host *host) & DWMCI_DIVRATIO_MASK) + 1; } -unsigned int exynos_dwmci_get_clk(struct dwmci_host *host, uint freq) +static unsigned int exynos_dwmci_get_clk(struct dwmci_host *host, uint freq) { unsigned long sclk; u8 clk_div; @@ -204,7 +201,6 @@ static void exynos_dwmci_board_init(struct dwmci_host *host) MPSCTRL_NON_SECURE_WRITE_BIT | MPSCTRL_VALID); } - /* Set to timing value at initial time */ if (priv->sdr_timing) exynos_dwmci_clksel(host); } @@ -214,8 +210,8 @@ static int exynos_dwmmc_of_to_plat(struct udevice *dev) { struct dwmci_exynos_priv_data *priv = dev_get_priv(dev); struct dwmci_host *host = &priv->host; - int err = 0; u32 div, timing[2]; + int err; priv->chip = (struct exynos_dwmmc_variant *)dev_get_driver_data(dev); @@ -223,9 +219,8 @@ static int exynos_dwmmc_of_to_plat(struct udevice *dev) const void *blob = gd->fdt_blob; int node = dev_of_offset(dev); - /* Extract device id for each mmc channel */ + /* Obtain device ID for current MMC channel */ host->dev_id = pinmux_decode_periph_id(blob, node); - host->dev_index = dev_read_u32_default(dev, "index", host->dev_id); if (host->dev_index == host->dev_id) host->dev_index = host->dev_id - PERIPH_ID_SDMMC0; @@ -241,10 +236,6 @@ static int exynos_dwmmc_of_to_plat(struct udevice *dev) host->dev_index = 2; /* SD card */ #endif - /* Get the bus width from the device node (Default is 4bit buswidth) */ - host->buswidth = dev_read_u32_default(dev, "bus-width", 4); - - /* Set the base address from the device node */ host->ioaddr = dev_read_addr_ptr(dev); if (!host->ioaddr) { printf("DWMMC%d: Can't get base address\n", host->dev_index); @@ -255,17 +246,17 @@ static int exynos_dwmmc_of_to_plat(struct udevice *dev) div = priv->chip->div; else div = dev_read_u32_default(dev, "samsung,dw-mshc-ciu-div", 0); + err = dev_read_u32_array(dev, "samsung,dw-mshc-sdr-timing", timing, 2); if (err) { printf("DWMMC%d: Can't get sdr-timings\n", host->dev_index); return -EINVAL; } - priv->sdr_timing = DWMCI_SET_SAMPLE_CLK(timing[0]) | DWMCI_SET_DRV_CLK(timing[1]) | DWMCI_SET_DIV_RATIO(div); - /* sdr_timing didn't assigned anything, use the default value */ + /* sdr_timing wasn't set, use the default value */ if (!priv->sdr_timing) { if (host->dev_index == 0) priv->sdr_timing = DWMMC_MMC0_SDR_TIMING_VAL; @@ -284,6 +275,7 @@ static int exynos_dwmmc_of_to_plat(struct udevice *dev) DWMCI_SET_DIV_RATIO(div); } + host->buswidth = dev_read_u32_default(dev, "bus-width", 4); host->fifo_depth = dev_read_u32_default(dev, "fifo-depth", 0); host->bus_hz = dev_read_u32_default(dev, "clock-frequency", 0); @@ -396,8 +388,8 @@ U_BOOT_DRIVER(exynos_dwmmc_drv) = { .of_match = exynos_dwmmc_ids, .of_to_plat = exynos_dwmmc_of_to_plat, .bind = exynos_dwmmc_bind, - .ops = &dm_dwmci_ops, .probe = exynos_dwmmc_probe, + .ops = &dm_dwmci_ops, .priv_auto = sizeof(struct dwmci_exynos_priv_data), .plat_auto = sizeof(struct exynos_mmc_plat), }; From patchwork Thu Aug 8 03:14:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817697 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp676013wrt; Wed, 7 Aug 2024 20:20:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW9GuJ7GIcuSpi04S6zIYfYKE2ShNEfFVQWcUM/3oD1AxMcE5PfbW0ghL6iwhTn4fRgZ/EfT3BrK1d1PXgUG/SA X-Google-Smtp-Source: AGHT+IF+GsobJ0i0MmFfYMB4JE2xarAu3NJ9xXvk7RxqabEq+lFLgUdA+KuywQnFmK+aI4J5X+bi X-Received: by 2002:a17:907:da1:b0:a7a:a2e3:3739 with SMTP id a640c23a62f3a-a8091f226e3mr31860566b.20.1723087252062; Wed, 07 Aug 2024 20:20:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087252; cv=none; d=google.com; s=arc-20160816; b=dkHspWdKWsCk6DBsPQCPBCMsCyaAcyZxctsfdHyeCxNmAchzlotvtcSVcb1/5UdaR7 nxkl+xXpRyNl1uTdjqySTtCLVW2zipkbnp1Lfvu7y477TRhofvXoiMRsreGJewFtGOz7 uSIpGiZ35hA8VrMGFagxYH3al1WA5gS1w2Jmrf8wBpOxhkGPNzDnzoVgRRT/yocWWkxi 5QUPjnaxAgimBzi9mz7vwbkWdKURkDuRFemBHYlBrF9Xmwk5jwnQOznw6I+uh3mYHjNQ y5vQGQCsE/Hh1mqkqJfYmR8uDBUYSeJvPwxwHazSgemcdjXb2RFq26iSZjGfNzRI7Rhz Ybhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GMBO0TKnoGZ2Os/Na/4z8r9LiumA2hDLvzolhxblVXc=; fh=ASj29KsF9G4FzMcKY5qd3P8pgodZDGQblp4oSXgj8HY=; b=J6IZuQwsHwjPCajlvdnfN9udqGtfk0gyIy1vC0eFhj3TcON0ljXYLSTnCj+6ErITFx rWRt5KJfrLPk31GX+mNpJbArJ0O7y955Gjpg5iuNG066m0XYBghioeSIs8cTdR21cb82 cLWgCw/+i/uNyL+qzB1Vui/ZPGSKWCqaiefs5Zf7aeMyuz19JMNMubMepfvFwp9tjnwZ nGP+ZCy6zGGQSpGDnxSTNmp0N4MPJbCCO0xdLb3Fsc5pehq1HabgS9FCJANvUEZ2v1UN xh836KtOmiEIhjiDEQo15n3UXcIMMaXeXr4hrAyefvdyMeEXxOHCDnN8sOqxCIe8P8L5 BhPQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NhuqZtoH; 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-5bbb2cfec3asi263230a12.293.2024.08.07.20.20.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:20:52 -0700 (PDT) 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=NhuqZtoH; 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 D62A088BEF; Thu, 8 Aug 2024 05:15:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="NhuqZtoH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 778C788BB0; Thu, 8 Aug 2024 05:15:20 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) (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 BBE8688C25 for ; Thu, 8 Aug 2024 05:15:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-3db1bc36bc2so260898b6e.0 for ; Wed, 07 Aug 2024 20:15:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086912; x=1723691712; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GMBO0TKnoGZ2Os/Na/4z8r9LiumA2hDLvzolhxblVXc=; b=NhuqZtoHtg6Wykql8tOrZaLavl5VhNaZ6lkH7EIz1clDUeJylLDFn4iXzbIe5M5bhe RjhBncOqxFEgdBuDEPUvOl0kKvaXkvq075ThzK1nHnNmR9sase8cU0CMkFJm8IOHKlCt U0yzxaDjm7RZIDn6/PLtAix4/eyHlC0ij4nYwv7KlkuKU+6t194fI5Gif9t2kdKfqiv7 O5BHK1cdRjeGNEp3RQlAUtiM261hZmDlgM2z1tfG5LeihwI4MV3R/ngZWncpbD6bFUf1 GnTEEd7JImPwnZTSUp5FFPwEV7cL9ucxPibyLy9TkLm0wRXZMWXTP5oOPG/9z96ivMKt 2J/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086912; x=1723691712; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GMBO0TKnoGZ2Os/Na/4z8r9LiumA2hDLvzolhxblVXc=; b=OWWCXa8A+OgccUtGpGYveP8P8DvB1rkSBOaIxD3AMlYrDtuKvujbNpC5MuyxeQ4BgX OYXGKFCmz8+R5oLjjulmIXu/8DEsEc+xjIjd64TGlU/1vK7fLrEWqX+pFCLKQckw1EGc N3nxJKHsdPr/3Pb4UwQ+Nij9lgQW3erBZ+fFIRBRoXFUV31jX/QA2+Jb3g791J44eQSo ojijp4lYMnNrzpIMZP7hmLWDNoPmj3LbJRnh9LW9JBwd5wFUffiMyaQDcPvutS1otPBA rC1XrycjmILGCKtaIzXy04F1TVErtGO5qcLOGrI8Q8N+ybkySDbhuRMZ3Ree2wLi3tyJ X1PA== X-Forwarded-Encrypted: i=1; AJvYcCVxU7rJleW/5JNZfYZg2G2GdvtKBFK64qtzsIbSUu1RmGjSXTKFUxtaptU7FccppgAYMBO9D0GywlvYWG48/NwCGqwNzw== X-Gm-Message-State: AOJu0YwlME6yvzianiltrtXgmh4d3GXxQUdIhuBT0e8ImUux95fA0dpQ 91zspdAi3a/TZ7AY4l8kdg6kLca7/Ljq6zwRzhX2+ScJ0UAJUMLFqUhhSfg4grE= X-Received: by 2002:a05:6808:13d6:b0:3d6:2bab:16ca with SMTP id 5614622812f47-3dc3c184e05mr138478b6e.13.1723086911802; Wed, 07 Aug 2024 20:15:11 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3db5627d8c4sm4562880b6e.0.2024.08.07.20.15.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:11 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 36/38] arm: dts: exynos: Remove outdated DW MMC properties in all Exynos dts Date: Wed, 7 Aug 2024 22:14:42 -0500 Message-Id: <20240808031444.9619-37-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Upstream properties were added to device trees to follow current Linux kernel. DW MMC driver was updated accordingly. Safely remove outdated MMC properties. Details on removed properties are as follows: * samsung,removable: replaced by non-removable * samsung,bus-width: replaced by bus-width * samsung,timing: - replaced by samsung,dw-mshc-ciu-div and samsung,dw-mshc-sdr-timing in dw_mmc nodes - removed from sdhci nodes (it's neither described in bindings, nor it's used in s5p_sdhci.c driver) * fifoth_val: replaced by fifo-depth * bus_hz: replaced by clock-frequency * div: the fixed CIU clock divider value was moved to the chip data in exynos_dw_mmc.c driver No functional change. Signed-off-by: Sam Protsenko --- Changes in v5: - Rebased on top of changed patch 14/38 Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) arch/arm/dts/exynos4210-origen.dts | 2 -- arch/arm/dts/exynos4210-trats.dts | 4 ---- arch/arm/dts/exynos4210-universal_c210.dts | 4 ---- arch/arm/dts/exynos4412-odroid.dts | 8 -------- arch/arm/dts/exynos4412-trats2.dts | 12 ------------ arch/arm/dts/exynos5250-arndale.dts | 4 ---- arch/arm/dts/exynos5250-smdk5250.dts | 6 ------ arch/arm/dts/exynos5250-snow.dts | 6 ------ arch/arm/dts/exynos5250-spring.dts | 3 --- arch/arm/dts/exynos5420-smdk5420.dts | 6 ------ arch/arm/dts/exynos5422-odroidxu3.dts | 2 -- arch/arm/dts/exynos54xx.dtsi | 6 ------ 12 files changed, 63 deletions(-) diff --git a/arch/arm/dts/exynos4210-origen.dts b/arch/arm/dts/exynos4210-origen.dts index a4915de2c49c..40289c8c4aaf 100644 --- a/arch/arm/dts/exynos4210-origen.dts +++ b/arch/arm/dts/exynos4210-origen.dts @@ -25,9 +25,7 @@ }; &sdhci2 { - samsung,bus-width = <4>; bus-width = <4>; - samsung,timing = <1 2 3>; cd-gpios = <&gpk2 2 0>; status = "okay"; }; diff --git a/arch/arm/dts/exynos4210-trats.dts b/arch/arm/dts/exynos4210-trats.dts index 4fbdf4730994..88e9c0ed2bb0 100644 --- a/arch/arm/dts/exynos4210-trats.dts +++ b/arch/arm/dts/exynos4210-trats.dts @@ -240,17 +240,13 @@ }; &sdhci0 { - samsung,bus-width = <8>; bus-width = <8>; - samsung,timing = <1 3 3>; pwr-gpios = <&gpk0 2 0>; status = "okay"; }; &sdhci2 { - samsung,bus-width = <4>; bus-width = <4>; - samsung,timing = <1 2 3>; cd-gpios = <&gpx3 4 0>; status = "okay"; }; diff --git a/arch/arm/dts/exynos4210-universal_c210.dts b/arch/arm/dts/exynos4210-universal_c210.dts index 1b3ac1fee15f..c87b92be609d 100644 --- a/arch/arm/dts/exynos4210-universal_c210.dts +++ b/arch/arm/dts/exynos4210-universal_c210.dts @@ -235,17 +235,13 @@ }; &sdhci0 { - samsung,bus-width = <8>; bus-width = <8>; - samsung,timing = <1 3 3>; pwr-gpios = <&gpk0 2 0>; status = "okay"; }; &sdhci2 { - samsung,bus-width = <4>; bus-width = <4>; - samsung,timing = <1 2 3>; cd-gpios = <&gpx3 4 0>; status = "okay"; }; diff --git a/arch/arm/dts/exynos4412-odroid.dts b/arch/arm/dts/exynos4412-odroid.dts index a405b9708719..346e0f55c768 100644 --- a/arch/arm/dts/exynos4412-odroid.dts +++ b/arch/arm/dts/exynos4412-odroid.dts @@ -234,27 +234,19 @@ }; &sdhci2 { - samsung,bus-width = <4>; bus-width = <4>; - samsung,timing = <1 2 3>; cd-inverted; cd-gpios = <&gpk2 2 0>; status = "okay"; }; &mshc_0 { - samsung,bus-width = <8>; bus-width = <8>; - samsung,timing = <2 1 0>; samsung,dw-mshc-ciu-div = <0>; samsung,dw-mshc-sdr-timing = <2 1>; - samsung,removable = <0>; non-removable; - fifoth_val = <0x203f0040>; fifo-depth = <0x80>; clock-frequency = <400000000>; - bus_hz = <400000000>; - div = <0x3>; index = <4>; status = "okay"; }; diff --git a/arch/arm/dts/exynos4412-trats2.dts b/arch/arm/dts/exynos4412-trats2.dts index 30758ffa1ef9..2b71d328cd0e 100644 --- a/arch/arm/dts/exynos4412-trats2.dts +++ b/arch/arm/dts/exynos4412-trats2.dts @@ -108,9 +108,7 @@ }; sdhci@12510000 { - samsung,bus-width = <8>; bus-width = <8>; - samsung,timing = <1 3 3>; pwr-gpios = <&gpk0 4 0>; status = "disabled"; }; @@ -432,33 +430,23 @@ }; &sdhci0 { - samsung,bus-width = <8>; bus-width = <8>; - samsung,timing = <1 3 3>; pwr-gpios = <&gpk0 4 0>; status = "disabled"; }; &sdhci2 { - samsung,bus-width = <4>; bus-width = <4>; - samsung,timing = <1 2 3>; cd-gpios = <&gpk2 2 0>; status = "okay"; }; &mshc_0 { - samsung,bus-width = <8>; bus-width = <8>; - samsung,timing = <2 1 0>; samsung,dw-mshc-ciu-div = <0>; samsung,dw-mshc-sdr-timing = <2 1>; - samsung,removable = <0>; non-removable; - fifoth_val = <0x203f0040>; clock-frequency = <400000000>; - bus_hz = <400000000>; - div = <0x3>; index = <4>; fifo-depth = <0x80>; status = "okay"; diff --git a/arch/arm/dts/exynos5250-arndale.dts b/arch/arm/dts/exynos5250-arndale.dts index 7f84589c97a2..4c894f1712fa 100644 --- a/arch/arm/dts/exynos5250-arndale.dts +++ b/arch/arm/dts/exynos5250-arndale.dts @@ -27,9 +27,7 @@ }; mmc@12200000 { - samsung,bus-width = <8>; bus-width = <8>; - samsung,timing = <1 3 3>; samsung,dw-mshc-ciu-div = <3>; samsung,dw-mshc-sdr-timing = <1 3>; }; @@ -39,9 +37,7 @@ }; mmc@12220000 { - samsung,bus-width = <4>; bus-width = <4>; - samsung,timing = <1 2 3>; samsung,dw-mshc-ciu-div = <3>; samsung,dw-mshc-sdr-timing = <1 2>; }; diff --git a/arch/arm/dts/exynos5250-smdk5250.dts b/arch/arm/dts/exynos5250-smdk5250.dts index 882db2d1f608..f9f54cb63871 100644 --- a/arch/arm/dts/exynos5250-smdk5250.dts +++ b/arch/arm/dts/exynos5250-smdk5250.dts @@ -145,12 +145,9 @@ }; mmc@12200000 { - samsung,bus-width = <8>; bus-width = <8>; - samsung,timing = <1 3 3>; samsung,dw-mshc-ciu-div = <3>; samsung,dw-mshc-sdr-timing = <1 3>; - samsung,removable = <0>; non-removable; }; @@ -159,12 +156,9 @@ }; mmc@12220000 { - samsung,bus-width = <4>; bus-width = <4>; - samsung,timing = <1 2 3>; samsung,dw-mshc-ciu-div = <3>; samsung,dw-mshc-sdr-timing = <1 2>; - samsung,removable = <1>; }; mmc@12230000 { diff --git a/arch/arm/dts/exynos5250-snow.dts b/arch/arm/dts/exynos5250-snow.dts index bcf04d5c07c0..ab7b5212ba7c 100644 --- a/arch/arm/dts/exynos5250-snow.dts +++ b/arch/arm/dts/exynos5250-snow.dts @@ -301,12 +301,9 @@ }; mmc@12200000 { - samsung,bus-width = <8>; bus-width = <8>; - samsung,timing = <1 3 3>; samsung,dw-mshc-ciu-div = <3>; samsung,dw-mshc-sdr-timing = <1 3>; - samsung,removable = <0>; non-removable; }; @@ -315,12 +312,9 @@ }; mmc@12220000 { - samsung,bus-width = <4>; bus-width = <4>; - samsung,timing = <1 2 3>; samsung,dw-mshc-ciu-div = <3>; samsung,dw-mshc-sdr-timing = <1 2>; - samsung,removable = <1>; }; mmc@12230000 { diff --git a/arch/arm/dts/exynos5250-spring.dts b/arch/arm/dts/exynos5250-spring.dts index 7270a546a795..9c478837ba44 100644 --- a/arch/arm/dts/exynos5250-spring.dts +++ b/arch/arm/dts/exynos5250-spring.dts @@ -103,12 +103,9 @@ }; mmc@12200000 { - samsung,bus-width = <8>; bus-width = <8>; - samsung,timing = <1 3 3>; samsung,dw-mshc-ciu-div = <3>; samsung,dw-mshc-sdr-timing = <1 3>; - samsung,removable = <0>; non-removable; }; diff --git a/arch/arm/dts/exynos5420-smdk5420.dts b/arch/arm/dts/exynos5420-smdk5420.dts index 1f27baafebaf..6ba1306e862a 100644 --- a/arch/arm/dts/exynos5420-smdk5420.dts +++ b/arch/arm/dts/exynos5420-smdk5420.dts @@ -106,12 +106,9 @@ }; mmc@12200000 { - samsung,bus-width = <8>; bus-width = <8>; - samsung,timing = <1 3 3>; samsung,dw-mshc-ciu-div = <3>; samsung,dw-mshc-sdr-timing = <1 3>; - samsung,removable = <0>; non-removable; samsung,pre-init; }; @@ -121,12 +118,9 @@ }; mmc@12220000 { - samsung,bus-width = <4>; bus-width = <4>; - samsung,timing = <1 2 3>; samsung,dw-mshc-ciu-div = <3>; samsung,dw-mshc-sdr-timing = <1 2>; - samsung,removable = <1>; }; mmc@12230000 { diff --git a/arch/arm/dts/exynos5422-odroidxu3.dts b/arch/arm/dts/exynos5422-odroidxu3.dts index 767b3e415d58..ef25cf774470 100644 --- a/arch/arm/dts/exynos5422-odroidxu3.dts +++ b/arch/arm/dts/exynos5422-odroidxu3.dts @@ -280,12 +280,10 @@ }; mmc@12200000 { - fifoth_val = <0x201f0020>; fifo-depth = <0x40>; }; mmc@12220000 { - fifoth_val = <0x201f0020>; fifo-depth = <0x40>; }; diff --git a/arch/arm/dts/exynos54xx.dtsi b/arch/arm/dts/exynos54xx.dtsi index fd74166c7e48..5915ed697791 100644 --- a/arch/arm/dts/exynos54xx.dtsi +++ b/arch/arm/dts/exynos54xx.dtsi @@ -119,12 +119,9 @@ }; mmc@12200000 { - samsung,bus-width = <8>; bus-width = <8>; - samsung,timing = <1 3 3>; samsung,dw-mshc-ciu-div = <3>; samsung,dw-mshc-sdr-timing = <1 3>; - samsung,removable = <0>; non-removable; samsung,pre-init; }; @@ -134,12 +131,9 @@ }; mmc@12220000 { - samsung,bus-width = <4>; bus-width = <4>; - samsung,timing = <1 2 3>; samsung,dw-mshc-ciu-div = <3>; samsung,dw-mshc-sdr-timing = <1 2>; - samsung,removable = <1>; }; mmc@12230000 { From patchwork Thu Aug 8 03:14:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817700 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp676145wrt; Wed, 7 Aug 2024 20:21:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU0ZOYY7VbNyxE/Q2flO2PeA0ug0as2+f3j1peHVebszClPKoFS4+RJlYK5zjhJdEyOO5JHGb9UOqrrrn8mqdH7 X-Google-Smtp-Source: AGHT+IHkksMSp8OZYUcKhyE3K3t6dZ/d2zZGv9ImpYrxcW7OCKaahbYnoTYSrXWJ35wdUa7EcWYa X-Received: by 2002:a05:6402:11cf:b0:58b:fd23:7065 with SMTP id 4fb4d7f45d1cf-5bbb2231626mr367001a12.16.1723087281301; Wed, 07 Aug 2024 20:21:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087281; cv=none; d=google.com; s=arc-20160816; b=Y9KygKAeCLqfi1kTspfjpxN1nWeKYHd+AizR2tCO+nIlj3stgNhLgGi/8UtuFufr0X OY0TuZIxFz7v5DyhdYBw357ey+lNwGSQEKU4fp+2ixgRbyl2jHOKFSCvF39YieIcjicA Ju0bewgyST69l2nbDPQiZtho0KQZH/QIW6OQkgdSJszsePztC8K/YRns6+N/8wjndqy4 d/hXaQ8+QbygQRO0YFxaJUYnRd3eLPKAG9Zr7C4m+yETsq59qgycaZqEpAK+w0bNb7hO 4ISegV8VF00zQ5XqYre3Ym1sWwXQ3nVHq4bgUVJZcw1lborjg0rg9cjRktX4bApJCnBF mXiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fjQQOetGXVK+xtU2b2bn038bOzbhgIt6wK4s+tVCTKw=; fh=wdW/gz/h50PpVim2ViVW8W9EKNKACecebKN/Z62kQik=; b=tUTHY3lvp9RncL385ZQ6SWocVkqDHCLkQPi1vkO0T2EBt4zG1Dn5N7GzTHf02PRjjK O64nBH/M+svpXg9rjnT7slT9lKySFUwcu7419N/Vhjt3vGr4WJRIak749oytCjIRtxmS U/Jvf3a4ShZgTPmKyk8DyXmbocL8Z7Z88vscICLNKV5GkHHi6/sT1xLvq3LbxCshdfhe x1oCfqx6isIWFIChsaylfQOMdimdb7MKJ8Vsce9xjpjIPhk0hk4nTBRfh3JaFw9jiXt+ iYFOPjbvyQGbS0Pn0eCwHjKw2T6lGJNcKnAjVnNHMMVRb4xpTSROu/Mz25duOJ8IvTFp aGNQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pa+RVdUn; 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-5bbb2e700a1si246295a12.636.2024.08.07.20.21.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:21:21 -0700 (PDT) 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=Pa+RVdUn; 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 9CC7788B81; Thu, 8 Aug 2024 05:15:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Pa+RVdUn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 26E3588C25; Thu, 8 Aug 2024 05:15:22 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) (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 C943988C28 for ; Thu, 8 Aug 2024 05:15:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3db18842a4dso792529b6e.0 for ; Wed, 07 Aug 2024 20:15:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086912; x=1723691712; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fjQQOetGXVK+xtU2b2bn038bOzbhgIt6wK4s+tVCTKw=; b=Pa+RVdUnX/IC2ww49F2ag3KR9ZO1uZXV2cXd8hf3jDGqgAlP7J0UCHxnpWsqykIvQH Zb4MXJctv135zdqWTEwAko0zaUs7h4cqUHx4XYvvji5wUyMaWZuxKEvAMTrrC9Eqxw+C 3u7nw3FkBW+TRfJ2sNpJb11XqSJHpU3bJ0Dazg3o5uvNipJv+8wmWd9lWToUzxEcuq3g 6ofFI+z8i5VUhkueB63PEsezY1TfrUrLJA7rtBiTMw2DWCnlyFZbGy0vgrZueDwDXzvt HCBQnvprIba5o77UPHjhpx0IS1rS14KC28JOi3JVBz3licfKqLOpOoGwFVok9+oh2uWX l8Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086912; x=1723691712; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fjQQOetGXVK+xtU2b2bn038bOzbhgIt6wK4s+tVCTKw=; b=eesYJJnvf2gBrBK3Og3HzAK2P+jcwKt9Tk5/Jvc5/AqMd/hkQpPwGdfJcMSHv+CUMK mdYH2cTa8su9lxdRndUHuABSQvaZTo8wTvRWmyvpHu4AJXe/k5OslrBVyDIr6UfmYn97 VN3LpeqoQOdAy/hRe8/YVZJPdJNJ1jTJokadNgdYJY4mUXloPeVowA9NuYCVdkxENQ7i BqzJcDE/0u/77WqzDbcCIC8ZR0kqeK1meb4ffLCX41Z/7sfnpmTiTKDBqjBduJgSzws3 7wVygK0mO3DcXKwhCPsoG89VCbVK3J+tWcMeyH2awhoqAAzdEV88/TJeQ1xcybBrqP5j cOpQ== X-Forwarded-Encrypted: i=1; AJvYcCVMpNpHz/6KGVyfxDaCSWYGipIWnZ9a264gi57Jni5zuF/jz9gSHI2mWytlPYLeXF2On1bM1D+uHUfyLT0WAMv0Fd8VgA== X-Gm-Message-State: AOJu0Yzgwlf1ROa3pjIQZG2pi49fMRc2stCx8j6/DvDh+Sq9+JX+TuJj 5GaydNQ9opRANiye9fMt+nREIC7TYjYC202rztuHv36MKWgBo6Qd+Dncyhj8ovk= X-Received: by 2002:a54:4399:0:b0:3d9:3427:56b9 with SMTP id 5614622812f47-3dc3c160e9bmr95965b6e.4.1723086912580; Wed, 07 Aug 2024 20:15:12 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3db563618e4sm4600169b6e.2.2024.08.07.20.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:12 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 37/38] configs: e850-96: Enable MMC Date: Wed, 7 Aug 2024 22:14:43 -0500 Message-Id: <20240808031444.9619-38-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 Enable MMC subsystem and DW MMC driver support to make eMMC functional. Also enable a couple of related commands so the user can make use of eMMC from U-Boot shell. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - Rebased on top of the most recent master Changes in v3: - (none) Changes in v2: - (none) configs/e850-96_defconfig | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/configs/e850-96_defconfig b/configs/e850-96_defconfig index 2949da24267f..e5d90996234e 100644 --- a/configs/e850-96_defconfig +++ b/configs/e850-96_defconfig @@ -9,12 +9,20 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xf8c00000 CONFIG_DEFAULT_DEVICE_TREE="exynos/exynos850-e850-96" CONFIG_SYS_LOAD_ADDR=0x80000000 +CONFIG_ANDROID_BOOT_IMAGE=y # CONFIG_AUTOBOOT is not set # CONFIG_DISPLAY_CPUINFO is not set +CONFIG_HUSH_PARSER=y +CONFIG_CMD_ABOOTIMG=y +CONFIG_CMD_CLK=y +CONFIG_CMD_GPT=y +CONFIG_CMD_MMC=y +CONFIG_CMD_PART=y +CONFIG_CMD_TIME=y CONFIG_CMD_RNG=y # CONFIG_NET is not set CONFIG_CLK_EXYNOS850=y -# CONFIG_MMC is not set +CONFIG_MMC_DW=y CONFIG_SOC_SAMSUNG=y CONFIG_EXYNOS_PMU=y CONFIG_EXYNOS_USI=y From patchwork Thu Aug 8 03:14:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817702 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp676235wrt; Wed, 7 Aug 2024 20:21:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVcCfufn9+jE9flfh9O7WHZCKt40OFCtQ0BcdS9Gxij0U5dbXynfcfI9Jh/ibVrip/1TQak2zbZnLQf35HUWiGe X-Google-Smtp-Source: AGHT+IGJ6ybZ+6OS94LPUljAgemyxicvdJFG+iCd42gqJVqqtVXX+1eeVRGvZepRnZvxRH9qxzLm X-Received: by 2002:a17:907:e6cd:b0:a7a:9f0f:ab26 with SMTP id a640c23a62f3a-a8090c6f0b2mr30883866b.23.1723087301383; Wed, 07 Aug 2024 20:21:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723087301; cv=none; d=google.com; s=arc-20160816; b=snwcc+h87xikjUTPIdPXGvGBTRwuDcPtPKaA0+LcPylLGropcv9TMVZ3IBqMea425w cF8c1dmOPPPhFQTf04wO4PV62Lu1JU3fA0p8bQIOtl0xL1QFSTi5EBNd5VNCjscpkZNS Nn/1duhdX4L+qZWL5dlV1ygZ2U+5PIgDx3vh66B9bYqz6sRpd/QQPrI2y1x3M4KIzapL 9V1UVspQzirKw99lFfL25vfjJgHislY5aXcQkhiVSPs19QGGA+5xBUYybXqLnIJBPsAo UfE1gDTpR27pzYLxz1E7mvqCeT4npJxCCVPp89kXjIjYaSJHFrESGxIzli4n5ORToa35 3/JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Lz6mHLXj+4xDB7VMFsWWY5w7o85P1WrFzOMBrWDtyfI=; fh=S2sMEPPDDggvT28cvRfUo36LLv52Xam+MJEQ4LXx9kg=; b=o1UigIxeVTg1k1ZApWWYn1IOK/i3zuIkyZ5YBaZs99YPxtP8CjsUVQibyXoUbgq/7I pKt09lZg6qrR6rm1qjcQyAckJ+idd3B7OSBN+kcOWAsVghasEW6creVkwCBIJntmhnyJ sUkGRFEnO6bRSTVcmLa5qWQSwxxDY57zT6qKHHI5q6I9ZZoPg4Qm1IUI4fortytj6o51 +RY9JMqMGGpjsTvUOmMzsbYAr1PBcUwJRKlKWUFxuU7Ryq2HwUseByH9QsXXFrFK3l4E 1X5EmIrT3fLKxcx1n4g5pCRUta0HdcLSG1uLKlrKTe3g4Z89c+bi9E+xn8i9+MmDGNQ9 /qSw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ph7uiruL; 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-a7dc9f2b054si754622366b.808.2024.08.07.20.21.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:21:41 -0700 (PDT) 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=ph7uiruL; 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 72D9688C4E; Thu, 8 Aug 2024 05:15:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ph7uiruL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 59AF988C26; Thu, 8 Aug 2024 05:15:22 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oa1-x2f.google.com (mail-oa1-x2f.google.com [IPv6:2001:4860:4864:20::2f]) (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 C692188C27 for ; Thu, 8 Aug 2024 05:15:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-260f94067bcso301654fac.3 for ; Wed, 07 Aug 2024 20:15:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086913; x=1723691713; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Lz6mHLXj+4xDB7VMFsWWY5w7o85P1WrFzOMBrWDtyfI=; b=ph7uiruLQdHm/XGlDbVHAfVp0ks3FIS1xWJLYZIj5LFDB1ffeHHHZePZRovodXzZro 6qT28C+xoE4t7JP3VMpWfpZQC/FsF+JtsQC18yrHa1snWr3NGugFzkHRYfAXt/tUpKZZ lPab0UsdyPO5pF02vRSEaR9c05QI6YmfF238acUgYPI5LBIwDmZ40NrwolaaPe3WgGKf 6kb3ga7yS2lqP736m/owNTk2aN2k/0H9a0iD4qte+1/gRZ30FwpGPTi0h31TznwHsuT6 nHwO+/pJ9UCOmRLivhCFdHI7XwtKRc2weePn7kSVuXpnJ4h7a2AMoOfnb+uaMbM+noX/ ahog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086913; x=1723691713; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Lz6mHLXj+4xDB7VMFsWWY5w7o85P1WrFzOMBrWDtyfI=; b=qHqV642mfwEC3S9gxbC5uF3K52NuHUSMjfMqPbJiP2nvbwy7clxgItWxtJFazEDBMJ R9F5EQTrjbLrq3yRYPj+Yicz8g0MQZ9yeoCiM6gwbG+NfrxuDPmcPYbDM1QgHrfUNNHb NffwtmKRgQJwwA8hmiCUX9OCAxm/YllYhT9XmQMdEHXj0Y6zxlDGpD5+u7WvrJaN5H8O SJagAt8aTouR2OJn8Gu/523xLn1KP36DaQ4I6k2S0TsXnvyXhmRC8IS3Es3tnQoJzMbQ /Xr9poiRfkHgAuk9aZ2ih0RSbVoT/DGKHpxzieQi1KHY2X2Pd9YAOH/kRdgB8eA2rE+0 IFsw== X-Forwarded-Encrypted: i=1; AJvYcCURfRby/MQ9yI33gkTvY4KQpiCuU60VJ5N2hh4NP0k3xsGfawyzg5yjXYS1uQdJ22yFBgJvG34L7tJHf84urOUp/8yAKA== X-Gm-Message-State: AOJu0YxTVSUwFYvWGujvTckvQpLHp0htj8PLNAOw3mVFP27aFxKvAKcX zQIwxxgq/d66ecBuDnwIbfbF0CFra8LC0nI9h4DVgraQYM/L4eQjAq+2Rp7VeLk= X-Received: by 2002:a05:6870:d293:b0:261:16da:ded9 with SMTP id 586e51a60fabf-2692b61a3f5mr811353fac.6.1723086913347; Wed, 07 Aug 2024 20:15:13 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2689a2f2269sm4360057fac.14.2024.08.07.20.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:13 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , Simon Glass , Quentin Schulz , Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH v5 38/38] doc: samsung: Mention enabled eMMC in E850-96 board doc Date: Wed, 7 Aug 2024 22:14:44 -0500 Message-Id: <20240808031444.9619-39-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-1-semen.protsenko@linaro.org> MIME-Version: 1.0 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 eMMC is enabled on E850-96 board now. Mention that in the board documentation. Signed-off-by: Sam Protsenko --- Changes in v5: - (none) Changes in v4: - (none) Changes in v3: - (none) Changes in v2: - (none) doc/board/samsung/e850-96.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/board/samsung/e850-96.rst b/doc/board/samsung/e850-96.rst index 0cb95473e536..0a7b6fc0c9dd 100644 --- a/doc/board/samsung/e850-96.rst +++ b/doc/board/samsung/e850-96.rst @@ -47,12 +47,13 @@ Build Procedure --------------- .. warning:: - At the moment both eMMC and USB features are not enabled in U-Boot. Flashing + At the moment USB is not enabled in U-Boot for this board. Although eMMC is + enabled, you won't be able to flash images over USB (fastboot). So flashing U-Boot binary **WILL** effectively brick your board. The ``dltool`` [8]_ can be used then to perform USB boot and flash LittleKernel bootloader binary [7]_ to unbrick and revive the board. Flashing U-Boot binary might be helpful for developers or anybody who want to check current state of U-Boot enablement on - E850-96 (which is mostly serial console and related blocks). + E850-96 (which is mostly serial console, eMMC and related blocks). Build U-Boot binary from source code (using AArch64 baremetal GCC toolchain):